Imported Upstream version 5.10.0.69

Former-commit-id: fc39669a0b707dd3c063977486506b6793da2890
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-29 19:03:06 +00:00
parent d8f8abd549
commit e2950ec768
6283 changed files with 453847 additions and 91879 deletions

View File

@@ -33,19 +33,24 @@ set Platform=
:: Restore the Tools directory
call "%__ProjectDir%\init-tools.cmd"
rem Tell nuget to always use repo-local nuget package cache. The "dotnet restore" invocations use the --packages
rem argument, but there are a few commands in publish and tests that do not.
set "NUGET_PACKAGES=%__PackagesDir%"
echo Using CLI tools version:
dir /b "%__DotNetCliPath%\sdk"
"%__DotNetCliPath%\dotnet.exe" msbuild "%__ProjectDir%\build.proj" /nologo /t:Restore /flp:v=normal;LogFile=build-restore.log /p:NuPkgRid=%__NugetRuntimeId% /maxcpucount /p:OSGroup=%__BuildOS% /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__ExtraMsBuildParams%
IF ERRORLEVEL 1 exit /b %ERRORLEVEL%
rem Buildtools tooling is not capable of publishing netcoreapp currently. Use helper projects to publish skeleton of
rem the standalone app that the build injects actual binaries into later.
"%__DotNetCliPath%\dotnet.exe" restore "%__SourceDir%\ILCompiler\netcoreapp\ilc.csproj" -r %__NugetRuntimeId%
IF ERRORLEVEL 1 exit /b %ERRORLEVEL%
"%__DotNetCliPath%\dotnet.exe" publish "%__SourceDir%\ILCompiler\netcoreapp\ilc.csproj" -r %__NugetRuntimeId% -o "%__RootBinDir%\%__BuildOS%.%__BuildArch%.%__BuildType%\tools"
IF ERRORLEVEL 1 exit /b %ERRORLEVEL%
:: Set the environment for the managed build
:SetupManagedBuild
call "!VS%__VSProductVersion%COMNTOOLS!\VsDevCmd.bat"
echo Commencing build of managed components for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.
%_msbuildexe% /ConsoleLoggerParameters:ForceNoAlign "%__ProjectDir%\build.proj" %__MSBCleanBuildArgs% %__ExtraMsBuildParams% /p:RepoPath="%__ProjectDir%" /p:RepoLocalBuild="true" /p:RelativeProductBinDir="%__RelativeProductBinDir%" /p:NuPkgRid=win7-x64 /p:ToolchainMilestone=%__ToolchainMilestone% /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=normal;LogFile="%__BuildLog%"
%_msbuildexe% /ConsoleLoggerParameters:ForceNoAlign "%__ProjectDir%\build.proj" %__ExtraMsBuildParams% /p:RepoPath="%__ProjectDir%" /p:RepoLocalBuild="true" /p:NuPkgRid=%__NugetRuntimeId% /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=normal;LogFile="%__BuildLog%"
IF NOT ERRORLEVEL 1 (
findstr /ir /c:".*Warning(s)" /c:".*Error(s)" /c:"Time Elapsed.*" "%__BuildLog%"
goto AfterILCompilerBuild
@@ -61,21 +66,15 @@ set __GenRespFiles=0
if not exist "%__ObjDir%\ryujit.rsp" set __GenRespFiles=1
if not exist "%__ObjDir%\cpp.rsp" set __GenRespFiles=1
if "%__GenRespFiles%"=="1" (
if exist "%__ReproProjectBinDir%" rd /s /q "%__ReproProjectBinDir%"
if exist "%__ReproProjectObjDir%" rd /s /q "%__ReproProjectObjDir%"
%_msbuildexe% /ConsoleLoggerParameters:ForceNoAlign "/p:IlcPath=%__BinDir%\packaging\publish1" /p:Configuration=%__BuildType% /t:IlcCompile "%__ReproProjectDir%\repro.csproj"
call :CopyResponseFile "%__ReproProjectObjDir%\native\repro.ilc.rsp" "%__ObjDir%\ryujit.rsp"
if exist "%__ReproProjectBinDir%" rd /s /q "%__ReproProjectBinDir%"
if exist "%__ReproProjectObjDir%" rd /s /q "%__ReproProjectObjDir%"
%_msbuildexe% /ConsoleLoggerParameters:ForceNoAlign "/p:IlcPath=%__BinDir%" /p:Configuration=%__BuildType% /t:Clean,IlcCompile "%__ProjectDir%\src\ILCompiler\repro\repro.csproj"
call :CopyResponseFile "%__ObjDir%\repro\native\repro.ilc.rsp" "%__ObjDir%\ryujit.rsp"
set __ExtraArgs=/p:NativeCodeGen=cpp
if /i "%__BuildType%"=="debug" (
set __ExtraArgs=!__ExtraArgs! "/p:AdditionalCppCompilerFlags=/MTd"
)
%_msbuildexe% /ConsoleLoggerParameters:ForceNoAlign "/p:IlcPath=%__BinDir%\packaging\publish1" /p:Configuration=%__BuildType% /t:IlcCompile "%__ReproProjectDir%\repro.csproj" !__ExtraArgs!
call :CopyResponseFile "%__ReproProjectObjDir%\native\repro.ilc.rsp" "%__ObjDir%\cpp.rsp"
%_msbuildexe% /ConsoleLoggerParameters:ForceNoAlign "/p:IlcPath=%__BinDir%" /p:Configuration=%__BuildType% /t:Clean,IlcCompile "%__ProjectDir%\src\ILCompiler\repro\repro.csproj" !__ExtraArgs!
call :CopyResponseFile "%__ObjDir%\repro\native\repro.ilc.rsp" "%__ObjDir%\cpp.rsp"
)
:AfterVsDevGenerateRespFiles
exit /b %ERRORLEVEL%
@@ -108,4 +107,4 @@ rem %1 Full path to the file, %2 Variable to receive the file name
setlocal
for %%i in ("%1") DO set fileName=%%~ni
endlocal & set "%2=%fileName%"
goto:eof
goto:eof

View File

@@ -6,6 +6,8 @@ if [ "$BUILDVARS_DONE" != 1 ]; then
. $scriptRoot/buildvars-setup.sh $*
fi
export __BuildArch
# Prepare the system for building
prepare_managed_build()
@@ -13,10 +15,6 @@ prepare_managed_build()
# Run Init-Tools to restore BuildTools and ToolRuntime
$__ProjectRoot/init-tools.sh
# Tell nuget to always use repo-local nuget package cache. The "dotnet restore" invocations use the --packages
# argument, but there are a few commands in publish and tests that do not.
export NUGET_PACKAGES=$__packageroot
echo "Using CLI tools version:"
ls "$__dotnetclipath/sdk"
}
@@ -26,17 +24,39 @@ build_managed_corert()
__buildproj=$__ProjectRoot/build.proj
__buildlog=$__ProjectRoot/msbuild.$__BuildArch.log
if [ -z "${ToolchainMilestone}" ]; then
ToolchainMilestone=testing
fi
__buildarch="$__BuildArch"
if [ "$__buildarch" = "armel" ]; then
__buildarch=arm
__ExtraMsBuildArgs="$__ExtraMsBuildArgs /p:BinDirPlatform=armel"
fi
$__ProjectRoot/Tools/msbuild.sh "$__buildproj" /m /nologo /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__buildlog" /t:Build /p:RepoPath=$__ProjectRoot /p:RepoLocalBuild="true" /p:RelativeProductBinDir=$__RelativeProductBinDir /p:CleanedTheBuild=$__CleanBuild /p:NuPkgRid=$__NugetRuntimeId /p:TestNugetRuntimeId=$__NugetRuntimeId /p:OSGroup=$__BuildOS /p:Configuration=$__BuildType /p:Platform=$__buildarch /p:COMPUTERNAME=$(hostname) /p:USERNAME=$(id -un) /p:ToolchainMilestone=${ToolchainMilestone} $__UnprocessedBuildArgs $__ExtraMsBuildArgs
$__dotnetclipath/dotnet msbuild "$__buildproj" /m /nologo /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__buildlog" /t:Restore /p:RepoPath=$__ProjectRoot /p:RepoLocalBuild="true" /p:NuPkgRid=$__NugetRuntimeId /p:OSGroup=$__BuildOS /p:Configuration=$__BuildType /p:Platform=$__buildarch /p:COMPUTERNAME=$(hostname) /p:USERNAME=$(id -un) $__UnprocessedBuildArgs $__ExtraMsBuildArgs
export BUILDERRORLEVEL=$?
echo
# Pull the build summary from the log file
tail -n 4 "$__buildlog"
echo Build Exit Code = $BUILDERRORLEVEL
if [ $BUILDERRORLEVEL != 0 ]; then
exit $BUILDERRORLEVEL
fi
# Buildtools tooling is not capable of publishing netcoreapp currently. Use helper projects to publish skeleton of
# the standalone app that the build injects actual binaries into later.
$__dotnetclipath/dotnet restore $__sourceroot/ILCompiler/netcoreapp/ilc.csproj -r $__NugetRuntimeId
export BUILDERRORLEVEL=$?
if [ $BUILDERRORLEVEL != 0 ]; then
exit $BUILDERRORLEVEL
fi
$__dotnetclipath/dotnet publish $__sourceroot/ILCompiler/netcoreapp/ilc.csproj -r $__NugetRuntimeId -o $__ProductBinDir/tools
export BUILDERRORLEVEL=$?
if [ $BUILDERRORLEVEL != 0 ]; then
exit $BUILDERRORLEVEL
fi
chmod +x $__ProductBinDir/tools/ilc
$__ProjectRoot/Tools/msbuild.sh "$__buildproj" /m /nologo /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__buildlog" /t:Build /p:RepoPath=$__ProjectRoot /p:RepoLocalBuild="true" /p:NuPkgRid=$__NugetRuntimeId /p:OSGroup=$__BuildOS /p:Configuration=$__BuildType /p:Platform=$__buildarch /p:COMPUTERNAME=$(hostname) /p:USERNAME=$(id -un) $__UnprocessedBuildArgs $__ExtraMsBuildArgs
export BUILDERRORLEVEL=$?
echo
@@ -54,50 +74,52 @@ build_managed_corert()
get_official_cross_builds()
{
if [ $__CrossBuild == 1 ]; then
__corefxsite="https://ci.dot.net/job/dotnet_corefx/job/master/view/Official%20Builds/job/"
__coreclrsite="https://ci.dot.net/job/dotnet_coreclr/job/master/view/Official%20Builds/job/"
__corefxsource=
__coreclrsource=
__buildtype=
if [ $__BuildType = "Debug" ]; then
__buildtype="debug"
else
__buildtype="release"
fi
ID=
case $__BuildArch in
arm)
;;
arm64)
;;
armel)
ID=
if [ -e $ROOTFS_DIR/etc/os-release ]; then
source $ROOTFS_DIR/etc/os-release
fi
if [ "$ID" = "tizen" ]; then
__corefxsource="tizen_armel_cross_${__buildtype}/lastSuccessfulBuild/artifact/bin/build.tar.gz"
__coreclrsource="armel_cross_${__buildtype}_tizen/lastSuccessfulBuild/artifact/bin/Product/Linux.armel.${__BuildType}/libSystem.Globalization.Native.a"
fi
;;
esac
if [ -n "${__corefxsource}" ]; then
wget "${__corefxsite}${__corefxsource}"
export BUILDERRORLEVEL=$?
if [ $BUILDERRORLEVEL != 0 ]; then
exit $BUILDERRORLEVEL
fi
tar xvf ./build.tar.gz ./System.Native.a
mv ./System.Native.a $__ProjectRoot/bin/Product/Linux.${__BuildArch}.${__BuildType}/packaging/publish1/framework
rm -rf ./build.tar.gz
# only tizen case now
if [ "$ID" != "tizen" ]; then
return 0
fi
if [ -n ${__coreclrsource} ]; then
wget "${__coreclrsite}${__coreclrsource}"
export BUILDERRORLEVEL=$?
if [ $BUILDERRORLEVEL != 0 ]; then
exit $BUILDERRORLEVEL
fi
mv ./libSystem.Globalization.Native.a $__ProjectRoot/bin/Product/Linux.${__BuildArch}.${__BuildType}/packaging/publish1/framework
__tizenToolsRoot=${__ProjectRoot}/Tools/tizen
__corefxsite="https://ci.dot.net/job/dotnet_corefx/job/master/view/Official%20Builds/job/"
__coreclrsite="https://ci.dot.net/job/dotnet_coreclr/job/master/view/Official%20Builds/job/"
__buildArchiveName="build.tar.gz"
__systemNativeLibName="System.Native.a"
__systemGlobNativeLibName="libSystem.Globalization.Native.a"
if [ $__BuildType = "Debug" ]; then
__buildtype="debug"
else
__buildtype="release"
fi
__corefxsource="tizen_armel_cross_${__buildtype}/lastSuccessfulBuild/artifact/bin/${__buildArchiveName}"
__coreclrsource="armel_cross_${__buildtype}_tizen/lastSuccessfulBuild/artifact/bin/Product/Linux.armel.${__BuildType}/${__systemGlobNativeLibName}"
mkdir -p $__tizenToolsRoot
(cd ${__tizenToolsRoot} && wget -N "${__corefxsite}${__corefxsource}")
export BUILDERRORLEVEL=$?
if [ $BUILDERRORLEVEL != 0 ]; then
exit $BUILDERRORLEVEL
fi
tar xvf ${__tizenToolsRoot}/${__buildArchiveName} -C ${__tizenToolsRoot} ./${__systemNativeLibName}
cp ${__tizenToolsRoot}/${__systemNativeLibName} $__ProjectRoot/bin/Linux.${__BuildArch}.${__BuildType}/framework
(cd ${__tizenToolsRoot} && wget -N "${__coreclrsite}${__coreclrsource}")
export BUILDERRORLEVEL=$?
if [ $BUILDERRORLEVEL != 0 ]; then
exit $BUILDERRORLEVEL
fi
cp ${__tizenToolsRoot}/${__systemGlobNativeLibName} $__ProjectRoot/bin/Linux.${__BuildArch}.${__BuildType}/framework
fi
}

