From a65df8475cae3a339c9af0d2afc651caae456e45 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Wed, 19 Jul 2023 21:05:34 -0700 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 6544 (#4808) * Only save package properties for track 2 packages (prevents overwrites of track 2 package info by track 1 packages) * Only overwrite if the package is track 2 --------- Co-authored-by: Daniel Jurek --- eng/common/scripts/Save-Package-Properties.ps1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/eng/common/scripts/Save-Package-Properties.ps1 b/eng/common/scripts/Save-Package-Properties.ps1 index 6fb9e61ee..44f622357 100644 --- a/eng/common/scripts/Save-Package-Properties.ps1 +++ b/eng/common/scripts/Save-Package-Properties.ps1 @@ -10,6 +10,10 @@ an artifact name property is available in the package properties. Can optionally add a dev version property which can be used logic for daily builds. +In cases of collisions where track 2 packages (IsNewSdk = true) have the same +filename as track 1 packages (e.g. same artifact name or package name), the +track 2 package properties will be written. + .PARAMETER serviceDirectory Service directory in which to search for packages @@ -87,6 +91,7 @@ function GetRelativePath($path) { return $relativePath } +$exportedPaths = @{} $allPackageProperties = Get-AllPkgProperties $serviceDirectory if ($allPackageProperties) { @@ -114,6 +119,15 @@ if ($allPackageProperties) Write-Host "Creating directory $($outDir) for json property file" New-Item -ItemType Directory -Path $outDir } + + # If package properties for a track 2 (IsNewSdk = true) package has + # already been written, skip writing to that same path. + if ($exportedPaths.ContainsKey($outputPath) -and $exportedPaths[$outputPath].IsNewSdk -eq $true) { + Write-Host "Track 2 package info with file name $($outputPath) already exported. Skipping export." + continue + } + $exportedPaths[$outputPath] = $pkg + SetOutput $outputPath $pkg }