set __ThisScriptShort=%0
set __ThisScriptFull="%~f0"
+set __ThisScriptPath="%~dp0"
:: Note that the msbuild project files (specifically, dir.proj) will use the following variables, if set:
:: __BuildArch -- default: x64
:: 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
if /i "%1" == "osxmscorlib" (set __MscorlibOnly=1&set __BuildOS=OSX&shift&goto Arg_Loop)
if /i "%1" == "windowsmscorlib" (set __MscorlibOnly=1&set __BuildOS=Windows_NT&shift&goto Arg_Loop)
-if /i "%1" == "vs2013" (set __VSVersion=%1&shift&goto Arg_Loop)
if /i "%1" == "vs2015" (set __VSVersion=%1&shift&goto Arg_Loop)
if /i "%1" == "configureonly" (set __ConfigureOnly=1&set __SkipMscorlibBuild=1&set __SkipTestBuild=1&shift&goto Arg_Loop)
if /i "%1" == "skipconfigure" (set __SkipConfigure=1&shift&goto Arg_Loop)
set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__IntermediatesDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__PackagesBinDir=%__BinDir%\.nuget"
-set "__TestBinDir=%__RootBinDir%\tests\%__BuildOS%.%__BuildArch%.%__BuildType%"
+set "__TestRootDir=%__RootBinDir%\tests"
+set "__TestBinDir=%__TestRootDir%\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__TestIntermediatesDir=%__RootBinDir%\tests\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
:: Use this variable to locate dynamically generated files; the actual location though will be different.
:CheckVS
set __VSProductVersion=
-if /i "%__VSVersion%" == "vs2013" set __VSProductVersion=120
if /i "%__VSVersion%" == "vs2015" set __VSProductVersion=140
:: Check presence of VS
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"
set UseRoslynCompiler=true
REM =========================================================================================
REM ===
+REM === Restore Build Tools
+REM ===
+REM =========================================================================================
+call %__ThisScriptPath%init-tools.cmd
+
+REM =========================================================================================
+REM ===
REM === Start the build steps
REM ===
REM =========================================================================================
REM =========================================================================================
REM ===
-REM === Build ETW infrastructure
-REM ===
-REM =========================================================================================
-
-echo %__MsgPrefix%Generating ETW files
-
-if not defined PythonPath (
- echo %__MsgPrefix%Error: Couldn't find Python.
- exit /b 1
-)
-
-:: Ensure there are no stale files in the Generated Directory
-if exist "%__GeneratedIntermediatesDir%" rd /s /q "%__GeneratedIntermediatesDir%"
-md "%__GeneratedIntermediatesDir%"
-md "%__GeneratedIntermediatesDir%\inc"
-set "genetw=%__SourceDir%\scripts\genWinEtw.py"
-
-mc -h "%__GeneratedIntermediatesDir%\inc" -r "%__GeneratedIntermediatesDir%" -b -co -um -p FireEtw "%__SourceDir%\VM\ClrEtwAll.man"
-IF ERRORLEVEL 1 goto FailedToGenEtwMetadata
-
-"%PythonPath%" "%genetw%" --man "%__SourceDir%\VM\ClrEtwAll.man" --exc "%__SourceDir%\VM\ClrEtwAllMeta.lst" --eventheader "%__GeneratedIntermediatesDir%\inc\ClrEtwAll.h" --macroheader "%__GeneratedIntermediatesDir%\inc\clretwallmain.h" --dummy "%__GeneratedIntermediatesDir%\inc\etmdummy.h"
-IF ERRORLEVEL 1 goto FailedToGenEtwMetadata
-
-:: Do not use this variable; it is used below to support incremental build.
-set "__GeneratedIntermediatesDirPresent=%__IntermediatesDir%\Generated"
-"%PythonPath%" -c "import sys;sys.path.insert(0,r\"%__SourceDir%\scripts\"); from Utilities import *;UpdateDirectory(r\"%__GeneratedIntermediatesDirPresent%\",r\"%__GeneratedIntermediatesDir%\")"
-IF ERRORLEVEL 1 goto FailedToGenEtwMetadata
-
-set __GeneratedIntermediatesDir="%__GeneratedIntermediatesDirPresent%"
-goto DoneGenEtwMetadata
-
-:FailedToGenEtwMetadata
-echo %__MsgPrefix%Error: failed to generate ETW files.
-exit /b %ERRORLEVEL%
-
-:DoneGenEtwMetadata
-
-REM =========================================================================================
-REM ===
REM === Build the CLR VM
REM ===
REM =========================================================================================
exit /b 0
)
-REM Consider doing crossgen build of mscorlib.
-
-if /i "%__BuildArch%" == "x86" (
- if not defined __DoCrossgen (
- echo %__MsgPrefix%Skipping Crossgen
- goto SkipCrossGenBuild
- )
-)
-
+REM Consider doing crossgen build of mscorlib unless we are skipping it intentionally
if /i "%__BuildArch%" == "arm64" (
if not defined __DoCrossgen (
echo %__MsgPrefix%Skipping Crossgen
exit /b 1
)
+:GenerateNuget
+if /i "%__BuildArch%" =="arm64" 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
+
+set __msbuildArgs="%__ProjectFilesDir%\src\.nuget\Microsoft.NETCore.Runtime.CoreClr\Microsoft.NETCore.Runtime.CoreCLR.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
+)
+
+:SkipNuget
+
:SkipCrossGenBuild
REM endlocal to rid us of environment changes from vsdevenv.bat
echo./? -? /h -h /help -help: view this message.
echo Build architecture: one of x64, x86, arm, arm64 ^(default: x64^).
echo Build type: one of Debug, Checked, Release ^(default: Debug^).
-echo Visual Studio version: one of VS2013 or VS2015 to force using a particular
-echo Visual Studio version ^(default: VS2015^).
+echo Visual Studio version: ^(default: VS2015^).
echo clean: force a clean build ^(default is to perform an incremental build^).
echo docrossgen: do a crossgen build of mscorlib.
echo msbuildargs ... : all arguments following this tag will be passed directly to msbuild.
exit /b 1
:NoVS
-echo Visual Studio 2013+ ^(Community is free^) is a prerequisite to build this repository.
+echo Visual Studio 2015+ ^(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
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 Visual Studio Express does not include the DIA SDK. ^
+You need Visual Studio 2015+ (Community is free).
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites
exit /b 1