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 2922 #27713

Merged
merged 1 commit into from
Mar 16, 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
23 changes: 13 additions & 10 deletions eng/common/scripts/Update-DocsMsToc.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -140,23 +140,26 @@ for ($i = 0; $i -lt $metadata.Count; $i++) {
Write-Host "File metadata already added for $($metadata[$i].Package). Keeping the first entry found."
continue
}

Add-Member `
-InputObject $metadata[$i] `
-MemberType NoteProperty `
-Name FileMetadata `
-Value $fileEntry
if (!($metadata[$i].PSObject.Members.Name -contains "GroupId") -or ($fileEntry.Group -eq $metadata[$i].GroupId)) {
Add-Member `
-InputObject $metadata[$i] `
-MemberType NoteProperty `
-Name FileMetadata `
-Value $fileEntry
}
}
}
}

$packagesForToc = @{}
foreach ($metadataEntry in (GetPackageLookup $metadata).Values) {
$allPackages = GetPackageLookup $metadata
foreach ($metadataKey in $allPackages.Keys) {
$metadataEntry = $allPackages[$metadataKey]
if (!$metadataEntry.ServiceName) {
LogWarning "Empty ServiceName for package `"$($metadataEntry.Package)`". Skipping."
LogWarning "Empty ServiceName for package `"$metadataKey`". Skipping."
continue
}
$packagesForToc[$metadataEntry.Package] = $metadataEntry
$packagesForToc[$metadataKey] = $metadataEntry
}

# Get unique service names and sort alphabetically to act as the service nodes
Expand All @@ -183,7 +186,7 @@ foreach ($service in $serviceNameList) {

# Client packages get individual entries
$clientPackages = $packagesForToc.Values.Where({ $_.ServiceName -eq $service -and ('client' -eq $_.Type) })
$clientPackages = $clientPackages | Sort-Object -Property Package
$clientPackages = $clientPackages | Sort-Object 'Package', 'GroupId' | Get-Unique
if ($clientPackages) {
foreach ($clientPackage in $clientPackages) {
$packageItems += GetClientPackageNode -clientPackage $clientPackage
Expand Down