Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync eng/common directory with azure-sdk-tools for PR 3000 #27822

Merged
merged 19 commits into from
Apr 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions eng/common/docgeneration/Generate-DocIndex.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ function Get-TocMapping {

foreach ($artifact in $artifacts) {
$packageInfo = $metadata | ? { $_.Package -eq $artifact -and $_.Hide -ne "true" }

$serviceName = ""
$displayName = ""
if (!$packageInfo) {
LogDebug "There is no service name for artifact $artifact or it is marked as hidden. Please check csv of Azure/azure-sdk/_data/release/latest repo if this is intended. "
continue
Expand All @@ -76,16 +76,28 @@ function Get-TocMapping {
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()
}
else {
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 = $packageInfo[0].ServiceName.Trim()
$displayName = $packageInfo[0].DisplayName.Trim()
}
$orderServiceMapping[$artifact] = @($serviceName, $displayName)

# Define the order of "New", "Type", if not match, return the length of the array.
$CustomOrder_New = "true", "false", ""
$newIndex = $CustomOrder_New.IndexOf($packageInfo[0].New.ToLower())
$newIndex = $newIndex -eq -1 ? $CustomOrder_New.Count : $newIndex
$CustomOrder_Type = "client", "mgmt", "compat", "spring", ""
$typeIndex = $CustomOrder_Type.IndexOf($packageInfo[0].Type.ToLower())
$typeIndex = $typeIndex -eq -1 ? $CustomOrder_Type.Count : $typeIndex
$orderServiceMapping[$artifact] = [PSCustomObject][ordered]@{
NewIndex = $newIndex
TypeIndex = $typeIndex
ServiceName = $serviceName
DisplayName = $packageInfo[0].DisplayName.Trim()
Artifact = $artifact
}
}
return $orderServiceMapping
}
Expand Down Expand Up @@ -114,10 +126,11 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang, [String]
New-Item -Path $YmlPath -Name "toc.yml" -Force
$visitedService = @{}
# Sort and display toc service name by alphabetical order, and then sort artifact by order.
foreach ($serviceMapping in ($tocContent.GetEnumerator() | Sort-Object Value, Key)) {
$artifact = $serviceMapping.Key
$serviceName = $serviceMapping.Value[0]
$displayName = $serviceMapping.Value[1]
$sortedToc = $tocContent.Values | Sort-Object NewIndex, TypeIndex, ServiceName, DisplayName, Artifact
foreach ($serviceMapping in $sortedToc) {
$artifact = $serviceMapping.Artifact
$serviceName = $serviceMapping.ServiceName
$displayName = $serviceMapping.DisplayName

# handle spaces in service name, EG "Confidential Ledger"
# handle / in service name, EG "Database for MySQL/PostgreSQL". Leaving a "/" present will generate a bad link location.
Expand Down