From 43ec6598da39d5ce4d82c9aba57013ba3e81e92c Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Tue, 2 Feb 2021 10:42:01 -0800 Subject: [PATCH 1/3] Scan all duplicate artifacts which set hide to true --- .../docgeneration/Generate-DocIndex.ps1 | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/eng/common/docgeneration/Generate-DocIndex.ps1 b/eng/common/docgeneration/Generate-DocIndex.ps1 index 36194f50d5a1e..f47e07f80e2b3 100644 --- a/eng/common/docgeneration/Generate-DocIndex.ps1 +++ b/eng/common/docgeneration/Generate-DocIndex.ps1 @@ -65,31 +65,36 @@ function Get-TocMapping { $orderServiceMapping = @{} foreach ($artifact in $artifacts) { - $packageInfo = $metadata | ? {$_.Package -eq $artifact} - - if ($packageInfo -and $packageInfo[0].Hide -eq 'true') { - LogDebug "The artifact $artifact set 'Hide' to 'true'." - continue + $packageInfo = $metadata | ? { $_.Package -eq $artifact } + $packageInfoCopy = @() + if ($packageInfo) { + foreach ($pkg in $packageInfo) { + if ($pkg.Hide -eq 'true') { + LogDebug "The artifact $artifact set 'Hide' to 'true'." + continue + } + $packageInfoCopy += $pkg + } } $serviceName = "" $displayName = "" - if (!$packageInfo) { + if (!$packageInfoCopy) { LogWarning "There is no artifact $artifact. Please check csv of Azure/azure-sdk/_data/release/latest repo if this is intended. " # If no service name retrieved, print out warning message, and put it into Other page. $serviceName = "Other" } - elseif (!$packageInfo[0].ServiceName) { + elseif (!$packageInfoCopy[0].ServiceName) { LogWarning "There is no service name for artifact $artifact. Please check csv of Azure/azure-sdk/_data/release/latest repo if this is intended. " # If no service name retrieved, print out warning message, and put it into Other page. $serviceName = "Other" - $displayName = $packageInfo[0].DisplayName.Trim() + $displayName = $packageInfoCopy[0].DisplayName.Trim() } else { - if ($packageInfo.Length -gt 1) { + if ($packageInfoCopy.Length -gt 1) { LogWarning "There are more than 1 packages fetched out for artifact $artifact. Please check csv of Azure/azure-sdk/_data/release/latest repo if this is intended. " } - $serviceName = $packageInfo[0].ServiceName.Trim() - $displayName = $packageInfo[0].DisplayName.Trim() + $serviceName = $packageInfoCopy[0].ServiceName.Trim() + $displayName = $packageInfoCopy[0].DisplayName.Trim() } $orderServiceMapping[$artifact] = @($serviceName, $displayName) } From a038620aacafa797c6608a1799b3f5c46e998b21 Mon Sep 17 00:00:00 2001 From: Sima Zhu <48036328+sima-zhu@users.noreply.github.com> Date: Tue, 2 Feb 2021 22:33:23 -0800 Subject: [PATCH 2/3] Update eng/common/docgeneration/Generate-DocIndex.ps1 Co-authored-by: Wes Haggard --- eng/common/docgeneration/Generate-DocIndex.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/docgeneration/Generate-DocIndex.ps1 b/eng/common/docgeneration/Generate-DocIndex.ps1 index f47e07f80e2b3..177882bce23fd 100644 --- a/eng/common/docgeneration/Generate-DocIndex.ps1 +++ b/eng/common/docgeneration/Generate-DocIndex.ps1 @@ -65,7 +65,7 @@ function Get-TocMapping { $orderServiceMapping = @{} foreach ($artifact in $artifacts) { - $packageInfo = $metadata | ? { $_.Package -eq $artifact } + $packageInfo = $metadata | ? { $_.Package -eq $artifact -and $_.Hide -ne "true" } $packageInfoCopy = @() if ($packageInfo) { foreach ($pkg in $packageInfo) { From 7e28a20faf7bd41b64d829502041e1fe5fbb2c12 Mon Sep 17 00:00:00 2001 From: Sima Zhu <48036328+sima-zhu@users.noreply.github.com> Date: Tue, 2 Feb 2021 22:34:29 -0800 Subject: [PATCH 3/3] Update Generate-DocIndex.ps1 --- .../docgeneration/Generate-DocIndex.ps1 | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/eng/common/docgeneration/Generate-DocIndex.ps1 b/eng/common/docgeneration/Generate-DocIndex.ps1 index 177882bce23fd..b2f6356c0b294 100644 --- a/eng/common/docgeneration/Generate-DocIndex.ps1 +++ b/eng/common/docgeneration/Generate-DocIndex.ps1 @@ -66,35 +66,25 @@ function Get-TocMapping { foreach ($artifact in $artifacts) { $packageInfo = $metadata | ? { $_.Package -eq $artifact -and $_.Hide -ne "true" } - $packageInfoCopy = @() - if ($packageInfo) { - foreach ($pkg in $packageInfo) { - if ($pkg.Hide -eq 'true') { - LogDebug "The artifact $artifact set 'Hide' to 'true'." - continue - } - $packageInfoCopy += $pkg - } - } $serviceName = "" $displayName = "" - if (!$packageInfoCopy) { + if (!$packageInfo) { LogWarning "There is no artifact $artifact. Please check csv of Azure/azure-sdk/_data/release/latest repo if this is intended. " # If no service name retrieved, print out warning message, and put it into Other page. $serviceName = "Other" } - elseif (!$packageInfoCopy[0].ServiceName) { + elseif (!$packageInfo[0].ServiceName) { LogWarning "There is no service name for artifact $artifact. Please check csv of Azure/azure-sdk/_data/release/latest repo if this is intended. " # If no service name retrieved, print out warning message, and put it into Other page. $serviceName = "Other" - $displayName = $packageInfoCopy[0].DisplayName.Trim() + $displayName = $packageInfo[0].DisplayName.Trim() } else { - if ($packageInfoCopy.Length -gt 1) { + if ($packageInfo.Length -gt 1) { LogWarning "There are more than 1 packages fetched out for artifact $artifact. Please check csv of Azure/azure-sdk/_data/release/latest repo if this is intended. " } - $serviceName = $packageInfoCopy[0].ServiceName.Trim() - $displayName = $packageInfoCopy[0].DisplayName.Trim() + $serviceName = $packageInfo[0].ServiceName.Trim() + $displayName = $packageInfo[0].DisplayName.Trim() } $orderServiceMapping[$artifact] = @($serviceName, $displayName) }