4
4
[Parameter (Mandatory = $true )][string ] $DotnetSymbolVersion , # Version of dotnet symbol to use
5
5
[Parameter (Mandatory = $false )][switch ] $CheckForWindowsPdbs , # If we should check for the existence of windows pdbs in addition to portable PDBs
6
6
[Parameter (Mandatory = $false )][switch ] $ContinueOnError , # If we should keep checking symbols after an error
7
- [Parameter (Mandatory = $false )][switch ] $Clean # Clean extracted symbols directory after checking symbols
7
+ [Parameter (Mandatory = $false )][switch ] $Clean , # Clean extracted symbols directory after checking symbols
8
+ [Parameter (Mandatory = $false )][string ] $SymbolExclusionFile # Exclude the symbols in the file from publishing to symbol server
8
9
)
9
10
11
+ . $PSScriptRoot \..\tools.ps1
10
12
# Maximum number of jobs to run in parallel
11
13
$MaxParallelJobs = 16
12
14
@@ -25,14 +27,28 @@ if ($CheckForWindowsPdbs) {
25
27
$WindowsPdbVerificationParam = " --windows-pdbs"
26
28
}
27
29
30
+ $ExclusionSet = New-Object System.Collections.Generic.HashSet[string ];
31
+
32
+ if (! $InputPath -or ! (Test-Path $InputPath )){
33
+ Write-Host " No symbols to validate."
34
+ ExitWithExitCode 0
35
+ }
36
+
37
+ # Check if the path exists
38
+ if ($SymbolExclusionFile -and (Test-Path $SymbolExclusionFile )){
39
+ [string []]$Exclusions = Get-Content " $SymbolExclusionFile "
40
+ $Exclusions | foreach { if ($_ -and $_.Trim ()){$ExclusionSet.Add ($_ )} }
41
+ }
42
+ else {
43
+ Write-Host " Symbol Exclusion file does not exists. No symbols to exclude."
44
+ }
45
+
28
46
$CountMissingSymbols = {
29
47
param (
30
48
[string ] $PackagePath , # Path to a NuGet package
31
49
[string ] $WindowsPdbVerificationParam # If we should check for the existence of windows pdbs in addition to portable PDBs
32
50
)
33
51
34
- . $using :PSScriptRoot \..\tools.ps1
35
-
36
52
Add-Type - AssemblyName System.IO.Compression.FileSystem
37
53
38
54
Write-Host " Validating $PackagePath "
@@ -142,37 +158,44 @@ $CountMissingSymbols = {
142
158
return $null
143
159
}
144
160
145
- $FileGuid = New-Guid
146
- $ExpandedSymbolsPath = Join-Path - Path $SymbolsPath - ChildPath $FileGuid
147
-
148
- $SymbolsOnMSDL = & $FirstMatchingSymbolDescriptionOrDefault `
149
- - FullPath $FileName `
150
- - TargetServerParam ' --microsoft-symbol-server' `
151
- - SymbolsPath " $ExpandedSymbolsPath -msdl" `
152
- - WindowsPdbVerificationParam $WindowsPdbVerificationParam
153
- $SymbolsOnSymWeb = & $FirstMatchingSymbolDescriptionOrDefault `
154
- - FullPath $FileName `
155
- - TargetServerParam ' --internal-server' `
156
- - SymbolsPath " $ExpandedSymbolsPath -symweb" `
157
- - WindowsPdbVerificationParam $WindowsPdbVerificationParam
158
-
159
- Write-Host - NoNewLine " `t Checking file " $FileName " ... "
160
-
161
- if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null ) {
162
- Write-Host " Symbols found on MSDL ($SymbolsOnMSDL ) and SymWeb ($SymbolsOnSymWeb )"
161
+ $FileRelativePath = $FileName.Replace (" $ExtractPath \" , " " )
162
+ if (($ ($using :ExclusionSet ) -ne $null ) -and ($ ($using :ExclusionSet ).Contains($FileRelativePath ) -or ($ ($using :ExclusionSet ).Contains($FileRelativePath.Replace (" \" , " /" ))))){
163
+ Write-Host " Skipping $FileName from symbol validation"
163
164
}
164
- else {
165
- $MissingSymbols ++
166
165
167
- if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null ) {
168
- Write-Host ' No symbols found on MSDL or SymWeb!'
166
+ else {
167
+ $FileGuid = New-Guid
168
+ $ExpandedSymbolsPath = Join-Path - Path $SymbolsPath - ChildPath $FileGuid
169
+
170
+ $SymbolsOnMSDL = & $FirstMatchingSymbolDescriptionOrDefault `
171
+ - FullPath $FileName `
172
+ - TargetServerParam ' --microsoft-symbol-server' `
173
+ - SymbolsPath " $ExpandedSymbolsPath -msdl" `
174
+ - WindowsPdbVerificationParam $WindowsPdbVerificationParam
175
+ $SymbolsOnSymWeb = & $FirstMatchingSymbolDescriptionOrDefault `
176
+ - FullPath $FileName `
177
+ - TargetServerParam ' --internal-server' `
178
+ - SymbolsPath " $ExpandedSymbolsPath -symweb" `
179
+ - WindowsPdbVerificationParam $WindowsPdbVerificationParam
180
+
181
+ Write-Host - NoNewLine " `t Checking file " $FileName " ... "
182
+
183
+ if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null ) {
184
+ Write-Host " Symbols found on MSDL ($SymbolsOnMSDL ) and SymWeb ($SymbolsOnSymWeb )"
169
185
}
170
186
else {
171
- if ($SymbolsOnMSDL -eq $null ) {
172
- Write-Host ' No symbols found on MSDL!'
187
+ $MissingSymbols ++
188
+
189
+ if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null ) {
190
+ Write-Host ' No symbols found on MSDL or SymWeb!'
173
191
}
174
192
else {
175
- Write-Host ' No symbols found on SymWeb!'
193
+ if ($SymbolsOnMSDL -eq $null ) {
194
+ Write-Host ' No symbols found on MSDL!'
195
+ }
196
+ else {
197
+ Write-Host ' No symbols found on SymWeb!'
198
+ }
176
199
}
177
200
}
178
201
}
0 commit comments