reclientreport.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. import argparse
  12. import os
  13. import subprocess
  14. import sys
  15. import ninja_reclient
  16. def main():
  17. parser = argparse.ArgumentParser(description=__doc__)
  18. parser.add_argument("--ninja_out",
  19. "-C",
  20. required=True,
  21. help="ninja out directory used for the autoninja build")
  22. parser.add_argument('args', nargs=argparse.REMAINDER)
  23. args, extras = parser.parse_known_args()
  24. if args.args and args.args[0] == '--':
  25. args.args.pop(0)
  26. if extras:
  27. args.args = extras + args.args
  28. ninja_reclient.set_reproxy_path_flags(args.ninja_out, make_dirs=False)
  29. reclient_bin_dir = ninja_reclient.find_reclient_bin_dir()
  30. code = subprocess.call([os.path.join(reclient_bin_dir, 'reclientreport')] +
  31. args.args)
  32. if code != 0:
  33. print("Failed to collect logs, make sure that %s/.reproxy_tmp exists" %
  34. args.ninja_out,
  35. file=sys.stderr)
  36. if __name__ == '__main__':
  37. sys.exit(main())