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 | eb2866e | 2023-01-20 20:14:44 +0000 | [diff] [blame] | 10 | import sys |
| 11 | |
| 12 | import ninja |
Junji Watanabe | 607284d | 2023-04-20 03:14:52 +0000 | [diff] [blame] | 13 | import reclient_helper |
Ben Segall | c4efd8a | 2023-02-13 17:17:33 +0000 | [diff] [blame] | 14 | |
| 15 | |
Ben Segall | eb2866e | 2023-01-20 20:14:44 +0000 | [diff] [blame] | 16 | def main(argv): |
Mike Frysinger | 124bb8e | 2023-09-06 05:48:55 +0000 | [diff] [blame^] | 17 | with reclient_helper.build_context(argv, 'ninja_reclient') as ret_code: |
| 18 | if ret_code: |
| 19 | return ret_code |
| 20 | try: |
| 21 | return ninja.main(argv) |
| 22 | except KeyboardInterrupt: |
| 23 | return 1 |
Ben Segall | eb2866e | 2023-01-20 20:14:44 +0000 | [diff] [blame] | 24 | |
| 25 | |
| 26 | if __name__ == '__main__': |
Mike Frysinger | 124bb8e | 2023-09-06 05:48:55 +0000 | [diff] [blame^] | 27 | sys.exit(main(sys.argv)) |