Sync eng/common directory with azure-sdk-tools for PR 4985 (#4209)

This commit is contained in:
Azure SDK Bot 2022-12-21 12:42:17 -05:00 committed by GitHub
parent 8747eacbc5
commit b67b46b059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 33 deletions

View File

@ -1,37 +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. <groupId>:<packageName> 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. <groupId>:<packageName> 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
}
# For deprecated packages, add "(deprecated)" besides of display name.
function GetDocsTocDisplayName($pkg) {
$displayName = $pkg.DisplayName
if ('deprecated' -eq $pkg.Support) {
LogWarning "The pkg $($pkg.Package) is deprecated. Adding 'deprecated' beside the display name."
$displayName += " (deprecated)"
}
return $displayName
}

View File

@ -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

View File

@ -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 = @{}

View File

@ -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"