From 0d0ada00caa03cd2a7d00bb647c5c6bb1a95156a Mon Sep 17 00:00:00 2001 From: Pat Gavlin Date: Tue, 12 Jan 2016 11:25:27 -0800 Subject: [PATCH] Add configureonly and skipconfigure to builds. These options allow the developer to either: 1. Run build configuration without actually running the build, or 2. Skip build configuration when running the build. CMake already adds the various CMakeLists.txt files as build dependencies s.t. it will be automatically re-run when necessary. --- build.cmd | 17 +++++ build.sh | 224 ++++++++++++++++++++++++++++++++++---------------------------- 2 files changed, 141 insertions(+), 100 deletions(-) diff --git a/build.cmd b/build.cmd index 8656c58..0ffb18f 100644 --- a/build.cmd +++ b/build.cmd @@ -48,6 +48,8 @@ set "__LogsDir=%__RootBinDir%\Logs" set __CleanBuild= set __MscorlibOnly= +set __ConfigureOnly= +set __SkipConfigure= set __SkipMscorlibBuild= set __SkipNativeBuild= set __SkipTestBuild= @@ -105,6 +107,8 @@ if /i "%1" == "windowsmscorlib" (set __MscorlibOnly=1&set __BuildOS=Windows_ if /i "%1" == "vs2013" (set __VSVersion=%1&shift&goto Arg_Loop) if /i "%1" == "vs2015" (set __VSVersion=%1&shift&goto Arg_Loop) +if /i "%1" == "configureonly" (set __ConfigureOnly=1&set __SkipMscorlibBuild=1&set __SkipTestBuild=1&shift&goto Arg_Loop) +if /i "%1" == "skipconfigure" (set __SkipConfigure=1&shift&goto Arg_Loop) if /i "%1" == "skipmscorlib" (set __SkipMscorlibBuild=1&shift&goto Arg_Loop) if /i "%1" == "skipnative" (set __SkipNativeBuild=1&shift&goto Arg_Loop) if /i "%1" == "skiptests" (set __SkipTestBuild=1&shift&goto Arg_Loop) @@ -134,6 +138,11 @@ goto Usage :ArgsDone +if defined __ConfigureOnly if defined __SkipConfigure ( + echo "Error: option 'configureonly' is incompatible with 'skipconfigure' + goto Usage +) + if defined __SkipMscorlibBuild if defined __MscorlibOnly ( echo Error: option 'skipmscorlib' is incompatible with 'freebsdmscorlib', 'linuxmscorlib', 'osxmscorlib', and 'windowsmscorlib'. goto Usage @@ -301,6 +310,8 @@ if not exist "%VSINSTALLDIR%DIA SDK" goto NoDIA :GenVSSolution +if defined __SkipConfigure goto SkipConfigure + echo %__MsgPrefix%Regenerating the Visual Studio solution pushd "%__IntermediatesDir%" @@ -308,6 +319,8 @@ call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersio @if defined __echo @echo on popd +:SkipConfigure + if not exist "%__IntermediatesDir%\install.vcxproj" ( echo %__MsgPrefix%Error: failed to generate native component build project! exit /b 1 @@ -358,6 +371,8 @@ REM === Build the CLR VM REM === REM ========================================================================================= +if defined __ConfigureOnly goto SkipNativeBuild + echo %__MsgPrefix%Invoking msbuild set "__BuildLog=%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.log" @@ -637,6 +652,8 @@ echo respectively^). echo priority ^ : specify a set of test that will be built and run, with priority N. echo sequential: force a non-parallel build ^(default is to build in parallel echo using all processors^). +echo configureonly: skip all builds; only run CMake ^(default: CMake and builds are run^) +echo skipconfigure: skip CMake ^(default: CMake is run^) echo skipmscorlib: skip building mscorlib ^(default: mscorlib is built^). echo skipnative: skip building native components ^(default: native components are built^). echo skiptests: skip building tests ^(default: tests are built^). diff --git a/build.sh b/build.sh index 3aa6c4e..67bc2c5 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ usage() { - echo "Usage: $0 [BuildArch] [BuildType] [clean] [verbose] [coverage] [cross] [clangx.y] [ninja] [skipnative] [skipmscorlib] [skiptests]" + echo "Usage: $0 [BuildArch] [BuildType] [clean] [verbose] [coverage] [cross] [clangx.y] [ninja] [configureonly] [skipconfigure] [skipnative] [skipmscorlib] [skiptests]" echo "BuildArch can be: x64, x86, arm, arm64" echo "BuildType can be: Debug, Checked, Release" echo "clean - optional argument to force a clean build." @@ -12,6 +12,8 @@ usage() 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 "configureonly - do not perform any builds; just configure the build." + echo "skipconfigure - skip build configuration." echo "skipnative - do not build native components." echo "skipmscorlib - do not build mscorlib.dll even if mono is installed." echo "skiptests - skip the tests in the 'tests' subdirectory." @@ -61,29 +63,26 @@ check_prereqs() build_coreclr() { - if [ $__SkipCoreCLR == 1 ]; then - echo "Skipping CoreCLR build." - return - fi + if [[ $__SkipCoreCLR == 0 || $__ConfigureOnly == 1 ]]; then + echo "Laying out dynamically generated files consumed by the build system " + python "$__ProjectRoot/src/scripts/genXplatEventing.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --exc "$__ProjectRoot/src/vm/ClrEtwAllMeta.lst" --inc "$__GeneratedIntermediatesDir/inc" --dummy "$__GeneratedIntermediatesDir/inc/etmdummy.h" --testdir "$__GeneratedIntermediatesDir/eventprovider_tests" + if [[ $? != 0 ]]; then + exit + fi - echo "Laying out dynamically generated files consumed by the build system " - python "$__ProjectRoot/src/scripts/genXplatEventing.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --exc "$__ProjectRoot/src/vm/ClrEtwAllMeta.lst" --inc "$__GeneratedIntermediatesDir/inc" --dummy "$__GeneratedIntermediatesDir/inc/etmdummy.h" --testdir "$__GeneratedIntermediatesDir/eventprovider_tests" - if [[ $? != 0 ]]; then - exit + #determine the logging system + case $__BuildOS in + Linux) + python "$__ProjectRoot/src/scripts/genXplatLttng.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediatesDir/" + if [[ $? != 0 ]]; then + exit + fi + ;; + *) + ;; + esac fi - #determine the logging system - case $__BuildOS in - Linux) - python "$__ProjectRoot/src/scripts/genXplatLttng.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediatesDir/" - if [[ $? != 0 ]]; then - exit - fi - ;; - *) - ;; - esac - export __GeneratedIntermediatesDirPresent="$__IntermediatesDir/Generated" #do not use this variable, it is used below to support incremental build python -c "import sys;sys.path.insert(0,\"$__ProjectRoot/src/scripts\"); from Utilities import *;UpdateDirectory(\"$__GeneratedIntermediatesDirPresent\",\"$__GeneratedIntermediatesDir\")" if [[ $? != 0 ]]; then @@ -107,9 +106,16 @@ build_coreclr() buildTool="ninja" fi - # Regenerate the CMake solution - echo "Invoking \"$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh\" \"$__ProjectRoot\" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__BuildType $__CodeCoverage $__IncludeTests $generator" - "$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh" "$__ProjectRoot" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__BuildType $__CodeCoverage $__IncludeTests $generator + if [ $__SkipConfigure == 0 ]; then + # Regenerate the CMake solution + echo "Invoking \"$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh\" \"$__ProjectRoot\" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__BuildType $__CodeCoverage $__IncludeTests $generator" + "$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh" "$__ProjectRoot" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__BuildType $__CodeCoverage $__IncludeTests $generator + fi + + if [ $__SkipCoreCLR == 1 ]; then + echo "Skipping CoreCLR build." + return + fi # Check that the makefiles were created. @@ -291,6 +297,8 @@ __LogsDir="$__RootBinDir/Logs" __UnprocessedBuildArgs= __MSBCleanBuildArgs= __UseNinja=0 +__ConfigureOnly=0 +__SkipConfigure=0 __SkipCoreCLR=0 __SkipMSCorLib=0 __CleanBuild=0 @@ -304,103 +312,119 @@ __MSBuildPath="$__PackagesDir/$__MSBuildPackageId.$__MSBuildPackageVersion/lib/M __NuGetPath="$__PackagesDir/NuGet.exe" for i in "$@" - do - lowerI="$(echo $i | awk '{print tolower($0)}')" - case $lowerI in - -\?|-h|--help) - usage - exit 1 - ;; +do + lowerI="$(echo $i | awk '{print tolower($0)}')" + case $lowerI in + -\?|-h|--help) + usage + exit 1 + ;; - x86) - __BuildArch=x86 - ;; + x86) + __BuildArch=x86 + ;; - x64) - __BuildArch=x64 - ;; + x64) + __BuildArch=x64 + ;; - arm) - __BuildArch=arm - ;; + arm) + __BuildArch=arm + ;; - arm64) - __BuildArch=arm64 - ;; + arm64) + __BuildArch=arm64 + ;; - debug) - __BuildType=Debug - ;; + debug) + __BuildType=Debug + ;; - checked) - __BuildType=Checked - ;; + checked) + __BuildType=Checked + ;; - release) - __BuildType=Release - ;; + release) + __BuildType=Release + ;; - coverage) - __CodeCoverage=Coverage - ;; + coverage) + __CodeCoverage=Coverage + ;; - clean) - __CleanBuild=1 - ;; + clean) + __CleanBuild=1 + ;; - verbose) - __VerboseBuild=1 - ;; + verbose) + __VerboseBuild=1 + ;; - cross) - __CrossBuild=1 - ;; + cross) + __CrossBuild=1 + ;; - clang3.5) - __ClangMajorVersion=3 - __ClangMinorVersion=5 - ;; + clang3.5) + __ClangMajorVersion=3 + __ClangMinorVersion=5 + ;; - clang3.6) - __ClangMajorVersion=3 - __ClangMinorVersion=6 - ;; + clang3.6) + __ClangMajorVersion=3 + __ClangMinorVersion=6 + ;; - clang3.7) - __ClangMajorVersion=3 - __ClangMinorVersion=7 - ;; + clang3.7) + __ClangMajorVersion=3 + __ClangMinorVersion=7 + ;; - ninja) - __UseNinja=1 - ;; + ninja) + __UseNinja=1 + ;; - skipnative) - # Use "skipnative" to use the same option name as build.cmd. - __SkipCoreCLR=1 - ;; + configureonly) + __ConfigureOnly=1 + __SkipCoreCLR=1 + __SkipMSCorLib=1 + __IncludeTests= + ;; - skipcoreclr) - # Accept "skipcoreclr" for backwards-compatibility. - __SkipCoreCLR=1 - ;; + skipconfigure) + __SkipConfigure=1 + ;; - skipmscorlib) - __SkipMSCorLib=1 - ;; + skipnative) + # Use "skipnative" to use the same option name as build.cmd. + __SkipCoreCLR=1 + ;; - includetests) - ;; + skipcoreclr) + # Accept "skipcoreclr" for backwards-compatibility. + __SkipCoreCLR=1 + ;; - skiptests) - __IncludeTests= - ;; + skipmscorlib) + __SkipMSCorLib=1 + ;; - *) - __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i" - ;; - esac - done + includetests) + ;; + + skiptests) + __IncludeTests= + ;; + + *) + __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i" + ;; + esac +done + +if [[ $__ConfigureOnly == 1 && $__SkipConfigure == 1 ]]; then + echo "configureonly and skipconfigure are mutually exclusive!" + exit 1 +fi # Set the remaining variables based upon the determined build configuration __BinDir="$__RootBinDir/Product/$__BuildOS.$__BuildArch.$__BuildType" -- 2.7.4