Skip to content

Commit 3a334b1

Browse files
committed
tools: update gyp to eb296f6
* [win] Add support for MS VS2017 (via Registry) REF: https://chromium.googlesource.com/external/gyp/+/eb296f67da078ec01f5e3a9ea9cdc6d26d680161 PR-URL: #12450 Reviewed-By: João Reis <[email protected]>
1 parent 1e7f6b1 commit 3a334b1

25 files changed

+1131
-452
lines changed

tools/gyp/AUTHORS

+3
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ Steven Knight <[email protected]>
1010
Ryan Norton <[email protected]>
1111
David J. Sankel <[email protected]>
1212
Eric N. Vander Weele <[email protected]>
13+
Tom Freudenberg <[email protected]>
14+
Julien Brianceau <[email protected]>
15+
Refael Ackermann <[email protected]>

tools/gyp/DEPS

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
# (You don't need to use gclient for normal GYP development work.)
44

55
vars = {
6-
"chrome_trunk": "http://src.chromium.org/svn/trunk",
7-
"googlecode_url": "http://%s.googlecode.com/svn",
6+
"chromium_git": "https://chromium.googlesource.com/",
87
}
98

109
deps = {
@@ -13,12 +12,12 @@ deps = {
1312
deps_os = {
1413
"win": {
1514
"third_party/cygwin":
16-
Var("chrome_trunk") + "/deps/third_party/cygwin@66844",
15+
Var("chromium_git") + "chromium/deps/cygwin@4fbd5b9",
1716

1817
"third_party/python_26":
19-
Var("chrome_trunk") + "/tools/third_party/python_26@89111",
18+
Var("chromium_git") + "chromium/deps/python_26@5bb4080",
2019

2120
"src/third_party/pefile":
22-
(Var("googlecode_url") % "pefile") + "/trunk@63",
21+
Var("chromium_git") + "external/pefile@72c6ae4",
2322
},
2423
}

tools/gyp/PRESUBMIT.py

-13
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,3 @@ def CheckChangeOnCommit(input_api, output_api):
124124
finally:
125125
sys.path = old_sys_path
126126
return report
127-
128-
129-
TRYBOTS = [
130-
'linux_try',
131-
'mac_try',
132-
'win_try',
133-
]
134-
135-
136-
def GetPreferredTryMasters(_, change):
137-
return {
138-
'client.gyp': { t: set(['defaulttests']) for t in TRYBOTS },
139-
}

tools/gyp/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
GYP can Generate Your Projects.
2+
===================================
3+
4+
Documents are available at [gyp.gsrc.io](https://gyp.gsrc.io), or you can check out ```md-pages``` branch to read those documents offline.

tools/gyp/codereview.settings

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
# This file is used by gcl to get repository specific information.
2-
CODE_REVIEW_SERVER: codereview.chromium.org
1+
# This file is used by git cl to get repository specific information.
32
4-
VIEW_VC: https://chromium.googlesource.com/external/gyp/+/
5-
TRY_ON_UPLOAD: False
6-
TRYSERVER_PROJECT: gyp
7-
TRYSERVER_PATCHLEVEL: 1
8-
TRYSERVER_ROOT: gyp
9-
TRYSERVER_SVN_URL: svn://svn.chromium.org/chrome-try/try-nacl
3+
CODE_REVIEW_SERVER: codereview.chromium.org
4+
GERRIT_HOST: True
105
PROJECT: gyp
6+
VIEW_VC: https://chromium.googlesource.com/external/gyp/+/

tools/gyp/gyptest.py

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import os
1212
import optparse
13+
import shlex
1314
import subprocess
1415
import sys
1516

tools/gyp/pylib/gyp/MSVSSettings.py

+1
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ def _ValidateSettings(validators, settings, stderr):
592592
_Same(_compile, 'UseFullPaths', _boolean) # /FC
593593
_Same(_compile, 'WholeProgramOptimization', _boolean) # /GL
594594
_Same(_compile, 'XMLDocumentationFileName', _file_name)
595+
_Same(_compile, 'CompileAsWinRT', _boolean) # /ZW
595596

596597
_Same(_compile, 'AssemblerOutput',
597598
_Enumeration(['NoListing',

tools/gyp/pylib/gyp/MSVSUtil.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
'loadable_module': 'dll',
1515
'shared_library': 'dll',
1616
'static_library': 'lib',
17+
'windows_driver': 'sys',
1718
}
1819

1920

@@ -110,7 +111,7 @@ def ShardTargets(target_list, target_dicts):
110111
else:
111112
new_target_dicts[t] = target_dicts[t]
112113
# Shard dependencies.
113-
for t in new_target_dicts:
114+
for t in sorted(new_target_dicts):
114115
for deptype in ('dependencies', 'dependencies_original'):
115116
dependencies = copy.copy(new_target_dicts[t].get(deptype, []))
116117
new_dependencies = []

tools/gyp/pylib/gyp/MSVSVersion.py

+42-12
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class VisualStudioVersion(object):
1818

1919
def __init__(self, short_name, description,
2020
solution_version, project_version, flat_sln, uses_vcxproj,
21-
path, sdk_based, default_toolset=None):
21+
path, sdk_based, default_toolset=None, compatible_sdks=None):
2222
self.short_name = short_name
2323
self.description = description
2424
self.solution_version = solution_version
@@ -28,6 +28,9 @@ def __init__(self, short_name, description,
2828
self.path = path
2929
self.sdk_based = sdk_based
3030
self.default_toolset = default_toolset
31+
compatible_sdks = compatible_sdks or []
32+
compatible_sdks.sort(key=lambda v: float(v.replace('v', '')), reverse=True)
33+
self.compatible_sdks = compatible_sdks
3134

3235
def ShortName(self):
3336
return self.short_name
@@ -68,17 +71,19 @@ def DefaultToolset(self):
6871
of a user override."""
6972
return self.default_toolset
7073

71-
def SetupScript(self, target_arch):
74+
def _SetupScriptInternal(self, target_arch):
7275
"""Returns a command (with arguments) to be used to set up the
7376
environment."""
74-
# Check if we are running in the SDK command line environment and use
75-
# the setup script from the SDK if so. |target_arch| should be either
76-
# 'x86' or 'x64'.
77+
# If WindowsSDKDir is set and SetEnv.Cmd exists then we are using the
78+
# depot_tools build tools and should run SetEnv.Cmd to set up the
79+
# environment. The check for WindowsSDKDir alone is not sufficient because
80+
# this is set by running vcvarsall.bat.
7781
assert target_arch in ('x86', 'x64')
7882
sdk_dir = os.environ.get('WindowsSDKDir')
79-
if self.sdk_based and sdk_dir:
80-
return [os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.Cmd')),
81-
'/' + target_arch]
83+
if sdk_dir:
84+
setup_path = os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.Cmd'))
85+
if self.sdk_based and sdk_dir and os.path.exists(setup_path):
86+
return [setup_path, '/' + target_arch]
8287
else:
8388
# We don't use VC/vcvarsall.bat for x86 because vcvarsall calls
8489
# vcvars32, which it can only find if VS??COMNTOOLS is set, which it
@@ -106,6 +111,14 @@ def SetupScript(self, target_arch):
106111
return [os.path.normpath(
107112
os.path.join(self.path, 'VC/vcvarsall.bat')), arg]
108113

114+
def SetupScript(self, target_arch):
115+
script_data = self._SetupScriptInternal(target_arch)
116+
script_path = script_data[0]
117+
if not os.path.exists(script_path):
118+
raise Exception('%s is missing - make sure VC++ tools are installed.' %
119+
script_path)
120+
return script_data
121+
109122

110123
def _RegistryQueryBase(sysdir, key, value):
111124
"""Use reg.exe to read a particular key.
@@ -226,6 +239,16 @@ def _CreateVersion(name, path, sdk_based=False):
226239
if path:
227240
path = os.path.normpath(path)
228241
versions = {
242+
'2017': VisualStudioVersion('2017',
243+
'Visual Studio 2017',
244+
solution_version='12.00',
245+
project_version='15.0',
246+
flat_sln=False,
247+
uses_vcxproj=True,
248+
path=path,
249+
sdk_based=sdk_based,
250+
default_toolset='v141',
251+
compatible_sdks=['v8.1', 'v10.0']),
229252
'2015': VisualStudioVersion('2015',
230253
'Visual Studio 2015',
231254
solution_version='12.00',
@@ -338,14 +361,14 @@ def _DetectVisualStudioVersions(versions_to_check, force_express):
338361
A list of visual studio versions installed in descending order of
339362
usage preference.
340363
Base this on the registry and a quick check if devenv.exe exists.
341-
Only versions 8-10 are considered.
342364
Possibilities are:
343365
2005(e) - Visual Studio 2005 (8)
344366
2008(e) - Visual Studio 2008 (9)
345367
2010(e) - Visual Studio 2010 (10)
346368
2012(e) - Visual Studio 2012 (11)
347369
2013(e) - Visual Studio 2013 (12)
348370
2015 - Visual Studio 2015 (14)
371+
2017 - Visual Studio 2017 (15)
349372
Where (e) is e for express editions of MSVS and blank otherwise.
350373
"""
351374
version_to_year = {
@@ -355,6 +378,7 @@ def _DetectVisualStudioVersions(versions_to_check, force_express):
355378
'11.0': '2012',
356379
'12.0': '2013',
357380
'14.0': '2015',
381+
'15.0': '2017'
358382
}
359383
versions = []
360384
for version in versions_to_check:
@@ -385,13 +409,18 @@ def _DetectVisualStudioVersions(versions_to_check, force_express):
385409

386410
# The old method above does not work when only SDK is installed.
387411
keys = [r'HKLM\Software\Microsoft\VisualStudio\SxS\VC7',
388-
r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VC7']
412+
r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VC7',
413+
r'HKLM\Software\Microsoft\VisualStudio\SxS\VS7',
414+
r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VS7']
389415
for index in range(len(keys)):
390416
path = _RegistryGetValue(keys[index], version)
391417
if not path:
392418
continue
393419
path = _ConvertToCygpath(path)
394-
if version != '14.0': # There is no Express edition for 2015.
420+
if version == '15.0':
421+
if os.path.exists(path):
422+
versions.append(_CreateVersion('2017', path))
423+
elif version != '14.0': # There is no Express edition for 2015.
395424
versions.append(_CreateVersion(version_to_year[version] + 'e',
396425
os.path.join(path, '..'), sdk_based=True))
397426

@@ -410,7 +439,7 @@ def SelectVisualStudioVersion(version='auto', allow_fallback=True):
410439
if version == 'auto':
411440
version = os.environ.get('GYP_MSVS_VERSION', 'auto')
412441
version_map = {
413-
'auto': ('14.0', '12.0', '10.0', '9.0', '8.0', '11.0'),
442+
'auto': ('15.0', '14.0', '12.0', '10.0', '9.0', '8.0', '11.0'),
414443
'2005': ('8.0',),
415444
'2005e': ('8.0',),
416445
'2008': ('9.0',),
@@ -422,6 +451,7 @@ def SelectVisualStudioVersion(version='auto', allow_fallback=True):
422451
'2013': ('12.0',),
423452
'2013e': ('12.0',),
424453
'2015': ('14.0',),
454+
'2017': ('15.0',),
425455
}
426456
override_path = os.environ.get('GYP_MSVS_OVERRIDE_PATH')
427457
if override_path:

tools/gyp/pylib/gyp/common.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -425,13 +425,15 @@ def GetFlavor(params):
425425
return 'freebsd'
426426
if sys.platform.startswith('openbsd'):
427427
return 'openbsd'
428+
if sys.platform.startswith('netbsd'):
429+
return 'netbsd'
428430
if sys.platform.startswith('aix'):
429431
return 'aix'
430432

431433
return 'linux'
432434

433435

434-
def CopyTool(flavor, out_path):
436+
def CopyTool(flavor, out_path, generator_flags={}):
435437
"""Finds (flock|mac|win)_tool.gyp in the gyp directory and copies it
436438
to |out_path|."""
437439
# aix and solaris just need flock emulation. mac and win use more complicated
@@ -451,11 +453,18 @@ def CopyTool(flavor, out_path):
451453
with open(source_path) as source_file:
452454
source = source_file.readlines()
453455

456+
# Set custom header flags.
457+
header = '# Generated by gyp. Do not edit.\n'
458+
mac_toolchain_dir = generator_flags.get('mac_toolchain_dir', None)
459+
if flavor == 'mac' and mac_toolchain_dir:
460+
header += "import os;\nos.environ['DEVELOPER_DIR']='%s'\n" \
461+
% mac_toolchain_dir
462+
454463
# Add header and write it out.
455464
tool_path = os.path.join(out_path, 'gyp-%s-tool' % prefix)
456465
with open(tool_path, 'w') as tool_file:
457466
tool_file.write(
458-
''.join([source[0], '# Generated by gyp. Do not edit.\n'] + source[1:]))
467+
''.join([source[0], header] + source[1:]))
459468

460469
# Make file executable.
461470
os.chmod(tool_path, 0755)

0 commit comments

Comments
 (0)