autoninja: Refactor the code calling Reclient

- Remove reclient_helper.py to avoid calling it directly.
- Cleans up autoninja.py

I just want to do this cleanup before merging the user notice messages
for logs/metrics collection.

Bug: 345113094
Change-Id: I0c76426b3cb387eae6dede031727c107e57d5d1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5668282
Reviewed-by: Philipp Wollermann <philwo@google.com>
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Ben Segall <bentekkie@google.com>
Auto-Submit: Junji Watanabe <jwata@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
Junji Watanabe
2024-07-09 00:52:12 +00:00
committed by LUCI CQ
parent 9e9fc99280
commit 1387a8c958
7 changed files with 73 additions and 92 deletions

View File

@@ -19,8 +19,9 @@ import time
import uuid
import gclient_paths
import ninja
import reclient_metrics
import siso
THIS_DIR = os.path.dirname(__file__)
RECLIENT_LOG_CLEANUP = os.path.join(THIS_DIR, 'reclient_log_cleanup.py')
@@ -376,3 +377,29 @@ Ensure you have completed the reproxy setup instructions:
if os.environ.get('NINJA_SUMMARIZE_BUILD') == '1':
elapsed = time.time() - start
print('%1.3fs to stop reproxy' % elapsed)
def run_ninja(ninja_cmd):
"""Runs Ninja in build_context()."""
# TODO: crbug.com/345113094 - rename the `tool` label to `ninja`.
with build_context(ninja_cmd, "ninja_reclient") as ret_code:
if ret_code:
return ret_code
try:
return ninja.main(ninja_cmd)
except KeyboardInterrupt:
print("Shutting down reproxy...", file=sys.stderr)
return 1
def run_siso(siso_cmd):
"""Runs Siso in build_context()."""
# TODO: crbug.com/345113094 - rename the `autosiso` label to `siso`.
with build_context(siso_cmd, "autosiso") as ret_code:
if ret_code:
return ret_code
try:
return siso.main(siso_cmd)
except KeyboardInterrupt:
print("Shutting down reproxy...", file=sys.stderr)
return 1