diff --git a/UpdateDependencies.ps1 b/UpdateDependencies.ps1 index dda2c03ca6c0..145d1e275171 100644 --- a/UpdateDependencies.ps1 +++ b/UpdateDependencies.ps1 @@ -53,7 +53,7 @@ function UpdateValidDependencyVersionsFile # Updates all the project.json files with out of date version numbers function RunUpdatePackageDependencyVersions { - cmd /c $PSScriptRoot\build.cmd managed /t:UpdateInvalidPackageVersions | Out-Host + cmd /c $PSScriptRoot\build-managed.cmd -UpdateInvalidPackageVersions | Out-Host return $LASTEXITCODE -eq 0 } diff --git a/build-managed.cmd b/build-managed.cmd new file mode 100644 index 000000000000..cdc4b1847c2c --- /dev/null +++ b/build-managed.cmd @@ -0,0 +1,2 @@ +@call %~dp0run.cmd build-managed -nodoReuse -binclashWindows %* +@exit /b %ERRORLEVEL% \ No newline at end of file diff --git a/build-managed.sh b/build-managed.sh new file mode 100755 index 000000000000..89ff7b2b433a --- /dev/null +++ b/build-managed.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +usage() +{ + echo "Usage: $0 [platform] [useservergc]" + echo + echo "platform can be: FreeBSD, Linux, NetBSD, OSX, Windows." + echo "useservergc - Switch used by configure the hosted coreclr instance when executing tests." + echo +} + + +__scriptpath=$(cd "$(dirname "$0")"; pwd -P) + +__UnprocessedBuildArgs= +__TestNugetRuntimeId=-distroRid +__BuildOS=-os +__TargetOS=-target-os +__ServerGC=0 + +while :; do + if [ $# -le 0 ]; then + break + fi + + lowerI="$(echo $1 | awk '{print tolower($0)}')" + case $lowerI in + freebsd) + __TestNugetRuntimeId="$__TestNugetRuntimeId=osx.10.10-x64" + __BuildOS="$__BuildOS=freebsd" + __TargetOS="$__TargetOS=freebsd" + ;; + netbsd) + __TestNugetRuntimeId="$__TestNugetRuntimeId=osx.10.10-x64" + __BuildOS="$__BuildOS=netbsd" + __TargetOS="$__TargetOS=netbsd" + ;; + osx) + __TestNugetRuntimeId="$__TestNugetRuntimeId=osx.10.10-x64" + __BuildOS="$__BuildOS=osx" + __TargetOS="$__TargetOS=osx" + ;; + windows) + __TestNugetRuntimeId="$__TestNugetRuntimeId=win7-x64" + __BuildOS="$__BuildOS=windows_nt" + __TargetOS="$__TargetOS=Windows_NT" + ;; + useservergc) + __ServerGC=1 + ;; + *) + __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1" + esac + + shift +done + +export CORECLR_SERVER_GC="$__ServerGC" + +$__scriptpath/run.sh build-managed -binclashUnix $__BuildOS $__TargetOS $__TestNugetRuntimeId $__UnprocessedBuildArgs +exit $? diff --git a/build-native.cmd b/build-native.cmd new file mode 100644 index 000000000000..6e0ab4a6fb38 --- /dev/null +++ b/build-native.cmd @@ -0,0 +1,2 @@ +@call %~dp0run.cmd build-native %* +@exit /b %ERRORLEVEL% \ No newline at end of file diff --git a/build-native.sh b/build-native.sh new file mode 100755 index 000000000000..a9bfabf0e0d9 --- /dev/null +++ b/build-native.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +#The Run Command Tool is calling src/Native/build-native.sh +$working_tree_root/run.sh build-native $* +exit $? diff --git a/build-packages.cmd b/build-packages.cmd index 8e899a7d0147..d685d86c534b 100644 --- a/build-packages.cmd +++ b/build-packages.cmd @@ -1,33 +1,2 @@ -@if "%_echo%" neq "on" echo off -setlocal EnableDelayedExpansion - -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 - -echo msbuild.exe %~dp0src\packages.builds !options! !allargs! >> %packagesLog% -call msbuild.exe %~dp0src\packages.builds !options! !allargs! -if NOT [%ERRORLEVEL%]==[0] ( - echo ERROR: An error occurred while building packages, see %packagesLog% for more details. - exit /b 1 -) - -echo Done Building Packages. -exit /b - -:Usage -echo. -echo Builds the NuGet packages from the binaries that were built in the Build product binaries step. -echo No option parameters. -exit /b \ No newline at end of file +@call %~dp0run.cmd build-managed -packages -nodoReuse -binclashWindows %* +@exit /b %ERRORLEVEL% \ No newline at end of file diff --git a/build-packages.sh b/build-packages.sh index 827c48a2e566..32832de8c098 100755 --- a/build-packages.sh +++ b/build-packages.sh @@ -1,75 +1,4 @@ #!/usr/bin/env bash - -usage() -{ - echo "Builds the NuGet packages from the binaries that were built in the Build product binaries step." - echo "No option parameters." - exit 1 -} - working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -build_packages_log=$working_tree_root/build-packages.log -binclashlog=$working_tree_root/binclash.log -binclashloggerdll=$working_tree_root/Tools/Microsoft.DotNet.Build.Tasks.dll -RuntimeOS=ubuntu.14.04 - -# Use uname to determine what the OS is. -OSName=$(uname -s) -case $OSName in - Darwin) - # Darwin version can be three sets of digits (e.g. 10.10.3), we want just the first one - DarwinVersion=$(sw_vers -productVersion | awk 'match($0, /[0-9]+/) { print substr($0, RSTART, RLENGTH) }') - RuntimeOS=osx.$DarwinVersion - ;; - - FreeBSD|NetBSD) - # TODO this doesn't seem correct - RuntimeOS=osx.10 - ;; - - Linux) - if [ ! -e /etc/os-release ]; then - echo "Cannot determine Linux distribution, assuming Ubuntu 14.04" - else - source /etc/os-release - # for some distros we only need the version major number - VersionMajor=$(echo $VERSION_ID | awk 'match($0, /[0-9]+/) { print substr($0, RSTART, RLENGTH) }') - if [ "$ID" == "rhel" ]; then - RuntimeOS=$ID.$VersionMajor - else - RuntimeOS=$ID.$VERSION_ID - fi - fi - ;; - - *) - echo "Unsupported OS '$OSName' detected. Configuring as if for Ubuntu." - ;; -esac - -options="/m /nologo /v:minimal /clp:Summary /flp:v=diagnostic;Append;LogFile=$build_packages_log /l:BinClashLogger,$binclashloggerdll;LogFile=$binclashlog /p:FilterToOSGroup=$RuntimeOS" -allargs="$@" - -echo -e "Running build-packages.sh $allargs" > $build_packages_log - -if [ "$allargs" == "-h" ] || [ "$allargs" == "--help" ]; then - usage -fi - -# Ensure that MSBuild is available -echo "Running init-tools.sh" -$working_tree_root/init-tools.sh - -echo -e "\n$working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/packages.builds $options $allargs" >> $build_packages_log -$working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/packages.builds $options $allargs - - -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." - exit 1 -fi - -echo "Done building packages." -echo -e "\nDone building packages." >> $build_packages_log -exit 0 +$working_tree_root/run.sh build-managed -packages -binclashUnix $* +exit $? diff --git a/build-tests.cmd b/build-tests.cmd index 4045e6ef1a44..4377a335a7b6 100644 --- a/build-tests.cmd +++ b/build-tests.cmd @@ -1,33 +1,2 @@ -@if "%_echo%" neq "on" echo off -setlocal EnableDelayedExpansion - -set buildTests=build-tests.log -set binclashLoggerDll=%~dp0Tools\net45\Microsoft.DotNet.Build.Tasks.dll -set binclashlog=%~dp0binclash.log -echo Running build-tests.cmd %* > %buildTests% - -set options=/nologo /maxcpucount /v:minimal /clp:Summary /nodeReuse:false /flp:v=detailed;Append;LogFile=%buildTests% /l:BinClashLogger,%binclashLoggerDll%;LogFile=%binclashlog% -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\tests.builds !options! !allargs! >> %buildTests% -call msbuild.exe %~dp0src\tests.builds !options! !allargs! -if NOT [%ERRORLEVEL%]==[0] ( - echo ERROR: An error occurred while building the tests, see %buildTests% for more details. - exit /b 1 -) - -echo Done Building tests. -exit /b - -:Usage -echo. -echo Builds the tests that are in the repository. -echo No option parameters. -exit /b \ No newline at end of file +@call %~dp0run.cmd build-managed -tests -nodoReuse -binclashWindows %* +@exit /b %ERRORLEVEL% \ No newline at end of file diff --git a/build-tests.sh b/build-tests.sh index cc4796f7cb28..a9126444140a 100755 --- a/build-tests.sh +++ b/build-tests.sh @@ -1,40 +1,4 @@ #!/usr/bin/env bash - -usage() -{ - echo "Builds the tests that are in the repository." - echo "No option parameters." - exit 1 -} - working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -build_tests_log=$working_tree_root/build-tests.log -binclashlog=$working_tree_root/binclash.log -binclashloggerdll=$working_tree_root/Tools/Microsoft.DotNet.Build.Tasks.dll - -options="/m /nologo /v:minimal /clp:Summary /flp:v=detailed;Append;LogFile=$build_tests_log /l:BinClashLogger,$binclashloggerdll;LogFile=$binclashlog" -allargs="$@" - -echo -e "Running build-tests.sh $allargs" > $build_tests_log - -if [ "$allargs" == "-h" ] || [ "$allargs" == "--help" ]; then - usage -fi - -# Ensure that MSBuild is available -echo "Running init-tools.sh" -$working_tree_root/init-tools.sh - -echo -e "\n$working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/tests.builds $options $allargs" >> $build_tests_log -$working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/tests.builds $options $allargs - - -if [ $? -ne 0 ]; then - echo -e "\nAn error occurred. Aborting build-tests.sh ." >> $build_tests_log - echo "ERROR: An error occurred while building tests, see $build_tests_log for more details." - exit 1 -fi - -echo "Done building tests." -echo -e "\nDone building tests." >> $build_tests_log -exit 0 +$working_tree_root/run.sh build-managed -tests -binclashUnix $* +exit $? diff --git a/build.cmd b/build.cmd index 1cdf368dad3e..56a83b291896 100644 --- a/build.cmd +++ b/build.cmd @@ -1,111 +1,26 @@ @if "%_echo%" neq "on" echo off -setlocal EnableDelayedExpansion +setlocal -:: 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. - -:ReadArguments -:: Read in the args to determine whether to run the native build, managed build, or both (default) -set "__args= %*" -set processedArgs= -set unprocessedBuildArgs= - -:Loop -if [%1]==[] goto Tools - -if /I [%1]==[native] ( - set __buildSpec=native - set processedArgs=!processedArgs! %1 - goto Next -) - -if /I [%1] == [managed] ( - set __buildSpec=managed - set processedArgs=!processedArgs! %1 - goto Next -) - -if [!processedArgs!]==[] ( - call set unprocessedBuildArgs=!__args! -) else ( - call set unprocessedBuildArgs=%%__args:*!processedArgs!=%% -) - -:Next -shift /1 -goto Loop - -:Tools -:: Setup VS -if not defined VisualStudioVersion ( - if defined VS140COMNTOOLS ( - call "%VS140COMNTOOLS%\VsDevCmd.bat" - goto :Build - ) - - echo Error: build.cmd requires Visual Studio 2015. - echo Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md for build instructions. - exit /b 1 -) +if /I [%1] == [-?] goto Usage :Build -:: Restore the Tools directory -call %~dp0init-tools.cmd - -:: Call the builds -if "%__buildSpec%"=="managed" goto :BuildManaged - -:BuildNative -:: Run the Native Windows build -echo [%time%] Building Native Libraries... -IF EXIST "%~dp0src\native\Windows\build-native.cmd" ( - call %~dp0src\native\Windows\build-native.cmd %__args% >nativebuild.log - IF ERRORLEVEL 1 ( - echo Native component build failed see nativebuild.log for more details. - ) else ( - echo [%time%] Successfully built Native Libraries. - ) -) - -:: If we only wanted to build the native components, exit -if "%__buildSpec%"=="native" goto :eof - -:BuildManaged -:: 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= - -:: Log build command line -set _buildproj=%~dp0build.proj -set _buildlog=%~dp0msbuild.log -set _binclashLoggerDll=%~dp0Tools\net45\Microsoft.DotNet.Build.Tasks.dll -set _binclashlog=%~dp0binclash.log -set _buildprefix=echo -set _buildpostfix=^> "%_buildlog%" -call :build %__args% - -:: Build -set _buildprefix= -set _buildpostfix= -echo [%time%] Building Managed Libraries... -call :build %__args% - -goto :AfterBuild - -:build -%_buildprefix% msbuild "%_buildproj%" /nologo /maxcpucount /v:minimal /clp:Summary /nodeReuse:false /flp:v=normal;LogFile="%_buildlog%";Append /flp2:warningsonly;logfile=%~dp0msbuild.wrn /flp3:errorsonly;logfile=%~dp0msbuild.err "/l:BinClashLogger,%_binclashLoggerDll%;LogFile=%_binclashlog%" !unprocessedBuildArgs! %_buildpostfix% -set BUILDERRORLEVEL=%ERRORLEVEL% -goto :eof - -:AfterBuild +call %~dp0build-native.cmd %* +if NOT [%ERRORLEVEL%]==[0] exit /b 1 +call %~dp0build-managed.cmd %* +exit /b %ERRORLEVEL% +:Usage echo. -:: Pull the build summary from the log file -findstr /ir /c:".*Warning(s)" /c:".*Error(s)" /c:"Time Elapsed.*" "%_buildlog%" -echo [%time%] Build Exit Code = %BUILDERRORLEVEL% - -exit /b %BUILDERRORLEVEL% +echo There are new changes on how we build. Use this script only for generic +echo build instructions that apply for both build native and build managed. +echo Otherwise: +echo. +echo Before Now +echo build.cmd native build-native.cmd +echo build.cmd managed build-managed.cmd +echo. +echo For more information: "https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md" +echo ---------------------------------------------------------------------------- +echo. +echo. +goto :Build \ No newline at end of file diff --git a/build.sh b/build.sh index f1546806b137..290588b8cf6f 100755 --- a/build.sh +++ b/build.sh @@ -2,451 +2,32 @@ usage() { - echo "Usage: $0 [managed] [native] [BuildArch] [BuildType] [clean] [verbose] [clangx.y] [platform] [cross] [skiptests] [staticLibLink] [cmakeargs] [makeargs]" - 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, arm-softfp, 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 "platform can be: FreeBSD, Linux, NetBSD, OSX, Windows" - echo "cross - optional argument to signify cross compilation," - echo " - will use ROOTFS_DIR environment variable if set." - echo "skiptests - skip the tests in the './bin/*/*Tests/' subdirectory." - echo "staticLibLink - Optional argument to statically link any native library." - echo "generateversion - if building native only, pass this in to get a version on the build output." - echo "cmakeargs - user-settable additional arguments passed to CMake." - exit 1 -} - -setup_dirs() -{ - echo Setting up directories for build - - mkdir -p "$__BinDir" - 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" - setup_dirs -} - -# 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 the system for building - -prepare_managed_build() -{ - # Run Init-Tools to restore BuildTools and ToolRuntime - $__scriptpath/init-tools.sh -} - -prepare_native_build() -{ - # Specify path to be set for CMAKE_INSTALL_PREFIX. - # 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 - - # If managed build is supported, then generate version - if [ $__buildmanaged == true ]; then - __generateversionsource=true - fi - - # Ensure tools are present if we will generate version.c - if [ $__generateversionsource == true ]; then - $__scriptpath/init-tools.sh - fi - - # Generate version.c if specified, else have an empty one. - __versionSourceFile=$__scriptpath/bin/obj/version.c - if [ ! -e "${__versionSourceFile}" ]; then - if [ $__generateversionsource == true ]; then - $__scriptpath/Tools/dotnetcli/dotnet $__scriptpath/Tools/MSBuild.exe "$__scriptpath/build.proj" /t:GenerateVersionSourceFile /p:GenerateVersionSourceFile=true /v:minimal - else - __versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";" - echo $__versionSourceLine > $__versionSourceFile - fi - fi -} - -build_managed() -{ - __buildproj=$__scriptpath/build.proj - __buildlog=$__scriptpath/msbuild.log - __binclashlog=$__scriptpath/binclash.log - __binclashloggerdll=$__scriptpath/Tools/Microsoft.DotNet.Build.Tasks.dll - - $__scriptpath/Tools/dotnetcli/dotnet $__scriptpath/Tools/MSBuild.exe "$__buildproj" /m /nologo /verbosity:minimal "/flp:Verbosity=normal;LogFile=$__buildlog" "/flp2:warningsonly;logfile=$__scriptpath/msbuild.wrn" "/flp3:errorsonly;logfile=$__scriptpath/msbuild.err" "/l:BinClashLogger,$__binclashloggerdll;LogFile=$__binclashlog" /p:ConfigurationGroup=$__BuildType /p:TargetOS=$__BuildOS /p:OSGroup=$__BuildOS /p:SkipTests=$__SkipTests /p:COMPUTERNAME=$(hostname) /p:USERNAME=$(id -un) /p:TestNugetRuntimeId=$__TestNugetRuntimeId $__UnprocessedBuildArgs - BUILDERRORLEVEL=$? - echo - - # Pull the build summary from the log file - tail -n 4 "$__buildlog" - echo Build Exit Code = $BUILDERRORLEVEL -} - -build_native() -{ - # All set to commence the build - - echo "Commencing build of corefx native components for $__BuildOS.$__BuildArch.$__BuildType" - cd "$__IntermediatesDir" - - # Regenerate the CMake solution - echo "Invoking cmake with arguments: \"$__nativeroot\" $__CMakeArgs $__CMakeExtraArgs" - "$__nativeroot/gen-buildsys-clang.sh" "$__nativeroot" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__CMakeArgs "$__CMakeExtraArgs" - - # Check that the makefiles were created. - - if [ ! -f "$__IntermediatesDir/Makefile" ]; then - echo "Failed to generate native component build project!" - 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 $__MakeExtraArgs" - - make install -j $NumProc $__MakeExtraArgs - if [ $? != 0 ]; then - echo "Failed to build corefx native components." - exit 1 - fi - - echo "CoreFX native components successfully built." - echo "Product binaries are available at $__BinDir" + echo "There are new changes on how we build. Use this script only for generic" + echo "build instructions that apply for both build native and build managed." + echo "Otherwise:" + echo + echo "Before Now" + echo "build.sh native build-native.sh" + echo "build.sh managed build-managed.sh" + echo + echo "For more information: https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md" + echo "----------------------------------------------------------------------------" + echo + echo } -__scriptpath=$(cd "$(dirname "$0")"; pwd -P) -__nativeroot=$__scriptpath/src/Native -__packageroot=$__scriptpath/packages -__sourceroot=$__scriptpath/src -__rootbinpath="$__scriptpath/bin" -__generateversionsource=false -__buildmanaged=false -__buildnative=false -__TestNugetRuntimeId=win7-x64 - -# Use uname to determine what the CPU is. -CPUName=$(uname -p) -# Some Linux platforms report unknown for platform, but the arch for machine. -if [ $CPUName == "unknown" ]; then - CPUName=$(uname -m) -fi - -case $CPUName in - i686) - __BuildArch=x86 - ;; - - x86_64) - __BuildArch=x64 - ;; - - armv7l) - __BuildArch=arm - ;; - - aarch64) - __BuildArch=arm64 - ;; - - *) - echo "Unknown CPU $CPUName detected, configuring as if for x64" - __BuildArch=x64 - ;; -esac - -# Use uname to determine what the OS is. -OSName=$(uname -s) -case $OSName in - Darwin) - __HostOS=OSX - __TestNugetRuntimeId=osx.10.10-x64 - ;; - - FreeBSD) - __HostOS=FreeBSD - # TODO: Add native version - __TestNugetRuntimeId=osx.10.10-x64 - ;; - - Linux) - __HostOS=Linux - if [ ! -e /etc/os-release ]; then - echo "Cannot determine Linux distribution, assuming Ubuntu 14.04" - __TestNugetRuntimeId=ubuntu.14.04-x64 - else - source /etc/os-release - __TestNugetRuntimeId=$ID.$VERSION_ID-$__BuildArch - fi - ;; - - NetBSD) - __HostOS=NetBSD - # TODO: Add native version - __TestNugetRuntimeId=osx.10.10-x64 - ;; - - *) - echo "Unsupported OS '$OSName' detected. Configuring as if for Ubuntu." - __HostOS=Linux - __TestNugetRuntimeId=ubuntu.14.04-x64 - ;; -esac -__BuildOS=$__HostOS -__BuildType=Debug -__CMakeArgs=DEBUG -__CMakeExtraArgs="" -__MakeExtraArgs="" - -BUILDERRORLEVEL=0 - -# Set the various build properties here so that CMake and MSBuild can pick them up -__UnprocessedBuildArgs= -__CleanBuild=false -__CrossBuild=0 -__SkipTests=false -__ServerGC=0 -__VerboseBuild=false -__ClangMajorVersion=3 -__ClangMinorVersion=5 - -while :; do - if [ $# -le 0 ]; then - break - fi - - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - -\?|-h|--help) - usage - exit 1 - ;; - managed) - __buildmanaged=true - ;; - native) - __buildnative=true - ;; - x86) - __BuildArch=x86 - ;; - x64) - __BuildArch=x64 - ;; - arm) - __BuildArch=arm - ;; - arm-softfp) - __BuildArch=arm-softfp - ;; - arm64) - __BuildArch=arm64 - ;; - debug) - __BuildType=Debug - ;; - release) - __BuildType=Release - __CMakeArgs=RELEASE - ;; - clean) - __CleanBuild=1 - ;; - verbose) - __VerboseBuild=1 - ;; - staticliblink) - __CMakeExtraArgs="$__CMakeExtraArgs -DCMAKE_STATIC_LIB_LINK=1" - ;; - generateversion) - __generateversionsource=true - ;; - clang3.5) - __ClangMajorVersion=3 - __ClangMinorVersion=5 - ;; - clang3.6) - __ClangMajorVersion=3 - __ClangMinorVersion=6 - ;; - clang3.7) - __ClangMajorVersion=3 - __ClangMinorVersion=7 - ;; - clang3.8) - __ClangMajorVersion=3 - __ClangMinorVersion=8 - ;; - freebsd) - __BuildOS=FreeBSD - __TestNugetRuntimeId=osx.10.10-x64 - ;; - linux) - __BuildOS=Linux - # If the Host OS is also Linux, then use the RID of the host. - # Otherwise, override it to Ubuntu by default. - if [ "$__HostOS" != "Linux" ]; then - __TestNugetRuntimeId=ubuntu.14.04-x64 - fi - ;; - netbsd) - __BuildOS=NetBSD - __TestNugetRuntimeId=osx.10.10-x64 - ;; - osx) - __BuildOS=OSX - __TestNugetRuntimeId=osx.10.10-x64 - ;; - windows) - __BuildOS=Windows_NT - __TestNugetRuntimeId=win7-x64 - ;; - cross) - __CrossBuild=1 - ;; - skiptests) - __SkipTests=true - ;; - cmakeargs) - if [ -n "$2" ]; then - __CMakeExtraArgs="$__CMakeExtraArgs $2" - shift - else - echo "ERROR: 'cmakeargs' requires a non-empty option argument" - exit 1 - fi - ;; - makeargs) - if [ -n "$2" ]; then - __MakeExtraArgs="$__MakeExtraArgs $2" - shift - else - echo "ERROR: 'makeargs' requires a non-empty option argument" - exit 1 - fi - ;; - useservergc) - __ServerGC=1 - ;; - *) - __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 - __buildmanaged=true - __buildnative=true -fi - -# Disable the native build when targeting Windows. - -if [ "$__BuildOS" != "$__HostOS" ]; then - echo "Warning: cross compiling native components is not yet supported" - __buildnative=false +if [ $1 == "-?" ]; then + usage fi -if [ ! -e "$__nativeroot" ]; then - __buildnative=false -fi - -# Set the remaining variables based upon the determined build configuration -__IntermediatesDir="$__rootbinpath/obj/$__BuildOS.$__BuildArch.$__BuildType/Native" -__BinDir="$__rootbinpath/$__BuildOS.$__BuildArch.$__BuildType/Native" - -# Make the directories necessary for build if they don't exist - -setup_dirs - -# Configure environment if we are doing a cross compile. -if [ "$__CrossBuild" == 1 ]; then - export CROSSCOMPILE=1 - if ! [[ -n "$ROOTFS_DIR" ]]; then - export ROOTFS_DIR="$__scriptpath/cross/rootfs/$__BuildArch" - fi -fi - -export CORECLR_SERVER_GC="$__ServerGC" - -if $__buildnative; then - - # Check prereqs. - - check_native_prereqs - - # Prepare the system - - prepare_native_build - - # Build the corefx native components. - - build_native - - # Build complete -fi - -if $__buildmanaged; then - - # Prepare the system - - prepare_managed_build - - # Build the corefx native components. - - build_managed +__scriptpath=$(cd "$(dirname "$0")"; pwd -P) - # Build complete +"$__scriptpath/build-native.sh" $* +if [ $? -ne 0 ];then + exit 1 fi -# If managed build failed, exit with the status code of the managed build -if [ $BUILDERRORLEVEL != 0 ]; then - exit $BUILDERRORLEVEL -fi +"$__scriptpath/build-managed.sh" $* +exit $? -exit $BUILDERRORLEVEL diff --git a/clean.cmd b/clean.cmd index 3e274a970143..78ef70e97c92 100644 --- a/clean.cmd +++ b/clean.cmd @@ -1,163 +1,29 @@ @if "%_echo%" neq "on" echo off setlocal EnableDelayedExpansion -set cleanlog=%~dp0clean.log -echo Running Clean.cmd %* > %cleanlog% - -set options=/nologo /v:minimal /clp:Summary /flp:v=detailed;Append;LogFile=%cleanlog% -set unprocessedBuildArgs= -set allargs=%* -set thisArgs= -set clean_successful=true - -if [%1] == [] ( - set clean_targets=Clean; - goto Begin -) - -set clean_targets= -set clean_src= -set clean_tools= -set clean_environment= -set clean_all= - -:Loop -if [%1] == [] goto Begin - -if /I [%1] == [/?] goto Usage - -if /I [%1] == [/b] ( - set clean_targets=Clean;%clean_targets% - set thisArgs=!thisArgs!%1 - goto Next -) - -if /I [%1] == [/p] ( - set clean_targets=CleanPackages;%clean_targets% - set thisArgs=!thisArgs!%1 - goto Next -) - -if /I [%1] == [/c] ( - set clean_targets=CleanPackagesCache;%clean_targets% - set thisArgs=!thisArgs!%1 - goto Next -) - -if /I [%1] == [/s] ( - set clean_src=true - set thisArgs=!thisArgs!%1 - goto Next -) - -if /I [%1] == [/t] ( - set clean_tools=true - set thisArgs=!thisArgs!%1 - goto Next -) - -if /I [%1] == [/e] ( - set clean_environment=true - set thisArgs=!thisArgs!%1 - goto Next -) - -if /I [%1] == [/all] ( - set clean_src= - set clean_tools= - set clean_environment= - set clean_targets=Clean;CleanPackages;CleanPackagesCache; - set clean_all=true - set thisArgs=!thisArgs!%1 - goto Next -) - -if [!thisArgs!]==[] ( - set unprocessedBuildArgs=!allargs! -) else ( - call set unprocessedBuildArgs=%%allargs:*!thisArgs!=%% -) - -:Next -shift /1 -goto Loop - -:Begin -if /I [%clean_environment%] == [true] ( - call :CleanEnvironment -) - -if /I [%clean_src%] == [true] ( - echo Cleaning src directory ... - echo. >> %cleanlog% && echo git clean -xdf %~dp0src >> %cleanlog% - call git clean -xdf %~dp0src >> %cleanlog% - call :CheckErrorLevel -) - -if NOT "%clean_targets%" == "" ( - echo Running init-tools.cmd - call %~dp0init-tools.cmd - - echo Running msbuild clean targets "%clean_targets:~0,-1%" ... - echo. >> %cleanlog% && echo msbuild.exe %~dp0build.proj /t:%clean_targets:~0,-1% !options! !unprocessedBuildArgs! >> %cleanlog% - call msbuild.exe %~dp0build.proj /t:%clean_targets:~0,-1% !options! !unprocessedBuildArgs! - call :CheckErrorLevel -) - -if /I [%clean_tools%] == [true] ( - call :CleanEnvironment - echo Cleaning tools directory ... - echo. >> %cleanlog% && echo rmdir /s /q %~dp0tools >> %cleanlog% - rmdir /s /q %~dp0tools >> %cleanlog% - REM Don't call CheckErrorLevel because if the Tools directory didn't exist when this script was - REM invoked, then it sometimes exits with error level 3 despite successfully deleting the directory. -) +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 -if /I [%clean_all%] == [true] ( - call :CleanEnvironment +if [%1] == [-all] ( echo Cleaning entire working directory ... - echo. >> %cleanlog% && echo git clean -xdf -e clean.log %~dp0 >> %cleanlog% - call git clean -xdf -e clean.log %~dp0 >> %cleanlog% - call :CheckErrorLevel + call git clean -xdf + exit /b !ERRORLEVEL! ) -if /I [%clean_successful%] == [true] ( - echo Clean completed successfully. - echo. >> %cleanlog% && echo Clean completed successfully. >> %cleanlog% - exit /b 0 -) else ( - echo An error occured while cleaning; see %cleanlog% for more details. - echo. >> %cleanlog% && echo Clean completed with errors. >> %cleanlog% - exit /b 1 -) +if [%1]==[] set __args=-b +call %~dp0run.cmd clean %__args% %* +exit /b %ERRORLEVEL% :Usage echo. echo Repository cleaning script. echo. echo Options: -echo /b - Deletes the binary output directory. -echo /p - Deletes the repo-local nuget package directory. -echo /c - Deletes the user-local nuget package cache. -echo /t - Deletes the tools directory. -echo /s - Deletes the untracked files under src directory (git clean src -xdf). -echo /e - Kills and/or stops the processes that are still running, for example VBCSCompiler.exe -echo /all - Combines all of the above. +echo -b - Deletes the binary output directory. +echo -p - Deletes the repo-local nuget package directory. +echo -c - Deletes the user-local nuget package cache. +echo -all - Combines all of the above. echo. -echo If no option is specified then clean.cmd /b is implied. +echo If no option is specified then clean.cmd -b is implied. -exit /b 1 - -:CheckErrorLevel -if NOT [%ERRORLEVEL%]==[0] ( - echo Command exited with ERRORLEVEL %ERRORLEVEL% >> %cleanlog% - set clean_successful=false -) -exit /b - -:CleanEnvironment -REM If VBCSCompiler.exe is running we need to kill it -echo Stop VBCSCompiler.exe execution. -echo. >> %cleanlog% && echo Stop VBCSCompiler.exe execution. >> %cleanlog% -for /f "tokens=2 delims=," %%F in ('tasklist /nh /fi "imagename eq VBCSCompiler.exe" /fo csv') do taskkill /f /PID %%~F >> %cleanlog% -exit /b \ No newline at end of file +exit /b 1 \ No newline at end of file diff --git a/clean.sh b/clean.sh index 2d4fd17cc400..24a59a505962 100755 --- a/clean.sh +++ b/clean.sh @@ -5,122 +5,27 @@ usage() echo "Usage: clean [options]" echo "Cleans the local dev environment." echo - echo " -b Delete the binary output directory" - echo " -p Delete the repo-local NuGet package directory" - echo " -c Delete the user-local NuGet package caches" - echo " -t Delete the tools directory" - echo " -s Remove all untracked files under the src directory" - echo " -a, --all Clean all of the above" + echo " -b Delete the binary output directory." + echo " -p Delete the repo-local NuGet package directory." + echo " -c Delete the user-local NuGet package caches." + echo " --all Cleans the root directory." echo echo "If no option is specified, then \"clean.sh -b\" is implied." exit 1 } -check_exit_status() -{ - ExitStatus=$? - if [ $ExitStatus -ne 0 ] - then - echo "Command exited with exit status $ExitStatus" >> $CleanLog - CleanSuccessful=false - fi -} - -WorkingTreeRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -CleanLog=$WorkingTreeRoot/clean.log +__working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -options="/nologo /v:minimal /clp:Summary /flp:v=detailed;Append;LogFile=$CleanLog" -unprocessedBuildArgs= -CleanSuccessful=true -CleanTargets= - -echo "Running clean.sh $*" > $CleanLog - -# Parse arguments -if [ $# == 0 ] +if [ $* == -all ] then - CleanTargets="Clean;" + echo "Removing all untracked files in the working tree" + git clean -xdf $__working_tree_root + exit $? fi -while [[ $# > 0 ]] -do - opt="$1" - case $opt in - -h|--help) - usage - ;; - -b) - CleanTargets="Clean;$CleanTargets" - ;; - -p) - CleanTargets="CleanPackages;$CleanTargets" - ;; - -c) - CleanTargets="CleanPackagesCache;$CleanTargets" - ;; - -t) - CleanToolsDir=true - ;; - -s) - CleanSrc=true - ;; - -a|--all) - CleanWorkingTree=true - CleanTargets="Clean;CleanPackages;CleanPackagesCache;" - ;; - *) - unprocessedBuildArgs="$unprocessedBuildArgs $1" - esac - shift -done - -if [ -n "$CleanTargets" ] -then - # Ensure that MSBuild is available - echo "Running init-tools.sh" - $WorkingTreeRoot/init-tools.sh - - # Trim the trailing semicolon from the targets string - CleanTargetsTrimmed=${CleanTargets:0:${#CleanTargets}-1} - - echo "Running MSBuild target(s): $CleanTargetsTrimmed" - echo -e "\n$WorkingTreeRoot/Tools/dotnetcli/dotnet $WorkingTreeRoot/Tools/MSBuild.exe $WorkingTreeRoot/build.proj /t:$CleanTargetsTrimmed $options $unprocessedBuildArgs" >> $CleanLog - $WorkingTreeRoot/Tools/dotnetcli/dotnet $WorkingTreeRoot/Tools/MSBuild.exe $WorkingTreeRoot/build.proj /t:$CleanTargetsTrimmed $options $unprocessedBuildArgs - check_exit_status +if [ $# == 0 ]; then + __args=-b fi -if [ "$CleanToolsDir" == true ] && [ "$CleanWorkingTree" != true ] -then - echo "Removing Tools directory" - # This directory cannot be removed in a build target because MSBuild is in the Tools directory - echo -e "\nrm -rf $WorkingTreeRoot/Tools" >> $CleanLog - rm -rf $WorkingTreeRoot/Tools >> $CleanLog - check_exit_status -fi - -if [ "$CleanSrc" == true ] && [ "$CleanWorkingTree" != true ] -then - echo "Removing all untracked files in the src directory" - echo -e "\ngit clean -xdf $WorkingTreeRoot/src" >> $CleanLog - git clean -xdf $WorkingTreeRoot/src >> $CleanLog - check_exit_status -fi - -if [ "$CleanWorkingTree" == true ] -then - echo "Removing all untracked files in the working tree" - echo -e "\ngit clean -xdf -e clean.log $WorkingTreeRoot" >> $CleanLog - git clean -xdf -e clean.log $WorkingTreeRoot >> $CleanLog - check_exit_status -fi - -if [ "$CleanSuccessful" == true ] -then - echo "Clean completed successfully." - echo -e "\nClean completed successfully." >> $CleanLog - exit 0 -else - echo "An error occured while cleaning; see $CleanLog for more details." - echo -e "\nClean completed with errors." >> $CleanLog - exit 1 -fi +$__working_tree_root/run.sh clean $__args $* +exit $? diff --git a/config.json b/config.json new file mode 100644 index 000000000000..6a88b13e5a70 --- /dev/null +++ b/config.json @@ -0,0 +1,586 @@ +{ + "settings": { + "SkipTests":{ + "description": "Enables/Disables running tests.", + "valueType": "property", + "values": ["True", "False"], + "defaultValue": false + }, + "OSGroup": { + "description": "OS Group for result binaries.", + "valueType": "property", + "values": ["AnyOS", "Windows_NT", "Linux", "OSX", "FreeBSD", "NetBSD"], + "defaultValue": "${OSName}" + }, + "TargetOS": { + "description": "Target OS for result binaries.", + "valueType": "property", + "values": ["AnyOS", "Windows_NT", "Linux", "OSX", "FreeBSD", "NetBSD"], + "defaultValue": "${OSName}" + }, + "FilterToOSGroup": { + "description": "FilterToOSGroup for result binaries.", + "valueType": "property", + "values": ["Windows_NT", "Linux", "OSX", "FreeBSD", "NetBSD"], + "defaultValue": "${OSRid}" + }, + "TestNugetRuntimeId": { + "description": "Target OS for result binaries.", + "valueType": "property", + "values": ["win7-x64", "osx.10.10-x64", "ubuntu.14.04-x64", "ubuntu.16.04-x64", "etc-other-rids"], + "defaultValue": "${OSRid}-x64" + }, + "TestWithLocalLibraries": { + "description": "Enables/Disables run test with local libraries.", + "valueType": "property", + "values": ["True", "False"], + "defaultValue": true + }, + "RestoreDuringBuild": { + "description": "Enables/Disables the restoration of packages.", + "valueType": "property", + "values": ["True", "False"], + "defaultValue": true + }, + "Platform": { + "description": "Sets the value of the platform.", + "valueType": "property", + "values": ["AnyCPU", "x86", "arm", "x64", "arm64"], + "defaultValue": "x64" + }, + "ConfigurationGroup": { + "description": "Sets the configuration group as Release or Debug", + "valueType": "property", + "values": ["Release", "Debug"], + "defaultValue": "Debug" + }, + "BuildPackages": { + "description": "Enables/Disables building packages.", + "valueType": "property", + "values": ["True", "False"], + "defaultValue": true + }, + "BuildPackageLibraryReferences": { + "description": "Enables/Disables building libraries referenced by packages.", + "valueType": "property", + "values": ["True", "False"], + "defaultValue": true + }, + "SkipManagedPackageBuild": { + "description": "Enables/Disables building packages for manage builds.", + "valueType": "property", + "values": ["True", "False"], + "defaultValue": false + }, + "BuildTests": { + "description": "Enables/Disables building tests.", + "valueType": "property", + "values": ["True", "False"], + "defaultValue": true + }, + "BuildTestsAgainstPackages": { + "description": "Allows to build tests against product packages.", + "valueType": "property", + "values": ["True", "False"], + "defaultValue": false + }, + "Coverage":{ + "description": "Enables code coverage runs.", + "valueType": "property", + "values": ["True", "False"], + "defaultValue": true + }, + "Outerloop":{ + "description": "Enables outerloops tests scenarios.", + "valueType": "property", + "values": ["True", "False"], + "defaultValue": true + }, + "BuildAllOSGroups":{ + "description": "Enables building the libraries for all OSes.", + "valueType": "property", + "values": ["True", "False"], + "defaultValue": true + }, + "OfficialBuildId":{ + "description": "Specifies the SeedDate and the revision of the build to generate the version of the libraries.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "CloudDropAccountName": { + "description": "Azure account name.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "CloudDropAccessToken": { + "description": "Azure access token", + "valueType": "property", + "values": [], + "defaultValue": "" + }, + "ContainerName": { + "description": "Azure container 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": "" + }, + "GenerateNativeVersionInfo": { + "description": "Allows to generate the native version header.", + "valueType": "property", + "values": ["True", "False"], + "defaultValue": true + }, + "SkipManagedPackageBuild": { + "description": "Allows to skip building packages from managed binaries.", + "valueType": "property", + "values": ["True", "False"], + "defaultValue": false + }, + "BuildPackageLibraryReferences": { + "description": "Allows to build libraries referenced by packages", + "valueType": "property", + "values": ["True", "False"], + "defaultValue": true + }, + "MsBuildNodoReuse": { + "description": "Disables node reuse.", + "valueType": "passThrough", + "values": [], + "defaultValue": "/nodeReuse:false" + }, + "MsBuildLogging": { + "description": "MsBuild logging options.", + "valueType": "passThrough", + "values": [], + "defaultValue": "/flp:v=normal" + }, + "MsBuildWarning": { + "description": "MsBuild warning logging.", + "valueType": "passThrough", + "values": [], + "defaultValue": "/flp2:warningsonly;logfile=msbuild.wrn" + }, + "MsBuildError": { + "description": "MsBuild error logging.", + "valueType": "passThrough", + "values": [], + "defaultValue": "/flp3:errorsonly;logfile=msbuild.err" + }, + "MsBuildParameters": { + "description": "MsBuild building options.", + "valueType": "passThrough", + "values": [], + "defaultValue": "/nologo /maxcpucount /verbosity:minimal /clp:Summary" + }, + "MsBuildBinClashLogger-Windows": { + "description": "MsBuild Bin clash logger options for Windows.", + "valueType": "passThrough", + "values": [], + "defaultValue": "/l:BinClashLogger,Tools\\net45\\Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log" + }, + "MsBuildBinClashLogger-Unix": { + "description": "MsBuild Bin clash logger options for Unix.", + "valueType": "passThrough", + "values": [], + "defaultValue": "/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log" + }, + "BuildArchitecture": { + "description": "Sets the value of the build architecture.", + "valueType": "passThrough", + "values": ["x86", "arm", "arm-softfp", "x64", "arm64"], + "defaultValue": "${CPUArch}" + }, + "CmakeBuildType": { + "description": "Sets the value of the build configuration.", + "valueType": "passThrough", + "values": [], + "defaultValue": "DEBUG" + }, + "HostOs": { + "description": "OS for result binaries.", + "valueType": "passThrough", + "values": ["AnyOS", "Windows_NT", "Linux", "OSX", "FreeBSD", "NetBSD"], + "defaultValue": "${OSName}" + }, + "ProcessorCount": { + "description": "Sets the value of the number of processors available.", + "valueType": "passThrough", + "values": ["NUmeric values"], + "defaultValue": "${ProcessorCount}" + }, + "Project": { + "description": "Project where the commands are going to be applied.", + "valueType": "passThrough", + "values": [], + "defaultValue": "" + }, + "ExtraParameters": { + "description": "Extra parameters will be passed to the selected command.", + "valueType": "passThrough", + "values": [], + "defaultValue": "" + }, + "BatchGenerateTestProjectJsons": { + "description": "MsBuild target that generates the project Jsons files to build tests against packages.", + "valueType": "target", + "values": [], + "defaultValue": "" + }, + "BatchRestorePackages": { + "description": "MsBuild target that restores the packages.", + "valueType": "target", + "values": [], + "defaultValue": "" + }, + "GenerateVersionHeader": { + "description": "MsBuild target that generates the version header.", + "valueType": "target", + "values": [], + "defaultValue": "" + }, + "UpdateInvalidPackageVersions": { + "description": "MsBuild target that looks through all dependencies and using the validation rules, it updates any invalid versions.", + "valueType": "target", + "values": [], + "defaultValue": "" + }, + "CleanAllProjects": { + "description": "MsBuild target that deletes the binary output directory.", + "valueType": "target", + "values": [], + "defaultValue": "" + }, + "CleanPackages": { + "description": "MsBuild target that deletes the repo-local nuget package directory.", + "valueType": "target", + "values": [], + "defaultValue": "" + }, + "CleanPackagesCache": { + "description": "MsBuild target that deletes the user-local nuget package cache.", + "valueType": "target", + "values": [], + "defaultValue": "" + } + }, + "commands": { + "sync":{ + "alias":{ + "p":{ + "description": "Restores all NuGet packages for repository.", + "settings":{ + "RestoreDuringBuild": true, + "BatchRestorePackages": "default" + } + }, + "ab":{ + "description": "Downloads the latests product packages from Azure. The values for '-AzureAccount' and '-AzureToken' are required", + "settings":{ + "Project": "src/syncAzure.proj", + } + }, + "t":{ + "description": "Generates project.jsons for test projects, restores packages, builds product and then builds tests against the generated project.json files.", + "settings":{ + "RestoreDuringBuild": true, + "BuildTestsAgainstPackages": true, + "BatchGenerateTestProjectJsons": "default", + "BatchRestorePackages": "default" + } + }, + "AzureAccount":{ + "description": "Account name to connect to Azure Blob storage. Required for -ab to work.", + "settings":{ + "CloudDropAccountName": "default" + } + }, + "AzureToken":{ + "description": "Account token to connect to Azure Blob storage. Required for -ab to work.", + "settings":{ + "CloudDropAccessToken": "default" + } + }, + "Container":{ + "description": "Container name of the Azure Blob where the packages are going to be stored.", + "settings":{ + "ContainerName": "default" + } + }, + "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" + } + }, + "verbose":{ + "description": "Passes /flp:v=diag to the msbuild command or the value passed by the user.", + "settings":{ + "MsBuildLogging": "/flp:v=diag;LogFile=sync.log" + } + } + }, + "defaultValues":{ + "toolName": "msbuild", + "settings": { + "MsBuildParameters":"default", + "MsBuildLogging":"/flp:v=normal;LogFile=sync.log" + } + } + }, + "build-managed":{ + "alias":{ + "binaries":{ + "description": "Only builds binaries. It doesn't restore packages.", + "settings":{ + "RestoreDuringBuild": false, + "BuildTests": false, + "BuildPackages": false + } + }, + "packages":{ + "description": "Builds the NuGet packages.", + "settings":{ + "Project": "src/packages.builds", + "FilterToOSGroup":"default", + "MsBuildLogging":"/flp:v=normal;LogFile=build-packages.log" + } + }, + "tests":{ + "description": "Builds the tests that are in the repository.", + "settings":{ + "Project": "src/tests.builds", + "MsBuildLogging":"/flp:v=normal;LogFile=build-tests.log" + } + }, + "debug":{ + "description": "Sets ConfigurationGroup=Debug or the value passed by the user.", + "settings":{ + "ConfigurationGroup": "Debug" + } + }, + "release":{ + "description": "Sets ConfigurationGroup=Release or the value passed by the user.", + "settings":{ + "ConfigurationGroup": "Release" + } + }, + "os":{ + "description": "Sets OSGroup to the OS name where the build is going to run or it is set to the value passed by the user.", + "settings":{ + "OSGroup": "default" + } + }, + "target-os":{ + "description": "Sets TargetOS to the OS name where the build is going to run or it is set to the value passed by the user.", + "settings":{ + "TargetOS": "default" + } + }, + "distroRid":{ + "description": "Sets the OS version to the TestNugetRuntimeId property.", + "settings":{ + "TestNugetRuntimeId": "default" + } + }, + "GenerateVersion":{ + "description": "Generates the version header for native binaries.", + "settings":{ + "GenerateNativeVersionInfo": true, + "GenerateVersionHeader": "default" + } + }, + "DisableManagedPackage":{ + "description": "Generates the version header for native binaries.", + "settings":{ + "SkipManagedPackageBuild": true + } + }, + "buildArch":{ + "description": "Passes the value of the build architecture to the respective build-native script.", + "settings":{ + "Platform": "default" + } + }, + "verbose":{ + "description": "Passes /flp:v=diag to the msbuild command or the value passed by the user.", + "settings":{ + "MsBuildLogging": "/flp:v=diag;LogFile=build-managed.log" + } + }, + "nodoReuse":{ + "description": "Disables node reuse because it causes file locking issues. Only available in the Desktop MsBuild.", + "settings":{ + "MsBuildNodoReuse": "default" + } + }, + "binclashWindows":{ + "description": "Bin clash logger for Windows.", + "settings":{ + "MsBuildBinClashLogger-Windows":"default" + } + }, + "binclashUnix":{ + "description": "Bin clash logger for Unix.", + "settings":{ + "MsBuildBinClashLogger-Unix":"default" + } + } + }, + "defaultValues":{ + "toolName": "msbuild", + "settings": { + "OSGroup": "default", + "TargetOS": "default", + "ConfigurationGroup": "default", + "MsBuildParameters":"default", + "MsBuildLogging":"default", + "MsBuildWarning":"default", + "MsBuildError":"default" + } + } + }, + "build-native":{ + "alias":{ + "debug":{ + "description": "Passes DEBUG to respective build-native script.", + "settings":{ + "CmakeBuildType": "DEBUG" + } + }, + "release":{ + "description": "Passes RELEASE to respective build-native script.", + "settings":{ + "CmakeBuildType": "RELEASE" + } + }, + "buildArch":{ + "description": "Passes the value of the build architecture to the respective build-native script.", + "settings":{ + "BuildArchitecture": "default" + } + }, + "os":{ + "description": "Passes the value of the OS to the respective build-native script.", + "settings":{ + "HostOs": "default" + } + } + }, + "defaultValues":{ + "toolName": "terminal", + "Project": "src/Native/build-native", + "settings": { + "BuildArchitecture": "default", + "CmakeBuildType": "default", + "HostOs": "default", + "ProcessorCount": "default" + } + } + }, + "publish-packages":{ + "alias":{ + "AzureAccount":{ + "description": "Account name to connect to Azure Blob storage. Required for the command to work.", + "settings":{ + "CloudDropAccountName": "default" + } + }, + "AzureToken":{ + "description": "Account token to connect to Azure Blob storage. Required for the command to work.", + "settings":{ + "CloudDropAccessToken": "default" + } + }, + "Container":{ + "description": "Container name of the Azure Blob where the packages are going to be stored. Required for the command to work.", + "settings":{ + "ContainerName": "default" + } + }, + "verbose":{ + "description": "Passes /flp:v=diag to the msbuild command or the value passed by the user.", + "settings":{ + "MsBuildLogging": "/flp:v=diag;LogFile=publish-packages.log" + } + } + }, + "defaultValues":{ + "toolName": "msbuild", + "settings": { + "Project": "src/publish.proj", + "MsBuildParameters":"default", + "MsBuildLogging":"/flp:v=normal;LogFile=publish-packages.log" + } + } + }, + "clean":{ + "alias":{ + "b":{ + "description": "Deletes the binary output directory.", + "settings":{ + "CleanAllProjects": "default" + } + }, + "p":{ + "description": "Deletes the repo-local nuget package directory.", + "settings":{ + "CleanPackages": "default" + } + }, + "c":{ + "description": "Deletes the user-local nuget package cache.", + "settings":{ + "CleanPackagesCache": "default" + } + } + }, + "defaultValues":{ + "toolName": "msbuild", + "settings": { + "MsBuildParameters":"default", + "MsBuildLogging":"/flp:v=normal;LogFile=clean.log" + } + } + } + }, + "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": {} + } + } +} diff --git a/netci.groovy b/netci.groovy index f3ac65192f4b..767fdeb3ca64 100644 --- a/netci.groovy +++ b/netci.groovy @@ -12,7 +12,7 @@ def projectFolder = Utilities.getFolderName(project) + '/' + Utilities.getFolder // Globals -// Map of os -> osGroup. +// Map of osName -> osGroup. def osGroupMap = ['Ubuntu14.04':'Linux', 'Ubuntu16.04':'Linux', 'Debian8.4':'Linux', @@ -24,7 +24,7 @@ def osGroupMap = ['Ubuntu14.04':'Linux', 'RHEL7.2': 'Linux', 'LinuxARMEmulator': 'Linux'] -// Map of os -> nuget runtime +// Map of osName -> nuget runtime def targetNugetRuntimeMap = ['OSX' : 'osx.10.10-x64', 'Ubuntu14.04' : 'ubuntu.14.04-x64', 'Ubuntu16.04' : 'ubuntu.16.04-x64', @@ -56,7 +56,7 @@ def osShortName = ['Windows 10': 'win10', def isLocal = (localType == 'local') def newJobName = 'code_coverage_windows' - def batchCommand = 'call "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\VsDevCmd.bat" && build.cmd /p:Coverage=true /p:Outerloop=true /p:WithoutCategories=IgnoreForCI' + def batchCommand = 'call build.cmd -coverage -outerloop -- /p:WithoutCategories=IgnoreForCI' if (isLocal) { newJobName = "${newJobName}_local" batchCommand = "${batchCommand} /p:TestWithLocalLibraries=true" @@ -98,7 +98,7 @@ def osShortName = ['Windows 10': 'win10', [true, false].each { isPR -> def newJob = job(Utilities.getFullJobName(project, 'native_code_format_check', isPR)) { steps { - shell('python src/Native/format-code.py checkonly') + shell('python src/Native/Unix/format-code.py checkonly') } } @@ -120,16 +120,16 @@ def osShortName = ['Windows 10': 'win10', // Define outerloop windows Nano testing. Run locally on each machine. // ************************** [true, false].each { isPR -> - ['Windows Nano 2016'].each { os -> + ['Windows Nano 2016'].each { osName -> ['Debug', 'Release'].each { configurationGroup -> - def newJobName = "outerloop_${osShortName[os]}_${configurationGroup.toLowerCase()}" + def newJobName = "outerloop_${osShortName[osName]}_${configurationGroup.toLowerCase()}" - def newBuildJobName = "outerloop_${osShortName[os]}_${configurationGroup.toLowerCase()}_bld" + def newBuildJobName = "outerloop_${osShortName[osName]}_${configurationGroup.toLowerCase()}_bld" def newBuildJob = job(Utilities.getFullJobName(project, newBuildJobName, isPR)) { steps { - batchFile("call \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat\" x86 && build.cmd /p:OSGroup=Windows_NT /p:ConfigurationGroup=${configurationGroup} /p:SkipTests=true /p:Outerloop=true /p:WithoutCategories=IgnoreForCI") + batchFile("call \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat\" x86 && build.cmd -os=Windows_NT -${configurationGroup} -skipTests -outerloop -- /p:WithoutCategories=IgnoreForCI") // Package up the results. batchFile("C:\\Packer\\Packer.exe .\\bin\\build.pack . bin packages") } @@ -143,7 +143,7 @@ def osShortName = ['Windows 10': 'win10', Utilities.addArchival(newBuildJob, "bin/build.pack,run-test.cmd,msbuild.log") def fullCoreFXBuildJobName = projectFolder + '/' + newBuildJob.name - def newTestJobName = "outerloop_${osShortName[os]}_${configurationGroup.toLowerCase()}_tst" + def newTestJobName = "outerloop_${osShortName[osName]}_${configurationGroup.toLowerCase()}_tst" def newTestJob = job(Utilities.getFullJobName(project, newTestJobName, isPR)) { steps { // The tests/corefx components @@ -169,7 +169,7 @@ def osShortName = ['Windows 10': 'win10', } // Set the affinity. All of these run on Windows Nano currently. - Utilities.setMachineAffinity(newTestJob, os) + Utilities.setMachineAffinity(newTestJob, osName) // Set up standard options. Utilities.addStandardOptions(newTestJob, isPR) // Add the unit test results @@ -193,7 +193,7 @@ def osShortName = ['Windows 10': 'win10', if (isPR) { // Set PR trigger. // TODO: More elaborate regex trigger? - Utilities.addGithubPRTriggerForBranch(newJob, branch, "OuterLoop ${os} ${configurationGroup}", "(?i).*test\\W+outerloop\\W+${os}\\W+${configurationGroup}.*") + Utilities.addGithubPRTriggerForBranch(newJob, branch, "OuterLoop ${osName} ${configurationGroup}", "(?i).*test\\W+outerloop\\W+${osName}\\W+${configurationGroup}.*") } else { // Set a periodic trigger @@ -207,33 +207,33 @@ def osShortName = ['Windows 10': 'win10', // Define outerloop testing for OSes that can build and run. Run locally on each machine. // ************************** [true, false].each { isPR -> - ['Windows 7', 'Windows_NT', 'Ubuntu14.04', 'Ubuntu16.04', 'CentOS7.1', 'OpenSUSE13.2', 'RHEL7.2', 'Fedora23', 'Debian8.4', 'OSX'].each { os -> + ['Windows 7', 'Windows_NT', 'Ubuntu14.04', 'Ubuntu16.04', 'CentOS7.1', 'OpenSUSE13.2', 'RHEL7.2', 'Fedora23', 'Debian8.4', 'OSX'].each { osName -> ['Debug', 'Release'].each { configurationGroup -> - def newJobName = "outerloop_${osShortName[os]}_${configurationGroup.toLowerCase()}" + def newJobName = "outerloop_${osShortName[osName]}_${configurationGroup.toLowerCase()}" def newJob = job(Utilities.getFullJobName(project, newJobName, isPR)) { steps { - if (os == 'Windows 10' || os == 'Windows 7' || os == 'Windows_NT') { - batchFile("call \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat\" x86 && build.cmd /p:ConfigurationGroup=${configurationGroup} /p:Outerloop=true /p:WithoutCategories=IgnoreForCI") + if (osName == 'Windows 10' || osName == 'Windows 7' || osName == 'Windows_NT') { + batchFile("call \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat\" x86 && build.cmd -${configurationGroup} -outerloop -- /p:WithoutCategories=IgnoreForCI") } - else if (os == 'OSX') { - shell("HOME=\$WORKSPACE/tempHome ./build.sh ${configurationGroup.toLowerCase()} /p:ConfigurationGroup=${configurationGroup} /p:Outerloop=true /p:TestWithLocalLibraries=true /p:WithoutCategories=IgnoreForCI") + else if (osName == 'OSX') { + shell("HOME=\$WORKSPACE/tempHome ./build.sh -${configurationGroup.toLowerCase()} -outerloop -testWithLocalLibraries -- /p:WithoutCategories=IgnoreForCI") } else { - shell("sudo HOME=\$WORKSPACE/tempHome ./build.sh ${configurationGroup.toLowerCase()} /p:TestNugetRuntimeId=${targetNugetRuntimeMap[os]} /p:ConfigurationGroup=${configurationGroup} /p:Outerloop=true /p:TestWithLocalLibraries=true /p:WithoutCategories=IgnoreForCI") + shell("sudo HOME=\$WORKSPACE/tempHome ./build.sh -${configurationGroup.toLowerCase()} -outerloop -testWithLocalLibraries -- /p:TestNugetRuntimeId=${targetNugetRuntimeMap[osName]} /p:WithoutCategories=IgnoreForCI") } } } // Set the affinity. OS name matches the machine affinity. - if (os == 'Windows_NT' || os == 'OSX') { - Utilities.setMachineAffinity(newJob, os, "latest-or-auto-elevated") + if (osName == 'Windows_NT' || osName == 'OSX') { + Utilities.setMachineAffinity(newJob, osName, "latest-or-auto-elevated") } - else if (osGroupMap[os] == 'Linux') { - Utilities.setMachineAffinity(newJob, os, 'outer-latest-or-auto') + else if (osGroupMap[osName] == 'Linux') { + Utilities.setMachineAffinity(newJob, osName, 'outer-latest-or-auto') } else { - Utilities.setMachineAffinity(newJob, os, 'latest-or-auto'); + Utilities.setMachineAffinity(newJob, osName, 'latest-or-auto'); } // Set up standard options. @@ -245,7 +245,7 @@ def osShortName = ['Windows 10': 'win10', if (isPR) { // Set PR trigger. // TODO: More elaborate regex trigger? - Utilities.addGithubPRTriggerForBranch(newJob, branch, "OuterLoop ${os} ${configurationGroup}", "(?i).*test\\W+outerloop\\W+${os}\\W+${configurationGroup}.*") + Utilities.addGithubPRTriggerForBranch(newJob, branch, "OuterLoop ${osName} ${configurationGroup}", "(?i).*test\\W+outerloop\\W+${osName}\\W+${configurationGroup}.*") } else { // Set a periodic trigger @@ -261,14 +261,14 @@ def osShortName = ['Windows 10': 'win10', // builds with secrets should never be available for pull requests. // right now perf tests are only run on Win10 (but can be built on any Windows) -['Windows 10'].each { os -> +['Windows 10'].each { osName -> ['Debug', 'Release'].each { configurationGroup -> - def newJobName = "perf_${osShortName[os]}_${configurationGroup.toLowerCase()}" + def newJobName = "perf_${osShortName[osName]}_${configurationGroup.toLowerCase()}" def newJob = job(Utilities.getFullJobName(project, newJobName, /* isPR */ false)) { steps { - helix("Build.cmd /p:Creator=dotnet-bot /p:ArchiveTests=true /p:ConfigurationGroup=${configurationGroup} /p:Configuration=Windows_${configurationGroup} /p:TestDisabled=true /p:EnableCloudTest=true /p:BuildMoniker={uniqueId} /p:TargetQueue=Windows.10.Amd64 /p:TestProduct=CoreFx /p:Branch=master /p:OSGroup=Windows_NT /p:CloudDropAccountName=dotnetbuilddrops /p:CloudResultsAccountName=dotnetjobresults /p:CloudDropAccessToken={CloudDropAccessToken} /p:CloudResultsAccessToken={CloudResultsAccessToken} /p:BuildCompleteConnection={BuildCompleteConnection} /p:BuildIsOfficialConnection={BuildIsOfficialConnection} /p:DocumentDbKey={DocumentDbKey} /p:DocumentDbUri=https://hms.documents.azure.com:443/ /p:FuncTestsDisabled=true /p:Performance=true") + helix("Build.cmd -- /p:Creator=dotnet-bot /p:ArchiveTests=true /p:ConfigurationGroup=${configurationGroup} /p:Configuration=Windows_${configurationGroup} /p:TestDisabled=true /p:EnableCloudTest=true /p:BuildMoniker={uniqueId} /p:TargetQueue=Windows.10.Amd64 /p:TestProduct=CoreFx /p:Branch=master /p:OSGroup=Windows_NT /p:CloudDropAccountName=dotnetbuilddrops /p:CloudResultsAccountName=dotnetjobresults /p:CloudDropAccessToken={CloudDropAccessToken} /p:CloudResultsAccessToken={CloudResultsAccessToken} /p:BuildCompleteConnection={BuildCompleteConnection} /p:BuildIsOfficialConnection={BuildIsOfficialConnection} /p:DocumentDbKey={DocumentDbKey} /p:DocumentDbUri=https://hms.documents.azure.com:443/ /p:FuncTestsDisabled=true /p:Performance=true") } // perf tests can be built on any Windows label("windows10 || windows7 || windows") @@ -290,23 +290,23 @@ def osShortName = ['Windows 10': 'win10', // ************************** [true, false].each { isPR -> ['Debug', 'Release'].each { configurationGroup -> - ['Windows_NT', 'Ubuntu14.04', 'Ubuntu16.04', 'Debian8.4', 'CentOS7.1', 'OpenSUSE13.2', 'Fedora23', 'RHEL7.2', 'OSX'].each { os -> - def osGroup = osGroupMap[os] - def newJobName = "${os.toLowerCase()}_${configurationGroup.toLowerCase()}" + ['Windows_NT', 'Ubuntu14.04', 'Ubuntu16.04', 'Debian8.4', 'CentOS7.1', 'OpenSUSE13.2', 'Fedora23', 'RHEL7.2', 'OSX'].each { osName -> + def osGroup = osGroupMap[osName] + def newJobName = "${osName.toLowerCase()}_${configurationGroup.toLowerCase()}" def newJob = job(Utilities.getFullJobName(project, newJobName, isPR)) { // On Windows we use the packer to put together everything. On *nix we use tar steps { - if (os == 'Windows 10' || os == 'Windows 7' || os == 'Windows_NT') { - batchFile("call \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat\" x86 && build.cmd /p:ConfigurationGroup=${configurationGroup} /p:OSGroup=${osGroup} /p:WithoutCategories=IgnoreForCI") + if (osName == 'Windows 10' || osName == 'Windows 7' || osName == 'Windows_NT') { + batchFile("call \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat\" x86 && build.cmd -${configurationGroup} -os=${osGroup} -- /p:WithoutCategories=IgnoreForCI") batchFile("C:\\Packer\\Packer.exe .\\bin\\build.pack .\\bin") } else { // Use Server GC for Ubuntu/OSX Debug PR build & test def useServerGC = (configurationGroup == 'Release' && isPR) ? 'useServerGC' : '' - shell("HOME=\$WORKSPACE/tempHome ./build.sh ${useServerGC} ${configurationGroup.toLowerCase()} /p:TestNugetRuntimeId=${targetNugetRuntimeMap[os]} /p:ConfigurationGroup=${configurationGroup} /p:TestWithLocalLibraries=true /p:WithoutCategories=IgnoreForCI") + shell("HOME=\$WORKSPACE/tempHome ./build.sh -${configurationGroup.toLowerCase()} -testWithLocalLibraries -- ${useServerGC} /p:TestNugetRuntimeId=${targetNugetRuntimeMap[osName]} /p:WithoutCategories=IgnoreForCI") // Tar up the appropriate bits. On OSX the tarring is a different syntax for exclusion. - if (os == 'OSX') { + if (osName == 'OSX') { shell("tar -czf bin/build.tar.gz --exclude *.Tests bin/*.${configurationGroup} bin/ref bin/packages") } else { @@ -317,13 +317,13 @@ def osShortName = ['Windows 10': 'win10', } // Set the affinity. - Utilities.setMachineAffinity(newJob, os, 'latest-or-auto') + Utilities.setMachineAffinity(newJob, osName, 'latest-or-auto') // Set up standard options. Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}") // Add the unit test results Utilities.addXUnitDotNETResults(newJob, 'bin/tests/**/testResults.xml') def archiveContents = "msbuild.log" - if (os.contains('Windows')) { + if (osName.contains('Windows')) { // Packer.exe is a .NET Framework application. When we can use it from the tool-runtime, we can archive the ".pack" file here. archiveContents += ",bin/build.pack" } @@ -335,11 +335,11 @@ def osShortName = ['Windows 10': 'win10', // Set up triggers if (isPR) { // Set PR trigger, we run Windows_NT, Ubuntu 14.04, CentOS 7.1 and OSX on every PR. - if ( os == 'Windows_NT' || os == 'Ubuntu14.04' || os == 'CentOS7.1' || os == 'OSX' ) { - Utilities.addGithubPRTriggerForBranch(newJob, branch, "Innerloop ${os} ${configurationGroup} Build and Test") + if ( osName == 'Windows_NT' || osName == 'Ubuntu14.04' || osName == 'CentOS7.1' || osName == 'OSX' ) { + Utilities.addGithubPRTriggerForBranch(newJob, branch, "Innerloop ${osName} ${configurationGroup} Build and Test") } else { - Utilities.addGithubPRTriggerForBranch(newJob, branch, "Innerloop ${os} ${configurationGroup} Build and Test", "(?i).*test\\W+innerloop\\W+${os}\\W+${configurationGroup}.*") + Utilities.addGithubPRTriggerForBranch(newJob, branch, "Innerloop ${osName} ${configurationGroup} Build and Test", "(?i).*test\\W+innerloop\\W+${osName}\\W+${configurationGroup}.*") } } else { @@ -360,14 +360,14 @@ def osShortName = ['Windows 10': 'win10', // ************************** [true, false].each { isPR -> ['Debug', 'Release'].each { configurationGroup -> - ['LinuxARMEmulator'].each { os -> - def osGroup = osGroupMap[os] - def newJobName = "${os.toLowerCase()}_cross_${configurationGroup.toLowerCase()}" + ['LinuxARMEmulator'].each { osName -> + def osGroup = osGroupMap[osName] + def newJobName = "${osName.toLowerCase()}_cross_${configurationGroup.toLowerCase()}" def arch = "arm-softfp" - // Setup variables to hold emulator folder path and the rootfs mount path - def armemul_path = '/opt/linux-arm-emulator' - def armrootfs_mountpath = '/opt/linux-arm-emulator-root' + // Setup variables to hold emulator folder path and the rootfs mount path + def armemul_path = '/opt/linux-arm-emulator' + def armrootfs_mountpath = '/opt/linux-arm-emulator-root' def newJob = job(Utilities.getFullJobName(project, newJobName, isPR)) { steps { @@ -392,7 +392,7 @@ def osShortName = ['Windows 10': 'win10', // Set up triggers if (isPR) { - if (os == 'LinuxARMEmulator') { + if (osName == 'LinuxARMEmulator') { Utilities.addGithubPRTriggerForBranch(newJob, branch, "Innerloop Linux ARM Emulator ${configurationGroup} Cross Build", "(?i).*test\\W+Innerloop\\W+Linux\\W+ARM\\W+Emulator\\W+${configurationGroup}\\W+Cross\\W+Build.*") } } diff --git a/publish-packages.cmd b/publish-packages.cmd index 9c1f9b45d68b..ee1f740016eb 100644 --- a/publish-packages.cmd +++ b/publish-packages.cmd @@ -1,33 +1,2 @@ -@if "%_echo%" neq "on" echo off -setlocal EnableDelayedExpansion - -set packagesLog=publish-packages.log -echo Running publish-packages.cmd %* > %packagesLog% - -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 - -:Usage -echo. -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" -exit /b +@call %~dp0run.cmd publish-packages %* +@exit /b %ERRORLEVEL% \ No newline at end of file diff --git a/publish-packages.sh b/publish-packages.sh index 4309b551a429..7027bd948332 100755 --- a/publish-packages.sh +++ b/publish-packages.sh @@ -1,39 +1,4 @@ #!/usr/bin/env bash - -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'" - exit 1 -} - working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -publish_packages_log=$working_tree_root/publish-packages.log -options="/nologo /flp:v=detailed;Append;LogFile=$publish_packages_log" -allargs="$@" - -echo -e "Running publish-packages.sh $allargs" > $publish_packages_log - -# Parse arguments -if [ "$allargs" == "-h" ] || [ "$allargs" == "--help" ]; then - usage -fi - -# Ensure that MSBuild is available -echo "Running init-tools.sh" -$working_tree_root/init-tools.sh - -echo -e "\n$working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.proj $options $allargs" >> $publish_packages_log -$working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.proj $options $allargs - -if [ $? -ne 0 ]; then - echo -e "\nAn error occurred. Aborting publish-packages.sh ." >> $publish_packages_log - echo "ERROR: An error occurred while publishing packages, see $publish_packages_log for more details." - exit 1 -fi - -echo "Done publishing packages." -echo -e "\nDone publishing packages." >> $publish_packages_log -exit 0 +$working_tree_root/run.sh publish-packages $* +exit $? diff --git a/run.cmd b/run.cmd new file mode 100644 index 000000000000..b53296815778 --- /dev/null +++ b/run.cmd @@ -0,0 +1,28 @@ +@if "%_echo%" neq "on" echo off +setlocal + +if not defined VisualStudioVersion ( + if defined VS140COMNTOOLS ( + call "%VS140COMNTOOLS%\VsDevCmd.bat" + goto :Run + ) + echo Error: Visual Studio 2015 required. + echo Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.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 %* +exit /b %ERRORLEVEL% \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 000000000000..64354936ff14 --- /dev/null +++ b/run.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +__scriptpath=$(cd "$(dirname "$0")"; pwd -P) +$__scriptpath/init-tools.sh +if [ $? -ne 0 ]; then + exit 1 +fi + +__toolRuntime=$__scriptpath/Tools +__dotnet=$__toolRuntime/dotnetcli/dotnet + +echo Running: $__dotnet $__toolRuntime/run.exe $* +$__dotnet $__toolRuntime/run.exe $* +exit $? diff --git a/scripts/arm32_ci_script.sh b/scripts/arm32_ci_script.sh index 8577ec682c1c..cc48a2da79c0 100755 --- a/scripts/arm32_ci_script.sh +++ b/scripts/arm32_ci_script.sh @@ -146,7 +146,9 @@ function cross_build_corefx { git am < "$__ARMRootfsMountPath"/dotnet/setenv/corefx_cross.patch #Cross building for emulator rootfs - ROOTFS_DIR="$__ARMRootfsMountPath" CPLUS_INCLUDE_PATH=$LINUX_ARM_INCPATH CXXFLAGS=$LINUX_ARM_CXXFLAGS ./build.sh $__buildArch clean cross $__verboseFlag $__buildConfig skiptests + ROOTFS_DIR="$__ARMRootfsMountPath" CPLUS_INCLUDE_PATH=$LINUX_ARM_INCPATH CXXFLAGS=$LINUX_ARM_CXXFLAGS + BUILD_NATIVE="$ROOTFS_DIR" ./build-native.sh -buildArch=$__buildArch -$__buildConfig -- cross $__verboseFlag + BUILD_MANAGED="$ROOTFS_DIR" ./build-managed.sh -buildArch=$__buildArch -$__buildConfig -skipTests #Reset the code to the upstream version (set +x; echo 'Rewinding HEAD to master code') diff --git a/src/Native/.clang-format b/src/Native/Unix/.clang-format similarity index 100% rename from src/Native/.clang-format rename to src/Native/Unix/.clang-format diff --git a/src/Native/CMakeLists.txt b/src/Native/Unix/CMakeLists.txt similarity index 100% rename from src/Native/CMakeLists.txt rename to src/Native/Unix/CMakeLists.txt diff --git a/src/Native/Common/pal_config.h.in b/src/Native/Unix/Common/pal_config.h.in similarity index 100% rename from src/Native/Common/pal_config.h.in rename to src/Native/Unix/Common/pal_config.h.in diff --git a/src/Native/Common/pal_types.h b/src/Native/Unix/Common/pal_types.h similarity index 100% rename from src/Native/Common/pal_types.h rename to src/Native/Unix/Common/pal_types.h diff --git a/src/Native/Common/pal_utilities.h b/src/Native/Unix/Common/pal_utilities.h similarity index 100% rename from src/Native/Common/pal_utilities.h rename to src/Native/Unix/Common/pal_utilities.h diff --git a/src/Native/System.IO.Compression.Native/CMakeLists.txt b/src/Native/Unix/System.IO.Compression.Native/CMakeLists.txt similarity index 100% rename from src/Native/System.IO.Compression.Native/CMakeLists.txt rename to src/Native/Unix/System.IO.Compression.Native/CMakeLists.txt diff --git a/src/Native/System.IO.Compression.Native/pal_zlib.cpp b/src/Native/Unix/System.IO.Compression.Native/pal_zlib.cpp similarity index 100% rename from src/Native/System.IO.Compression.Native/pal_zlib.cpp rename to src/Native/Unix/System.IO.Compression.Native/pal_zlib.cpp diff --git a/src/Native/System.IO.Compression.Native/pal_zlib.h b/src/Native/Unix/System.IO.Compression.Native/pal_zlib.h similarity index 100% rename from src/Native/System.IO.Compression.Native/pal_zlib.h rename to src/Native/Unix/System.IO.Compression.Native/pal_zlib.h diff --git a/src/Native/System.Native/CMakeLists.txt b/src/Native/Unix/System.Native/CMakeLists.txt similarity index 100% rename from src/Native/System.Native/CMakeLists.txt rename to src/Native/Unix/System.Native/CMakeLists.txt diff --git a/src/Native/System.Native/pal_console.cpp b/src/Native/Unix/System.Native/pal_console.cpp similarity index 100% rename from src/Native/System.Native/pal_console.cpp rename to src/Native/Unix/System.Native/pal_console.cpp diff --git a/src/Native/System.Native/pal_console.h b/src/Native/Unix/System.Native/pal_console.h similarity index 100% rename from src/Native/System.Native/pal_console.h rename to src/Native/Unix/System.Native/pal_console.h diff --git a/src/Native/System.Native/pal_errno.cpp b/src/Native/Unix/System.Native/pal_errno.cpp similarity index 100% rename from src/Native/System.Native/pal_errno.cpp rename to src/Native/Unix/System.Native/pal_errno.cpp diff --git a/src/Native/System.Native/pal_errno.h b/src/Native/Unix/System.Native/pal_errno.h similarity index 100% rename from src/Native/System.Native/pal_errno.h rename to src/Native/Unix/System.Native/pal_errno.h diff --git a/src/Native/System.Native/pal_interfaceaddresses.cpp b/src/Native/Unix/System.Native/pal_interfaceaddresses.cpp similarity index 100% rename from src/Native/System.Native/pal_interfaceaddresses.cpp rename to src/Native/Unix/System.Native/pal_interfaceaddresses.cpp diff --git a/src/Native/System.Native/pal_interfaceaddresses.h b/src/Native/Unix/System.Native/pal_interfaceaddresses.h similarity index 100% rename from src/Native/System.Native/pal_interfaceaddresses.h rename to src/Native/Unix/System.Native/pal_interfaceaddresses.h diff --git a/src/Native/System.Native/pal_io.cpp b/src/Native/Unix/System.Native/pal_io.cpp similarity index 100% rename from src/Native/System.Native/pal_io.cpp rename to src/Native/Unix/System.Native/pal_io.cpp diff --git a/src/Native/System.Native/pal_io.h b/src/Native/Unix/System.Native/pal_io.h similarity index 100% rename from src/Native/System.Native/pal_io.h rename to src/Native/Unix/System.Native/pal_io.h diff --git a/src/Native/System.Native/pal_maphardwaretype.cpp b/src/Native/Unix/System.Native/pal_maphardwaretype.cpp similarity index 100% rename from src/Native/System.Native/pal_maphardwaretype.cpp rename to src/Native/Unix/System.Native/pal_maphardwaretype.cpp diff --git a/src/Native/System.Native/pal_maphardwaretype.h b/src/Native/Unix/System.Native/pal_maphardwaretype.h similarity index 100% rename from src/Native/System.Native/pal_maphardwaretype.h rename to src/Native/Unix/System.Native/pal_maphardwaretype.h diff --git a/src/Native/System.Native/pal_memory.cpp b/src/Native/Unix/System.Native/pal_memory.cpp similarity index 100% rename from src/Native/System.Native/pal_memory.cpp rename to src/Native/Unix/System.Native/pal_memory.cpp diff --git a/src/Native/System.Native/pal_memory.h b/src/Native/Unix/System.Native/pal_memory.h similarity index 100% rename from src/Native/System.Native/pal_memory.h rename to src/Native/Unix/System.Native/pal_memory.h diff --git a/src/Native/System.Native/pal_mount.cpp b/src/Native/Unix/System.Native/pal_mount.cpp similarity index 100% rename from src/Native/System.Native/pal_mount.cpp rename to src/Native/Unix/System.Native/pal_mount.cpp diff --git a/src/Native/System.Native/pal_mount.h b/src/Native/Unix/System.Native/pal_mount.h similarity index 100% rename from src/Native/System.Native/pal_mount.h rename to src/Native/Unix/System.Native/pal_mount.h diff --git a/src/Native/System.Native/pal_networkchange.cpp b/src/Native/Unix/System.Native/pal_networkchange.cpp similarity index 100% rename from src/Native/System.Native/pal_networkchange.cpp rename to src/Native/Unix/System.Native/pal_networkchange.cpp diff --git a/src/Native/System.Native/pal_networkchange.h b/src/Native/Unix/System.Native/pal_networkchange.h similarity index 100% rename from src/Native/System.Native/pal_networkchange.h rename to src/Native/Unix/System.Native/pal_networkchange.h diff --git a/src/Native/System.Native/pal_networking.cpp b/src/Native/Unix/System.Native/pal_networking.cpp similarity index 100% rename from src/Native/System.Native/pal_networking.cpp rename to src/Native/Unix/System.Native/pal_networking.cpp diff --git a/src/Native/System.Native/pal_networking.h b/src/Native/Unix/System.Native/pal_networking.h similarity index 100% rename from src/Native/System.Native/pal_networking.h rename to src/Native/Unix/System.Native/pal_networking.h diff --git a/src/Native/System.Native/pal_networkstatistics.cpp b/src/Native/Unix/System.Native/pal_networkstatistics.cpp similarity index 100% rename from src/Native/System.Native/pal_networkstatistics.cpp rename to src/Native/Unix/System.Native/pal_networkstatistics.cpp diff --git a/src/Native/System.Native/pal_networkstatistics.h b/src/Native/Unix/System.Native/pal_networkstatistics.h similarity index 100% rename from src/Native/System.Native/pal_networkstatistics.h rename to src/Native/Unix/System.Native/pal_networkstatistics.h diff --git a/src/Native/System.Native/pal_process.cpp b/src/Native/Unix/System.Native/pal_process.cpp similarity index 100% rename from src/Native/System.Native/pal_process.cpp rename to src/Native/Unix/System.Native/pal_process.cpp diff --git a/src/Native/System.Native/pal_process.h b/src/Native/Unix/System.Native/pal_process.h similarity index 100% rename from src/Native/System.Native/pal_process.h rename to src/Native/Unix/System.Native/pal_process.h diff --git a/src/Native/System.Native/pal_runtimeextensions.cpp b/src/Native/Unix/System.Native/pal_runtimeextensions.cpp similarity index 100% rename from src/Native/System.Native/pal_runtimeextensions.cpp rename to src/Native/Unix/System.Native/pal_runtimeextensions.cpp diff --git a/src/Native/System.Native/pal_runtimeextensions.h b/src/Native/Unix/System.Native/pal_runtimeextensions.h similarity index 100% rename from src/Native/System.Native/pal_runtimeextensions.h rename to src/Native/Unix/System.Native/pal_runtimeextensions.h diff --git a/src/Native/System.Native/pal_runtimeinformation.cpp b/src/Native/Unix/System.Native/pal_runtimeinformation.cpp similarity index 100% rename from src/Native/System.Native/pal_runtimeinformation.cpp rename to src/Native/Unix/System.Native/pal_runtimeinformation.cpp diff --git a/src/Native/System.Native/pal_runtimeinformation.h b/src/Native/Unix/System.Native/pal_runtimeinformation.h similarity index 100% rename from src/Native/System.Native/pal_runtimeinformation.h rename to src/Native/Unix/System.Native/pal_runtimeinformation.h diff --git a/src/Native/System.Native/pal_string.cpp b/src/Native/Unix/System.Native/pal_string.cpp similarity index 100% rename from src/Native/System.Native/pal_string.cpp rename to src/Native/Unix/System.Native/pal_string.cpp diff --git a/src/Native/System.Native/pal_string.h b/src/Native/Unix/System.Native/pal_string.h similarity index 100% rename from src/Native/System.Native/pal_string.h rename to src/Native/Unix/System.Native/pal_string.h diff --git a/src/Native/System.Native/pal_tcpstate.cpp b/src/Native/Unix/System.Native/pal_tcpstate.cpp similarity index 100% rename from src/Native/System.Native/pal_tcpstate.cpp rename to src/Native/Unix/System.Native/pal_tcpstate.cpp diff --git a/src/Native/System.Native/pal_tcpstate.h b/src/Native/Unix/System.Native/pal_tcpstate.h similarity index 100% rename from src/Native/System.Native/pal_tcpstate.h rename to src/Native/Unix/System.Native/pal_tcpstate.h diff --git a/src/Native/System.Native/pal_time.cpp b/src/Native/Unix/System.Native/pal_time.cpp similarity index 100% rename from src/Native/System.Native/pal_time.cpp rename to src/Native/Unix/System.Native/pal_time.cpp diff --git a/src/Native/System.Native/pal_time.h b/src/Native/Unix/System.Native/pal_time.h similarity index 100% rename from src/Native/System.Native/pal_time.h rename to src/Native/Unix/System.Native/pal_time.h diff --git a/src/Native/System.Native/pal_uid.cpp b/src/Native/Unix/System.Native/pal_uid.cpp similarity index 100% rename from src/Native/System.Native/pal_uid.cpp rename to src/Native/Unix/System.Native/pal_uid.cpp diff --git a/src/Native/System.Native/pal_uid.h b/src/Native/Unix/System.Native/pal_uid.h similarity index 100% rename from src/Native/System.Native/pal_uid.h rename to src/Native/Unix/System.Native/pal_uid.h diff --git a/src/Native/System.Net.Http.Native/CMakeLists.txt b/src/Native/Unix/System.Net.Http.Native/CMakeLists.txt similarity index 100% rename from src/Native/System.Net.Http.Native/CMakeLists.txt rename to src/Native/Unix/System.Net.Http.Native/CMakeLists.txt diff --git a/src/Native/System.Net.Http.Native/pal_curlinit.cpp b/src/Native/Unix/System.Net.Http.Native/pal_curlinit.cpp similarity index 100% rename from src/Native/System.Net.Http.Native/pal_curlinit.cpp rename to src/Native/Unix/System.Net.Http.Native/pal_curlinit.cpp diff --git a/src/Native/System.Net.Http.Native/pal_curlinit.h b/src/Native/Unix/System.Net.Http.Native/pal_curlinit.h similarity index 100% rename from src/Native/System.Net.Http.Native/pal_curlinit.h rename to src/Native/Unix/System.Net.Http.Native/pal_curlinit.h diff --git a/src/Native/System.Net.Http.Native/pal_easy.cpp b/src/Native/Unix/System.Net.Http.Native/pal_easy.cpp similarity index 100% rename from src/Native/System.Net.Http.Native/pal_easy.cpp rename to src/Native/Unix/System.Net.Http.Native/pal_easy.cpp diff --git a/src/Native/System.Net.Http.Native/pal_easy.h b/src/Native/Unix/System.Net.Http.Native/pal_easy.h similarity index 100% rename from src/Native/System.Net.Http.Native/pal_easy.h rename to src/Native/Unix/System.Net.Http.Native/pal_easy.h diff --git a/src/Native/System.Net.Http.Native/pal_multi.cpp b/src/Native/Unix/System.Net.Http.Native/pal_multi.cpp similarity index 100% rename from src/Native/System.Net.Http.Native/pal_multi.cpp rename to src/Native/Unix/System.Net.Http.Native/pal_multi.cpp diff --git a/src/Native/System.Net.Http.Native/pal_multi.h b/src/Native/Unix/System.Net.Http.Native/pal_multi.h similarity index 100% rename from src/Native/System.Net.Http.Native/pal_multi.h rename to src/Native/Unix/System.Net.Http.Native/pal_multi.h diff --git a/src/Native/System.Net.Http.Native/pal_slist.cpp b/src/Native/Unix/System.Net.Http.Native/pal_slist.cpp similarity index 100% rename from src/Native/System.Net.Http.Native/pal_slist.cpp rename to src/Native/Unix/System.Net.Http.Native/pal_slist.cpp diff --git a/src/Native/System.Net.Http.Native/pal_slist.h b/src/Native/Unix/System.Net.Http.Native/pal_slist.h similarity index 100% rename from src/Native/System.Net.Http.Native/pal_slist.h rename to src/Native/Unix/System.Net.Http.Native/pal_slist.h diff --git a/src/Native/System.Net.Http.Native/pal_versioninfo.cpp b/src/Native/Unix/System.Net.Http.Native/pal_versioninfo.cpp similarity index 100% rename from src/Native/System.Net.Http.Native/pal_versioninfo.cpp rename to src/Native/Unix/System.Net.Http.Native/pal_versioninfo.cpp diff --git a/src/Native/System.Net.Http.Native/pal_versioninfo.h b/src/Native/Unix/System.Net.Http.Native/pal_versioninfo.h similarity index 100% rename from src/Native/System.Net.Http.Native/pal_versioninfo.h rename to src/Native/Unix/System.Net.Http.Native/pal_versioninfo.h diff --git a/src/Native/System.Net.Security.Native/CMakeLists.txt b/src/Native/Unix/System.Net.Security.Native/CMakeLists.txt similarity index 100% rename from src/Native/System.Net.Security.Native/CMakeLists.txt rename to src/Native/Unix/System.Net.Security.Native/CMakeLists.txt diff --git a/src/Native/System.Net.Security.Native/pal_gssapi.cpp b/src/Native/Unix/System.Net.Security.Native/pal_gssapi.cpp similarity index 100% rename from src/Native/System.Net.Security.Native/pal_gssapi.cpp rename to src/Native/Unix/System.Net.Security.Native/pal_gssapi.cpp diff --git a/src/Native/System.Net.Security.Native/pal_gssapi.h b/src/Native/Unix/System.Net.Security.Native/pal_gssapi.h similarity index 100% rename from src/Native/System.Net.Security.Native/pal_gssapi.h rename to src/Native/Unix/System.Net.Security.Native/pal_gssapi.h diff --git a/src/Native/System.Security.Cryptography.Native/CMakeLists.txt b/src/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt similarity index 100% rename from src/Native/System.Security.Cryptography.Native/CMakeLists.txt rename to src/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt diff --git a/src/Native/System.Security.Cryptography.Native/configure.cmake b/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake similarity index 100% rename from src/Native/System.Security.Cryptography.Native/configure.cmake rename to src/Native/Unix/System.Security.Cryptography.Native/configure.cmake diff --git a/src/Native/System.Security.Cryptography.Native/openssl.c b/src/Native/Unix/System.Security.Cryptography.Native/openssl.c similarity index 100% rename from src/Native/System.Security.Cryptography.Native/openssl.c rename to src/Native/Unix/System.Security.Cryptography.Native/openssl.c diff --git a/src/Native/System.Security.Cryptography.Native/pal_asn1.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_asn1.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_asn1.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_asn1.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_asn1.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_asn1.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_asn1.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_asn1.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_asn1_print.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_asn1_print.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_asn1_print.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_asn1_print.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_asn1_print.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_asn1_print.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_asn1_print.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_asn1_print.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_bignum.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_bignum.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_bignum.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_bignum.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_bignum.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_bignum.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_bignum.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_bignum.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_bio.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_bio.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_bio.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_bio.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_bio.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_bio.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_bio.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_bio.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_crypto_config.h.in b/src/Native/Unix/System.Security.Cryptography.Native/pal_crypto_config.h.in similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_crypto_config.h.in rename to src/Native/Unix/System.Security.Cryptography.Native/pal_crypto_config.h.in diff --git a/src/Native/System.Security.Cryptography.Native/pal_crypto_types.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_crypto_types.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_crypto_types.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_crypto_types.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_ecc_import_export.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_ecc_import_export.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_ecc_import_export.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_ecc_import_export.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_ecc_import_export.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_ecc_import_export.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_ecc_import_export.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_ecc_import_export.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_ecdsa.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_ecdsa.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_ecdsa.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_ecdsa.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_ecdsa.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_ecdsa.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_ecdsa.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_ecdsa.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_eckey.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_eckey.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_eckey.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_eckey.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_eckey.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_eckey.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_eckey.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_eckey.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_err.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_err.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_err.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_err.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_err.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_err.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_err.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_err.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_evp.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_evp.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_evp.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_evp.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_evp.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_evp.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_evp.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_evp.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_evp_cipher.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_evp_cipher.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_evp_cipher.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_evp_cipher.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_evp_cipher.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_evp_cipher.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_evp_cipher.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_evp_cipher.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_evp_pkey.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_evp_pkey.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_evp_pkey.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_evp_pkey.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_evp_pkey_eckey.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_eckey.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_evp_pkey_eckey.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_eckey.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_evp_pkey_eckey.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_eckey.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_evp_pkey_eckey.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_eckey.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_evp_pkey_rsa.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_rsa.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_evp_pkey_rsa.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_rsa.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_evp_pkey_rsa.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_rsa.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_evp_pkey_rsa.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_rsa.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_hmac.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_hmac.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_hmac.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_hmac.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_hmac.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_hmac.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_hmac.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_hmac.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_pkcs12.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_pkcs12.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_pkcs12.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_pkcs12.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_pkcs12.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_pkcs12.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_pkcs12.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_pkcs12.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_pkcs7.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_pkcs7.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_pkcs7.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_pkcs7.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_pkcs7.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_pkcs7.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_pkcs7.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_pkcs7.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_rsa.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_rsa.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_rsa.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_rsa.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_rsa.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_rsa.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_rsa.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_rsa.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_ssl.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_ssl.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_ssl.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_ssl.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_ssl.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_ssl.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_ssl.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_ssl.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_x509.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_x509.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_x509.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_x509.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_x509.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_x509.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_x509.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_x509.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_x509_name.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_x509_name.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_x509_name.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_x509_name.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_x509_name.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_x509_name.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_x509_name.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_x509_name.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_x509_root.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_x509_root.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_x509_root.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_x509_root.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_x509_root.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_x509_root.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_x509_root.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_x509_root.h diff --git a/src/Native/System.Security.Cryptography.Native/pal_x509ext.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_x509ext.cpp similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_x509ext.cpp rename to src/Native/Unix/System.Security.Cryptography.Native/pal_x509ext.cpp diff --git a/src/Native/System.Security.Cryptography.Native/pal_x509ext.h b/src/Native/Unix/System.Security.Cryptography.Native/pal_x509ext.h similarity index 100% rename from src/Native/System.Security.Cryptography.Native/pal_x509ext.h rename to src/Native/Unix/System.Security.Cryptography.Native/pal_x509ext.h diff --git a/src/Native/configure.cmake b/src/Native/Unix/configure.cmake similarity index 100% rename from src/Native/configure.cmake rename to src/Native/Unix/configure.cmake diff --git a/src/Native/format-code.py b/src/Native/Unix/format-code.py old mode 100644 new mode 100755 similarity index 100% rename from src/Native/format-code.py rename to src/Native/Unix/format-code.py diff --git a/src/Native/gen-buildsys-clang.sh b/src/Native/Unix/gen-buildsys-clang.sh similarity index 98% rename from src/Native/gen-buildsys-clang.sh rename to src/Native/Unix/gen-buildsys-clang.sh index 43f8cf759fab..3dae741e9b90 100755 --- a/src/Native/gen-buildsys-clang.sh +++ b/src/Native/Unix/gen-buildsys-clang.sh @@ -7,7 +7,7 @@ if [ $# -lt 4 -o $# -gt 6 ] then echo "Usage..." echo "gen-buildsys-clang.sh [build flavor] [cmakeargs]" - echo "Specify the path to the top level CMake file - /src/Native" + echo "Specify the path to the top level CMake file - /src/Native/Unix" echo "Specify the clang version to use, split into major and minor version" echo "Specify the target architecture." echo "Optionally specify the build configuration (flavor.) Defaults to DEBUG." @@ -16,7 +16,7 @@ then fi #Set the root directory of the project -project_root="$1"/../.. +project_root="$1"/../../.. # Set up the environment to be used for building with clang. if which "clang-$2.$3" > /dev/null 2>&1 diff --git a/src/Native/Windows/gen-buildsys-win.bat b/src/Native/Windows/gen-buildsys-win.bat index 997d39d05c11..1772dd1d0951 100644 --- a/src/Native/Windows/gen-buildsys-win.bat +++ b/src/Native/Windows/gen-buildsys-win.bat @@ -9,12 +9,7 @@ if NOT %argC%==3 GOTO :USAGE if %1=="/?" GOTO :USAGE setlocal -set basePath=%__sourceDir% -:: remove quotes -set "basePath=%basePath:"=%" -:: remove trailing slash -if %basePath:~-1%==\ set "basePath=%basePath:~0,-1%" - +set __sourceDir=%~dp0 :: Default to vs2013 unless vs2015 is specified set __VSString=12 2013 if /i "%2" == "vs2015" (set __VSString=14 2015) diff --git a/src/Native/Windows/build-native.cmd b/src/Native/build-native.cmd similarity index 64% rename from src/Native/Windows/build-native.cmd rename to src/Native/build-native.cmd index b6d43b7a4061..b41f24df215a 100644 --- a/src/Native/Windows/build-native.cmd +++ b/src/Native/build-native.cmd @@ -3,8 +3,9 @@ setlocal :SetupArgs :: Initialize the args that will be passed to cmake -set __sourceDir=%~dp0 -set __binDir=%~dp0..\..\..\bin +set __nativeWindowsDir=%~dp0\Windows +set __binDir=%~dp0..\..\bin +set __rootDir=%~dp0..\.. set __CMakeBinDir="" set __IntermediatesDir="" set __BuildArch=x64 @@ -13,30 +14,22 @@ set CMAKE_BUILD_TYPE=Debug set "__LinkArgs= " set "__LinkLibraries= " +call %__rootDir%/run.cmd build-managed -GenerateVersion + :Arg_Loop :: Since the native build requires some configuration information before msbuild is called, we have to do some manual args parsing -:: For consistency with building the managed components, some args are taken in the msbuild style i.e. /p: if [%1] == [] goto :ToolsVersion -if /i [%1] == [/p:ConfigurationGroup] ( - if /i [%2] == [Release] ( set CMAKE_BUILD_TYPE=Release&&shift&&shift&goto Arg_Loop) - if /i [%2] == [Debug] ( set CMAKE_BUILD_TYPE=Debug&&shift&&shift&goto Arg_Loop) - echo Error: Invalid configuration args "%1 and %2" - exit /b 1 -) -if /i [%1] == [/p:Platform] ( - if /i [%2] == [AnyCPU] ( set __BuildArch=x64&&set __VCBuildArch=x86_amd64&&shift&&shift&goto Arg_Loop) - if /i [%2] == [x86] ( set __BuildArch=x86&&set __VCBuildArch=x86&&shift&&shift&goto Arg_Loop) - if /i [%2] == [arm] ( set __BuildArch=arm&&set __VCBuildArch=x86_arm&&shift&&shift&goto Arg_Loop) - if /i [%2] == [arm64] ( set __BuildArch=arm64&&set __VCBuildArch=arm64&&shift&&shift&goto Arg_Loop) - if /i [%2] == [x64] ( set __BuildArch=x64&&set __VCBuildArch=x86_amd64&&shift&&shift&goto Arg_Loop) - if /i [%2] == [amd64] ( set __BuildArch=x64&&set __VCBuildArch=x86_amd64&&shift&&shift&goto Arg_Loop) - echo Error: Invalid platform args "%1 and %2" - exit /b 1 -) -if /i [%1] == [-LinkArgument] ( set "__LinkArgs=%__LinkArgs% %2"&&shift&&shift&goto Arg_Loop) -if /i [%1] == [-LinkLibraries] ( set "__LinkLibraries=%__LinkLibraries% %2"&&shift&&shift&goto Arg_Loop) -if /i [%1] == [toolset_dir] ( set "__ToolsetDir=%2"&&shift&&shift&goto Arg_Loop) -if /i [%1] == [/p:toolset_dir] ( set "__ToolsetDir=%2"&&shift&&shift&goto Arg_Loop) +if /i [%1] == [Release] ( set CMAKE_BUILD_TYPE=Release&&shift&goto Arg_Loop) +if /i [%1] == [Debug] ( set CMAKE_BUILD_TYPE=Debug&&shift&goto Arg_Loop) + +if /i [%1] == [AnyCPU] ( set __BuildArch=x64&&set __VCBuildArch=x86_amd64&&shift&goto Arg_Loop) +if /i [%1] == [x86] ( set __BuildArch=x86&&set __VCBuildArch=x86&&shift&goto Arg_Loop) +if /i [%1] == [arm] ( set __BuildArch=arm&&set __VCBuildArch=x86_arm&&shift&goto Arg_Loop) +if /i [%1] == [x64] ( set __BuildArch=x64&&set __VCBuildArch=x86_amd64&&shift&goto Arg_Loop) +if /i [%1] == [amd64] ( set __BuildArch=x64&&set __VCBuildArch=x86_amd64&&shift&goto Arg_Loop) +if /i [%1] == [arm64] ( set __BuildArch=arm64&&set __VCBuildArch=arm64&&shift&goto Arg_Loop) + +if /i [%1] == [toolsetDir] ( set "__ToolsetDir=%2"&&shift&&shift&goto Arg_Loop) shift goto :Arg_Loop @@ -47,34 +40,18 @@ if not defined VisualStudioVersion ( if defined VS140COMNTOOLS ( goto :VS2015 ) - if defined VS120COMNTOOLS ( - goto :VS2013 - ) goto :MissingVersion ) if "%VisualStudioVersion%"=="14.0" ( goto :VS2015 ) -if "%VisualStudioVersion%"=="12.0" ( - goto :VS2013 -) :MissingVersion :: Can't find VS 2013+ -echo Error: build.cmd requires Visual Studio 2013 or 2015. +echo Error: Visual Studio 2015 required echo Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md for build instructions. exit /b 1 -:VS2013 -:: Setup vars for VS2013 -set __VSVersion=vs2013 -set __PlatformToolset="v120" -if NOT "%__BuildArch%" == "arm64" ( - :: Set the environment for the native build - call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" %__VCBuildArch% -) -goto :SetupDirs - :VS2015 :: Setup vars for VS2015 set __VSVersion=vs2015 @@ -90,16 +67,6 @@ goto :SetupDirs echo Commencing build of native components echo. -REM Generate _version.h -set __versionLog=%__sourceDir%..\..\..\version.log -if not exist "%__binDir%\obj\_version.h" ( - msbuild "%__sourceDir%..\..\..\build.proj" /nologo /t:GenerateVersionHeader /p:GenerateNativeVersionInfo=true > "%__versionLog%" -) - -IF ERRORLEVEL 1 ( - goto :Failure -) - if %__CMakeBinDir% == "" ( set "__CMakeBinDir=%__binDir%\Windows_NT.%__BuildArch%.%CMAKE_BUILD_TYPE%\Native" ) @@ -134,7 +101,7 @@ if /i "%__BuildArch%" == "arm64" ( ) pushd "%__IntermediatesDir%" -call "%__sourceDir%\gen-buildsys-win.bat" %__sourceDir% %__VSVersion% %__BuildArch% +call "%__nativeWindowsDir%\gen-buildsys-win.bat" %__nativeWindowsDir% %__VSVersion% %__BuildArch% popd :CheckForProj @@ -189,4 +156,4 @@ set INCLUDE=^ %__ToolsetDir%\sdpublic\sdk\inc\abi;^ %__ToolsetDir%\sdpublic\sdk\inc\clientcore;^ %__ToolsetDir%\diasdk\include -exit /b 0 \ No newline at end of file +exit /b 0 diff --git a/src/Native/build-native.sh b/src/Native/build-native.sh new file mode 100755 index 000000000000..8477584f9ab5 --- /dev/null +++ b/src/Native/build-native.sh @@ -0,0 +1,211 @@ +#!/usr/bin/env bash + +usage() +{ + echo "Our parameters changed! The parameters: buildArch, buildType and HostOS" + echo "are passes by the Run Command Tool." + echo "For more information type build-native.sh -? at the root of the repo." + echo + echo "Usage: $0 [verbose] [clangx.y] [cross] [staticLibLink] [cmakeargs] [makeargs]" + 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." + echo "staticLibLink - Optional argument to statically link any native library." + echo "generateversion - Pass this in to get a version on the build output." + echo "cmakeargs - user-settable additional arguments passed to CMake." + exit 1 +} + +setup_dirs() +{ + echo Setting up directories for build + + mkdir -p "$__BinDir" + mkdir -p "$__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; } +} + + +prepare_native_build() +{ + # Specify path to be set for CMAKE_INSTALL_PREFIX. + # This is where all built CoreClr libraries will copied to. + export __CMakeBinDir="$__BinDir" + + # Configure environment if we are doing a verbose build + if [ $__VerboseBuild == 1 ]; then + export VERBOSE=1 + fi + + # Generate version.c if specified, else have an empty one. + __versionSourceFile=$__rootRepo/bin/obj/version.c + if [ ! -e "${__versionSourceFile}" ]; then + if [ $__generateversionsource == true ]; then + $__rootRepo/Tools/msbuild.sh "$__rootRepo/build.proj" /t:GenerateVersionSourceFile /p:GenerateVersionSourceFile=true /v:minimal + else + __versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";" + echo $__versionSourceLine > $__versionSourceFile + fi + fi +} + +build_native() +{ + # All set to commence the build + + echo "Commencing build of corefx native components for $__BuildOS.$__BuildArch.$__BuildType" + cd "$__IntermediatesDir" + + # Regenerate the CMake solution + echo "Invoking cmake with arguments: \"$__nativeroot\" $__CMakeArgs $__CMakeExtraArgs" + "$__nativeroot/gen-buildsys-clang.sh" "$__nativeroot" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__CMakeArgs "$__CMakeExtraArgs" + + # Check that the makefiles were created. + + if [ ! -f "$__IntermediatesDir/Makefile" ]; then + echo "Failed to generate native component build project!" + exit 1 + fi + + # Build + + echo "Executing make install -j $__NumProc $__MakeExtraArgs" + + make install -j $__NumProc $__MakeExtraArgs + if [ $? != 0 ]; then + echo "Failed to build corefx native components." + exit 1 + fi +} + +__scriptpath=$(cd "$(dirname "$0")"; pwd -P) +__nativeroot=$__scriptpath/Unix +__rootRepo="$__scriptpath/../.." +__rootbinpath="$__scriptpath/../../bin" + +#This parameters are handled and passed by the Run Command Tool +#For more information: 'link to documentation' +__BuildArch=$1 +__BuildType=$2 +__HostOS=$3 +__NumProc=$4 + +__BuildOS=$__HostOS +__CMakeArgs=$__BuildType +__CMakeExtraArgs="" +__MakeExtraArgs="" +__generateversionsource=false + +# Set the various build properties here so that CMake and MSBuild can pick them up +__UnprocessedBuildArgs= +__CrossBuild=0 +__ServerGC=0 +__VerboseBuild=false +__ClangMajorVersion=3 +__ClangMinorVersion=5 + +while :; do + if [ $# -le 0 ]; then + break + fi + + lowerI="$(echo $1 | awk '{print tolower($0)}')" + case $lowerI in + -\?|-h|--help) + usage + exit 1 + ;; + verbose) + __VerboseBuild=1 + ;; + staticliblink) + __CMakeExtraArgs="$__CMakeExtraArgs -DCMAKE_STATIC_LIB_LINK=1" + ;; + generateversion) + __generateversionsource=true + ;; + clang3.5) + __ClangMajorVersion=3 + __ClangMinorVersion=5 + ;; + clang3.6) + __ClangMajorVersion=3 + __ClangMinorVersion=6 + ;; + clang3.7) + __ClangMajorVersion=3 + __ClangMinorVersion=7 + ;; + clang3.8) + __ClangMajorVersion=3 + __ClangMinorVersion=8 + ;; + cross) + __CrossBuild=1 + ;; + cmakeargs) + if [ -n "$2" ]; then + __CMakeExtraArgs="$__CMakeExtraArgs $2" + shift + else + echo "ERROR: 'cmakeargs' requires a non-empty option argument" + exit 1 + fi + ;; + makeargs) + if [ -n "$2" ]; then + __MakeExtraArgs="$__MakeExtraArgs $2" + shift + else + echo "ERROR: 'makeargs' requires a non-empty option argument" + exit 1 + fi + ;; + useservergc) + __ServerGC=1 + ;; + *) + __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1" + esac + + shift +done + +# Set the remaining variables based upon the determined build configuration +__IntermediatesDir="$__rootbinpath/obj/$__BuildOS.$__BuildArch.$__BuildType/Native" +__BinDir="$__rootbinpath/$__BuildOS.$__BuildArch.$__BuildType/Native" + +# Make the directories necessary for build if they don't exist +setup_dirs + +# Configure environment if we are doing a cross compile. +if [ "$__CrossBuild" == 1 ]; then + export CROSSCOMPILE=1 + if ! [[ -n "$ROOTFS_DIR" ]]; then + export ROOTFS_DIR="$__rootRepo/cross/rootfs/$__BuildArch" + fi +fi + + # Check prereqs. + + check_native_prereqs + + # Prepare the system + + prepare_native_build + + # Build the corefx native components. + + build_native diff --git a/sync.cmd b/sync.cmd index 844d0678f3a7..e6c91750e188 100644 --- a/sync.cmd +++ b/sync.cmd @@ -1,125 +1,4 @@ -@if "%_echo%" neq "on" echo off -setlocal EnableDelayedExpansion - -set synclog=sync.log -echo Running Sync.cmd %* > %synclog% - -set options=/nologo /v:minimal /clp:Summary /flp:v=detailed;Append;LogFile=%synclog% - -set "__args= %*" -set processedArgs= -set unprocessedBuildArgs= - -set src=false -set packages=false -set tests=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] == [/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] == [/t] ( - set tests=true - set packages=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=BatchRestorePackages -if [%tests%] == [true] ( - set options=!options! /p:BuildTestsAgainstPackages=true - set targets=BatchGenerateTestProjectJsons;!targets! -) - -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 - -: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 /t - Generates tests project.json files and then it 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 To download a specific group of product packages, specify: -echo /p:BuildNumberMajor -echo /p:BuildNumberMinor -echo. -echo If no option is specified then sync.cmd /s /p is implied. \ No newline at end of file +@setlocal +@if [%1]==[] set __args=-p +@call %~dp0run.cmd sync %__args% %* +@exit /b %ERRORLEVEL% \ No newline at end of file diff --git a/sync.sh b/sync.sh index 89cf48b0d078..8c9068260e80 100755 --- a/sync.sh +++ b/sync.sh @@ -1,98 +1,9 @@ #!/usr/bin/env bash -usage() -{ - echo "Usage: sync [-p] [-s]" - 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 " -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 " To download a specific group of product packages, specify:" - echo " /p:BuildNumberMajor" - echo " /p:BuildNumberMinor" - echo - echo "If no option is specified, then \"sync.sh -p -s\" 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 -fi - -while [[ $# > 0 ]] -do - opt="$1" - case $opt in - -h|--help) - usage - ;; - -p) - sync_packages=true - ;; - -s) - sync_src=true - ;; - -ab) - azure_blobs=true - ;; - *) - unprocessedBuildArgs="$unprocessedBuildArgs $1" - esac - 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 [ "$azure_blobs" == true ]; then - echo "Connecting and downloading packages from Azure BLOB ..." - echo -e "\n$working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/syncAzure.proj $options $unprocessedBuildArgs" >> $sync_log - $working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/syncAzure.proj $options $unprocessedBuildArgs - if [ $? -ne 0 ] - then - echo -e "\nDownload from Azure failed. Aborting sync." >> $sync_log - echo "ERROR: An error occurred while downloading packages from Azure BLOB; see $sync_log for more details. There may have been networking problems, so please try again in a few minutes." - exit 1 - fi + __args=-p fi -if [ "$sync_packages" == true ]; then - options="$options /t:BatchRestorePackages /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 -fi - -echo "Sync completed successfully." -echo -e "\nSync completed successfully." >> $sync_log -exit 0 +working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +$working_tree_root/run.sh sync $__args $* +exit $?