Skip to content

Commit f998105

Browse files
authored
Fix validation output and check the proposed updated version of the package (Azure#23705)
* Fix the issue where ValidatePackage outputs a true-ish value before the function's result * Use a different branch * Validate the incoming version, not the existing verison of the package * Revert "Use a different branch" This reverts commit f6956e7. * Use only one `ValidatePackage` * Use correct variable naming in the case of new packages
1 parent ce0be9b commit f998105

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

eng/scripts/Language-Settings.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,13 @@ function PackageDependenciesResolve($artifactNamePrefix, $packageDirectory) {
335335
return $true
336336
}
337337

338-
function ValidatePackage($package, $workingDirectory) {
339-
$artifactNamePrefix = "$($package.packageGroupId):$($package.packageArtifactId):$($package.packageVersion)"
338+
function ValidatePackage($groupId, $artifactId, $version, $workingDirectory) {
339+
$artifactNamePrefix = "${groupId}:${artifactId}:${version}"
340340

341341
$packageDirectory = Join-Path `
342342
$workingDirectory `
343-
"$($package.packageGroupId)__$($package.packageArtifactId)__$($package.packageVersion)"
344-
New-Item -ItemType Directory -Path $packageDirectory -Force
343+
"${groupId}__${artifactId}__${version}"
344+
New-Item -ItemType Directory -Path $packageDirectory -Force | Out-Null
345345

346346
return (SourcePackageHasComFolder $artifactNamePrefix $packageDirectory) `
347347
-and (PackageDependenciesResolve $artifactNamePrefix $packageDirectory)
@@ -438,7 +438,7 @@ function UpdateDocsMsPackages($DocConfigFile, $Mode, $DocsMetadata) {
438438
# If upgrading the package, run basic sanity checks against the package
439439
if ($package.packageVersion -ne $packageVersion) {
440440
Write-Host "Validating new version detected for $packageName ($packageVersion)"
441-
$validatePackageResult = ValidatePackage $package $workingDirectory
441+
$validatePackageResult = ValidatePackage $package.packageGroupId $package.packageArtifactId $packageVersion $workingDirectory
442442

443443
if (!$validatePackageResult) {
444444
LogWarning "Package is not valid: $packageName. Keeping old version."
@@ -479,7 +479,7 @@ function UpdateDocsMsPackages($DocConfigFile, $Mode, $DocsMetadata) {
479479
}
480480

481481
Write-Host "Validating new package $($packageGroupId):$($packageName):$($packageVersion)"
482-
$validatePackageResult = ValidatePackage $package $workingDirectory
482+
$validatePackageResult = ValidatePackage $packageGroupId $packageName $packageVersion $workingDirectory
483483
if (!$validatePackageResult) {
484484
LogWarning "Package is not valid: ${packageGroupId}:$packageName. Cannot onboard."
485485
continue

0 commit comments

Comments
 (0)