55)
66
77Add-Type - AssemblyName System.IO.Compression.FileSystem
8+ . $PSScriptRoot \pipeline- logging- functions.ps1
89
910function FirstMatchingSymbolDescriptionOrDefault {
1011 param (
1112 [string ] $FullPath , # Full path to the module that has to be checked
12- [string ] $TargetServerParam , # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols
13+ [string ] $TargetServerParameter , # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols
1314 [string ] $SymbolsPath
1415 )
1516
@@ -21,36 +22,36 @@ function FirstMatchingSymbolDescriptionOrDefault {
2122 # checking and which type of file was uploaded.
2223
2324 # The file itself is returned
24- $SymbolPath = $SymbolsPath + " \ " + $FileName
25+ $SymbolPath = $SymbolsPath + ' \ ' + $FileName
2526
2627 # PDB file for the module
27- $PdbPath = $SymbolPath.Replace ($Extension , " .pdb" )
28+ $PdbPath = $SymbolPath.Replace ($Extension , ' .pdb' )
2829
2930 # PDB file for R2R module (created by crossgen)
30- $NGenPdb = $SymbolPath.Replace ($Extension , " .ni.pdb" )
31+ $NGenPdb = $SymbolPath.Replace ($Extension , ' .ni.pdb' )
3132
3233 # DBG file for a .so library
33- $SODbg = $SymbolPath.Replace ($Extension , " .so.dbg" )
34+ $SODbg = $SymbolPath.Replace ($Extension , ' .so.dbg' )
3435
3536 # DWARF file for a .dylib
36- $DylibDwarf = $SymbolPath.Replace ($Extension , " .dylib.dwarf" )
37+ $DylibDwarf = $SymbolPath.Replace ($Extension , ' .dylib.dwarf' )
3738
38- .\dotnet-symbol.exe -- symbols -- modules -- windows- pdbs $TargetServerParam $FullPath - o $SymbolsPath | Out-Null
39+ .\dotnet-symbol.exe -- symbols -- modules -- windows- pdbs $TargetServerParameter $FullPath - o $SymbolsPath | Out-Null
3940
4041 if (Test-Path $PdbPath ) {
41- return " PDB"
42+ return ' PDB'
4243 }
4344 elseif (Test-Path $NGenPdb ) {
44- return " NGen PDB"
45+ return ' NGen PDB'
4546 }
4647 elseif (Test-Path $SODbg ) {
47- return " DBG for SO"
48+ return ' DBG for SO'
4849 }
4950 elseif (Test-Path $DylibDwarf ) {
50- return " Dwarf for Dylib"
51+ return ' Dwarf for Dylib'
5152 }
5253 elseif (Test-Path $SymbolPath ) {
53- return " Module"
54+ return ' Module'
5455 }
5556 else {
5657 return $null
@@ -68,15 +69,15 @@ function CountMissingSymbols {
6869 }
6970
7071 # Extensions for which we'll look for symbols
71- $RelevantExtensions = @ (" .dll" , " .exe" , " .so" , " .dylib" )
72+ $RelevantExtensions = @ (' .dll' , ' .exe' , ' .so' , ' .dylib' )
7273
7374 # How many files are missing symbol information
7475 $MissingSymbols = 0
7576
7677 $PackageId = [System.IO.Path ]::GetFileNameWithoutExtension($PackagePath )
7778 $PackageGuid = New-Guid
7879 $ExtractPath = Join-Path - Path $ExtractPath - ChildPath $PackageGuid
79- $SymbolsPath = Join-Path - Path $ExtractPath - ChildPath " Symbols"
80+ $SymbolsPath = Join-Path - Path $ExtractPath - ChildPath ' Symbols'
8081
8182 [System.IO.Compression.ZipFile ]::ExtractToDirectory($PackagePath , $ExtractPath )
8283
@@ -86,31 +87,31 @@ function CountMissingSymbols {
8687 Get-ChildItem - Recurse $ExtractPath |
8788 Where-Object {$RelevantExtensions -contains $_.Extension } |
8889 ForEach-Object {
89- if ($_.FullName -Match " \\ref\\" ) {
90+ if ($_.FullName -Match ' \\ref\\' ) {
9091 Write-Host " `t Ignoring reference assembly file" $_.FullName
9192 return
9293 }
9394
94- $SymbolsOnMSDL = FirstMatchingSymbolDescriptionOrDefault $_.FullName " -- microsoft-symbol-server" $SymbolsPath
95- $SymbolsOnSymWeb = FirstMatchingSymbolDescriptionOrDefault $_.FullName " -- internal-server" $SymbolsPath
95+ $SymbolsOnMSDL = FirstMatchingSymbolDescriptionOrDefault - FullPath $_.FullName - TargetServerParameter ' -- microsoft-symbol-server' - SymbolsPath $SymbolsPath
96+ $SymbolsOnSymWeb = FirstMatchingSymbolDescriptionOrDefault - FullPath $_.FullName - TargetServerParameter ' -- internal-server' - SymbolsPath $SymbolsPath
9697
9798 Write-Host - NoNewLine " `t Checking file" $_.FullName " ... "
9899
99100 if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null ) {
100- Write-Host " Symbols found on MSDL (" $ SymbolsOnMSDL " ) and SymWeb (" $ SymbolsOnSymWeb " )"
101+ Write-Host " Symbols found on MSDL (${$ SymbolsOnMSDL} ) and SymWeb (${$ SymbolsOnSymWeb} )"
101102 }
102103 else {
103104 $MissingSymbols ++
104105
105106 if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null ) {
106- Write-Host " No symbols found on MSDL or SymWeb!"
107+ Write-Host ' No symbols found on MSDL or SymWeb!'
107108 }
108109 else {
109110 if ($SymbolsOnMSDL -eq $null ) {
110- Write-Host " No symbols found on MSDL!"
111+ Write-Host ' No symbols found on MSDL!'
111112 }
112113 else {
113- Write-Host " No symbols found on SymWeb!"
114+ Write-Host ' No symbols found on SymWeb!'
114115 }
115116 }
116117 }
@@ -129,26 +130,26 @@ function CheckSymbolsAvailable {
129130 Get-ChildItem " $InputPath \*.nupkg" |
130131 ForEach-Object {
131132 $FileName = $_.Name
132-
133+
133134 # These packages from Arcade-Services include some native libraries that
134135 # our current symbol uploader can't handle. Below is a workaround until
135136 # we get issue: https://github.com/dotnet/arcade/issues/2457 sorted.
136- if ($FileName -Match " Microsoft\.DotNet\.Darc\." ) {
137+ if ($FileName -Match ' Microsoft\.DotNet\.Darc\.' ) {
137138 Write-Host " Ignoring Arcade-services file: $FileName "
138139 Write-Host
139140 return
140141 }
141- elseif ($FileName -Match " Microsoft\.DotNet\.Maestro\.Tasks\." ) {
142+ elseif ($FileName -Match ' Microsoft\.DotNet\.Maestro\.Tasks\.' ) {
142143 Write-Host " Ignoring Arcade-services file: $FileName "
143144 Write-Host
144145 return
145146 }
146-
147+
147148 Write-Host " Validating $FileName "
148149 $Status = CountMissingSymbols " $InputPath \$FileName "
149150
150151 if ($Status -ne 0 ) {
151- Write-Error " Missing symbols for $Status modules in the package $FileName "
152+ Write-PipelineTelemetryError - Category ' CheckSymbols ' - Message " Missing symbols for $Status modules in the package $FileName "
152153 }
153154
154155 Write-Host
0 commit comments