| 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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 'dir': self.chromium_src_dir, | 945 'dir': self.chromium_src_dir, |
| 946 'version': 1, | 946 'version': 1, |
| 947 }, | 947 }, |
| 948 isolate_path + 'd.gen.json', | 948 isolate_path + 'd.gen.json', |
| 949 ) | 949 ) |
| 950 | 950 |
| 951 def MapTargetsToLabels(self, isolate_map, targets): | 951 def MapTargetsToLabels(self, isolate_map, targets): |
| 952 labels = [] | 952 labels = [] |
| 953 err = '' | 953 err = '' |
| 954 | 954 |
| 955 def StripTestSuffixes(target): | |
| 956 for suffix in ('_apk_run', '_apk', '_run'): | |
| 957 if target.endswith(suffix): | |
| 958 return target[:-len(suffix)], suffix | |
| 959 return None, None | |
| 960 | |
| 961 for target in targets: | 955 for target in targets: |
| 962 if target == 'all': | 956 if target == 'all': |
| 963 labels.append(target) | 957 labels.append(target) |
| 964 elif target.startswith('//'): | 958 elif target.startswith('//'): |
| 965 labels.append(target) | 959 labels.append(target) |
| 966 else: | 960 else: |
| 967 if target in isolate_map: | 961 if target in isolate_map: |
| 968 stripped_target, suffix = target, '' | 962 if isolate_map[target]['type'] == 'unknown': |
| 969 else: | |
| 970 stripped_target, suffix = StripTestSuffixes(target) | |
| 971 if stripped_target in isolate_map: | |
| 972 if isolate_map[stripped_target]['type'] == 'unknown': | |
| 973 err += ('test target "%s" type is unknown\n' % target) | 963 err += ('test target "%s" type is unknown\n' % target) |
| 974 else: | 964 else: |
| 975 labels.append(isolate_map[stripped_target]['label'] + suffix) | 965 labels.append(isolate_map[target]['label']) |
| 976 else: | 966 else: |
| 977 err += ('target "%s" not found in ' | 967 err += ('target "%s" not found in ' |
| 978 '//testing/buildbot/gn_isolate_map.pyl\n' % target) | 968 '//testing/buildbot/gn_isolate_map.pyl\n' % target) |
| 979 | 969 |
| 980 return err, labels | 970 return err, labels |
| 981 | 971 |
| 982 def GNCmd(self, subcommand, path, *args): | 972 def GNCmd(self, subcommand, path, *args): |
| 983 if self.platform == 'linux2': | 973 if self.platform == 'linux2': |
| 984 subdir, exe = 'linux64', 'gn' | 974 subdir, exe = 'linux64', 'gn' |
| 985 elif self.platform == 'darwin': | 975 elif self.platform == 'darwin': |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 # Then check to see if the arg contains any metacharacters other than | 1535 # Then check to see if the arg contains any metacharacters other than |
| 1546 # double quotes; if it does, quote everything (including the double | 1536 # double quotes; if it does, quote everything (including the double |
| 1547 # quotes) for safety. | 1537 # quotes) for safety. |
| 1548 if any(a in UNSAFE_FOR_CMD for a in arg): | 1538 if any(a in UNSAFE_FOR_CMD for a in arg): |
| 1549 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) | 1539 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) |
| 1550 return arg | 1540 return arg |
| 1551 | 1541 |
| 1552 | 1542 |
| 1553 if __name__ == '__main__': | 1543 if __name__ == '__main__': |
| 1554 sys.exit(main(sys.argv[1:])) | 1544 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |