Teach autoninja to handle siso/autosiso

autoninja is intended to mean "build this directory, don't bother me
with the details". As we transition to siso it is therefore appropriate
that it should take on the duty of deciding whether to invoke ninja or
siso.

By looking for a use_siso gn arg autoninja can easily do this.

This change relies on crrev.com/c/4753433 to add the use_siso gn arg.

This change also teaches autoninja to detect if a user switches
between siso and ninja without doing a gn clean inbetween.

Note that this change also teaches autoninja to invoke autosiso or
siso ninja based on whether use_remoteexec is true.

Bug: b/293657720
Change-Id: I3ad36a81857e75ffe6babc4f107b777e733a285b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4749722
Reviewed-by: Philipp Wollermann <philwo@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
changes/22/4749722/8
Bruce Dawson 2 years ago committed by LUCI CQ
parent 07289ce941
commit 5a4c350ee9

@ -62,12 +62,10 @@ def main(args):
file=sys.stderr)
print(file=sys.stderr)
# Strip -o/--offline so ninja doesn't see them.
input_args = [arg for arg in input_args if arg not in ('-o', '--offline')]
use_goma = False
use_remoteexec = False
use_rbe = False
use_siso = False
# Attempt to auto-detect remote build acceleration. We support gn-based
# builds, where we look for args.gn in the build tree, and cmake-based builds
@ -94,6 +92,27 @@ def main(args):
if re.search(r'(^|\s)(use_rbe)\s*=\s*true($|\s)', line_without_comment):
use_rbe = True
continue
if re.search(r'(^|\s)(use_siso)\s*=\s*true($|\s)',
line_without_comment):
use_siso = True
continue
if use_siso:
ninja_marker = os.path.join(output_dir, '.ninja_deps')
if os.path.exists(ninja_marker):
return ('echo Run gn clean before switching from ninja to siso in %s' %
output_dir)
siso = ['autosiso'] if use_remoteexec else ['siso', 'ninja']
if sys.platform.startswith('win'):
# An explicit 'call' is needed to make sure the invocation of autosiso
# returns to autoninja.bat, and the command prompt title gets reset.
siso = ['call'] + siso
return ' '.join(siso + input_args[1:])
siso_marker = os.path.join(output_dir, '.siso_deps')
if os.path.exists(siso_marker):
return ('echo Run gn clean before switching from siso to ninja in %s' %
output_dir)
else:
for relative_path in [
@ -108,6 +127,9 @@ def main(args):
use_goma = True
break
# Strip -o/--offline so ninja doesn't see them.
input_args = [arg for arg in input_args if arg not in ('-o', '--offline')]
# If GOMA_DISABLED is set to "true", "t", "yes", "y", or "1"
# (case-insensitive) then gomacc will use the local compiler instead of doing
# a goma compile. This is convenient if you want to briefly disable goma. It

Loading…
Cancel
Save