OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """MB - the Meta-Build wrapper around GYP and GN | 6 """MB - the Meta-Build wrapper around GYP and GN |
7 | 7 |
8 MB is a wrapper script for GYP and GN that can be used to generate build files | 8 MB is a wrapper script for GYP and GN that can be used to generate build files |
9 for sets of canned configurations and analyze them. | 9 for sets of canned configurations and analyze them. |
10 """ | 10 """ |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 self.Print() | 409 self.Print() |
410 | 410 |
411 output_path = self.args.output_path[0] | 411 output_path = self.args.output_path[0] |
412 | 412 |
413 # Bail out early if a GN file was modified, since 'gn refs' won't know | 413 # Bail out early if a GN file was modified, since 'gn refs' won't know |
414 # what to do about it. | 414 # what to do about it. |
415 if any(f.endswith('.gn') or f.endswith('.gni') for f in inp['files']): | 415 if any(f.endswith('.gn') or f.endswith('.gni') for f in inp['files']): |
416 self.WriteJSON({'status': 'Found dependency (all)'}, output_path) | 416 self.WriteJSON({'status': 'Found dependency (all)'}, output_path) |
417 return 0 | 417 return 0 |
418 | 418 |
| 419 # TODO: Because of the --type=executable filter below, we don't detect |
| 420 # when files will cause 'all' or 'gn_all' or similar targets to be |
| 421 # dirty. We need to figure out how to handle that properly, but for |
| 422 # now we can just bail out early. |
| 423 if 'gn_all' in inp['targets'] or 'all' in inp['targets']: |
| 424 self.WriteJSON({'status': 'Found dependency (all)'}, output_path) |
| 425 return 0 |
| 426 |
419 all_needed_targets = set() | 427 all_needed_targets = set() |
420 ret = 0 | 428 ret = 0 |
421 for f in inp['files']: | 429 for f in inp['files']: |
422 cmd = self.GNCmd('refs', self.args.path[0]) + [ | 430 cmd = self.GNCmd('refs', self.args.path[0]) + [ |
423 '//' + f, '--type=executable', '--all', '--as=output'] | 431 '//' + f, '--type=executable', '--all', '--as=output'] |
424 ret, out, _ = self.Run(cmd) | 432 ret, out, _ = self.Run(cmd) |
425 if ret: | 433 if ret: |
426 self.WriteFailureAndRaise('gn refs returned %d: %s' % (ret, out), | 434 self.WriteFailureAndRaise('gn refs returned %d: %s' % (ret, out), |
427 output_path) | 435 output_path) |
428 | 436 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 | 548 |
541 if __name__ == '__main__': | 549 if __name__ == '__main__': |
542 try: | 550 try: |
543 sys.exit(main(sys.argv[1:])) | 551 sys.exit(main(sys.argv[1:])) |
544 except MBErr as e: | 552 except MBErr as e: |
545 print(e) | 553 print(e) |
546 sys.exit(1) | 554 sys.exit(1) |
547 except KeyboardInterrupt: | 555 except KeyboardInterrupt: |
548 print("interrupted, exiting", stream=sys.stderr) | 556 print("interrupted, exiting", stream=sys.stderr) |
549 sys.exit(130) | 557 sys.exit(130) |
OLD | NEW |