Skip to content

Commit 23add9a

Browse files
committed
Default to ninja for faster builds
Require ninja by default for a predictable build experience on Unix platforms. Users can opt out with --ninja false. Contributes to #54022
1 parent f8a3e55 commit 23add9a

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

eng/build.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ usage()
8484
echo " --gccx.y Optional argument to build using gcc version x.y."
8585
echo " --portablebuild Optional argument: set to false to force a non-portable build."
8686
echo " --keepnativesymbols Optional argument: set to true to keep native symbols/debuginfo in generated binaries."
87-
echo " --ninja Optional argument: use Ninja instead of Make (default: true if ninja is installed, use --ninja false to disable)."
87+
echo " --ninja Optional argument: use Ninja instead of Make (default: true, use --ninja false to disable)."
8888
echo " --pgoinstrument Optional argument: build PGO-instrumented runtime"
8989
echo " --fsanitize Optional argument: Specify native sanitizers to instrument the native build with. Supported values are: 'address'."
9090
echo ""
@@ -166,12 +166,8 @@ source $scriptroot/common/native/init-os-and-arch.sh
166166

167167
hostArch=$arch
168168

169-
# Default to using Ninja if installed for faster builds (can be overridden with --ninja false)
170-
if command -v ninja &> /dev/null; then
171-
useNinja=true
172-
else
173-
useNinja=false
174-
fi
169+
# Default to using Ninja for faster builds (can be overridden with --ninja false)
170+
useNinja=true
175171

176172
# Check if an action is passed in
177173
declare -a actions=("b" "build" "r" "restore" "rebuild" "testnobuild" "sign" "publish" "clean")

eng/native/build-commons.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ usage()
271271
echo " will use ROOTFS_DIR environment variable if set."
272272
echo "-gcc: optional argument to build using gcc in PATH."
273273
echo "-gccx.y: optional argument to build using gcc version x.y."
274-
echo "-ninja: target ninja instead of GNU make (default on macOS, use -ninja false to disable)"
274+
echo "-ninja: target ninja instead of GNU make (default: true, use -ninja false to disable)"
275275
echo "-numproc: set the number of build processes."
276276
echo "-targetrid: optional argument that overrides the target rid name."
277277
echo "-portablebuild: pass -portablebuild=false to force a non-portable build."
@@ -311,11 +311,8 @@ else
311311
__NumProc=1
312312
fi
313313

314-
# Default to using Ninja on macOS for faster builds
315-
__UseNinja=0
316-
if [[ "$os" == "osx" ]]; then
317-
__UseNinja=1
318-
fi
314+
# Default to using Ninja for faster builds
315+
__UseNinja=1
319316

320317
while :; do
321318
if [[ "$#" -le 0 ]]; then

0 commit comments

Comments
 (0)