OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2016 the V8 project authors. All rights reserved. | 2 # Copyright 2016 the V8 project authors. All rights reserved. |
3 # Copyright 2015 The Chromium Authors. All rights reserved. | 3 # Copyright 2015 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """MB - the Meta-Build wrapper around GYP and GN | 7 """MB - the Meta-Build wrapper around GYP and GN |
8 | 8 |
9 MB is a wrapper script for GYP and GN that can be used to generate build files | 9 MB is a wrapper script for GYP and GN that can be used to generate build files |
10 for sets of canned configurations and analyze them. | 10 for sets of canned configurations and analyze them. |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 gn_labels.append(gn_isolate_map[target_name]['label']) | 770 gn_labels.append(gn_isolate_map[target_name]['label']) |
771 | 771 |
772 if err: | 772 if err: |
773 raise MBErr('Error: Failed to match swarming targets to %s:\n%s' % | 773 raise MBErr('Error: Failed to match swarming targets to %s:\n%s' % |
774 ('//testing/buildbot/gn_isolate_map.pyl', err)) | 774 ('//testing/buildbot/gn_isolate_map.pyl', err)) |
775 | 775 |
776 gn_runtime_deps_path = self.ToAbsPath(build_dir, 'runtime_deps') | 776 gn_runtime_deps_path = self.ToAbsPath(build_dir, 'runtime_deps') |
777 self.WriteFile(gn_runtime_deps_path, '\n'.join(gn_labels) + '\n') | 777 self.WriteFile(gn_runtime_deps_path, '\n'.join(gn_labels) + '\n') |
778 cmd.append('--runtime-deps-list-file=%s' % gn_runtime_deps_path) | 778 cmd.append('--runtime-deps-list-file=%s' % gn_runtime_deps_path) |
779 | 779 |
780 # Override msvs infra environment variables. | 780 ret, _, _ = self.Run(cmd) |
781 # TODO(machenbach): Remove after GYP_MSVS_VERSION is removed on infra side. | |
782 env = {} | |
783 env.update(os.environ) | |
784 env['GYP_MSVS_VERSION'] = '2015' | |
785 | |
786 ret, _, _ = self.Run(cmd, env=env) | |
787 if ret: | 781 if ret: |
788 # If `gn gen` failed, we should exit early rather than trying to | 782 # If `gn gen` failed, we should exit early rather than trying to |
789 # generate isolates. Run() will have already logged any error output. | 783 # generate isolates. Run() will have already logged any error output. |
790 self.Print('GN gen failed: %d' % ret) | 784 self.Print('GN gen failed: %d' % ret) |
791 return ret | 785 return ret |
792 | 786 |
793 android = 'target_os="android"' in vals['gn_args'] | 787 android = 'target_os="android"' in vals['gn_args'] |
794 for target in swarming_targets: | 788 for target in swarming_targets: |
795 if android: | 789 if android: |
796 # Android targets may be either android_apk or executable. The former | 790 # Android targets may be either android_apk or executable. The former |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 # Then check to see if the arg contains any metacharacters other than | 1491 # Then check to see if the arg contains any metacharacters other than |
1498 # double quotes; if it does, quote everything (including the double | 1492 # double quotes; if it does, quote everything (including the double |
1499 # quotes) for safety. | 1493 # quotes) for safety. |
1500 if any(a in UNSAFE_FOR_CMD for a in arg): | 1494 if any(a in UNSAFE_FOR_CMD for a in arg): |
1501 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) | 1495 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) |
1502 return arg | 1496 return arg |
1503 | 1497 |
1504 | 1498 |
1505 if __name__ == '__main__': | 1499 if __name__ == '__main__': |
1506 sys.exit(main(sys.argv[1:])) | 1500 sys.exit(main(sys.argv[1:])) |
OLD | NEW |