mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
autoninja: use build/toolchain/remoteexec_defaults.gni for use_reclient
Instead of using build/toolchain/use_reclient_value.py in both autoninja and gn, use build/toolchain/remoteexec_defaults.gni to set default value for use_reclient (on siso or on ninja). Bug: 397994249 Change-Id: Ia4302fe8794218d485e52ca38f8523453814a6b9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6301378 Reviewed-by: Andrew Grieve <agrieve@chromium.org> Commit-Queue: Fumitoshi Ukai <ukai@google.com> Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
This commit is contained in:
47
autoninja.py
47
autoninja.py
@@ -138,27 +138,27 @@ def _print_cmd(cmd):
|
||||
print(*[shell_quoter(arg) for arg in cmd], file=sys.stderr)
|
||||
|
||||
|
||||
def _get_use_reclient_value(output_dir):
|
||||
def _get_remoteexec_defaults():
|
||||
root_dir = gclient_paths.GetPrimarySolutionPath()
|
||||
if not root_dir:
|
||||
return None
|
||||
script_path = os.path.join(root_dir,
|
||||
"build/toolchain/use_reclient_value.py")
|
||||
if not os.path.exists(script_path):
|
||||
return None
|
||||
|
||||
script = _import_from_path("use_reclient_value", script_path)
|
||||
try:
|
||||
r = script.use_reclient_value(output_dir)
|
||||
except:
|
||||
raise RuntimeError(
|
||||
'Could not call method "use_reclient_value" in {}"'.format(
|
||||
script_path))
|
||||
if not isinstance(r, bool):
|
||||
raise TypeError(
|
||||
'Method "use_reclient_defualt" in "{}" returns invalid result. Expected bool, got "{}" (type "{}")'
|
||||
.format(script_path, r, type(r)))
|
||||
return r
|
||||
default_file = os.path.join(root_dir,
|
||||
"build/toolchain/remoteexec_defaults.gni")
|
||||
values = {
|
||||
"use_reclient_on_siso": True,
|
||||
"use_reclient_on_ninja": True,
|
||||
}
|
||||
if not os.path.exists(default_file):
|
||||
return values
|
||||
pattern = re.compile(r"(^|\s*)([^=\s]*)\s*=\s*(\S*)\s*$")
|
||||
with open(default_file, encoding="utf-8") as f:
|
||||
for line in f:
|
||||
line = line.split("#")[0]
|
||||
m = pattern.match(line)
|
||||
if not m:
|
||||
continue
|
||||
values[m.group(2)] = m.group(3) == "true"
|
||||
return values
|
||||
|
||||
|
||||
def _siso_supported(output_dir):
|
||||
@@ -251,7 +251,7 @@ def _main_inner(input_args, build_id, should_collect_logs=False):
|
||||
print(file=sys.stderr)
|
||||
|
||||
use_remoteexec = False
|
||||
use_reclient = _get_use_reclient_value(output_dir)
|
||||
use_reclient = None
|
||||
use_android_build_server = False
|
||||
use_siso = None
|
||||
|
||||
@@ -293,7 +293,14 @@ def _main_inner(input_args, build_id, should_collect_logs=False):
|
||||
use_siso = _get_use_siso_default(output_dir)
|
||||
|
||||
if use_reclient is None:
|
||||
use_reclient = use_remoteexec
|
||||
if os.path.exists(os.path.join(output_dir, ".reproxy_tmp")):
|
||||
use_reclient = True
|
||||
elif use_remoteexec:
|
||||
values = _get_remoteexec_defaults()
|
||||
if use_siso:
|
||||
use_reclient = values["use_reclient_on_siso"]
|
||||
else:
|
||||
use_reclient = values["use_reclient_on_ninja"]
|
||||
|
||||
if use_remoteexec:
|
||||
if use_reclient:
|
||||
|
||||
Reference in New Issue
Block a user