@@ -2550,8 +2550,8 @@ Constants.allScenarios.each { scenario ->
25502550 }
25512551
25522552 // If we are running a stress mode, we'll set those variables as well
2553- def stressValues = null
25542553 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
2554+ def stressValues = null
25552555 if (isJitStressScenario(scenario)) {
25562556 stressValues = Constants . jitStressModeScenarios[scenario]
25572557 }
@@ -2565,9 +2565,34 @@ Constants.allScenarios.each { scenario ->
25652565 }
25662566
25672567 if (isR2RScenario(scenario)) {
2568- addEnvVariable(" RunCrossGen" , " true" )
2568+ // Crossgen the framework assemblies.
2569+ buildCommands + = """
2570+ for %%F in (%CORE_ROOT%\\ *.dll) do call :PrecompileAssembly "%CORE_ROOT%" "%%F" %%~nxF
2571+ goto skip_PrecompileAssembly
2572+
2573+ :PrecompileAssembly
2574+ REM Skip mscorlib since it is already precompiled.
2575+ if /I "%3" == "mscorlib.dll" exit /b 0
2576+ if /I "%3" == "mscorlib.ni.dll" exit /b 0
2577+
2578+ "%CORE_ROOT%\\ crossgen.exe" /Platform_Assemblies_Paths "%CORE_ROOT%" "%2" >nul 2>nul
2579+ if "%errorlevel%" == "-2146230517" (
2580+ echo %2 is not a managed assembly.
2581+ ) else if "%errorlevel%" == "-2146234344" (
2582+ echo %2 is not a managed assembly.
2583+ ) else if %errorlevel% neq 0 (
2584+ echo Unable to precompile %2
2585+ ) else (
2586+ echo Precompiled %2
2587+ )
2588+ exit /b 0
25692589
2570- // TODO: crossgen the framework assemblies
2590+ :skip_PrecompileAssembly
2591+ """
2592+
2593+ // Set RunCrossGen variable to cause test wrappers to invoke their logic to run
2594+ // crossgen on tests before running them.
2595+ addEnvVariable(" RunCrossGen" , " true" )
25712596 }
25722597
25732598 // Create the smarty command
0 commit comments