ninja: support disabling parallel building

but keep it enabled by default
This commit is contained in:
Orivej Desh 2017-12-04 15:15:58 +00:00
parent 9f8ec7e4d3
commit 2c7cd2455e

View File

@ -4,9 +4,16 @@ ninjaBuildPhase() {
if [[ -z "$ninjaFlags" && ! ( -e build.ninja ) ]]; then
echo "no build.ninja, doing nothing"
else
local buildCores=1
# Parallel building is enabled by default.
if [ "${enableParallelBuilding-1}" ]; then
buildCores="$NIX_BUILD_CORES"
fi
# shellcheck disable=SC2086
local flagsArray=( \
${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} \
-j"$buildCores" -l"$NIX_BUILD_CORES" \
$ninjaFlags "${ninjaFlagsArray[@]}" \
$buildFlags "${buildFlagsArray[@]}")