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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 ret, _, _ = self.Run(cmd) | 528 ret, _, _ = self.Run(cmd) |
529 if ret: | 529 if ret: |
530 # If `gn gen` failed, we should exit early rather than trying to | 530 # If `gn gen` failed, we should exit early rather than trying to |
531 # generate isolates. Run() will have already logged any error output. | 531 # generate isolates. Run() will have already logged any error output. |
532 self.Print('GN gen failed: %d' % ret) | 532 self.Print('GN gen failed: %d' % ret) |
533 return ret | 533 return ret |
534 | 534 |
535 for target in swarming_targets: | 535 for target in swarming_targets: |
536 if gn_isolate_map[target]['type'] == 'gpu_browser_test': | 536 if gn_isolate_map[target]['type'] == 'gpu_browser_test': |
537 runtime_deps_target = 'browser_tests' | 537 runtime_deps_target = 'browser_tests' |
538 elif gn_isolate_map[target]['type'] == 'script': | 538 elif (gn_isolate_map[target]['type'] == 'script' or |
| 539 gn_isolate_map[target].get('label_type') == 'group'): |
539 # For script targets, the build target is usually a group, | 540 # For script targets, the build target is usually a group, |
540 # for which gn generates the runtime_deps next to the stamp file | 541 # for which gn generates the runtime_deps next to the stamp file |
541 # for the label, which lives under the obj/ directory. | 542 # for the label, which lives under the obj/ directory. |
542 label = gn_isolate_map[target]['label'] | 543 label = gn_isolate_map[target]['label'] |
543 runtime_deps_target = 'obj/%s.stamp' % label.replace(':', '/') | 544 runtime_deps_target = 'obj/%s.stamp' % label.replace(':', '/') |
544 else: | 545 else: |
545 runtime_deps_target = target | 546 runtime_deps_target = target |
546 if self.platform == 'win32': | 547 if self.platform == 'win32': |
547 deps_path = self.ToAbsPath(build_dir, | 548 deps_path = self.ToAbsPath(build_dir, |
548 runtime_deps_target + '.exe.runtime_deps') | 549 runtime_deps_target + '.exe.runtime_deps') |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 '--test-launcher-jobs=1', | 727 '--test-launcher-jobs=1', |
727 '--gtest_filter=%s' % gtest_filter, | 728 '--gtest_filter=%s' % gtest_filter, |
728 ] | 729 ] |
729 elif test_type == 'script': | 730 elif test_type == 'script': |
730 extra_files = [ | 731 extra_files = [ |
731 '../../testing/test_env.py' | 732 '../../testing/test_env.py' |
732 ] | 733 ] |
733 cmdline = [ | 734 cmdline = [ |
734 '../../testing/test_env.py', | 735 '../../testing/test_env.py', |
735 '../../' + self.ToSrcRelPath(gn_isolate_map[target]['script']) | 736 '../../' + self.ToSrcRelPath(gn_isolate_map[target]['script']) |
736 ] + gn_isolate_map[target].get('args', []) | 737 ] |
737 elif test_type in ('raw'): | 738 elif test_type in ('raw'): |
738 extra_files = [] | 739 extra_files = [] |
739 cmdline = [ | 740 cmdline = [ |
740 './' + str(target) + executable_suffix, | 741 './' + str(target) + executable_suffix, |
741 ] + gn_isolate_map[target].get('args') | 742 ] |
742 | 743 |
743 else: | 744 else: |
744 self.WriteFailureAndRaise('No command line for %s found (test type %s).' | 745 self.WriteFailureAndRaise('No command line for %s found (test type %s).' |
745 % (target, test_type), output_path=None) | 746 % (target, test_type), output_path=None) |
746 | 747 |
| 748 cmdline += gn_isolate_map[target].get('args', []) |
| 749 |
747 return cmdline, extra_files | 750 return cmdline, extra_files |
748 | 751 |
749 def ToAbsPath(self, build_path, *comps): | 752 def ToAbsPath(self, build_path, *comps): |
750 return self.PathJoin(self.chromium_src_dir, | 753 return self.PathJoin(self.chromium_src_dir, |
751 self.ToSrcRelPath(build_path), | 754 self.ToSrcRelPath(build_path), |
752 *comps) | 755 *comps) |
753 | 756 |
754 def ToSrcRelPath(self, path): | 757 def ToSrcRelPath(self, path): |
755 """Returns a relative path from the top of the repo.""" | 758 """Returns a relative path from the top of the repo.""" |
756 # TODO: Support normal paths in addition to source-absolute paths. | 759 # TODO: Support normal paths in addition to source-absolute paths. |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 | 1089 |
1087 if __name__ == '__main__': | 1090 if __name__ == '__main__': |
1088 try: | 1091 try: |
1089 sys.exit(main(sys.argv[1:])) | 1092 sys.exit(main(sys.argv[1:])) |
1090 except MBErr as e: | 1093 except MBErr as e: |
1091 print(e) | 1094 print(e) |
1092 sys.exit(1) | 1095 sys.exit(1) |
1093 except KeyboardInterrupt: | 1096 except KeyboardInterrupt: |
1094 print("interrupted, exiting", stream=sys.stderr) | 1097 print("interrupted, exiting", stream=sys.stderr) |
1095 sys.exit(130) | 1098 sys.exit(130) |
OLD | NEW |