Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 128 additions & 38 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,53 +1,143 @@
@echo off
setlocal
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

:: Default to highest Visual Studio version available
if defined VS120COMNTOOLS set __VSVersion=vs2013
if defined VS140COMNTOOLS set __VSVersion=vs2015

:: Set the various build properties here so that CMake and MSBuild can pick them up
set "__ProjectDir=%~dp0"
:: remove trailing slash
if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
set "__SourceDir=%__ProjectDir%\src"
set "__PackagesDir=%__ProjectDir%\packages"
set "__RootBinDir=%__ProjectDir%\bin"
set "__LogsDir=%__RootBinDir%\Logs"
set __MSBCleanBuildArgs=
set __SkipTestBuild=

:Arg_Loop
if "%1" == "" goto ArgsDone
if /i "%1" == "/?" goto Usage

if /i "%1" == "debug" (set __BuildType=Debug&shift&goto Arg_Loop)
if /i "%1" == "release" (set __BuildType=Release&shift&goto Arg_Loop)

if /i "%1" == "clean" (set __CleanBuild=1&shift&goto Arg_Loop)

if /i "%1" == "skiptestbuild" (set __SkipTestBuild=1&shift&goto Arg_Loop)

echo Invalid command line argument: %1
goto Usage

:ArgsDone

echo Commencing CoreRT Repo build
echo.

:: Set the remaining variables based upon the determined build configuration
set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"

:: Configure environment if we are doing a clean build.
if not defined __CleanBuild goto MakeDirs
echo Doing a clean build
echo.

:: MSBuild projects would need a rebuild
set __MSBCleanBuildArgs=/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%.*"

:MakeDirs
if not exist "%__BinDir%" md "%__BinDir%"
if not exist "%__LogsDir%" md "%__LogsDir%"

:CheckPrereqs
:: Check prerequisites
echo Checking pre-requisites...
echo.
rem ******************************************
rem PUT NATIVE BUILD PRE-REQUISITES CHECK HERE
rem ******************************************

:CheckVS

set __VSProductVersion=
if /i "%__VSVersion%" == "vs2013" set __VSProductVersion=120
if /i "%__VSVersion%" == "vs2015" set __VSProductVersion=140


:: Check presence of VS
if defined VS%__VSProductVersion%COMNTOOLS goto CheckVSExistence
echo Visual Studio 2013+ (Community is free) is a pre-requisite to build this repository.
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites
exit /b 1

:CheckVSExistence
:: Does VS 2013 or VS 2015 really exist?
if exist "!VS%__VSProductVersion%COMNTOOLS!\..\IDE\devenv.exe" goto CheckMSBuild
echo Visual Studio 2013+ (Community is free) is a pre-requisite to build this repository.
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites
exit /b 1

:CheckMSBuild
:: 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.
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

if not defined VisualStudioVersion (
if defined VS140COMNTOOLS (
call "%VS140COMNTOOLS%\VsDevCmd.bat"
goto :EnvSet
)
:: All set to commence the build

if defined VS120COMNTOOLS (
call "%VS120COMNTOOLS%\VsDevCmd.bat"
goto :EnvSet
)

echo Error: build.cmd requires Visual Studio 2013 or 2015.
echo Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md for build instructions.
exit /b 1
)

:EnvSet
setlocal
rem *********************
rem PUT NATIVE BUILD HERE
rem *********************

:: Log build command line
set _buildproj=%~dp0build.proj
set _buildlog=%~dp0msbuild.log
set _buildprefix=echo
set _buildpostfix=^> "%_buildlog%"
call :build %*
:ManagedBuild
REM endlocal to rid us of environment changes from vcvarsall.bat
endlocal

:: Build
set _buildprefix=
set _buildpostfix=
call :build %*
REM setlocal to prepare for vsdevcmd.bat
setlocal

goto :AfterBuild
rem Explicitly set Platform causes conflicts in managed project files. Clear it to allow building from VS x64 Native Tools Command Prompt
set Platform=