View File

@@ -30,31 +30,36 @@ exit /b %ERRORLEVEL%
echo Commencing build of native components for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.
:PrepareVs
:: Set the environment for the native build
set __VCBuildArch=x86_amd64
if /i "%__BuildArch%" == "x86" (set __VCBuildArch=x86)
:: VS2017 changed the location of vcvarsall.bat.
if /i "%__VSVersion%" == "vs2017" (
call "!VS%__VSProductVersion%COMNTOOLS!\..\..\VC\Auxiliary\Build\vcvarsall.bat" %__VCBuildArch%
) else (
call "!VS%__VSProductVersion%COMNTOOLS!\..\..\VC\vcvarsall.bat" %__VCBuildArch%
)
call "!VS%__VSProductVersion%COMNTOOLS!\..\..\VC\Auxiliary\Build\vcvarsall.bat" %__VCBuildArch%
:: Regenerate the VS solution
:: Regenerate the build files
:RegenerateBuildFiles
pushd "%__IntermediatesDir%"
call "%__SourceDir%\Native\gen-buildsys-win.bat" "%__ProjectDir%\src\Native" %__VSVersion% %__BuildArch%
call "%__SourceDir%\Native\gen-buildsys-win.bat" "%__ProjectDir%\src\Native" %__VSVersion% %__BuildArch% %__BuildType%
popd
if exist "%__IntermediatesDir%\install.vcxproj" goto BuildNative
if exist "%__IntermediatesDir%\install.vcxproj" goto BuildNativeVs
if exist "%__IntermediatesDir%\Makefile" goto BuildNativeEmscripten
echo Failed to generate native component build project!
exit /b 1
:BuildNative
%_msbuildexe% /ConsoleLoggerParameters:ForceNoAlign "%__IntermediatesDir%\install.vcxproj" %__MSBCleanBuildArgs% %__ExtraMsBuildParams% /nologo /maxcpucount /nodeReuse:false /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% /fileloggerparameters:Verbosity=normal;LogFile="%__NativeBuildLog%"
:BuildNativeVs
%_msbuildexe% /ConsoleLoggerParameters:ForceNoAlign "%__IntermediatesDir%\install.vcxproj" %__ExtraMsBuildParams% /nologo /maxcpucount /nodeReuse:false /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% /fileloggerparameters:Verbosity=normal;LogFile="%__NativeBuildLog%"
IF NOT ERRORLEVEL 1 goto AfterNativeBuild
echo Native component build failed. Refer !__NativeBuildLog! for details.
exit /b 1
:BuildNativeEmscripten
pushd "%__IntermediatesDir%"
nmake install
popd
IF NOT ERRORLEVEL 1 goto AfterNativeBuild
exit /b 1
:AfterNativeBuild
endlocal
endlocal

