Skip to content

Commit

Permalink
gn bootstrap: Allow specifying ninja binary with $NINJA
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
michaelforney authored and Commit Bot committed Dec 19, 2019
1 parent 483274d commit 53b414c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 3 additions & 2 deletions tools/gn/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -120,7 +121,7 @@ def append_to_env(var, vals):
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:
Expand Down

0 comments on commit 53b414c

Please sign in to comment.