| 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 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 if not inp['files']: | 1279 if not inp['files']: |
| 1280 self.Print('Warning: No files modified in patch, bailing out early.') | 1280 self.Print('Warning: No files modified in patch, bailing out early.') |
| 1281 self.WriteJSON({ | 1281 self.WriteJSON({ |
| 1282 'status': 'No dependency', | 1282 'status': 'No dependency', |
| 1283 'compile_targets': [], | 1283 'compile_targets': [], |
| 1284 'test_targets': [], | 1284 'test_targets': [], |
| 1285 }, output_path) | 1285 }, output_path) |
| 1286 return 0 | 1286 return 0 |
| 1287 | 1287 |
| 1288 gn_inp = {} | 1288 gn_inp = {} |
| 1289 gn_inp['files'] = ['//' + f for f in inp['files'] if not f.startswith('//')] | 1289 gn_inp['files'] = sorted(['//' + f for f in inp['files'] |
| 1290 if not f.startswith('//')]) |
| 1290 | 1291 |
| 1291 isolate_map = self.ReadIsolateMap() | 1292 isolate_map = self.ReadIsolateMap() |
| 1292 err, gn_inp['additional_compile_targets'] = self.MapTargetsToLabels( | 1293 err, gn_inp['additional_compile_targets'] = self.MapTargetsToLabels( |
| 1293 isolate_map, inp['additional_compile_targets']) | 1294 isolate_map, inp['additional_compile_targets']) |
| 1295 gn_inp['additional_compile_targets'].sort() |
| 1294 if err: | 1296 if err: |
| 1295 raise MBErr(err) | 1297 raise MBErr(err) |
| 1296 | 1298 |
| 1297 err, gn_inp['test_targets'] = self.MapTargetsToLabels( | 1299 err, gn_inp['test_targets'] = self.MapTargetsToLabels( |
| 1298 isolate_map, inp['test_targets']) | 1300 isolate_map, inp['test_targets']) |
| 1301 gn_inp['test_targets'].sort() |
| 1299 if err: | 1302 if err: |
| 1300 raise MBErr(err) | 1303 raise MBErr(err) |
| 1301 labels_to_targets = {} | 1304 labels_to_targets = {} |
| 1302 for i, label in enumerate(gn_inp['test_targets']): | 1305 for i, label in enumerate(gn_inp['test_targets']): |
| 1303 labels_to_targets[label] = inp['test_targets'][i] | 1306 labels_to_targets[label] = inp['test_targets'][i] |
| 1304 | 1307 |
| 1305 try: | 1308 try: |
| 1306 self.WriteJSON(gn_inp, gn_input_path) | 1309 self.WriteJSON(gn_inp, gn_input_path) |
| 1307 cmd = self.GNCmd('analyze', build_path, gn_input_path, gn_output_path) | 1310 cmd = self.GNCmd('analyze', build_path, gn_input_path, gn_output_path) |
| 1308 ret, _, _ = self.Run(cmd, force_verbose=True) | 1311 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 | 1567 # Then check to see if the arg contains any metacharacters other than |
| 1565 # double quotes; if it does, quote everything (including the double | 1568 # double quotes; if it does, quote everything (including the double |
| 1566 # quotes) for safety. | 1569 # quotes) for safety. |
| 1567 if any(a in UNSAFE_FOR_CMD for a in arg): | 1570 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) | 1571 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) |
| 1569 return arg | 1572 return arg |
| 1570 | 1573 |
| 1571 | 1574 |
| 1572 if __name__ == '__main__': | 1575 if __name__ == '__main__': |
| 1573 sys.exit(main(sys.argv[1:])) | 1576 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |