@@ -11,10 +11,9 @@ UpdateVersionDetailsPath: Path to a ps1 or cmd that updates version.details.xml.
11
11
Clean: Performs a clean on BuildOutput, Obj, and build\override
12
12
13
13
Note about building in different environments.
14
- The feed the nuget .config points to changes depending on the branch.
14
+ The feed the NuGet .config points to changes depending on the branch.
15
15
Develop branch points to the internal feed.
16
16
Main branch points to the external feed.
17
-
18
17
#>
19
18
20
19
Param (
@@ -33,23 +32,24 @@ $buildOverridePath = "build\override"
33
32
$BasePath = " BuildOutput/FullNuget"
34
33
35
34
# FUTURE(YML2PS): Update build to no longer place generated files in sources directory
36
- if ($Clean )
35
+ if ($Clean )
37
36
{
38
37
$CleanTargets = @ (
39
38
" BuildOutput" ,
40
39
" obj" ,
40
+ " .user" ,
41
41
$buildOverridePath
42
42
)
43
-
43
+
44
44
foreach ($CleanTarget in $CleanTargets )
45
45
{
46
46
$CleanTargetPath = (Join-Path $env: Build_SourcesDirectory $CleanTarget )
47
-
47
+
48
48
if (Test-Path ($CleanTargetPath )) {
49
49
Remove-Item $CleanTargetPath - recurse
50
50
}
51
51
}
52
-
52
+
53
53
Exit
54
54
}
55
55
@@ -68,7 +68,7 @@ if(-not (test-path ".nuget\nuget.exe"))
68
68
$configurationForMrtAndAnyCPU = " Release"
69
69
$MRTSourcesDirectory = " dev\MRTCore"
70
70
71
- $VCToolsInstallDir = . " ${env: ProgramFiles(x86)} \Microsoft Visual Studio\Installer\vswhere.exe" - Latest - requires Microsoft.Component.MSBuild - property InstallationPath
71
+ $VCToolsInstallDir = . " ${env: ProgramFiles(x86)} \Microsoft Visual Studio\Installer\vswhere.exe" - Latest - prerelease - requires Microsoft.Component.MSBuild - property InstallationPath
72
72
write-host " VCToolsInstallDir: $VCToolsInstallDir "
73
73
74
74
$msBuildPath = " $VCToolsInstallDir \MSBuild\Current\Bin\msbuild.exe"
90
90
91
91
if ($AzureBuildStep -ne " all" )
92
92
{
93
- # Some builds have "-branchname" appended, but when this happens the environment variable
93
+ # Some builds have "-branchname" appended, but when this happens the environment variable
94
94
# TFS_BUILDNUMBER has the un-modified version.
95
95
if ($env: TFS_BUILDNUMBER )
96
96
{
@@ -100,19 +100,31 @@ Try {
100
100
$yymm = $env: BUILD_BUILDNUMBER.substring ($env: BUILD_BUILDNUMBER.length - 10 , 4 )
101
101
$dd = $env: BUILD_BUILDNUMBER.substring ($env: BUILD_BUILDNUMBER.length - 5 , 2 )
102
102
$revision = $env: BUILD_BUILDNUMBER.substring ($env: BUILD_BUILDNUMBER.length - 3 , 3 )
103
-
103
+
104
104
$WindowsAppSDKVersionProperty = " /p:WindowsAppSDKVersionBuild=$yymm /p:WindowsAppSDKVersionRevision=$dd$revision "
105
-
105
+
106
106
# If $AzureBuildStep is not "all", that means we are in the pipeline
107
107
$WindowsAppSDKBuildPipeline = 1
108
108
}
109
- if (($AzureBuildStep -eq " all" ) -Or (($AzureBuildStep -eq " BuildBinaries" ) -Or ($AzureBuildStep -eq " BuildMRT" )))
109
+ # PreFastSetup is specifically for use when preparing for PREFast scans. It triggers the same actions below as BuildBinaries or BuildMRT, except
110
+ # PreFastSetup stops short of calling msBuild.exe to build the target, which the Guardian:PREFast task does _not_ support, so the caller of this
111
+ # script needs to resort to calling the MSBuild/VSBuild task later to build the target, which the Guardian:PREFast task does support. Structuring
112
+ # the code this way allows minimally diveraging the flow while supporting building the target both via this script and the VSBuild/MSBuild task.
113
+ if (($AzureBuildStep -eq " all" ) -Or (($AzureBuildStep -eq " BuildBinaries" ) -Or ($AzureBuildStep -eq " BuildMRT" ) -Or ($AzureBuildStep -eq " PreFastSetup" )))
110
114
{
111
- & .\.nuget\nuget.exe restore WindowsAppRuntime.sln - configfile nuget.config
112
- & .\.nuget\nuget.exe restore " dev\Bootstrap\CS\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj" - configfile nuget.config
115
+ & .\.nuget\nuget.exe restore WindowsAppRuntime.sln - configfile NuGet.config
116
+
117
+ if ($lastexitcode -ne 0 )
118
+ {
119
+ write-host " ERROR: restore WindowsAppRuntime.sln FAILED."
120
+ exit 1
121
+ }
122
+
123
+ & .\.nuget\nuget.exe restore " dev\Bootstrap\CS\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj" - configfile NuGet.config
113
124
114
125
if ($lastexitcode -ne 0 )
115
126
{
127
+ write-host " ERROR: restore Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj FAILED."
116
128
exit 1
117
129
}
118
130
@@ -132,10 +144,12 @@ Try {
132
144
133
145
if ($lastexitcode -ne 0 )
134
146
{
147
+ write-host " ERROR: Copy-Item -Force $srcPath .FullName $destPath .FullName FAILED."
135
148
exit 1
136
149
}
137
150
}
138
- if (($AzureBuildStep -eq " all" ) -Or ($AzureBuildStep -eq " BuildBinaries" ))
151
+ # PreFastSetup intentionally skips the call to MSBuild.exe below.
152
+ if (($AzureBuildStep -eq " all" ) -Or ($AzureBuildStep -eq " BuildBinaries" ))
139
153
{
140
154
foreach ($configurationToRun in $configuration.Split (" ," ))
141
155
{
@@ -153,54 +167,94 @@ Try {
153
167
/ p:WindowsAppSDKBuildPipeline= $WindowsAppSDKBuildPipeline
154
168
if ($lastexitcode -ne 0 )
155
169
{
170
+ write-host " ERROR: msbuild.exe /restore WindowsAppRuntime.sln FAILED."
156
171
exit 1
157
172
}
158
173
}
159
174
}
160
175
}
161
- if (($AzureBuildStep -eq " all" ) -Or ($AzureBuildStep -eq " BuildMRT" ))
176
+ if (($AzureBuildStep -eq " all" ) -Or ($AzureBuildStep -eq " BuildMRT" ) -Or ( $AzureBuildStep -eq " PreFastSetup " ))
162
177
{
163
178
# ------------------
164
179
# Build mrtcore.sln and move output to staging.
165
180
# ------------------
166
181
167
182
# Restore packages from mrt.
168
- & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\MrtCore.sln" - ConfigFile nuget.config
169
- & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\Microsoft.Windows.ApplicationModel.Resources\src\packages.config" - ConfigFile nuget.config
170
- & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\mrm\mrmex\packages.config" - ConfigFile nuget.config
171
- & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\mrm\mrmmin\packages.config" - ConfigFile nuget.config
172
- & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\mrm\unittests\packages.config" - ConfigFile nuget.config
183
+ & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\MrtCore.sln" - ConfigFile NuGet.config
184
+
185
+ if ($lastexitcode -ne 0 )
186
+ {
187
+ write-host " ERROR: restore MrtCore.sln FAILED."
188
+ exit 1
189
+ }
190
+
191
+ & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\Microsoft.Windows.ApplicationModel.Resources\src\packages.config" - ConfigFile NuGet.config
192
+
193
+ if ($lastexitcode -ne 0 )
194
+ {
195
+ write-host " ERROR: restore Microsoft.Windows.ApplicationModel.Resources\src\packages.config FAILED."
196
+ exit 1
197
+ }
198
+
199
+ & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\mrm\mrmex\packages.config" - ConfigFile NuGet.config
200
+
201
+ if ($lastexitcode -ne 0 )
202
+ {
203
+ write-host " ERROR: restore mrm\mrmex\packages.config FAILED."
204
+ exit 1
205
+ }
206
+
207
+ & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\mrm\mrmmin\packages.config" - ConfigFile NuGet.config
208
+
209
+ if ($lastexitcode -ne 0 )
210
+ {
211
+ write-host " ERROR: restore mrmmin\packages.config FAILED."
212
+ exit 1
213
+ }
214
+
215
+ & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\mrm\unittests\packages.config" - ConfigFile NuGet.config
173
216
174
217
if ($lastexitcode -ne 0 )
175
218
{
219
+ write-host " ERROR: restore unittests\packages.config FAILED."
176
220
exit 1
177
221
}
178
222
179
223
# Init mrtcore
180
224
foreach ($platformToRun in $platform.Split (" ," ))
181
225
{
182
226
& $MRTSourcesDirectory \build\init.cmd / envonly $platformToRun \fre
227
+
228
+ if ($lastexitcode -ne 0 )
229
+ {
230
+ write-host " ERROR: init.cmd /envonly $platformToRun \fre FAILED."
231
+ }
183
232
}
184
233
185
- # Build mrt core .
186
- foreach ( $configurationToRun in $configuration .Split ( " , " ))
234
+ # PreFastSetup intentionally skips the call to MSBuild.exe below .
235
+ if (( $AzureBuildStep -eq " all " ) -Or ( $AzureBuildStep -eq " BuildMRT " ))
187
236
{
188
- foreach ($platformToRun in $platform.Split (" ," ))
237
+ # Build mrt core.
238
+ foreach ($configurationToRun in $configuration.Split (" ," ))
189
239
{
190
- write-host " Building MrtCore.sln for configuration $configurationToRun and platform:$platformToRun "
191
- & $msBuildPath / restore " $MRTSourcesDirectory \mrt\MrtCore.sln" `
192
- / p:Configuration= $configurationToRun , Platform= $platformToRun `
193
- / p:PGOBuildMode= $PGOBuildMode `
194
- / binaryLogger:" BuildOutput/mrtcore.$platformToRun .$configurationToRun .binlog"
195
-
196
- if ($lastexitcode -ne 0 )
240
+ foreach ($platformToRun in $platform.Split (" ," ))
197
241
{
198
- exit 1
242
+ write-host " Building MrtCore.sln for configuration $configurationToRun and platform:$platformToRun "
243
+ & $msBuildPath / restore " $MRTSourcesDirectory \mrt\MrtCore.sln" `
244
+ / p:Configuration= $configurationToRun , Platform= $platformToRun `
245
+ / p:PGOBuildMode= $PGOBuildMode `
246
+ / binaryLogger:" BuildOutput/mrtcore.$platformToRun .$configurationToRun .binlog"
247
+
248
+ if ($lastexitcode -ne 0 )
249
+ {
250
+ write-host " ERROR: msbuild restore '$MRTSourcesDirectory \mrt\MrtCore.sln' FAILED."
251
+ exit 1
252
+ }
199
253
}
200
254
}
201
255
}
202
256
}
203
- if (($AzureBuildStep -eq " all" ) -Or ($AzureBuildStep -eq " BuildAnyCPU" ))
257
+ if (($AzureBuildStep -eq " all" ) -Or ($AzureBuildStep -eq " BuildAnyCPU" ))
204
258
{
205
259
# ------------------
206
260
# Build windowsAppRuntime.sln (anyCPU) and move output to staging.
@@ -209,16 +263,17 @@ Try {
209
263
& $msBuildPath / restore " dev\Bootstrap\CS\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj" / p:Configuration= $configurationForMrtAndAnyCPU , Platform= AnyCPU
210
264
if ($lastexitcode -ne 0 )
211
265
{
266
+ write-host " ERROR: msbuild restore Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj FAILED."
212
267
exit 1
213
268
}
214
269
}
215
- if (($AzureBuildStep -eq " all" ) -Or ($AzureBuildStep -eq " StageFiles" ))
270
+ if (($AzureBuildStep -eq " all" ) -Or ($AzureBuildStep -eq " StageFiles" ))
216
271
{
217
272
# ------------------
218
273
# Stage files for Packing
219
- # ------------------
274
+ # ------------------
220
275
if (-not (test-path " $BasePath " ))
221
- {
276
+ {
222
277
new-item - path " $BasePath " - itemtype " directory"
223
278
}
224
279
@@ -235,6 +290,7 @@ Try {
235
290
.\build\CopyFilesToStagingDir.ps1 - BuildOutputDir ' BuildOutput' - OverrideDir " $buildOverridePath " - PublishDir " $windowsAppSdkBinariesPath " - NugetDir " $BasePath " - Platform $PlatformToRun - Configuration $ConfigurationToRun
236
291
if ($lastexitcode -ne 0 )
237
292
{
293
+ write-host " ERROR: msCopyFilesToStagingDir.ps1 FAILED."
238
294
exit 1
239
295
}
240
296
}
@@ -267,7 +323,7 @@ Try {
267
323
Copy-Item - path " BuildOutput\$configurationForMrtAndAnyCPU \$platformToRun \mrm\MRM.pdb" - destination " $BasePath \runtimes\win10-$platformToRun \native" - force
268
324
Copy-Item - path " BuildOutput\$configurationForMrtAndAnyCPU \$platformToRun \Microsoft.Windows.ApplicationModel.Resources\Microsoft.Windows.ApplicationModel.Resources.pdb" - destination " $BasePath \runtimes\win10-$platformToRun \native" - force
269
325
Copy-Item - path " BuildOutput\$configurationForMrtAndAnyCPU \$platformToRun \Microsoft.Windows.ApplicationModel.Resources\Microsoft.Windows.ApplicationModel.Resources.dll" - destination " $BasePath \runtimes\win10-$platformToRun \native" - force
270
-
326
+
271
327
Copy-Item - path " BuildOutput\$configurationForMrtAndAnyCPU \$platformToRun \mrm\MRM.lib" - destination " $BasePath \lib\win10-$platformToRun " - force
272
328
273
329
if ($platformToRun -eq " x86" )
@@ -302,10 +358,18 @@ Try {
302
358
# ------------------
303
359
304
360
Copy-Item - Path " $nuSpecsPath \AppxManifest.xml" - Destination " $BasePath "
361
+
362
+ if ($lastexitcode -ne 0 )
363
+ {
364
+ write-host " ERROR: Copy-Item -Path AppxManifest.xml FAILED."
365
+ exit 1
366
+ }
367
+
305
368
Copy-Item - Path " LICENSE" - Destination " $BasePath " - force
306
369
307
370
if ($lastexitcode -ne 0 )
308
371
{
372
+ write-host " ERROR: Copy-Item -Path LICENSE FAILED."
309
373
exit 1
310
374
}
311
375
@@ -322,12 +386,13 @@ Try {
322
386
323
387
if ($lastexitcode -ne 0 )
324
388
{
389
+ write-host " ERROR: xslt.Transform FAILED."
325
390
exit 1
326
391
}
327
392
}
328
- if (($AzureBuildStep -eq " all" ) -Or ($AzureBuildStep -eq " PackNuget" ))
393
+ if (($AzureBuildStep -eq " all" ) -Or ($AzureBuildStep -eq " PackNuget" ))
329
394
{
330
- $nuspecPath = " BuildOutput\Microsoft.WindowsAppSDK.Foundation.nuspec"
395
+ $nuspecPath = " BuildOutput\Microsoft.WindowsAppSDK.Foundation.nuspec"
331
396
Copy-Item - Path " .\build\NuSpecs\Microsoft.WindowsAppSDK.Foundation.nuspec" - Destination $nuspecPath
332
397
333
398
# Add the version to the nuspec.
@@ -340,11 +405,12 @@ Try {
340
405
341
406
if ($lastexitcode -ne 0 )
342
407
{
408
+ write-host " ERROR: nuget.exe pack $nuspecPath FAILED."
343
409
exit 1
344
410
}
345
411
}
346
- }
347
- Catch
412
+ }
413
+ Catch
348
414
{
349
415
$formatstring = " `n {0}`n`n {1}`n`n "
350
416
$fields = $_ , $_.ScriptStackTrace
0 commit comments