From aec39c38f8ed9e10e61679a0d7f7cdbd949e302c Mon Sep 17 00:00:00 2001 From: Simeon Anfinrud Date: Fri, 20 Jan 2023 00:37:41 +0000 Subject: [PATCH] (Reland) Detect RBE builds and accelerate them. Chromecast builds use a buildflag called `use_rbe` instead of `use_remoteexec` or `use_goma`. Previous attempt at crrev.com/c/4144469 tried recycling the use_remoteexec variable for the use_rbe case, but that caused problems with Cast CI because it would hit the error case where the reclient binary isn't found. This new attempt introduces a new dedicated use_rbe variable that skips that check intended only for use_remoteexec. Bug: b/266099996 Test: run `autoninja` in the chromecast internal repo Change-Id: Ieaf3af709589fe1b8611904afc2fd80284b333b8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4179133 Auto-Submit: Simeon Anfinrud Commit-Queue: Bruce Dawson Reviewed-by: Bruce Dawson --- autoninja.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/autoninja.py b/autoninja.py index 661f1444d0..6418fccafb 100755 --- a/autoninja.py +++ b/autoninja.py @@ -66,6 +66,7 @@ def main(args): use_goma = False use_remoteexec = False + use_rbe = False # Currently get reclient binary and config dirs relative to output_dir. If # they exist and using remoteexec, then automatically call bootstrap to start @@ -82,7 +83,7 @@ def main(args): if os.path.exists(os.path.join(output_dir, 'args.gn')): with open(os.path.join(output_dir, 'args.gn')) as file_handle: for line in file_handle: - # Either use_goma or use_remoteexec will activate build acceleration. + # use_goma, use_remoteexec, or use_rbe will activate build acceleration. # # This test can match multi-argument lines. Examples of this are: # is_debug=false use_goma=true is_official_build=false @@ -98,6 +99,10 @@ def main(args): line_without_comment): use_remoteexec = True continue + if re.search(r'(^|\s)(use_rbe)\s*=\s*true($|\s)', line_without_comment): + use_rbe = True + continue + else: for relative_path in [ '', # GN keeps them in the root of output_dir @@ -184,7 +189,7 @@ def main(args): num_cores = multiprocessing.cpu_count() if not j_specified and not t_specified: - if use_goma or use_remoteexec: + if use_goma or use_remoteexec or use_rbe: args.append('-j') default_core_multiplier = 80 if platform.machine() in ('x86_64', 'AMD64'):