From 92bba0ab577b019eb9ab6412f05295cd891afbda Mon Sep 17 00:00:00 2001 From: Ivan Diaz Sanchez Date: Tue, 2 Jun 2020 19:05:07 -0700 Subject: [PATCH 1/8] Sorted the build scripts' help alphabetically, and made the subset error message softer and without metrics. --- eng/SubsetValidation.targets | 2 +- eng/build.ps1 | 51 +++++++++++++++++++++++------------ eng/build.sh | 52 +++++++++++++++++++++++++----------- 3 files changed, 71 insertions(+), 34 deletions(-) diff --git a/eng/SubsetValidation.targets b/eng/SubsetValidation.targets index 3b0acd5c5e1564..182f7115941423 100644 --- a/eng/SubsetValidation.targets +++ b/eng/SubsetValidation.targets @@ -39,7 +39,7 @@ - diff --git a/eng/build.ps1 b/eng/build.ps1 index f8f1164bcafc8d..c3c31aea61984d 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -20,39 +20,50 @@ Param( function Get-Help() { Write-Host "Common settings:" - Write-Host " -subset Build a subset, print available subsets with -subset help (short: -s)" - Write-Host " -vs Open the solution with VS using the locally acquired SDK. Path or solution name (ie -vs Microsoft.CSharp)" + Write-Host " -arch Build platform: x86, x64, arm, arm64, or wasm (short: -a)." + Write-Host " Pass a comma-separated list to build for multiple architectures." + Write-Host " [Default: Your machine's architecture.]" + Write-Host " -binaryLog Output binary log (short: -bl)" + Write-Host " -configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c)." + Write-Host " Pass a comma-separated list to build for multiple configurations." + Write-Host " [Default: Debug]" + Write-Host " -help Print help and exit (short: -h)" + Write-Host " -librariesConfiguration Libraries build configuration: Debug or Release (short: -lc)" + Write-Host " [Default: Debug]" Write-Host " -os Build operating system: Windows_NT, Linux, OSX, or Browser" - Write-Host " -arch Build platform: x86, x64, arm, arm64, or wasm (short: -a). Pass a comma-separated list to build for multiple architectures." - Write-Host " -configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c). Pass a comma-separated list to build for multiple configurations" + Write-Host " [Default: Your machine's OS.]" Write-Host " -runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked (short: -rc)" - Write-Host " -librariesConfiguration Libraries build configuration: Debug or Release (short: -lc)" + Write-Host " [Default: Debug]" + Write-Host " -subset Build a subset, print available subsets with -subset help (short: -s)" + Write-Host " [Default: Builds the entire repo.]" Write-Host " -verbosity MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" - Write-Host " -binaryLog Output binary log (short: -bl)" - Write-Host " -help Print help and exit (short: -h)" + Write-Host " [Default: Minimal]" + Write-Host " -vs Open the solution with VS using the locally acquired SDK. Path or solution name." + Write-Host " (Example: -vs Microsoft.CSharp)" Write-Host "" Write-Host "Actions (defaults to -restore -build):" - Write-Host " -restore Restore dependencies" Write-Host " -build Build all source projects (short: -b)" - Write-Host " -rebuild Rebuild all source projects" - Write-Host " -test Build and run tests (short: -t)" + Write-Host " -clean Clean the solution" Write-Host " -pack Package build outputs into NuGet packages" - Write-Host " -sign Sign build outputs" Write-Host " -publish Publish artifacts (e.g. symbols)" - Write-Host " -clean Clean the solution" + Write-Host " -rebuild Rebuild all source projects" + Write-Host " -restore Restore dependencies" + Write-Host " -sign Sign build outputs" + Write-Host " -test Build and run tests (short: -t)" Write-Host "" Write-Host "Libraries settings:" - Write-Host " -framework Build framework: net5.0 or net472 (short: -f)" + Write-Host " -allconfigurations Build packages for all build configurations" Write-Host " -coverage Collect code coverage when testing" - Write-Host " -testscope Scope tests, allowed values: innerloop, outerloop, all" + Write-Host " -framework Build framework: net5.0 or net472 (short: -f)" Write-Host " -testnobuild Skip building tests when invoking -test" - Write-Host " -allconfigurations Build packages for all build configurations" + Write-Host " -testscope Scope tests, allowed values: innerloop, outerloop, all" Write-Host "" - Write-Host "Command-line arguments not listed above are passed thru to msbuild." - Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -con for configuration, -t for test, etc.)." + Write-Host "Command-line arguments not listed above are passed through to MSBuild." + Write-Host "The above arguments can be shortened as much as to be unambiguous." + Write-Host "(Example: -con for configuration, -t for test, etc.)." } if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) { @@ -60,6 +71,12 @@ if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $ exit 0 } +if ($subset -eq 'help') { + $argumentsForHelp = "-restore -build /p:subset=help /clp:nosummary" + Invoke-Expression "& `"$PSScriptRoot/common/build.ps1`" $argumentsForHelp" + exit 0 +} + if ($vs) { . $PSScriptRoot\common\tools.ps1 diff --git a/eng/build.sh b/eng/build.sh index 02c5d278e259d6..753deef6aae9e9 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -17,36 +17,43 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" usage() { echo "Common settings:" - echo " --subset Build a subset, print available subsets with -subset help (short: -s)" - echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, NetBSD or SunOS" echo " --arch Build platform: x86, x64, arm, armel, arm64 or wasm" + echo " [Default: Your machine's architecture.]" + echo " --binaryLog Output binary log (short: -bl)" + echo " --cross Optional argument to signify cross compilation" echo " --configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c)" - echo " --runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked (short: -rc)" + echo " [Default: Debug]" + echo " --help Print help and exit (short: -h)" echo " --librariesConfiguration Libraries build configuration: Debug or Release (short: -lc)" + echo " [Default: Debug]" + echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, NetBSD or SunOS" + echo " [Default: Your machine's OS.]" echo " --projects Project or solution file(s) to build" + echo " --runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked (short: -rc)" + echo " [Default: Debug]" + echo " --subset Build a subset, print available subsets with -subset help (short: -s)" + echo " [Default: Builds the entire repo.]" echo " --verbosity MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" - echo " --binaryLog Output binary log (short: -bl)" - echo " --cross Optional argument to signify cross compilation" - echo " --help Print help and exit (short: -h)" + echo " [Default: Minimal]" echo "" echo "Actions (defaults to --restore --build):" - echo " --restore Restore dependencies (short: -r)" echo " --build Build all source projects (short: -b)" - echo " --rebuild Rebuild all source projects" - echo " --test Build and run tests (short: -t)" + echo " --clean Clean the solution" echo " --pack Package build outputs into NuGet packages" - echo " --sign Sign build outputs" echo " --publish Publish artifacts (e.g. symbols)" - echo " --clean Clean the solution" + echo " --rebuild Rebuild all source projects" + echo " --restore Restore dependencies (short: -r)" + echo " --sign Sign build outputs" + echo " --test Build and run tests (short: -t)" echo "" echo "Libraries settings:" - echo " --framework Build framework: net5.0 or net472 (short: -f)" + echo " --allconfigurations Build packages for all build configurations" echo " --coverage Collect code coverage when testing" - echo " --testscope Test scope, allowed values: innerloop, outerloop, all" + echo " --framework Build framework: net5.0 or net472 (short: -f)" echo " --testnobuild Skip building tests when invoking -test" - echo " --allconfigurations Build packages for all build configurations" + echo " --testscope Test scope, allowed values: innerloop, outerloop, all" echo "" echo "Native build settings:" @@ -79,6 +86,12 @@ initDistroRid() initDistroRidGlobal ${targetOs} ${buildArch} ${isPortableBuild} ${passedRootfsDir} } +showSubsetHelp() +{ + argumentsForHelp="-restore -build /p:subset=help /clp:nosummary" + "$scriptroot/common/build.sh" $argumentsForHelp +} + arguments='' cmakeargs='' extraargs='' @@ -110,9 +123,16 @@ while [[ $# > 0 ]]; do -subset|-s) if [ -z ${2+x} ]; then - arguments="$arguments /p:Subset=help" - shift 1 + showSubsetHelp + exit 0 + # arguments="$arguments /p:Subset=help" + # shift 1 else + passedSubset="$(echo "$2" | awk '{print tolower($0)}')" + if [ $passedSubset == "help" ]; then + showSubsetHelp + exit 0 + fi arguments="$arguments /p:Subset=$2" shift 2 fi From 2a7f6169dcac1e6914e0406b6aa791a56696b3c6 Mon Sep 17 00:00:00 2001 From: Ivan Diaz Sanchez Date: Wed, 3 Jun 2020 13:15:57 -0700 Subject: [PATCH 2/8] Added simple examples to the scripts' helps. --- eng/build.ps1 | 14 ++++++++++++++ eng/build.sh | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/eng/build.ps1 b/eng/build.ps1 index c3c31aea61984d..ed5abb83ccbee3 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -64,6 +64,20 @@ function Get-Help() { Write-Host "Command-line arguments not listed above are passed through to MSBuild." Write-Host "The above arguments can be shortened as much as to be unambiguous." Write-Host "(Example: -con for configuration, -t for test, etc.)." + Write-Host "" + + Write-Host "Here are some quick examples:" + Write-Host "" + Write-Host "Build CoreCLR on Windows for x64 on release configuration:" + Write-Host ".\build.cmd -subset clr -os Windows_NT -arch x64 -configuration Release" + Write-Host "" + Write-Host "Cross-compile CoreCLR runtime on Windows for ARM64." + Write-Host ".\build.cmd -subset clr.runtime -os Windows_NT -arch arm64 -configuration Release" + Write-Host "" + Write-Host "Build Debug libraries with a Release runtime." + Write-Host ".\build.cmd -subset clr+libs -os Windows_NT -arch x64 -runtimeConfiguration Release" + Write-Host "" + Write-Host "For more information, check out https://github.com/dotnet/runtime/blob/master/docs/workflow/README.md" } if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) { diff --git a/eng/build.sh b/eng/build.sh index 753deef6aae9e9..7e7617ee031512 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -62,9 +62,28 @@ usage() echo " --cmakeargs User-settable additional arguments passed to CMake." echo " --gcc Optional argument to build using gcc in PATH (default)" echo " --gccx.y Optional argument to build using gcc version x.y" + echo "" echo "Command line arguments starting with '/p:' are passed through to MSBuild." echo "Arguments can also be passed in with a single hyphen." + echo "" + + echo "Here are some quick examples:" + echo "" + echo "Build CoreCLR on Linux for x64 on release configuration:" + echo "./build.sh --subset clr --os linux --arch x64 --configuration release" + echo "" + echo "Build Debug libraries with a Release runtime." + echo "./build.sh --subset clr+libs --os linux --arch x64 --runtimeConfiguration release" + echo "" + echo "Cross-compile CoreCLR runtime on Linux for ARM64." + echo "./build.sh -subset clr.runtime --os linux --arch arm64 --configuration release --cross" + echo "" + echo "However, for this last example, you need to already have ROOTFS_DIR set up." + echo "Further information on this can be found here:" + echo "https://github.com/dotnet/runtime/blob/master/docs/workflow/building/coreclr/linux-instructions.md" + echo "" + echo "For more general information, check out https://github.com/dotnet/runtime/blob/master/docs/workflow/README.md" } initDistroRid() From 9299ca7f777bdc3fdb1997db09053600fbe2a364 Mon Sep 17 00:00:00 2001 From: Ivan Diaz Sanchez Date: Wed, 3 Jun 2020 17:44:30 -0700 Subject: [PATCH 3/8] Moved short flags to the flag column and rephrased a bit. --- eng/build.ps1 | 69 ++++++++++++++++++++++++------------------------ eng/build.sh | 73 ++++++++++++++++++++++++++------------------------- 2 files changed, 72 insertions(+), 70 deletions(-) diff --git a/eng/build.ps1 b/eng/build.ps1 index ed5abb83ccbee3..06a77004d02ea8 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -20,45 +20,46 @@ Param( function Get-Help() { Write-Host "Common settings:" - Write-Host " -arch Build platform: x86, x64, arm, arm64, or wasm (short: -a)." - Write-Host " Pass a comma-separated list to build for multiple architectures." - Write-Host " [Default: Your machine's architecture.]" - Write-Host " -binaryLog Output binary log (short: -bl)" - Write-Host " -configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c)." - Write-Host " Pass a comma-separated list to build for multiple configurations." - Write-Host " [Default: Debug]" - Write-Host " -help Print help and exit (short: -h)" - Write-Host " -librariesConfiguration Libraries build configuration: Debug or Release (short: -lc)" - Write-Host " [Default: Debug]" - Write-Host " -os Build operating system: Windows_NT, Linux, OSX, or Browser" - Write-Host " [Default: Your machine's OS.]" - Write-Host " -runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked (short: -rc)" - Write-Host " [Default: Debug]" - Write-Host " -subset Build a subset, print available subsets with -subset help (short: -s)" - Write-Host " [Default: Builds the entire repo.]" - Write-Host " -verbosity MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" - Write-Host " [Default: Minimal]" - Write-Host " -vs Open the solution with VS using the locally acquired SDK. Path or solution name." - Write-Host " (Example: -vs Microsoft.CSharp)" + Write-Host " -arch (-a) Build platform: x86, x64, arm, arm64, or wasm." + Write-Host " Pass a comma-separated list to build for multiple architectures." + Write-Host " [Default: Your machine's architecture.]" + Write-Host " -binaryLog (-bl) Output binary log." + Write-Host " -configuration (-c) Build configuration: Debug, Release or [CoreCLR]Checked." + Write-Host " Pass a comma-separated list to build for multiple configurations." + Write-Host " [Default: Debug]" + Write-Host " -help (-h) Print help and exit." + Write-Host " -librariesConfiguration (-lc) Libraries build configuration: Debug or Release." + Write-Host " [Default: Debug]" + Write-Host " -os Build operating system: Windows_NT, Linux, OSX, or Browser." + Write-Host " [Default: Your machine's OS.]" + Write-Host " -runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or [CoreCLR]Checked." + Write-Host " [Default: Debug]" + Write-Host " -subset (-s) Build a subset, print available subsets with -subset help." + Write-Host " '-subset' can be omitted if the subset is given as the first argument." + Write-Host " [Default: Builds the entire repo.]" + Write-Host " -verbosity (-v) MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]." + Write-Host " [Default: Minimal]" + Write-Host " -vs Open the solution with VS using the locally acquired SDK. Path or solution name." + Write-Host " (Example: -vs Microsoft.CSharp)" Write-Host "" Write-Host "Actions (defaults to -restore -build):" - Write-Host " -build Build all source projects (short: -b)" - Write-Host " -clean Clean the solution" - Write-Host " -pack Package build outputs into NuGet packages" - Write-Host " -publish Publish artifacts (e.g. symbols)" - Write-Host " -rebuild Rebuild all source projects" - Write-Host " -restore Restore dependencies" - Write-Host " -sign Sign build outputs" - Write-Host " -test Build and run tests (short: -t)" + Write-Host " -build (-b) Build all source projects." + Write-Host " -clean Clean the solution." + Write-Host " -pack Package build outputs into NuGet packages." + Write-Host " -publish Publish artifacts (e.g. symbols)." + Write-Host " -rebuild Rebuild all source projects." + Write-Host " -restore Restore dependencies." + Write-Host " -sign Sign build outputs." + Write-Host " -test (-t) Build and run tests." Write-Host "" Write-Host "Libraries settings:" - Write-Host " -allconfigurations Build packages for all build configurations" - Write-Host " -coverage Collect code coverage when testing" - Write-Host " -framework Build framework: net5.0 or net472 (short: -f)" - Write-Host " -testnobuild Skip building tests when invoking -test" - Write-Host " -testscope Scope tests, allowed values: innerloop, outerloop, all" + Write-Host " -allconfigurations Build packages for all build configurations." + Write-Host " -coverage Collect code coverage when testing." + Write-Host " -framework (-f) Build framework: net5.0 or net472." + Write-Host " -testnobuild Skip building tests when invoking -test." + Write-Host " -testscope Scope tests, allowed values: innerloop, outerloop, all." Write-Host "" Write-Host "Command-line arguments not listed above are passed through to MSBuild." @@ -69,7 +70,7 @@ function Get-Help() { Write-Host "Here are some quick examples:" Write-Host "" Write-Host "Build CoreCLR on Windows for x64 on release configuration:" - Write-Host ".\build.cmd -subset clr -os Windows_NT -arch x64 -configuration Release" + Write-Host ".\build.cmd clr -os Windows_NT -arch x64 -configuration Release" Write-Host "" Write-Host "Cross-compile CoreCLR runtime on Windows for ARM64." Write-Host ".\build.cmd -subset clr.runtime -os Windows_NT -arch arm64 -configuration Release" diff --git a/eng/build.sh b/eng/build.sh index 7e7617ee031512..2c96972dc76464 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -17,51 +17,52 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" usage() { echo "Common settings:" - echo " --arch Build platform: x86, x64, arm, armel, arm64 or wasm" - echo " [Default: Your machine's architecture.]" - echo " --binaryLog Output binary log (short: -bl)" - echo " --cross Optional argument to signify cross compilation" - echo " --configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c)" - echo " [Default: Debug]" - echo " --help Print help and exit (short: -h)" - echo " --librariesConfiguration Libraries build configuration: Debug or Release (short: -lc)" - echo " [Default: Debug]" - echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, NetBSD or SunOS" - echo " [Default: Your machine's OS.]" - echo " --projects Project or solution file(s) to build" - echo " --runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked (short: -rc)" - echo " [Default: Debug]" - echo " --subset Build a subset, print available subsets with -subset help (short: -s)" - echo " [Default: Builds the entire repo.]" - echo " --verbosity MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" - echo " [Default: Minimal]" + echo " --arch Build platform: x86, x64, arm, armel, arm64 or wasm." + echo " [Default: Your machine's architecture.]" + echo " --binaryLog (-bl) Output binary log." + echo " --cross Optional argument to signify cross compilation." + echo " --configuration (-c) Build configuration: Debug, Release or [CoreCLR]Checked." + echo " [Default: Debug]" + echo " --help (-h) Print help and exit." + echo " --librariesConfiguration (-lc) Libraries build configuration: Debug or Release." + echo " [Default: Debug]" + echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, NetBSD or SunOS." + echo " [Default: Your machine's OS.]" + echo " --projects Project or solution file(s) to build." + echo " --runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or [CoreCLR]Checked." + echo " [Default: Debug]" + echo " --subset (-s) Build a subset, print available subsets with -subset help." + echo " '--subset' can be omitted if the subset is given as the first argument." + echo " [Default: Builds the entire repo.]" + echo " --verbosity (-v) MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]." + echo " [Default: Minimal]" echo "" echo "Actions (defaults to --restore --build):" - echo " --build Build all source projects (short: -b)" - echo " --clean Clean the solution" - echo " --pack Package build outputs into NuGet packages" - echo " --publish Publish artifacts (e.g. symbols)" - echo " --rebuild Rebuild all source projects" - echo " --restore Restore dependencies (short: -r)" - echo " --sign Sign build outputs" - echo " --test Build and run tests (short: -t)" + echo " --build (-b) Build all source projects." + echo " --clean Clean the solution." + echo " --pack Package build outputs into NuGet packages." + echo " --publish Publish artifacts (e.g. symbols)." + echo " --rebuild Rebuild all source projects." + echo " --restore (-r) Restore dependencies." + echo " --sign Sign build outputs." + echo " --test (-t) Build and run tests." echo "" echo "Libraries settings:" - echo " --allconfigurations Build packages for all build configurations" - echo " --coverage Collect code coverage when testing" - echo " --framework Build framework: net5.0 or net472 (short: -f)" - echo " --testnobuild Skip building tests when invoking -test" - echo " --testscope Test scope, allowed values: innerloop, outerloop, all" + echo " --allconfigurations Build packages for all build configurations." + echo " --coverage Collect code coverage when testing." + echo " --framework (-f) Build framework: net5.0 or net472." + echo " --testnobuild Skip building tests when invoking -test." + echo " --testscope Test scope, allowed values: innerloop, outerloop, all." echo "" echo "Native build settings:" - echo " --clang Optional argument to build using clang in PATH (default)" - echo " --clangx.y Optional argument to build using clang version x.y" + echo " --clang Optional argument to build using clang in PATH (default)." + echo " --clangx.y Optional argument to build using clang version x.y." echo " --cmakeargs User-settable additional arguments passed to CMake." - echo " --gcc Optional argument to build using gcc in PATH (default)" - echo " --gccx.y Optional argument to build using gcc version x.y" + echo " --gcc Optional argument to build using gcc in PATH (default)." + echo " --gccx.y Optional argument to build using gcc version x.y." echo "" echo "Command line arguments starting with '/p:' are passed through to MSBuild." @@ -71,7 +72,7 @@ usage() echo "Here are some quick examples:" echo "" echo "Build CoreCLR on Linux for x64 on release configuration:" - echo "./build.sh --subset clr --os linux --arch x64 --configuration release" + echo "./build.sh clr --os linux --arch x64 --configuration release" echo "" echo "Build Debug libraries with a Release runtime." echo "./build.sh --subset clr+libs --os linux --arch x64 --runtimeConfiguration release" From efd1954cbda771ec5e6ac3faf77602566bbe43fa Mon Sep 17 00:00:00 2001 From: Ivan Diaz Sanchez Date: Wed, 3 Jun 2020 17:48:26 -0700 Subject: [PATCH 4/8] Removed remains of old code. --- eng/build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/eng/build.sh b/eng/build.sh index 2c96972dc76464..15f54628cab3d1 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -145,8 +145,6 @@ while [[ $# > 0 ]]; do if [ -z ${2+x} ]; then showSubsetHelp exit 0 - # arguments="$arguments /p:Subset=help" - # shift 1 else passedSubset="$(echo "$2" | awk '{print tolower($0)}')" if [ $passedSubset == "help" ]; then From 42280b5fbb709aa562699e6487c15486a4244ffe Mon Sep 17 00:00:00 2001 From: Ivan Diaz Sanchez Date: Thu, 4 Jun 2020 18:45:25 -0700 Subject: [PATCH 5/8] Added more examples and rephrased some things for better clarity. --- eng/build.ps1 | 50 +++++++++++++++++++++++++++++++------------- eng/build.sh | 58 ++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 78 insertions(+), 30 deletions(-) diff --git a/eng/build.ps1 b/eng/build.ps1 index 06a77004d02ea8..6c05e31e176d26 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -20,44 +20,55 @@ Param( function Get-Help() { Write-Host "Common settings:" - Write-Host " -arch (-a) Build platform: x86, x64, arm, arm64, or wasm." + Write-Host " -arch (-a) Target platform: x86, x64, arm, arm64, or wasm." Write-Host " Pass a comma-separated list to build for multiple architectures." Write-Host " [Default: Your machine's architecture.]" Write-Host " -binaryLog (-bl) Output binary log." - Write-Host " -configuration (-c) Build configuration: Debug, Release or [CoreCLR]Checked." + Write-Host " -configuration (-c) Build configuration: Debug, Release or Checked." + Write-Host " Checked is exclusive to the CLR subset. Use it for optimized code with asserts and" + Write-Host " the DEBUG flag off." + Write-Host " For non-optimized code with the DEBUG flag on, use the Debug configuration." Write-Host " Pass a comma-separated list to build for multiple configurations." Write-Host " [Default: Debug]" Write-Host " -help (-h) Print help and exit." Write-Host " -librariesConfiguration (-lc) Libraries build configuration: Debug or Release." Write-Host " [Default: Debug]" - Write-Host " -os Build operating system: Windows_NT, Linux, OSX, or Browser." + Write-Host " -os Target operating system: Windows_NT, Linux, OSX, or Browser." Write-Host " [Default: Your machine's OS.]" - Write-Host " -runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or [CoreCLR]Checked." + Write-Host " -runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or Checked." + Write-Host " Checked is exclusive to the CLR runtime. Use it for optimized code with asserts and" + Write-Host " the DEBUG flag off." + Write-Host " For non-optimized code with the DEBUG flag on, use the Debug configuration." Write-Host " [Default: Debug]" Write-Host " -subset (-s) Build a subset, print available subsets with -subset help." Write-Host " '-subset' can be omitted if the subset is given as the first argument." Write-Host " [Default: Builds the entire repo.]" Write-Host " -verbosity (-v) MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]." Write-Host " [Default: Minimal]" - Write-Host " -vs Open the solution with VS using the locally acquired SDK. Path or solution name." + Write-Host " -vs Open the solution with Visual Studio using the locally acquired SDK." + Write-Host " Path or any project or solution name is accepted." Write-Host " (Example: -vs Microsoft.CSharp)" Write-Host "" Write-Host "Actions (defaults to -restore -build):" Write-Host " -build (-b) Build all source projects." + Write-Host " This assumes -restore has been run already." Write-Host " -clean Clean the solution." Write-Host " -pack Package build outputs into NuGet packages." Write-Host " -publish Publish artifacts (e.g. symbols)." + Write-Host " This assumes -build has been run already." Write-Host " -rebuild Rebuild all source projects." Write-Host " -restore Restore dependencies." Write-Host " -sign Sign build outputs." - Write-Host " -test (-t) Build and run tests." + Write-Host " -test (-t) Incrementally builds and runs tests." + Write-Host " Use in conjuction with -testnobuild to only run tests." Write-Host "" Write-Host "Libraries settings:" Write-Host " -allconfigurations Build packages for all build configurations." Write-Host " -coverage Collect code coverage when testing." Write-Host " -framework (-f) Build framework: net5.0 or net472." + Write-Host " [Default: net5.0]" Write-Host " -testnobuild Skip building tests when invoking -test." Write-Host " -testscope Scope tests, allowed values: innerloop, outerloop, all." Write-Host "" @@ -67,16 +78,26 @@ function Get-Help() { Write-Host "(Example: -con for configuration, -t for test, etc.)." Write-Host "" - Write-Host "Here are some quick examples:" + Write-Host "Here are some quick examples. These assume you are on a Windows x64 machine:" Write-Host "" - Write-Host "Build CoreCLR on Windows for x64 on release configuration:" - Write-Host ".\build.cmd clr -os Windows_NT -arch x64 -configuration Release" + Write-Host "* Build CoreCLR for Windows x64 on Release configuration:" + Write-Host ".\build.cmd clr -c release" Write-Host "" - Write-Host "Cross-compile CoreCLR runtime on Windows for ARM64." - Write-Host ".\build.cmd -subset clr.runtime -os Windows_NT -arch arm64 -configuration Release" + Write-Host "* Cross-compile CoreCLR runtime for Windows ARM64 on Release configuration." + Write-Host ".\build.cmd clr.runtime -arch arm64 -c release" Write-Host "" - Write-Host "Build Debug libraries with a Release runtime." - Write-Host ".\build.cmd -subset clr+libs -os Windows_NT -arch x64 -runtimeConfiguration Release" + Write-Host "* Build Debug libraries with a Release runtime for Windows x64." + Write-Host ".\build.cmd clr+libs -rc release" + Write-Host "" + Write-Host "* Build Release libraries and their tests with a Checked runtime for Windows x64, and run the tests." + Write-Host ".\build.cmd clr+libs+libs.tests -rc checked -lc release -test" + Write-Host "" + Write-Host "* Build Mono runtime for Windows x64 on Release configuration." + Write-Host ".\build.cmd mono -c release" + Write-Host "" + Write-Host "It's important to mention that to build Mono for the first time," + Write-Host "you need to build the CLR and Libs subsets beforehand." + Write-Host "This is done automatically if a full build is performed at first." Write-Host "" Write-Host "For more information, check out https://github.com/dotnet/runtime/blob/master/docs/workflow/README.md" } @@ -87,8 +108,7 @@ if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $ } if ($subset -eq 'help') { - $argumentsForHelp = "-restore -build /p:subset=help /clp:nosummary" - Invoke-Expression "& `"$PSScriptRoot/common/build.ps1`" $argumentsForHelp" + Invoke-Expression "& `"$PSScriptRoot/common/build.ps1`" -restore -build /p:subset=help /clp:nosummary" exit 0 } diff --git a/eng/build.sh b/eng/build.sh index 15f54628cab3d1..dc819d5b80288a 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -17,19 +17,26 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" usage() { echo "Common settings:" - echo " --arch Build platform: x86, x64, arm, armel, arm64 or wasm." + echo " --arch Target platform: x86, x64, arm, armel, arm64 or wasm." echo " [Default: Your machine's architecture.]" echo " --binaryLog (-bl) Output binary log." echo " --cross Optional argument to signify cross compilation." - echo " --configuration (-c) Build configuration: Debug, Release or [CoreCLR]Checked." + echo " --configuration (-c) Build configuration: Debug, Release or Checked." + echo " Checked is exclusive to the CLR subset. Use it for optimized code with asserts and" + echo " the DEBUG flag off." + echo " For non-optimized code with the DEBUG flag on, use the Debug configuration." echo " [Default: Debug]" echo " --help (-h) Print help and exit." echo " --librariesConfiguration (-lc) Libraries build configuration: Debug or Release." echo " [Default: Debug]" - echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, NetBSD or SunOS." + echo " --os Target operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android," + echo " Browser, NetBSD or SunOS." echo " [Default: Your machine's OS.]" echo " --projects Project or solution file(s) to build." - echo " --runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or [CoreCLR]Checked." + echo " --runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or Checked." + echo " Checked is exclusive to the CLR runtime. Use it for optimized code with asserts and" + echo " the DEBUG flag off." + echo " For non-optimized code with the DEBUG flag on, use the Debug configuration." echo " [Default: Debug]" echo " --subset (-s) Build a subset, print available subsets with -subset help." echo " '--subset' can be omitted if the subset is given as the first argument." @@ -40,19 +47,23 @@ usage() echo "Actions (defaults to --restore --build):" echo " --build (-b) Build all source projects." + echo " This assumes --restore has been run already." echo " --clean Clean the solution." echo " --pack Package build outputs into NuGet packages." echo " --publish Publish artifacts (e.g. symbols)." + echo " This assumes --build has been run already." echo " --rebuild Rebuild all source projects." echo " --restore (-r) Restore dependencies." echo " --sign Sign build outputs." - echo " --test (-t) Build and run tests." + echo " --test (-t) Incrementally builds and runs tests." + echo " Use in conjuction with --testnobuild to only run tests." echo "" echo "Libraries settings:" echo " --allconfigurations Build packages for all build configurations." echo " --coverage Collect code coverage when testing." echo " --framework (-f) Build framework: net5.0 or net472." + echo " [Default: net5.0]" echo " --testnobuild Skip building tests when invoking -test." echo " --testscope Test scope, allowed values: innerloop, outerloop, all." echo "" @@ -69,21 +80,34 @@ usage() echo "Arguments can also be passed in with a single hyphen." echo "" - echo "Here are some quick examples:" + echo "Here are some quick examples. These assume you are on a Linux x64 machine:" echo "" - echo "Build CoreCLR on Linux for x64 on release configuration:" - echo "./build.sh clr --os linux --arch x64 --configuration release" + echo "* Build CoreCLR for Linux x64 on Release configuration:" + echo "./build.sh clr -c release" echo "" - echo "Build Debug libraries with a Release runtime." - echo "./build.sh --subset clr+libs --os linux --arch x64 --runtimeConfiguration release" + echo "* Build Debug libraries with a Release runtime for Linux x64." + echo "./build.sh clr+libs -rc release" echo "" - echo "Cross-compile CoreCLR runtime on Linux for ARM64." - echo "./build.sh -subset clr.runtime --os linux --arch arm64 --configuration release --cross" + echo "* Build Release libraries and their tests with a Checked runtime for Linux x64, and run the tests." + echo "./build.sh clr+libs+libs.tests -rc checked -lc release -test" echo "" - echo "However, for this last example, you need to already have ROOTFS_DIR set up." + echo "* Build CoreCLR for Linux x64 on Debug configuration using Clang 9." + echo "./build.sh clr -clang9" + echo "" + echo "* Cross-compile CoreCLR runtime for Linux ARM64 on Release configuration." + echo "./build.sh clr.runtime -arch arm64 -c release -cross" + echo "" + echo "However, for this example, you need to already have ROOTFS_DIR set up." echo "Further information on this can be found here:" echo "https://github.com/dotnet/runtime/blob/master/docs/workflow/building/coreclr/linux-instructions.md" echo "" + echo "* Build Mono runtime for Linux x64 on Release configuration." + echo "./build.sh mono -c release" + echo "" + echo "It's important to mention that to build Mono for the first time," + echo "you need to build the CLR and Libs subsets beforehand." + echo "This is done automatically if a full build is performed at first." + echo "" echo "For more general information, check out https://github.com/dotnet/runtime/blob/master/docs/workflow/README.md" } @@ -108,8 +132,7 @@ initDistroRid() showSubsetHelp() { - argumentsForHelp="-restore -build /p:subset=help /clp:nosummary" - "$scriptroot/common/build.sh" $argumentsForHelp + "$scriptroot/common/build.sh" "-restore" "-build" "/p:Subset=help" "/clp:nosummary" } arguments='' @@ -128,6 +151,11 @@ while [[ $# > 0 ]]; do opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" if [[ $firstArgumentChecked -eq 0 && $opt =~ ^[a-zA-Z.+]+$ ]]; then + if [ $opt == "help" ]; then + showSubsetHelp + exit 0 + fi + arguments="$arguments /p:Subset=$1" shift 1 continue From f1987b89f7b8ca0be668da614b999aa8ef8ebda2 Mon Sep 17 00:00:00 2001 From: Ivan Diaz Sanchez Date: Fri, 5 Jun 2020 12:01:31 -0700 Subject: [PATCH 6/8] Added gcc example to build.sh. --- eng/build.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eng/build.sh b/eng/build.sh index dc819d5b80288a..84f9f64a818f86 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -94,6 +94,9 @@ usage() echo "* Build CoreCLR for Linux x64 on Debug configuration using Clang 9." echo "./build.sh clr -clang9" echo "" + echo "* Build CoreCLR for Linux x64 on Debug configuration using GCC 8.4." + echo "./build.sh clr -gcc8.4" + echo "" echo "* Cross-compile CoreCLR runtime for Linux ARM64 on Release configuration." echo "./build.sh clr.runtime -arch arm64 -c release -cross" echo "" From 06015218d78d13918255103eb9150595b14a22c1 Mon Sep 17 00:00:00 2001 From: Ivan Diaz Sanchez Date: Fri, 5 Jun 2020 13:36:25 -0700 Subject: [PATCH 7/8] Corrected definition of the Checked configuration. --- eng/build.ps1 | 10 ++++------ eng/build.sh | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/eng/build.ps1 b/eng/build.ps1 index 6c05e31e176d26..651a17ad820e5e 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -25,9 +25,8 @@ function Get-Help() { Write-Host " [Default: Your machine's architecture.]" Write-Host " -binaryLog (-bl) Output binary log." Write-Host " -configuration (-c) Build configuration: Debug, Release or Checked." - Write-Host " Checked is exclusive to the CLR subset. Use it for optimized code with asserts and" - Write-Host " the DEBUG flag off." - Write-Host " For non-optimized code with the DEBUG flag on, use the Debug configuration." + Write-Host " Checked is exclusive to the CLR subset. It is the same as Debug, except code is" + Write-Host " compiled with optimizations enabled." Write-Host " Pass a comma-separated list to build for multiple configurations." Write-Host " [Default: Debug]" Write-Host " -help (-h) Print help and exit." @@ -36,9 +35,8 @@ function Get-Help() { Write-Host " -os Target operating system: Windows_NT, Linux, OSX, or Browser." Write-Host " [Default: Your machine's OS.]" Write-Host " -runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or Checked." - Write-Host " Checked is exclusive to the CLR runtime. Use it for optimized code with asserts and" - Write-Host " the DEBUG flag off." - Write-Host " For non-optimized code with the DEBUG flag on, use the Debug configuration." + Write-Host " Checked is exclusive to the CLR runtime. It is the same as Debug, except code is" + Write-Host " compiled with optimizations enabled." Write-Host " [Default: Debug]" Write-Host " -subset (-s) Build a subset, print available subsets with -subset help." Write-Host " '-subset' can be omitted if the subset is given as the first argument." diff --git a/eng/build.sh b/eng/build.sh index 84f9f64a818f86..f14d35002d9c89 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -22,9 +22,8 @@ usage() echo " --binaryLog (-bl) Output binary log." echo " --cross Optional argument to signify cross compilation." echo " --configuration (-c) Build configuration: Debug, Release or Checked." - echo " Checked is exclusive to the CLR subset. Use it for optimized code with asserts and" - echo " the DEBUG flag off." - echo " For non-optimized code with the DEBUG flag on, use the Debug configuration." + echo " Checked is exclusive to the CLR subset. It is the same as Debug, except code is" + echo " compiled with optimizations enabled." echo " [Default: Debug]" echo " --help (-h) Print help and exit." echo " --librariesConfiguration (-lc) Libraries build configuration: Debug or Release." @@ -34,9 +33,8 @@ usage() echo " [Default: Your machine's OS.]" echo " --projects Project or solution file(s) to build." echo " --runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or Checked." - echo " Checked is exclusive to the CLR runtime. Use it for optimized code with asserts and" - echo " the DEBUG flag off." - echo " For non-optimized code with the DEBUG flag on, use the Debug configuration." + echo " Checked is exclusive to the CLR runtime. It is the same as Debug, except code is" + echo " compiled with optimizations enabled." echo " [Default: Debug]" echo " --subset (-s) Build a subset, print available subsets with -subset help." echo " '--subset' can be omitted if the subset is given as the first argument." From eb5fa4245c07fc223143275ac4150bb9b49eeac9 Mon Sep 17 00:00:00 2001 From: Ivan Diaz Sanchez Date: Mon, 8 Jun 2020 13:04:51 -0700 Subject: [PATCH 8/8] Added --clangx to build.sh --- eng/build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/build.sh b/eng/build.sh index f14d35002d9c89..442702f9df3655 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -68,7 +68,8 @@ usage() echo "Native build settings:" echo " --clang Optional argument to build using clang in PATH (default)." - echo " --clangx.y Optional argument to build using clang version x.y." + echo " --clangx Optional argument to build using clang version x (used for Clang 7 and newer)." + echo " --clangx.y Optional argument to build using clang version x.y (used for Clang 6 and older)." echo " --cmakeargs User-settable additional arguments passed to CMake." echo " --gcc Optional argument to build using gcc in PATH (default)." echo " --gccx.y Optional argument to build using gcc version x.y."