55)
66
77Add-Type - AssemblyName System.IO.Compression.FileSystem
8- . $PSScriptRoot \pipeline- logging- functions.ps1
98
109function FirstMatchingSymbolDescriptionOrDefault {
1110 param (
1211 [string ] $FullPath , # Full path to the module that has to be checked
13- [string ] $TargetServerParameter , # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols
12+ [string ] $TargetServerParam , # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols
1413 [string ] $SymbolsPath
1514 )
1615
@@ -22,36 +21,36 @@ function FirstMatchingSymbolDescriptionOrDefault {
2221 # checking and which type of file was uploaded.
2322
2423 # The file itself is returned
25- $SymbolPath = $SymbolsPath + ' \ ' + $FileName
24+ $SymbolPath = $SymbolsPath + " \ " + $FileName
2625
2726 # PDB file for the module
28- $PdbPath = $SymbolPath.Replace ($Extension , ' .pdb' )
27+ $PdbPath = $SymbolPath.Replace ($Extension , " .pdb" )
2928
3029 # PDB file for R2R module (created by crossgen)
31- $NGenPdb = $SymbolPath.Replace ($Extension , ' .ni.pdb' )
30+ $NGenPdb = $SymbolPath.Replace ($Extension , " .ni.pdb" )
3231
3332 # DBG file for a .so library
34- $SODbg = $SymbolPath.Replace ($Extension , ' .so.dbg' )
33+ $SODbg = $SymbolPath.Replace ($Extension , " .so.dbg" )
3534
3635 # DWARF file for a .dylib
37- $DylibDwarf = $SymbolPath.Replace ($Extension , ' .dylib.dwarf' )
36+ $DylibDwarf = $SymbolPath.Replace ($Extension , " .dylib.dwarf" )
3837
39- .\dotnet-symbol.exe -- symbols -- modules -- windows- pdbs $TargetServerParameter $FullPath - o $SymbolsPath | Out-Null
38+ .\dotnet-symbol.exe -- symbols -- modules -- windows- pdbs $TargetServerParam $FullPath - o $SymbolsPath | Out-Null
4039
4140 if (Test-Path $PdbPath ) {
42- return ' PDB'
41+ return " PDB"
4342 }
4443 elseif (Test-Path $NGenPdb ) {
45- return ' NGen PDB'
44+ return " NGen PDB"
4645 }
4746 elseif (Test-Path $SODbg ) {
48- return ' DBG for SO'
47+ return " DBG for SO"
4948 }
5049 elseif (Test-Path $DylibDwarf ) {
51- return ' Dwarf for Dylib'
50+ return " Dwarf for Dylib"
5251 }
5352 elseif (Test-Path $SymbolPath ) {
54- return ' Module'
53+ return " Module"
5554 }
5655 else {
5756 return $null
@@ -69,15 +68,15 @@ function CountMissingSymbols {
6968 }
7069
7170 # Extensions for which we'll look for symbols
72- $RelevantExtensions = @ (' .dll' , ' .exe' , ' .so' , ' .dylib' )
71+ $RelevantExtensions = @ (" .dll" , " .exe" , " .so" , " .dylib" )
7372
7473 # How many files are missing symbol information
7574 $MissingSymbols = 0
7675
7776 $PackageId = [System.IO.Path ]::GetFileNameWithoutExtension($PackagePath )
7877 $PackageGuid = New-Guid
7978 $ExtractPath = Join-Path - Path $ExtractPath - ChildPath $PackageGuid
80- $SymbolsPath = Join-Path - Path $ExtractPath - ChildPath ' Symbols'
79+ $SymbolsPath = Join-Path - Path $ExtractPath - ChildPath " Symbols"
8180
8281 [System.IO.Compression.ZipFile ]::ExtractToDirectory($PackagePath , $ExtractPath )
8382
@@ -87,31 +86,31 @@ function CountMissingSymbols {
8786 Get-ChildItem - Recurse $ExtractPath |
8887 Where-Object {$RelevantExtensions -contains $_.Extension } |
8988 ForEach-Object {
90- if ($_.FullName -Match ' \\ref\\' ) {
89+ if ($_.FullName -Match " \\ref\\" ) {
9190 Write-Host " `t Ignoring reference assembly file" $_.FullName
9291 return
9392 }
9493
95- $SymbolsOnMSDL = FirstMatchingSymbolDescriptionOrDefault - FullPath $_.FullName - TargetServerParameter ' -- microsoft-symbol-server' - SymbolsPath $SymbolsPath
96- $SymbolsOnSymWeb = FirstMatchingSymbolDescriptionOrDefault - FullPath $_.FullName - TargetServerParameter ' -- internal-server' - SymbolsPath $SymbolsPath
94+ $SymbolsOnMSDL = FirstMatchingSymbolDescriptionOrDefault $_.FullName " -- microsoft-symbol-server" $SymbolsPath
95+ $SymbolsOnSymWeb = FirstMatchingSymbolDescriptionOrDefault $_.FullName " -- internal-server" $SymbolsPath
9796
9897 Write-Host - NoNewLine " `t Checking file" $_.FullName " ... "
9998
10099 if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null ) {
101- Write-Host " Symbols found on MSDL (${$ SymbolsOnMSDL} ) and SymWeb (${$ SymbolsOnSymWeb} )"
100+ Write-Host " Symbols found on MSDL (" $ SymbolsOnMSDL " ) and SymWeb (" $ SymbolsOnSymWeb " )"
102101 }
103102 else {
104103 $MissingSymbols ++
105104
106105 if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null ) {
107- Write-Host ' No symbols found on MSDL or SymWeb!'
106+ Write-Host " No symbols found on MSDL or SymWeb!"
108107 }
109108 else {
110109 if ($SymbolsOnMSDL -eq $null ) {
111- Write-Host ' No symbols found on MSDL!'
110+ Write-Host " No symbols found on MSDL!"
112111 }
113112 else {
114- Write-Host ' No symbols found on SymWeb!'
113+ Write-Host " No symbols found on SymWeb!"
115114 }
116115 }
117116 }
@@ -130,26 +129,26 @@ function CheckSymbolsAvailable {
130129 Get-ChildItem " $InputPath \*.nupkg" |
131130 ForEach-Object {
132131 $FileName = $_.Name
133-
132+
134133 # These packages from Arcade-Services include some native libraries that
135134 # our current symbol uploader can't handle. Below is a workaround until
136135 # we get issue: https://github.com/dotnet/arcade/issues/2457 sorted.
137- if ($FileName -Match ' Microsoft\.DotNet\.Darc\.' ) {
136+ if ($FileName -Match " Microsoft\.DotNet\.Darc\." ) {
138137 Write-Host " Ignoring Arcade-services file: $FileName "
139138 Write-Host
140139 return
141140 }
142- elseif ($FileName -Match ' Microsoft\.DotNet\.Maestro\.Tasks\.' ) {
141+ elseif ($FileName -Match " Microsoft\.DotNet\.Maestro\.Tasks\." ) {
143142 Write-Host " Ignoring Arcade-services file: $FileName "
144143 Write-Host
145144 return
146145 }
147-
146+
148147 Write-Host " Validating $FileName "
149148 $Status = CountMissingSymbols " $InputPath \$FileName "
150149
151150 if ($Status -ne 0 ) {
152- Write-PipelineTelemetryError - Category ' CheckSymbols ' - Message " Missing symbols for $Status modules in the package $FileName "
151+ Write-Error " Missing symbols for $Status modules in the package $FileName "
153152 }
154153
155154 Write-Host
0 commit comments