diff options
author | Vance Morrison <vancem@microsoft.com> | 2017-08-15 09:18:50 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-15 09:18:50 -0700 |
commit | ea1a4a57f48b5021f027786743979e61ba505a9d (patch) | |
tree | c144e3e7fd18c45189e542cbb72848334292bd08 | |
parent | 62daf41d8aa26600a917e595038dad16780ad8ec (diff) | |
download | coreclr-ea1a4a57f48b5021f027786743979e61ba505a9d.tar.gz coreclr-ea1a4a57f48b5021f027786743979e61ba505a9d.tar.bz2 coreclr-ea1a4a57f48b5021f027786743979e61ba505a9d.zip |
Use dashes for build options (#13353)
* Fix IndexOutOfRangeException in PayloadNames property
If you pass an null payload using Write<T>, and in the EventListener then call PayloadNames, it
will throw an IndexOutOfRangeException. It should just return null. This fixes this.
* To be consistant with the other build.cmd files use - for options
* Update docs to track change in option convention
* Updated Unix script to use - for options.
* Fix build break
* Fix Whitespace (review feedback)
* Another fix
-rw-r--r-- | Documentation/building/windows-instructions.md | 4 | ||||
-rw-r--r-- | build.cmd | 86 | ||||
-rwxr-xr-x | build.sh | 140 |
3 files changed, 136 insertions, 94 deletions
diff --git a/Documentation/building/windows-instructions.md b/Documentation/building/windows-instructions.md index 4122711174..1cbd8e3f27 100644 --- a/Documentation/building/windows-instructions.md +++ b/Documentation/building/windows-instructions.md @@ -141,8 +141,8 @@ full rebuild. Build has a number of options that you can learn about using build -?. Some of the more important options are - * skiptests - don't build the tests. This can shorten build times quite a bit, but means you can't run tests. - * release - build the 'Release' build type that does not have extra development-time checking compiled in. + * -skiptests - don't build the tests. This can shorten build times quite a bit, but means you can't run tests. + * -release - build the 'Release' build type that does not have extra development-time checking compiled in. * -rebuild - force the build not to be incremental but to recompile everything. You want this if you are going to do performance testing on your build. @@ -106,7 +106,21 @@ if "%1" == "" goto ArgsDone if /i "%1" == "-?" goto Usage if /i "%1" == "-h" goto Usage if /i "%1" == "-help" goto Usage +if /i "%1" == "--help" goto Usage + +if /i "%1" == "-all" (set __BuildAll=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-x64" (set __BuildArchX64=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-x86" (set __BuildArchX86=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-arm" (set __BuildArchArm=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-arm64" (set __BuildArchArm64=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) + +if /i "%1" == "-debug" (set __BuildTypeDebug=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-checked" (set __BuildTypeChecked=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-release" (set __BuildTypeRelease=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) + +REM TODO these are deprecated remove them eventually +REM don't add more, use the - syntax instead if /i "%1" == "all" (set __BuildAll=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "x64" (set __BuildArchX64=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "x86" (set __BuildArchX86=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) @@ -125,6 +139,34 @@ if [!__PassThroughArgs!]==[] ( set __PassThroughArgs=%__PassThroughArgs% %1 ) +if /i "%1" == "-freebsdmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildOS=FreeBSD&set __SkipNugetPackage=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-linuxmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildOS=Linux&set __SkipNugetPackage=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-netbsdmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildOS=NetBSD&set __SkipNugetPackage=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-osxmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildOS=OSX&set __SkipNugetPackage=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-windowsmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildOS=Windows_NT&set __SkipNugetPackage=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-nativemscorlib" (set __BuildNativeCoreLib=1&set __BuildCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-configureonly" (set __ConfigureOnly=1&set __BuildNative=1&set __BuildNativeCoreLib=0&set __BuildCoreLib=0&set __BuildTests=0&set __BuildPackages=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-skipconfigure" (set __SkipConfigure=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-skipmscorlib" (set __BuildCoreLib=0&set __BuildNativeCoreLib=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-skipnative" (set __BuildNative=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-skiptests" (set __BuildTests=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-skipbuildpackages" (set __BuildPackages=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-skiprestoreoptdata" (set __RestoreOptData=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-usenmakemakefiles" (set __NMakeMakefiles=1&set __ConfigureOnly=1&set __BuildNative=1&set __BuildNativeCoreLib=0&set __BuildCoreLib=0&set __BuildTests=0&set __BuildPackages=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-pgoinstrument" (set __PgoInstrument=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-enforcepgo" (set __EnforcePgo=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-nopgooptimize" (set __PgoOptimize=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-ibcinstrument" (set __IbcTuning=/Tuning&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-toolset_dir" (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) +if /i "%1" == "-buildstandalonegc" ( + set __BuildStandaloneGC="-DFEATURE_STANDALONE_GC=1" + set __BuildStandaloneGCOnly="-DFEATURE_STANDALONE_GC_ONLY=1" + set processedArgs=!processedArgs! %1 + shift&goto Arg_Loop +) + +REM TODO these are deprecated remove them eventually +REM don't add more, use the - syntax instead if /i "%1" == "freebsdmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildOS=FreeBSD&set __SkipNugetPackage=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "linuxmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildOS=Linux&set __SkipNugetPackage=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "netbsdmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildOS=NetBSD&set __SkipNugetPackage=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) @@ -631,29 +673,29 @@ echo build.cmd all [option1] [option2] -- ... echo. echo All arguments are optional. The options are: echo. -echo.-? -h -help: view this message. -echo all: Builds all configurations and platforms. -echo Build architecture: one of x64, x86, arm, arm64 ^(default: x64^). -echo Build type: one of Debug, Checked, Release ^(default: Debug^). +echo.-? -h -help --help: view this message. +echo -all: Builds all configurations and platforms. +echo Build architecture: one of -x64, -x86, -arm, -arm64 ^(default: -x64^). +echo Build type: one of -Debug, -Checked, -Release ^(default: -Debug^). echo -- ... : all arguments following this tag will be passed directly to msbuild. -echo mscorlib version: one of freebsdmscorlib, linuxmscorlib, netbsdmscorlib, osxmscorlib, -echo or windowsmscorlib. If one of these is passed, only System.Private.CoreLib is built, +echo mscorlib version: one of -freebsdmscorlib, -linuxmscorlib, -netbsdmscorlib, -osxmscorlib, +echo or -windowsmscorlib. If one of these is passed, only System.Private.CoreLib is built, echo for the specified platform ^(FreeBSD, Linux, NetBSD, OS X or Windows, echo respectively^). echo add nativemscorlib to go further and build the native image for designated mscorlib. -echo toolset_dir ^<dir^> : set the toolset directory -- Arm64 use only. Required for Arm64 builds. -echo nopgooptimize: do not use profile guided optimizations. -echo enforcepgo: verify after the build that PGO was used for key DLLs, and fail the build if not -echo pgoinstrument: generate instrumented code for profile guided optimization enabled binaries. -echo ibcinstrument: generate IBC-tuning-enabled native images when invoking crossgen. -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 System.Private.CoreLib ^(default: System.Private.CoreLib is built^). -echo skipnative: skip building native components ^(default: native components are built^). -echo skiptests: skip building tests ^(default: tests are built^). -echo skipbuildpackages: skip building nuget packages ^(default: packages are built^). -echo skiprestoreoptdata: skip restoring optimization data used by profile-based optimizations. -echo buildstandalonegc: builds the GC in a standalone mode. +echo -toolset_dir ^<dir^> : set the toolset directory -- Arm64 use only. Required for Arm64 builds. +echo -nopgooptimize: do not use profile guided optimizations. +echo -enforcepgo: verify after the build that PGO was used for key DLLs, and fail the build if not +echo -pgoinstrument: generate instrumented code for profile guided optimization enabled binaries. +echo -ibcinstrument: generate IBC-tuning-enabled native images when invoking crossgen. +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 System.Private.CoreLib ^(default: System.Private.CoreLib is built^). +echo -skipnative: skip building native components ^(default: native components are built^). +echo -skiptests: skip building tests ^(default: tests are built^). +echo -skipbuildpackages: skip building nuget packages ^(default: packages are built^). +echo -skiprestoreoptdata: skip restoring optimization data used by profile-based optimizations. +echo -buildstandalonegc: builds the GC in a standalone mode. echo -skiprestore: skip restoring packages ^(default: packages are restored during build^). echo -disableoss: Disable Open Source Signing for System.Private.CoreLib. echo -priority=^<N^> : specify a set of test that will be built and run, with priority N. @@ -668,11 +710,11 @@ echo one or more build architectures or types is specified, then only those buil echo and types are built. echo. echo For example: -echo build all +echo build -all echo -- builds all architectures, and all build types per architecture -echo build all x86 +echo build -all -x86 echo -- builds all build types for x86 -echo build all x64 x86 Checked Release +echo build -all -x64 -x86 -Checked -Release echo -- builds x64 and x86 architectures, Checked and Release build types for each exit /b 1 @@ -19,42 +19,42 @@ fi usage() { - echo "Usage: $0 [BuildArch] [BuildType] [verbose] [coverage] [cross] [clangx.y] [ninja] [configureonly] [skipconfigure] [skipnative] [skipmscorlib] [skiptests] [stripsymbols] [ignorewarnings] [cmakeargs] [bindir]" - echo "BuildArch can be: x64, x86, arm, armel, arm64" - echo "BuildType can be: debug, checked, release" - echo "coverage - optional argument to enable code coverage build (currently supported only for Linux and OSX)." - echo "ninja - target ninja instead of GNU make" - 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 "crosscomponent - optional argument to build cross-architecture component," - echo " - will use CAC_ROOTFS_DIR environment variable if set." - echo "nopgooptimize - do not use profile guided optimizations." - echo "pgoinstrument - generate instrumented code for profile guided optimization enabled binaries." - echo "ibcinstrument - generate IBC-tuning-enabled native images when invoking crossgen." - 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." - echo "skiptests - skip the tests in the 'tests' subdirectory." - echo "skipnuget - skip building nuget packages." - echo "skiprestoreoptdata - skip restoring optimization data used by profile-based optimizations." - echo "skipcrossgen - skip native image generation" - echo "verbose - optional argument to enable verbose build output." + echo "Usage: $0 [BuildArch] [BuildType] [-verbose] [-coverage] [-cross] [-clangx.y] [-ninja] [-configureonly] [-skipconfigure] [-skipnative] [-skipmscorlib] [-skiptests] [-stripsymbols] [-ignorewarnings] [-cmakeargs] [-bindir]" + echo "BuildArch can be: -x64, -x86, -arm, -armel, -arm64" + echo "BuildType can be: -debug, -checked, -release" + echo "-coverage - optional argument to enable code coverage build (currently supported only for Linux and OSX)." + echo "-ninja - target ninja instead of GNU make" + 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 "-crosscomponent - optional argument to build cross-architecture component," + echo " - will use CAC_ROOTFS_DIR environment variable if set." + echo "-nopgooptimize - do not use profile guided optimizations." + echo "-pgoinstrument - generate instrumented code for profile guided optimization enabled binaries." + echo "-ibcinstrument - generate IBC-tuning-enabled native images when invoking crossgen." + 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." + echo "-skiptests - skip the tests in the 'tests' subdirectory." + echo "-skipnuget - skip building nuget packages." + echo "-skiprestoreoptdata - skip restoring optimization data used by profile-based optimizations." + echo "-skipcrossgen - skip native image generation" + echo "-verbose - optional argument to enable verbose build output." echo "-skiprestore: skip restoring packages ^(default: packages are restored during build^)." echo "-disableoss: Disable Open Source Signing for System.Private.CoreLib." echo "-sequential: force a non-parallel build ^(default is to build in parallel" echo " using all processors^)." echo "-officialbuildid=^<ID^>: specify the official build ID to be used by this build." echo "-Rebuild: passes /t:rebuild to the build projects." - echo "stripSymbols - Optional argument to strip native symbols during the build." - echo "skipgenerateversion - disable version generation even if MSBuild is supported." - echo "ignorewarnings - do not treat warnings as errors" - echo "cmakeargs - user-settable additional arguments passed to CMake." - echo "bindir - output directory (defaults to $__ProjectRoot/bin)" - echo "buildstandalonegc - builds the GC in a standalone mode. Can't be used with \"cmakeargs\"." - echo "msbuildonunsupportedplatform - build managed binaries even if distro is not officially supported." - echo "numproc - set the number of build processes." + echo "-stripSymbols - Optional argument to strip native symbols during the build." + echo "-skipgenerateversion - disable version generation even if MSBuild is supported." + echo "-ignorewarnings - do not treat warnings as errors" + echo "-cmakeargs - user-settable additional arguments passed to CMake." + echo "-bindir - output directory (defaults to $__ProjectRoot/bin)" + echo "-buildstandalonegc - builds the GC in a standalone mode. Can't be used with \"cmakeargs\"." + echo "-msbuildonunsupportedplatform - build managed binaries even if distro is not officially supported." + echo "-numproc - set the number of build processes." exit 1 } @@ -661,43 +661,43 @@ while :; do exit 1 ;; - x86) + x86|-x86) __BuildArch=x86 ;; - x64) + x64|-x64) __BuildArch=x64 ;; - arm) + arm|-arm) __BuildArch=arm ;; - armel) + armel|-armel) __BuildArch=armel ;; - arm64) + arm64|-arm64) __BuildArch=arm64 ;; - debug) + debug|-debug) __BuildType=Debug ;; - checked) + checked|-checked) __BuildType=Checked ;; - release) + release|-release) __BuildType=Release ;; - coverage) + coverage|-coverage) __CodeCoverage=Coverage ;; - cross) + cross|-cross) __CrossBuild=1 ;; @@ -705,118 +705,118 @@ while :; do __PortableBuild=0 ;; - verbose) + verbose|-verbose) __VerboseBuild=1 ;; - stripsymbols) + stripsymbols|-stripsymbols) __cmakeargs="$__cmakeargs -DSTRIP_SYMBOLS=true" ;; - clang3.5) + clang3.5|-clang3.5) __ClangMajorVersion=3 __ClangMinorVersion=5 ;; - clang3.6) + clang3.6|-clang3.6) __ClangMajorVersion=3 __ClangMinorVersion=6 ;; - clang3.7) + clang3.7|-clang3.7) __ClangMajorVersion=3 __ClangMinorVersion=7 ;; - clang3.8) + clang3.8|-clang3.8) __ClangMajorVersion=3 __ClangMinorVersion=8 ;; - clang3.9) + clang3.9|-clang3.9) __ClangMajorVersion=3 __ClangMinorVersion=9 ;; - clang4.0) + clang4.0|-clang4.0) __ClangMajorVersion=4 __ClangMinorVersion=0 ;; - ninja) + ninja|-ninja) __UseNinja=1 ;; - pgoinstrument) + pgoinstrument|-pgoinstrument) __PgoInstrument=1 ;; - nopgooptimize) + nopgooptimize|-nopgooptimize) __PgoOptimize=0 __SkipRestoreOptData=1 ;; - ibcinstrument) + ibcinstrument|-ibcinstrument) __IbcTuning="/Tuning" ;; - configureonly) + configureonly|-configureonly) __ConfigureOnly=1 __SkipMSCorLib=1 __SkipNuget=1 ;; - skipconfigure) + skipconfigure|-skipconfigure) __SkipConfigure=1 ;; - skipnative) + skipnative|-skipnative) # Use "skipnative" to use the same option name as build.cmd. __SkipCoreCLR=1 ;; - skipcoreclr) + skipcoreclr|-skipcoreclr) # Accept "skipcoreclr" for backwards-compatibility. __SkipCoreCLR=1 ;; - crosscomponent) + crosscomponent|-crosscomponent) __DoCrossArchBuild=1 ;; - skipmscorlib) + skipmscorlib|-skipmscorlib) __SkipMSCorLib=1 ;; - skipgenerateversion) + skipgenerateversion|-skipgenerateversion) __SkipGenerateVersion=1 ;; - skiprestoreoptdata) + skiprestoreoptdata|-skiprestoreoptdata) __SkipRestoreOptData=1 ;; - skipcrossgen) + skipcrossgen|-skipcrossgen) __SkipCrossgen=1 ;; - includetests) + includetests|-includetests) ;; - skiptests) + skiptests|-skiptests) __IncludeTests= ;; - skipnuget) + skipnuget|-skipnuget) __SkipNuget=1 ;; - ignorewarnings) + ignorewarnings|-ignorewarnings) __IgnoreWarnings=1 __cmakeargs="$__cmakeargs -DCLR_CMAKE_WARNINGS_ARE_ERRORS=OFF" ;; - cmakeargs) + cmakeargs|-cmakeargs) if [ -n "$2" ]; then __cmakeargs="$__cmakeargs $2" shift @@ -826,7 +826,7 @@ while :; do fi ;; - bindir) + bindir|-bindir) if [ -n "$2" ]; then __RootBinDir="$2" if [ ! -d $__RootBinDir ]; then @@ -841,13 +841,13 @@ while :; do exit 1 fi ;; - buildstandalonegc) + buildstandalonegc|-buildstandalonegc) __cmakeargs="$__cmakeargs -DFEATURE_STANDALONE_GC=1 -DFEATURE_STANDALONE_GC_ONLY=1" ;; - msbuildonunsupportedplatform) + msbuildonunsupportedplatform|-msbuildonunsupportedplatform) __msbuildonunsupportedplatform=1 ;; - numproc) + numproc|-numproc) if [ -n "$2" ]; then __NumProc="$2" shift |