| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 vs_runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() | 297 vs_runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() |
| 298 if not vs_runtime_dll_dirs: | 298 if not vs_runtime_dll_dirs: |
| 299 return | 299 return |
| 300 | 300 |
| 301 x64_runtime, x86_runtime = vs_runtime_dll_dirs | 301 x64_runtime, x86_runtime = vs_runtime_dll_dirs |
| 302 runtime_dir = x64_runtime if target_cpu == 'x64' else x86_runtime | 302 runtime_dir = x64_runtime if target_cpu == 'x64' else x86_runtime |
| 303 _CopyRuntime(target_dir, runtime_dir, target_cpu, debug=False) | 303 _CopyRuntime(target_dir, runtime_dir, target_cpu, debug=False) |
| 304 if configuration == 'Debug': | 304 if configuration == 'Debug': |
| 305 _CopyRuntime(target_dir, runtime_dir, target_cpu, debug=True) | 305 _CopyRuntime(target_dir, runtime_dir, target_cpu, debug=True) |
| 306 | 306 |
| 307 _CopyDebugger(target_dir, target_cpu) | |
| 308 | |
| 309 | |
| 310 def _CopyDebugger(target_dir, target_cpu): | |
| 311 """Copy cdb.exe into the requested directory as needed. | |
| 312 | |
| 313 target_cpu is one of 'x86' or 'x64'. | |
| 314 | |
| 315 This is used for the GN build. | |
| 316 """ | |
| 317 win_sdk_dir = SetEnvironmentAndGetSDKDir() | |
| 318 if not win_sdk_dir: | |
| 319 return | |
| 320 | |
| 321 debugger_files = ( | |
| 322 'cdb.exe', 'dbgeng.dll', 'dbghelp.dll', 'dbgmodel.dll', 'dbgcore.dll') | |
| 323 | |
| 324 for debug_file in debugger_files: | |
| 325 full_path = os.path.join(win_sdk_dir, 'Debuggers', target_cpu, debug_file) | |
| 326 target_path = os.path.join(target_dir, debug_file) | |
| 327 _CopyRuntimeImpl(target_path, full_path) | |
| 328 | |
| 329 | 307 |
| 330 def _GetDesiredVsToolchainHashes(): | 308 def _GetDesiredVsToolchainHashes(): |
| 331 """Load a list of SHA1s corresponding to the toolchains that we want installed | 309 """Load a list of SHA1s corresponding to the toolchains that we want installed |
| 332 to build with.""" | 310 to build with.""" |
| 333 env_version = GetVisualStudioVersion() | 311 env_version = GetVisualStudioVersion() |
| 334 if env_version == '2015': | 312 if env_version == '2015': |
| 335 # Update 3 final with patches with 10.0.14393.0 SDK. | 313 # Update 3 final with patches with 10.0.14393.0 SDK. |
| 336 return ['d3cb0e37bdd120ad0ac4650b674b09e81be45616'] | 314 return ['d3cb0e37bdd120ad0ac4650b674b09e81be45616'] |
| 337 if env_version == '2017': | 315 if env_version == '2017': |
| 338 # VS 2017 RTM with 10.0.14393.0 SDK and dbghelp.dll fixes. | 316 # VS 2017 RTM with 10.0.14393.0 SDK and dbghelp.dll fixes. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 364 |
| 387 return 0 | 365 return 0 |
| 388 | 366 |
| 389 | 367 |
| 390 def NormalizePath(path): | 368 def NormalizePath(path): |
| 391 while path.endswith("\\"): | 369 while path.endswith("\\"): |
| 392 path = path[:-1] | 370 path = path[:-1] |
| 393 return path | 371 return path |
| 394 | 372 |
| 395 | 373 |
| 396 def SetEnvironmentAndGetSDKDir(): | 374 def GetToolchainDir(): |
| 397 """Gets location information about the current sdk (must have been | 375 """Gets location information about the current toolchain (must have been |
| 398 previously updated by 'update'). This is used for the GN build.""" | 376 previously updated by 'update'). This is used for the GN build.""" |
| 399 runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() | 377 runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() |
| 400 | 378 |
| 401 # If WINDOWSSDKDIR is not set, search the default SDK path and set it. | 379 # If WINDOWSSDKDIR is not set, search the default SDK path and set it. |
| 402 if not 'WINDOWSSDKDIR' in os.environ: | 380 if not 'WINDOWSSDKDIR' in os.environ: |
| 403 default_sdk_path = 'C:\\Program Files (x86)\\Windows Kits\\10' | 381 default_sdk_path = 'C:\\Program Files (x86)\\Windows Kits\\10' |
| 404 if os.path.isdir(default_sdk_path): | 382 if os.path.isdir(default_sdk_path): |
| 405 os.environ['WINDOWSSDKDIR'] = default_sdk_path | 383 os.environ['WINDOWSSDKDIR'] = default_sdk_path |
| 406 | 384 |
| 407 return NormalizePath(os.environ['WINDOWSSDKDIR']) | |
| 408 | |
| 409 | |
| 410 def GetToolchainDir(): | |
| 411 """Gets location information about the current toolchain (must have been | |
| 412 previously updated by 'update'). This is used for the GN build.""" | |
| 413 runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() | |
| 414 win_sdk_dir = SetEnvironmentAndGetSDKDir() | |
| 415 | |
| 416 print '''vs_path = "%s" | 385 print '''vs_path = "%s" |
| 417 sdk_path = "%s" | 386 sdk_path = "%s" |
| 418 vs_version = "%s" | 387 vs_version = "%s" |
| 419 wdk_dir = "%s" | 388 wdk_dir = "%s" |
| 420 runtime_dirs = "%s" | 389 runtime_dirs = "%s" |
| 421 ''' % ( | 390 ''' % ( |
| 422 NormalizePath(os.environ['GYP_MSVS_OVERRIDE_PATH']), | 391 NormalizePath(os.environ['GYP_MSVS_OVERRIDE_PATH']), |
| 423 win_sdk_dir, | 392 NormalizePath(os.environ['WINDOWSSDKDIR']), |
| 424 GetVisualStudioVersion(), | 393 GetVisualStudioVersion(), |
| 425 NormalizePath(os.environ.get('WDK_DIR', '')), | 394 NormalizePath(os.environ.get('WDK_DIR', '')), |
| 426 os.path.pathsep.join(runtime_dll_dirs or ['None'])) | 395 os.path.pathsep.join(runtime_dll_dirs or ['None'])) |
| 427 | 396 |
| 428 | 397 |
| 429 def main(): | 398 def main(): |
| 430 commands = { | 399 commands = { |
| 431 'update': Update, | 400 'update': Update, |
| 432 'get_toolchain_dir': GetToolchainDir, | 401 'get_toolchain_dir': GetToolchainDir, |
| 433 'copy_dlls': CopyDlls, | 402 'copy_dlls': CopyDlls, |
| 434 } | 403 } |
| 435 if len(sys.argv) < 2 or sys.argv[1] not in commands: | 404 if len(sys.argv) < 2 or sys.argv[1] not in commands: |
| 436 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) | 405 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) |
| 437 return 1 | 406 return 1 |
| 438 return commands[sys.argv[1]](*sys.argv[2:]) | 407 return commands[sys.argv[1]](*sys.argv[2:]) |
| 439 | 408 |
| 440 | 409 |
| 441 if __name__ == '__main__': | 410 if __name__ == '__main__': |
| 442 sys.exit(main()) | 411 sys.exit(main()) |
| OLD | NEW |