diff options
-rw-r--r-- | build-packages.cmd | 45 | ||||
-rwxr-xr-x | build-packages.sh | 151 | ||||
-rw-r--r-- | build-test.cmd | 289 | ||||
-rw-r--r-- | build.cmd | 671 | ||||
-rwxr-xr-x | build.sh | 120 | ||||
-rw-r--r-- | clean.cmd | 22 | ||||
-rw-r--r-- | config.json | 541 | ||||
-rw-r--r-- | dir.props | 14 | ||||
-rwxr-xr-x | netci.groovy | 12 | ||||
-rw-r--r-- | publish-packages.cmd | 36 | ||||
-rwxr-xr-x | publish-packages.sh | 57 | ||||
-rw-r--r-- | run.cmd | 39 | ||||
-rw-r--r-- | run.sh | 20 | ||||
-rw-r--r-- | sync.cmd | 113 | ||||
-rwxr-xr-x | sync.sh | 52 | ||||
-rw-r--r-- | tests/buildtest.cmd | 412 | ||||
-rwxr-xr-x | tests/scripts/arm32_ci_script.sh | 3 |
17 files changed, 1246 insertions, 1351 deletions
diff --git a/build-packages.cmd b/build-packages.cmd index 1881799837..0c827b5a77 100644 --- a/build-packages.cmd +++ b/build-packages.cmd @@ -2,61 +2,38 @@ setlocal EnableDelayedExpansion set "__ProjectDir=%~dp0" -set packagesLog=build-packages.log -set binclashLoggerDll=%~dp0Tools\net45\Microsoft.DotNet.Build.Tasks.dll -set binclashlog=%~dp0binclash.log -echo Running build-packages.cmd %* > %packagesLog% - -set options=/nologo /maxcpucount /v:minimal /clp:Summary /nodeReuse:false /flp:v=detailed;Append;LogFile=%packagesLog% /l:BinClashLogger,%binclashLoggerDll%;LogFile=%binclashlog% /p:FilterToOSGroup=Windows_NT set allargs=%* if /I [%1] == [/?] goto Usage if /I [%1] == [/help] goto Usage -REM ensure that msbuild is available -echo Running init-tools.cmd -call %~dp0init-tools.cmd - -set __msbuildArgs="%__ProjectDir%\src\.nuget\Microsoft.NETCore.Runtime.CoreClr\Microsoft.NETCore.Runtime.CoreCLR.builds" !allargs! -echo msbuild.exe %__msbuildArgs% !options! >> %packagesLog% -call msbuild.exe %__msbuildArgs% !options! +call %__ProjectDir%/run.cmd build-packages -Project=%__ProjectDir%/src/.nuget/Microsoft.NETCore.Runtime.CoreClr/Microsoft.NETCore.Runtime.CoreCLR.builds -FilterToOSGroup=Windows_NT %allargs% if NOT [!ERRORLEVEL!]==[0] ( - echo ERROR: An error occurred while building packages, see %packagesLog% for more details. + echo ERROR: An error occurred while building CoreCLR Runtime package, see build-packages.log for more details. exit /b 1 ) -set __msbuildArgs="%__ProjectDir%\src\.nuget\Microsoft.NETCore.Jit\Microsoft.NETCore.Jit.builds" !allargs! -echo msbuild.exe %__msbuildArgs% !options! >> %packagesLog% -call msbuild.exe %__msbuildArgs% !options! +call %__ProjectDir%/run.cmd build-packages -Project=%__ProjectDir%/src/.nuget/Microsoft.NETCore.Jit/Microsoft.NETCore.Jit.builds -FilterToOSGroup=Windows_NT %allargs% if NOT [!ERRORLEVEL!]==[0] ( - echo ERROR: An error occurred while building packages, see %packagesLog% for more details. + echo ERROR: An error occurred while building Jit package, see build-packages.log for more details. exit /b 1 ) -rem Build the ILAsm package -set __msbuildArgs="%__ProjectDir%\src\.nuget\Microsoft.NETCore.ILAsm\Microsoft.NETCore.ILAsm.builds" !allargs! -echo msbuild.exe %__msbuildArgs% !options! >> %packagesLog% -call msbuild.exe %__msbuildArgs% !options! +call %__ProjectDir%/run.cmd build-packages -Project=%__ProjectDir%/src/.nuget/Microsoft.NETCore.ILAsm/Microsoft.NETCore.ILAsm.builds -FilterToOSGroup=Windows_NT %allargs% if NOT [!ERRORLEVEL!]==[0] ( - echo ERROR: An error occurred while building packages, see %packagesLog% for more details. + echo ERROR: An error occurred while building ILAsm package, see build-packages.log for more details. exit /b 1 ) -rem Build the ILDAsm package -set __msbuildArgs="%__ProjectDir%\src\.nuget\Microsoft.NETCore.ILDAsm\Microsoft.NETCore.ILDAsm.builds" !allargs! -echo msbuild.exe %__msbuildArgs% !options! >> %packagesLog% -call msbuild.exe %__msbuildArgs% !options! +call %__ProjectDir%/run.cmd build-packages -Project=%__ProjectDir%/src/.nuget/Microsoft.NETCore.ILDAsm/Microsoft.NETCore.ILDAsm.builds -FilterToOSGroup=Windows_NT %allargs% if NOT [!ERRORLEVEL!]==[0] ( - echo ERROR: An error occurred while building packages, see %packagesLog% for more details. + echo ERROR: An error occurred while building ILDAsm package, see build-packages.log for more details. exit /b 1 ) -rem Build the TargetingPack package -set __msbuildArgs="%__ProjectDir%\src\.nuget\Microsoft.TargetingPack.Private.CoreCLR\Microsoft.TargetingPack.Private.CoreCLR.pkgproj" !allargs! -echo msbuild.exe %__msbuildArgs% !options! >> %packagesLog% -call msbuild.exe %__msbuildArgs% !options! +call %__ProjectDir%/run.cmd build-packages -Project=%__ProjectDir%/src/.nuget/Microsoft.TargetingPack.Private.CoreCLR/Microsoft.TargetingPack.Private.CoreCLR.pkgproj -FilterToOSGroup=Windows_NT %allargs% if NOT [!ERRORLEVEL!]==[0] ( - echo ERROR: An error occurred while building packages, see %packagesLog% for more details. + echo ERROR: An error occurred while building CoreCLR TargetingPack package, see build-packages.log for more details. exit /b 1 ) @@ -76,7 +53,7 @@ exit /b echo. echo Builds the NuGet packages from the binaries that were built in the Build product binaries step. echo The following properties are required to define build architecture -echo /p:__BuildArch=[architecture] /p:__BuildType=[configuration] +echo -BuildArch=[architecture] -BuildType=[configuration] echo Architecture can be x64, x86, arm, or arm64 echo Configuration can be Release, Debug, or Checked exit /b diff --git a/build-packages.sh b/build-packages.sh index be75891850..b4dcaa884b 100755 --- a/build-packages.sh +++ b/build-packages.sh @@ -3,7 +3,7 @@ usage() { echo "Builds the NuGet packages from the binaries that were built in the Build product binaries step." - echo "Usage: build-packages [arch] [configuration]" + echo "Usage: build-packages -BuildArch -BuildType" echo "arch can be x64, x86, arm, arm64 (default is x64)" echo "configuration can be release, checked, debug (default is debug)" echo @@ -11,148 +11,54 @@ usage() } __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -build_packages_log=$__ProjectRoot/build-packages.log -binclashlog=$__ProjectRoot/binclash.log -binclashloggerdll=$__ProjectRoot/Tools/Microsoft.DotNet.Build.Tasks.dll -RuntimeOS=ubuntu.$VERSION_ID -__MSBuildPath=$__ProjectRoot/Tools/MSBuild.exe - -# Parse arguments -__BuildArch=x64 -__BuildType=Debug - -allargs="$@" - -echo -e "Running build-packages.sh $allargs" > $build_packages_log - -if [ "$allargs" == "-h" ] || [ "$allargs" == "--help" ]; then - usage -fi +unprocessedBuildArgs= while :; do if [ $# -le 0 ]; then break fi - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in + case "$1" in -\?|-h|--help) - usage - exit 1 - ;; - - x86) - __BuildArch=x86 - ;; - - x64) - __BuildArch=x64 - ;; - - arm) - __BuildArch=arm - ;; - - arm64) - __BuildArch=arm64 - ;; - debug) - __BuildType=Debug - ;; - release) - __BuildType=Release - ;; - checked) - __BuildType=Checked + usage + exit 1 + ;; + -BuildArch=*) + unprocessedBuildArgs="$unprocessedBuildArgs $1" + __Arch=$(echo $1| cut -d'=' -f 2) + ;; + *) + unprocessedBuildArgs="$unprocessedBuildArgs $1" esac shift done -# Use uname to determine what the OS is. -OSName=$(uname -s) -case $OSName in - Linux) - __BuildOS=Linux - ;; - - Darwin) - __BuildOS=OSX - ;; - - FreeBSD) - __BuildOS=FreeBSD - ;; - - OpenBSD) - __BuildOS=OpenBSD - ;; - - NetBSD) - __BuildOS=NetBSD - ;; - - SunOS) - __BuildOS=SunOS - ;; - - *) - echo "Unsupported OS $OSName detected, configuring as if for Linux" - __BuildOS=Linux - ;; -esac - -if [ "$__BuildOS" == "Linux" ]; then - if [ ! -e /etc/os-release ]; then - echo "WARNING: Can not determine runtime id for current distro." - export __DistroRid="" - else - source /etc/os-release - export __DistroRid="$ID.$VERSION_ID-$__BuildArch" - fi -fi - -__IntermediatesDir="$__ProjectRoot/bin/obj/$__BuildOS.$__BuildArch.$__BuildType" - -# Ensure that MSBuild is available -echo "Running init-tools.sh" -$__ProjectRoot/init-tools.sh - - echo "Generating nuget packages for "$__BuildOS - - # Invoke MSBuild - $__ProjectRoot/Tools/dotnetcli/dotnet "$__MSBuildPath" /nologo "$__ProjectRoot/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/Microsoft.NETCore.Runtime.CoreCLR.builds" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$binclashlog" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:BuildNugetPackage=false /p:UseSharedCompilation=false - -if [ $? -ne 0 ]; then - echo -e "\nAn error occurred. Aborting build-packages.sh ." >> $build_packages_log - echo "ERROR: An error occurred while building packages, see $build_packages_log for more details." +$__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/Microsoft.NETCore.Runtime.CoreCLR.builds -DistroRid=\${OSRid}-$__Arch -UseSharedCompilation=false -BuildNugetPackage=false $unprocessedBuildArgs +if [ $? -ne 0 ] +then + echo "ERROR: An error occurred while syncing packages; See build-packages.log for more details." exit 1 fi - # Build the JIT packages - $__ProjectRoot/Tools/dotnetcli/dotnet "$__MSBuildPath" /nologo "$__ProjectRoot/src/.nuget/Microsoft.NETCore.Jit/Microsoft.NETCore.Jit.builds" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$binclashlog" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:BuildNugetPackage=false /p:UseSharedCompilation=false - -if [ $? -ne 0 ]; then - echo -e "\nAn error occurred. Aborting build-packages.sh ." >> $build_packages_log - echo "ERROR: An error occurred while building packages, see $build_packages_log for more details." +$__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/Microsoft.NETCore.Jit/Microsoft.NETCore.Jit.builds -DistroRid=\${OSRid}-$__Arch -UseSharedCompilation=false -BuildNugetPackage=false $unprocessedBuildArgs +if [ $? -ne 0 ] +then + echo "ERROR: An error occurred while syncing packages; See build-packages.log for more details." exit 1 fi - # Build the ILAsm package - $__ProjectRoot/Tools/dotnetcli/dotnet "$__MSBuildPath" /nologo "$__ProjectRoot/src/.nuget/Microsoft.NETCore.ILAsm/Microsoft.NETCore.ILAsm.builds" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$binclashlog" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:BuildNugetPackage=false /p:UseSharedCompilation=false - -if [ $? -ne 0 ]; then - echo -e "\nAn error occurred. Aborting build-packages.sh ." >> $build_packages_log - echo "ERROR: An error occurred while building packages, see $build_packages_log for more details." +$__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/Microsoft.NETCore.ILAsm/Microsoft.NETCore.ILAsm.builds -DistroRid=\${OSRid}-$__Arch -UseSharedCompilation=false -BuildNugetPackage=false $unprocessedBuildArgs +if [ $? -ne 0 ] +then + echo "ERROR: An error occurred while syncing packages; See build-packages.log for more details." exit 1 fi - # Build the ILDAsm package - $__ProjectRoot/Tools/dotnetcli/dotnet "$__MSBuildPath" /nologo "$__ProjectRoot/src/.nuget/Microsoft.NETCore.ILDAsm/Microsoft.NETCore.ILDAsm.builds" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$binclashlog" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:BuildNugetPackage=false /p:UseSharedCompilation=false - -if [ $? -ne 0 ]; then - echo -e "\nAn error occurred. Aborting build-packages.sh ." >> $build_packages_log - echo "ERROR: An error occurred while building packages, see $build_packages_log for more details." +$__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/Microsoft.NETCore.ILDAsm/Microsoft.NETCore.ILDAsm.builds -DistroRid=\${OSRid}-$__Arch -UseSharedCompilation=false -BuildNugetPackage=false $unprocessedBuildArgs +if [ $? -ne 0 ] +then + echo "ERROR: An error occurred while syncing packages; See build-packages.log for more details." exit 1 fi @@ -166,5 +72,4 @@ if [ $? -ne 0 ]; then fi echo "Done building packages." -echo -e "\nDone building packages." >> $build_packages_log exit 0 diff --git a/build-test.cmd b/build-test.cmd new file mode 100644 index 0000000000..f2b5d2ae86 --- /dev/null +++ b/build-test.cmd @@ -0,0 +1,289 @@ +@if not defined __echo @echo off +setlocal EnableDelayedExpansion + +:: Set the default arguments for build +set __BuildArch=x64 +set __BuildType=Debug +set __BuildOS=Windows_NT +set __VSVersion=vs2015 +set __VSToolsRoot=%VS140COMNTOOLS% + +:: 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: + +set "__ProjectDir=%~dp0" +:: remove trailing slash +if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%" +set "__TestDir=%__ProjectDir%\tests" +set "__ProjectFilesDir=%__TestDir%" +set "__SourceDir=%__ProjectDir%\src" +set "__PackagesDir=%__ProjectDir%\packages" +set "__RootBinDir=%__ProjectDir%\bin" +set "__LogsDir=%__RootBinDir%\Logs" + +REM __unprocessedBuildArgs are args that we pass to msbuild (e.g. /p:__BuildArch=x64) +set "__args= %*" +set processedArgs= +set __unprocessedBuildArgs= +set __RunArgs= + +: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" == "x64" (set __BuildArch=x64&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "x86" (set __BuildArch=x86&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "arm" (set __BuildArch=arm&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "arm64" (set __BuildArch=arm64&set processedArgs=!processedArgs! %1&goto Arg_Next) + +if /i "%1" == "debug" (set __BuildType=Debug&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "release" (set __BuildType=Release&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "checked" (set __BuildType=Checked&set processedArgs=!processedArgs! %1&goto Arg_Next) + +if /i "%1" == "crossgen" (set __crossgen=true&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "skipmanaged" (set __SkipManaged=1&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "updateinvalidpackages" (set __UpdateInvalidPackagesArg=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "toolset_dir" (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&goto Arg_Next) + +set __unprocessedBuildArgs=!__unprocessedBuildArgs! %1 + +:Arg_Next +shift /1 +goto :Arg_Loop + +:ArgsDone +set __RunArgs=-BuildOS=%__BuildOS% -BuildType=%__BuildType% -BuildArch=%__BuildArch% + +rem arm64 builds currently use private toolset which has not been released yet +REM TODO, remove once the toolset is open. +if /i "%__BuildArch%" == "arm64" call :PrivateToolSet + +echo %__MsgPrefix%Commencing CoreCLR repo 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. + +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 +set "__CMakeBinDir=%__TestBinDir%" +set "__CMakeBinDir=%__CMakeBinDir:\=/%" + +if not exist "%__TestBinDir%" md "%__TestBinDir%" +if not exist "%__NativeTestIntermediatesDir%" md "%__NativeTestIntermediatesDir%" +if not exist "%__ManagedTestIntermediatesDir%" md "%__ManagedTestIntermediatesDir%" +if not exist "%__LogsDir%" md "%__LogsDir%" + +echo %__MsgPrefix%Checking prerequisites + +:: Eval the output from probe-win1.ps1 +for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy RemoteSigned "& ""%__SourceDir%\pal\tools\probe-win.ps1"""') do %%a + +REM ========================================================================================= +REM === +REM === Restore Build Tools +REM === +REM ========================================================================================= +call %__ProjectDir%\init-tools.cmd + +REM ========================================================================================= +REM === +REM === Resolve runtime dependences +REM === +REM ========================================================================================= +call %__TestDir%\setup-runtime-dependencies.cmd /arch %__BuildArch% /outputdir %__BinDir% + +if defined __UpdateInvalidPackagesArg ( + goto skipnative +) + +REM ========================================================================================= +REM === +REM === Native test build section +REM === +REM ========================================================================================= + +echo %__MsgPrefix%Commencing build of native test components for %__BuildArch%/%__BuildType% + +if defined __ToolsetDir ( + echo %__MsgPrefix%ToolsetDir is defined to be :%__ToolsetDir% + goto GenVSSolution :: Private ToolSet is Defined +) + +:: Set the environment for the native build +echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" %__VCBuildArch% +call "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" x86_amd64 +@if defined __echo @echo on + +if not defined VSINSTALLDIR ( + echo %__MsgPrefix%Error: VSINSTALLDIR variable not defined. + exit /b 1 +) +if not exist "%VSINSTALLDIR%DIA SDK" goto NoDIA + +:GenVSSolution + +pushd "%__NativeTestIntermediatesDir%" +call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" ""%__ProjectFilesDir%"" %__VSVersion% %__BuildArch% +@if defined __echo @echo on +popd + +if not exist "%__NativeTestIntermediatesDir%\install.vcxproj" ( + echo %__MsgPrefix%Failed to generate test native component build project! + exit /b 1 +) + +set __msbuildNativeArgs=-configuration=%__BuildType% + +if defined __ToolsetDir ( + set __msbuildNativeArgs=%__msbuildNativeArgs% -UseEnv +) else ( + set __msbuildNativeArgs=%__msbuildNativeArgs% -platform=%__BuildArch% +) + +set __BuildLogRootName=Tests_Native +call %~dp0\run.cmd build -Project="%__NativeTestIntermediatesDir%\install.vcxproj" %__msbuildNativeArgs% %__RunArgs% %__unprocessedBuildArgs% +if errorlevel 1 exit /b 1 + +:skipnative + +if defined __SkipManaged exit /b 0 + +REM ========================================================================================= +REM === +REM === Managed test build section +REM === +REM ========================================================================================= + +echo %__MsgPrefix%Starting the Managed Tests Build + +:: Set the environment for the managed build +echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\VsDevCmd.bat" +call "%__VSToolsRoot%\VsDevCmd.bat" + +if not defined VSINSTALLDIR ( + 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. + exit /b 1 +) + +set __BuildLogRootName=Tests_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%" + +if defined __UpdateInvalidPackagesArg ( + set __up=-updateinvalidpackageversions +) + +call %~dp0run.cmd build -buildManagedTests -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__up% %__RunArgs% %__unprocessedBuildArgs% +if errorlevel 1 ( + echo %__MsgPrefix%Error: build failed. Refer to the build log files for details: + echo %__BuildLog% + echo %__BuildWrn% + echo %__BuildErr% + exit /b 1 +) + +set CORE_ROOT=%__TestBinDir%\Tests\Core_Root + +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%" + +call %~dp0run.cmd build -testOverlay -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__unprocessedBuildArgs% +if errorlevel 1 ( + echo %__MsgPrefix%Error: build failed. Refer to the build log files for details: + echo %__BuildLog% + echo %__BuildWrn% + echo %__BuildErr% + exit /b 1 +) + +REM ========================================================================================= +REM === +REM === All builds complete! +REM === +REM ========================================================================================= + +echo %__MsgPrefix%Test build successful. +echo %__MsgPrefix%Test binaries are available at !__TestBinDir! +exit /b 0 + +:Usage +echo. +echo Usage: +echo %0 [option1] [option2] ... +echo All arguments are optional. Options are case-insensitive. The options are: +echo. +echo. -? -h -help: view this message. +echo Build architecture: -buildArch: only x64 is currently allowed ^(default: x64^). +echo Build type: -buildType: one of Debug, Checked, Release ^(default: Debug^). +echo crossgen: enables the tests to run crossgen on the test executables before executing them. +echo updateinvalidpackageversions: Runs the target to update package versions. +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 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 +echo -sequential: force a non-parallel build ^(default is to build in parallel +echo using all processors^). +echo -ilasmroundtrip: enables ilasm round trip build and run of the tests before executing them. +echo -verbose: enables detailed file logging for the msbuild tasks into the msbuild log file. +exit /b 1 + +:NoDIA +echo Error: DIA SDK is missing at "%VSINSTALLDIR%DIA SDK". ^ +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 +echo Visual Studio 2013 Express does not include the DIA SDK. ^ +You need Visual Studio 2013+ (Community is free). +echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites +exit /b 1 + + +:PrivateToolSet + +echo %__MsgPrefix% Setting Up the usage of __ToolsetDir:%__ToolsetDir% + +if /i "%__ToolsetDir%" == "" ( + echo %__MsgPrefix%Error: A toolset directory is required for the Arm64 Windows build. Use the toolset_dir argument. + exit /b 1 +) + +set PATH=%__ToolsetDir%\VC_sdk\bin;%PATH% +set LIB=%__ToolsetDir%\VC_sdk\lib\arm64;%__ToolsetDir%\sdpublic\sdk\lib\arm64 +set INCLUDE=^ +%__ToolsetDir%\VC_sdk\inc;^ +%__ToolsetDir%\sdpublic\sdk\inc;^ +%__ToolsetDir%\sdpublic\shared\inc;^ +%__ToolsetDir%\sdpublic\shared\inc\minwin;^ +%__ToolsetDir%\sdpublic\sdk\inc\ucrt;^ +%__ToolsetDir%\sdpublic\sdk\inc\minwin;^ +%__ToolsetDir%\sdpublic\sdk\inc\mincore;^ +%__ToolsetDir%\sdpublic\sdk\inc\abi;^ +%__ToolsetDir%\sdpublic\sdk\inc\clientcore;^ +%__ToolsetDir%\diasdk\include +exit /b 0 @@ -1,10 +1,8 @@ @if not defined __echo @echo off setlocal EnableDelayedExpansion EnableExtensions -set __ThisScriptShort=%0 set __ThisScriptFull="%~f0" -set __ThisScriptPath="%~dp0" - +set __VSToolsRoot=%VS140COMNTOOLS% :: Note that the msbuild project files (specifically, dir.proj) will use the following variables, if set: :: __BuildArch -- default: x64 :: __BuildType -- default: Debug @@ -28,11 +26,9 @@ set __BuildOS=Windows_NT :: Default to highest Visual Studio version available set __VSVersion=vs2015 -if defined VS140COMNTOOLS set __VSVersion=vs2015 - :: 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=BUILD: +set __MsgPrefix=BUILD: :: Set the various build properties here so that CMake and MSBuild can pick them up set "__ProjectDir=%~dp0" @@ -44,21 +40,6 @@ set "__PackagesDir=%__ProjectDir%\packages" set "__RootBinDir=%__ProjectDir%\bin" set "__LogsDir=%__RootBinDir%\Logs" -set __CleanBuild= -set __CoreLibOnly= -set __CoreLibAlsoNativeImage= -set __ConfigureOnly= -set __SkipConfigure= -set __SkipCoreLibBuild= -set __SkipNativeBuild= -set __SkipTestBuild= -set __BuildSequential= -set __SkipRestore= -set __SkipBuildPackages= -set __msbuildCleanBuildArgs= -set __SignTypeReal= -set __OfficialBuildIdArg= - set __BuildAll= set __BuildArchX64=0 @@ -75,84 +56,62 @@ REM __PassThroughArgs is a set of things that will be passed through to nested c REM when using "all". set __PassThroughArgs= -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 __BuildCoreLib=1 +set __BuildNative=1 +set __BuildTests=1 +set __BuildPackages=1 +set __BuildNativeCoreLib=1 :Arg_Loop if "%1" == "" goto ArgsDone -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" == "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" == "arm" (set __BuildArchArm=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "arm64" (set __BuildArchArm64=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "all" (set __BuildAll=1&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "x64" (set __BuildArchX64=1&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "x86" (set __BuildArchX86=1&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "arm" (set __BuildArchArm=1&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "arm64" (set __BuildArchArm64=1&set processedArgs=!processedArgs! %1&goto Arg_Next) -if /i "%1" == "debug" (set __BuildTypeDebug=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "checked" (set __BuildTypeChecked=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "release" (set __BuildTypeRelease=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "debug" (set __BuildTypeDebug=1&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "checked" (set __BuildTypeChecked=1&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "release" (set __BuildTypeRelease=1&set processedArgs=!processedArgs! %1&goto Arg_Next) REM All arguments after this point will be passed through directly to build.cmd on nested invocations REM using the "all" argument, and must be added to the __PassThroughArgs variable. set __PassThroughArgs=%__PassThroughArgs% %1 -if /i "%1" == "clean" (set __CleanBuild=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) - -if /i "%1" == "freebsdmscorlib" (set __CoreLibOnly=1&set __BuildOS=FreeBSD&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "linuxmscorlib" (set __CoreLibOnly=1&set __BuildOS=Linux&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "netbsdmscorlib" (set __CoreLibOnly=1&set __BuildOS=NetBSD&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "osxmscorlib" (set __CoreLibOnly=1&set __BuildOS=OSX&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "windowsmscorlib" (set __CoreLibOnly=1&set __BuildOS=Windows_NT&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) - -if /i "%1" == "nativemscorlib" (set __CoreLibAlsoNativeImage=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "vs2015" (set __VSVersion=%1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "configureonly" (set __ConfigureOnly=1&set __SkipCoreLibBuild=1&set __SkipBuildPackages=1&set __SkipTestBuild=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "skipconfigure" (set __SkipConfigure=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "skipmscorlib" (set __SkipCoreLibBuild=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "skipnative" (set __SkipNativeBuild=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "skiptests" (set __SkipTestBuild=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "skiprestore" (set __SkipRestore=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "skipbuildpackages" (set __SkipBuildPackages=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "sequential" (set __BuildSequential=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "disableoss" (set __SignTypeReal="/p:SignType=real"&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "priority" (set __TestPriority=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) -if /i "%1" == "officialbuildid" (set __OfficialBuildIdArg=/p:OfficialBuildId=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) -if /i "%1" == "buildjit32" (set __BuildJit32="-DBUILD_JIT32=1"&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) - -@REM For backwards compatibility, continue accepting "skiptestbuild", which was the original name of the option. -if /i "%1" == "skiptestbuild" (set __SkipTestBuild=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) - -@REM It was initially /toolset_dir. Not sure why, since it doesn't match the other usage. -if /i "%1" == "/toolset_dir" (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) -if /i "%1" == "toolset_dir" (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) - -if [!processedArgs!]==[] ( - call set unprocessedBuildArgs=!__args! -) else ( - call set unprocessedBuildArgs=%%__args:*!processedArgs!=%% -) +if /i "%1" == "freebsdmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildOS=FreeBSD&set __SkipNugetPackage=1&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "linuxmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildOS=Linux&set __SkipNugetPackage=1&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "netbsdmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildOS=NetBSD&set __SkipNugetPackage=1&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "osxmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildOS=OSX&set __SkipNugetPackage=1&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "windowsmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildOS=Windows_NT&set __SkipNugetPackage=1&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "nativemscorlib" (set __BuildNativeCoreLib=1&set __BuildCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "configureonly" (set __ConfigureOnly=1&set __BuildNative=1&set __BuildNativeCoreLib=0&set __BuildCoreLib=0&set __BuildTests=0&set __BuildPackages=0&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "skipconfigure" (set __SkipConfigure=1&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "skipmscorlib" (set __BuildCoreLib=0&set __BuildNativeCoreLib=0&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "skipnative" (set __BuildNative=0&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "skiptests" (set __BuildTests=0&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "skipbuildpackages" (set __BuildPackages=0&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "buildjit32" (set __BuildJit32="-DBUILD_JIT32=1"&set processedArgs=!processedArgs! %1&goto Arg_Next) +if /i "%1" == "toolset_dir" (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&goto Arg_Next) + +set __UnprocessedBuildArgs=!__UnprocessedBuildArgs! %1 + +:Arg_Next +shift /1 +goto :Arg_Loop :ArgsDone -if defined __ConfigureOnly if defined __SkipConfigure ( - echo "Error: option 'configureonly' is incompatible with 'skipconfigure'" - goto Usage -) - -if defined __SkipCoreLibBuild if defined __CoreLibOnly ( - echo Error: option 'skipmscorlib' is incompatible with 'freebsdmscorlib', 'linuxmscorlib', 'netbsdmscorlib', 'osxmscorlib' and 'windowsmscorlib'. - goto Usage -) - if defined __BuildAll goto BuildAll set /A __TotalSpecifiedBuildArch=__BuildArchX64 + __BuildArchX86 + __BuildArchArm + __BuildArchArm64 @@ -179,7 +138,7 @@ if %__BuildTypeDebug%==1 set __BuildType=Debug if %__BuildTypeChecked%==1 set __BuildType=Checked if %__BuildTypeRelease%==1 set __BuildType=Release -echo %__MsgPrefix%Commencing CoreCLR Repo build +set __RunArgs=-BuildOS=%__BuildOS% -BuildType=%__BuildType% -BuildArch=%__BuildArch% :: Set the remaining variables based upon the determined build configuration set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%" @@ -189,201 +148,100 @@ 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" + if NOT "%__CrossArch%" == "" set __CrossComponentBinDir=%__CrossComponentBinDir%\%__CrossArch% +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 set "__CMakeBinDir=%__BinDir%" set "__CMakeBinDir=%__CMakeBinDir:\=/%" -:: Configure environment if we are doing a clean build. -if not defined __CleanBuild goto SkipCleanBuild -echo %__MsgPrefix%Doing a clean build - -:: MSBuild projects would need a rebuild -set __msbuildCleanBuildArgs=/t:rebuild - -:: Cleanup the previous output for the selected configuration -if exist "%__BinDir%" rd /s /q "%__BinDir%" -if exist "%__IntermediatesDir%" rd /s /q "%__IntermediatesDir%" -if exist "%__LogsDir%" del /f /q "%__LogsDir%\*_%__BuildOS%__%__BuildArch%__%__BuildType%.*" -if exist "%__ProjectDir%\Tools" rd /s /q "%__ProjectDir%\Tools" - -:SkipCleanBuild - if not exist "%__BinDir%" md "%__BinDir%" if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%" if not exist "%__LogsDir%" md "%__LogsDir%" -:: CMake isn't a requirement when building CoreLib only -if defined __CoreLibOnly goto CheckVS - -echo %__MsgPrefix%Checking prerequisites - -:: Validate that PowerShell is accessibile. -for %%X in (powershell.exe) do (set __PSDir=%%~$PATH:X) -if not defined __PSDir goto :NoPS +echo %__MsgPrefix%Commencing CoreCLR Repo build -:: Validate Powershell version -set "PS_VERSION_LOG=%__LogsDir%\ps-version.log" -powershell -NoProfile -ExecutionPolicy unrestricted -Command "$PSVersionTable.PSVersion.Major" > %PS_VERSION_LOG% -set /P PS_VERSION=< %PS_VERSION_LOG% -if %PS_VERSION% LEQ 2 ( - goto :OldPS -) +:: Set the remaining variables based upon the determined build configuration +echo %__MsgPrefix%Checking prerequisites :: Eval the output from probe-win1.ps1 for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy RemoteSigned "& ""%__SourceDir%\pal\tools\probe-win.ps1"""') do %%a -:CheckVS - -set __VSProductVersion= -if /i "%__VSVersion%" == "vs2015" set __VSProductVersion=140 - -:: Check presence of VS -if not defined VS%__VSProductVersion%COMNTOOLS goto NoVS - -set __VSToolsRoot=!VS%__VSProductVersion%COMNTOOLS! -if %__VSToolsRoot:~-1%==\ set "__VSToolsRoot=%__VSToolsRoot:~0,-1%" - -:: Does VS really exist? -if not exist "%__VSToolsRoot%\..\IDE\devenv.exe" goto NoVS -if not exist "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" goto NoVS -if not exist "%__VSToolsRoot%\VsDevCmd.bat" goto NoVS - -:MSBuild14 -set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" -:CheckMSBuild14 -if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe" -if not exist %_msbuildexe% echo %__MsgPrefix%Error: Could not find MSBuild.exe. Please see https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md for build instructions. && exit /b 1 - -:: Note: We've disabled node reuse because it causes file locking issues. -:: The issue is that we extend the build with our own targets which -:: means that that rebuilding cannot successfully delete the task -:: assembly. -set __msbuildCommonArgs=/nologo /nodeReuse:false %__msbuildCleanBuildArgs% %unprocessedBuildArgs% %__OfficialBuildIdArg% - -if not defined __BuildSequential ( - set __msbuildCommonArgs=%__msbuildCommonArgs% /maxcpucount -) -if defined __SkipRestore ( - set __msbuildCommonArgs=%__msbuildCommonArgs% /p:RestoreDuringBuild=false -) - - REM ========================================================================================= REM === -REM === Restore Build Tools +REM === Start the build steps REM === REM ========================================================================================= -call %__ThisScriptPath%init-tools.cmd -if errorlevel 1 ( - echo ERROR: Could not restore build tools. - exit /b 1 -) + +@call %~dp0run.cmd build -generateHeaderWindows -NativeVersionHeaderFile="%__RootBinDir%\obj\_version.h" %__RunArgs% %__UnprocessedBuildArgs% REM ========================================================================================= REM === -REM === Start the build steps +REM === Build the CLR VM REM === REM ========================================================================================= -:: Generate _version.h -if exist "%__RootBinDir%\obj\_version.h" del "%__RootBinDir%\obj\_version.h" -%_msbuildexe% "%__ProjectFilesDir%\build.proj" /t:GenerateVersionHeader /v:minimal /p:NativeVersionHeaderFile="%__RootBinDir%\obj\_version.h" /p:GenerateVersionHeader=true %__OfficialBuildIdArg% -if defined __CoreLibOnly goto PerformCoreLibBuild +if %__BuildNative% EQU 1 ( + echo %__MsgPrefix%Commencing build of native components for %__BuildOS%.%__BuildArch%.%__BuildType% -if defined __SkipNativeBuild ( - echo %__MsgPrefix%Skipping native components build - goto SkipNativeBuild -) - -echo %__MsgPrefix%Commencing build of native components for %__BuildOS%.%__BuildArch%.%__BuildType% - -REM Use setlocal to restrict environment changes form vcvarsall.bat and more to just this native components build section. -setlocal EnableDelayedExpansion EnableExtensions + set nativePlatfromArgs=-platform=%__BuildArch% + if /i "%__BuildArch%" == "arm64" ( set nativePlatfromArgs=-useEnv ) -if /i "%__BuildArch%" == "arm64" ( -rem arm64 builds currently use private toolset which has not been released yet -REM TODO, remove once the toolset is open. -call :PrivateToolSet + set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.log" + set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn" + set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.err" -goto GenVSSolution -) + if /i "%__BuildArch%" == "arm64" ( + rem arm64 builds currently use private toolset which has not been released yet + REM TODO, remove once the toolset is open. + call :PrivateToolSet + goto GenVSSolution + ) -:: Set the environment for the native build -set __VCBuildArch=x86_amd64 -if /i "%__BuildArch%" == "x86" (set __VCBuildArch=x86) -echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" %__VCBuildArch% -call "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" %__VCBuildArch% -@if defined __echo @echo on - -if not defined VSINSTALLDIR ( - echo %__MsgPrefix%Error: VSINSTALLDIR variable not defined. - exit /b 1 -) -if not exist "%VSINSTALLDIR%DIA SDK" goto NoDIA + :: Set the environment for the native build + set __VCBuildArch=x86_amd64 + if /i "%__BuildArch%" == "x86" ( set __VCBuildArch=x86 ) + echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" !__VCBuildArch! + call "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" !__VCBuildArch! + @if defined __echo @echo on + if not defined VSINSTALLDIR ( + echo %__MsgPrefix%Error: VSINSTALLDIR variable not defined. + exit /b 1 + ) + if not exist "!VSINSTALLDIR!DIA SDK" goto NoDIA :GenVSSolution + if defined __SkipConfigure goto SkipConfigure -if defined __SkipConfigure goto SkipConfigure - -echo %__MsgPrefix%Regenerating the Visual Studio solution - -pushd "%__IntermediatesDir%" -call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__BuildArch% %__BuildJit32% -@if defined __echo @echo on -popd + echo %__MsgPrefix%Regenerating the Visual Studio solution + pushd "%__IntermediatesDir%" + call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__BuildArch% %__BuildJit32% + @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 -) - -REM ========================================================================================= -REM === -REM === Build the CLR VM -REM === -REM ========================================================================================= - -if defined __ConfigureOnly goto SkipNativeBuild - -echo %__MsgPrefix%Invoking msbuild - -set "__BuildLog=%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.log" -set "__BuildWrn=%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn" -set "__BuildErr=%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.err" -set __msbuildLogArgs=^ -/fileloggerparameters:Verbosity=normal;LogFile="%__BuildLog%" ^ -/fileloggerparameters1:WarningsOnly;LogFile="%__BuildWrn%" ^ -/fileloggerparameters2:ErrorsOnly;LogFile="%__BuildErr%" ^ -/consoleloggerparameters:Summary ^ -/verbosity:minimal - -set __msbuildArgs="%__IntermediatesDir%\install.vcxproj" %__msbuildCommonArgs% %__msbuildLogArgs% /p:Configuration=%__BuildType% + if not exist "%__IntermediatesDir%\install.vcxproj" ( + echo %__MsgPrefix%Error: failed to generate native component build project! + exit /b 1 + ) -if /i "%__BuildArch%" == "arm64" ( - REM TODO, remove once we have msbuild support for this platform. - set __msbuildArgs=%__msbuildArgs% /p:UseEnv=true -) else ( - set __msbuildArgs=%__msbuildArgs% /p:Platform=%__BuildArch% -) + @call %~dp0run.cmd build -Project=%__IntermediatesDir%\install.vcxproj -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! -configuration=%__BuildType% %nativePlatfromArgs% %__RunArgs% %__UnprocessedBuildArgs% -%_msbuildexe% %__msbuildArgs% -if errorlevel 1 ( - echo %__MsgPrefix%Error: native component build failed. Refer to the build log files for details: - echo %__BuildLog% - echo %__BuildWrn% - echo %__BuildErr% - exit /b 1 + if %errorlevel% == 1 ( + echo %__MsgPrefix%Error: native component build failed. Refer to the build log files for details: + echo "%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.log" + echo "%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn" + echo "%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.err" + exit /b 1 + ) ) - :SkipNativeBuild -REM endlocal to rid us of environment changes from vcvarsall.bat -endlocal - REM ========================================================================================= REM === REM === Build Cross-Architecture Native Components (if applicable) @@ -391,227 +249,155 @@ REM === REM ========================================================================================= REM cross-arch build only enabled for arm64 -if "%__CrossArch%" == "" goto SkipCrossCompBuild - -echo %__MsgPrefix%Commencing build of cross architecture native components for %__BuildOS%.%__BuildArch%.%__BuildType% - -REM Use setlocal to restrict environment changes form vcvarsall.bat and more to just this native components build section. -setlocal EnableDelayedExpansion EnableExtensions - -:: Set the environment for the native build -set __VCBuildArch=x86_amd64 -if /i "%__CrossArch%" == "x86" (set __VCBuildArch=x86) -call "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" %__VCBuildArch% -@if defined __echo @echo on - -set __CrossCompIntermediatesDir=%__IntermediatesDir%\crossgen -if not exist "%__CrossCompIntermediatesDir%" md "%__CrossCompIntermediatesDir%" - -pushd "%__CrossCompIntermediatesDir%" - -set __CMakeBinDir=%__CrossComponentBinDir% -set "__CMakeBinDir=%__CMakeBinDir:\=/%" -set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" -call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__CrossArch% %__ExtraCmakeArgs% -@if defined __echo @echo on -popd - -if not exist "%__CrossCompIntermediatesDir%\install.vcxproj" ( - echo %__MsgPrefix%Error: failed to generate cross-arch components build project! - exit /b 1 -) -if defined __ConfigureOnly goto SkipCrossCompBuild +if /i "%__BuildArch%"=="arm64" ( + + echo %__MsgPrefix%Commencing build of cross architecture native components for %__BuildOS%.%__BuildArch%.%__BuildType% + + :: Set the environment for the native build + set __VCBuildArch=x86_amd64 + if /i "%__CrossArch%" == "x86" ( set __VCBuildArch=x86 ) + @call "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" !__VCBuildArch! + @if defined __echo @echo on + + if not exist "%__CrossCompIntermediatesDir%" md "%__CrossCompIntermediatesDir%" + if defined __SkipConfigure goto SkipConfigureCrossBuild + + pushd "%__CrossCompIntermediatesDir%" + set __CMakeBinDir=%__CrossComponentBinDir% + set "__CMakeBinDir=%__CMakeBinDir:\=/%" + set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" + call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__CrossArch% %__ExtraCmakeArgs% + @if defined __echo @echo on + popd +:SkipConfigureCrossBuild + if not exist "%__CrossCompIntermediatesDir%\install.vcxproj" ( + echo %__MsgPrefix%Error: failed to generate cross-arch components build project! + exit /b 1 + ) -echo %__MsgPrefix%Invoking msbuild + if defined __ConfigureOnly goto SkipCrossCompBuild -set "__BuildLog=%__LogsDir%\CrossComp_%__BuildOS%__%__BuildArch%__%__BuildType%.log" -set "__BuildWrn=%__LogsDir%\CrossComp_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn" -set "__BuildErr=%__LogsDir%\CrossComp_%__BuildOS%__%__BuildArch%__%__BuildType%.err" -set __msbuildLogArgs=^ -/fileloggerparameters:Verbosity=normal;LogFile="%__BuildLog%" ^ -/fileloggerparameters1:WarningsOnly;LogFile="%__BuildWrn%" ^ -/fileloggerparameters2:ErrorsOnly;LogFile="%__BuildErr%" ^ -/consoleloggerparameters:Summary ^ -/verbosity:minimal + echo %__MsgPrefix%Invoking msbuild -set __msbuildArgs="%__CrossCompIntermediatesDir%\install.vcxproj" %__msbuildCommonArgs% %__msbuildLogArgs% /p:Configuration=%__BuildType% /p:Platform=%__CrossArch% + set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__LogsDir%\Cross_%__BuildOS%__%__BuildArch%__%__BuildType%.log" + set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__LogsDir%\Cross_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn" + set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__LogsDir%\Cross_%__BuildOS%__%__BuildArch%__%__BuildType%.err" -%_msbuildexe% %__msbuildArgs% -if errorlevel 1 ( - echo %__MsgPrefix%Error: cross-arch components build failed. Refer to the build log files for details: - echo %__BuildLog% - echo %__BuildWrn% - echo %__BuildErr% - exit /b 1 + @call %~dp0run.cmd build -Project=%__CrossCompIntermediatesDir%\install.vcxproj -configuration=%__BuildType% -platform=%__CrossArch% -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! %__RunArgs% %__UnprocessedBuildArgs% + if %errorlevel% == 1 ( + echo %__MsgPrefix%Error: cross-arch components build failed. Refer to the build log files for details: + echo "%__LogsDir%\Cross_%__BuildOS%__%__BuildArch%__%__BuildType%.log" + echo "%__LogsDir%\Cross_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn" + echo "%__LogsDir%\Cross_%__BuildOS%__%__BuildArch%__%__BuildType%.err" + exit /b 1 + ) ) -REM endlocal to rid us of environment changes from vcvarsall.bat -endlocal - :SkipCrossCompBuild - REM ========================================================================================= REM === REM === CoreLib and NuGet package build section. REM === REM ========================================================================================= -:PerformCoreLibBuild - -REM setlocal to prepare for vsdevcmd.bat -setlocal EnableDelayedExpansion EnableExtensions - -rem Explicitly set Platform causes conflicts in CoreLib project files. Clear it to allow building from VS x64 Native Tools Command Prompt -set Platform= - -:: Set the environment for the managed build -echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\VsDevCmd.bat" -call "%__VSToolsRoot%\VsDevCmd.bat" - -if defined __SkipCoreLibBuild ( - echo %__MsgPrefix%Skipping System.Private.CoreLib build - goto SkipCoreLibBuild -) - -echo %__MsgPrefix%Commencing build of System.Private.CoreLib for %__BuildOS%.%__BuildArch%.%__BuildType% - -set "__BuildLog=%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.log" -set "__BuildWrn=%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn" -set "__BuildErr=%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.err" -set __msbuildLogArgs=^ -/fileloggerparameters:Verbosity=normal;LogFile="%__BuildLog%" ^ -/fileloggerparameters1:WarningsOnly;LogFile="%__BuildWrn%" ^ -/fileloggerparameters2:ErrorsOnly;LogFile="%__BuildErr%" ^ -/consoleloggerparameters:Summary ^ -/verbosity:minimal - -set __msbuildArgs="%__ProjectFilesDir%\build.proj" %__msbuildCommonArgs% %__msbuildLogArgs% %__SignTypeReal% - -set __BuildNugetPackage=true -if defined __CoreLibOnly set __BuildNugetPackage=false -if /i "%__BuildArch%" =="arm64" set __BuildNugetPackage=false -if %__BuildNugetPackage%==false set __msbuildArgs=%__msbuildArgs% /p:BuildNugetPackage=false - -%_msbuildexe% %__msbuildArgs% -if errorlevel 1 ( - echo %__MsgPrefix%Error: System.Private.CoreLib build failed. Refer to the build log files for details: - echo %__BuildLog% - echo %__BuildWrn% - echo %__BuildErr% - type %__BuildErr% - exit /b 1 +if %__BuildCoreLib% EQU 1 ( + + echo %__MsgPrefix%Commencing build of System.Private.CoreLib for %__BuildOS%.%__BuildArch%.%__BuildType% + rem Explicitly set Platform causes conflicts in CoreLib project files. Clear it to allow building from VS x64 Native Tools Command Prompt + set Platform= + + :: Set the environment for the managed build + echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\VsDevCmd.bat" + call "%__VSToolsRoot%\VsDevCmd.bat" + + set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.log" + set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn" + set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.err" + + if /i "%__BuildArch%" == "arm64" ( + set __nugetBuildArgs=-buildNugetPackage=false + ) else if "%__SkipNugetPackage%" == "1" ( + set __nugetBuildArgs=-buildNugetPackage=false + ) else ( + set __nugetBuildArgs=-buildNugetPackage=true + ) + + @call %~dp0run.cmd build -buildCoreLib -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! %__RunArgs% %__UnprocessedBuildArgs% !__nugetBuildArgs! + if %errorlevel% == 1 ( + echo %__MsgPrefix%Error: System.Private.CoreLib build failed. Refer to the build log files for details: + echo "%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.log" + echo "%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn" + echo "%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.err" + exit /b 1 + ) ) -if defined __CoreLibOnly ( - echo %__MsgPrefix%System.Private.CoreLib successfully built. - if not defined __CoreLibAlsoNativeImage ( - exit /b 0 +if %__BuildNativeCoreLib% EQU 1 ( + echo %__MsgPrefix%Generating native image of System.Private.CoreLib for %__BuildOS%.%__BuildArch%.%__BuildType% + + echo "%__CrossgenExe%" /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\System.Private.CoreLib.ni.dll" "%__BinDir%\System.Private.CoreLib.dll" + "%__CrossgenExe%" /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\System.Private.CoreLib.ni.dll" "%__BinDir%\System.Private.CoreLib.dll" > "%__CrossGenCoreLibLog%" 2>&1 + if NOT %errorlevel% == 0 ( + echo %__MsgPrefix%Error: CrossGen System.Private.CoreLib build failed. Refer to the build log file for details: + echo %__CrossGenCoreLibLog% + exit /b 1 ) -) -echo %__MsgPrefix%Generating native image of System.Private.CoreLib for %__BuildOS%.%__BuildArch%.%__BuildType% + echo %__MsgPrefix%Generating native image of MScorlib facade for %__BuildOS%.%__BuildArch%.%__BuildType% -set "__CrossGenCoreLibLog=%__LogsDir%\CrossgenCoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.log" -set "__CrossgenExe=%__CrossComponentBinDir%\crossgen.exe" -"%__CrossgenExe%" /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\System.Private.CoreLib.ni.dll" "%__BinDir%\System.Private.CoreLib.dll" > "%__CrossGenCoreLibLog%" 2>&1 -if NOT %errorlevel% == 0 ( - echo %__MsgPrefix%Error: CrossGen System.Private.CoreLib build failed. Refer to the build log file for details: - echo %__CrossGenCoreLibLog% - type %__CrossGenCoreLibLog% - exit /b 1 + set "__CrossGenCoreLibLog=%__LogsDir%\CrossgenMSCoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.log" + set "__CrossgenExe=%__CrossComponentBinDir%\crossgen.exe" + "%__CrossgenExe%" /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\mscorlib.ni.dll" "%__BinDir%\mscorlib.dll" > "%__CrossGenCoreLibLog%" 2>&1 + if NOT %errorlevel% == 0 ( + echo %__MsgPrefix%Error: CrossGen mscorlib facade build failed. Refer to the build log file for details: + echo %__CrossGenCoreLibLog% + exit /b 1 + ) ) -echo %__MsgPrefix%Generating native image of MScorlib facade for %__BuildOS%.%__BuildArch%.%__BuildType% +if %__BuildPackages% EQU 1 ( -set "__CrossGenCoreLibLog=%__LogsDir%\CrossgenMSCoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.log" -set "__CrossgenExe=%__CrossComponentBinDir%\crossgen.exe" -"%__CrossgenExe%" /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\mscorlib.ni.dll" "%__BinDir%\mscorlib.dll" > "%__CrossGenCoreLibLog%" 2>&1 -if NOT %errorlevel% == 0 ( - echo %__MsgPrefix%Error: CrossGen mscorlib facade build failed. Refer to the build log file for details: - echo %__CrossGenCoreLibLog% - type %__CrossGenCoreLibLog% - exit /b 1 -) + set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__LogsDir%\Nuget_%__BuildOS%__%__BuildArch%__%__BuildType%.log" + set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__LogsDir%\Nuget_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn" + set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__LogsDir%\Nuget_%__BuildOS%__%__BuildArch%__%__BuildType%.err" -if defined __CoreLibAlsoNativeImage ( - exit /b 0 -) + REM The conditions as to what to build are captured in the builds file. + @call %~dp0run.cmd build -buildPackages -platform=%__BuildArch% -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! %__RunArgs% %__UnprocessedBuildArgs% -:SkipCoreLibBuild - -:GenerateNuget -if /i "%__SkipBuildPackages%" == "1" goto :SkipNuget - -set "__BuildLog=%__LogsDir%\Nuget_%__BuildOS%__%__BuildArch%__%__BuildType%.log" -set "__BuildWrn=%__LogsDir%\Nuget_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn" -set "__BuildErr=%__LogsDir%\Nuget_%__BuildOS%__%__BuildArch%__%__BuildType%.err" -set __msbuildLogArgs=^ -/fileloggerparameters:Verbosity=normal;LogFile="%__BuildLog%" ^ -/fileloggerparameters1:WarningsOnly;LogFile="%__BuildWrn%" ^ -/fileloggerparameters2:ErrorsOnly;LogFile="%__BuildErr%" ^ -/consoleloggerparameters:Summary ^ -/verbosity:minimal - -REM The conditions as to what to build are captured in the builds file. -set __msbuildArgs="%__ProjectFilesDir%\src\.nuget\packages.builds" /p:Platform=%__BuildArch% -%_msbuildexe% !__msbuildArgs! %__msbuildLogArgs% -if errorlevel 1 ( - echo %__MsgPrefix%Error: Nuget package generation failed build failed. Refer to the build log files for details: - echo %__BuildLog% - echo %__BuildWrn% - echo %__BuildErr% - exit /b 1 + if %errorlevel% == 1 ( + echo %__MsgPrefix%Error: Nuget package generation failed build failed. Refer to the build log files for details: + echo "%__LogsDir%\Nuget_%__BuildOS%__%__BuildArch%__%__BuildType%.log" + echo "%__LogsDir%\Nuget_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn" + echo "%__LogsDir%\Nuget_%__BuildOS%__%__BuildArch%__%__BuildType%.err" + exit /b 1 + ) ) - -:SkipNuget - -REM endlocal to rid us of environment changes from vsdevenv.bat -endlocal - REM ========================================================================================= REM === REM === Test build section REM === REM ========================================================================================= -if defined __SkipTestBuild ( - echo %__MsgPrefix%Skipping test build - goto SkipTestBuild -) - -echo %__MsgPrefix%Commencing build of tests for %__BuildOS%.%__BuildArch%.%__BuildType% +if %__BuildTests% EQU 1 ( + echo %__MsgPrefix%Commencing build of tests for %__BuildOS%.%__BuildArch%.%__BuildType% -REM Construct the arguments to pass to the test build script. + REM Construct the arguments to pass to the test build script. -set __BuildtestArgs=%__BuildArch% %__BuildType% %__VSVersion% + rem arm64 builds currently use private toolset which has not been released yet + REM TODO, remove once the toolset is open. + if /i "%__BuildArch%" == "arm64" call :PrivateToolSet -if defined __CleanBuild ( - set "__BuildtestArgs=%__BuildtestArgs% clean" -) - -if defined __BuildSequential ( - set "__BuildtestArgs=%__BuildtestArgs% sequential" -) + echo "%__ProjectDir%\build-test.cmd %__BuildArch% %__BuildType% %__UnprocessedBuildArgs%" + @call %__ProjectDir%\build-test.cmd %__BuildArch% %__BuildType% %__UnprocessedBuildArgs% -if defined __TestPriority ( - set "__BuildtestArgs=%__BuildtestArgs% Priority %__TestPriority%" -) - -rem arm64 builds currently use private toolset which has not been released yet -REM TODO, remove once the toolset is open. -if /i "%__BuildArch%" == "arm64" call :PrivateToolSet - -call %__ProjectDir%\tests\buildtest.cmd %__BuildtestArgs% - -if errorlevel 1 ( - REM buildtest.cmd has already emitted an error message and mentioned the build log file to examine. - exit /b 1 + if %errorlevel% == 1 ( + REM buildtest.cmd has already emitted an error message and mentioned the build log file to examine. + exit /b 1 + ) ) -:SkipTestBuild - REM ========================================================================================= REM === REM === All builds complete! @@ -620,7 +406,7 @@ REM ============================================================================ echo %__MsgPrefix%Repo successfully built. echo %__MsgPrefix%Product binaries are available at !__BinDir! -if not defined __SkipTestBuild ( +if %__BuildTests% EQU 1 ( echo %__MsgPrefix%Test binaries are available at !__TestBinDir! ) exit /b 0 @@ -692,7 +478,7 @@ set __BuildType=%2 set __NextCmd=call %__ThisScriptFull% %__BuildArch% %__BuildType% %__PassThroughArgs% echo %__MsgPrefix%Invoking: %__NextCmd% %__NextCmd% -if errorlevel 1 ( +if %errorlevel% == 1 ( echo %__MsgPrefix% %__BuildArch% %__BuildType% %__PassThroughArgs% >> %__BuildResultFile% set __AllBuildSuccess=false ) @@ -709,36 +495,36 @@ echo. echo Build the CoreCLR repo. echo. echo Usage: -echo %__ThisScriptShort% [option1] [option2] ... +echo build.cmd [option1] [option2] echo or: -echo %__ThisScriptShort% all [option1] [option2] ... +echo build.cmd all [option1] [option2] -- ... echo. echo All arguments are optional. The options are: echo. -echo./? -? /h -h /help -help: view this message. +echo.-? -h -help: view this message. +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 Visual Studio version: ^(default: VS2015^). -echo clean: force a clean build ^(default is to perform an incremental build^). -echo msbuildargs ... : all arguments following this tag will be passed directly to msbuild. +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, echo respectively^). echo add nativemscorlib to go further and build the native image for designated mscorlib. -echo priority ^<N^> : specify a set of test that will be built and run, with priority N. -echo sequential: force a non-parallel build ^(default is to build in parallel -echo using all processors^). +echo toolset_dir ^<dir^> : set the toolset directory -- Arm64 use only. Required for Arm64 builds. echo configureonly: skip all builds; only run CMake ^(default: CMake and builds are run^) echo skipconfigure: skip CMake ^(default: CMake is run^) echo skipmscorlib: skip building System.Private.CoreLib ^(default: System.Private.CoreLib is built^). echo skipnative: skip building native components ^(default: native components are built^). echo skiptests: skip building tests ^(default: tests are built^). -echo skiprestore: skip restoring packages ^(default: packages are restored during build^). echo skipbuildpackages: skip building nuget packages ^(default: packages are built^). -echo disableoss: Disable Open Source Signing for System.Private.CoreLib. -echo toolset_dir ^<dir^> : set the toolset directory -- Arm64 use only. Required for Arm64 builds. -echo officialbuildid ^<ID^>: specify the official build ID to be used by this build. +echo -skiprestore: skip restoring packages ^(default: packages are restored during build^). +echo -disableoss: Disable Open Source Signing for System.Private.CoreLib. +echo -priority=^<N^> : specify a set of test that will be built and run, with priority N. +echo -sequential: force a non-parallel build ^(default is to build in parallel +echo using all processors^). +echo -officialbuildid=^<ID^>: specify the official build ID to be used by this build. +echo -Rebuild: force a clean build ^(default is to perform an incremental build^). echo. echo If "all" is specified, then all build architectures and types are built. If, in addition, echo one or more build architectures or types is specified, then only those build architectures @@ -753,23 +539,6 @@ echo build all x64 x86 Checked Release echo -- builds x64 and x86 architectures, Checked and Release build types for each exit /b 1 -:NoPS -echo PowerShell v3.0 or later is a prerequisite to build this repository, but it is not accessible. -echo Ensure that it is defined in the PATH environment variable. -echo Typically it should be %%SYSTEMROOT%%\System32\WindowsPowerShell\v1.0\. -exit /b 1 - -:OldPS -echo PowerShell v3.0 or later is a prerequisite to build this repository. -echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md -echo Download via https://www.microsoft.com/en-us/download/details.aspx?id=40855 -exit /b 1 - -:NoVS -echo Visual Studio 2015+ ^(Community is free^) is a prerequisite to build this repository. -echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md -exit /b 1 - :NoDIA echo Error: DIA SDK is missing at "%VSINSTALLDIR%DIA SDK". ^ This is due to a bug in the Visual Studio installer. It does not install DIA SDK at "%VSINSTALLDIR%" but rather ^ @@ -27,11 +27,9 @@ fi usage() { - echo "Usage: $0 [BuildArch] [BuildType] [clean] [verbose] [coverage] [cross] [clangx.y] [ninja] [configureonly] [skipconfigure] [skipnative] [skipmscorlib] [skiptests] [cmakeargs] [bindir]" + echo "Usage: $0 [BuildArch] [BuildType] [verbose] [coverage] [cross] [clangx.y] [ninja] [configureonly] [skipconfigure] [skipnative] [skipmscorlib] [skiptests] [cmakeargs] [bindir]" echo "BuildArch can be: x64, x86, arm, arm-softfp, arm64" echo "BuildType can be: debug, checked, release" - echo "clean - optional argument to force a clean build." - echo "verbose - optional argument to enable verbose build output." echo "coverage - optional argument to enable code coverage build (currently supported only for Linux and OSX)." echo "ninja - target ninja instead of GNU make" echo "clangx.y - optional argument to build using clang version x.y." @@ -42,9 +40,15 @@ usage() echo "skipnative - do not build native components." echo "skipmscorlib - do not build mscorlib.dll." echo "skiptests - skip the tests in the 'tests' subdirectory." - echo "skiprestore - skip restoring nuget packages." echo "skipnuget - skip building nuget packages." - echo "disableoss - Disable Open Source Signing for mscorlib." + echo "verbose - optional argument to enable verbose build output." + echo "-skiprestore: skip restoring packages ^(default: packages are restored during build^)." + echo "-disableoss: Disable Open Source Signing for System.Private.CoreLib." + echo "-priority=^<N^> : specify a set of test that will be built and run, with priority N." + echo "-sequential: force a non-parallel build ^(default is to build in parallel" + echo " using all processors^)." + echo "-officialbuildid=^<ID^>: specify the official build ID to be used by this build." + echo "-Rebuild: force a clean build ^(default is to perform an incremental build^)." echo "skipgenerateversion - disable version generation even if MSBuild is supported." echo "cmakeargs - user-settable additional arguments passed to CMake." echo "bindir - output directory (defaults to $__ProjectRoot/bin)" @@ -75,21 +79,6 @@ setup_dirs() mkdir -p "$__IntermediatesDir" } -# Performs "clean build" type actions (deleting and remaking directories) - -clean() -{ - echo Cleaning previous output for the selected configuration - rm -rf "$__BinDir" - rm -rf "$__IntermediatesDir" - - rm -rf "$__TestWorkingDir" - rm -rf "$__TestIntermediatesDir" - - rm -rf "$__LogsDir/*_$__BuildOS__$__BuildArch__$__BuildType.*" - rm -rf "$__ProjectRoot/Tools" -} - # Check the system to ensure the right prereqs are in place check_prereqs() @@ -159,8 +148,6 @@ build_coreclr() echo "Commencing build of native components for $__BuildOS.$__BuildArch.$__BuildType in $__IntermediatesDir" - cd "$__IntermediatesDir" - generator="" buildFile="Makefile" buildTool="make" @@ -176,13 +163,14 @@ build_coreclr() # Drop version.c file __versionSourceFile=$__IntermediatesDir/version.cpp if [ $__SkipGenerateVersion == 0 ]; then - "$__ProjectRoot/init-tools.sh" > "$__ProjectRoot/init-tools.log" - echo "Running: \"$__ProjectRoot/Tools/dotnetcli/dotnet\" \"$__ProjectRoot/Tools/MSBuild.exe\" \"$__ProjectRoot/build.proj\" /v:minimal /t:GenerateVersionSourceFile /p:NativeVersionSourceFile=$__versionSourceFile /p:GenerateVersionSourceFile=true /v:minimal $__OfficialBuildIdArg" - "$__ProjectRoot/Tools/dotnetcli/dotnet" "$__ProjectRoot/Tools/MSBuild.exe" "$__ProjectRoot/build.proj" /v:minimal /t:GenerateVersionSourceFile /p:NativeVersionSourceFile=$__versionSourceFile /p:GenerateVersionSourceFile=true /v:minimal $__OfficialBuildIdArg + echo "Running: \"$__ProjectRoot/run.sh\" build -generateHeaderUnix -NativeVersionSourceFile=$__versionSourceFile $__RunArgs $__UnprocessedBuildArgs" + "$__ProjectRoot/run.sh" build -generateHeaderUnix -NativeVersionSourceFile=$__versionSourceFile $__RunArgs $__UnprocessedBuildArgs else __versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";" echo $__versionSourceLine > $__versionSourceFile fi + + pushd "$__IntermediatesDir" # Regenerate the CMake solution echo "Invoking \"$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh\" \"$__ProjectRoot\" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__BuildType $__CodeCoverage $__IncludeTests $generator $__cmakeargs" "$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh" "$__ProjectRoot" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__BuildType $__CodeCoverage $__IncludeTests $generator "$__cmakeargs" @@ -215,16 +203,7 @@ build_coreclr() echo "Failed to build coreclr components." exit 1 fi -} - -restoreBuildTools() -{ - echo "Restoring BuildTools..." - $__ProjectRoot/init-tools.sh - if [ $? -ne 0 ]; then - echo "Failed to restore BuildTools." - exit 1 - fi + popd } isMSBuildOnNETCoreSupported() @@ -305,14 +284,10 @@ build_CoreLib() return fi - # Restore buildTools - - restoreBuildTools - echo "Commencing build of managed components for $__BuildOS.$__BuildArch.$__BuildType" # Invoke MSBuild - $__ProjectRoot/Tools/dotnetcli/dotnet "$__MSBuildPath" /nologo "$__ProjectRoot/build.proj" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__LogsDir/System.Private.CoreLib_$__BuildOS__$__BuildArch__$__BuildType.log" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir /p:BuildNugetPackage=false /p:UseSharedCompilation=false ${__SignTypeReal} + $__ProjectRoot/run.sh build -buildCoreLib -MsBuildLog="/flp:Verbosity=normal;LogFile=$__LogsDir/System.Private.CoreLib_$__BuildOS__$__BuildArch__$__BuildType.log" -BuildTarget -__IntermediatesDir=$__IntermediatesDir -__RootBinDir=$__RootBinDir -BuildNugetPackage=false -UseSharedCompilation=false $__RunArgs $__UnprocessedBuildArgs if [ $? -ne 0 ]; then echo "Failed to build managed components." @@ -348,17 +323,10 @@ generate_NugetPackages() return fi - if [ $__SkipMSCorLib == 1 ]; then - # Restore buildTools, since we skipped doing so with the mscorlib build. - restoreBuildTools - - echo "Unable to generate Microsoft.NETCore.Runtime.CoreCLR nuget package since mscorlib was not built." - fi - echo "Generating nuget packages for "$__BuildOS # Build the packages - $__ProjectRoot/Tools/dotnetcli/dotnet "$__MSBuildPath" /nologo "$__ProjectRoot/src/.nuget/packages.builds" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__LogsDir/Nuget_$__BuildOS__$__BuildArch__$__BuildType.log" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir /p:BuildNugetPackage=false /p:UseSharedCompilation=false + $__ProjectRoot/run.sh build -buildPackages -MsBuildLog="/flp:Verbosity=normal;LogFile=$__LogsDir/Nuget_$__BuildOS__$__BuildArch__$__BuildType.log" -BuildTarget -__IntermediatesDir=$__IntermediatesDir -__RootBinDir=$__RootBinDir -BuildNugetPackage=false -UseSharedCompilation=false $__RunArgs $__UnprocessedBuildArgs if [ $? -ne 0 ]; then echo "Failed to generate Nuget packages." @@ -466,25 +434,22 @@ __SourceDir="$__ProjectDir/src" __PackagesDir="$__ProjectDir/packages" __RootBinDir="$__ProjectDir/bin" __UnprocessedBuildArgs= +__RunArgs= __MSBCleanBuildArgs= __UseNinja=0 +__VerboseBuild=0 __ConfigureOnly=0 __SkipConfigure=0 __SkipRestore="" __SkipNuget=0 __SkipCoreCLR=0 __SkipMSCorLib=0 -__CleanBuild=0 -__VerboseBuild=0 -__SignTypeReal="" __CrossBuild=0 __ClangMajorVersion=0 __ClangMinorVersion=0 -__MSBuildPath=$__ProjectRoot/Tools/MSBuild.exe __NuGetPath="$__PackagesDir/NuGet.exe" __DistroRid="" __cmakeargs="" -__OfficialBuildIdArg= __SkipGenerateVersion=0 while :; do @@ -535,18 +500,14 @@ while :; do __CodeCoverage=Coverage ;; - clean) - __CleanBuild=1 - ;; - - verbose) - __VerboseBuild=1 - ;; - cross) __CrossBuild=1 ;; + verbose) + __VerboseBuild=1 + ;; + clang3.5) __ClangMajorVersion=3 __ClangMinorVersion=5 @@ -607,18 +568,10 @@ while :; do __IncludeTests= ;; - skiprestore) - __SkipRestore="/p:RestoreDuringBuild=true" - ;; - skipnuget) __SkipNuget=1 ;; - disableoss) - __SignTypeReal="/p:SignType=real" - ;; - cmakeargs) if [ -n "$2" ]; then __cmakeargs="$2" @@ -646,17 +599,21 @@ while :; do ;; *) - if [[ $1 == "/p:OfficialBuildId="* ]]; then - __OfficialBuildIdArg=$1 - else - __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1" - fi + __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1" ;; esac shift done +__RunArgs="-BuildArch=$__BuildArch -BuildType=$__BuildType -BuildOS=$__BuildOS" + +# Configure environment if we are doing a verbose build +if [ $__VerboseBuild == 1 ]; then + export VERBOSE=1 + __RunArgs="$__RunArgs -verbose" +fi + # Set default clang version if [[ $__ClangMajorVersion == 0 && $__ClangMinorVersion == 0 ]]; then if [ $__CrossBuild == 1 ]; then @@ -671,11 +628,6 @@ fi # Set dependent variables __LogsDir="$__RootBinDir/Logs" -if [[ $__ConfigureOnly == 1 && $__SkipConfigure == 1 ]]; then - echo "configureonly and skipconfigure are mutually exclusive!" - exit 1 -fi - # init the distro name initDistroRid @@ -705,16 +657,6 @@ fi # This is where all built CoreClr libraries will copied to. export __CMakeBinDir="$__BinDir" -# Configure environment if we are doing a clean build. -if [ $__CleanBuild == 1 ]; then - clean -fi - -# Configure environment if we are doing a verbose build -if [ $__VerboseBuild == 1 ]; then - export VERBOSE=1 -fi - # Configure environment if we are doing a cross compile. if [ $__CrossBuild == 1 ]; then export CROSSCOMPILE=1 @@ -17,28 +17,28 @@ if [%1]==[] ( :Loop if [%1]==[] goto Begin -if /I [%1] == [/?] goto Usage -if /I [%1] == [/help] goto Usage +if /I [%1] == [-?] goto Usage +if /I [%1] == [-help] goto Usage -if /I [%1] == [/p] ( +if /I [%1] == [-p] ( set packages=true set thisArgs=!thisArgs!%1 goto Next ) -if /I [%1] == [/b] ( +if /I [%1] == [-b] ( set bin=true set thisArgs=!thisArgs!%1 goto Next ) -if /I [%1] == [/t] ( +if /I [%1] == [-t] ( set tools=true set thisArgs=!thisArgs!%1 goto Next ) -if /I [%1] == [/all] ( +if /I [%1] == [-all] ( set tools=true set bin=true set packages=true @@ -96,10 +96,10 @@ exit /b 0 echo. echo Repository cleaning script. echo Options: -echo /b - Cleans the bin directory -echo /p - Cleans the packages directory -echo /t - Cleans the tools directory -echo /all - Cleans everything +echo -b - Cleans the bin directory +echo -p - Cleans the packages directory +echo -t - Cleans the tools directory +echo -all - Cleans everything echo. -echo If no option is specified then clean.cmd /b /p /t is implied. +echo If no option is specified then clean.cmd -b -p -t is implied. exit /b
\ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000000..c84c771713 --- /dev/null +++ b/config.json @@ -0,0 +1,541 @@ +{ + "settings": { + "CloudDropAccessToken": { + "description": "Azure access token", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "CloudDropAccountName": { + "description": "Azure account name.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "BuildNumberMajor": { + "description": "Product build major number.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "BuildNumberMinor": { + "description": "Product build minor number.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "MsBuildParameters": { + "description": "MsBuild building options.", + "valueType": "passThrough", + "values": [], + "defaultValue": "/nologo /verbosity:minimal /clp:Summary" + }, + "MsBuildFileLogging": { + "description": "MsBuild logging options.", + "valueType": "passThrough", + "values": [], + "defaultValue": "/flp:v=normal" + }, + "MsBuildEventLogging": { + "description": "MsBuild logging options.", + "valueType": "passThrough", + "values": [], + "defaultValue": "/l:BinClashLogger,Tools/net45/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log" + }, + "FilterToOSGroup": { + "description": "Specifies the OSGroup.", + "valueType": "property", + "values": [ "Windows_NT", "Linux", "Unix", "OSX" ], + "defaultValue": "${OSName}" + }, + "RestoreNETCorePlatforms": { + "description": "MsBuild target that restores the NETCore packages.", + "valueType": "target", + "values": [], + "defaultValue": "" + }, + "RestoreDuringBuild": { + "description": "Enables/disables package restore.", + "valueType": "property", + "values": [ true, false ], + "defaultValue": true + }, + "Project": { + "description": "Project where the commands are going to be applied.", + "valueType": "passThrough", + "values": [], + "defaultValue": "" + }, + "__BuildType": { + "description": "Specifies the configuration to publish packages", + "valueType": "property", + "values": [ "release", "debug", "checked" ], + "defaultValue": "debug" + }, + "__BuildArch": { + "description": "Specifies the architecture to publish packages", + "valueType": "property", + "values": [ "x64", "x86", "arm", "arm64" ], + "defaultValue": "${CPUArch}" + }, + "__BuildOS": { + "description": "Specifies the OS to publish packages.", + "valueType": "property", + "values": [ "Linux", "OSX", "FreeBSD", "OpenBSD", "NetBSD", "SunOS", "Windows_NT" ], + "defaultValue": "${OSName}" + }, + "__DistroRid": { + "description": "Specifies the distro rid for Unix OS.", + "valueType": "property", + "values": [], + "defaultValue": "${OSRid}" + }, + "__VSVersion": { + "description": "Sets the Visual Studio version to use.", + "valueType": "property", + "values": [], + "defaultValue": "vs2015" + }, + "__ProjectDir": { + "description": "Directory of the dir.props file.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "__SourceDir": { + "description": "Source directory.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "__PackagesDir": { + "description": "Packages directory.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "__RootBinDir": { + "description": "Root bin directory.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "__BinDir": { + "description": "Bin directory of specific OS, Arch and Type being built.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "__IntermediatesDir": { + "description": "Intermediates bin directory.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "__PackagesBinDir": { + "description": "Packages bin directory.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "__TestWorkingDir": { + "description": "Test working directory.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "GenerateVersionHeader": { + "description": "Generates _version.h", + "valueType": "passThrough", + "values": [], + "defaultValue": "/t:GenerateVersionHeader /p:GenerateVersionHeader=true" + }, + "GenerateVersionSourceFile": { + "description": "Generate version.cpp", + "valueType": "passThrough", + "values": [], + "defaultValue": "/t:GenerateVersionSourceFile /p:GenerateVersionSourceFile=true" + }, + "NativeVersionSourceFile": { + "description": "Provides location for version.cpp", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "NativeVersionHeaderFile": { + "description": "Provides location for _version.h", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "OfficialBuildId": { + "description": "Official Build Id.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "Configuration": { + "description": "Specifies the build type for native build.", + "valueType": "property", + "values": [ "debug", "release", "checked" ], + "defaultValue": "debug" + }, + "UseEnv": { + "description": "Set when building for arm64.", + "valueType": "property", + "values": [ true, false ], + "defaultValue": true + }, + "Platform": { + "description": "Sets the build arch for native build.", + "valueType": "property", + "values": [ "x86", "x64", "arm", "arm64" ], + "defaultValue": "${CPUArch}" + }, + "Rebuild": { + "description": "Specifies rebuild target.", + "valueType": "target", + "values": [], + "defaultValue": "" + }, + "MsBuildLog": { + "description": "Specifies build logs for build alias.", + "valueType": "passThrough", + "values": [], + "defaultValue": "" + }, + "MsBuildWrn": { + "description": "Specifies build logs for build alias.", + "valueType": "passThrough", + "values": [], + "defaultValue": "" + }, + "MsBuildErr": { + "description": "Specifies build logs for build alias.", + "valueType": "passThrough", + "values": [], + "defaultValue": "" + }, + "BuildNugetPackage": { + "description": "Specifies to build nuget packages.", + "valueType": "property", + "values": [ true, false ], + "defaultValue": true + }, + "SignType": { + "description": "Sets the SignType.", + "valueType": "property", + "values": [ "real" ], + "defaultValue": "" + }, + "maxcpucount": { + "description": "Msbuild internal command.", + "valueType": "internal", + "values": [], + "defaultValue": "" + }, + "CLRTestPriorityToBuild": { + "description": "Sets priority to build test.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "IlasmRoundTrip": { + "description": "Sets ilasm round trip property.", + "valueType": "property", + "values": [ true, false ], + "defaultValue": true + }, + "CreateTestOverlay": { + "description": "Runs CreateTestOverlay target.", + "valueType": "target", + "values": [], + "defaultValue": "" + }, + "Verbosity": { + "description": "Sets build verbosity.", + "valueType": "passThrough", + "values": [], + "defaultValue": "/v:normal" + }, + "Build": { + "description": "Runs the build target.", + "valueType": "target", + "values": [], + "defaultValue": "" + }, + "UseSharedCompilation": { + "description": "Sets the use shared compilation property.", + "valueType": "property", + "values": [ true, false ], + "defaultValue": true + }, + "UpdateInvalidPackageVersions": { + "description": "Runs the target to update package versions.", + "valueType": "target", + "values": [], + "defaultValue": "" + } + }, + "commands": { + "build": { + "alias": { + "generateHeaderWindows": { + "description": "Generates _version.h", + "settings": { + "GenerateVersionHeader": "default", + "NativeVersionHeaderFile": "default", + "Project": "./build.proj" + } + }, + "generateHeaderUnix": { + "description": "Generates version.cpp", + "settings": { + "GenerateVersionSourceFile": "default", + "NativeVersionSourceFile": "default", + "Project": "./build.proj" + } + }, + "buildCoreLib": { + "description": "Builds System.Private.CoreLib.", + "settings": { + "Project": "./build.proj" + } + }, + "buildPackages": { + "description": "Builds nuget packages.", + "settings": { + "Project": "./src/.nuget/packages.builds" + } + }, + "verbose": { + "description": "Sets the verbosity", + "settings": { + "Verbosity": "/v:detailed" + } + }, + "disableoss": { + "description": "Sets the sign type.", + "settings": { + "SignType": "real" + } + }, + "buildType": { + "description": "Sets buildtype.", + "settings": { + "__BuildType": "default" + } + }, + "buildArch": { + "description": "Sets buildarch.", + "settings": { + "__BuildArch": "default" + } + }, + "buildOS": { + "description": "Sets the OS to build.", + "settings": { + "__BuildOS": "default" + } + }, + "testOverlay": { + "description": "Runs test overlay target.", + "settings": { + "Project": "./tests/runtest.proj", + "CreateTestOverlay": "default" + } + }, + "buildManagedTests": { + "description": "Builds managed tests.", + "settings": { + "Project": "./tests/build.proj" + } + }, + "priority": { + "description": "Sets CLRTestPriorityToBuild property.", + "settings": { + "CLRTestPriorityToBuild": "default" + } + }, + "sequential": { + "description": "Sets sequential build", + "settings": { + "maxcpucount": "default" + } + }, + "skipRestore": { + "description": "Skips restoring packages during build.", + "settings": { + "RestoreDuringBuild": false + } + }, + "BuildTarget": { + "description": "Runs the build target.", + "settings": { + "Build": "default" + } + } + }, + "defaultValues": { + "toolName": "msbuild", + "settings": { + "MsBuildParameters": "default", + "MsBuildLog": "default", + "MsBuildWrn": "default", + "MsBuildErr": "default" + } + } + }, + "sync": { + "alias": { + "p": { + "description": "Restores all NuGet packages for repository.", + "settings": { + "Project": "./build.proj", + "RestoreDuringBuild": true, + "RestoreNETCorePlatforms": "default" + } + }, + "ab": { + "description": "Downloads the latests product packages from Azure. The values for '-AzureAccount' and '-AzureToken' are required", + "settings": { + "Project": "./src/syncAzure.proj" + } + }, + "azureToken": { + "description": "Account token to connect to Azure Blob storage.", + "settings": { + "CloudDropAccessToken": "default" + } + }, + "azureAccount": { + "description": "Account name to connect to Azure Blob storage.", + "settings": { + "CloudDropAccountName": "default" + } + }, + "verbose": { + "description": "Passes /flp:v=diag to the msbuild command or the value passed by the user.", + "settings": { + "MsBuildFileLogging": "/flp:v=diag;LogFile=sync.log" + } + }, + "buildMajor": { + "description": "To download a specific group of product packages, specify build number. The value for -BuildMinor required.", + "settings": { + "BuildNumberMajor": "default" + } + }, + "buildMinor": { + "description": "To download a specific group of product packages, specify build number. The value for -BuildMajor required.", + "settings": { + "BuildNumberMinor": "default" + } + } + }, + "defaultValues": { + "toolName": "msbuild", + "settings": { + "MsBuildParameters": "default", + "maxcpucount": "default", + "MsBuildFileLogging": "/flp:v=detailed;LogFile=sync.log" + } + } + }, + "publish-packages": { + "alias": { + "azureToken": { + "description": "Account token to connect to Azure Blob storage.", + "settings": { + "CloudDropAccessToken": "default" + } + }, + "azureAccount": { + "description": "Account name to connect to Azure Blob storage.", + "settings": { + "CloudDropAccountName": "default" + } + }, + "buildArch": { + "description": "Specifies architecture to publish, can be x64, x86, arm or arm64", + "settings": { + "__BuildArch": "default" + } + }, + "buildType": { + "description": "Specifies configuration to publish, can be Release, Debug or Checked.", + "settings": { + "__BuildType": "default" + } + }, + "buildOS": { + "description": "Specifies the OS to publish packages.", + "settings": { + "__BuildOS": "default" + } + } + }, + "defaultValues": { + "toolName": "msbuild", + "settings": { + "Project": "./src/publish.proj", + "MsBuildParameters": "default", + "maxcpucount": "default", + "MsBuildFileLogging": "/flp:v=detailed;LogFile=publish-packages.log" + } + } + }, + "build-packages": { + "alias": { + "buildArch": { + "description": "Specifies architecture to publish, can be x64, x86, arm or arm64", + "settings": { + "__BuildArch": "default" + } + }, + "buildType": { + "description": "Specifies configuration to publish, can be Release, Debug or Checked.", + "settings": { + "__BuildType": "default" + } + }, + "distroRid": { + "description": "Specifies distro rid for Unix OS.", + "settings": { + "__DistroRid": "default" + } + } + }, + "defaultValues": { + "toolName": "msbuild", + "settings": { + "MsBuildParameters": "default", + "__BuildOS": "default", + "maxcpucount": "default", + "MsBuildFileLogging": "/flp:v=detailed;Append;LogFile=build-packages.log", + "MsBuildEventLogging": "default" + } + } + } + }, + "tools": { + "msbuild": { + "run": { + "windows": "Tools\\msbuild.cmd", + "unix": "Tools/msbuild.sh" + }, + "valueTypes": { + "property": "/p:{name}={value}", + "target": "/t:{name}", + "internal": "/{name}" + } + }, + "terminal": { + "run": { + "windows": "cmd", + "unix": "sh" + }, + "valueTypes": {} + } + } +} @@ -14,7 +14,7 @@ <RoslynPackageName>Microsoft.Net.ToolsetCompilers</RoslynPackageName> </PropertyGroup> - <!-- + <!-- Switching to the .NET Core version of the BuildTools tasks seems to break numerous scenarios, such as VS intellisense and resource designer as well as runnning the build on mono. Until we can get these sorted out we will continue using the .NET 4.5 version of the tasks. --> @@ -25,7 +25,6 @@ <!-- Common properties --> <PropertyGroup> <!-- Set basic properties and normalize --> - <BuildArch>$(__BuildArch)</BuildArch> <BuildArch Condition="'$(__BuildArch)'==''">x64</BuildArch> <BuildArch Condition="'$(__BuildArch)' == 'amd64'">x64</BuildArch> @@ -52,7 +51,8 @@ <BinDir>$(__BinDir)\</BinDir> <BinDir Condition="'$(__BinDir)'==''">$(RootBinDir)Product\$(BuildOS).$(BuildArch).$(BuildType)\</BinDir> - + + <__IntermediatesDir Condition="'$(__IntermediatesDir)' == ''">$(RootBinDir)obj\$(BuildOS).$(BuildArch).$(BuildType)</__IntermediatesDir> <IntermediateOutputRootPath Condition="'$(IntermediateOutputRootPath)' == ''">$(__IntermediatesDir)\</IntermediateOutputRootPath> <!-- We don't append back slash because this path is used by nuget.exe as output directory and it @@ -63,7 +63,7 @@ <ToolsDir Condition="'$(ToolsDir)'==''">$(ProjectDir)Tools/</ToolsDir> <DotnetCliPath Condition="'$(DotnetCliPath)'==''">$(ToolsDir)dotnetcli/</DotnetCliPath> - <OverrideToolHost>$(DotnetCliPath)dotnet</OverrideToolHost> + <OverrideToolHost>$(DotnetCliPath)dotnet</OverrideToolHost> <BuildToolsSemaphore Condition="'$(BuildToolsSemaphore)' == ''">$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll</BuildToolsSemaphore> <TestWorkingDir>$(__TestWorkingDir)\</TestWorkingDir> @@ -166,7 +166,7 @@ <MinOSForArch>win7</MinOSForArch> <MinOSForArch Condition="'$(PackagePlatform)' == 'arm'">win8</MinOSForArch> <MinOSForArch Condition="'$(PackagePlatform)' == 'arm64'">win10</MinOSForArch> - + <!-- Arm64 cross target components are x64 hosted --> <HasCrossTargetComponents Condition="'$(PackagePlatform)' =='arm64'">true</HasCrossTargetComponents> <CrossTargetComponentFolder Condition="'$(PackagePlatform)' == 'arm64'">x64</CrossTargetComponentFolder> @@ -179,11 +179,11 @@ <ItemGroup Condition="'$(MSBuildProjectExtension)' == '.pkgproj'"> <File Condition="Exists('$(PackageLicenseFile)')" Include="$(PackageLicenseFile)" > - <SkipPackageFileCheck>true</SkipPackageFileCheck> + <SkipPackageFileCheck>true</SkipPackageFileCheck> </File> <File Condition="Exists('$(PackageThirdPartyNoticesFile)')" Include="$(PackageThirdPartyNoticesFile)" > - <SkipPackageFileCheck>true</SkipPackageFileCheck> + <SkipPackageFileCheck>true</SkipPackageFileCheck> </File> </ItemGroup> diff --git a/netci.groovy b/netci.groovy index 2ceb39dea6..c16982caee 100755 --- a/netci.groovy +++ b/netci.groovy @@ -1493,22 +1493,22 @@ combinedScenarios.each { scenario -> } // For Pri 1 tests, we must shorten the output test binary path names. - // if __TestIntermediateDir is already set, buildtest.cmd will + // if __TestIntermediateDir is already set, build-test.cmd will // output test binaries to that directory. If it is not set, the // binaries are sent to a default directory whose name is about // 35 characters long. else if (scenario == 'pri1' || scenario == 'pri1r2r' || scenario == 'gcstress15_pri1r2r'|| scenario == 'coverage') { - buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${arch} Priority 1" + buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${arch} -priority=1" } else if (scenario == 'ilrt') { // First do the build with skiptests and then build the tests with ilasm roundtrip buildCommands += "build.cmd ${lowerConfiguration} ${arch} skiptests" - buildCommands += "set __TestIntermediateDir=int&&tests\\buildtest.cmd ${lowerConfiguration} ${arch} ilasmroundtrip" + buildCommands += "set __TestIntermediateDir=int&&build-test.cmd ${lowerConfiguration} ${arch} -ilasmroundtrip" } else if (isLongGc(scenario)) { buildCommands += "build.cmd ${lowerConfiguration} ${arch} skiptests" - buildCommands += "set __TestIntermediateDir=int&&tests\\buildtest.cmd ${lowerConfiguration} ${arch}" + buildCommands += "set __TestIntermediateDir=int&&build-test.cmd ${lowerConfiguration} ${arch}" } else { println("Unknown scenario: ${scenario}") @@ -1662,10 +1662,10 @@ combinedScenarios.each { scenario -> // Debug runs take too long to run. So build job only. if (lowerConfiguration == "debug") { - buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${architecture} /toolset_dir C:\\ats2" + buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${architecture} toolset_dir C:\\ats2" } else { - buildCommands += "set __TestIntermediateDir=int&&build.cmd skiptests ${lowerConfiguration} ${architecture} /toolset_dir C:\\ats2" + buildCommands += "set __TestIntermediateDir=int&&build.cmd skiptests ${lowerConfiguration} ${architecture} toolset_dir C:\\ats2" // Test build and run are launched together. buildCommands += "Z:\\arm64\\common\\scripts\\arm64PostLauncher.cmd %WORKSPACE% ${architecture} ${lowerConfiguration} ${scenario}" Utilities.addXUnitDotNETResults(newJob, 'bin/tests/testResults.xml') diff --git a/publish-packages.cmd b/publish-packages.cmd index 760452a128..5831d29cc2 100644 --- a/publish-packages.cmd +++ b/publish-packages.cmd @@ -1,37 +1,23 @@ @if "%_echo%" neq "on" echo off setlocal EnableDelayedExpansion -set packagesLog=publish-packages.log -echo Running publish-packages.cmd %* > %packagesLog% +if /I [%1] == [-?] goto Usage +if /I [%1] == [-help] goto Usage -set options=/nologo /v:minimal /flp:v=detailed;Append;LogFile=%packagesLog% -set allargs=%* - -if /I [%1] == [/?] goto Usage -if /I [%1] == [/help] goto Usage - -REM ensure that msbuild is available -echo Running init-tools.cmd -call %~dp0init-tools.cmd - -echo msbuild.exe %~dp0src\publish.proj !options! !allargs! >> %packagesLog% -call msbuild.exe %~dp0src\publish.proj !options! !allargs! -if NOT [%ERRORLEVEL%]==[0] ( - echo ERROR: An error occurred while publishing packages, see %packagesLog% for more details. - exit /b 1 -) - -echo Done publishing packages. -exit /b +echo %~dp0run.cmd publish-packages %* +call %~dp0run.cmd publish-packages %* +@exit /b %ERRORLEVEL% :Usage echo. echo Publishes the NuGet packages to the specified location. +echo -? - Prints Usage +echo -help - Prints Usage echo For publishing to Azure the following properties are required. -echo /p:CloudDropAccountName="account name" -echo /p:CloudDropAccessToken="access token" -echo /p:__BuildType="Configuration" -echo /p:__BuildArch="Architecture" +echo -AzureAccount="account name" +echo -AzureToken="access token" +echo -BuildType="Configuration" +echo -BuildArch="Architecture" echo Architecture can be x64, x86, arm, or arm64 echo Configuration can be Release, Debug, or Checked exit /b
\ No newline at end of file diff --git a/publish-packages.sh b/publish-packages.sh index 555a590256..8170419fb5 100755 --- a/publish-packages.sh +++ b/publish-packages.sh @@ -4,68 +4,23 @@ usage() { echo "Publishes the NuGet packages to the specified location." echo "For publishing to Azure the following properties are required." - echo " /p:CloudDropAccountName=\"account name\"" - echo " /p:CloudDropAccessToken=\"access token\"" - echo " /p:__BuildType=\"Configuration\"" - echo " /p:__BuildArch=\"Architecture\"" + echo " -AzureAccount=\"account name\"" + echo " -AzureToken=\"access token\"" + echo " -BuildType=\"Configuration\"" + echo " -BuildArch=\"Architecture\"" echo "Configuration can be Release, Checked, or Debug" echo "Architecture can be x64, x86, arm, or arm64" exit 1 } working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -publish_log=$working_tree_root/publish.log -# Use uname to determine what the OS is. -OSName=$(uname -s) -case $OSName in - Linux) - __BuildOS=Linux - ;; - - Darwin) - __BuildOS=OSX - ;; - - FreeBSD) - __BuildOS=FreeBSD - ;; - - OpenBSD) - __BuildOS=OpenBSD - ;; - - NetBSD) - __BuildOS=NetBSD - ;; - - SunOS) - __BuildOS=SunOS - ;; - - *) - echo "Unsupported OS $OSName detected, configuring as if for Linux" - __BuildOS=Linux - ;; -esac - -options="/nologo /v:minimal /flp:v=detailed;Append;LogFile=$publish_log" - -echo "Running publish-packages.sh $*" > $publish_log - -echo "Running init-tools.sh" -$working_tree_root/init-tools.sh - -echo "Publishing packages..." -echo -e "\n$working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.proj $options $*" /p:__BuildOS=$__BuildOS >> $publish_log -$working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.proj $options $* /p:__BuildOS=$__BuildOS +$working_tree_root/run.sh publish-packages -BuildOS $* if [ $? -ne 0 ] then - echo -e "\nPackage publishing failed. Aborting." >> $publish_log - echo "ERROR: An error occurred while publishing packages; see $publish_log for more details. There may have been networking problems, so please try again in a few minutes." + echo "ERROR: An error occurred while publishing packages; see $working_tree_root/publish-packages.log for more details. There may have been networking problems, so please try again in a few minutes." exit 1 fi echo "Publish completed successfully." -echo -e "\nPublish completed successfully." >> $publish_log exit 0
\ No newline at end of file diff --git a/run.cmd b/run.cmd new file mode 100644 index 0000000000..3647198d3d --- /dev/null +++ b/run.cmd @@ -0,0 +1,39 @@ +@if "%_echo%" neq "on" echo off +setlocal + +if not defined VisualStudioVersion ( + if defined VS140COMNTOOLS ( + if not exist "%VS140COMNTOOLS%\..\IDE\devenv.exe" goto NoVS + if not exist "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" goto NoVS + if not exist "%VS140COMNTOOLS%\VsDevCmd.bat" goto NoVS + call "%VS140COMNTOOLS%\VsDevCmd.bat" + goto :Run + ) + + :NoVS + echo Error: Visual Studio 2015 required. + echo https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md for build instructions. + exit /b 1 +) + +:Run +:: Clear the 'Platform' env variable for this session, as it's a per-project setting within the build, and +:: misleading value (such as 'MCD' in HP PCs) may lead to build breakage (issue: #69). +set Platform= + +:: Restore the Tools directory +call %~dp0init-tools.cmd +if NOT [%ERRORLEVEL%]==[0] ( + exit /b 1 +) + +set _toolRuntime=%~dp0Tools +set _dotnet=%_toolRuntime%\dotnetcli\dotnet.exe + +echo Running: %_dotnet% %_toolRuntime%\run.exe %* +call %_dotnet% %_toolRuntime%\run.exe %* +if NOT [%ERRORLEVEL%]==[0] ( + exit /b 1 +) + +exit /b 0
\ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100644 index 0000000000..1c9299ae17 --- /dev/null +++ b/run.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +echo "Running init-tools.sh" +$working_tree_root/init-tools.sh + +toolRuntime=$working_tree_root/Tools +dotnet=$toolRuntime/dotnetcli/dotnet + +echo "Running: $dotnet $toolRuntime/run.exe $*" +$dotnet $toolRuntime/run.exe $* +if [ $? -ne 0 ] +then + echo "ERROR: An error occured in $dotnet $toolRuntime/run $#. Check $# logs under $working_tree_root." + exit 1 +fi + +echo "Command successfully completed." +exit 0 @@ -1,114 +1,29 @@ @if "%_echo%" neq "on" echo off setlocal EnableDelayedExpansion -set synclog=sync.log -echo Running Sync.cmd %* > %synclog% +if /I [%1] == [-?] goto Usage +if /I [%1] == [-help] goto Usage -set options=/nologo /v:minimal /clp:Summary /flp:v=detailed;Append;LogFile=%synclog% +@if [%1]==[] set __args=-p -set "__args= %*" -set processedArgs= -set unprocessedBuildArgs= - -set src=false -set packages=false -set azureBlobs=false - -if [%1]==[] ( - set src=true - set packages=true - goto Begin -) - -:Loop -if [%1]==[] goto Begin - -if /I [%1] == [/?] goto Usage -if /I [%1] == [/help] goto Usage - -if /I [%1] == [/p] ( - set packages=true - set processedArgs=!processedArgs! %1 - goto Next -) - -if /I [%1] == [/s] ( - set src=true - set processedArgs=!processedArgs! %1 - goto Next -) - -if /I [%1] == [/ab] ( - set azureBlobs=true - set processedArgs=!processedArgs! %1 - goto Next -) - -if [!processedArgs!]==[] ( - call set unprocessedBuildArgs=!__args! -) else ( - call set unprocessedBuildArgs=%%__args:*!processedArgs!=%% -) - -:Next -shift /1 -goto Loop - -:Begin -echo Running init-tools.cmd -call %~dp0init-tools.cmd - -if [%src%] == [true] ( - echo Fetching git database from remote repos ... - call git fetch --all -p -v >> %synclog% 2>&1 - if NOT [!ERRORLEVEL!]==[0] ( - echo ERROR: An error occurred while fetching remote source code, see %synclog% for more details. - exit /b 1 - ) -) - -if [%azureBlobs%] == [true] ( - echo Connecting and downloading packages from Azure BLOB ... - echo msbuild.exe %~dp0src\syncAzure.proj !options! !unprocessedBuildArgs! >> %synclog% - call msbuild.exe %~dp0src\syncAzure.proj !options! !unprocessedBuildArgs! - if NOT [!ERRORLEVEL!]==[0] ( - echo ERROR: An error occurred while downloading packages from Azure BLOB, see %synclog% for more details. There may have been networking problems so please try again in a few minutes. - exit /b 1 - ) -) - -set targets=RestoreNETCorePlatforms - -if [%packages%] == [true] ( - set options=!options! /t:!targets! /p:RestoreDuringBuild=true - echo msbuild.exe %~dp0build.proj !options! !unprocessedBuildArgs! >> %synclog% - call msbuild.exe %~dp0build.proj !options! !unprocessedBuildArgs! - if NOT [!ERRORLEVEL!]==[0] ( - echo ERROR: An error occurred while syncing packages, see %synclog% for more details. There may have been networking problems so please try again in a few minutes. - exit /b 1 - ) -) - -echo Done Syncing. -exit /b 0 - -goto :EOF + @call %~dp0run.cmd sync %__args% %* +@exit /b %ERRORLEVEL% :Usage echo. echo Repository syncing script. echo. echo Options: -echo /s - Fetches source history from all configured remotes -echo (git fetch --all -p -v) -echo /p - Restores all nuget packages for repository -echo /ab - Downloads the latests product packages from Azure. +echo -? - Prints Usage +echo -help - Prints Usage +echo -p - Restores all nuget packages for repository +echo -ab - Downloads the latests product packages from Azure. echo The following properties are required: -echo /p:CloudDropAccountName="Account name" -echo /p:CloudDropAccessToken="Access token" +echo -AzureAccount="Account name" +echo -AzureToken="Access token" echo To download a specific group of product packages, specify: -echo /p:BuildNumberMajor -echo /p:BuildNumberMinor +echo -BuildMajor +echo -BuildMinor echo. echo. -echo If no option is specified then sync.cmd /s /p is implied.
\ No newline at end of file +echo If no option is specified then sync.cmd -p is implied.
\ No newline at end of file @@ -2,28 +2,19 @@ usage() { - echo "Usage: sync [-p] [-s]" + echo "Usage: sync [-p]" echo "Repository syncing script." - echo " -s Fetch source history from all configured remotes" - echo " (git fetch --all -p -v)" echo " -p Restore all NuGet packages for the repository" - echo - echo "If no option is specified, then \"sync.sh -p -s\" is implied." + echo "If no option is specified, then \"sync.sh -p\" is implied." exit 1 } working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -sync_log=$working_tree_root/sync.log - -options="/nologo /v:minimal /clp:Summary /flp:v=detailed;Append;LogFile=$sync_log" unprocessedBuildArgs= -echo "Running sync.sh $*" > $sync_log - # Parse arguments if [ $# == 0 ]; then - sync_packages=true - sync_src=true + buildArgs="-p" fi while [[ $# -gt 0 ]] @@ -34,10 +25,7 @@ do usage ;; -p) - sync_packages=true - ;; - -s) - sync_src=true + buildArgs="-p" ;; *) unprocessedBuildArgs="$unprocessedBuildArgs $1" @@ -45,32 +33,12 @@ do shift done -echo "Running init-tools.sh" -$working_tree_root/init-tools.sh - -if [ "$sync_src" == true ]; then - echo "Fetching git database from remote repos..." - git fetch --all -p -v >> $sync_log 2>&1 - if [ $? -ne 0 ]; then - echo -e "\ngit fetch failed. Aborting sync." >> $sync_log - echo "ERROR: An error occurred while fetching remote source code; see $sync_log for more details." - exit 1 - fi -fi - -if [ "$sync_packages" == true ]; then - options="$options /t:RestoreNETCorePlatforms /p:RestoreDuringBuild=true" - echo "Restoring all packages..." - echo -e "\n$working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/build.proj $options $unprocessedBuildArgs" >> $sync_log - $working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/build.proj $options $unprocessedBuildArgs - if [ $? -ne 0 ] - then - echo -e "\nPackage restored failed. Aborting sync." >> $sync_log - echo "ERROR: An error occurred while syncing packages; see $sync_log for more details. There may have been networking problems, so please try again in a few minutes." - exit 1 - fi +$working_tree_root/run.sh sync $buildArgs $unprocessedBuildArgs +if [ $? -ne 0 ] +then + echo "ERROR: An error occurred while syncing packages; See $working_tree_root/sync.log for more details. There may have been networking problems, so please try again in a few minutes." + exit 1 fi echo "Sync completed successfully." -echo -e "\nSync completed successfully." >> $sync_log -exit 0
\ No newline at end of file +exit 0 diff --git a/tests/buildtest.cmd b/tests/buildtest.cmd deleted file mode 100644 index d5f89358ca..0000000000 --- a/tests/buildtest.cmd +++ /dev/null @@ -1,412 +0,0 @@ -@if not defined __echo @echo off -setlocal EnableDelayedExpansion - -:: Set the default arguments for build -set __BuildArch=x64 -set __BuildType=Debug -set __BuildOS=Windows_NT - -:: Default to highest Visual Studio version available -set __VSVersion=vs2015 - -if defined VS120COMNTOOLS set __VSVersion=vs2013 -if defined VS140COMNTOOLS set __VSVersion=vs2015 - -:: 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: - -set "__ProjectDir=%~dp0..\" -:: remove trailing slash -if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%" -set "__TestDir=%__ProjectDir%\tests" -set "__ProjectFilesDir=%__TestDir%" -set "__SourceDir=%__ProjectDir%\src" -set "__PackagesDir=%__ProjectDir%\packages" -set "__RootBinDir=%__ProjectDir%\bin" -set "__LogsDir=%__RootBinDir%\Logs" - -set __CleanBuild= -set __crossgen= -set __ILAsmRoundtrip= -set __BuildSequential= -set __TestPriority= -set __msbuildCleanBuildArgs= -set __verbosity=normal -set __UpdateInvalidPackagesArg= - -REM unprocessedBuildArgs are args that we pass to msbuild (e.g. /p:__BuildArch=x64) -set "__args= %*" -set processedArgs= -set unprocessedBuildArgs= - -:Arg_Loop -if "%1" == "" goto ArgsDone - -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" == "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" == "checked" (set __BuildType=Checked&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) - -if /i "%1" == "clean" (set __CleanBuild=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) - -if /i "%1" == "vs2013" (set __VSVersion=%1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "vs2015" (set __VSVersion=%1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) - -if /i "%1" == "crossgen" (set __crossgen=true&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "ilasmroundtrip" (set __ILAsmRoundtrip=true&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "sequential" (set __BuildSequential=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "priority" (set __TestPriority=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) - -if /i "%1" == "verbose" (set __verbosity=detailed&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) - -if /i "%1" == "skipmanaged" (set __SkipManaged=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) - -if /i "%1" == "updateinvalidpackages" (set __UpdateInvalidPackagesArg=/t:UpdateInvalidPackageVersions&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) - -@REM It was initially /toolset_dir. Not sure why, since it doesn't match the other usage. -if /i "%1" == "/toolset_dir" (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) -if /i "%1" == "toolset_dir" (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) - -if [!processedArgs!]==[] ( - call set unprocessedBuildArgs=!__args! -) else ( - call set unprocessedBuildArgs=%%__args:*!processedArgs!=%% -) - -:ArgsDone - -rem arm64 builds currently use private toolset which has not been released yet -REM TODO, remove once the toolset is open. -if /i "%__BuildArch%" == "arm64" call :PrivateToolSet - -if %__verbosity%==detailed ( - echo Enabling verbose file logging -) - -echo %__MsgPrefix%Commencing CoreCLR repo 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. - -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 -set "__CMakeBinDir=%__TestBinDir%" -set "__CMakeBinDir=%__CMakeBinDir:\=/%" - -:: Configure environment if we are doing a clean build. -if not defined __CleanBuild goto SkipCleanBuild -echo %__MsgPrefix%Doing a clean test build - -:: MSBuild projects would need a rebuild -set __msbuildCleanBuildArgs=/t:rebuild - -:: Cleanup the binaries drop folder for the current configuration -if exist "%__TestBinDir%" rd /s /q "%__TestBinDir%" -if exist "%__NativeTestIntermediatesDir%" rd /s /q "%__NativeTestIntermediatesDir%" - -:SkipCleanBuild - -if not exist "%__TestBinDir%" md "%__TestBinDir%" -if not exist "%__NativeTestIntermediatesDir%" md "%__NativeTestIntermediatesDir%" -if not exist "%__ManagedTestIntermediatesDir%" md "%__ManagedTestIntermediatesDir%" -if not exist "%__LogsDir%" md "%__LogsDir%" - -echo %__MsgPrefix%Checking prerequisites - -:: Eval the output from probe-win1.ps1 -for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy RemoteSigned "& ""%__SourceDir%\pal\tools\probe-win.ps1"""') do %%a - -set __VSProductVersion= -if /i "%__VSVersion%" == "vs2013" set __VSProductVersion=120 -if /i "%__VSVersion%" == "vs2015" set __VSProductVersion=140 - -:: Check presence of VS -if not defined VS%__VSProductVersion%COMNTOOLS goto NoVS - -set __VSToolsRoot=!VS%__VSProductVersion%COMNTOOLS! -if %__VSToolsRoot:~-1%==\ set "__VSToolsRoot=%__VSToolsRoot:~0,-1%" - -:: Does VS really exist? -if not exist "%__VSToolsRoot%\..\IDE\devenv.exe" goto NoVS -if not exist "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" goto NoVS -if not exist "%__VSToolsRoot%\VsDevCmd.bat" goto NoVS - -if /i "%__VSVersion%" =="vs2015" goto MSBuild14 -set _msbuildexe="%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe" -if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\12.0\Bin\MSBuild.exe" -if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" -goto :CheckMSBuild14 -:MSBuild14 -set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" -:CheckMSBuild14 -if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe" -if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe. Please see https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md for build instructions. && exit /b 1 - -:: Note: We've disabled node reuse because it causes file locking issues. -:: The issue is that we extend the build with our own targets which -:: means that that rebuilding cannot successfully delete the task -:: assembly. -set __msbuildCommonArgs=/nologo /nodeReuse:false %unprocessedBuildArgs% - -if not defined __BuildSequential ( - set __msbuildCommonArgs=%__msbuildCommonArgs% /maxcpucount -) -REM ========================================================================================= -REM === -REM === Restore Build Tools -REM === -REM ========================================================================================= -call %__ProjectDir%\init-tools.cmd - -REM ========================================================================================= -REM === -REM === Resolve runtime dependences -REM === -REM ========================================================================================= -call %__TestDir%\setup-runtime-dependencies.cmd /arch %__BuildArch% /outputdir %__BinDir% - -if NOT "%__UpdateInvalidPackagesArg%" == "" goto skipnative - -REM ========================================================================================= -REM === -REM === Native test build section -REM === -REM ========================================================================================= - -::Building Native part of Tests -setlocal EnableDelayedExpansion - -echo %__MsgPrefix%Commencing build of native test components for %__BuildArch%/%__BuildType% - -if defined __ToolsetDir ( - echo %__MsgPrefix%ToolsetDir is defined to be :%__ToolsetDir% - goto GenVSSolution :: Private ToolSet is Defined -) - -:: Set the environment for the native build -echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" %__VCBuildArch% -call "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" x86_amd64 -@if defined __echo @echo on - -if not defined VSINSTALLDIR ( - echo %__MsgPrefix%Error: VSINSTALLDIR variable not defined. - exit /b 1 -) -if not exist "%VSINSTALLDIR%DIA SDK" goto NoDIA - -:GenVSSolution -echo %__MsgPrefix%Regenerating the Visual Studio solution in %__NativeTestIntermediatesDir% - -pushd "%__NativeTestIntermediatesDir%" -call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectFilesDir%\" %__VSVersion% %__BuildArch% -@if defined __echo @echo on -popd - -if not exist "%__NativeTestIntermediatesDir%\install.vcxproj" ( - echo %__MsgPrefix%Failed to generate test native component build project! - exit /b 1 -) - -set __msbuildNativeArgs=%__msbuildCleanBuildArgs% /p:Configuration=%__BuildType% - -if defined __ToolsetDir ( - set __msbuildNativeArgs=%__msbuildNativeArgs% /p:UseEnv=true -) else ( - set __msbuildNativeArgs=%__msbuildNativeArgs% /p:Platform=%__BuildArch% -) - -set __BuildLogRootName=Tests_Native -call :msbuild "%__NativeTestIntermediatesDir%\install.vcxproj" %__msbuildNativeArgs% -if errorlevel 1 exit /b 1 -REM endlocal to rid us of environment changes from vcvarsall.bat -endlocal - -:skipnative - -if defined __SkipManaged exit /b 0 - -REM ========================================================================================= -REM === -REM === Managed test build section -REM === -REM ========================================================================================= - -REM setlocal to prepare for vsdevcmd.bat -setlocal EnableDelayedExpansion - -echo %__MsgPrefix%Starting the Managed Tests Build - -:: Set the environment for the managed build -echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\VsDevCmd.bat" -call "%__VSToolsRoot%\VsDevCmd.bat" - -if not defined VSINSTALLDIR ( - 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. - exit /b 1 -) - -set __msbuildManagedBuildArgs=%__msbuildCleanBuildArgs% - -if defined __ILAsmRoundtrip ( - echo Building tests with IlasmRoundTrip enabled. - set __msbuildManagedBuildArgs=%__msbuildManagedBuildArgs% /p:IlasmRoundTrip=true -) - -if defined __TestPriority ( - echo Building Test Priority %__TestPriority% - set __msbuildManagedBuildArgs=%__msbuildManagedBuildArgs% /p:CLRTestPriorityToBuild=%__TestPriority% -) - -set __BuildLogRootName=Tests_Managed -call :msbuild "%__ProjectFilesDir%\build.proj" %__msbuildManagedBuildArgs% %__UpdateInvalidPackagesArg% -if errorlevel 1 exit /b 1 - -set CORE_ROOT=%__TestBinDir%\Tests\Core_Root - -echo %__MsgPrefix%Creating test overlay... - -set __BuildLogRootName=Tests_Overlay_Managed -call :msbuild "%__ProjectFilesDir%\runtest.proj" /t:CreateTestOverlay -if errorlevel 1 exit /b 1 - -REM ========================================================================================= -REM === -REM === All builds complete! -REM === -REM ========================================================================================= - -echo %__MsgPrefix%Test build successful. -echo %__MsgPrefix%Test binaries are available at !__TestBinDir! -exit /b 0 - -REM ========================================================================================= -REM === -REM === Helper routines -REM === -REM ========================================================================================= - -:msbuild -@REM Subroutine to invoke msbuild. All arguments are passed to msbuild. The first argument should be the -@REM .proj file to invoke. -@REM -@REM On entry, __BuildLogRootName must be set to a file name prefix for the generated log file. -@REM All the "standard" environment variables that aren't expected to change per invocation must also be set, -@REM like __msbuildCommonArgs. -@REM -@REM The build log files will be overwritten, not appended to. - -echo %__MsgPrefix%Invoking msbuild - -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 __msbuildLogArgs=^ -/fileloggerparameters:Verbosity=%__verbosity%;LogFile="%__BuildLog%";Append ^ -/fileloggerparameters1:WarningsOnly;LogFile="%__BuildWrn%" ^ -/fileloggerparameters2:ErrorsOnly;LogFile="%__BuildErr%" ^ -/consoleloggerparameters:Summary ^ -/verbosity:minimal - -set __msbuildArgs=%* %__msbuildCommonArgs% %__msbuildLogArgs% - -@REM The next line will overwrite the existing log file, if any. -echo Invoking: %_msbuildexe% %__msbuildArgs% > "%__BuildLog%" - -%_msbuildexe% %__msbuildArgs% -if errorlevel 1 ( - echo %__MsgPrefix%Error: build failed. Refer to the build log files for details: - echo %__BuildLog% - echo %__BuildWrn% - echo %__BuildErr% - exit /b 1 -) - -exit /b 0 - -:Usage -echo. -echo Usage: -echo %0 [option1] [option2] ... -echo All arguments are optional. Options are case-insensitive. The options are: -echo. -echo./? -? /h -h /help -help: view this message. -echo Build architecture: only x64 is currently allowed ^(default: x64^). -echo Build type: one of Debug, Checked, Release ^(default: Debug^). -echo Visual Studio version: one of VS2013 or VS2015 to force using a particular -echo Visual Studio version ^(default: VS2015^). -echo clean: force a clean build ^(default is to perform an incremental build^). -echo CrossGen: enables the tests to run crossgen on the test executables before executing them. -echo msbuildargs ... : 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 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 -echo sequential: force a non-parallel build ^(default is to build in parallel -echo using all processors^). -echo IlasmRoundTrip: enables ilasm round trip build and run of the tests before executing them. -echo updateinvalidpackages: enables updating package versions in all test project.json files -echo verbose: enables detailed file logging for the msbuild tasks into the msbuild log file. -exit /b 1 - -:NoVS -echo Visual Studio 2013+ ^(Community is free^) is a prerequisite to build this repository. -echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites -exit /b 1 - -:NoDIA -echo Error: DIA SDK is missing at "%VSINSTALLDIR%DIA SDK". ^ -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 -echo Visual Studio 2013 Express does not include the DIA SDK. ^ -You need Visual Studio 2013+ (Community is free). -echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites -exit /b 1 - - -:PrivateToolSet - -echo %__MsgPrefix% Setting Up the usage of __ToolsetDir:%__ToolsetDir% - -if /i "%__ToolsetDir%" == "" ( - echo %__MsgPrefix%Error: A toolset directory is required for the Arm64 Windows build. Use the toolset_dir argument. - exit /b 1 -) - -set PATH=%__ToolsetDir%\VC_sdk\bin;%PATH% -set LIB=%__ToolsetDir%\VC_sdk\lib\arm64;%__ToolsetDir%\sdpublic\sdk\lib\arm64 -set INCLUDE=^ -%__ToolsetDir%\VC_sdk\inc;^ -%__ToolsetDir%\sdpublic\sdk\inc;^ -%__ToolsetDir%\sdpublic\shared\inc;^ -%__ToolsetDir%\sdpublic\shared\inc\minwin;^ -%__ToolsetDir%\sdpublic\sdk\inc\ucrt;^ -%__ToolsetDir%\sdpublic\sdk\inc\minwin;^ -%__ToolsetDir%\sdpublic\sdk\inc\mincore;^ -%__ToolsetDir%\sdpublic\sdk\inc\abi;^ -%__ToolsetDir%\sdpublic\sdk\inc\clientcore;^ -%__ToolsetDir%\diasdk\include -exit /b 0 diff --git a/tests/scripts/arm32_ci_script.sh b/tests/scripts/arm32_ci_script.sh index a9044bbd1c..1de79b6b47 100755 --- a/tests/scripts/arm32_ci_script.sh +++ b/tests/scripts/arm32_ci_script.sh @@ -198,8 +198,9 @@ function cross_build_coreclr { git am < "$__ARMRootfsMountPath"/dotnet/setenv/coreclr_release.patch fi + ./clean.sh -b -t #Cross building for emulator rootfs - ROOTFS_DIR="$__ARMRootfsMountPath" CPLUS_INCLUDE_PATH=$LINUX_ARM_INCPATH CXXFLAGS=$LINUX_ARM_CXXFLAGS ./build.sh $__buildArch clean cross $__verboseFlag $__skipMscorlib clang3.5 $__buildConfig + ROOTFS_DIR="$__ARMRootfsMountPath" CPLUS_INCLUDE_PATH=$LINUX_ARM_INCPATH CXXFLAGS=$LINUX_ARM_CXXFLAGS ./build.sh $__buildArch cross $__verboseFlag $__skipMscorlib clang3.5 $__buildConfig #Reset the code to the upstream version (set +x; echo 'Rewinding HEAD to master code') |