@@ -147,39 +147,42 @@ $myexit=0
147
147
# If we fail at first, but succeed at either of next two attempts, then it is a sporadic failure.
148
148
# If we even at third attempt fail, then it is a true failure.
149
149
#
150
- for ($i = 0 ; $i -le 2 ; $i ++ ) {
150
+ for ($i = 0 ; $i -lt 3 ; $i ++ )
151
+ {
152
+ $binLogFilePath = " $LogFilesDirectory \$SampleName .$Configuration .$Platform .$i .binlog"
151
153
$errorLogFilePath = " $LogFilesDirectory \$SampleName .$Configuration .$Platform .$i .err"
152
154
$warnLogFilePath = " $LogFilesDirectory \$SampleName .$Configuration .$Platform .$i .wrn"
153
155
$OutLogFilePath = " $LogFilesDirectory \$SampleName .$Configuration .$Platform .$i .out"
154
156
155
- msbuild $solutionFile - clp:Verbosity= m - t:rebuild - property:Configuration= $Configuration - property:Platform= $Platform - p:TargetVersion= Windows10 - p:InfVerif_AdditionalOptions= " $InfVerif_AdditionalOptions " - warnaserror - flp1:errorsonly` ;logfile= $errorLogFilePath - flp2:WarningsOnly` ;logfile= $warnLogFilePath - noLogo > $OutLogFilePath
156
- if ($env: WDS_WipeOutputs -ne $null )
157
+ msbuild $solutionFile - clp:Verbosity= m - t:rebuild - property:Configuration= $Configuration - property:Platform= $Platform - p:TargetVersion= Windows10 - p:InfVerif_AdditionalOptions= " $InfVerif_AdditionalOptions " - warnaserror - binaryLogger:LogFile = $binLogFilePath ` ;ProjectImports = None - flp1:errorsonly` ;logfile= $errorLogFilePath - flp2:WarningsOnly` ;logfile= $warnLogFilePath - noLogo > $OutLogFilePath
158
+ if ($null -ne $env: WDS_WipeOutputs )
157
159
{
158
- Write-Verbose (" WipeOutputs: " + $Directory + " " + (((Get-Volume ($DriveLetter = ( Get-Item " ." ).PSDrive.Name)) .SizeRemaining/ 1 GB )))
159
- Get-ChildItem - path $Directory - Recurse - Include x64| Remove-Item - Recurse
160
- Get-ChildItem - path $Directory - Recurse - Include arm64| Remove-Item - Recurse
160
+ Write-Verbose (" WipeOutputs: " + $Directory + " " + (((Get-Volume (Get-Item " ." ).PSDrive.Name).SizeRemaining / 1 GB )))
161
+ Get-ChildItem - path $Directory - Recurse - Include x64 | Remove-Item - Recurse
162
+ Get-ChildItem - path $Directory - Recurse - Include arm64 | Remove-Item - Recurse
161
163
}
162
164
if ($LASTEXITCODE -eq 0 )
163
165
{
164
166
# We succeeded building.
165
- # If at first attempt, then $myexit=0
166
- # If at later attempt, then $myexit=2
167
+ # If it was at a later attempt, let the caller know with a different exit code.
167
168
if ($i -eq 0 )
168
169
{
169
- $myexit = 0
170
+ $myexit = 0
170
171
}
171
172
else
172
173
{
173
- $myexit = 2
174
+ $myexit = 2
174
175
}
175
- break ;
176
+ # Remove binlog on success to save space; keep otherwise to diagnose issues.
177
+ Remove-Item $binLogFilePath
178
+ break ;
176
179
}
177
180
else
178
181
{
179
182
# We failed building.
180
183
# Let us sleep for a bit.
181
184
# Then let the while loop do its thing and re-run.
182
- sleep 1
185
+ Start-Sleep 1
183
186
if ($Verbose )
184
187
{
185
188
Write-Warning " `u{274C} Build failed. Retrying to see if sporadic..."
0 commit comments