@@ -77,14 +77,27 @@ write-host "VCToolsInstallDir: $VCToolsInstallDir"
7777$msBuildPath = " $VCToolsInstallDir \MSBuild\Current\Bin\msbuild.exe"
7878write-host " msBuildPath: $msBuildPath "
7979
80-
8180# Generate overrides
8281# Make sure override directory exists.
8382if (-not (test-path " $buildOverridePath " ))
8483{
8584 new-item - path " $buildOverridePath " - itemtype " directory"
8685}
8786
87+ function NugetRestore ([string ] $Label , [string ] $Target )
88+ {
89+ if ($AzureBuildStep -ne " all" )
90+ {
91+ $env: NUGET_RESTORE_MSBUILD_ARGS = " /binaryLogger:BuildOutput\binlogs\$Label .restore.$Platform .$Configuration .binlog /p:Platform=$Platform /p:Configuration=$Configuration "
92+ }
93+ & .\.nuget\nuget.exe restore $Target - configfile NuGet.config
94+ if ($lastexitcode -ne 0 )
95+ {
96+ write-host " ERROR: nuget.exe restore $Label FAILED."
97+ exit 1
98+ }
99+ }
100+
88101Try {
89102 $WindowsAppSDKBuildPipeline = 0
90103 $WindowsAppSDKVersionProperty = " "
@@ -110,34 +123,23 @@ Try {
110123 # If $AzureBuildStep is not "all", that means we are in the pipeline
111124 $WindowsAppSDKBuildPipeline = 1
112125 }
113- # PreFastSetup is specifically for use when preparing for PREFast scans. It triggers the same actions below as BuildBinaries or BuildMRT, except
126+ # PreFastSetup is specifically for use when preparing for PREFast scans. It triggers the same actions below as BuildFoundation or BuildMRT, except
114127 # PreFastSetup stops short of calling msBuild.exe to build the target, which the Guardian:PREFast task does _not_ support, so the caller of this
115128 # script needs to resort to calling the MSBuild/VSBuild task later to build the target, which the Guardian:PREFast task does support. Structuring
116129 # the code this way allows minimally diveraging the flow while supporting building the target both via this script and the VSBuild/MSBuild task.
117- if (($AzureBuildStep -eq " all" ) -Or (($AzureBuildStep -eq " BuildBinaries " ) -Or ($AzureBuildStep -eq " BuildMRT" ) -Or ($AzureBuildStep -eq " PreFastSetup" )))
130+ if (($AzureBuildStep -eq " all" ) -Or (($AzureBuildStep -eq " BuildFoundation " ) -Or ($AzureBuildStep -eq " BuildMRT" ) -Or ($AzureBuildStep -eq " PreFastSetup" )))
118131 {
119- & .\.nuget\nuget.exe restore WindowsAppRuntime.sln - configfile NuGet.config
120-
121- if ($lastexitcode -ne 0 )
122- {
123- write-host " ERROR: restore WindowsAppRuntime.sln FAILED."
124- exit 1
125- }
126-
127- & .\.nuget\nuget.exe restore " dev\Bootstrap\CS\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj" - configfile NuGet.config
128-
129- if ($lastexitcode -ne 0 )
130- {
131- write-host " ERROR: restore Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj FAILED."
132- exit 1
133- }
132+ NugetRestore " WindowsAppRuntime" " WindowsAppRuntime.sln"
133+ NugetRestore " Microsoft.WindowsAppRuntime.Bootstrap.Net" " dev\Bootstrap\CS\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj"
134134
135135 $srcPath = Get-Childitem - Path ' dev\WindowsAppRuntime_Insights\packages' - File ' MicrosoftTelemetry.h' - Recurse
136136
137- if (($srcPath -ne $null )){
137+ if (($srcPath -ne $null ))
138+ {
138139 $destinationPaths = Get-Childitem - Path ' packages' - File ' Traceloggingconfig.h' - Recurse
139140
140- if (($destinationPaths -ne $null )) {
141+ if (($destinationPaths -ne $null ))
142+ {
141143 foreach ($destPath in $destinationPaths ) {
142144 Write-Host ' SourcePath:' $srcPath.FullName
143145 Write-Host ' DestinationPath:' $destPath.FullName
@@ -153,7 +155,7 @@ Try {
153155 }
154156 }
155157 # PreFastSetup intentionally skips the call to MSBuild.exe below.
156- if (($AzureBuildStep -eq " all" ) -Or ($AzureBuildStep -eq " BuildBinaries " ))
158+ if (($AzureBuildStep -eq " all" ) -Or ($AzureBuildStep -eq " BuildFoundation " ))
157159 {
158160 foreach ($configurationToRun in $configuration.Split (" ," ))
159161 {
@@ -163,15 +165,15 @@ Try {
163165 & $msBuildPath / restore `
164166 WindowsAppRuntime.sln `
165167 / p:Configuration= $configurationToRun , Platform= $platformToRun `
166- / binaryLogger:" BuildOutput/WindowsAppRuntime.$platformToRun .$configurationToRun .binlog" `
168+ / binaryLogger:" BuildOutput/binlogs/ WindowsAppRuntime.$platformToRun .$configurationToRun .binlog" `
167169 $WindowsAppSDKVersionProperty `
168170 / p:PGOBuildMode= $PGOBuildMode `
169171 / p:WindowsAppSDKCleanIntermediateFiles= true `
170172 / p:AppxSymbolPackageEnabled= false `
171173 / p:WindowsAppSDKBuildPipeline= $WindowsAppSDKBuildPipeline
172174 if ($lastexitcode -ne 0 )
173175 {
174- write-host " ERROR: msbuild.exe /restore WindowsAppRuntime.sln FAILED."
176+ write-host " ERROR: msbuild.exe WindowsAppRuntime.sln FAILED."
175177 exit 1
176178 }
177179 }
@@ -184,45 +186,11 @@ Try {
184186 # ------------------
185187
186188 # Restore packages from mrt.
187- & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\MrtCore.sln" - ConfigFile NuGet.config
188-
189- if ($lastexitcode -ne 0 )
190- {
191- write-host " ERROR: restore MrtCore.sln FAILED."
192- exit 1
193- }
194-
195- & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\Microsoft.Windows.ApplicationModel.Resources\src\packages.config" - ConfigFile NuGet.config
196-
197- if ($lastexitcode -ne 0 )
198- {
199- write-host " ERROR: restore Microsoft.Windows.ApplicationModel.Resources\src\packages.config FAILED."
200- exit 1
201- }
202-
203- & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\mrm\mrmex\packages.config" - ConfigFile NuGet.config
204-
205- if ($lastexitcode -ne 0 )
206- {
207- write-host " ERROR: restore mrm\mrmex\packages.config FAILED."
208- exit 1
209- }
210-
211- & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\mrm\mrmmin\packages.config" - ConfigFile NuGet.config
212-
213- if ($lastexitcode -ne 0 )
214- {
215- write-host " ERROR: restore mrmmin\packages.config FAILED."
216- exit 1
217- }
218-
219- & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\mrm\unittests\packages.config" - ConfigFile NuGet.config
220-
221- if ($lastexitcode -ne 0 )
222- {
223- write-host " ERROR: restore unittests\packages.config FAILED."
224- exit 1
225- }
189+ NugetRestore " MrtCore" " $MRTSourcesDirectory \mrt\MrtCore.sln"
190+ NugetRestore " Microsoft.Windows.ApplicationModel.Resources" " $MRTSourcesDirectory \mrt\Microsoft.Windows.ApplicationModel.Resources\src\packages.config"
191+ NugetRestore " mrmex" " $MRTSourcesDirectory \mrt\mrm\mrmex\packages.config"
192+ NugetRestore " mrmmin" " $MRTSourcesDirectory \mrt\mrm\mrmmin\packages.config"
193+ NugetRestore " unittests" " $MRTSourcesDirectory \mrt\mrm\unittests\packages.config"
226194
227195 # Init mrtcore
228196 foreach ($platformToRun in $platform.Split (" ," ))
@@ -247,11 +215,11 @@ Try {
247215 & $msBuildPath / restore " $MRTSourcesDirectory \mrt\MrtCore.sln" `
248216 / p:Configuration= $configurationToRun , Platform= $platformToRun `
249217 / p:PGOBuildMode= $PGOBuildMode `
250- / binaryLogger:" BuildOutput/mrtcore .$platformToRun .$configurationToRun .binlog"
218+ / binaryLogger:" BuildOutput/binlogs/MrtCore .$platformToRun .$configurationToRun .binlog"
251219
252220 if ($lastexitcode -ne 0 )
253221 {
254- write-host " ERROR: Building '$MRTSourcesDirectory \mrt\MrtCore.sln' FAILED."
222+ write-host " ERROR: msbuild.exe '$MRTSourcesDirectory \mrt\MrtCore.sln' FAILED."
255223 exit 1
256224 }
257225 }
@@ -263,11 +231,11 @@ Try {
263231 # ------------------
264232 # Build windowsAppRuntime.sln (anyCPU) and move output to staging.
265233 # ------------------
266- # build AnyCPU
234+ # build and restore AnyCPU
267235 & $msBuildPath / restore " dev\Bootstrap\CS\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj" / p:Configuration= $configurationForMrtAndAnyCPU , Platform= AnyCPU
268236 if ($lastexitcode -ne 0 )
269237 {
270- write-host " ERROR: msbuild restore Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj FAILED."
238+ write-host " ERROR: msbuild.exe Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj FAILED."
271239 exit 1
272240 }
273241 }
@@ -418,12 +386,6 @@ Try {
418386 exit 1
419387 }
420388 }
421- # if (($AzureBuildStep -eq "all") -Or ($AzureBuildStep -eq "BuildMock"))
422- # {
423- # $transportPackagepath = (Join-Path $OutputDirectory "Microsoft.WindowsAppSDK.Foundation.TransportPackage.$PackageVersion.nupkg")
424- # . eng\common\Scripts\buildMockWinAppSdkPackage.ps1 -TransportPackageName "Foundation" -TransportPackagePath $transportPackagepath -RepoRoot $env:Build_SourcesDirectory -Output $OutputDirectory -Platform $Platform -Configuration $Configuration -TransportPackageVersion $PackageVersion -CleanOutput
425- # }
426-
427389 $files = Get-ChildItem $OutputDirectory - File - Filter " *.nupkg"
428390 foreach ($file in $files )
429391 {
0 commit comments