From 48fcabef4c8a23dc6e375a03ba8ecdc5dce62185 Mon Sep 17 00:00:00 2001 From: Junji Watanabe Date: Fri, 21 Apr 2023 01:28:51 +0000 Subject: [PATCH] [autosiso] suggest using siso command direclty for non build commands `autosiso` doesn't handle non build commands. e.g. help, version, login We should encourage users to use `siso` command directly, and get rid of `autosiso` eventually at some point. Bug: b/278675516 Change-Id: I651e537d8d03674f5d1996983083e25ab5d149c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4452374 Reviewed-by: Takuto Ikuta Reviewed-by: Fumitoshi Ukai Commit-Queue: Junji Watanabe --- autosiso.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/autosiso.py b/autosiso.py index 1dce46315..c052c84d3 100755 --- a/autosiso.py +++ b/autosiso.py @@ -4,16 +4,41 @@ # found in the LICENSE file. """ Developers invoke this script via autosiso or autosiso.bat to simply run -Siso builds. +Siso/Reclient builds. """ +# TODO(b/278976196): `siso ninja` command should handle the reclient and +# authentication accordingly. +import os +import re import sys import reclient_helper import siso +def _use_remoteexec(argv): + out_dir = reclient_helper.find_ninja_out_dir(argv) + gn_args_path = os.path.join(out_dir, 'args.gn') + if not os.path.exists(gn_args_path): + return False + with open(gn_args_path) as f: + for line in f: + line_without_comment = line.split('#')[0] + if re.search(r'(^|\s)use_remoteexec\s*=\s*true($|\s)', + line_without_comment): + return True + return False + + def main(argv): + if not _use_remoteexec(argv): + print( + "`use_remoteexec=true` is not detected.\n" + "Please run `siso` command directly.", + file=sys.stderr) + return 1 + with reclient_helper.build_context(argv) as ret_code: if ret_code: return ret_code