From bea2d617ad3009d8d9bd68a5dedfebb5dee89380 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 26 Mar 2024 15:50:40 -0400 Subject: [PATCH] Call GetDocsMsDevLanguageSpecificPackageInfoFn if it's defined (#34943) Co-authored-by: James Suplizio --- eng/common/scripts/Update-DocsMsMetadata.ps1 | 23 ++++++++------------ 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/eng/common/scripts/Update-DocsMsMetadata.ps1 b/eng/common/scripts/Update-DocsMsMetadata.ps1 index 817407f4bc18..8b7b777d503c 100644 --- a/eng/common/scripts/Update-DocsMsMetadata.ps1 +++ b/eng/common/scripts/Update-DocsMsMetadata.ps1 @@ -111,18 +111,13 @@ function GetPackageInfoJson ($packageInfoJsonLocation) { $packageInfoJson = Get-Content $packageInfoJsonLocation -Raw $packageInfo = ConvertFrom-Json $packageInfoJson + if ($GetDocsMsDevLanguageSpecificPackageInfoFn -and (Test-Path "Function:$GetDocsMsDevLanguageSpecificPackageInfoFn")) { + $packageInfo = &$GetDocsMsDevLanguageSpecificPackageInfoFn $packageInfo $PackageSourceOverride + } + # Default: use the dev version from package info as the version for + # downstream processes if ($packageInfo.DevVersion) { - # If the package is of a dev version there may be language-specific needs to - # specify the appropriate version. For example, in the case of JS, the dev - # version is always 'dev' when interacting with NPM. - if ($GetDocsMsDevLanguageSpecificPackageInfoFn -and (Test-Path "Function:$GetDocsMsDevLanguageSpecificPackageInfoFn")) { - $packageInfo = &$GetDocsMsDevLanguageSpecificPackageInfoFn $packageInfo - } - else { - # Default: use the dev version from package info as the version for - # downstream processes - $packageInfo.Version = $packageInfo.DevVersion - } + $packageInfo.Version = $packageInfo.DevVersion } return $packageInfo } @@ -202,7 +197,7 @@ foreach ($packageInfoLocation in $PackageInfoJsonLocations) { Write-Host "Validating the packages..." $packageInfo = GetPackageInfoJson $packageInfoLocation - # This calls a function named "Validate-${Language}-DocMsPackages" + # This calls a function named "Validate-${Language}-DocMsPackages" # declared in common.ps1, implemented in Language-Settings.ps1 $isValid = &$ValidateDocsMsPackagesFn ` -PackageInfos $packageInfo ` @@ -214,7 +209,7 @@ foreach ($packageInfoLocation in $PackageInfoJsonLocations) { Write-Host "Package validation failed for package: $packageInfoLocation" $allSucceeded = $false - # Skip the later call to UpdateDocsMsMetadataForPackage because this + # Skip the later call to UpdateDocsMsMetadataForPackage because this # package has not passed validation continue } @@ -229,6 +224,6 @@ foreach ($packageInfoLocation in $PackageInfoJsonLocations) { # any packages failed validation if ($allSucceeded) { Write-Host "##vso[task.setvariable variable=DocsMsPackagesAllValid;]$true" -} else { +} else { Write-Host "##vso[task.setvariable variable=DocsMsPackagesAllValid;]$false" }