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