Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -0,0 +1,111 @@
@if not defined _echo @echo off
setlocal EnableDelayedExpansion
set __ThisScriptShort=%0
if /i "%1" == "/?" goto HelpVarCall
if /i "%1" == "-?" goto HelpVarCall
if /i "%1" == "/h" goto HelpVarCall
if /i "%1" == "-h" goto HelpVarCall
if /i "%1" == "/help" goto HelpVarCall
if /i "%1" == "-help" goto HelpVarCall
if defined BUILDVARS_DONE goto :AfterVarSetup
goto :NormalVarCall
:HelpVarCall
call %~dp0buildvars-setup.cmd -help
exit /b 1
:NormalVarCall
call %~dp0buildvars-setup.cmd %*
IF NOT ERRORLEVEL 1 goto AfterVarSetup
echo Setting build variables failed.
exit /b %ERRORLEVEL%
:AfterVarSetup
rem Explicitly set Platform causes conflicts in managed project files. Clear it to allow building from VS x64 Native Tools Command Prompt
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"
:: 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%"
IF NOT ERRORLEVEL 1 (
findstr /ir /c:".*Warning(s)" /c:".*Error(s)" /c:"Time Elapsed.*" "%__BuildLog%"
goto AfterILCompilerBuild
)
echo ILCompiler build failed with exit code %ERRORLEVEL%. Refer !__BuildLog! for details.
exit /b %ERRORLEVEL%
:AfterILCompilerBuild
:VsDevGenerateRespFiles
if defined __SkipVsDev goto :AfterVsDevGenerateRespFiles
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%"
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"
)
:AfterVsDevGenerateRespFiles
exit /b %ERRORLEVEL%
endlocal
rem Copies the dotnet generated response file while patching up references
rem to System.Private assemblies to the live built ones.
rem This is to make sure that making changes in a private library doesn't require
rem a full rebuild. It also helps with locating the symbols.
:CopyResponseFile
setlocal
> %~2 (
for /f "tokens=*" %%l in (%~1) do (
set line=%%l
if "!line:publish1\sdk=!"=="!line!" (
echo !line!
) ELSE (
set assemblyPath=!line:~3!
call :ExtractFileName !assemblyPath! assemblyFileName
echo -r:%__BinDir%\!assemblyFileName!\!assemblyFileName!.dll
)
)
)
endlocal
goto:eof
rem Extracts a file name from a full path
rem %1 Full path to the file, %2 Variable to receive the file name
:ExtractFileName
setlocal
for %%i in ("%1") DO set fileName=%%~ni
endlocal & set "%2=%fileName%"
goto:eof

59
external/corert/buildscripts/build-managed.sh vendored Executable file
View File

@@ -0,0 +1,59 @@
#!/usr/bin/env bash
scriptRoot="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ "$BUILDVARS_DONE" != 1 ]; then
. $scriptRoot/buildvars-setup.sh $*
fi
# Prepare the system for building
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"
}
build_managed_corert()
{
__buildproj=$__ProjectRoot/build.proj
__buildlog=$__ProjectRoot/msbuild.$__BuildArch.log
if [ -z "${ToolchainMilestone}" ]; then
ToolchainMilestone=testing
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
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
}
if $__buildmanaged; then
# Prepare the system
prepare_managed_build
# Build the corert native components.
build_managed_corert
# Build complete
fi

View File

@@ -0,0 +1,60 @@
@if not defined _echo @echo off
setlocal EnableDelayedExpansion
set __ThisScriptShort=%0
if /i "%1" == "/?" goto HelpVarCall
if /i "%1" == "-?" goto HelpVarCall
if /i "%1" == "/h" goto HelpVarCall
if /i "%1" == "-h" goto HelpVarCall
if /i "%1" == "/help" goto HelpVarCall
if /i "%1" == "-help" goto HelpVarCall
if defined BUILDVARS_DONE goto :AfterVarSetup
goto :NormalVarCall
:HelpVarCall
call %~dp0buildvars-setup.cmd -help
exit /b 1
:NormalVarCall
call %~dp0buildvars-setup.cmd %*
IF NOT ERRORLEVEL 1 goto AfterVarSetup
echo Setting build variables failed.
exit /b %ERRORLEVEL%
:AfterVarSetup
echo Commencing build of native components for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.
:: 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%
)
:: Regenerate the VS solution
pushd "%__IntermediatesDir%"
call "%__SourceDir%\Native\gen-buildsys-win.bat" "%__ProjectDir%\src\Native" %__VSVersion% %__BuildArch%
popd
if exist "%__IntermediatesDir%\install.vcxproj" goto BuildNative
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%"
IF NOT ERRORLEVEL 1 goto AfterNativeBuild
echo Native component build failed. Refer !__NativeBuildLog! for details.
exit /b 1
:AfterNativeBuild
endlocal

