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

Print unique set of PDBs to a text file #4332

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,28 @@ stages:
env:
LIB: $(Build.SourcesDirectory)

# In the "Publish symbols to SymWeb and MSDL" step, the symbols are automatically stripped in the API.
# However, since WindowsAppSDK is public, we don't need to strip them.
# So we need to send a list of pdbs to the symbols team that is not needed to be stripped
# This task facilitates this.
- task: PowerShell@2
name: ListUniquePDBs
displayName: 'List Unique PDBs and write to pdbs.txt'
inputs:
targetType: 'inline'
script: |
$pdbSet = @{}
$inputPath = "$(Build.ArtifactStagingDirectory)\symbols"
Get-ChildItem *.pdb -Path $inputPath -Recurse | foreach-object {
$pdbSet[$_.Name] = $true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're using hashset as a dynamically growable collection? Since you don't care about the value $null would be slightly prefereable to $true

}
foreach ($value in $pdbSet.Keys)
{
Write-Host $value
}
New-Item "$(ob_outputDirectory)\pdbs.txt" -Force
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is 'ob'?

$pdbSet.Keys | Out-File "$(ob_outputDirectory)\pdbs.txt"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can replace lines 164-165 with the simpler

$pdbSet.Keys | Set-Content -Path "$(ob_outputDirectory)\pdbs.txt" -Force

You can also control encoding if need be (see other Set-Content uses across the repo for examples)


# Publishing symbols publicly requires making an API call to the service and is handled by PublishPublicSymbols.ps1
# in eng/common
# See this page for more info:
Expand Down