View File

@@ -16,6 +16,12 @@ check_native_prereqs()
# Check for clang
hash clang-$__ClangMajorVersion.$__ClangMinorVersion 2>/dev/null || hash clang$__ClangMajorVersion$__ClangMinorVersion 2>/dev/null || hash clang 2>/dev/null || { echo >&2 "Please install clang before running this script"; exit 1; }
# Check for additional prereqs for wasm build
if [ $__BuildArch == "wasm" ]; then
hash emcmake 2>/dev/null || { echo >&2 "Please install Emscripten before running this script. See https://github.com/dotnet/corert/blob/master/Documentation/how-to-build-WebAssembly.md for more information."; exit 1; }
if [ -z ${EMSCRIPTEN+x} ]; then echo "EMSCRIPTEN is not set. Ensure your have set up the Emscripten environment using \"source <emsdk_dir>/emsdk_env.sh\""; exit 1; fi
fi
}
prepare_native_build()
@@ -65,7 +71,11 @@ build_native_corert()
echo "Executing make install -j $NumProc $__UnprocessedBuildArgs"
make install -j $NumProc $__UnprocessedBuildArgs
if [ $__BuildArch == "wasm" ]; then
emmake make install -j $NumProc $__UnprocessedBuildArgs
else
make install -j $NumProc $__UnprocessedBuildArgs
fi
if [ $? != 0 ]; then
echo "Failed to build corert native components."
popd
@@ -119,7 +129,6 @@ build_host_native_corert()
build_native_corert
cp ${__ProductHostBinDir}/jitinterface.so ${__ProductBinDir}
cp ${__ProductHostBinDir}/jitinterface.so ${__ProductBinDir}/packaging/publish1
export __BuildArch=$__SavedBuildArch
export __IntermediatesDir=$__SavedIntermediatesDir

