Skip to content

Commit

Permalink
Call GetDocsMsDevLanguageSpecificPackageInfoFn if it's defined (#34943)
Browse files Browse the repository at this point in the history
Co-authored-by: James Suplizio <[email protected]>
  • Loading branch information
azure-sdk and JimSuplizio authored Mar 26, 2024
1 parent ec78666 commit bea2d61
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions eng/common/scripts/Update-DocsMsMetadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 `
Expand All @@ -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
}
Expand All @@ -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"
}

0 comments on commit bea2d61

Please sign in to comment.