0

gn bootstrap: Allow specifying ninja binary with $NINJA

This allows the builder to specify the path of the ninja binary in
case they want to use a specific version, or an alternate
implementation like samurai[0].

Also, when calling ninja, make sure build target comes after any
options.

[0] https://github.com/michaelforney/samurai

Change-Id: I4295baa9e0e04e61ae092a9b86ea6ddc943b3c92
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1975453
Reviewed-by: Nico Weber <thakis@chromium.org>
Auto-Submit: Michael Forney <mforney@mforney.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726552}
This commit is contained in:
Michael Forney
2019-12-19 22:21:56 +00:00
committed by Commit Bot
parent 483274d81d
commit 53b414cba1
2 changed files with 4 additions and 2 deletions
AUTHORS
tools/gn/bootstrap

@@ -627,6 +627,7 @@ Md. Hasanur Rashid <hasanur.r@samsung.com>
Md Jobed Hossain <jrony15@gmail.com>
Md Sami Uddin <md.sami@samsung.com>
Michael Cirone <mikecirone@gmail.com>
Michael Forney <mforney@mforney.org>
Michael Gilbert <floppymaster@gmail.com>
Michael Lopez <lopes92290@gmail.com>
Michael Morrison <codebythepound@gmail.com>

@@ -70,6 +70,7 @@ def main(argv):
out_dir = os.path.join(SRC_ROOT, build_rel)
gn_path = options.output or os.path.join(out_dir, 'gn')
gn_build_dir = os.path.join(out_dir, 'gn_build')
ninja_binary = os.environ.get('NINJA', 'ninja')
# TODO(thomasanderson): Remove this once Ubuntu Trusty reaches EOL, or when
# Chromium's infrastructure is upgraded from Trusty to Xenial, whichever comes
@@ -90,7 +91,7 @@ def main(argv):
os.environ.get('CFLAGS', '').split() +
os.environ.get('CXXFLAGS', '').split()),
]) + '\n')
subprocess.check_call(['ninja', '-C', libcxx_dir])
subprocess.check_call([ninja_binary, '-C', libcxx_dir])
shutil.copy2(os.path.join(gn_build_dir, 'libc++.gn.so'), out_dir)
def append_to_env(var, vals):
@@ -120,7 +121,7 @@ def main(argv):
shutil.copy2(
os.path.join(BOOTSTRAP_DIR, 'last_commit_position.h'), gn_build_dir)
subprocess.check_call(
['ninja', '-C', gn_build_dir, 'gn', '-w', 'dupbuild=err'])
[ninja_binary, '-C', gn_build_dir, '-w', 'dupbuild=err', 'gn'])
shutil.copy2(os.path.join(gn_build_dir, 'gn'), gn_path)
if not options.skip_generate_buildfiles: