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

Side by Side Diff: build/vs_toolchain.py

Issue 3003433002: [infra] Remove dependency on gyp (Closed)
Patch Set: Remove another dead script Created 3 years, 4 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 | « DEPS ('k') | runtime/tools/generate_projects.py » ('j') | 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 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
11 import shutil 11 import shutil
12 import stat 12 import stat
13 import subprocess 13 import subprocess
14 import sys 14 import sys
15 15
16 16
17 script_dir = os.path.dirname(os.path.realpath(__file__)) 17 script_dir = os.path.dirname(os.path.realpath(__file__))
18 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir)) 18 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir))
19 SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 19 SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
20 sys.path.insert(1, os.path.join(chrome_src, 'tools')) 20 sys.path.insert(0, os.path.join(chrome_src, 'tools'))
21 sys.path.insert(0, os.path.join(chrome_src, 'third_party', 'gyp', 'pylib'))
22 json_data_file = os.path.join(script_dir, 'win_toolchain.json') 21 json_data_file = os.path.join(script_dir, 'win_toolchain.json')
23 22
24 23
25 import gyp
26
27
28 # Use MSVS2015 as the default toolchain. 24 # Use MSVS2015 as the default toolchain.
29 CURRENT_DEFAULT_TOOLCHAIN_VERSION = '2015' 25 CURRENT_DEFAULT_TOOLCHAIN_VERSION = '2015'
30 26
31 27
32 def SetEnvironmentAndGetRuntimeDllDirs(): 28 def SetEnvironmentAndGetRuntimeDllDirs():
33 """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
34 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
35 the output directory after gyp generation. 31 the output directory after gyp generation.
36 32
37 Return value is [x64path, x86path] or None 33 Return value is [x64path, x86path] or None
(...skipping 16 matching lines...) Expand all
54 if not win_sdk: 50 if not win_sdk:
55 win_sdk = toolchain_data['win8sdk'] 51 win_sdk = toolchain_data['win8sdk']
56 wdk = toolchain_data['wdk'] 52 wdk = toolchain_data['wdk']
57 # TODO(scottmg): The order unfortunately matters in these. They should be 53 # TODO(scottmg): The order unfortunately matters in these. They should be
58 # split into separate keys for x86 and x64. (See CopyVsRuntimeDlls call 54 # split into separate keys for x86 and x64. (See CopyVsRuntimeDlls call
59 # below). http://crbug.com/345992 55 # below). http://crbug.com/345992
60 vs_runtime_dll_dirs = toolchain_data['runtime_dirs'] 56 vs_runtime_dll_dirs = toolchain_data['runtime_dirs']
61 57
62 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain 58 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain
63 os.environ['GYP_MSVS_VERSION'] = version 59 os.environ['GYP_MSVS_VERSION'] = version
64 # We need to make sure windows_sdk_path is set to the automated
65 # toolchain values in GYP_DEFINES, but don't want to override any
66 # otheroptions.express
67 # values there.
68 gyp_defines_dict = gyp.NameValueListToDict(gyp.ShlexEnv('GYP_DEFINES'))
69 gyp_defines_dict['windows_sdk_path'] = win_sdk
70 os.environ['GYP_DEFINES'] = ' '.join('%s=%s' % (k, pipes.quote(str(v)))
71 for k, v in gyp_defines_dict.iteritems())
72 os.environ['WINDOWSSDKDIR'] = win_sdk 60 os.environ['WINDOWSSDKDIR'] = win_sdk
73 os.environ['WDK_DIR'] = wdk 61 os.environ['WDK_DIR'] = wdk
74 # Include the VS runtime in the PATH in case it's not machine-installed. 62 # Include the VS runtime in the PATH in case it's not machine-installed.
75 runtime_path = os.path.pathsep.join(vs_runtime_dll_dirs) 63 runtime_path = os.path.pathsep.join(vs_runtime_dll_dirs)
76 os.environ['PATH'] = runtime_path + os.path.pathsep + os.environ['PATH'] 64 os.environ['PATH'] = runtime_path + os.path.pathsep + os.environ['PATH']
77 elif sys.platform == 'win32' and not depot_tools_win_toolchain: 65 elif sys.platform == 'win32' and not depot_tools_win_toolchain:
78 if not 'GYP_MSVS_OVERRIDE_PATH' in os.environ: 66 if not 'GYP_MSVS_OVERRIDE_PATH' in os.environ:
79 os.environ['GYP_MSVS_OVERRIDE_PATH'] = DetectVisualStudioPath() 67 os.environ['GYP_MSVS_OVERRIDE_PATH'] = DetectVisualStudioPath()
80 if not 'GYP_MSVS_VERSION' in os.environ: 68 if not 'GYP_MSVS_VERSION' in os.environ:
81 os.environ['GYP_MSVS_VERSION'] = GetVisualStudioVersion() 69 os.environ['GYP_MSVS_VERSION'] = GetVisualStudioVersion()
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 'copy_dlls': CopyDlls, 384 'copy_dlls': CopyDlls,
397 } 385 }
398 if len(sys.argv) < 2 or sys.argv[1] not in commands: 386 if len(sys.argv) < 2 or sys.argv[1] not in commands:
399 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) 387 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands)
400 return 1 388 return 1
401 return commands[sys.argv[1]](*sys.argv[2:]) 389 return commands[sys.argv[1]](*sys.argv[2:])
402 390
403 391
404 if __name__ == '__main__': 392 if __name__ == '__main__':
405 sys.exit(main()) 393 sys.exit(main())
OLDNEW
« no previous file with comments | « DEPS ('k') | runtime/tools/generate_projects.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698