Skip to content

Commit bea2d61

Browse files
Call GetDocsMsDevLanguageSpecificPackageInfoFn if it's defined (#34943)
Co-authored-by: James Suplizio <[email protected]>
1 parent ec78666 commit bea2d61

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

eng/common/scripts/Update-DocsMsMetadata.ps1

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,13 @@ function GetPackageInfoJson ($packageInfoJsonLocation) {
111111

112112
$packageInfoJson = Get-Content $packageInfoJsonLocation -Raw
113113
$packageInfo = ConvertFrom-Json $packageInfoJson
114+
if ($GetDocsMsDevLanguageSpecificPackageInfoFn -and (Test-Path "Function:$GetDocsMsDevLanguageSpecificPackageInfoFn")) {
115+
$packageInfo = &$GetDocsMsDevLanguageSpecificPackageInfoFn $packageInfo $PackageSourceOverride
116+
}
117+
# Default: use the dev version from package info as the version for
118+
# downstream processes
114119
if ($packageInfo.DevVersion) {
115-
# If the package is of a dev version there may be language-specific needs to
116-
# specify the appropriate version. For example, in the case of JS, the dev
117-
# version is always 'dev' when interacting with NPM.
118-
if ($GetDocsMsDevLanguageSpecificPackageInfoFn -and (Test-Path "Function:$GetDocsMsDevLanguageSpecificPackageInfoFn")) {
119-
$packageInfo = &$GetDocsMsDevLanguageSpecificPackageInfoFn $packageInfo
120-
}
121-
else {
122-
# Default: use the dev version from package info as the version for
123-
# downstream processes
124-
$packageInfo.Version = $packageInfo.DevVersion
125-
}
120+
$packageInfo.Version = $packageInfo.DevVersion
126121
}
127122
return $packageInfo
128123
}
@@ -202,7 +197,7 @@ foreach ($packageInfoLocation in $PackageInfoJsonLocations) {
202197
Write-Host "Validating the packages..."
203198

204199
$packageInfo = GetPackageInfoJson $packageInfoLocation
205-
# This calls a function named "Validate-${Language}-DocMsPackages"
200+
# This calls a function named "Validate-${Language}-DocMsPackages"
206201
# declared in common.ps1, implemented in Language-Settings.ps1
207202
$isValid = &$ValidateDocsMsPackagesFn `
208203
-PackageInfos $packageInfo `
@@ -214,7 +209,7 @@ foreach ($packageInfoLocation in $PackageInfoJsonLocations) {
214209
Write-Host "Package validation failed for package: $packageInfoLocation"
215210
$allSucceeded = $false
216211

217-
# Skip the later call to UpdateDocsMsMetadataForPackage because this
212+
# Skip the later call to UpdateDocsMsMetadataForPackage because this
218213
# package has not passed validation
219214
continue
220215
}
@@ -229,6 +224,6 @@ foreach ($packageInfoLocation in $PackageInfoJsonLocations) {
229224
# any packages failed validation
230225
if ($allSucceeded) {
231226
Write-Host "##vso[task.setvariable variable=DocsMsPackagesAllValid;]$true"
232-
} else {
227+
} else {
233228
Write-Host "##vso[task.setvariable variable=DocsMsPackagesAllValid;]$false"
234229
}

0 commit comments

Comments
 (0)