|
|
|
@ -230,7 +230,7 @@ def _main_inner(input_args, build_id, should_collect_logs=False):
|
|
|
|
|
os.environ.setdefault("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")
|
|
|
|
|
# The -t tools are incompatible with -j
|
|
|
|
|
t_specified = False
|
|
|
|
|
j_specified = False
|
|
|
|
|
j_value = None
|
|
|
|
|
offline = False
|
|
|
|
|
output_dir = "."
|
|
|
|
|
summarize_build = os.environ.get("NINJA_SUMMARIZE_BUILD") == "1"
|
|
|
|
@ -240,7 +240,10 @@ def _main_inner(input_args, build_id, should_collect_logs=False):
|
|
|
|
|
# To leave non supported parameters untouched, we do not use getopt.
|
|
|
|
|
for index, arg in enumerate(input_args[1:]):
|
|
|
|
|
if arg.startswith("-j"):
|
|
|
|
|
j_specified = True
|
|
|
|
|
if arg == "-j":
|
|
|
|
|
j_value = input_args[index + 2]
|
|
|
|
|
else:
|
|
|
|
|
j_value = arg[2:]
|
|
|
|
|
if arg.startswith("-t"):
|
|
|
|
|
t_specified = True
|
|
|
|
|
if arg == "-C":
|
|
|
|
@ -406,14 +409,57 @@ def _main_inner(input_args, build_id, should_collect_logs=False):
|
|
|
|
|
)
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
|
|
if j_value:
|
|
|
|
|
local_jobs = None
|
|
|
|
|
remote_jobs = None
|
|
|
|
|
if use_remoteexec:
|
|
|
|
|
remote_jobs = j_value
|
|
|
|
|
else:
|
|
|
|
|
num_cpus = multiprocessing.cpu_count()
|
|
|
|
|
if int(j_value) <= num_cpus:
|
|
|
|
|
local_jobs = j_value
|
|
|
|
|
else:
|
|
|
|
|
print(
|
|
|
|
|
"WARNING: Ignoring -j %s because it is larger than "
|
|
|
|
|
"num_cpus=%d. Use -local_jobs=%s instead if it's intentional."
|
|
|
|
|
% (j_value, num_cpus, j_value),
|
|
|
|
|
file=sys.stderr,
|
|
|
|
|
)
|
|
|
|
|
# replace -j with -local_jobs,-remote_jobs.
|
|
|
|
|
_args = []
|
|
|
|
|
j_value_index = None
|
|
|
|
|
for i in range(len(input_args)):
|
|
|
|
|
arg = input_args[i]
|
|
|
|
|
if arg.startswith('-j'):
|
|
|
|
|
if arg == '-j':
|
|
|
|
|
j_value_index = i + 1
|
|
|
|
|
if local_jobs:
|
|
|
|
|
_args.extend(['-local_jobs=' + local_jobs])
|
|
|
|
|
if remote_jobs:
|
|
|
|
|
_args.extend(['-remote_jobs=' + remote_jobs])
|
|
|
|
|
continue
|
|
|
|
|
if i == j_value_index:
|
|
|
|
|
continue
|
|
|
|
|
_args.append(arg)
|
|
|
|
|
input_args = _args
|
|
|
|
|
|
|
|
|
|
# Build ID consistently used in other tools. e.g. Reclient, ninjalog.
|
|
|
|
|
os.environ.setdefault("SISO_BUILD_ID", build_id)
|
|
|
|
|
with android_build_server_helper.build_server_context(
|
|
|
|
|
build_id,
|
|
|
|
|
output_dir,
|
|
|
|
|
use_android_build_server=use_android_build_server):
|
|
|
|
|
|
|
|
|
|
def run_siso(args):
|
|
|
|
|
if summarize_build:
|
|
|
|
|
# Print the command-line to reassure the user that the right
|
|
|
|
|
# settings are being used.
|
|
|
|
|
_print_cmd(args)
|
|
|
|
|
return siso.main(args)
|
|
|
|
|
if use_remoteexec:
|
|
|
|
|
if use_reclient and not t_specified:
|
|
|
|
|
# TODO: crbug.com/379584977 - Remove siso/reclient
|
|
|
|
|
# integration.
|
|
|
|
|
return reclient_helper.run_siso(
|
|
|
|
|
[
|
|
|
|
|
'siso',
|
|
|
|
@ -423,15 +469,15 @@ def _main_inner(input_args, build_id, should_collect_logs=False):
|
|
|
|
|
'-reapi_instance=',
|
|
|
|
|
] + input_args[1:],
|
|
|
|
|
should_collect_logs)
|
|
|
|
|
return siso.main(["siso", "ninja"] + input_args[1:])
|
|
|
|
|
return run_siso(["siso", "ninja"] + input_args[1:])
|
|
|
|
|
if not project:
|
|
|
|
|
project = _siso_rbe_project()
|
|
|
|
|
if not t_specified and project and not offline:
|
|
|
|
|
print(
|
|
|
|
|
'Missing "use_remoteexec=true". No remote execution',
|
|
|
|
|
'WARNING: Missing "use_remoteexec=true". No remote execution',
|
|
|
|
|
file=sys.stderr,
|
|
|
|
|
)
|
|
|
|
|
return siso.main(["siso", "ninja", "--offline"] + input_args[1:])
|
|
|
|
|
return run_siso(["siso", "ninja", "--offline"] + input_args[1:])
|
|
|
|
|
|
|
|
|
|
if os.path.exists(siso_marker):
|
|
|
|
|
print(
|
|
|
|
@ -475,7 +521,7 @@ def _main_inner(input_args, build_id, should_collect_logs=False):
|
|
|
|
|
|
|
|
|
|
ninja_args = ['ninja']
|
|
|
|
|
num_cores = multiprocessing.cpu_count()
|
|
|
|
|
if not j_specified and not t_specified:
|
|
|
|
|
if not j_value and not t_specified:
|
|
|
|
|
if not offline and use_remoteexec:
|
|
|
|
|
ninja_args.append("-j")
|
|
|
|
|
default_core_multiplier = 80
|
|
|
|
|