Skip to content

Commit 2289c7f

Browse files
authored
Various BuildTransportPackage.ps1 Refactors and Fixes (#3221)
1 parent bd6e371 commit 2289c7f

6 files changed

+76
-33
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@echo off
22

3-
powershell -ExecutionPolicy Unrestricted -NoLogo -NoProfile -File %~dp0\BuildTransportPackage.ps1 %*
3+
powershell -ExecutionPolicy Unrestricted -NoLogo -NoProfile -File %~dp0\BuildAll.ps1 %*
44

55
exit /b %ERRORLEVEL%

BuildTransportPackage.ps1 renamed to BuildAll.ps1

+48-5
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ Try {
111111
& .\.nuget\nuget.exe restore WindowsAppRuntime.sln -configfile nuget.config
112112
& .\.nuget\nuget.exe restore "dev\Bootstrap\CS\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj" -configfile nuget.config
113113

114-
# If the call to restore WindowsAppRuntime_Insights fails check to make sure all Window SDK's from 17760 are installed.
115-
& .\.nuget\nuget.exe restore "dev\WindowsAppRuntime_Insights\packages.config" -ConfigFile "dev\WindowsAppRuntime_Insights\nuget.config" -PackagesDirectory "dev\WindowsAppRuntime_Insights\packages"
114+
if ($lastexitcode -ne 0)
115+
{
116+
exit 1
117+
}
116118

117119
$srcPath = Get-Childitem -Path 'dev\WindowsAppRuntime_Insights\packages' -File 'MicrosoftTelemetry.h' -Recurse
118120

@@ -127,6 +129,11 @@ Try {
127129
}
128130
}
129131
}
132+
133+
if ($lastexitcode -ne 0)
134+
{
135+
exit 1
136+
}
130137
}
131138
if (($AzureBuildStep -eq "all") -Or ($AzureBuildStep -eq "BuildBinaries"))
132139
{
@@ -144,6 +151,10 @@ Try {
144151
/p:WindowsAppSDKCleanIntermediateFiles=true `
145152
/p:AppxSymbolPackageEnabled=false `
146153
/p:WindowsAppSDKBuildPipeline=$WindowsAppSDKBuildPipeline
154+
if ($lastexitcode -ne 0)
155+
{
156+
exit 1
157+
}
147158
}
148159
}
149160
}
@@ -154,12 +165,17 @@ Try {
154165
#------------------
155166

156167
#Restore packages from mrt.
157-
& .\.nuget\nuget.exe restore "$MRTSourcesDirectory\mrt\MrtCore.sln" -ConfigFile nuget.config
168+
& .\.nuget\nuget.exe restore "$MRTSourcesDirectory\mrt\MrtCore.sln" -ConfigFile nuget.config -PackagesDirectory "$MRTSourcesDirectory\mrt\packages"
158169
& .\.nuget\nuget.exe restore "$MRTSourcesDirectory\mrt\Microsoft.Windows.ApplicationModel.Resources\src\packages.config" -ConfigFile nuget.config -PackagesDirectory "$MRTSourcesDirectory\mrt\packages"
159170
& .\.nuget\nuget.exe restore "$MRTSourcesDirectory\mrt\mrm\mrmex\packages.config" -ConfigFile nuget.config -PackagesDirectory "$MRTSourcesDirectory\mrt\packages"
160171
& .\.nuget\nuget.exe restore "$MRTSourcesDirectory\mrt\mrm\mrmmin\packages.config" -ConfigFile nuget.config -PackagesDirectory "$MRTSourcesDirectory\mrt\packages"
161172
& .\.nuget\nuget.exe restore "$MRTSourcesDirectory\mrt\mrm\unittests\packages.config" -ConfigFile nuget.config -PackagesDirectory "$MRTSourcesDirectory\mrt\packages"
162173

174+
if ($lastexitcode -ne 0)
175+
{
176+
exit 1
177+
}
178+
163179
# Init mrtcore
164180
foreach($platformToRun in $platform.Split(","))
165181
{
@@ -172,11 +188,15 @@ Try {
172188
foreach($platformToRun in $platform.Split(","))
173189
{
174190
write-host "Building MrtCore.sln for configuration $configurationToRun and platform:$platformToRun"
175-
& $msBuildPath /restore `
176-
"$MRTSourcesDirectory\mrt\MrtCore.sln" `
191+
& $msBuildPath /restore "$MRTSourcesDirectory\mrt\MrtCore.sln" `
177192
/p:Configuration=$configurationToRun,Platform=$platformToRun `
178193
/p:PGOBuildMode=$PGOBuildMode `
179194
/binaryLogger:"BuildOutput/mrtcore.$platformToRun.$configurationToRun.binlog"
195+
196+
if ($lastexitcode -ne 0)
197+
{
198+
exit 1
199+
}
180200
}
181201
}
182202
}
@@ -187,6 +207,10 @@ Try {
187207
#------------------
188208
# build AnyCPU
189209
& $msBuildPath /restore "dev\Bootstrap\CS\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj" /p:Configuration=$configurationForMrtAndAnyCPU,Platform=AnyCPU
210+
if ($lastexitcode -ne 0)
211+
{
212+
exit 1
213+
}
190214
}
191215
if (($AzureBuildStep -eq "all") -Or ($AzureBuildStep -eq "StageFiles"))
192216
{
@@ -209,6 +233,10 @@ Try {
209233
foreach($platformToRun in $platform.Split(","))
210234
{
211235
.\build\CopyFilesToStagingDir.ps1 -BuildOutputDir 'BuildOutput' -OverrideDir "$buildOverridePath" -PublishDir "$windowsAppSdkBinariesPath" -NugetDir "$BasePath" -Platform $PlatformToRun -Configuration $ConfigurationToRun
236+
if ($lastexitcode -ne 0)
237+
{
238+
exit 1
239+
}
212240
}
213241
}
214242

@@ -276,6 +304,11 @@ Try {
276304
Copy-Item -Path "$nuSpecsPath\AppxManifest.xml" -Destination "$BasePath"
277305
Copy-Item -Path "LICENSE" -Destination "$BasePath" -force
278306

307+
if ($lastexitcode -ne 0)
308+
{
309+
exit 1
310+
}
311+
279312
# for some reason xslt.load changes the working directory to C:\windows\system32.
280313
# store the current working directory here.
281314
$workingDirectory = get-location
@@ -286,6 +319,11 @@ Try {
286319
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform
287320
$xslt.Load("$workingDirectory\build\TransformAppxManifest.xslt")
288321
$xslt.Transform("$workingDirectory\$BasePath\AppxManifest.xml", "$workingDirectory\$manifestPath\Microsoft.WindowsAppSdk.Foundation.manifest")
322+
323+
if ($lastexitcode -ne 0)
324+
{
325+
exit 1
326+
}
289327
}
290328
if (($AzureBuildStep -eq "all") -Or ($AzureBuildStep -eq "PackNuget"))
291329
{
@@ -299,6 +337,11 @@ Try {
299337

300338
# Make the foundation transport package.
301339
& .\.nuget\nuget.exe pack $nuspecPath -BasePath $BasePath -OutputDirectory $OutputDirectory
340+
341+
if ($lastexitcode -ne 0)
342+
{
343+
exit 1
344+
}
302345
}
303346
}
304347
Catch

build/AzurePipelinesTemplates/WindowsAppSDK-BuildAndTestMRT-Steps.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ steps:
44
- task: PowerShell@2
55
name: BuildBinaries
66
inputs:
7-
filePath: 'BuildTransportPackage.ps1'
7+
filePath: 'BuildAll.ps1'
88
arguments: -Platform "$(buildPlatform)" -Configuration "$(buildConfiguration)" -AzureBuildStep "BuildMRT"
99

1010
# component detection must happen *within* the build task

build/ProjectReunion-BuildFoundation.yml

+22-4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ jobs:
8181
inputs:
8282
nuGetServiceConnections: 'TelemetryInternal'
8383

84+
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
85+
displayName: 'NuGet restore of packages'
86+
inputs:
87+
command: 'custom'
88+
arguments: 'restore dev\WindowsAppRuntime_Insights\packages.config -ConfigFile dev\WindowsAppRuntime_Insights\nuget.config -PackagesDirectory dev\WindowsAppRuntime_Insights\packages'
89+
8490
- template: AzurePipelinesTemplates\WindowsAppSDK-SetupBuildEnvironment-Steps.yml
8591

8692
- task: NuGetAuthenticate@1
@@ -118,7 +124,7 @@ jobs:
118124
- task: PowerShell@2
119125
name: BuildBinaries
120126
inputs:
121-
filePath: 'BuildTransportPackage.ps1'
127+
filePath: 'BuildAll.ps1'
122128
arguments: -Platform "$(buildPlatform)" -Configuration "$(buildConfiguration)" -AzureBuildStep "BuildBinaries"
123129

124130
# component detection must happen *within* the build task
@@ -153,12 +159,18 @@ jobs:
153159
inputs:
154160
nuGetServiceConnections: 'TelemetryInternal'
155161

162+
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
163+
displayName: 'NuGet restore of packages'
164+
inputs:
165+
command: 'custom'
166+
arguments: 'restore dev\WindowsAppRuntime_Insights\packages.config -ConfigFile dev\WindowsAppRuntime_Insights\nuget.config -PackagesDirectory dev\WindowsAppRuntime_Insights\packages'
167+
156168
- template: AzurePipelinesTemplates\WindowsAppSDK-SetupBuildEnvironment-Steps.yml
157169

158170
- task: PowerShell@2
159171
name: BuildBinaries
160172
inputs:
161-
filePath: 'BuildTransportPackage.ps1'
173+
filePath: 'BuildAll.ps1'
162174
arguments: -AzureBuildStep "BuildAnyCPU"
163175

164176
- ${{ if eq(parameters.RunSDLBinaryAnalysis, 'true') }}:
@@ -216,6 +228,12 @@ jobs:
216228
inputs:
217229
nuGetServiceConnections: 'TelemetryInternal'
218230

231+
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
232+
displayName: 'NuGet restore of packages'
233+
inputs:
234+
command: 'custom'
235+
arguments: 'restore dev\WindowsAppRuntime_Insights\packages.config -ConfigFile dev\WindowsAppRuntime_Insights\nuget.config -PackagesDirectory dev\WindowsAppRuntime_Insights\packages'
236+
219237
- template: AzurePipelinesTemplates\WindowsAppSDK-BuildAndTestMRT-Steps.yml
220238

221239
- ${{ if eq(parameters.RunSDLBinaryAnalysis, 'true') }}:
@@ -265,7 +283,7 @@ jobs:
265283
- task: PowerShell@2
266284
name: StageFiles
267285
inputs:
268-
filePath: 'BuildTransportPackage.ps1'
286+
filePath: 'BuildAll.ps1'
269287
arguments: -Platform "x86,x64,arm64" -Configuration "release" -AzureBuildStep "StageFiles"
270288

271289
- task: EsrpCodeSigning@1
@@ -376,7 +394,7 @@ jobs:
376394
- task: PowerShell@2
377395
name: PackNuget
378396
inputs:
379-
filePath: 'BuildTransportPackage.ps1'
397+
filePath: 'BuildAll.ps1'
380398
arguments: -Platform "x64" -Configuration "release" -AzureBuildStep "PackNuget" -OutputDirectory "$(build.artifactStagingDirectory)\FullNuget" -PackageVersion "$(packageVersion)"
381399

382400
- task: EsrpCodeSigning@1

build/ProjectReunion-CI.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
- task: PowerShell@2
8989
name: BuildBinaries
9090
inputs:
91-
filePath: 'BuildTransportPackage.ps1'
91+
filePath: 'BuildAll.ps1'
9292
arguments: -Platform "$(buildPlatform)" -Configuration "$(buildConfiguration)" -AzureBuildStep "BuildBinaries"
9393

9494
- task: PublishBuildArtifacts@1
@@ -108,7 +108,7 @@ jobs:
108108
- task: PowerShell@2
109109
name: BuildBinaries
110110
inputs:
111-
filePath: 'BuildTransportPackage.ps1'
111+
filePath: 'BuildAll.ps1'
112112
arguments: -AzureBuildStep "BuildAnyCPU"
113113

114114
- task: PublishBuildArtifacts@1
@@ -167,7 +167,7 @@ jobs:
167167
- task: PowerShell@2
168168
name: StageFiles
169169
inputs:
170-
filePath: 'BuildTransportPackage.ps1'
170+
filePath: 'BuildAll.ps1'
171171
arguments: -Platform "x86,x64,arm64" -Configuration "release" -AzureBuildStep "StageFiles"
172172

173173
- task: PowerShell@2
@@ -192,7 +192,7 @@ jobs:
192192
- task: PowerShell@2
193193
name: PackNuget
194194
inputs:
195-
filePath: 'BuildTransportPackage.ps1'
195+
filePath: 'BuildAll.ps1'
196196
arguments: -Platform "x64" -Configuration "release" -AzureBuildStep "PackNuget" -OutputDirectory "$(build.artifactStagingDirectory)\FullNuget" -PackageVersion "$(packageVersion)"
197197

198198
- task: BinSkim@3

build_all.cmd

-18
This file was deleted.

0 commit comments

Comments
 (0)