@if not defined _echo @echo off
-setlocal EnableDelayedExpansion
-
-:: Set the default arguments for build
-set __BuildArch=x64
-set __VCBuildArch=x86_amd64
-set __BuildType=Debug
-set __BuildOS=Windows_NT
-
-set "__ProjectDir=%~dp0"
+setlocal EnableDelayedExpansion EnableExtensions
:: Define a prefix for most output progress messages that come from this script. That makes
:: it easier to see where these are coming from. Note that there is a trailing space here.
set "__MsgPrefix=BUILDTEST: "
-call "%__ProjectDir%"\setup_vs_tools.cmd
+echo %__MsgPrefix%Starting Build at %TIME%
+
+set __ThisScriptDir="%~dp0"
-REM setup_vs_tools.cmd will correctly echo error message.
+call "%__ThisScriptDir%"\setup_vs_tools.cmd
if NOT '%ERRORLEVEL%' == '0' exit /b 1
if defined VS150COMNTOOLS (
- set "__VSToolsRoot=%VS150COMNTOOLS%"
- set "__VCToolsRoot=%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build"
- set __VSVersion=vs2017
+ set "__VSToolsRoot=%VS150COMNTOOLS%"
+ set "__VCToolsRoot=%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build"
+ set __VSVersion=vs2017
) else (
- set "__VSToolsRoot=%VS140COMNTOOLS%"
- set "__VCToolsRoot=%VS140COMNTOOLS%\..\..\VC"
- set __VSVersion=vs2015
+ set "__VSToolsRoot=%VS140COMNTOOLS%"
+ set "__VCToolsRoot=%VS140COMNTOOLS%\..\..\VC"
+ set __VSVersion=vs2015
)
+:: Set the default arguments for build
+set __BuildArch=x64
+set __BuildType=Debug
+set __BuildOS=Windows_NT
+
+set "__ProjectDir=%~dp0"
:: remove trailing slash
if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
set "__TestDir=%__ProjectDir%\tests"
:: Default __Exclude to issues.targets
set __Exclude=%__TestDir%\issues.targets
-REM __unprocessedBuildArgs are args that we pass to msbuild (e.g. /p:__BuildArch=x64)
+REM __UnprocessedBuildArgs are args that we pass to msbuild (e.g. /p:__BuildArch=x64)
set "__args= %*"
set processedArgs=
-set __unprocessedBuildArgs=
+set __UnprocessedBuildArgs=
set __RunArgs=
+
set __BuildAgainstPackagesArg=
set __BuildAgainstPackagesMsbuildArg=
set __SkipRestorePackages=
@REM and allow the "-priority=1" syntax.
set __Priority=0
set __PriorityArg=
-set __PassThroughArg=
:Arg_Loop
if "%1" == "" goto ArgsDone
-if /i "%1" == "-?" goto Usage
-if /i "%1" == "-h" goto Usage
-if /i "%1" == "-help" goto Usage
+if /i "%1" == "/?" goto Usage
+if /i "%1" == "-?" goto Usage
+if /i "%1" == "/h" goto Usage
+if /i "%1" == "-h" goto Usage
+if /i "%1" == "/help" goto Usage
+if /i "%1" == "-help" goto Usage
+if /i "%1" == "--help" goto Usage
-if /i "%1" == "x64" (set __BuildArch=x64&set __VCBuildArch=x86_amd64&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "x86" (set __BuildArch=x86&set __VCBuildArch=x86&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "arm" (set __BuildArch=arm&set __VCBuildArch=x86_arm&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "arm64" (set __BuildArch=arm64&set __VCBuildArch=x86_arm64&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "x64" (set __BuildArch=x64&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "x86" (set __BuildArch=x86&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "arm" (set __BuildArch=arm&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "arm64" (set __BuildArch=arm64&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "debug" (set __BuildType=Debug&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "release" (set __BuildType=Release&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "targetsNonWindows" (set __TargetsWindows=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "Exclude" (set __Exclude=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
if /i "%1" == "-priority" (set __Priority=%2&shift&set processedArgs=!processedArgs! %1=%2&shift&goto Arg_Loop)
-if /i "%1" == "--" (set __PassThroughArg=%1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if [!processedArgs!]==[] (
- set __UnprocessedBuildArgs=%__args%
+ set __UnprocessedBuildArgs=%__args%
) else (
- set __UnprocessedBuildArgs=%__args%
- for %%t in (!processedArgs!) do (
- set __UnprocessedBuildArgs=!__UnprocessedBuildArgs:*%%t=!
- )
+ set __UnprocessedBuildArgs=%__args%
+ for %%t in (!processedArgs!) do (
+ set __UnprocessedBuildArgs=!__UnprocessedBuildArgs:*%%t=!
+ )
)
:ArgsDone
REM As we move from buildtools to arcade, __RunArgs should be replaced with __msbuildArgs
set __msbuildArgs=/p:__BuildOS=%__BuildOS% /p:__BuildType=%__BuildType% /p:__BuildArch=%__BuildArch%
-echo %__MsgPrefix%Commencing CoreCLR repo test build
+echo %__MsgPrefix%Commencing CoreCLR test build
set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__TestRootDir=%__RootBinDir%\tests"
set "__TestBinDir=%__TestRootDir%\%__BuildOS%.%__BuildArch%.%__BuildType%"
-:: We have different managed and native intermediate dirs because the managed bits will include
-:: the configuration information deeper in the intermediates path.
-:: These variables are used by the msbuild project files.
+
+REM We have different managed and native intermediate dirs because the managed bits will include
+REM the configuration information deeper in the intermediates path.
+REM These variables are used by the msbuild project files.
if not defined __TestIntermediateDir (
set "__TestIntermediateDir=tests\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__NativeTestIntermediatesDir=%__RootBinDir%\%__TestIntermediateDir%\Native"
set "__ManagedTestIntermediatesDir=%__RootBinDir%\%__TestIntermediateDir%\Managed"
-:: Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
+REM Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
set "__CMakeBinDir=%__TestBinDir%"
set "__CMakeBinDir=%__CMakeBinDir:\=/%"
echo %__MsgPrefix%Checking prerequisites
-:: Eval the output from probe-win1.ps1
+REM Eval the output from probe-win1.ps1
for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& ""%__SourceDir%\pal\tools\probe-win.ps1"""') do %%a
REM =========================================================================================
REM === Restore Build Tools
REM ===
REM =========================================================================================
+
call "%__ProjectDir%\init-tools.cmd"
@if defined _echo @echo on
+
set "__ToolsDir=%__ProjectDir%\Tools"
-set "__DotnetHost=%__ToolsDir%\dotnetcli\dotnet.exe"
-if not exist "%__DotnetHost%" (
- echo %__DotnetHost% not found after init-tools.
- exit /b 1
+set "DotNetCli=%__ToolsDir%\dotnetcli\dotnet.exe"
+if not exist "%DotNetCli%" (
+ echo %__MsgPrefix%"%DotNetCli%" not found after init-tools.
+ exit /b 1
)
REM =========================================================================================
call "%__TestDir%\setup-stress-dependencies.cmd" /arch %__BuildArch% /outputdir %__BinDir%
@if defined _echo @echo on
-if defined __SkipNative goto skipnative
-
REM =========================================================================================
REM ===
REM === Native test build section
REM ===
REM =========================================================================================
+if defined __SkipNative goto skipnative
+
echo %__MsgPrefix%Commencing build of native test components for %__BuildArch%/%__BuildType%
-:: Set the environment for the native build
+REM Set the environment for the native build
+set __VCBuildArch=x86_amd64
+if /i "%__BuildArch%" == "x86" ( set __VCBuildArch=x86 )
+if /i "%__BuildArch%" == "arm" ( set __VCBuildArch=x86_arm )
+if /i "%__BuildArch%" == "arm64" ( set __VCBuildArch=x86_arm64 )
+
echo %__MsgPrefix%Using environment: "%__VCToolsRoot%\vcvarsall.bat" %__VCBuildArch%
call "%__VCToolsRoot%\vcvarsall.bat" %__VCBuildArch%
@if defined _echo @echo on
set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
-set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
-set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
-set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
+set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
+set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
+set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
+set __Logging=-MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr!
-call "%__ProjectDir%\run.cmd" build -Project="%__NativeTestIntermediatesDir%\install.vcxproj" -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! -configuration=%__BuildType% -platform=%__BuildArch% %__RunArgs% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs%
+call "%__ProjectDir%\run.cmd" build -Project="%__NativeTestIntermediatesDir%\install.vcxproj" !__Logging! -configuration=%__BuildType% -platform=%__BuildArch% %__RunArgs% %__PriorityArg% %__UnprocessedBuildArgs%
if errorlevel 1 (
echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
echo %__BuildLog%
:skipnative
-set "__TestWorkingDir=%__RootBinDir%\tests\%__BuildOS%.%__BuildArch%.%__BuildType%"
-if "%__SkipRestorePackages%" == 1 goto SkipRestoreProduct
REM =========================================================================================
REM ===
REM === Restore product binaries from packages
REM ===
REM =========================================================================================
-if not defined XunitTestBinBase set XunitTestBinBase=%__TestWorkingDir%
+if "%__SkipRestorePackages%" == 1 goto SkipRestoreProduct
+
+echo %__MsgPrefix%Restoring CoreCLR product from packages
+
+if not defined XunitTestBinBase set XunitTestBinBase=%__TestBinDir%
set "CORE_ROOT=%XunitTestBinBase%\Tests\Core_Root"
set __BuildLogRootName=Restore_Product
set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
-set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
-set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
-set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
+set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
+set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
+set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
+set __Logging=-MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr!
-call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj -BatchRestorePackages -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs%
+call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj -BatchRestorePackages !__Logging! %__RunArgs% %__BuildAgainstPackagesArg% %__PriorityArg% %__UnprocessedBuildArgs%
if not defined __BuildAgainstPackagesArg goto SkipRestoreProduct
+
+echo %__MsgPrefix%BinPlacing CoreLib
+
set __BuildLogRootName=Tests_GenerateRuntimeLayout
set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
-set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
-set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
-set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
+set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
+set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
+set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
+set __Logging=-MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr!
-call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\runtest.proj -BinPlaceRef -BinPlaceProduct -CopyCrossgenToProduct -RuntimeId="%__RuntimeId%" -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs%
+call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\runtest.proj -BinPlaceRef -BinPlaceProduct -CopyCrossgenToProduct -RuntimeId="%__RuntimeId%" !__Logging! %__RunArgs% %__BuildAgainstPackagesArg% %__PriorityArg% %__UnprocessedBuildArgs%
if errorlevel 1 (
- echo BinPlace of mscorlib.dll failed
+ echo %__MsgPrefix%Error: BinPlace of mscorlib.dll failed. Refer to the build log files for details:
+ echo %__BuildLog%
+ echo %__BuildWrn%
+ echo %__BuildErr%
exit /b 1
)
-echo %__MsgPrefix% Restored CoreCLR product from packages
-
:SkipRestoreProduct
-if defined __SkipManaged goto SkipManagedBuild
-
REM =========================================================================================
REM ===
REM === Managed test build section
REM ===
REM =========================================================================================
+if defined __SkipManaged goto SkipManagedBuild
+
echo %__MsgPrefix%Starting the Managed Tests Build
if not defined VSINSTALLDIR (
for /l %%G in (1, 1, %__BuildLoopCount%) do (
- set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%";Append=!__AppendToLog!
- set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%";Append=!__AppendToLog!
- set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%";Append=!__AppendToLog!
+ set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%";Append=!__AppendToLog!
+ set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%";Append=!__AppendToLog!
+ set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%";Append=!__AppendToLog!
+ set __Logging=-MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr!
set TestBuildSlice=%%G
- call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs%
+ call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj !__Logging! %__RunArgs% %__BuildAgainstPackagesArg% %__PriorityArg% %__UnprocessedBuildArgs%
if errorlevel 1 (
echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
)
:SkipManagedBuild
-REM Prepare the Test Drop
-REM Cleans any NI from the last run
-powershell -NoProfile "Get-ChildItem -path %__TestWorkingDir% -Include '*.ni.*' -Recurse -Force | Remove-Item -force"
-REM Cleans up any lock folder used for synchronization from last run
-powershell -NoProfile "Get-ChildItem -path %__TestWorkingDir% -Include 'lock' -Recurse -Force | where {$_.Attributes -eq 'Directory'}| Remove-Item -force -Recurse"
+
+REM =========================================================================================
+REM ===
+REM === Prepare the test drop
+REM ===
+REM =========================================================================================
+
+echo %__MsgPrefix%Removing 'ni' files and 'lock' folders from %__TestBinDir%
+REM Remove any NI from previous runs.
+powershell -NoProfile "Get-ChildItem -path %__TestBinDir% -Include '*.ni.*' -Recurse -Force | Remove-Item -force"
+REM Remove any lock folder used for synchronization from previous runs.
+powershell -NoProfile "Get-ChildItem -path %__TestBinDir% -Include 'lock' -Recurse -Force | where {$_.Attributes -eq 'Directory'}| Remove-Item -force -Recurse"
set CORE_ROOT=%__TestBinDir%\Tests\Core_Root
set CORE_ROOT_STAGE=%__TestBinDir%\Tests\Core_Root_Stage
md "%CORE_ROOT_STAGE%"
xcopy "%__BinDir%" "%CORE_ROOT_STAGE%"
-
if defined __BuildAgainstPackagesArg (
- if "%__TargetsWindows%"=="0" (
+ if "%__TargetsWindows%"=="0" (
- if not exist %__PackagesDir%\TestNativeBins (
- echo %__MsgPrefix%Error: Ensure you have run sync.cmd -ab before building a non-Windows test overlay against packages
- exit /b 1
- )
+ if not exist %__PackagesDir%\TestNativeBins (
+ echo %__MsgPrefix%Error: Ensure you have run sync.cmd -ab before building a non-Windows test overlay against packages
+ exit /b 1
+ )
- for /R %__PackagesDir%\TestNativeBins\%__RuntimeId%\%__BuildType% %%f in (*.so) do copy %%f %CORE_ROOT_STAGE%
- for /R %__PackagesDir%\TestNativeBins\%__RuntimeId%\%__BuildType% %%f in (*.dylib) do copy %%f %CORE_ROOT_STAGE%
- )
+ for /R %__PackagesDir%\TestNativeBins\%__RuntimeId%\%__BuildType% %%f in (*.so) do copy %%f %CORE_ROOT_STAGE%
+ for /R %__PackagesDir%\TestNativeBins\%__RuntimeId%\%__BuildType% %%f in (*.dylib) do copy %%f %CORE_ROOT_STAGE%
+ )
)
REM =========================================================================================
REM ===
REM =========================================================================================
+echo %__MsgPrefix%Creating test overlay
+
set RuntimeIdArg=
if defined __RuntimeId (
set RuntimeIdArg=-RuntimeID="%__RuntimeId%"
set TargetsWindowsMsbuildArg=/p:TargetsWindows=false
)
-echo %__MsgPrefix%Creating test overlay...
-
set __BuildLogRootName=Tests_Overlay_Managed
set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
-set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
-set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
-set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
+set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
+set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
+set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
+set __Logging=-MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr!
-call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -testOverlay -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %RuntimeIdArg% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs%
+call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -testOverlay !__Logging! %__RunArgs% %RuntimeIdArg% %__PriorityArg% %__UnprocessedBuildArgs%
if errorlevel 1 (
echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
echo %__BuildLog%
xcopy /s /y "%CORE_ROOT_STAGE%" "%CORE_ROOT%"
-REM Create the test host necessary for running CoreFX tests
-REM The test host includes a dotnet executable, system libraries and CoreCLR assemblies found in CoreRoot
+REM =========================================================================================
+REM ===
+REM === Create the test host necessary for running CoreFX tests.
+REM === The test host includes a dotnet executable, system libraries and CoreCLR assemblies found in CORE_ROOT.
+REM ===
+REM =========================================================================================
+
+echo %__MsgPrefix%Building CoreFX test host
set __BuildLogRootName=Tests_CoreFX_Testhost
set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
-set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
-set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
-set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
+set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
+set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
+set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
+set __Logging=-MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr!
-call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -testHost -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %RuntimeIdArg% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs%
+call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -testHost !__Logging! %__RunArgs% %RuntimeIdArg% %__PriorityArg% %__UnprocessedBuildArgs%
if errorlevel 1 (
echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
echo %__BuildLog%
exit /b 1
)
+REM =========================================================================================
+REM ===
+REM === Create test wrappers.
+REM ===
+REM =========================================================================================
+
if defined __SkipManaged goto SkipBuildingWrappers
-echo %__MsgPrefix%Creating test wrappers...
+echo %__MsgPrefix%Creating test wrappers
set __BuildLogRootName=Tests_XunitWrapper
set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
-set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
-set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
-set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
+set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
+set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
+set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
+set __Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr!
REM Build wrappers using the local SDK's msbuild. As we move to arcade, the other builds should be moved away from run.exe as well.
-call %__DotnetHost% msbuild %__ProjectDir%\tests\runtest.proj /p:RestoreAdditionalProjectSources=https://dotnet.myget.org/F/dotnet-core/ /p:BuildWrappers=true !__msbuildLog! !__msbuildWrn! !__msbuildErr! %__msbuildArgs% %TargetsWindowsMsbuildArg% %__BuildAgainstPackagesMsbuildArg% %__unprocessedBuildArgs%
+call %DotNetCli% msbuild %__ProjectDir%\tests\runtest.proj /p:RestoreAdditionalProjectSources=https://dotnet.myget.org/F/dotnet-core/ /p:BuildWrappers=true !__Logging! %__msbuildArgs% %TargetsWindowsMsbuildArg% %__BuildAgainstPackagesMsbuildArg% %__UnprocessedBuildArgs%
if errorlevel 1 (
- echo Xunit Wrapper build failed
+ echo %__MsgPrefix%Error: Xunit wrapper build failed. Refer to the build log files for details:
+ echo %__BuildLog%
+ echo %__BuildWrn%
+ echo %__BuildErr%
exit /b 1
)
+
:SkipBuildingWrappers
+REM =========================================================================================
+REM ===
+REM === Crossgen assemblies if needed.
+REM ===
+REM =========================================================================================
+
set __CrossgenArg = ""
if defined __DoCrossgen (
- set __CrossgenArg="-Crossgen"
- if "%__TargetsWindows%" == "1" (
- call :PrecompileFX
- ) else (
- echo "%__MsgPrefix% Crossgen only supported on Windows, for now"
- )
+ set __CrossgenArg="-Crossgen"
+ if "%__TargetsWindows%" == "1" (
+ echo %__MsgPrefix%Running crossgen on framework assemblies
+ call :PrecompileFX
+ ) else (
+ echo "%__MsgPrefix%Crossgen only supported on Windows, for now"
+ )
)
rd /s /q "%CORE_ROOT_STAGE%"
+REM =========================================================================================
+REM ===
+REM === Prep test binaries for Helix publishing
+REM ===
+REM =========================================================================================
+
if not defined __ZipTests goto SkipPrepForPublish
+echo %__MsgPrefix%Preparing test binaries for Helix publishing
+
set __BuildLogRootName=Helix_Prep
set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
-set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
-set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
-set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
-
-REM =========================================================================================
-REM ===
-REM === Prep test binaries for Helix publishing
-REM ===
-REM =========================================================================================
+set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
+set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
+set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
+set __Logging=-MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr!
-call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\helixprep.proj -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %RuntimeIdArg% %TargetsWindowsArg% %__CrossgenArg% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs%
+call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\helixprep.proj !__Logging! %__RunArgs% %__BuildAgainstPackagesArg% %RuntimeIdArg% %TargetsWindowsArg% %__CrossgenArg% %__PriorityArg% %__UnprocessedBuildArgs%
if errorlevel 1 (
echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
echo %__BuildLog%
exit /b 1
)
-echo %__MsgPrefix% Prepped test binaries for publishing
-
:SkipPrepForPublish
REM =========================================================================================
REM ===
REM =========================================================================================
-echo %__MsgPrefix%Test build successful.
+echo %__MsgPrefix%Test build succeeded. Finished at %TIME%
echo %__MsgPrefix%Test binaries are available at !__TestBinDir!
exit /b 0
echo %0 [option1] [option2] ...
echo All arguments are optional. Options are case-insensitive. The options are:
echo.
-echo. -? -h -help: view this message.
+echo.-? -h -help --help: view this message.
echo Build architecture: one of x64, x86, arm, arm64 ^(default: x64^).
echo Build type: one of Debug, Checked, Release ^(default: Debug^).
echo skipmanaged: skip the managed tests build
echo targetsNonWindows:
echo Exclude- Optional parameter - specify location of default exclusion file ^(defaults to tests\issues.targets if not specified^)
echo Set to "" to disable default exclusion file.
-echo -- ... : all arguments following this tag will be passed directly to msbuild.
-echo -priority=^<N^> : specify a set of test that will be built and run, with priority N.
+echo -priority=^<N^> : specify a set of tests that will be built and run, with priority N.
echo 0: Build only priority 0 cases as essential testcases (default)
echo 1: Build all tests with priority 0 and 1
echo 666: Build all tests with priority 0, 1 ... 666
This is due to a bug in the Visual Studio installer. It does not install DIA SDK at "%VSINSTALLDIR%" but rather ^
at the install location of previous Visual Studio version. The workaround is to copy the DIA SDK folder from the Visual Studio install location ^
of the previous version to "%VSINSTALLDIR%" and then build.
-:: DIA SDK not included in Express editions
+REM DIA SDK not included in Express editions
echo Visual Studio Express does not include the DIA SDK. ^
You need Visual Studio 2015 or 2017 (Community is free).
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites
exit /b 0
)
-:: Delete original .dll & replace it with the Crossgened .dll
+REM Delete original .dll & replace it with the Crossgened .dll
del %1
ren "%CORE_ROOT%\temp.ni.dll" %2
set "__MsgPrefix=BUILD: "
echo %__MsgPrefix%Starting Build at %TIME%
+
set __ThisScriptFull="%~f0"
set __ThisScriptDir="%~dp0"
if NOT '%ERRORLEVEL%' == '0' exit /b 1
if defined VS150COMNTOOLS (
- set "__VSToolsRoot=%VS150COMNTOOLS%"
- set "__VCToolsRoot=%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build"
- set __VSVersion=vs2017
+ set "__VSToolsRoot=%VS150COMNTOOLS%"
+ set "__VCToolsRoot=%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build"
+ set __VSVersion=vs2017
) else (
- set "__VSToolsRoot=%VS140COMNTOOLS%"
- set "__VCToolsRoot=%VS140COMNTOOLS%\..\..\VC"
- set __VSVersion=vs2015
+ set "__VSToolsRoot=%VS140COMNTOOLS%"
+ set "__VCToolsRoot=%VS140COMNTOOLS%\..\..\VC"
+ set __VSVersion=vs2015
)
:: Work around Jenkins CI + msbuild problem: Jenkins sometimes creates very large environment
if [%__PackagesDir%]==[] set "__PackagesDir=%__ProjectDir%\packages"
set "__RootBinDir=%__ProjectDir%\bin"
set "__LogsDir=%__RootBinDir%\Logs"
-set "__PgoOptDataVersion="
-set "__IbcOptDataVersion="
set __BuildAll=
set __BuildCoreLib=1
set __BuildSOS=1
set __BuildNative=1
+set __BuildCrossArchNative=0
set __BuildTests=1
set __BuildPackages=1
set __BuildNativeCoreLib=1
set __RestoreOptData=1
set __GenerateLayout=0
set __CrossgenAltJit=
+set __CrossArch=
+set __SkipNugetPackage=0
+set __PgoOptDataVersion=
+set __IbcOptDataVersion=
@REM CMD has a nasty habit of eating "=" on the argument list, so passing:
@REM -priority=1
:Arg_Loop
if "%1" == "" goto ArgsDone
-if /i "%1" == "-?" goto Usage
-if /i "%1" == "-h" goto Usage
-if /i "%1" == "-help" goto Usage
+if /i "%1" == "/?" goto Usage
+if /i "%1" == "-?" goto Usage
+if /i "%1" == "/h" goto Usage
+if /i "%1" == "-h" goto Usage
+if /i "%1" == "/help" goto Usage
+if /i "%1" == "-help" goto Usage
if /i "%1" == "--help" goto Usage
-
if /i "%1" == "-all" (set __BuildAll=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-x64" (set __BuildArchX64=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-x86" (set __BuildArchX86=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "ibcinstrument" (set __IbcTuning=/Tuning&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if [!processedArgs!]==[] (
- set __UnprocessedBuildArgs=%__args%
+ set __UnprocessedBuildArgs=%__args%
) else (
- set __UnprocessedBuildArgs=%__args%
- for %%t in (!processedArgs!) do (
- set __UnprocessedBuildArgs=!__UnprocessedBuildArgs:*%%t=!
- )
+ set __UnprocessedBuildArgs=%__args%
+ for %%t in (!processedArgs!) do (
+ set __UnprocessedBuildArgs=!__UnprocessedBuildArgs:*%%t=!
+ )
)
:ArgsDone
set __UnprocessedBuildArgs=!__UnprocessedBuildArgs! -priority=%__Priority%
)
-if %__PgoOptimize%==0 set __RestoreOptData=0
-
if defined __BuildAll goto BuildAll
set /A __TotalSpecifiedBuildArch=__BuildArchX64 + __BuildArchX86 + __BuildArchArm + __BuildArchArm64
)
)
-REM Determine if this is a cross-arch build
+REM Determine if this is a cross-arch build. Only do cross-arch build if we're also building native.
-if /i "%__BuildArch%"=="arm64" (
- set __DoCrossArchBuild=1
+if %__BuildNative% EQU 1 (
+ if /i "%__BuildArch%"=="arm64" (
+ set __BuildCrossArchNative=1
)
-
-if /i "%__BuildArch%"=="arm" (
- set __DoCrossArchBuild=1
+ if /i "%__BuildArch%"=="arm" (
+ set __BuildCrossArchNative=1
)
+)
+
+REM Set the remaining variables based upon the determined build configuration
+
+if %__PgoOptimize%==0 set __RestoreOptData=0
+if /i %__BuildType% NEQ Release set __RestoreOptData=0
+
+REM REVIEW: why no System.Private.CoreLib NuGet package build for ARM64?
+if /i "%__BuildArch%"=="arm64" set __SkipNugetPackage=0
-:: Set the remaining variables based upon the determined build configuration
set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__IntermediatesDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
if "%__NMakeMakefiles%"=="1" (set "__IntermediatesDir=%__RootBinDir%\nmakeobj\%__BuildOS%.%__BuildArch%.%__BuildType%")
set "__PackagesBinDir=%__BinDir%\.nuget"
-set "__TestRootDir=%__RootBinDir%\tests"
-set "__TestBinDir=%__TestRootDir%\%__BuildOS%.%__BuildArch%.%__BuildType%"
-set "__TestIntermediatesDir=%__RootBinDir%\tests\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__CrossComponentBinDir=%__BinDir%"
set "__CrossCompIntermediatesDir=%__IntermediatesDir%\crossgen"
set "__CrossGenCoreLibLog=%__LogsDir%\CrossgenCoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
set "__CrossgenExe=%__CrossComponentBinDir%\crossgen.exe"
-:: Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
+REM Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
set "__CMakeBinDir=%__BinDir%"
set "__CMakeBinDir=%__CMakeBinDir:\=/%"
REM does not exist. Avoid this in at least one case by aggressively creating the directory.
if not exist "%__BinDir%\.nuget\pkg" md "%__BinDir%\.nuget\pkg"
-echo %__MsgPrefix%Commencing CoreCLR Repo build
+echo %__MsgPrefix%Commencing CoreCLR product build
-:: Set the remaining variables based upon the determined build configuration
+REM Set the remaining variables based upon the determined build configuration
echo %__MsgPrefix%Checking prerequisites
-:: Eval the output from probe-win1.ps1
+
+REM Eval the output from probe-win1.ps1
for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& ""%__SourceDir%\pal\tools\probe-win.ps1"""') do %%a
REM NumberOfCores is an WMI property providing number of physical cores on machine
REM processor(s). It is used to set optimal level of CL parallelism during native build step
if not defined NumberOfCores (
-REM Determine number of physical processor cores available on machine
-for /f "tokens=*" %%I in (
- 'wmic cpu get NumberOfCores /value ^| find "=" 2^>NUL'
+ REM Determine number of physical processor cores available on machine
+ for /f "tokens=*" %%I in (
+ 'wmic cpu get NumberOfCores /value ^| find "=" 2^>NUL'
) do set %%I
)
echo %__MsgPrefix%Number of processor cores %NumberOfCores%
REM ===
REM =========================================================================================
-if %__RestoreOptData% EQU 1 if %__BuildTypeRelease% EQU 1 (
+if %__RestoreOptData% EQU 1 (
echo %__MsgPrefix%Restoring the OptimizationData Package
call %__ProjectDir%\run.cmd build -optdata %__RunArgs% %__UnprocessedBuildArgs%
if not !errorlevel! == 0 (
REM Parse the optdata package versions out of msbuild so that we can pass them on to CMake
set DotNetCli=%__ProjectDir%\Tools\dotnetcli\dotnet.exe
if not exist "%DotNetCli%" (
- echo %__MsgPrefix%Assertion failed: dotnet.exe not found at path "%DotNetCli%"
+ echo %__MsgPrefix%Error: "%DotNetCli%" not found
exit /b 1
)
set OptDataProjectFilePath=%__ProjectDir%\src\.nuget\optdata\optdata.csproj
-for /f "tokens=*" %%s in ('%DotNetCli% msbuild "%OptDataProjectFilePath%" /t:DumpPgoDataPackageVersion /nologo') do @(
+for /f "tokens=*" %%s in ('%DotNetCli% msbuild "%OptDataProjectFilePath%" /t:DumpPgoDataPackageVersion /nologo') do (
set __PgoOptDataVersion=%%s
)
-for /f "tokens=*" %%s in ('%DotNetCli% msbuild "%OptDataProjectFilePath%" /t:DumpIbcDataPackageVersion /nologo') do @(
+for /f "tokens=*" %%s in ('%DotNetCli% msbuild "%OptDataProjectFilePath%" /t:DumpIbcDataPackageVersion /nologo') do (
set __IbcOptDataVersion=%%s
)
exit /b 1
)
-if /i "%__BuildNative%"=="1" (
+if %__BuildNative% EQU 1 (
echo %__MsgPrefix%Laying out dynamically generated files consumed by the native build system
echo %__MsgPrefix%Laying out dynamically generated Event test files and etmdummy stub functions
"!PYTHON!" -B -Wall %__SourceDir%\scripts\genEtwProvider.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate %__IntermediatesIncDir% --exc %__SourceDir%\vm\ClrEtwAllMeta.lst || exit /b 1
)
-if /i "%__BuildCoreLib%"=="1" (
+if %__BuildCoreLib% EQU 1 (
echo %__MsgPrefix%Laying out dynamically generated EventSource classes
"!PYTHON!" -B -Wall %__SourceDir%\scripts\genRuntimeEventSources.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate %__IntermediatesEventingDir% || exit /b 1
)
-if /i "%__DoCrossArchBuild%"=="1" (
- if NOT DEFINED PYTHON (
- echo %__MsgPrefix%Error: Could not find a python installation
- exit /b 1
- )
+if %__BuildCrossArchNative% EQU 1 (
set __CrossCompIntermediatesIncDir=%__CrossCompIntermediatesDir%\src\inc
set __CrossCompIntermediatesEventingDir=%__CrossCompIntermediatesDir%\eventing
echo %__MsgPrefix%Commencing build of native components for %__BuildOS%.%__BuildArch%.%__BuildType%
- :: Set the environment for the native build
+ REM Set the environment for the native build
set __VCBuildArch=x86_amd64
if /i "%__BuildArch%" == "x86" ( set __VCBuildArch=x86 )
if /i "%__BuildArch%" == "arm" (
echo %__MsgPrefix%Regenerating the Visual Studio solution
pushd "%__IntermediatesDir%"
- set __ExtraCmakeArgs=!___SDKVersion! "-DCLR_CMAKE_TARGET_OS=%__BuildOs%" "-DCLR_CMAKE_PACKAGES_DIR=%__PackagesDir%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_VERSION=%__PgoOptDataVersion%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%"
+ set __ExtraCmakeArgs=!___SDKVersion! "-DCLR_CMAKE_TARGET_OS=%__BuildOS%" "-DCLR_CMAKE_PACKAGES_DIR=%__PackagesDir%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_VERSION=%__PgoOptDataVersion%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%"
call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs!
@if defined _echo @echo on
popd
:SkipConfigure
- if defined __ConfigureOnly goto SkipNativeBuild
-
if not exist "%__IntermediatesDir%\install.vcxproj" (
echo %__MsgPrefix%Error: failed to generate native component build project!
exit /b 1
)
+ if defined __ConfigureOnly goto SkipNativeBuild
+
set __BuildLogRootName=CoreCLR
set __BuildLog="%__LogsDir%\!__BuildLogRootName!_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
set __BuildWrn="%__LogsDir%\!__BuildLogRootName!_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn"
set __MsbuildLog=/flp:Verbosity=normal;LogFile=!__BuildLog!
set __MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn!
set __MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!
+ set __Logging=-MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr!
- call %__ProjectDir%\run.cmd build -Project=%__IntermediatesDir%\install.vcxproj -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! -configuration=%__BuildType% -platform=%__BuildArch% %__RunArgs% -MSBuildNodeCount="/m:2" %__UnprocessedBuildArgs%
+ call %__ProjectDir%\run.cmd build -Project=%__IntermediatesDir%\install.vcxproj !__Logging! -configuration=%__BuildType% -platform=%__BuildArch% %__RunArgs% -MSBuildNodeCount="/m:2" %__UnprocessedBuildArgs%
if not !errorlevel! == 0 (
echo %__MsgPrefix%Error: native component build failed. Refer to the build log files for details:
REM ===
REM =========================================================================================
-if /i "%__DoCrossArchBuild%"=="1" (
+if %__BuildCrossArchNative% EQU 1 (
REM Scope environment changes start {
setlocal
echo %__MsgPrefix%Commencing build of cross architecture native components for %__BuildOS%.%__BuildArch%.%__BuildType%
- :: Set the environment for the native build
+ REM Set the environment for the cross-arch native build
set __VCBuildArch=x86_amd64
if /i "%__CrossArch%" == "x86" ( set __VCBuildArch=x86 )
pushd "%__CrossCompIntermediatesDir%"
set __CMakeBinDir=%__CrossComponentBinDir%
set "__CMakeBinDir=!__CMakeBinDir:\=/!"
- set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__BuildOs%" "-DCLR_CMAKE_PACKAGES_DIR=%__PackagesDir%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_VERSION=%__PgoOptDataVersion%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCMAKE_SYSTEM_VERSION=10.0"
+ set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__BuildOS%" "-DCLR_CMAKE_PACKAGES_DIR=%__PackagesDir%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_VERSION=%__PgoOptDataVersion%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCMAKE_SYSTEM_VERSION=10.0"
call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__CrossArch% !__ExtraCmakeArgs!
@if defined _echo @echo on
popd
set __MsbuildLog=/flp:Verbosity=normal;LogFile=!__BuildLog!
set __MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn!
set __MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!
+ set __Logging=-MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr!
- call %__ProjectDir%\run.cmd build -Project=%__CrossCompIntermediatesDir%\install.vcxproj -configuration=%__BuildType% -platform=%__CrossArch% -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! %__RunArgs% -MSBuildNodeCount="/m:2" %__UnprocessedBuildArgs%
+ call %__ProjectDir%\run.cmd build -Project=%__CrossCompIntermediatesDir%\install.vcxproj !__Logging! -configuration=%__BuildType% -platform=%__CrossArch% %__RunArgs% -MSBuildNodeCount="/m:2" %__UnprocessedBuildArgs%
if not !errorlevel! == 0 (
echo %__MsgPrefix%Error: cross-arch components build failed. Refer to the build log files for details:
set __ExtraBuildArgs=
if not defined __IbcTuning (
- set __ExtraBuildArgs=!__ExtraBuildArgs! -OptimizationDataDir="%__PackagesDir%/optimization.%__BuildOS%-%__BuildArch%.IBC.CoreCLR/%__IbcOptDataVersion%/data/"
- set __ExtraBuildArgs=!__ExtraBuildArgs! -EnableProfileGuidedOptimization=true
+ set __ExtraBuildArgs=!__ExtraBuildArgs! -OptimizationDataDir="%__PackagesDir%/optimization.%__BuildOS%-%__BuildArch%.IBC.CoreCLR/%__IbcOptDataVersion%/data/"
+ set __ExtraBuildArgs=!__ExtraBuildArgs! -EnableProfileGuidedOptimization=true
)
if "%__BuildSOS%" == "0" (
set __ExtraBuildArgs=!__ExtraBuildArgs! -BuildManagedTools=true
)
- if /i "%__BuildArch%" == "arm64" (
- set __nugetBuildArgs=-buildNugetPackage=false
- ) else if "%__SkipNugetPackage%" == "1" (
- set __nugetBuildArgs=-buildNugetPackage=false
+ if "%__SkipNugetPackage%" == "1" (
+ set __ExtraBuildArgs=!__ExtraBuildArgs! -buildNugetPackage=false
) else (
- set __nugetBuildArgs=-buildNugetPackage=true
+ set __ExtraBuildArgs=!__ExtraBuildArgs! -buildNugetPackage=true
)
set __BuildLogRootName=System.Private.CoreLib
set __MsbuildLog=/flp:Verbosity=normal;LogFile=!__BuildLog!
set __MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn!
set __MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!
+ set __Logging=-MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr!
- call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\build.proj -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! !__nugetBuildArgs! %__RunArgs% !__ExtraBuildArgs! %__UnprocessedBuildArgs%
+ call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\build.proj !__Logging! %__RunArgs% !__ExtraBuildArgs! %__UnprocessedBuildArgs%
if not !errorlevel! == 0 (
echo %__MsgPrefix%Error: System.Private.CoreLib build failed. Refer to the build log files for details:
endlocal
)
+REM =========================================================================================
+REM ===
+REM === Build native System.Private.CoreLib.
+REM ===
+REM =========================================================================================
+
REM Scope environment changes start {
setlocal
REM HACK: Workaround for [dotnet/coreclr#13970](https://github.com/dotnet/coreclr/issues/13970)
set __PgoRtPath=
for /f "tokens=*" %%f in ('where pgort*.dll') do (
- if not defined __PgoRtPath set "__PgoRtPath=%%~f"
+ if not defined __PgoRtPath set "__PgoRtPath=%%~f"
)
echo %__MsgPrefix%Copying "!__PgoRtPath!" into "%__BinDir%"
copy /y "!__PgoRtPath!" "%__BinDir%" || (
- echo %__MsgPrefix%Error: copy failed
- goto CrossgenFailure
+ echo %__MsgPrefix%Error: copy failed
+ goto CrossgenFailure
)
REM End HACK
)
!NEXTCMD! >> "%__CrossGenCoreLibLog%" 2>&1
if NOT !errorlevel! == 0 (
echo %__MsgPrefix%Error: CrossGen System.Private.CoreLib build failed. Refer to %__CrossGenCoreLibLog%
- :: Put it in the same log, helpful for Jenkins
+ REM Put it in the same log, helpful for Jenkins
type %__CrossGenCoreLibLog%
goto CrossgenFailure
)
!NEXTCMD! >> "%__CrossGenCoreLibLog%" 2>&1
if NOT !errorlevel! == 0 (
echo %__MsgPrefix%Error: CrossGen /CreatePdb System.Private.CoreLib build failed. Refer to %__CrossGenCoreLibLog%
- :: Put it in the same log, helpful for Jenkins
+ REM Put it in the same log, helpful for Jenkins
type %__CrossGenCoreLibLog%
goto CrossgenFailure
)
REM } Scope environment changes end
endlocal
+REM =========================================================================================
+REM ===
+REM === Build packages
+REM ===
+REM =========================================================================================
if %__BuildPackages% EQU 1 (
REM Scope environment changes start {
set __MsbuildLog=/flp:Verbosity=normal;LogFile=!__BuildLog!
set __MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn!
set __MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!
+ set __Logging=-MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr!
REM The conditions as to what to build are captured in the builds file.
- call %__ProjectDir%\run.cmd build -Project=%__SourceDir%\.nuget\packages.builds -platform=%__BuildArch% -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! %__RunArgs% %__UnprocessedBuildArgs%
+ call %__ProjectDir%\run.cmd build -Project=%__SourceDir%\.nuget\packages.builds !__Logging! -platform=%__BuildArch% %__RunArgs% %__UnprocessedBuildArgs%
if not !errorlevel! == 0 (
- echo %__MsgPrefix%Error: Nuget package generation failed build failed. Refer to the build log files for details:
+ echo %__MsgPrefix%Error: Nuget package generation failed. Refer to the build log files for details:
echo !__BuildLog!
echo !__BuildWrn!
echo !__BuildErr!
REM ===
REM =========================================================================================
-echo %__MsgPrefix%Repo successfully built. Finished at %TIME%
+echo %__MsgPrefix%Build succeeded. Finished at %TIME%
echo %__MsgPrefix%Product binaries are available at !__BinDir!
-if %__BuildTests% EQU 1 (
- echo %__MsgPrefix%Test binaries are available at !__TestBinDir!
-)
exit /b 0
REM =========================================================================================
echo Usage:
echo build.cmd [option1] [option2]
echo or:
-echo build.cmd all [option1] [option2] -- ...
+echo build.cmd all [option1] [option2]
echo.
echo All arguments are optional. The options are:
echo.
echo -all: Builds all configurations and platforms.
echo Build architecture: one of -x64, -x86, -arm, -arm64 ^(default: -x64^).
echo Build type: one of -Debug, -Checked, -Release ^(default: -Debug^).
-echo -- ... : all arguments following this tag will be passed directly to msbuild.
echo mscorlib version: one of -freebsdmscorlib, -linuxmscorlib, -netbsdmscorlib, -osxmscorlib,
echo or -windowsmscorlib. If one of these is passed, only System.Private.CoreLib is built,
echo for the specified platform ^(FreeBSD, Linux, NetBSD, OS X or Windows,
This is due to a bug in the Visual Studio installer. It does not install DIA SDK at "%VSINSTALLDIR%" but rather ^
at the install location of previous Visual Studio version. The workaround is to copy the DIA SDK folder from the Visual Studio install location ^
of the previous version to "%VSINSTALLDIR%" and then build.
-:: DIA SDK not included in Express editions
+REM DIA SDK not included in Express editions
echo Visual Studio Express does not include the DIA SDK. ^
You need Visual Studio 2015 or 2017 (Community is free).
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites
@if not defined _echo @echo off
-setlocal EnableDelayedExpansion
-
-:: Set the default arguments
-set __BuildArch=x64
-set __BuildType=Debug
-set __BuildOS=Windows_NT
-set __MSBuildBuildArch=x64
-
-set "__ProjectDir=%~dp0"
+setlocal EnableDelayedExpansion EnableExtensions
:: Define a prefix for most output progress messages that come from this script. That makes
:: it easier to see where these are coming from. Note that there is a trailing space here.
set "__MsgPrefix=RUNTEST: "
-call "%__ProjectDir%"\..\setup_vs_tools.cmd
+set __ThisScriptDir="%~dp0"
-REM setup_vs_tools.cmd will correctly echo error message.
+call "%__ThisScriptDir%"\..\setup_vs_tools.cmd
if NOT '%ERRORLEVEL%' == '0' exit /b 1
-set __VSVersion=vs2017
+if defined VS150COMNTOOLS (
+ set __VSVersion=vs2017
+) else (
+ set __VSVersion=vs2015
+)
-if defined VS140COMNTOOLS set __VSVersion=vs2015
-if defined VS150COMNTOOLS set __VSVersion=vs2017
+:: Set the default arguments
+set __BuildArch=x64
+set __BuildType=Debug
+set __BuildOS=Windows_NT
+set "__ProjectDir=%~dp0"
:: remove trailing slash
if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
set "__ProjectFilesDir=%__ProjectDir%"
if /i "%1" == "/help" goto Usage
if /i "%1" == "-help" goto Usage
-if /i "%1" == "x64" (set __BuildArch=x64&set __MSBuildBuildArch=x64&shift&goto Arg_Loop)
-if /i "%1" == "x86" (set __BuildArch=x86&set __MSBuildBuildArch=x86&shift&goto Arg_Loop)
-if /i "%1" == "arm" (set __BuildArch=arm&set __MSBuildBuildArch=arm&shift&goto Arg_Loop)
-if /i "%1" == "arm64" (set __BuildArch=arm64&set __MSBuildBuildArch=arm64&shift&goto Arg_Loop)
+if /i "%1" == "x64" (set __BuildArch=x64&shift&goto Arg_Loop)
+if /i "%1" == "x86" (set __BuildArch=x86&shift&goto Arg_Loop)
+if /i "%1" == "arm" (set __BuildArch=arm&shift&goto Arg_Loop)
+if /i "%1" == "arm64" (set __BuildArch=arm64&shift&goto Arg_Loop)
if /i "%1" == "debug" (set __BuildType=Debug&shift&goto Arg_Loop)
if /i "%1" == "release" (set __BuildType=Release&shift&goto Arg_Loop)
)
:: Set the remaining variables based upon the determined configuration
+set __MSBuildBuildArch=%__BuildArch%
+
set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__TestWorkingDir=%__RootBinDir%\tests\%__BuildOS%.%__BuildArch%.%__BuildType%"
call :ResolveDependencies
if errorlevel 1 exit /b 1
-if defined __DoCrossgen call :PrecompileFX
+if defined __DoCrossgen (
+ echo %__MsgPrefix%Running crossgen on framework assemblies
+ call :PrecompileFX
+)
REM Delete the unecessary mscorlib.ni file.
if exist %CORE_ROOT%\mscorlib.ni.dll del %CORE_ROOT%\mscorlib.ni.dll
if defined __GenerateLayoutOnly (
+ echo %__MsgPrefix%Done generating layout.
exit /b 0
)
)
echo %__MsgPrefix%CORE_ROOT that will be used is: %CORE_ROOT%
-echo %__MsgPrefix%Starting the test run ...
+echo %__MsgPrefix%Starting test run at %TIME%
set __BuildLogRootName=TestRunResults
call :msbuild "%__ProjectFilesDir%\runtest.proj" /p:Runtests=true /clp:showcommandline
)
if %__errorlevel% GEQ 1 (
- echo Test Run failed. Refer to the following:
+ echo %__MsgPrefix%Test Run failed. Refer to the following:
echo Html report: %__TestRunHtmlLog%
exit /b 1
)
:RunPerfTests
echo %__MsgPrefix%CORE_ROOT that will be used is: %CORE_ROOT%
-echo %__MsgPrefix%Starting the test run ...
+echo %__MsgPrefix%Starting test run at %TIME%
set __BuildLogRootName=PerfTestRunResults
echo %__MsgPrefix%Running perf tests
call :msbuild "%__ProjectFilesDir%\runtest.proj" /t:RunPerfTests /clp:showcommandline
if errorlevel 1 (
- echo %__MsgPrefix%Test Run failed. Refer to the following:
- echo Html report: %__TestRunHtmlLog%
-)
+ echo %__MsgPrefix%Test Run failed. Refer to the following:
+ echo Html report: %__TestRunHtmlLog%
+)
+
goto TestsDone
REM =========================================================================================
REM === Run CoreFX tests
REM ===
REM =========================================================================================
+
:RunCoreFXTests
+
set _CoreFXTestHost=%XunitTestBinBase%\testhost
-set _toolsDir=%__ProjectDir%\..\Tools
-set _dotnet=%_toolsDir%\dotnetcli\dotnet.exe
+set __ToolsDir=%__ProjectDir%\..\Tools
+set "DotNetCli=%__ToolsDir%\dotnetcli\dotnet.exe"
set _RootCoreFXTestPath=%__TestWorkingDir%\CoreFX
set _CoreFXTestUtilitiesOutputPath=%_RootCoreFXTestPath%\CoreFXTestUtilities
exit /b 0
)
-if not exist %_CoreFXTestHost%\dotnet.exe echo CoreFX test host not found, please run runtest.cmd again && exit /b 1
+if not exist %_CoreFXTestHost%\dotnet.exe (
+ echo %__MsgPrefix%CoreFX test host not found, please run runtest.cmd again
+ exit /b 1
+)
set /p _CoreFXTestRemoteURL=< "%__ProjectFilesDir%\CoreFX\CoreFXTestListURL.txt"
if not defined __CoreFXTestList ( set __CoreFXTestList=%__ProjectFilesDir%\CoreFX\CoreFX.issues.json )
-
set _CoreFXTestExecutable=xunit.console.netcore.exe
set _CoreFXTestExecutableArgs= --notrait category=nonnetcoreapptests --notrait category=nonwindowstests --notrait category=failing --notrait category=IgnoreForCI --notrait category=OuterLoop --notrait Benchmark=true
set _CoreFX_RunCommand=--runSpecifiedTests
)
-
-echo Downloading and Running CoreFX Test Binaries
-echo %__MsgPrefix%call "%_dotnet%" "%_CoreFXTestUtilitiesOutputPath%\%_CoreFXTestSetupUtilityName%.dll" --clean --outputDirectory "%_CoreFXTestBinariesPath%" --testListJsonPath "%__CoreFXTestList%" --testUrl "!_CoreFXTestRemoteURL!" %_CoreFX_RunCommand% --dotnetPath "%_CoreFXTestHost%\dotnet.exe" --executable %_CoreFXTestExecutable% --logPath %_CoreFXLogsDir% %_CoreFXTestExecutableArgs%
-call "%_dotnet%" "%_CoreFXTestUtilitiesOutputPath%\%_CoreFXTestSetupUtilityName%.dll" --clean --outputDirectory "%_CoreFXTestBinariesPath%" --testListJsonPath "%__CoreFXTestList%" --testUrl "!_CoreFXTestRemoteURL!" %_CoreFX_RunCommand% --dotnetPath "%_CoreFXTestHost%\dotnet.exe" --executable %_CoreFXTestExecutable% --log %_CoreFXLogsDir% %_CoreFXTestExecutableArgs%
+echo %__MsgPrefix%Downloading and Running CoreFX Test Binaries
+set NEXTCMD=call "%DotNetCli%" "%_CoreFXTestUtilitiesOutputPath%\%_CoreFXTestSetupUtilityName%.dll" --clean --outputDirectory "%_CoreFXTestBinariesPath%" --testListJsonPath "%__CoreFXTestList%" --testUrl "!_CoreFXTestRemoteURL!" %_CoreFX_RunCommand% --dotnetPath "%_CoreFXTestHost%\dotnet.exe" --executable %_CoreFXTestExecutable% --log %_CoreFXLogsDir% %_CoreFXTestExecutableArgs%
+echo !NEXTCMD!
+!NEXTCMD!
if errorlevel 1 (
- echo %__MsgPrefix%Running CoreFX tests finished with Failures
- echo %__MsgPrefix%Check %_CoreFXLogsDir% for test run logs
- exit /b 1
+ echo %__MsgPrefix%CoreFX tests finished with failures. Refer to the following:
+ echo %_CoreFXLogsDir%
+ exit /b 1
)
-)
goto TestsDone
REM =========================================================================================
:TestsDone
-echo %__MsgPrefix%Test run successful. Refer to the log files for details:
+echo %__MsgPrefix%Test run successful. Finished at %TIME%. Refer to the log files for details:
echo %__TestRunHtmlLog%
echo %__TestRunXmlLog%
exit /b 0
REM =========================================================================================
:ResolveDependencies
+
set __BuildLogRootName=Tests_GenerateRuntimeLayout
call :msbuild "%__ProjectFilesDir%\runtest.proj" /p:GenerateRuntimeLayout=true
if errorlevel 1 (
REM =========================================================================================
:ResolveCoreFXDependencies
-set __BuildLogRootName=Tests_GenerateTestHost
+
echo %__MsgPrefix%Building CoreFX Test Host
+
+set __BuildLogRootName=Tests_GenerateTestHost
call :msbuild "%__ProjectFilesDir%\runtest.proj" /p:GenerateTestHost=true
if errorlevel 1 (
echo %__MsgPrefix%Test Host Dependency Resolution Failed
REM Publish and call the CoreFX test helper projects - should this be integrated into runtest.proj?
REM Build Helper project
-echo "%_dotnet%" msbuild /t:Restore "%_CoreFXTestSetupUtility%"
-call "%_dotnet%" msbuild /t:Restore "%_CoreFXTestSetupUtility%"
+set NEXTCMD="%DotNetCli%" msbuild /t:Restore "%_CoreFXTestSetupUtility%"
+echo !NEXTCMD!
+!NEXTCMD!
if errorlevel 1 (
- exit /b 1
+ exit /b 1
)
-echo "%_dotnet%" msbuild "/p:Configuration=%CoreRT_BuildType%" "/p:OSGroup=%CoreRT_BuildOS%" "/p:Platform=%CoreRT_BuildArch%" "/p:OutputPath=%_CoreFXTestUtilitiesOutputPath%" "%_CoreFXTestSetupUtility%"
-call "%_dotnet%" msbuild "/p:Configuration=%CoreRT_BuildType%" "/p:OSGroup=%CoreRT_BuildOS%" "/p:Platform=%CoreRT_BuildArch%" "/p:OutputPath=%_CoreFXTestUtilitiesOutputPath%" "%_CoreFXTestSetupUtility%"
+
+set NEXTCMD=call "%DotNetCli%" msbuild "/p:Configuration=%CoreRT_BuildType%" "/p:OSGroup=%CoreRT_BuildOS%" "/p:Platform=%CoreRT_BuildArch%" "/p:OutputPath=%_CoreFXTestUtilitiesOutputPath%" "%_CoreFXTestSetupUtility%"
+echo !NEXTCMD!
+!NEXTCMD!
if errorlevel 1 (
- exit /b 1
+ exit /b 1
)
exit /b 0