| 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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 android = 'target_os="android"' in vals['gn_args'] | 846 android = 'target_os="android"' in vals['gn_args'] |
| 847 for target in swarming_targets: | 847 for target in swarming_targets: |
| 848 if android: | 848 if android: |
| 849 # Android targets may be either android_apk or executable. The former | 849 # Android targets may be either android_apk or executable. The former |
| 850 # will result in runtime_deps associated with the stamp file, while the | 850 # will result in runtime_deps associated with the stamp file, while the |
| 851 # latter will result in runtime_deps associated with the executable. | 851 # latter will result in runtime_deps associated with the executable. |
| 852 label = isolate_map[target]['label'] | 852 label = isolate_map[target]['label'] |
| 853 runtime_deps_targets = [ | 853 runtime_deps_targets = [ |
| 854 target + '.runtime_deps', | 854 target + '.runtime_deps', |
| 855 'obj/%s.stamp.runtime_deps' % label.replace(':', '/')] | 855 'obj/%s.stamp.runtime_deps' % label.replace(':', '/')] |
| 856 elif isolate_map[target]['type'] == 'gpu_browser_test': |
| 857 if self.platform == 'win32': |
| 858 runtime_deps_targets = ['browser_tests.exe.runtime_deps'] |
| 859 else: |
| 860 runtime_deps_targets = ['browser_tests.runtime_deps'] |
| 856 elif (isolate_map[target]['type'] == 'script' or | 861 elif (isolate_map[target]['type'] == 'script' or |
| 857 isolate_map[target].get('label_type') == 'group'): | 862 isolate_map[target].get('label_type') == 'group'): |
| 858 # For script targets, the build target is usually a group, | 863 # For script targets, the build target is usually a group, |
| 859 # for which gn generates the runtime_deps next to the stamp file | 864 # for which gn generates the runtime_deps next to the stamp file |
| 860 # for the label, which lives under the obj/ directory, but it may | 865 # for the label, which lives under the obj/ directory, but it may |
| 861 # also be an executable. | 866 # also be an executable. |
| 862 label = isolate_map[target]['label'] | 867 label = isolate_map[target]['label'] |
| 863 runtime_deps_targets = [ | 868 runtime_deps_targets = [ |
| 864 'obj/%s.stamp.runtime_deps' % label.replace(':', '/')] | 869 'obj/%s.stamp.runtime_deps' % label.replace(':', '/')] |
| 865 if self.platform == 'win32': | 870 if self.platform == 'win32': |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 ] | 1118 ] |
| 1114 cmdline = [ | 1119 cmdline = [ |
| 1115 '../../testing/test_env.py', | 1120 '../../testing/test_env.py', |
| 1116 './' + str(executable) + executable_suffix, | 1121 './' + str(executable) + executable_suffix, |
| 1117 '--brave-new-test-launcher', | 1122 '--brave-new-test-launcher', |
| 1118 '--test-launcher-bot-mode', | 1123 '--test-launcher-bot-mode', |
| 1119 '--asan=%d' % asan, | 1124 '--asan=%d' % asan, |
| 1120 '--msan=%d' % msan, | 1125 '--msan=%d' % msan, |
| 1121 '--tsan=%d' % tsan, | 1126 '--tsan=%d' % tsan, |
| 1122 ] | 1127 ] |
| 1128 elif test_type == 'gpu_browser_test': |
| 1129 extra_files = [ |
| 1130 '../../testing/test_env.py' |
| 1131 ] |
| 1132 gtest_filter = isolate_map[target]['gtest_filter'] |
| 1133 cmdline = [ |
| 1134 '../../testing/test_env.py', |
| 1135 './browser_tests' + executable_suffix, |
| 1136 '--test-launcher-bot-mode', |
| 1137 '--enable-gpu', |
| 1138 '--test-launcher-jobs=1', |
| 1139 '--gtest_filter=%s' % gtest_filter, |
| 1140 ] |
| 1123 elif test_type == 'script': | 1141 elif test_type == 'script': |
| 1124 extra_files = [ | 1142 extra_files = [ |
| 1125 '../../testing/test_env.py' | 1143 '../../testing/test_env.py' |
| 1126 ] | 1144 ] |
| 1127 cmdline = [ | 1145 cmdline = [ |
| 1128 '../../testing/test_env.py', | 1146 '../../testing/test_env.py', |
| 1129 '../../' + self.ToSrcRelPath(isolate_map[target]['script']) | 1147 '../../' + self.ToSrcRelPath(isolate_map[target]['script']) |
| 1130 ] | 1148 ] |
| 1131 elif test_type in ('raw'): | 1149 elif test_type in ('raw'): |
| 1132 extra_files = [] | 1150 extra_files = [] |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 if not inp['files']: | 1279 if not inp['files']: |
| 1262 self.Print('Warning: No files modified in patch, bailing out early.') | 1280 self.Print('Warning: No files modified in patch, bailing out early.') |
| 1263 self.WriteJSON({ | 1281 self.WriteJSON({ |
| 1264 'status': 'No dependency', | 1282 'status': 'No dependency', |
| 1265 'compile_targets': [], | 1283 'compile_targets': [], |
| 1266 'test_targets': [], | 1284 'test_targets': [], |
| 1267 }, output_path) | 1285 }, output_path) |
| 1268 return 0 | 1286 return 0 |
| 1269 | 1287 |
| 1270 gn_inp = {} | 1288 gn_inp = {} |
| 1271 gn_inp['files'] = sorted(['//' + f for f in inp['files'] | 1289 gn_inp['files'] = ['//' + f for f in inp['files'] if not f.startswith('//')] |
| 1272 if not f.startswith('//')]) | |
| 1273 | 1290 |
| 1274 isolate_map = self.ReadIsolateMap() | 1291 isolate_map = self.ReadIsolateMap() |
| 1275 err, gn_inp['additional_compile_targets'] = self.MapTargetsToLabels( | 1292 err, gn_inp['additional_compile_targets'] = self.MapTargetsToLabels( |
| 1276 isolate_map, inp['additional_compile_targets']) | 1293 isolate_map, inp['additional_compile_targets']) |
| 1277 gn_inp['additional_compile_targets'].sort() | |
| 1278 if err: | 1294 if err: |
| 1279 raise MBErr(err) | 1295 raise MBErr(err) |
| 1280 | 1296 |
| 1281 err, gn_inp['test_targets'] = self.MapTargetsToLabels( | 1297 err, gn_inp['test_targets'] = self.MapTargetsToLabels( |
| 1282 isolate_map, inp['test_targets']) | 1298 isolate_map, inp['test_targets']) |
| 1283 gn_inp['test_targets'].sort() | |
| 1284 if err: | 1299 if err: |
| 1285 raise MBErr(err) | 1300 raise MBErr(err) |
| 1286 labels_to_targets = {} | 1301 labels_to_targets = {} |
| 1287 for i, label in enumerate(gn_inp['test_targets']): | 1302 for i, label in enumerate(gn_inp['test_targets']): |
| 1288 labels_to_targets[label] = inp['test_targets'][i] | 1303 labels_to_targets[label] = inp['test_targets'][i] |
| 1289 | 1304 |
| 1290 try: | 1305 try: |
| 1291 self.WriteJSON(gn_inp, gn_input_path) | 1306 self.WriteJSON(gn_inp, gn_input_path) |
| 1292 cmd = self.GNCmd('analyze', build_path, gn_input_path, gn_output_path) | 1307 cmd = self.GNCmd('analyze', build_path, gn_input_path, gn_output_path) |
| 1293 ret, _, _ = self.Run(cmd, force_verbose=True) | 1308 ret, _, _ = self.Run(cmd, force_verbose=True) |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1549 # Then check to see if the arg contains any metacharacters other than | 1564 # Then check to see if the arg contains any metacharacters other than |
| 1550 # double quotes; if it does, quote everything (including the double | 1565 # double quotes; if it does, quote everything (including the double |
| 1551 # quotes) for safety. | 1566 # quotes) for safety. |
| 1552 if any(a in UNSAFE_FOR_CMD for a in arg): | 1567 if any(a in UNSAFE_FOR_CMD for a in arg): |
| 1553 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) | 1568 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) |
| 1554 return arg | 1569 return arg |
| 1555 | 1570 |
| 1556 | 1571 |
| 1557 if __name__ == '__main__': | 1572 if __name__ == '__main__': |
| 1558 sys.exit(main(sys.argv[1:])) | 1573 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |