Merge pull request #10936 from BruceForstall/TempRegApi
[platform/upstream/coreclr.git] / build-test.cmd
1 @if not defined _echo @echo off
2 setlocal EnableDelayedExpansion
3
4 :: Set the default arguments for build
5 set __BuildArch=x64
6 set __VCBuildArch=x86_amd64
7 set __BuildType=Debug
8 set __BuildOS=Windows_NT
9
10 :: Default to highest Visual Studio version available
11 ::
12 :: For VS2015 (and prior), only a single instance is allowed to be installed on a box
13 :: and VS140COMNTOOLS is set as a global environment variable by the installer. This
14 :: allows users to locate where the instance of VS2015 is installed.
15 ::
16 :: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS
17 :: is no longer set as a global environment variable and is instead only set if the user
18 :: has launched the VS2017 Developer Command Prompt.
19 ::
20 :: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is
21 :: set, as this indicates the user is running from the VS2017 Developer Command Prompt and
22 :: is already configured to use that toolset. Otherwise, we will fallback to using the VS2015
23 :: toolset if it is installed. Finally, we will fail the script if no supported VS instance
24 :: can be found.
25 if defined VS150COMNTOOLS (
26   set "__VSToolsRoot=%VS150COMNTOOLS%"
27   set "__VCToolsRoot=%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build"
28   set __VSVersion=vs2017
29 ) else (
30   set "__VSToolsRoot=%VS140COMNTOOLS%"
31   set "__VCToolsRoot=%VS140COMNTOOLS%\..\..\VC"
32   set __VSVersion=vs2015
33 )
34
35 :: Define a prefix for most output progress messages that come from this script. That makes
36 :: it easier to see where these are coming from. Note that there is a trailing space here.
37 set __MsgPrefix=BUILDTEST: 
38
39 set "__ProjectDir=%~dp0"
40 :: remove trailing slash
41 if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
42 set "__TestDir=%__ProjectDir%\tests"
43 set "__ProjectFilesDir=%__TestDir%"
44 set "__SourceDir=%__ProjectDir%\src"
45 set "__PackagesDir=%__ProjectDir%\packages"
46 set "__RootBinDir=%__ProjectDir%\bin"
47 set "__LogsDir=%__RootBinDir%\Logs"
48
49 :: Default __Exclude to issues.targets
50 set __Exclude=%__TestDir%\issues.targets
51
52 REM __unprocessedBuildArgs are args that we pass to msbuild (e.g. /p:__BuildArch=x64)
53 set "__args= %*"
54 set processedArgs=
55 set __unprocessedBuildArgs=
56 set __RunArgs=
57 set __BuildAgainstPackagesArg=
58 set __RuntimeId=
59 set __ZipTests=
60 set __TargetsWindows=1
61
62 :Arg_Loop
63 if "%1" == "" goto ArgsDone
64
65 if /i "%1" == "-?"    goto Usage
66 if /i "%1" == "-h"    goto Usage
67 if /i "%1" == "-help" goto Usage
68
69 if /i "%1" == "x64"                   (set __BuildArch=x64&set __VCBuildArch=x86_amd64&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
70 if /i "%1" == "x86"                   (set __BuildArch=x86&set __VCBuildArch=x86&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
71 if /i "%1" == "arm"                   (set __BuildArch=arm&set __VCBuildArch=x86_arm&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
72 if /i "%1" == "arm64"                 (set __BuildArch=arm64&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
73
74 if /i "%1" == "debug"                 (set __BuildType=Debug&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
75 if /i "%1" == "release"               (set __BuildType=Release&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
76 if /i "%1" == "checked"               (set __BuildType=Checked&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
77
78 if /i "%1" == "skipmanaged"           (set __SkipManaged=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
79 if /i "%1" == "updateinvalidpackages" (set __UpdateInvalidPackagesArg=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
80 if /i "%1" == "toolset_dir"           (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
81 if /i "%1" == "buildagainstpackages"  (set __ZipTests=1&set __BuildAgainstPackagesArg=-BuildTestsAgainstPackages&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
82 if /i "%1" == "ziptests"              (set __ZipTests=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
83 if /i "%1" == "runtimeid"             (set __RuntimeId=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
84 if /i "%1" == "targetsNonWindows"     (set __TargetsWindows=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
85 if /i "%1" == "Exclude"               (set __Exclude=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
86
87 if [!processedArgs!]==[] (
88   call set __UnprocessedBuildArgs=!__args!
89 ) else (
90   call set __UnprocessedBuildArgs=%%__args:*!processedArgs!=%%
91 )
92
93 :ArgsDone
94
95 if defined __BuildAgainstPackagesArg (
96     if not defined __RuntimeID (
97         echo %__MsgPrefix%Error: When building against packages, you must supply a target Runtime ID.
98         exit /b 1
99     )
100 )
101
102 echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\VsDevCmd.bat"
103 call                                 "%__VSToolsRoot%\VsDevCmd.bat"
104
105 set __RunArgs=-BuildOS=%__BuildOS% -BuildType=%__BuildType% -BuildArch=%__BuildArch%
106
107 rem arm64 builds currently use private toolset which has not been released yet
108 REM TODO, remove once the toolset is open.
109 if /i "%__BuildArch%" == "arm64" call :PrivateToolSet
110
111 echo %__MsgPrefix%Commencing CoreCLR repo test build
112
113 set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
114 set "__TestRootDir=%__RootBinDir%\tests"
115 set "__TestBinDir=%__TestRootDir%\%__BuildOS%.%__BuildArch%.%__BuildType%"
116 :: We have different managed and native intermediate dirs because the managed bits will include
117 :: the configuration information deeper in the intermediates path.
118 :: These variables are used by the msbuild project files.
119
120 if not defined __TestIntermediateDir (
121     set "__TestIntermediateDir=tests\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
122 )
123 set "__NativeTestIntermediatesDir=%__RootBinDir%\%__TestIntermediateDir%\Native"
124 set "__ManagedTestIntermediatesDir=%__RootBinDir%\%__TestIntermediateDir%\Managed"
125
126 :: Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
127 set "__CMakeBinDir=%__TestBinDir%"
128 set "__CMakeBinDir=%__CMakeBinDir:\=/%"
129
130 if not exist "%__TestBinDir%"                   md "%__TestBinDir%"
131 if not exist "%__NativeTestIntermediatesDir%"   md "%__NativeTestIntermediatesDir%"
132 if not exist "%__ManagedTestIntermediatesDir%"  md "%__ManagedTestIntermediatesDir%"
133 if not exist "%__LogsDir%"                      md "%__LogsDir%"
134
135 echo %__MsgPrefix%Checking prerequisites
136
137 :: Eval the output from probe-win1.ps1
138 for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& ""%__SourceDir%\pal\tools\probe-win.ps1"""') do %%a
139
140 REM =========================================================================================
141 REM ===
142 REM === Restore Build Tools
143 REM ===
144 REM =========================================================================================
145 call "%__ProjectDir%\init-tools.cmd"
146
147 REM =========================================================================================
148 REM ===
149 REM === Resolve runtime dependences
150 REM ===
151 REM =========================================================================================
152 call "%__TestDir%\setup-runtime-dependencies.cmd" /arch %__BuildArch% /outputdir %__BinDir%
153
154 if defined __UpdateInvalidPackagesArg (
155   goto skipnative
156 )
157
158 REM =========================================================================================
159 REM ===
160 REM === Native test build section
161 REM ===
162 REM =========================================================================================
163
164 echo %__MsgPrefix%Commencing build of native test components for %__BuildArch%/%__BuildType%
165
166 if defined __ToolsetDir (
167  echo %__MsgPrefix%ToolsetDir is defined to be :%__ToolsetDir%
168  goto GenVSSolution :: Private ToolSet is Defined
169 )
170
171 :: Set the environment for the native build
172 echo %__MsgPrefix%Using environment: "%__VCToolsRoot%\vcvarsall.bat" %__VCBuildArch%
173 call                                 "%__VCToolsRoot%\vcvarsall.bat" %__VCBuildArch%
174 @if defined _echo @echo on
175
176 if not defined VSINSTALLDIR (
177     echo %__MsgPrefix%Error: VSINSTALLDIR variable not defined.
178     exit /b 1
179 )
180 if not exist "%VSINSTALLDIR%DIA SDK" goto NoDIA
181
182 :GenVSSolution
183
184 pushd "%__NativeTestIntermediatesDir%"
185 call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" ""%__ProjectFilesDir%"" %__VSVersion% %__BuildArch%
186 @if defined _echo @echo on
187 popd
188
189 if not exist "%__NativeTestIntermediatesDir%\install.vcxproj" (
190     echo %__MsgPrefix%Failed to generate test native component build project!
191     exit /b 1
192 )
193
194 set __msbuildNativeArgs=-configuration=%__BuildType%
195
196 if defined __ToolsetDir (
197     set __msbuildNativeArgs=%__msbuildNativeArgs% -UseEnv
198 ) else (
199     set __msbuildNativeArgs=%__msbuildNativeArgs% -platform=%__BuildArch%
200 )
201
202 set __BuildLogRootName=Tests_Native
203 set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
204 set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
205 set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
206 set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
207 set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
208 set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
209
210 call "%__ProjectDir%\run.cmd" build -Project="%__NativeTestIntermediatesDir%\install.vcxproj" -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__msbuildNativeArgs% %__RunArgs% %__unprocessedBuildArgs%
211 if errorlevel 1 (
212     echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
213     echo     %__BuildLog%
214     echo     %__BuildWrn%
215     echo     %__BuildErr%
216     exit /b 1
217 )
218
219 :skipnative
220
221 set __BuildLogRootName=Restore_Product
222 set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
223 set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
224 set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
225 set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
226 set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
227 set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
228
229 set "__TestWorkingDir=%__RootBinDir%\tests\%__BuildOS%.%__BuildArch%.%__BuildType%"
230
231 if not defined __BuildAgainstPackagesArg goto SkipRestoreProduct
232 REM =========================================================================================
233 REM ===
234 REM === Restore product binaries from packages
235 REM ===
236 REM =========================================================================================
237
238 if not defined XunitTestBinBase       set  XunitTestBinBase=%__TestWorkingDir%
239 set "CORE_ROOT=%XunitTestBinBase%\Tests\Core_Root"
240
241 call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj  -UpdateDependencies -BatchRestorePackages -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs%
242
243 set __BuildLogRootName=Tests_GenerateRuntimeLayout
244
245 call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\runtest.proj -BinPlaceRef -BinPlaceProduct -CopyCrossgenToProduct -RuntimeId="%__RuntimeId%" -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs%
246 if errorlevel 1 (
247     echo BinPlace of mscorlib.dll failed
248     exit /b 1
249 )
250
251 echo %__MsgPrefix% Restored CoreCLR product from packages
252
253 :SkipRestoreProduct
254
255 if defined __SkipManaged exit /b 0
256
257 set __BuildLogRootName=Tests_Managed
258 set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
259 set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
260 set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
261 set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
262 set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
263 set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
264
265 REM =========================================================================================
266 REM ===
267 REM === Managed test build section
268 REM ===
269 REM =========================================================================================
270
271 echo %__MsgPrefix%Starting the Managed Tests Build
272
273 if not defined VSINSTALLDIR (
274     echo %__MsgPrefix%Error: buildtest.cmd should be run from a Visual Studio Command Prompt.  Please see https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md for build instructions.
275     exit /b 1
276 )
277
278 if defined __UpdateInvalidPackagesArg (
279   set __up=-updateinvalidpackageversions
280 )
281
282 call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__up% %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs%
283 if errorlevel 1 (
284     echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
285     echo     %__BuildLog%
286     echo     %__BuildWrn%
287     echo     %__BuildErr%
288     exit /b 1
289 )
290
291 REM Prepare the Test Drop
292 REM Cleans any NI from the last run
293 powershell "Get-ChildItem -path %__TestWorkingDir% -Include '*.ni.*' -Recurse -Force | Remove-Item -force"
294 REM Cleans up any lock folder used for synchronization from last run
295 powershell "Get-ChildItem -path %__TestWorkingDir% -Include 'lock' -Recurse -Force |  where {$_.Attributes -eq 'Directory'}| Remove-Item -force -Recurse"
296
297 set CORE_ROOT=%__TestBinDir%\Tests\Core_Root
298 if exist "%CORE_ROOT%" rd /s /q "%CORE_ROOT%"
299 md "%CORE_ROOT%"
300 xcopy /s "%__BinDir%" "%CORE_ROOT%"
301
302 if defined __BuildAgainstPackagesArg ( 
303   if "%__TargetsWindows%"=="0" (
304
305     if not exist %__PackagesDir%\TestNativeBins (
306         echo %__MsgPrefix%Error: Ensure you have run sync.cmd -ab before building a non-Windows test overlay against packages
307         exit /b 1
308     )
309
310     for /R %__PackagesDir%\TestNativeBins\%__RuntimeId%\%__BuildType% %%f in (*.so) do copy %%f %CORE_ROOT%
311     for /R %__PackagesDir%\TestNativeBins\%__RuntimeId%\%__BuildType% %%f in (*.dylib) do copy %%f %CORE_ROOT%
312   )
313 )
314
315 echo %__MsgPrefix%Creating test wrappers...
316
317 set RuntimeIdArg=
318 set TargetsWindowsArg=
319
320 if defined __RuntimeId (
321     set RuntimeIdArg=-RuntimeID="%__RuntimeId%"
322 )
323
324 if "%__TargetsWindows%"=="1" (
325     set TargetsWindowsArg=-TargetsWindows=true
326 ) else if "%__TargetsWindows%"=="0" (
327     set TargetsWindowsArg=-TargetsWindows=false
328 )
329
330 set __BuildLogRootName=Tests_XunitWrapper
331 set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
332 set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
333 set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
334 set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
335 set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
336 set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
337
338 call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -BuildWrappers -MsBuildEventLogging=" " -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs% %TargetsWindowsArg%
339 if errorlevel 1 (
340     echo Xunit Wrapper build failed
341     exit /b 1
342 )
343
344 echo %__MsgPrefix%Creating test overlay...
345
346 set __BuildLogRootName=Tests_Overlay_Managed
347 set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
348 set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
349 set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
350 set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
351 set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
352 set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
353
354 call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -testOverlay -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %RuntimeIdArg% %__unprocessedBuildArgs%
355 if errorlevel 1 (
356     echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
357     echo     %__BuildLog%
358     echo     %__BuildWrn%
359     echo     %__BuildErr%
360     exit /b 1
361 )
362
363 if not defined __ZipTests goto SkipPrepForPublish
364
365 set __BuildLogRootName=Helix_Prep
366 set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
367 set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
368 set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
369 set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
370 set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
371 set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
372
373 REM =========================================================================================
374 REM ===
375 REM === Prep test binaries for Helix publishing
376 REM ===
377 REM =========================================================================================
378
379 call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\helixprep.proj  -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs% %RuntimeIdArg% %TargetsWindowsArg%
380
381 echo %__MsgPrefix% Prepped test binaries for publishing
382
383 :SkipPrepForPublish
384
385 REM =========================================================================================
386 REM ===
387 REM === All builds complete!
388 REM ===
389 REM =========================================================================================
390
391 echo %__MsgPrefix%Test build successful.
392 echo %__MsgPrefix%Test binaries are available at !__TestBinDir!
393 exit /b 0
394
395 :Usage
396 echo.
397 echo Usage:
398 echo     %0 [option1] [option2] ...
399 echo All arguments are optional. Options are case-insensitive. The options are:
400 echo.
401 echo. -? -h -help: view this message.
402 echo Build architecture: -buildArch: only x64 is currently allowed ^(default: x64^).
403 echo Build type: -buildType: one of Debug, Checked, Release ^(default: Debug^).
404 echo updateinvalidpackageversions: Runs the target to update package versions.
405 echo buildagainstpackages: builds tests against restored packages, instead of against a built product.
406 echo runtimeid ^<ID^>: Builds a test overlay for the specified OS (Only supported when building against packages). Supported IDs are:
407 echo     alpine.3.4.3-x64: Builds overlay for Alpine 3.4.3
408 echo     debian.8-x64: Builds overlay for Debian 8
409 echo     fedora.24-x64: Builds overlay for Fedora 24
410 echo     linux-x64: Builds overlay for portable linux
411 echo     opensuse.42.1-x64: Builds overlay for OpenSUSE 42.1
412 echo     osx.10.12-x64: Builds overlay for OSX 10.12
413 echo     osx-x64: Builds overlay for portable OSX
414 echo     rhel.7-x64: Builds overlay for RHEL 7 or CentOS
415 echo     ubuntu.14.04-x64: Builds overlay for Ubuntu 14.04
416 echo     ubuntu.16.04-x64: Builds overlay for Ubuntu 16.04
417 echo     ubuntu.16.10-x64: Builds overlay for Ubuntu 16.10
418 echo     win-x64: Builds overlay for portable Windows
419 echo     win7-x64: Builds overlay for Windows 7
420 echo ziptests: zips CoreCLR tests & Core_Root for a Helix run
421 echo Exclude- Optional parameter - specify location of default exclusion file (defaults to tests\issues.targets if not specified)
422 echo     Set to "" to disable default exclusion file.
423 echo -- ... : all arguments following this tag will be passed directly to msbuild.
424 echo -priority=^<N^> : specify a set of test that will be built and run, with priority N.
425 echo     0: Build only priority 0 cases as essential testcases (default)
426 echo     1: Build all tests with priority 0 and 1
427 echo     666: Build all tests with priority 0, 1 ... 666
428 echo -sequential: force a non-parallel build ^(default is to build in parallel
429 echo     using all processors^).
430 echo -ilasmroundtrip: enables ilasm round trip build and run of the tests before executing them.
431 echo -verbose: enables detailed file logging for the msbuild tasks into the msbuild log file.
432 exit /b 1
433
434 :NoDIA
435 echo Error: DIA SDK is missing at "%VSINSTALLDIR%DIA SDK". ^
436 This is due to a bug in the Visual Studio installer. It does not install DIA SDK at "%VSINSTALLDIR%" but rather ^
437 at the install location of previous Visual Studio version. The workaround is to copy the DIA SDK folder from the Visual Studio install location ^
438 of the previous version to "%VSINSTALLDIR%" and then build.
439 :: DIA SDK not included in Express editions
440 echo Visual Studio Express does not include the DIA SDK. ^
441 You need Visual Studio 2015 or 2017 (Community is free).
442 echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites
443 exit /b 1
444
445
446 :PrivateToolSet
447
448 echo %__MsgPrefix% Setting Up the usage of __ToolsetDir:%__ToolsetDir%
449
450 if /i "%__ToolsetDir%" == "" (
451     echo %__MsgPrefix%Error: A toolset directory is required for the Arm64 Windows build. Use the toolset_dir argument.
452     exit /b 1
453 )
454
455 set PATH=%__ToolsetDir%\VC_sdk\bin;%PATH%
456 set LIB=%__ToolsetDir%\VC_sdk\lib\arm64;%__ToolsetDir%\sdpublic\sdk\lib\arm64
457 set INCLUDE=^
458 %__ToolsetDir%\VC_sdk\inc;^
459 %__ToolsetDir%\sdpublic\sdk\inc;^
460 %__ToolsetDir%\sdpublic\shared\inc;^
461 %__ToolsetDir%\sdpublic\shared\inc\minwin;^
462 %__ToolsetDir%\sdpublic\sdk\inc\ucrt;^
463 %__ToolsetDir%\sdpublic\sdk\inc\minwin;^
464 %__ToolsetDir%\sdpublic\sdk\inc\mincore;^
465 %__ToolsetDir%\sdpublic\sdk\inc\abi;^
466 %__ToolsetDir%\sdpublic\sdk\inc\clientcore;^
467 %__ToolsetDir%\diasdk\include
468 exit /b 0