View File

@@ -27,5 +27,5 @@ exit /b %ERRORLEVEL%
:AfterVarSetup
%_msbuildexe% "%__ProjectDir%\pkg\packages.proj" /m /nologo /flp:v=diag;LogFile=build-packages.log /p:NuPkgRid=win7-x64 /p:OSGroup=%__BuildOS% /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__ExtraMsBuildParams%
exit /b %ERRORLEVEL%
%_msbuildexe% "%__ProjectDir%\pkg\packages.proj" /m /nologo /flp:v=diag;LogFile=build-packages.log /p:NuPkgRid=%__NugetRuntimeId% /p:OSGroup=%__BuildOS% /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__ExtraMsBuildParams%
exit /b %ERRORLEVEL%

View File

@@ -33,4 +33,4 @@ pushd "%__ProjectDir%\tests"
call "runtest.cmd" %__BuildType% %__BuildArch% /dotnetclipath %__DotNetCliPath%
set TEST_EXIT_CODE=%ERRORLEVEL%
popd
exit /b %TEST_EXIT_CODE%
exit /b %TEST_EXIT_CODE%

View File

@@ -3,21 +3,14 @@ set __BuildArch=x64
set __BuildType=Debug
set __BuildOS=Windows_NT
:: Default to highest Visual Studio version available
set __VSVersion=vs2015
if defined VS150COMNTOOLS set __VSVersion=vs2017
:: 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=
set __ToolchainMilestone=testing
set "__DotNetCliPath=%__ProjectDir%\Tools\dotnetcli"
:Arg_Loop
@@ -33,18 +26,15 @@ if /i "%1" == "-help" goto Usage
if /i "%1" == "x64" (set __BuildArch=x64&&shift&goto Arg_Loop)
if /i "%1" == "x86" (set __BuildArch=x86&&shift&goto Arg_Loop)
if /i "%1" == "arm" (set __BuildArch=arm&&shift&goto Arg_Loop)
if /i "%1" == "wasm" (set __BuildOS=WebAssembly&&set __BuildArch=wasm&&shift&goto Arg_Loop)
if /i "%1" == "debug" (set __BuildType=Debug&shift&goto Arg_Loop)
if /i "%1" == "release" (set __BuildType=Release&shift&goto Arg_Loop)
if /i "%1" == "vs2017" (set __VSVersion=vs2017&shift&goto Arg_Loop)
if /i "%1" == "vs2015" (set __VSVersion=vs2015&shift&goto Arg_Loop)
if /i "%1" == "clean" (set __CleanBuild=1&shift&goto Arg_Loop)
if /i "%1" == "skiptests" (set __SkipTests=1&shift&goto Arg_Loop)
if /i "%1" == "skipvsdev" (set __SkipVsDev=1&shift&goto Arg_Loop)
if /i "%1" == "/milestone" (set __ToolchainMilestone=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "/dotnetclipath" (set __DotNetCliPath=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "/officialbuildid" (set "__ExtraMsBuildParams=/p:OfficialBuildId=%2"&shift&shift&goto Arg_Loop)
@@ -54,15 +44,11 @@ exit /b 1
:ArgsDone
:: Set the remaining variables based upon the determined build configuration
set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__BinDir=%__RootBinDir%\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__ObjDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__IntermediatesDir=%__RootBinDir%\obj\Native\%__BuildOS%.%__BuildArch%.%__BuildType%\"
set "__RelativeProductBinDir=bin\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__NativeBuildLog=%__LogsDir%\Native_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
set "__BuildLog=%__LogsDir%\msbuild_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
set "__ReproProjectDir=%__ProjectDir%\src\ILCompiler\repro"
set "__ReproProjectBinDir=%__BinDir%\repro"
set "__ReproProjectObjDir=%__ObjDir%\repro"
:: Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
set "__CMakeBinDir=%__BinDir%"
@@ -73,9 +59,6 @@ if not defined __CleanBuild goto MakeDirs
echo Doing a clean build
echo.
:: MSBuild projects would need a rebuild
set __MSBCleanBuildArgs=/t:rebuild /p:CleanedTheBuild=1
:: Cleanup the previous output for the selected configuration
if exist "%__BinDir%" rd /s /q "%__BinDir%"
if exist "%__ObjDir%" rd /s /q "%__ObjDir%"
@@ -89,11 +72,25 @@ if not exist "%__ObjDir%" md "%__ObjDir%"
if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%"
if not exist "%__LogsDir%" md "%__LogsDir%"
:CheckPrereqs
:: Check prerequisites
echo Checking pre-requisites...
echo.
if "%__BuildArch%"=="wasm" (
goto :CheckPrereqsEmscripten
) else (
goto :CheckPrereqsVs
)
:CheckPrereqsEmscripten
if not defined EMSCRIPTEN (
echo Emscripten is a prerequisite to build for WebAssembly.
echo See: https://github.com/dotnet/corert/blob/master/Documentation/how-to-build-WebAssembly.md
exit /b 1
)
goto CheckPrereqsVs
:CheckPrereqsVs
:: Validate that PowerShell is accessibile.
for %%X in (powershell.exe) do (set __PSDir=%%~$PATH:X)
if defined __PSDir goto EvaluatePS
@@ -105,45 +102,58 @@ exit /b 1
:: Eval the output from probe-win1.ps1
for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& ""%__SourceDir%\Native\probe-win.ps1"""') do %%a
:: Default to highest Visual Studio version available
::
:: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS
:: is no longer set as a global environment variable and is instead only set if the user
:: has launched the VS2017 Developer Command Prompt.
::
:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is
:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and
:: is already configured to use that toolset. Otherwise, we will fallback to using the latest
:: VS2017 toolset if it is installed. Finally, we will fail the script if no supported VS instance
:: can be found.
set __VSProductVersion=
if /i "%__VSVersion%" == "vs2015" set __VSProductVersion=140
if /i "%__VSVersion%" == "vs2017" set __VSProductVersion=150
if defined VisualStudioVersion goto :RunVCVars
:: Check presence of VS
if defined VS%__VSProductVersion%COMNTOOLS goto CheckVSExistence
echo Visual Studio 2015 or 2017 (Community is free) is a pre-requisite to build this repository.
echo If you're using Visual Studio 2017, make sure to run build.cmd from the "Developer Command Prompt
echo for VS 2017" (find it in the Start menu).
set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if exist %_VSWHERE% (
for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -prerelease -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools
)
if not exist "%_VSCOMNTOOLS%" goto :MissingVersion
call "%_VSCOMNTOOLS%\VsDevCmd.bat"
:RunVCVars
if "%VisualStudioVersion%"=="15.0" (
goto :VS2017
)
:MissingVersion
:: Can't find VS 2017
echo Visual Studio 2017 is a pre-requisite to build this repository.
echo See: https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md
exit /b 1
:CheckVSExistence
:: Does VS VS 2015 really exist?
if exist "!VS%__VSProductVersion%COMNTOOLS!\..\IDE\devenv.exe" goto CheckMSBuild
echo Visual Studio not installed in !VS%__VSProductVersion%COMNTOOLS!.
:VS2017
:: Setup vars for VS2017
set __VSVersion=vs2017
set __VSProductVersion=150
if not exist "!VS%__VSProductVersion%COMNTOOLS!\..\..\VC\Auxiliary\Build\vcvarsall.bat" goto :MissingVisualC
goto :CheckMSBuild
:MissingVisualC
echo Could not find Visual C++ under !VS%__VSProductVersion%COMNTOOLS!. Visual C++ is a pre-requisite to build this repository.
echo See: https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md
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%" == "vs2017" (
rem The MSBuild that is installed in the shared location is not compatible
rem with VS2017 C++ projects. I must use the MSBuild located in
rem C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe
rem which is compatible. However, I don't know a good way to specify this
rem path in a way that isn't specific to my system, so I am relying on the
rem system PATH to locate this tool.
set _msbuildexe=msbuild
) else (
set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
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/corert/blob/master/Documentation/prerequisites-for-building.md for build instructions. && exit /b 1)
)
rem The MSBuild that is installed in the shared location is not compatible
rem with VS2017 C++ projects. I must use the MSBuild located in
rem C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe
set _msbuildexe="%VSINSTALLDIR%\MSBuild\15.0\Bin\MSBuild.exe"
if not exist !_msbuildexe! (echo Error: Could not find MSBuild.exe. Please see https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md for build instructions. && exit /b 1)
rem Explicitly set Platform causes conflicts in managed project files. Clear it to allow building from VS x64 Native Tools Command Prompt
set Platform=
@@ -152,10 +162,10 @@ set Platform=
set __VCBuildArch=x86_amd64
if /i "%__BuildArch%" == "x86" (set __VCBuildArch=x86)
rem Tell nuget to always use repo-local nuget package cache. The "dotnet restore" invocations use the --packages
rem argument, but there are a few commands in publish and tests that do not.
set "NUGET_PACKAGES=%__PackagesDir%"
set __NugetRuntimeId=win7-x64
if /i "%__BuildArch%" == "x86" (set __NugetRuntimeId=win7-x86)
:Done
set BUILDVARS_DONE=1
exit /b 0
@@ -169,9 +179,8 @@ echo.
echo All arguments are optional. The options are:
echo.
echo./? -? /h -h /help -help: view this message.
echo Build architecture: one of x64, x86, arm ^(default: x64^).
echo Build architecture: one of x64, x86, arm, wasm ^(default: x64^).
echo Build type: one of Debug, Checked, Release ^(default: Debug^).
echo Visual Studio version: vs2015, vs2017 ^(defaults to highest detected^).
echo clean: force a clean build ^(default is to perform an incremental build^).
echo skiptests: skip building tests ^(default: tests are built^).
exit /b 1
exit /b 1

View File

@@ -2,14 +2,15 @@
usage()
{
echo "Usage: $0 [managed] [native] [BuildArch] [BuildType] [clean] [cross] [verbose] [clangx.y]"
echo "Usage: $0 [managed] [native] [BuildArch] [BuildType] [clean] [cross] [verbose] [objwriter] [clangx.y]"
echo "managed - optional argument to build the managed code"
echo "native - optional argument to build the native code"
echo "The following arguments affect native builds only:"
echo "BuildArch can be: x64, x86, arm, arm64, armel"
echo "BuildArch can be: x64, x86, arm, arm64, armel, wasm"
echo "BuildType can be: Debug, Release"
echo "clean - optional argument to force a clean build."
echo "verbose - optional argument to enable verbose build output."
echo "objwriter - optional argument to enable build ObjWriter library"
echo "clangx.y - optional argument to build using clang version x.y."
echo "cross - optional argument to signify cross compilation,"
echo " - will use ROOTFS_DIR environment variable if set."
@@ -56,99 +57,43 @@ check_native_prereqs()
hash clang-$__ClangMajorVersion.$__ClangMinorVersion 2>/dev/null || hash clang$__ClangMajorVersion$__ClangMinorVersion 2>/dev/null || hash clang 2>/dev/null || { echo >&2 "Please install clang before running this script"; exit 1; }
}
get_current_linux_rid() {
# Construct RID for current distro
get_current_linux_distro() {
# Detect Distro
if [ "$(cat /etc/*-release | grep -cim1 ubuntu)" -eq 1 ]; then
if [ "$(cat /etc/*-release | grep -cim1 16.04)" -eq 1 ]; then
echo "ubuntu.16.04"
return 0
rid=linux
if [ -e /etc/os-release ]; then
source /etc/os-release
if [[ $ID == "alpine" ]]; then
# remove the last version digit
VERSION_ID=${VERSION_ID%.*}
rid=alpine.$VERSION_ID
elif [[ $ID == "ubuntu" ]]; then
rid=$ID.$VERSION_ID
fi
echo "ubuntu.14.04"
return 0
elif [ -e /etc/redhat-release ]; then
redhatRelease=$(</etc/redhat-release)
if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then
rid=rhel.6
fi
fi
# Cannot determine Linux distribution, assuming Ubuntu 14.04.
echo "ubuntu.14.04"
return 0
echo $rid
}
export __scriptpath="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export __ProjectRoot=$__scriptpath/..
export __packageroot=$__ProjectRoot/packages
export __sourceroot=$__ProjectRoot/src
export __rootbinpath="$__ProjectRoot/bin"
export __buildmanaged=false
export __buildnative=false
export __dotnetclipath=$__ProjectRoot/Tools/dotnetcli
# Use uname to determine what the CPU is.
export CPUName=$(uname -p)
# Some Linux platforms report unknown for platform, but the arch for machine.
if [ $CPUName == "unknown" ]; then
export CPUName=$(uname -m)
fi
# Initialize variables that depend on the compilation host
. $__scriptpath/hostvars-setup.sh
case $CPUName in
i686)
export __BuildArch=x86
;;
x86_64)
export __BuildArch=x64
;;
armv7l)
echo "Unsupported CPU $CPUName detected, build might not succeed!"
export __BuildArch=arm
;;
aarch64)
echo "Unsupported CPU $CPUName detected, build might not succeed!"
export __BuildArch=arm64
;;
*)
echo "Unknown CPU $CPUName detected, configuring as if for x64"
export __BuildArch=x64
;;
esac
export __HostArch=$__BuildArch
# Use uname to determine what the OS is.
export OSName=$(uname -s)
case $OSName in
Darwin)
export __BuildOS=OSX
export __NugetRuntimeId=osx.10.10-x64
ulimit -n 2048
;;
FreeBSD)
export __BuildOS=FreeBSD
# TODO: Add proper FreeBSD target
export __NugetRuntimeId=ubuntu.14.04-x64
;;
Linux)
export __BuildOS=Linux
export __NugetRuntimeId=$(get_current_linux_distro)-x64
;;
NetBSD)
export __BuildOS=NetBSD
# TODO: Add proper NetBSD target
export __NugetRuntimeId=ubuntu.14.04-x64
;;
*)
echo "Unsupported OS $OSName detected, configuring as if for Linux"
export __BuildOS=Linux
export __NugetRuntimeId=ubuntu.14.04-x64
;;
esac
export __BuildType=Debug
export BUILDERRORLEVEL=0
@@ -157,10 +102,12 @@ export BUILDERRORLEVEL=0
export __UnprocessedBuildArgs=
export __CleanBuild=0
export __VerboseBuild=0
export __ObjWriterBuild=0
export __ClangMajorVersion=3
export __ClangMinorVersion=9
export __CrossBuild=0
__BuildArch=$__HostArch
while [ "$1" != "" ]; do
lowerI="$(echo $1 | awk '{print tolower($0)}')"
@@ -176,21 +123,22 @@ while [ "$1" != "" ]; do
export __buildnative=true
;;
x86)
export __BuildArch=x86
__BuildArch=x86
;;
x64)
export __BuildArch=x64
__BuildArch=x64
;;
arm)
export __BuildArch=arm
__BuildArch=arm
;;
arm64)
export __BuildArch=arm64
__BuildArch=arm64
;;
armel)
export __BuildArch=armel
export __ClangMajorVersion=3
export __ClangMinorVersion=5
__BuildArch=armel
;;
wasm)
__BuildArch=wasm
;;
debug)
export __BuildType=Debug
@@ -204,6 +152,9 @@ while [ "$1" != "" ]; do
verbose)
export __VerboseBuild=1
;;
objwriter)
export __ObjWriterBuild=1
;;
clang3.6)
export __ClangMajorVersion=3
export __ClangMinorVersion=6
@@ -240,6 +191,44 @@ while [ "$1" != "" ]; do
shift
done
export $__BuildArch
if [ $__BuildArch == "wasm" ]; then
export __BuildOS=WebAssembly
else
# Use uname to determine what the OS is.
export OSName=$(uname -s)
case $OSName in
Darwin)
export __BuildOS=OSX
export __NugetRuntimeId=osx.10.10-x64
ulimit -n 2048
;;
FreeBSD)
export __BuildOS=FreeBSD
# TODO: Add proper FreeBSD target
export __NugetRuntimeId=ubuntu.14.04-x64
;;
Linux)
export __BuildOS=Linux
export __NugetRuntimeId=$(get_current_linux_rid)-$__HostArch
;;
NetBSD)
export __BuildOS=NetBSD
# TODO: Add proper NetBSD target
export __NugetRuntimeId=ubuntu.14.04-x64
;;
*)
echo "Unsupported OS $OSName detected, configuring as if for Linux"
export __BuildOS=Linux
export __NugetRuntimeId=ubuntu.14.04-x64
;;
esac
fi
# If neither managed nor native are passed as arguments, default to building both
@@ -253,11 +242,10 @@ export __IntermediatesDir="$__rootbinpath/obj/Native/$__BuildOS.$__BuildArch.$__
if [ $__CrossBuild = 1 ]; then
export __IntermediatesHostDir="$__rootbinpath/obj/Native/$__BuildOS.$__HostArch.$__BuildType"
fi
export __ProductBinDir="$__rootbinpath/Product/$__BuildOS.$__BuildArch.$__BuildType"
export __ProductBinDir="$__rootbinpath/$__BuildOS.$__BuildArch.$__BuildType"
if [ $__CrossBuild = 1 ]; then
export __ProductHostBinDir="$__rootbinpath/Product/$__BuildOS.$__HostArch.$__BuildType"
export __ProductHostBinDir="$__rootbinpath/$__BuildOS.$__HostArch.$__BuildType"
fi
export __RelativeProductBinDir="bin/Product/$__BuildOS.$__BuildArch.$__BuildType"
# CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to set.
# This is needed by CLI to function.

View File

@@ -0,0 +1,33 @@
#!/usr/bin/env bash
# Use uname to determine what the CPU is.
export CPUName=$(uname -p)
# Some Linux platforms report unknown for platform, but the arch for machine.
if [ $CPUName == "unknown" ]; then
export CPUName=$(uname -m)
fi
case $CPUName in
i686)
export __HostArch=x86
;;
x86_64)
export __HostArch=x64
;;
armv7l)
echo "Unsupported CPU $CPUName detected, build might not succeed!"
export __HostArch=arm
;;
aarch64)
echo "Unsupported CPU $CPUName detected, build might not succeed!"
export __HostArch=arm64
;;
*)
echo "Unknown CPU $CPUName detected, configuring as if for x64"
export __HostArch=x64
;;
esac

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<Import Project="$(ToolsDir)PublishContent.targets" />
<Import Project="$(ToolsDir)versioning.targets" />
@@ -17,4 +16,4 @@
</Target>
<Target Name="Build" DependsOnTargets="CreateContainerName;UploadToAzure" />
</Project>
</Project>

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
@@ -16,4 +15,4 @@
</Target>
<Target Name="Build" DependsOnTargets="ValidateRequiredProperties;DownloadBlobsFromAzureTargets" />
</Project>
</Project>