5
5
)
6
6
7
7
Add-Type - AssemblyName System.IO.Compression.FileSystem
8
+ . $PSScriptRoot \pipeline- logging- functions.ps1
8
9
9
10
function FirstMatchingSymbolDescriptionOrDefault {
10
11
param (
11
12
[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
13
14
[string ] $SymbolsPath
14
15
)
15
16
@@ -21,36 +22,36 @@ function FirstMatchingSymbolDescriptionOrDefault {
21
22
# checking and which type of file was uploaded.
22
23
23
24
# The file itself is returned
24
- $SymbolPath = $SymbolsPath + " \ " + $FileName
25
+ $SymbolPath = $SymbolsPath + ' \ ' + $FileName
25
26
26
27
# PDB file for the module
27
- $PdbPath = $SymbolPath.Replace ($Extension , " .pdb" )
28
+ $PdbPath = $SymbolPath.Replace ($Extension , ' .pdb' )
28
29
29
30
# PDB file for R2R module (created by crossgen)
30
- $NGenPdb = $SymbolPath.Replace ($Extension , " .ni.pdb" )
31
+ $NGenPdb = $SymbolPath.Replace ($Extension , ' .ni.pdb' )
31
32
32
33
# DBG file for a .so library
33
- $SODbg = $SymbolPath.Replace ($Extension , " .so.dbg" )
34
+ $SODbg = $SymbolPath.Replace ($Extension , ' .so.dbg' )
34
35
35
36
# DWARF file for a .dylib
36
- $DylibDwarf = $SymbolPath.Replace ($Extension , " .dylib.dwarf" )
37
+ $DylibDwarf = $SymbolPath.Replace ($Extension , ' .dylib.dwarf' )
37
38
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
39
40
40
41
if (Test-Path $PdbPath ) {
41
- return " PDB"
42
+ return ' PDB'
42
43
}
43
44
elseif (Test-Path $NGenPdb ) {
44
- return " NGen PDB"
45
+ return ' NGen PDB'
45
46
}
46
47
elseif (Test-Path $SODbg ) {
47
- return " DBG for SO"
48
+ return ' DBG for SO'
48
49
}
49
50
elseif (Test-Path $DylibDwarf ) {
50
- return " Dwarf for Dylib"
51
+ return ' Dwarf for Dylib'
51
52
}
52
53
elseif (Test-Path $SymbolPath ) {
53
- return " Module"
54
+ return ' Module'
54
55
}
55
56
else {
56
57
return $null
@@ -68,15 +69,15 @@ function CountMissingSymbols {
68
69
}
69
70
70
71
# Extensions for which we'll look for symbols
71
- $RelevantExtensions = @ (" .dll" , " .exe" , " .so" , " .dylib" )
72
+ $RelevantExtensions = @ (' .dll' , ' .exe' , ' .so' , ' .dylib' )
72
73
73
74
# How many files are missing symbol information
74
75
$MissingSymbols = 0
75
76
76
77
$PackageId = [System.IO.Path ]::GetFileNameWithoutExtension($PackagePath )
77
78
$PackageGuid = New-Guid
78
79
$ExtractPath = Join-Path - Path $ExtractPath - ChildPath $PackageGuid
79
- $SymbolsPath = Join-Path - Path $ExtractPath - ChildPath " Symbols"
80
+ $SymbolsPath = Join-Path - Path $ExtractPath - ChildPath ' Symbols'
80
81
81
82
[System.IO.Compression.ZipFile ]::ExtractToDirectory($PackagePath , $ExtractPath )
82
83
@@ -86,31 +87,31 @@ function CountMissingSymbols {
86
87
Get-ChildItem - Recurse $ExtractPath |
87
88
Where-Object {$RelevantExtensions -contains $_.Extension } |
88
89
ForEach-Object {
89
- if ($_.FullName -Match " \\ref\\" ) {
90
+ if ($_.FullName -Match ' \\ref\\' ) {
90
91
Write-Host " `t Ignoring reference assembly file" $_.FullName
91
92
return
92
93
}
93
94
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
96
97
97
98
Write-Host - NoNewLine " `t Checking file" $_.FullName " ... "
98
99
99
100
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} )"
101
102
}
102
103
else {
103
104
$MissingSymbols ++
104
105
105
106
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!'
107
108
}
108
109
else {
109
110
if ($SymbolsOnMSDL -eq $null ) {
110
- Write-Host " No symbols found on MSDL!"
111
+ Write-Host ' No symbols found on MSDL!'
111
112
}
112
113
else {
113
- Write-Host " No symbols found on SymWeb!"
114
+ Write-Host ' No symbols found on SymWeb!'
114
115
}
115
116
}
116
117
}
@@ -129,26 +130,26 @@ function CheckSymbolsAvailable {
129
130
Get-ChildItem " $InputPath \*.nupkg" |
130
131
ForEach-Object {
131
132
$FileName = $_.Name
132
-
133
+
133
134
# These packages from Arcade-Services include some native libraries that
134
135
# our current symbol uploader can't handle. Below is a workaround until
135
136
# 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\.' ) {
137
138
Write-Host " Ignoring Arcade-services file: $FileName "
138
139
Write-Host
139
140
return
140
141
}
141
- elseif ($FileName -Match " Microsoft\.DotNet\.Maestro\.Tasks\." ) {
142
+ elseif ($FileName -Match ' Microsoft\.DotNet\.Maestro\.Tasks\.' ) {
142
143
Write-Host " Ignoring Arcade-services file: $FileName "
143
144
Write-Host
144
145
return
145
146
}
146
-
147
+
147
148
Write-Host " Validating $FileName "
148
149
$Status = CountMissingSymbols " $InputPath \$FileName "
149
150
150
151
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 "
152
153
}
153
154
154
155
Write-Host
0 commit comments