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

Side by Side Diff: build/vs_toolchain.py

Issue 1676263003: Reland of Change default Windows compiler to VS 2015 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « build/toolchain/win/setup_toolchain.py ('k') | 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 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 import json 6 import json
7 import os 7 import os
8 import pipes 8 import pipes
9 import shutil 9 import shutil
10 import subprocess 10 import subprocess
11 import sys 11 import sys
12 12
13 13
14 script_dir = os.path.dirname(os.path.realpath(__file__)) 14 script_dir = os.path.dirname(os.path.realpath(__file__))
15 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir)) 15 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir))
16 SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 16 SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) 17 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
18 json_data_file = os.path.join(script_dir, 'win_toolchain.json') 18 json_data_file = os.path.join(script_dir, 'win_toolchain.json')
19 19
20 20
21 import gyp 21 import gyp
22 22
23 23
24 # Use MSVS2013 as the default toolchain. 24 # Use MSVS2015 as the default toolchain.
25 CURRENT_DEFAULT_TOOLCHAIN_VERSION = '2013' 25 CURRENT_DEFAULT_TOOLCHAIN_VERSION = '2015'
26 26
27 27
28 def SetEnvironmentAndGetRuntimeDllDirs(): 28 def SetEnvironmentAndGetRuntimeDllDirs():
29 """Sets up os.environ to use the depot_tools VS toolchain with gyp, and 29 """Sets up os.environ to use the depot_tools VS toolchain with gyp, and
30 returns the location of the VS runtime DLLs so they can be copied into 30 returns the location of the VS runtime DLLs so they can be copied into
31 the output directory after gyp generation. 31 the output directory after gyp generation.
32 """ 32 """
33 vs_runtime_dll_dirs = None 33 vs_runtime_dll_dirs = None
34 depot_tools_win_toolchain = \ 34 depot_tools_win_toolchain = \
35 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))) 35 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')))
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 _CopyRuntime(target_dir, runtime_dir, target_cpu, debug=True) 267 _CopyRuntime(target_dir, runtime_dir, target_cpu, debug=True)
268 268
269 269
270 def _GetDesiredVsToolchainHashes(): 270 def _GetDesiredVsToolchainHashes():
271 """Load a list of SHA1s corresponding to the toolchains that we want installed 271 """Load a list of SHA1s corresponding to the toolchains that we want installed
272 to build with.""" 272 to build with."""
273 if GetVisualStudioVersion() == '2015': 273 if GetVisualStudioVersion() == '2015':
274 # Update 1 with Debuggers, UCRT installers and ucrtbased.dll 274 # Update 1 with Debuggers, UCRT installers and ucrtbased.dll
275 return ['523b6c2d3df300b2c8538cdc0beac404726af051'] 275 return ['523b6c2d3df300b2c8538cdc0beac404726af051']
276 else: 276 else:
277 # Default to VS2013.
278 return ['4087e065abebdca6dbd0caca2910c6718d2ec67f'] 277 return ['4087e065abebdca6dbd0caca2910c6718d2ec67f']
279 278
280 279
281 def ShouldUpdateToolchain(): 280 def ShouldUpdateToolchain():
282 """Check if the toolchain should be upgraded.""" 281 """Check if the toolchain should be upgraded."""
283 if not os.path.exists(json_data_file): 282 if not os.path.exists(json_data_file):
284 return True 283 return True
285 with open(json_data_file, 'r') as tempf: 284 with open(json_data_file, 'r') as tempf:
286 toolchain_data = json.load(tempf) 285 toolchain_data = json.load(tempf)
287 version = toolchain_data['version'] 286 version = toolchain_data['version']
(...skipping 13 matching lines...) Expand all
301 return 1 300 return 1
302 if force == '--force' or os.path.exists(json_data_file): 301 if force == '--force' or os.path.exists(json_data_file):
303 force = True 302 force = True
304 303
305 depot_tools_win_toolchain = \ 304 depot_tools_win_toolchain = \
306 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))) 305 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')))
307 if ((sys.platform in ('win32', 'cygwin') or force) and 306 if ((sys.platform in ('win32', 'cygwin') or force) and
308 depot_tools_win_toolchain): 307 depot_tools_win_toolchain):
309 import find_depot_tools 308 import find_depot_tools
310 depot_tools_path = find_depot_tools.add_depot_tools_to_path() 309 depot_tools_path = find_depot_tools.add_depot_tools_to_path()
310 # Necessary so that get_toolchain_if_necessary.py will put the VS toolkit
311 # in the correct directory.
312 os.environ['GYP_MSVS_VERSION'] = GetVisualStudioVersion()
311 get_toolchain_args = [ 313 get_toolchain_args = [
312 sys.executable, 314 sys.executable,
313 os.path.join(depot_tools_path, 315 os.path.join(depot_tools_path,
314 'win_toolchain', 316 'win_toolchain',
315 'get_toolchain_if_necessary.py'), 317 'get_toolchain_if_necessary.py'),
316 '--output-json', json_data_file, 318 '--output-json', json_data_file,
317 ] + _GetDesiredVsToolchainHashes() 319 ] + _GetDesiredVsToolchainHashes()
318 if force: 320 if force:
319 get_toolchain_args.append('--force') 321 get_toolchain_args.append('--force')
320 subprocess.check_call(get_toolchain_args) 322 subprocess.check_call(get_toolchain_args)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 'copy_dlls': CopyDlls, 355 'copy_dlls': CopyDlls,
354 } 356 }
355 if len(sys.argv) < 2 or sys.argv[1] not in commands: 357 if len(sys.argv) < 2 or sys.argv[1] not in commands:
356 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) 358 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands)
357 return 1 359 return 1
358 return commands[sys.argv[1]](*sys.argv[2:]) 360 return commands[sys.argv[1]](*sys.argv[2:])
359 361
360 362
361 if __name__ == '__main__': 363 if __name__ == '__main__':
362 sys.exit(main()) 364 sys.exit(main())
OLDNEW
« no previous file with comments | « build/toolchain/win/setup_toolchain.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698