Ben Segall | eb2866e | 2023-01-20 20:14:44 +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 ninja.py script that also |
| 6 | handles the client lifecycle safely. It will automatically start |
| 7 | reproxy before running ninja and stop reproxy when ninja stops |
| 8 | for any reason eg. build completes, keyboard interupt etc.""" |
| 9 | |
Ben Segall | bb67064 | 2023-09-06 14:44:21 +0000 | [diff] [blame] | 10 | import os |
Ben Segall | eb2866e | 2023-01-20 20:14:44 +0000 | [diff] [blame] | 11 | import sys |
| 12 | |
| 13 | import ninja |
Junji Watanabe | 607284d | 2023-04-20 03:14:52 +0000 | [diff] [blame] | 14 | import reclient_helper |
Ben Segall | c4efd8a | 2023-02-13 17:17:33 +0000 | [diff] [blame] | 15 | |
| 16 | |
Ben Segall | eb2866e | 2023-01-20 20:14:44 +0000 | [diff] [blame] | 17 | def main(argv): |
Ben Segall | bb67064 | 2023-09-06 14:44:21 +0000 | [diff] [blame] | 18 | os.environ.setdefault("RBE_exec_strategy", "racing") |
Mike Frysinger | 124bb8e | 2023-09-06 05:48:55 +0000 | [diff] [blame] | 19 | with reclient_helper.build_context(argv, 'ninja_reclient') as ret_code: |
| 20 | if ret_code: |
| 21 | return ret_code |
| 22 | try: |
| 23 | return ninja.main(argv) |
| 24 | except KeyboardInterrupt: |
| 25 | return 1 |
Ben Segall | eb2866e | 2023-01-20 20:14:44 +0000 | [diff] [blame] | 26 | |
| 27 | |
| 28 | if __name__ == '__main__': |
Mike Frysinger | 124bb8e | 2023-09-06 05:48:55 +0000 | [diff] [blame] | 29 | sys.exit(main(sys.argv)) |