Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 5.6k
Default to ninja for faster builds (mac & linux)#124041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
968f944c98f1b9f8a3e5523add9a93dfc63ec35a19d1b144746558501d102aaFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -84,7 +84,7 @@ usage() | ||
| echo " --gccx.y Optional argument to build using gcc version x.y." | ||
| echo " --portablebuild Optional argument: set to false to force a non-portable build." | ||
| echo " --keepnativesymbols Optional argument: set to true to keep native symbols/debuginfo in generated binaries." | ||
| echo " --ninja Optional argument: set to true to use Ninja instead of Make to run the native build." | ||
| echo " --ninja Optional argument: use Ninja instead of Make (default: true, use --ninja false to disable)." | ||
| echo " --pgoinstrument Optional argument: build PGO-instrumented runtime" | ||
| echo " --fsanitize Optional argument: Specify native sanitizers to instrument the native build with. Supported values are: 'address'." | ||
| echo "" | ||
| @@ -166,6 +166,9 @@ source $scriptroot/common/native/init-os-and-arch.sh | ||
| hostArch=$arch | ||
| # Default to using Ninja for faster builds (can be overridden with --ninja false) | ||
| useNinja=true | ||
steveisok marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # Check if an action is passed in | ||
| declare -a actions=("b" "build" "r" "restore" "rebuild" "testnobuild" "sign" "publish" "clean") | ||
| actInt=($(comm -12 <(printf '%s\n' "${actions[@]/#/-}" | sort) <(printf '%s\n' "${@/#--/-}" | sort))) | ||
| @@ -496,20 +499,17 @@ while [[ $# -gt 0 ]]; do | ||
| -ninja) | ||
| if [ -z ${2+x} ]; then | ||
| arguments+=("/p:Ninja=true") | ||
| if [ -z ${2+x} ] || [[ "$2" == -* ]]; then | ||
| useNinja=true | ||
| shift 1 | ||
| else | ||
| ninja="$(echo "$2" | tr "[:upper:]" "[:lower:]")" | ||
| if [ "$ninja" = true ]; then | ||
| arguments+=("/p:Ninja=true") | ||
| shift 2 | ||
| elif [ "$ninja" = false ]; then | ||
| shift 2 | ||
| if [ "$ninja" = false ]; then | ||
| arguments+=("/p:Ninja=false") | ||
| shift 2 | ||
| useNinja=false | ||
| else | ||
| arguments+=("/p:Ninja=true") | ||
| shift 1 | ||
| useNinja=true | ||
| fi | ||
| fi | ||
steveisok marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ;; | ||
steveisok marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| @@ -582,6 +582,11 @@ arguments+=("-tl:false") | ||
| # disable line wrapping so that C&P from the console works well | ||
| arguments+=("-clp:ForceNoAlign") | ||
| # Apply ninja setting | ||
| if [[ "$useNinja" == true ]]; then | ||
| arguments+=("/p:Ninja=true") | ||
steveisok marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| fi | ||
| initDistroRid "$os" "$arch" "$crossBuild" | ||
| # Disable targeting pack caching as we reference a partially constructed targeting pack and update it later. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -217,8 +217,8 @@ build_native() | ||
| pushd "$intermediatesDir" | ||
| buildTool="$SCAN_BUILD_COMMAND -o $__BinDir/scan-build-log $buildTool" | ||
| echo "Executing $buildTool $target -j $__NumProc" | ||
| "$buildTool" $target -j "$__NumProc" | ||
| echo "Executing $buildTool -j $__NumProc $target" | ||
| "$buildTool" -j "$__NumProc" $target | ||
| exit_code="$?" | ||
steveisok marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| popd | ||
| @@ -234,8 +234,8 @@ build_native() | ||
| # multiple targets. Instead, directly invoke the build tool to build multiple targets in one invocation. | ||
| pushd "$intermediatesDir" | ||
| echo "Executing $buildTool $target -j $__NumProc" | ||
| "$buildTool" $target -j "$__NumProc" | ||
| echo "Executing $buildTool -j $__NumProc $target" | ||
| "$buildTool" -j "$__NumProc" $target | ||
| exit_code="$?" | ||
| popd | ||
| @@ -271,7 +271,7 @@ usage() | ||
| echo " will use ROOTFS_DIR environment variable if set." | ||
| echo "-gcc: optional argument to build using gcc in PATH." | ||
| echo "-gccx.y: optional argument to build using gcc version x.y." | ||
| echo "-ninja: target ninja instead of GNU make" | ||
| echo "-ninja: target ninja instead of GNU make (default: true, use -ninja false to disable)" | ||
| echo "-numproc: set the number of build processes." | ||
| echo "-targetrid: optional argument that overrides the target rid name." | ||
| echo "-portablebuild: pass -portablebuild=false to force a non-portable build." | ||
| @@ -311,6 +311,9 @@ else | ||
| __NumProc=1 | ||
| fi | ||
| # Default to using Ninja for faster builds | ||
| __UseNinja=1 | ||
steveisok marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. steveisok marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| while :; do | ||
| if [[ "$#" -le 0 ]]; then | ||
| break | ||
| @@ -412,7 +415,17 @@ while :; do | ||
| ;; | ||
| ninja|-ninja) | ||
| __UseNinja=1 | ||
| if [[ -z "${2+x}" ]] || [[ "$2" == -* ]]; then | ||
| __UseNinja=1 | ||
| else | ||
| ninja_arg="$(echo "$2" | tr "[:upper:]" "[:lower:]")" | ||
| if [[ "$ninja_arg" == "false" ]]; then | ||
| __UseNinja=0 | ||
| else | ||
| __UseNinja=1 | ||
| fi | ||
| shift | ||
| fi | ||
| ;; | ||
| numproc|-numproc) | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.