96
external/corert/buildscripts/build-native.sh vendored Executable file
View File

@@ -0,0 +1,96 @@
#!/usr/bin/env bash
scriptRoot="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ "$BUILDVARS_DONE" != 1 ]; then
. $scriptRoot/buildvars-setup.sh $*
fi
# Check the system to ensure the right pre-reqs are in place
check_native_prereqs()
{
echo "Checking pre-requisites..."
# Check presence of CMake on the path
hash cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script"; exit 1; }
# 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; }
}
prepare_native_build()
{
# Specify path to be set for CMAKE_INSTALL_PREFIX.
# This is where all built CoreClr libraries will copied to.
export __CMakeBinDir="$__ProductBinDir"
# Configure environment if we are doing a verbose build
if [ $__VerboseBuild == 1 ]; then
export VERBOSE=1
fi
}
build_native_corert()
{
# All set to commence the build
echo "Commencing build of corert native components for $__BuildOS.$__BuildArch.$__BuildType"
pushd "$__IntermediatesDir"
# Regenerate the CMake solution
echo "Invoking cmake with arguments: \"$__ProjectRoot\" $__BuildType"
"$__ProjectRoot/src/Native/gen-buildsys-clang.sh" "$__ProjectRoot" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__BuildType
# Check that the makefiles were created.
if [ ! -f "$__IntermediatesDir/Makefile" ]; then
echo "Failed to generate native component build project!"
popd
exit 1
fi
# Get the number of processors available to the scheduler
# Other techniques such as `nproc` only get the number of
# processors available to a single process.
if [ `uname` = "FreeBSD" ]; then
NumProc=`sysctl hw.ncpu | awk '{ print $2+1 }'`
elif [ `uname` = "NetBSD" ]; then
NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
else
NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
fi
# Build
echo "Executing make install -j $NumProc $__UnprocessedBuildArgs"
make install -j $NumProc $__UnprocessedBuildArgs
if [ $? != 0 ]; then
echo "Failed to build corert native components."
popd
exit $?
fi
echo "CoreRT native components successfully built."
popd
}
if $__buildnative; then
# Check prereqs.
check_native_prereqs
# Prepare the system
prepare_native_build
# Build the corert native components.
build_native_corert
# Build complete
fi

View File

@@ -0,0 +1,31 @@
@if not defined _echo @echo off
setlocal EnableDelayedExpansion
set __ThisScriptShort=%0
if /i "%1" == "/?" goto HelpVarCall
if /i "%1" == "-?" goto HelpVarCall
if /i "%1" == "/h" goto HelpVarCall
if /i "%1" == "-h" goto HelpVarCall
if /i "%1" == "/help" goto HelpVarCall
if /i "%1" == "-help" goto HelpVarCall
if defined BUILDVARS_DONE goto :AfterVarSetup
goto :NormalVarCall
:HelpVarCall
call %~dp0buildvars-setup.cmd -help
exit /b 1
:NormalVarCall
call %~dp0buildvars-setup.cmd %*
IF NOT ERRORLEVEL 1 goto AfterVarSetup
echo Setting build variables failed.
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%

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
scriptRoot="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ "$BUILDVARS_DONE" != 1 ]; then
. $scriptRoot/buildvars-setup.sh $*
fi
$__ProjectRoot/Tools/msbuild.sh "$__ProjectRoot/pkg/packages.proj" /m /nologo "/flp:v=diag;LogFile=build-packages.log" /p:RepoPath="$__ProjectRoot" /p:NuPkgRid=$__NugetRuntimeId /p:OSGroup=$__BuildOS /p:Configuration=$__BuildType /p:Platform=$__BuildArch /p:COMPUTERNAME=$(hostname) /p:USERNAME=$(id -un) $__UnprocessedBuildArgs $__ExtraMsBuildArgs
export BUILDERRORLEVEL=$?
exit $BUILDERRORLEVEL

View File

