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

Side by Side Diff: build/vs_toolchain.py

Issue 1783773004: 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, 9 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
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 glob 6 import glob
7 import json 7 import json
8 import os 8 import os
9 import pipes 9 import pipes
10 import shutil 10 import shutil
11 import subprocess 11 import subprocess
12 import sys 12 import sys
13 13
14 14
15 script_dir = os.path.dirname(os.path.realpath(__file__)) 15 script_dir = os.path.dirname(os.path.realpath(__file__))
16 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir)) 16 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir))
17 SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
18 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) 18 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
19 json_data_file = os.path.join(script_dir, 'win_toolchain.json') 19 json_data_file = os.path.join(script_dir, 'win_toolchain.json')
20 20
21 21
22 import gyp 22 import gyp
23 23
24 24
25 # Use MSVS2013 as the default toolchain. 25 # Use MSVS2015 as the default toolchain.
26 CURRENT_DEFAULT_TOOLCHAIN_VERSION = '2013' 26 CURRENT_DEFAULT_TOOLCHAIN_VERSION = '2015'
27 27
28 28
29 def SetEnvironmentAndGetRuntimeDllDirs(): 29 def SetEnvironmentAndGetRuntimeDllDirs():
30 """Sets up os.environ to use the depot_tools VS toolchain with gyp, and 30 """Sets up os.environ to use the depot_tools VS toolchain with gyp, and
31 returns the location of the VS runtime DLLs so they can be copied into 31 returns the location of the VS runtime DLLs so they can be copied into
32 the output directory after gyp generation. 32 the output directory after gyp generation.
33 """ 33 """
34 vs_runtime_dll_dirs = None 34 vs_runtime_dll_dirs = None
35 depot_tools_win_toolchain = \ 35 depot_tools_win_toolchain = \
36 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))) 36 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')))
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 _CopyRuntime(target_dir, runtime_dir, target_cpu, debug=True) 274 _CopyRuntime(target_dir, runtime_dir, target_cpu, debug=True)
275 275
276 276
277 def _GetDesiredVsToolchainHashes(): 277 def _GetDesiredVsToolchainHashes():
278 """Load a list of SHA1s corresponding to the toolchains that we want installed 278 """Load a list of SHA1s corresponding to the toolchains that we want installed
279 to build with.""" 279 to build with."""
280 if GetVisualStudioVersion() == '2015': 280 if GetVisualStudioVersion() == '2015':
281 # Update 1 with hot fixes. 281 # Update 1 with hot fixes.
282 return ['b349b3cc596d5f7e13d649532ddd7e8db39db0cb'] 282 return ['b349b3cc596d5f7e13d649532ddd7e8db39db0cb']
283 else: 283 else:
284 # Default to VS2013.
285 return ['4087e065abebdca6dbd0caca2910c6718d2ec67f'] 284 return ['4087e065abebdca6dbd0caca2910c6718d2ec67f']
286 285
287 286
288 def ShouldUpdateToolchain(): 287 def ShouldUpdateToolchain():
289 """Check if the toolchain should be upgraded.""" 288 """Check if the toolchain should be upgraded."""
290 if not os.path.exists(json_data_file): 289 if not os.path.exists(json_data_file):
291 return True 290 return True
292 with open(json_data_file, 'r') as tempf: 291 with open(json_data_file, 'r') as tempf:
293 toolchain_data = json.load(tempf) 292 toolchain_data = json.load(tempf)
294 version = toolchain_data['version'] 293 version = toolchain_data['version']
(...skipping 13 matching lines...) Expand all
308 return 1 307 return 1
309 if force == '--force' or os.path.exists(json_data_file): 308 if force == '--force' or os.path.exists(json_data_file):
310 force = True 309 force = True
311 310
312 depot_tools_win_toolchain = \ 311 depot_tools_win_toolchain = \
313 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))) 312 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')))
314 if ((sys.platform in ('win32', 'cygwin') or force) and 313 if ((sys.platform in ('win32', 'cygwin') or force) and
315 depot_tools_win_toolchain): 314 depot_tools_win_toolchain):
316 import find_depot_tools 315 import find_depot_tools
317 depot_tools_path = find_depot_tools.add_depot_tools_to_path() 316 depot_tools_path = find_depot_tools.add_depot_tools_to_path()
317 # Necessary so that get_toolchain_if_necessary.py will put the VS toolkit
318 # in the correct directory.
319 os.environ['GYP_MSVS_VERSION'] = GetVisualStudioVersion()
318 get_toolchain_args = [ 320 get_toolchain_args = [
319 sys.executable, 321 sys.executable,
320 os.path.join(depot_tools_path, 322 os.path.join(depot_tools_path,
321 'win_toolchain', 323 'win_toolchain',
322 'get_toolchain_if_necessary.py'), 324 'get_toolchain_if_necessary.py'),
323 '--output-json', json_data_file, 325 '--output-json', json_data_file,
324 ] + _GetDesiredVsToolchainHashes() 326 ] + _GetDesiredVsToolchainHashes()
325 if force: 327 if force:
326 get_toolchain_args.append('--force') 328 get_toolchain_args.append('--force')
327 subprocess.check_call(get_toolchain_args) 329 subprocess.check_call(get_toolchain_args)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 'copy_dlls': CopyDlls, 362 'copy_dlls': CopyDlls,
361 } 363 }
362 if len(sys.argv) < 2 or sys.argv[1] not in commands: 364 if len(sys.argv) < 2 or sys.argv[1] not in commands:
363 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) 365 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands)
364 return 1 366 return 1
365 return commands[sys.argv[1]](*sys.argv[2:]) 367 return commands[sys.argv[1]](*sys.argv[2:])
366 368
367 369
368 if __name__ == '__main__': 370 if __name__ == '__main__':
369 sys.exit(main()) 371 sys.exit(main())
OLDNEW
« build/toolchain/win/setup_toolchain.py ('K') | « build/toolchain/win/setup_toolchain.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698