Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: tools/mb/mb.py

Issue 2360633002: [gn] Hard-code msvs version 2013 in MB. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 29
30 from collections import OrderedDict 30 from collections import OrderedDict
31 31
32 CHROMIUM_SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname( 32 CHROMIUM_SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(
33 os.path.abspath(__file__)))) 33 os.path.abspath(__file__))))
34 sys.path = [os.path.join(CHROMIUM_SRC_DIR, 'build')] + sys.path 34 sys.path = [os.path.join(CHROMIUM_SRC_DIR, 'build')] + sys.path
35 35
36 import gn_helpers 36 import gn_helpers
37 37
38 38
39 # We override this here as some legacy gyp scripts are still called through gn.
40 # They rely on the environment variable or otherwise use chromium's default of
41 # 2015.
42 # TODO(machenbach): For switching to msvs 2015, simply remove this.
43 MSVS_VERSION = '2013'
44
45
39 def main(args): 46 def main(args):
40 mbw = MetaBuildWrapper() 47 mbw = MetaBuildWrapper()
41 return mbw.Main(args) 48 return mbw.Main(args)
42 49
43 50
44 class MetaBuildWrapper(object): 51 class MetaBuildWrapper(object):
45 def __init__(self): 52 def __init__(self):
46 self.chromium_src_dir = CHROMIUM_SRC_DIR 53 self.chromium_src_dir = CHROMIUM_SRC_DIR
47 self.default_config = os.path.join(self.chromium_src_dir, 'infra', 'mb', 54 self.default_config = os.path.join(self.chromium_src_dir, 'infra', 'mb',
48 'mb_config.pyl') 55 'mb_config.pyl')
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 gn_labels.append(gn_isolate_map[target_name]['label']) 777 gn_labels.append(gn_isolate_map[target_name]['label'])
771 778
772 if err: 779 if err:
773 raise MBErr('Error: Failed to match swarming targets to %s:\n%s' % 780 raise MBErr('Error: Failed to match swarming targets to %s:\n%s' %
774 ('//testing/buildbot/gn_isolate_map.pyl', err)) 781 ('//testing/buildbot/gn_isolate_map.pyl', err))
775 782
776 gn_runtime_deps_path = self.ToAbsPath(build_dir, 'runtime_deps') 783 gn_runtime_deps_path = self.ToAbsPath(build_dir, 'runtime_deps')
777 self.WriteFile(gn_runtime_deps_path, '\n'.join(gn_labels) + '\n') 784 self.WriteFile(gn_runtime_deps_path, '\n'.join(gn_labels) + '\n')
778 cmd.append('--runtime-deps-list-file=%s' % gn_runtime_deps_path) 785 cmd.append('--runtime-deps-list-file=%s' % gn_runtime_deps_path)
779 786
780 ret, _, _ = self.Run(cmd) 787 # Override msvs infra environment variables.
788 env = {}
789 env.update(os.environ)
790 env['GYP_MSVS_VERSION'] = MSVS_VERSION
791
792 ret, _, _ = self.Run(cmd, env=env)
781 if ret: 793 if ret:
782 # If `gn gen` failed, we should exit early rather than trying to 794 # If `gn gen` failed, we should exit early rather than trying to
783 # generate isolates. Run() will have already logged any error output. 795 # generate isolates. Run() will have already logged any error output.
784 self.Print('GN gen failed: %d' % ret) 796 self.Print('GN gen failed: %d' % ret)
785 return ret 797 return ret
786 798
787 android = 'target_os="android"' in vals['gn_args'] 799 android = 'target_os="android"' in vals['gn_args']
788 for target in swarming_targets: 800 for target in swarming_targets:
789 if android: 801 if android:
790 # Android targets may be either android_apk or executable. The former 802 # Android targets may be either android_apk or executable. The former
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 # Then check to see if the arg contains any metacharacters other than 1503 # Then check to see if the arg contains any metacharacters other than
1492 # double quotes; if it does, quote everything (including the double 1504 # double quotes; if it does, quote everything (including the double
1493 # quotes) for safety. 1505 # quotes) for safety.
1494 if any(a in UNSAFE_FOR_CMD for a in arg): 1506 if any(a in UNSAFE_FOR_CMD for a in arg):
1495 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) 1507 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg)
1496 return arg 1508 return arg
1497 1509
1498 1510
1499 if __name__ == '__main__': 1511 if __name__ == '__main__':
1500 sys.exit(main(sys.argv[1:])) 1512 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698