@@ -0,0 +1,36 @@
@if not defined _echo @echo off
setlocal EnableDelayedExpansion
set __ThisScriptShort=%0
if /i "%1" == "/?" goto HelpVarCall
if /i "%1" == "-?" goto HelpVarCall
if /i "%1" == "/h" goto HelpVarCall
if /i "%1" == "-h" goto HelpVarCall
if /i "%1" == "/help" goto HelpVarCall
if /i "%1" == "-help" goto HelpVarCall
if defined BUILDVARS_DONE goto :AfterVarSetup
goto :NormalVarCall
:HelpVarCall
call %~dp0buildvars-setup.cmd -help
exit /b 1
:NormalVarCall
call %~dp0buildvars-setup.cmd %*
IF NOT ERRORLEVEL 1 goto AfterVarSetup
echo Setting build variables failed.
exit /b %ERRORLEVEL%
:AfterVarSetup
if defined __SkipTests exit /b 0
pushd "%__ProjectDir%\tests"
call "runtest.cmd" %__BuildType% %__BuildArch% /dotnetclipath %__DotNetCliPath%
set TEST_EXIT_CODE=%ERRORLEVEL%
popd
exit /b %TEST_EXIT_CODE%

15
external/corert/buildscripts/build-tests.sh vendored Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
scriptRoot="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ "$BUILDVARS_DONE" != 1 ]; then
. $scriptRoot/buildvars-setup.sh $*
fi
pushd ${__ProjectRoot}/tests
source ${__ProjectRoot}/tests/runtest.sh $__BuildOS $__BuildArch $__BuildType -dotnetclipath $__dotnetclipath
TESTERRORLEVEL=$?
popd
if [ $TESTERRORLEVEL != 0 ]; then
exit $TESTERRORLEVEL
fi

View File

