orderfile_generator_backend: add --ninja-path and --ninja-j
orderfile_generator_backend used autoninja, but autoninja
doesn't work well with reclient on builders, because
builders don't have reproxy.cfg and don't need to manage
reproxy in autoninja.
add --ninja-path to specify ninja binary path to use
instead of autoninja on builder.
also add --ninja-j to specify -j for ninja.
recipes will pass these values to use ninja on builders.
Bug: 1412531
Change-Id: Ia65e9a28fc31c4e124298307b8e9822f60412f6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4238256
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Egor Pasko <pasko@chromium.org>
Commit-Queue: Benoit Lize <lizeb@chromium.org>
Reviewed-by: Benoit Lize <lizeb@chromium.org>
Auto-Submit: Fumitoshi Ukai <ukai@google.com>
Cr-Commit-Position: refs/heads/main@{#1104431}
diff --git a/tools/cygprofile/orderfile_generator_backend.py b/tools/cygprofile/orderfile_generator_backend.py
index 17abc57..848ca53 100755
--- a/tools/cygprofile/orderfile_generator_backend.py
+++ b/tools/cygprofile/orderfile_generator_backend.py
@@ -238,8 +238,8 @@
"""Handles compilation of clank."""
def __init__(self, out_dir, step_recorder, arch, use_goma, goma_dir,
- use_remoteexec, system_health_profiling, monochrome, public,
- orderfile_location):
+ use_remoteexec, ninja_command, system_health_profiling,
+ monochrome, public, orderfile_location):
self._out_dir = out_dir
self._step_recorder = step_recorder
self._arch = arch
@@ -247,6 +247,7 @@
self._use_goma = use_goma
self._goma_dir = goma_dir
self._use_remoteexec = use_remoteexec
+ self._ninja_command = ninja_command
self._system_health_profiling = system_health_profiling
self._public = public
self._orderfile_location = orderfile_location
@@ -313,8 +314,7 @@
'--args=' + ' '.join(args)])
self._step_recorder.RunCommand(
- ['autoninja', '-C',
- os.path.join(self._out_dir, 'Release'), target])
+ self._ninja_command + [os.path.join(self._out_dir, 'Release'), target])
def ForceRelink(self):
"""Forces libchrome.so or libmonochrome.so to be re-linked.
@@ -542,6 +542,12 @@
def __init__(self, options, orderfile_updater_class):
self._options = options
+ self._ninja_command = ['autoninja']
+ if self._options.ninja_path:
+ self._ninja_command = [self._options.ninja_path]
+ if self._options.ninja_j:
+ self._ninja_command += ['-j', self._options.ninja_j]
+ self._ninja_command += ['-C']
self._instrumented_out_dir = os.path.join(
self._BUILD_ROOT, self._options.arch + '_instrumented_out')
if self._options.use_call_graph:
@@ -908,6 +914,7 @@
self._options.arch, self._options.use_goma,
self._options.goma_dir,
self._options.use_remoteexec,
+ self._ninja_command,
self._options.system_health_orderfile,
self._monochrome, self._options.public,
self._GetPathToOrderfile())
@@ -955,8 +962,9 @@
self._compiler = ClankCompiler(
self._instrumented_out_dir, self._step_recorder, self._options.arch,
self._options.use_goma, self._options.goma_dir,
- self._options.use_remoteexec, self._options.system_health_orderfile,
- self._monochrome, self._options.public, self._GetPathToOrderfile())
+ self._options.use_remoteexec, self._ninja_command,
+ self._options.system_health_orderfile, self._monochrome,
+ self._options.public, self._GetPathToOrderfile())
if not self._options.pregenerated_profiles:
# If there are pregenerated profiles, the instrumented build should
# not be changed to avoid invalidating the pregenerated profile
@@ -993,8 +1001,9 @@
self._compiler = ClankCompiler(
self._uninstrumented_out_dir, self._step_recorder,
self._options.arch, self._options.use_goma, self._options.goma_dir,
- self._options.use_remoteexec, self._options.system_health_orderfile,
- self._monochrome, self._options.public, self._GetPathToOrderfile())
+ self._options.use_remoteexec, self._ninja_command,
+ self._options.system_health_orderfile, self._monochrome,
+ self._options.public, self._GetPathToOrderfile())
self._compiler.CompileLibchrome(instrumented=False,
use_call_graph=False)
@@ -1079,8 +1088,15 @@
'--use-goma', action='store_true', help='Enable GOMA.', default=False)
parser.add_argument('--use-remoteexec',
action='store_true',
- help='Enable remoteexec.',
+ help='Enable remoteexec. see //build/toolchain/rbe.gni.',
default=False)
+ parser.add_argument('--ninja-path',
+ help='Path to the ninja binary. If given, use this'
+ 'instead of autoninja.')
+ parser.add_argument('--ninja-j',
+ help='-j value passed to ninja.'
+ 'pass -j to ninja. no need to set this when '
+ '--ninja-path is not specified.')
parser.add_argument('--adb-path', help='Path to the adb binary.')
parser.add_argument('--public',