@@ -58,6 +58,7 @@ set __BuildAgainstPackagesArg=
58
58
set __RuntimeId =
59
59
set __ZipTests =
60
60
set __TargetsWindows = 1
61
+ set __DoCrossgen =
61
62
62
63
:Arg_Loop
63
64
if " %1 " == " " goto ArgsDone
@@ -80,6 +81,7 @@ if /i "%1" == "updateinvalidpackages" (set __UpdateInvalidPackagesArg=1&set proc
80
81
if /i " %1 " == " toolset_dir" (set __ToolsetDir=%2 & set __PassThroughArgs=%__PassThroughArgs% %2 & set processedArgs=!processedArgs! %1 %2 & shift& shift& goto Arg_Loop)
81
82
if /i " %1 " == " buildagainstpackages" (set __ZipTests=1& set __BuildAgainstPackagesArg=-BuildTestsAgainstPackages& set processedArgs=!processedArgs! %1 & shift& goto Arg_Loop)
82
83
if /i " %1 " == " ziptests" (set __ZipTests=1& set processedArgs=!processedArgs! %1 & shift& goto Arg_Loop)
84
+ if /i " %1 " == " crossgen" (set __DoCrossgen=1& set processedArgs=!processedArgs! %1 & shift& goto Arg_Loop)
83
85
if /i " %1 " == " runtimeid" (set __RuntimeId=%2 & set processedArgs=!processedArgs! %1 %2 & shift& shift& goto Arg_Loop)
84
86
if /i " %1 " == " targetsNonWindows" (set __TargetsWindows=0& set processedArgs=!processedArgs! %1 & shift& goto Arg_Loop)
85
87
if /i " %1 " == " Exclude" (set __Exclude=%2 & set processedArgs=!processedArgs! %1 %2 & shift& shift& goto Arg_Loop)
@@ -295,9 +297,13 @@ REM Cleans up any lock folder used for synchronization from last run
295
297
powershell " Get-ChildItem -path %__TestWorkingDir% -Include 'lock' -Recurse -Force | where {$_.Attributes -eq 'Directory'}| Remove-Item -force -Recurse"
296
298
297
299
set CORE_ROOT = %__TestBinDir% \Tests\Core_Root
300
+ set CORE_ROOT_STAGE = %__TestBinDir% \Tests\Core_Root_Stage
298
301
if exist " %CORE_ROOT% " rd /s /q " %CORE_ROOT% "
302
+ if exist " %CORE_ROOT_STAGE% " rd /s /q " %CORE_ROOT_STAGE% "
299
303
md " %CORE_ROOT% "
300
- xcopy /s " %__BinDir% " " %CORE_ROOT% "
304
+ md " %CORE_ROOT_STAGE% "
305
+ xcopy /s " %__BinDir% " " %CORE_ROOT_STAGE% "
306
+
301
307
302
308
if defined __BuildAgainstPackagesArg (
303
309
if " %__TargetsWindows% " == " 0" (
@@ -307,8 +313,8 @@ if defined __BuildAgainstPackagesArg (
307
313
exit /b 1
308
314
)
309
315
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 %
316
+ for /R %__PackagesDir% \TestNativeBins\%__RuntimeId% \%__BuildType% %%f in (*.so) do copy %%f %CORE_ROOT_STAGE %
317
+ for /R %__PackagesDir% \TestNativeBins\%__RuntimeId% \%__BuildType% %%f in (*.dylib) do copy %%f %CORE_ROOT_STAGE %
312
318
)
313
319
)
314
320
@@ -360,6 +366,20 @@ if errorlevel 1 (
360
366
exit /b 1
361
367
)
362
368
369
+ xcopy /s /y " %CORE_ROOT_STAGE% " " %CORE_ROOT% "
370
+
371
+ set __CrossgenArg = " "
372
+ if defined __DoCrossgen (
373
+ set __CrossgenArg = " -Crossgen"
374
+ if " %__TargetsWindows% " == " 1" (
375
+ call :PrecompileFX
376
+ ) else (
377
+ echo " %__MsgPrefix% Crossgen only supported on Windows, for now"
378
+ )
379
+ )
380
+
381
+ rd /s /q " %CORE_ROOT_STAGE% "
382
+
363
383
if not defined __ZipTests goto SkipPrepForPublish
364
384
365
385
set __BuildLogRootName = Helix_Prep
@@ -376,7 +396,7 @@ REM === Prep test binaries for Helix publishing
376
396
REM ===
377
397
REM =========================================================================================
378
398
379
- call %__ProjectDir% \run.cmd build -Project=%__ProjectDir% \tests\helixprep.proj -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %RuntimeIdArg% %TargetsWindowsArg% %__unprocessedBuildArgs%
399
+ call %__ProjectDir% \run.cmd build -Project=%__ProjectDir% \tests\helixprep.proj -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %RuntimeIdArg% %TargetsWindowsArg% %__CrossgenArg% % __unprocessedBuildArgs%
380
400
381
401
echo %__MsgPrefix% Prepped test binaries for publishing
382
402
@@ -418,6 +438,7 @@ echo ubuntu.16.10-x64: Builds overlay for Ubuntu 16.10
418
438
echo win-x64: Builds overlay for portable Windows
419
439
echo win7-x64: Builds overlay for Windows 7
420
440
echo ziptests: zips CoreCLR tests & Core_Root for a Helix run
441
+ echo crossgen: Precompiles the framework managed assemblies
421
442
echo Exclude- Optional parameter - specify location of default exclusion file (defaults to tests\issues.targets if not specified)
422
443
echo Set to " " to disable default exclusion file.
423
444
echo -- ... : all arguments following this tag will be passed directly to msbuild.
@@ -466,3 +487,31 @@ set INCLUDE=^
466
487
%__ToolsetDir% \sdpublic\sdk\inc\clientcore;^
467
488
%__ToolsetDir% \diasdk\include
468
489
exit /b 0
490
+
491
+ :PrecompileFX
492
+ for %%F in (%CORE_ROOT% \*.dll) do call :PrecompileAssembly " %%F " %%~nF%%~xF
493
+ exit /b 0
494
+
495
+ REM Compile the managed assemblies in Core_ROOT before running the tests
496
+ :PrecompileAssembly
497
+
498
+ REM Skip mscorlib since it is already precompiled.
499
+ if /I " %2 " == " mscorlib.dll" exit /b 0
500
+ if /I " %2 " == " mscorlib.ni.dll" exit /b 0
501
+ REM don't precompile anything from CoreCLR
502
+ if /I exist %CORE_ROOT_STAGE% \%2 exit /b 0
503
+
504
+ " %CORE_ROOT_STAGE% \crossgen.exe" /Platform_Assemblies_Paths " %CORE_ROOT% " " %1 " > nul 2 > nul
505
+ set /a __exitCode = %errorlevel%
506
+ if " %__exitCode% " == " -2146230517" (
507
+ echo %2 is not a managed assembly.
508
+ exit /b 0
509
+ )
510
+
511
+ if %__exitCode% neq 0 (
512
+ echo Unable to precompile %2
513
+ exit /b 0
514
+ )
515
+
516
+ echo Successfully precompiled %2
517
+ exit /b 0
0 commit comments