:build
%_buildprefix% msbuild "%_buildproj%" /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=normal;LogFile="%_buildlog%";Append %* %_buildpostfix%
set BUILDERRORLEVEL=%ERRORLEVEL%
goto :eof
:: Set the environment for the managed build
call "!VS%__VSProductVersion%COMNTOOLS!\VsDevCmd.bat"
echo Commencing build of ILToNative for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.
set "__ILToNativeBuildLog=%__LogsDir%\ILToNative_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
%_msbuildexe% "%__ProjectDir%\build.proj" %__MSBCleanBuildArgs% /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=normal;LogFile="%__ILToNativeBuildLog%"
IF NOT ERRORLEVEL 1 (
findstr /ir /c:".*Warning(s)" /c:".*Error(s)" /c:"Time Elapsed.*" "%__ILToNativeBuildLog%"
goto AfterILToNativeBuild
)
echo ILToNative build failed. Refer !__ILToNativeBuildLog! for details.
exit /b 1

:AfterBuild

echo.
:: Pull the build summary from the log file
findstr /ir /c:".*Warning(s)" /c:".*Error(s)" /c:"Time Elapsed.*" "%_buildlog%"
echo Build Exit Code = %BUILDERRORLEVEL%
:AfterILToNativeBuild

exit /b %BUILDERRORLEVEL%
2 changes: 1 addition & 1 deletion build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<!-- Override clean from dir.traversal.targets and just remove the full BinDir -->
<Target Name="Clean">
<RemoveDir Directories="$(BinDir)" />
<RemoveDir Directories="$(ObjDir)" />
</Target>

</Project>
1 change: 1 addition & 0 deletions src/ILToNative/repro/repro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<CLSCompliant>false</CLSCompliant>
<ExcludeResourcesImport>true</ExcludeResourcesImport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
1 change: 1 addition & 0 deletions src/ILToNative/src/ILToNative.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<FileAlignment>512</FileAlignment>
<CLSCompliant>false</CLSCompliant>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ExcludeResourcesImport>true</ExcludeResourcesImport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
16 changes: 8 additions & 8 deletions src/ILToNative/src/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
"System.Runtime": "4.0.20",
"System.Resources.ResourceManager": "4.0.0",
"System.Reflection.Primitives": "4.0.0",
"System.Diagnostics.Debug": "4.0.0",
"System.IO": "4.0.0",
"System.Diagnostics.Debug": "4.0.10",
"System.IO": "4.0.10",
"System.IO.FileSystem": "4.0.0",
"System.Collections": "4.0.0",
"System.Text.Encoding": "4.0.0",
"System.Runtime.InteropServices": "4.0.10",
"System.Collections": "4.0.10",
"System.Text.Encoding": "4.0.10",
"System.Runtime.InteropServices": "4.0.20",
"System.Reflection": "4.0.0",
"System.Runtime.Extensions": "4.0.10",
"System.Threading": "4.0.0",
"System.Text.Encoding.Extensions": "4.0.0",
"System.Threading": "4.0.10",
"System.Text.Encoding.Extensions": "4.0.10",
"System.Reflection.Extensions": "4.0.0",
"System.Console": "4.0.0-beta-*",
"System.AppContext": "4.0.0",
"System.Collections.Immutable": "1.1.37",
"System.Reflection.Metadata": "1.0.22"
},
"frameworks": {
"dnxcore50": {}
"dotnet": {}
}
}
1 change: 1 addition & 0 deletions src/TypeSystem.Ecma/src/TypeSystem.Ecma.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<CLSCompliant>false</CLSCompliant>
<ExcludeResourcesImport>true</ExcludeResourcesImport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
2 changes: 1 addition & 1 deletion src/TypeSystem.Ecma/src/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"System.Reflection.Metadata": "1.0.22"
},
"frameworks": {
"dnxcore50": {}
"dotnet": {}
}
}
1 change: 1 addition & 0 deletions src/TypeSystem/src/TypeSystem.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<FileAlignment>512</FileAlignment>
<CLSCompliant>false</CLSCompliant>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ExcludeResourcesImport>true</ExcludeResourcesImport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
2 changes: 1 addition & 1 deletion src/TypeSystem/src/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"System.Reflection.Extensions": "4.0.0"
},
"frameworks": {
"dnxcore50": {}
"dotnet": {}
}
}