Ben Segall | 9e36ef6 | 2023-04-18 22:09:28 +0000 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | # Copyright 2023 The Chromium Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | """This script is a wrapper around the //buildtools/reclient/reclientreport |
| 6 | binary that populates the log paths correctly for builds run via autoninja |
| 7 | Call this script with the same -C argument used for the autoninja build |
| 8 | Example usage: |
| 9 | $ reclientreport -C out/my-ninja-out |
| 10 | """ |
| 11 | |
| 12 | import argparse |
| 13 | import os |
| 14 | import subprocess |
| 15 | import sys |
| 16 | |
Ben Segall | 6b62f42 | 2023-04-20 13:29:36 +0000 | [diff] [blame] | 17 | import reclient_helper |
Ben Segall | 9e36ef6 | 2023-04-18 22:09:28 +0000 | [diff] [blame] | 18 | |
| 19 | |
| 20 | def main(): |
| 21 | parser = argparse.ArgumentParser(description=__doc__) |
| 22 | parser.add_argument("--ninja_out", |
| 23 | "-C", |
| 24 | required=True, |
| 25 | help="ninja out directory used for the autoninja build") |
| 26 | parser.add_argument('args', nargs=argparse.REMAINDER) |
| 27 | |
| 28 | args, extras = parser.parse_known_args() |
| 29 | if args.args and args.args[0] == '--': |
| 30 | args.args.pop(0) |
| 31 | if extras: |
| 32 | args.args = extras + args.args |
| 33 | |
Ben Segall | 6b62f42 | 2023-04-20 13:29:36 +0000 | [diff] [blame] | 34 | reclient_helper.set_reproxy_path_flags(args.ninja_out, make_dirs=False) |
| 35 | reclient_bin_dir = reclient_helper.find_reclient_bin_dir() |
Ben Segall | 9e36ef6 | 2023-04-18 22:09:28 +0000 | [diff] [blame] | 36 | code = subprocess.call([os.path.join(reclient_bin_dir, 'reclientreport')] + |
| 37 | args.args) |
| 38 | if code != 0: |
| 39 | print("Failed to collect logs, make sure that %s/.reproxy_tmp exists" % |
| 40 | args.ninja_out, |
| 41 | file=sys.stderr) |
| 42 | |
| 43 | |
| 44 | if __name__ == '__main__': |
| 45 | sys.exit(main()) |