From 10637cf558b43205f28068504cd7b9b5dca2cace Mon Sep 17 00:00:00 2001 From: sima-zhu Date: Thu, 15 Dec 2022 16:21:23 -0800 Subject: [PATCH 1/8] Give the csv flexibility to onboard not new package to Docs.Ms --- eng/common/scripts/Update-DocsMsPackages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/Update-DocsMsPackages.ps1 b/eng/common/scripts/Update-DocsMsPackages.ps1 index ab7f54dcea25d..ccd531d3bd402 100644 --- a/eng/common/scripts/Update-DocsMsPackages.ps1 +++ b/eng/common/scripts/Update-DocsMsPackages.ps1 @@ -80,7 +80,7 @@ function GetDocsMetadataForMoniker($moniker) { } function GetDocsMetadata() { # Read metadata from CSV - $csvMetadata = (Get-CSVMetadata).Where({ $_.New -eq 'true' -and $_.Hide -ne 'true' }) + $csvMetadata = (Get-CSVMetadata).Where({ ($_.New -eq 'true' -or $_.MSDocService -ne '') -and $_.Hide -ne 'true'}) # Read metadata from docs repo $metadataByPackage = @{} From c1a288e151d1e43fde5f334402e01eba46e23d91 Mon Sep 17 00:00:00 2001 From: sima-zhu Date: Fri, 16 Dec 2022 10:41:39 -0800 Subject: [PATCH 2/8] Use placeholder if the accurate msservice not decided yet --- eng/common/scripts/Update-DocsMsMetadata.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/Update-DocsMsMetadata.ps1 b/eng/common/scripts/Update-DocsMsMetadata.ps1 index b6b696758acb9..c51dc11851c0d 100644 --- a/eng/common/scripts/Update-DocsMsMetadata.ps1 +++ b/eng/common/scripts/Update-DocsMsMetadata.ps1 @@ -81,7 +81,7 @@ function GetAdjustedReadmeContent($ReadmeContent, $PackageInfo, $PackageMetadata # The $PackageMetadata could be $null if there is no associated metadata entry # based on how the metadata CSV is filtered $service = $PackageInfo.ServiceDirectory.ToLower() - if ($PackageMetadata -and $PackageMetadata.MSDocService) { + if ($PackageMetadata -and $PackageMetadata.MSDocService -and 'placeholder' -ine $PackageMetadata.MSDocService) { # Use MSDocService in csv metadata to override the service directory # TODO: Use taxonomy for service name -- https://github.com/Azure/azure-sdk-tools/issues/1442 $service = $PackageMetadata.MSDocService From 666e088bedc043437257bd95dbe1a6d2e7cb8823 Mon Sep 17 00:00:00 2001 From: sima-zhu Date: Fri, 16 Dec 2022 11:12:42 -0800 Subject: [PATCH 3/8] add deprecated message to display name --- eng/common/scripts/Helpers/Package-Helpers.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/eng/common/scripts/Helpers/Package-Helpers.ps1 b/eng/common/scripts/Helpers/Package-Helpers.ps1 index 15a1f2ea8d463..dc467a0ad9f9b 100644 --- a/eng/common/scripts/Helpers/Package-Helpers.ps1 +++ b/eng/common/scripts/Helpers/Package-Helpers.ps1 @@ -35,3 +35,12 @@ function GetPackageKey($pkg) { } return $packageLookup } + + fucntion GetDocsTocDisplayName($pkg) { + $displayName = $pkg.DisplayName + if ('deprecated' -eq $pkg.Support) { + LogWarning "The pkg $($pkg.Package) is deprecated. Add 'deprecated' besides of display name." + $diaplayName += " (deprecated)" + } + return $displayName + } \ No newline at end of file From bd5ce4e84d4cb6f4b1f264786ecd0d44ab636eec Mon Sep 17 00:00:00 2001 From: sima-zhu Date: Fri, 16 Dec 2022 11:14:02 -0800 Subject: [PATCH 4/8] reformat --- .../scripts/Helpers/Package-Helpers.ps1 | 79 ++++++++++--------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/eng/common/scripts/Helpers/Package-Helpers.ps1 b/eng/common/scripts/Helpers/Package-Helpers.ps1 index dc467a0ad9f9b..5a734c67d5c8c 100644 --- a/eng/common/scripts/Helpers/Package-Helpers.ps1 +++ b/eng/common/scripts/Helpers/Package-Helpers.ps1 @@ -1,46 +1,47 @@ function GetPackageKey($pkg) { - $pkgKey = $pkg.Package - $groupId = $null - - if ($pkg.PSObject.Members.Name -contains "GroupId") { - $groupId = $pkg.GroupId - } - - if ($groupId) { - $pkgKey = "${groupId}:${pkgKey}" - } - - return $pkgKey + $pkgKey = $pkg.Package + $groupId = $null + + if ($pkg.PSObject.Members.Name -contains "GroupId") { + $groupId = $pkg.GroupId } + + if ($groupId) { + $pkgKey = "${groupId}:${pkgKey}" + } + + return $pkgKey +} - # Different language needs a different way to index the package. Build a map in convienice to lookup the package. - # E.g. : is the package key in java. - function GetPackageLookup($packageList) { - $packageLookup = @{} - - foreach ($pkg in $packageList) { - $pkgKey = GetPackageKey $pkg - - # We want to prefer updating non-hidden packages but if there is only - # a hidden entry then we will return that - if (!$packageLookup.ContainsKey($pkgKey) -or $packageLookup[$pkgKey].Hide -eq "true") { - $packageLookup[$pkgKey] = $pkg - } - else { - # Warn if there are more then one non-hidden package - if ($pkg.Hide -ne "true") { - Write-Host "Found more than one package entry for $($pkg.Package) selecting the first non-hidden one." - } +# Different language needs a different way to index the package. Build a map in convienice to lookup the package. +# E.g. : is the package key in java. +function GetPackageLookup($packageList) { + $packageLookup = @{} + + foreach ($pkg in $packageList) { + $pkgKey = GetPackageKey $pkg + + # We want to prefer updating non-hidden packages but if there is only + # a hidden entry then we will return that + if (!$packageLookup.ContainsKey($pkgKey) -or $packageLookup[$pkgKey].Hide -eq "true") { + $packageLookup[$pkgKey] = $pkg + } + else { + # Warn if there are more then one non-hidden package + if ($pkg.Hide -ne "true") { + Write-Host "Found more than one package entry for $($pkg.Package) selecting the first non-hidden one." } } - return $packageLookup } + return $packageLookup +} - fucntion GetDocsTocDisplayName($pkg) { - $displayName = $pkg.DisplayName - if ('deprecated' -eq $pkg.Support) { - LogWarning "The pkg $($pkg.Package) is deprecated. Add 'deprecated' besides of display name." - $diaplayName += " (deprecated)" - } - return $displayName - } \ No newline at end of file +# For deprecated packages, add "(deprecated)" besides of display name. +fucntion GetDocsTocDisplayName($pkg) { + $displayName = $pkg.DisplayName + if ('deprecated' -eq $pkg.Support) { + LogWarning "The pkg $($pkg.Package) is deprecated. Add 'deprecated' besides of display name." + $diaplayName += " (deprecated)" + } + return $displayName +} \ No newline at end of file From 62202101bfb5e0c4168a5c1493151a1533e69139 Mon Sep 17 00:00:00 2001 From: sima-zhu Date: Fri, 16 Dec 2022 11:59:20 -0800 Subject: [PATCH 5/8] typo --- eng/common/scripts/Helpers/Package-Helpers.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/Helpers/Package-Helpers.ps1 b/eng/common/scripts/Helpers/Package-Helpers.ps1 index 5a734c67d5c8c..325dc4e482550 100644 --- a/eng/common/scripts/Helpers/Package-Helpers.ps1 +++ b/eng/common/scripts/Helpers/Package-Helpers.ps1 @@ -37,7 +37,7 @@ function GetPackageLookup($packageList) { } # For deprecated packages, add "(deprecated)" besides of display name. -fucntion GetDocsTocDisplayName($pkg) { +function GetDocsTocDisplayName($pkg) { $displayName = $pkg.DisplayName if ('deprecated' -eq $pkg.Support) { LogWarning "The pkg $($pkg.Package) is deprecated. Add 'deprecated' besides of display name." From a7f242f144009d62eed627f1b12a7f6fa64b03b0 Mon Sep 17 00:00:00 2001 From: sima-zhu Date: Fri, 16 Dec 2022 12:22:31 -0800 Subject: [PATCH 6/8] Add package helper to common --- eng/common/scripts/common.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/common/scripts/common.ps1 b/eng/common/scripts/common.ps1 index 1b77491fd374c..c78b1cfc2f1f0 100644 --- a/eng/common/scripts/common.ps1 +++ b/eng/common/scripts/common.ps1 @@ -15,6 +15,7 @@ $EngScriptsDir = Join-Path $EngDir "scripts" . (Join-Path $EngCommonScriptsDir Invoke-DevOpsAPI.ps1) . (Join-Path $EngCommonScriptsDir artifact-metadata-parsing.ps1) . (Join-Path $EngCommonScriptsDir "Helpers" git-helpers.ps1) +. (Join-Path $EngCommonScriptsDir "Helpers" Package-Helpers.ps1) # Setting expected from common languages settings $Language = "Unknown" From d0e96aaedb80bc471e9d9a6c260410155975e6a2 Mon Sep 17 00:00:00 2001 From: sima-zhu Date: Fri, 16 Dec 2022 14:45:30 -0800 Subject: [PATCH 7/8] typo again --- eng/common/scripts/Helpers/Package-Helpers.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/Helpers/Package-Helpers.ps1 b/eng/common/scripts/Helpers/Package-Helpers.ps1 index 325dc4e482550..19bfe45c3cda8 100644 --- a/eng/common/scripts/Helpers/Package-Helpers.ps1 +++ b/eng/common/scripts/Helpers/Package-Helpers.ps1 @@ -41,7 +41,7 @@ function GetDocsTocDisplayName($pkg) { $displayName = $pkg.DisplayName if ('deprecated' -eq $pkg.Support) { LogWarning "The pkg $($pkg.Package) is deprecated. Add 'deprecated' besides of display name." - $diaplayName += " (deprecated)" + $displayName += " (deprecated)" } return $displayName } \ No newline at end of file From 39645716f72f885fe5bc9aa191549cc19b9f4768 Mon Sep 17 00:00:00 2001 From: Sima Zhu <48036328+sima-zhu@users.noreply.github.com> Date: Wed, 21 Dec 2022 09:09:18 -0800 Subject: [PATCH 8/8] Update eng/common/scripts/Helpers/Package-Helpers.ps1 Co-authored-by: Ben Broderick Phillips --- eng/common/scripts/Helpers/Package-Helpers.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/Helpers/Package-Helpers.ps1 b/eng/common/scripts/Helpers/Package-Helpers.ps1 index 19bfe45c3cda8..3cc8adbb7e3d8 100644 --- a/eng/common/scripts/Helpers/Package-Helpers.ps1 +++ b/eng/common/scripts/Helpers/Package-Helpers.ps1 @@ -40,7 +40,7 @@ function GetPackageLookup($packageList) { function GetDocsTocDisplayName($pkg) { $displayName = $pkg.DisplayName if ('deprecated' -eq $pkg.Support) { - LogWarning "The pkg $($pkg.Package) is deprecated. Add 'deprecated' besides of display name." + LogWarning "The pkg $($pkg.Package) is deprecated. Adding 'deprecated' beside the display name." $displayName += " (deprecated)" } return $displayName