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