OLD | NEW |
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 platform | 10 import platform |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 ucrt_dst_file = os.path.join(target_dir, file_part) | 231 ucrt_dst_file = os.path.join(target_dir, file_part) |
232 _CopyRuntimeImpl(ucrt_dst_file, ucrt_src_file, False) | 232 _CopyRuntimeImpl(ucrt_dst_file, ucrt_src_file, False) |
233 _CopyRuntimeImpl(os.path.join(target_dir, 'ucrtbase' + suffix), | 233 _CopyRuntimeImpl(os.path.join(target_dir, 'ucrtbase' + suffix), |
234 os.path.join(source_dir, 'ucrtbase' + suffix)) | 234 os.path.join(source_dir, 'ucrtbase' + suffix)) |
235 | 235 |
236 | 236 |
237 def _CopyRuntime(target_dir, source_dir, target_cpu, debug): | 237 def _CopyRuntime(target_dir, source_dir, target_cpu, debug): |
238 """Copy the VS runtime DLLs, only if the target doesn't exist, but the target | 238 """Copy the VS runtime DLLs, only if the target doesn't exist, but the target |
239 directory does exist. Handles VS 2013, VS 2015, and VS 2017.""" | 239 directory does exist. Handles VS 2013, VS 2015, and VS 2017.""" |
240 suffix = "d.dll" if debug else ".dll" | 240 suffix = "d.dll" if debug else ".dll" |
241 if GetVisualStudioVersion() == '2015' or GetVisualStudioVersion() == '2017': | 241 if GetVisualStudioVersion() in ['2015', '2017']: |
242 # VS 2017 RC uses the same CRT DLLs as VS 2015. | 242 # VS 2017 uses the same CRT DLLs as VS 2015. |
243 _CopyUCRTRuntime(target_dir, source_dir, '%s140' + suffix, suffix) | 243 _CopyUCRTRuntime(target_dir, source_dir, '%s140' + suffix, suffix) |
244 else: | 244 else: |
245 _CopyRuntime2013(target_dir, source_dir, 'msvc%s120' + suffix) | 245 _CopyRuntime2013(target_dir, source_dir, 'msvc%s120' + suffix) |
246 | 246 |
247 # Copy the PGO runtime library to the release directories. | 247 # Copy the PGO runtime library to the release directories. |
248 if not debug and os.environ.get('GYP_MSVS_OVERRIDE_PATH'): | 248 if not debug and os.environ.get('GYP_MSVS_OVERRIDE_PATH'): |
249 pgo_x86_runtime_dir = os.path.join(os.environ.get('GYP_MSVS_OVERRIDE_PATH'), | 249 pgo_x86_runtime_dir = os.path.join(os.environ.get('GYP_MSVS_OVERRIDE_PATH'), |
250 'VC', 'bin') | 250 'VC', 'bin') |
251 pgo_x64_runtime_dir = os.path.join(pgo_x86_runtime_dir, 'amd64') | 251 pgo_x64_runtime_dir = os.path.join(pgo_x86_runtime_dir, 'amd64') |
252 pgo_runtime_dll = 'pgort' + _VersionNumber() + '.dll' | 252 pgo_runtime_dll = 'pgort' + _VersionNumber() + '.dll' |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 target_path = os.path.join(target_dir, debug_file) | 336 target_path = os.path.join(target_dir, debug_file) |
337 _CopyRuntimeImpl(target_path, full_path) | 337 _CopyRuntimeImpl(target_path, full_path) |
338 | 338 |
339 | 339 |
340 def _GetDesiredVsToolchainHashes(): | 340 def _GetDesiredVsToolchainHashes(): |
341 """Load a list of SHA1s corresponding to the toolchains that we want installed | 341 """Load a list of SHA1s corresponding to the toolchains that we want installed |
342 to build with.""" | 342 to build with.""" |
343 if GetVisualStudioVersion() == '2015': | 343 if GetVisualStudioVersion() == '2015': |
344 # Update 3 final with patches with 10.0.14393.0 SDK. | 344 # Update 3 final with patches with 10.0.14393.0 SDK. |
345 return ['d3cb0e37bdd120ad0ac4650b674b09e81be45616'] | 345 return ['d3cb0e37bdd120ad0ac4650b674b09e81be45616'] |
| 346 elif GetVisualStudioVersion() == '2013': |
| 347 return ['03a4e939cd325d6bc5216af41b92d02dda1366a6'] |
346 else: | 348 else: |
347 return ['03a4e939cd325d6bc5216af41b92d02dda1366a6'] | 349 raise Exception('Unsupported VS version %s' % GetVisualStudioVersion()) |
348 | 350 |
349 | 351 |
350 def ShouldUpdateToolchain(): | 352 def ShouldUpdateToolchain(): |
351 """Check if the toolchain should be upgraded.""" | 353 """Check if the toolchain should be upgraded.""" |
352 if not os.path.exists(json_data_file): | 354 if not os.path.exists(json_data_file): |
353 return True | 355 return True |
354 with open(json_data_file, 'r') as tempf: | 356 with open(json_data_file, 'r') as tempf: |
355 toolchain_data = json.load(tempf) | 357 toolchain_data = json.load(tempf) |
356 version = toolchain_data['version'] | 358 version = toolchain_data['version'] |
357 env_version = GetVisualStudioVersion() | 359 env_version = GetVisualStudioVersion() |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 'copy_dlls': CopyDlls, | 442 'copy_dlls': CopyDlls, |
441 } | 443 } |
442 if len(sys.argv) < 2 or sys.argv[1] not in commands: | 444 if len(sys.argv) < 2 or sys.argv[1] not in commands: |
443 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) | 445 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) |
444 return 1 | 446 return 1 |
445 return commands[sys.argv[1]](*sys.argv[2:]) | 447 return commands[sys.argv[1]](*sys.argv[2:]) |
446 | 448 |
447 | 449 |
448 if __name__ == '__main__': | 450 if __name__ == '__main__': |
449 sys.exit(main()) | 451 sys.exit(main()) |
OLD | NEW |