@@ -0,0 +1,173 @@
:: 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
:: 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
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&&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" == "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" == "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)
echo Invalid command line argument: %1
exit /b 1
:ArgsDone
:: Set the remaining variables based upon the determined build configuration
set "__BinDir=%__RootBinDir%\Product\%__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%"
set "__CMakeBinDir=%__CMakeBinDir:\=/%"
:: 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 /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%"
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 "%__ObjDir%" md "%__ObjDir%"
if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%"
if not exist "%__LogsDir%" md "%__LogsDir%"
:CheckPrereqs
:: Check prerequisites
echo Checking pre-requisites...
echo.
:: Validate that PowerShell is accessibile.
for %%X in (powershell.exe) do (set __PSDir=%%~$PATH:X)
if defined __PSDir goto EvaluatePS
echo PowerShell is a prerequisite to build this repository.
echo See: https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md
exit /b 1
:EvaluatePS
:: Eval the output from probe-win1.ps1
for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& ""%__SourceDir%\Native\probe-win.ps1"""') do %%a
set __VSProductVersion=
if /i "%__VSVersion%" == "vs2015" set __VSProductVersion=140
if /i "%__VSVersion%" == "vs2017" set __VSProductVersion=150
:: Check presence of VS
if defined VS%__VSProductVersion%COMNTOOLS goto CheckVSExistence
echo Visual Studio 2015 (Community is free) 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 2015 (Community is free) 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 Explicitly set Platform causes conflicts in managed project files. Clear it to allow building from VS x64 Native Tools Command Prompt
set Platform=
:: Set the environment for the native build
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 BUILDVARS_DONE=1
exit /b 0
:Usage
echo.
echo Build the CoreRT repo.
echo.
echo Usage:
echo %__ThisScriptShort% [option1] [option2] ...
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 type: one of Debug, Checked, Release ^(default: Debug^).
echo Visual Studio version: ^(default: VS2015, VS2017 also supported^).
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

View File

@@ -0,0 +1,267 @@
#!/usr/bin/env bash
usage()
{
echo "Usage: $0 [managed] [native] [BuildArch] [BuildType] [clean] [cross] [verbose] [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"
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 "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."
exit 1
}
setup_dirs()
{
echo Setting up directories for build
mkdir -p "$__ProductBinDir"
mkdir -p "$__IntermediatesDir"
}
# Performs "clean build" type actions (deleting and remaking directories)
clean()
{
echo "Cleaning previous output for the selected configuration"
rm -rf "$__ProductBinDir"
rm -rf "$__IntermediatesDir"
}
# Check the system to ensure the right pre-reqs are in place
check_native_prereqs()
{
echo "Checking pre-requisites..."
# Check presence of CMake on the path
hash cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script"; exit 1; }
# 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; }
}
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
fi
echo "ubuntu.14.04"
return 0
fi
# Cannot determine Linux distribution, assuming Ubuntu 14.04.
echo "ubuntu.14.04"
return 0
}
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
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
# 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
# Set the various build properties here so that CMake and MSBuild can pick them up
export __UnprocessedBuildArgs=
export __CleanBuild=0
export __VerboseBuild=0
export __ClangMajorVersion=3
export __ClangMinorVersion=9
export __CrossBuild=0
while [ "$1" != "" ]; do
lowerI="$(echo $1 | awk '{print tolower($0)}')"
case $lowerI in
-h|--help)
usage
exit 1
;;
managed)
export __buildmanaged=true
;;
native)
export __buildnative=true
;;
x86)
export __BuildArch=x86
;;
x64)
export __BuildArch=x64
;;
arm)
export __BuildArch=arm
;;
arm64)
export __BuildArch=arm64
;;
debug)
export __BuildType=Debug
;;
release)
export __BuildType=Release
;;
clean)
export __CleanBuild=1
;;
verbose)
export __VerboseBuild=1
;;
clang3.6)
export __ClangMajorVersion=3
export __ClangMinorVersion=6
;;
clang3.7)
export __ClangMajorVersion=3
export __ClangMinorVersion=7
;;
clang3.8)
export __ClangMajorVersion=3
export __ClangMinorVersion=8
;;
clang3.9)
export __ClangMajorVersion=3
export __ClangMinorVersion=9
;;
cross)
export __CrossBuild=1
;;
-dotnetclipath)
shift
export __dotnetclipath=$1
;;
-officialbuildid)
shift
export __ExtraMsBuildArgs="$__ExtraMsBuildArgs /p:OfficialBuildId=$1"
;;
*)
export __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1"
esac
shift
done
# If neither managed nor native are passed as arguments, default to building both
if [ "$__buildmanaged" = false -a "$__buildnative" = false ]; then
export __buildmanaged=true
export __buildnative=true
fi
# Set the remaining variables based upon the determined build configuration
export __IntermediatesDir="$__rootbinpath/obj/Native/$__BuildOS.$__BuildArch.$__BuildType"
export __ProductBinDir="$__rootbinpath/Product/$__BuildOS.$__BuildArch.$__BuildType"
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.
if [ -z "$HOME" ]; then
if [ ! -d "$__ProjectRoot/temp_home" ]; then
mkdir "$__ProjectRoot/temp_home"
fi
export HOME=$__ProjectRoot/temp_home
echo "HOME not defined; setting it to $HOME"
fi
# Configure environment if we are doing a clean build.
if [ $__CleanBuild == 1 ]; then
clean
fi
# Configure environment if we are doing a cross compile.
if [ $__CrossBuild == 1 ]; then
export CROSSCOMPILE=1
if ! [[ -n "$ROOTFS_DIR" ]]; then
export ROOTFS_DIR="$__ProjectRoot/cross/rootfs/$__BuildArch"
fi
fi
setup_dirs
export BUILDERRORLEVEL=0
export BUILDVARS_DONE=1

View File

@@ -0,0 +1,9 @@
@if not defined _echo @echo off
setlocal EnableDelayedExpansion
echo Stop VBCSCompiler.exe execution.
for /f "tokens=2 delims=," %%F in ('tasklist /nh /fi "imagename eq VBCSCompiler.exe" /fo csv') do taskkill /f /PID %%~F
echo Cleaning entire working directory ...
call git clean -xdf
exit /b !ERRORLEVEL!

5
external/corert/buildscripts/clean.sh vendored Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
echo "Removing all untracked files in the working tree"
git clean -xdf $__working_tree_root
exit $?

View File

@@ -0,0 +1,40 @@
@echo off
REM don't pass args to buildvars-setup, just get defaults
call %~dp0buildvars-setup.cmd
set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% (set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe")
REM hopefully it's on the path
if not exist %_msbuildexe% set _msbuildexe=msbuild
set AzureAccount=
set AzureToken=
set Container=
:Arg_Loop
if "%1" == "" goto ArgsDone
if /i "%1" == "-AzureAccount" (set AzureAccount=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "-AzureToken" (set AzureToken=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "-Container" (set Container=%2&shift&shift&goto Arg_Loop)
echo Invalid command line argument: %1
exit /b 1
:ArgsDone
set AzureToken=%AzureToken:"=%
if "%AzureAccount%" == "" (
echo Azure account not specified.
exit /b 1
)
if "%AzureToken%" == "" (
echo Azure token not specified.
exit /b 1
)
if "%Container%" == "" (
echo Azure container not specified.
exit /b 1
)
%_msbuildexe% %__ProjectDir%\buildscripts\publish.proj /p:CloudDropAccountName=%AzureAccount% /p:CloudDropAccessToken=%AzureToken% /p:ContainerName=%Container% /flp:v=diag;LogFile=publish-packages.log

View File

@@ -0,0 +1,33 @@
#!/usr/bin/env bash
export AzureAccount=
export AzureToken=
export Container=
while [ "$1" != "" ]; do
lowerI="$(echo $1 | awk '{print tolower($0)}')"
case $lowerI in
-azureaccount)
shift
export AzureAccount=$1
;;
-azuretoken)
shift
export AzureToken=$1
;;
-container)
shift
export Container=$1
;;
*)
echo Bad argument $1
exit 1
esac
shift
done
# don't pass args to buildvars-setup, just get defaults
scriptRoot="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
. $scriptRoot/buildvars-setup.sh
$__ProjectRoot/Tools/msbuild.sh $scriptRoot/publish.proj /p:CloudDropAccountName=$AzureAccount /p:CloudDropAccessToken=$AzureToken /p:ContainerName=$Container "/flp:v=diag;LogFile=publish-packages.log"

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" 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" />
<PropertyGroup>
<PublishPattern Condition="'$(PublishPattern)' == ''">$(PackageOutputRoot)**\*.nupkg</PublishPattern>
</PropertyGroup>
<Target Name="CreateContainerName"
DependsOnTargets="CreateVersionFileDuringBuild"
Condition="'$(ContainerName)' == ''">
<PropertyGroup>
<ContainerName>corert-$(PreReleaseLabel)-$(BuildNumberMajor)-$(BuildNumberMinor)</ContainerName>
</PropertyGroup>
</Target>
<Target Name="Build" DependsOnTargets="CreateContainerName;UploadToAzure" />
</Project>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ContainerNamePrefix Condition="'$(ContainerNamePrefix)' == ''">corert-$(PreReleaseLabel)</ContainerNamePrefix>
<ContainerName Condition="'$(ContainerNamePrefix)' != '' and '$(BuildNumberMajor)' != '' and '$(BuildNumberMinor)' != ''">$(ContainerNamePrefix)-$(BuildNumberMajor)-$(BuildNumberMinor)</ContainerName>
<DownloadDirectory>$(PackagesDir)AzureTransfer</DownloadDirectory>
</PropertyGroup>
<Import Project="$(ToolsDir)SyncCloudContent.targets" />
<Target Name="ValidateRequiredProperties">
<Error Condition="'$(CloudDropAccountName)' == ''" Text="Missing property CloudDropAccountName." />
<Error Condition="'$(CloudDropAccessToken)' == ''" Text="Missing property CloudDropAccessToken." />
</Target>
<Target Name="Build" DependsOnTargets="ValidateRequiredProperties;DownloadBlobsFromAzureTargets" />
</Project>

View File

@@ -0,0 +1,26 @@
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
# This script updates the dotnet/versions repository based on a set of packages. It directly
# commits the changes using GitHub APIs.
param(
[Parameter(Mandatory=$true)][string]$gitHubUser,
[Parameter(Mandatory=$true)][string]$gitHubEmail,
[Parameter(Mandatory=$true)][string]$gitHubAuthToken,
[Parameter(Mandatory=$true)][string]$versionsRepoOwner,
[Parameter(Mandatory=$true)][string]$versionsRepo,
[Parameter(Mandatory=$true)][string]$versionsRepoPath,
# A pattern matching all packages in the set that the versions repository should be set to.
[Parameter(Mandatory=$true)][string]$nupkgPath)
msbuild /t:UpdatePublishedVersions `
/p:GitHubUser="$gitHubUser" `
/p:GitHubEmail="$gitHubEmail" `
/p:GitHubAuthToken="$gitHubAuthToken" `
/p:VersionsRepoOwner="$versionsRepoOwner" `
/p:VersionsRepo="$versionsRepo" `
/p:VersionsRepoPath="$versionsRepoPath" `
/p:ShippedNuGetPackageGlobPath="$nupkgPath"