Merge pull request #18284 from Homebrew/ninja-parallelism
This commit is contained in:
commit
1ac73f44d8
@ -75,6 +75,7 @@ module Superenv
|
||||
self["HOMEBREW_TEMP"] = HOMEBREW_TEMP.to_s
|
||||
self["HOMEBREW_OPTFLAGS"] = determine_optflags
|
||||
self["HOMEBREW_ARCHFLAGS"] = ""
|
||||
self["HOMEBREW_MAKE_JOBS"] = determine_make_jobs.to_s
|
||||
self["CMAKE_PREFIX_PATH"] = determine_cmake_prefix_path
|
||||
self["CMAKE_FRAMEWORK_PATH"] = determine_cmake_frameworks_path
|
||||
self["CMAKE_INCLUDE_PATH"] = determine_cmake_include_path
|
||||
@ -313,16 +314,19 @@ module Superenv
|
||||
# When passed a block, MAKEFLAGS is removed only for the duration of the block and is restored after its completion.
|
||||
sig { params(block: T.nilable(T.proc.returns(T.untyped))).returns(T.untyped) }
|
||||
def deparallelize(&block)
|
||||
old = delete("MAKEFLAGS")
|
||||
old_makeflags = delete("MAKEFLAGS")
|
||||
old_make_jobs = delete("HOMEBREW_MAKE_JOBS")
|
||||
self["HOMEBREW_MAKE_JOBS"] = "1"
|
||||
if block
|
||||
begin
|
||||
yield
|
||||
ensure
|
||||
self["MAKEFLAGS"] = old
|
||||
self["MAKEFLAGS"] = old_makeflags
|
||||
self["HOMEBREW_MAKE_JOBS"] = old_make_jobs
|
||||
end
|
||||
end
|
||||
|
||||
old
|
||||
old_makeflags
|
||||
end
|
||||
|
||||
sig { returns(Integer) }
|
||||
|
@ -11,9 +11,15 @@ fi
|
||||
|
||||
source "${HOMEBREW_LIBRARY}/Homebrew/shims/utils.sh"
|
||||
|
||||
parallel_args=()
|
||||
if [[ -n "${HOMEBREW_MAKE_JOBS}" ]]
|
||||
then
|
||||
parallel_args+=(-j "${HOMEBREW_MAKE_JOBS}")
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
export HOMEBREW_CCCFG="O${HOMEBREW_CCCFG}"
|
||||
try_exec_non_system "ninja" "$@"
|
||||
try_exec_non_system "ninja" "${parallel_args[@]}" "$@"
|
||||
|
||||
echo "ninja: Shim failed to find ninja in PATH."
|
||||
exit 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user