Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3e75907

Browse filesBrowse files
ryzokukendanielleadams
authored andcommitted
tools: update gyp-next to v0.3.0
PR-URL: #32698 Reviewed-By: Christian Clauss <cclauss@me.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 7361a3f commit 3e75907
Copy full SHA for 3e75907

File tree

Expand file treeCollapse file tree

10 files changed

+141
-64
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

10 files changed

+141
-64
lines changed
Open diff view settings
Collapse file

‎tools/gyp/.github/workflows/Python_tests.yml‎

Copy file name to clipboardExpand all lines: tools/gyp/.github/workflows/Python_tests.yml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
os: [macos-latest, ubuntu-latest] # , windows-latest]
1515
python-version: [2.7, 3.6, 3.7, 3.8] # 3.5,
1616
steps:
17-
- uses: actions/checkout@v1
17+
- uses: actions/checkout@v2
1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v1
19+
uses: actions/setup-python@v2
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install dependencies
Collapse file

‎tools/gyp/CHANGELOG.md‎

Copy file name to clipboard
+32Lines changed: 32 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6+
7+
## [Unreleased]
8+
9+
## [0.3.0] - 2020-06-06
10+
11+
### Added
12+
- Added support for MSVC cross-compilation. This allows compilation on x64 for
13+
a Windows ARM target.
14+
15+
### Fixed
16+
- Fixed XCode CLT version detection on macOS Catalina.
17+
18+
## [0.2.1] - 2020-05-05
19+
20+
### Fixed
21+
- Relicensed to Node.js contributors.
22+
- Fixed Windows bug introduced in v0.2.0.
23+
24+
## [0.2.0] - 2020-04-06
25+
26+
This is the first release of this project, based on https://chromium.googlesource.com/external/gyp
27+
with changes made over the years in Node.js and node-gyp.
28+
29+
[Unreleased]: https://github.com/nodejs/gyp-next/compare/v0.3.0...HEAD
30+
[0.3.0]: https://github.com/nodejs/gyp-next/compare/v0.2.1...v0.3.0
31+
[0.2.1]: https://github.com/nodejs/gyp-next/compare/v0.2.0...v0.2.1
32+
[0.2.0]: https://github.com/nodejs/gyp-next/releases/tag/v0.2.0
Collapse file

‎tools/gyp/pylib/gyp/generator/android.py‎

Copy file name to clipboardExpand all lines: tools/gyp/pylib/gyp/generator/android.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,9 @@ def WriteList(
981981
"""
982982
values = ""
983983
if value_list:
984-
value_list = [quoter(prefix + l) for l in value_list]
984+
value_list = [quoter(prefix + value) for value in value_list]
985985
if local_pathify:
986-
value_list = [self.LocalPathify(l) for l in value_list]
986+
value_list = [self.LocalPathify(value) for value in value_list]
987987
values = " \\\n\t" + " \\\n\t".join(value_list)
988988
self.fp.write("%s :=%s\n\n" % (variable, values))
989989

Collapse file

‎tools/gyp/pylib/gyp/generator/make.py‎

Copy file name to clipboardExpand all lines: tools/gyp/pylib/gyp/generator/make.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1944,7 +1944,7 @@ def WriteList(self, value_list, variable=None, prefix="", quoter=QuoteIfNecessar
19441944
"""
19451945
values = ""
19461946
if value_list:
1947-
value_list = [quoter(prefix + l) for l in value_list]
1947+
value_list = [quoter(prefix + value) for value in value_list]
19481948
values = " \\\n\t" + " \\\n\t".join(value_list)
19491949
self.fp.write("%s :=%s\n\n" % (variable, values))
19501950

Collapse file

‎tools/gyp/pylib/gyp/generator/msvs.py‎

Copy file name to clipboardExpand all lines: tools/gyp/pylib/gyp/generator/msvs.py
+66-29Lines changed: 66 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"STATIC_LIB_SUFFIX": ".lib",
5252
"SHARED_LIB_SUFFIX": ".dll",
5353
"INTERMEDIATE_DIR": "$(IntDir)",
54-
"SHARED_INTERMEDIATE_DIR": "$(OutDir)obj/global_intermediate",
54+
"SHARED_INTERMEDIATE_DIR": "$(OutDir)/obj/global_intermediate",
5555
"OS": "win",
5656
"PRODUCT_DIR": "$(OutDir)",
5757
"LIB_DIR": "$(OutDir)lib",
@@ -1006,7 +1006,7 @@ def _GetMsbuildToolsetOfProject(proj_path, spec, version):
10061006
return toolset
10071007

10081008

1009-
def _GenerateProject(project, options, version, generator_flags):
1009+
def _GenerateProject(project, options, version, generator_flags, spec):
10101010
"""Generates a vcproj file.
10111011
10121012
Arguments:
@@ -1024,7 +1024,7 @@ def _GenerateProject(project, options, version, generator_flags):
10241024
return []
10251025

10261026
if version.UsesVcxproj():
1027-
return _GenerateMSBuildProject(project, options, version, generator_flags)
1027+
return _GenerateMSBuildProject(project, options, version, generator_flags, spec)
10281028
else:
10291029
return _GenerateMSVSProject(project, options, version, generator_flags)
10301030

@@ -1904,6 +1904,8 @@ def _GatherSolutionFolders(sln_projects, project_objects, flat):
19041904
# Convert into a tree of dicts on path.
19051905
for p in sln_projects:
19061906
gyp_file, target = gyp.common.ParseQualifiedTarget(p)[0:2]
1907+
if p.endswith("#host"):
1908+
target += "_host"
19071909
gyp_dir = os.path.dirname(gyp_file)
19081910
path_dict = _GetPathDict(root, gyp_dir)
19091911
path_dict[target + ".vcproj"] = project_objects[p]
@@ -1922,9 +1924,10 @@ def _GetPathOfProject(qualified_target, spec, options, msvs_version):
19221924
default_config = _GetDefaultConfiguration(spec)
19231925
proj_filename = default_config.get("msvs_existing_vcproj")
19241926
if not proj_filename:
1925-
proj_filename = (
1926-
spec["target_name"] + options.suffix + msvs_version.ProjectExtension()
1927-
)
1927+
proj_filename = spec["target_name"]
1928+
if spec["toolset"] == "host":
1929+
proj_filename += "_host"
1930+
proj_filename = proj_filename + options.suffix + msvs_version.ProjectExtension()
19281931

19291932
build_file = gyp.common.BuildFile(qualified_target)
19301933
proj_path = os.path.join(os.path.dirname(build_file), proj_filename)
@@ -1949,6 +1952,8 @@ def _GetPlatformOverridesOfProject(spec):
19491952
_ConfigBaseName(config_name, _ConfigPlatform(c)),
19501953
platform,
19511954
)
1955+
if spec["toolset"] == "host" and generator_supports_multiple_toolsets:
1956+
fixed_config_fullname = "%s|x64" % (config_name,)
19521957
config_platform_overrides[config_fullname] = fixed_config_fullname
19531958
return config_platform_overrides
19541959

@@ -1969,21 +1974,19 @@ def _CreateProjectObjects(target_list, target_dicts, options, msvs_version):
19691974
projects = {}
19701975
for qualified_target in target_list:
19711976
spec = target_dicts[qualified_target]
1972-
if spec["toolset"] != "target":
1973-
raise GypError(
1974-
"Multiple toolsets not supported in msvs build (target %s)"
1975-
% qualified_target
1976-
)
19771977
proj_path, fixpath_prefix = _GetPathOfProject(
19781978
qualified_target, spec, options, msvs_version
19791979
)
19801980
guid = _GetGuidOfProject(proj_path, spec)
19811981
overrides = _GetPlatformOverridesOfProject(spec)
19821982
build_file = gyp.common.BuildFile(qualified_target)
19831983
# Create object for this project.
1984+
target_name = spec["target_name"]
1985+
if spec["toolset"] == "host":
1986+
target_name += "_host"
19841987
obj = MSVSNew.MSVSProject(
19851988
proj_path,
1986-
name=spec["target_name"],
1989+
name=target_name,
19871990
guid=guid,
19881991
spec=spec,
19891992
build_file=build_file,
@@ -2162,7 +2165,10 @@ def GenerateOutput(target_list, target_dicts, data, params):
21622165
for qualified_target in target_list:
21632166
spec = target_dicts[qualified_target]
21642167
for config_name, config in spec["configurations"].items():
2165-
configs.add(_ConfigFullName(config_name, config))
2168+
config_name = _ConfigFullName(config_name, config)
2169+
configs.add(config_name)
2170+
if config_name == "Release|arm64":
2171+
configs.add("Release|x64")
21662172
configs = list(configs)
21672173

21682174
# Figure out all the projects that will be generated and their guids
@@ -2175,12 +2181,15 @@ def GenerateOutput(target_list, target_dicts, data, params):
21752181
for project in project_objects.values():
21762182
fixpath_prefix = project.fixpath_prefix
21772183
missing_sources.extend(
2178-
_GenerateProject(project, options, msvs_version, generator_flags)
2184+
_GenerateProject(project, options, msvs_version, generator_flags, spec)
21792185
)
21802186
fixpath_prefix = None
21812187

21822188
for build_file in data:
21832189
# Validate build_file extension
2190+
target_only_configs = configs
2191+
if generator_supports_multiple_toolsets:
2192+
target_only_configs = [i for i in configs if i.endswith("arm64")]
21842193
if not build_file.endswith(".gyp"):
21852194
continue
21862195
sln_path = os.path.splitext(build_file)[0] + options.suffix + ".sln"
@@ -2197,7 +2206,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
21972206
sln = MSVSNew.MSVSSolution(
21982207
sln_path,
21992208
entries=root_entries,
2200-
variants=configs,
2209+
variants=target_only_configs,
22012210
websiteProperties=False,
22022211
version=msvs_version,
22032212
)
@@ -2931,22 +2940,24 @@ def _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules):
29312940
easy_xml.WriteXmlIfChanged(content, xml_path, pretty=True, win32=True)
29322941

29332942

2934-
def _GetConfigurationAndPlatform(name, settings):
2943+
def _GetConfigurationAndPlatform(name, settings, spec):
29352944
configuration = name.rsplit("_", 1)[0]
29362945
platform = settings.get("msvs_configuration_platform", "Win32")
2946+
if spec["toolset"] == "host" and platform == "arm64":
2947+
platform = "x64" # Host-only tools are always built for x64
29372948
return (configuration, platform)
29382949

29392950

2940-
def _GetConfigurationCondition(name, settings):
2951+
def _GetConfigurationCondition(name, settings, spec):
29412952
return r"'$(Configuration)|$(Platform)'=='%s|%s'" % _GetConfigurationAndPlatform(
2942-
name, settings
2953+
name, settings, spec
29432954
)
29442955

29452956

2946-
def _GetMSBuildProjectConfigurations(configurations):
2957+
def _GetMSBuildProjectConfigurations(configurations, spec):
29472958
group = ["ItemGroup", {"Label": "ProjectConfigurations"}]
29482959
for (name, settings) in sorted(configurations.items()):
2949-
configuration, platform = _GetConfigurationAndPlatform(name, settings)
2960+
configuration, platform = _GetConfigurationAndPlatform(name, settings, spec)
29502961
designation = "%s|%s" % (configuration, platform)
29512962
group.append(
29522963
[
@@ -3034,7 +3045,7 @@ def _GetMSBuildConfigurationDetails(spec, build_file):
30343045
properties = {}
30353046
for name, settings in spec["configurations"].items():
30363047
msbuild_attributes = _GetMSBuildAttributes(spec, settings, build_file)
3037-
condition = _GetConfigurationCondition(name, settings)
3048+
condition = _GetConfigurationCondition(name, settings, spec)
30383049
character_set = msbuild_attributes.get("CharacterSet")
30393050
config_type = msbuild_attributes.get("ConfigurationType")
30403051
_AddConditionalProperty(properties, condition, "ConfigurationType", config_type)
@@ -3065,12 +3076,12 @@ def _GetMSBuildLocalProperties(msbuild_toolset):
30653076
return properties
30663077

30673078

3068-
def _GetMSBuildPropertySheets(configurations):
3079+
def _GetMSBuildPropertySheets(configurations, spec):
30693080
user_props = r"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
30703081
additional_props = {}
30713082
props_specified = False
30723083
for name, settings in sorted(configurations.items()):
3073-
configuration = _GetConfigurationCondition(name, settings)
3084+
configuration = _GetConfigurationCondition(name, settings, spec)
30743085
if "msbuild_props" in settings:
30753086
additional_props[configuration] = _FixPaths(settings["msbuild_props"])
30763087
props_specified = True
@@ -3223,7 +3234,7 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
32233234

32243235
properties = {}
32253236
for (name, configuration) in sorted(configurations.items()):
3226-
condition = _GetConfigurationCondition(name, configuration)
3237+
condition = _GetConfigurationCondition(name, configuration, spec)
32273238
attributes = _GetMSBuildAttributes(spec, configuration, build_file)
32283239
msbuild_settings = configuration["finalized_msbuild_settings"]
32293240
_AddConditionalProperty(
@@ -3346,7 +3357,7 @@ def _GetMSBuildToolSettingsSections(spec, configurations):
33463357
msbuild_settings = configuration["finalized_msbuild_settings"]
33473358
group = [
33483359
"ItemDefinitionGroup",
3349-
{"Condition": _GetConfigurationCondition(name, configuration)},
3360+
{"Condition": _GetConfigurationCondition(name, configuration, spec)},
33503361
]
33513362
for tool_name, tool_settings in sorted(msbuild_settings.items()):
33523363
# Skip the tool named '' which is a holder of global settings handled
@@ -3626,7 +3637,7 @@ def _AddSources2(
36263637

36273638
if precompiled_source == source:
36283639
condition = _GetConfigurationCondition(
3629-
config_name, configuration
3640+
config_name, configuration, spec
36303641
)
36313642
detail.append(
36323643
["PrecompiledHeader", {"Condition": condition}, "Create"]
@@ -3653,7 +3664,21 @@ def _GetMSBuildProjectReferences(project):
36533664
references = []
36543665
if project.dependencies:
36553666
group = ["ItemGroup"]
3667+
added_dependency_set = set()
36563668
for dependency in project.dependencies:
3669+
dependency_spec = dependency.spec
3670+
should_skip_dep = False
3671+
if project.spec["toolset"] == "target":
3672+
if dependency_spec["toolset"] == "host":
3673+
if dependency_spec["type"] == "static_library":
3674+
should_skip_dep = True
3675+
if dependency.name.startswith("run_"):
3676+
should_skip_dep = False
3677+
if should_skip_dep:
3678+
continue
3679+
3680+
canonical_name = dependency.name.replace("_host", "")
3681+
added_dependency_set.add(canonical_name)
36573682
guid = dependency.guid
36583683
project_dir = os.path.split(project.path)[0]
36593684
relative_path = gyp.common.RelativePath(dependency.path, project_dir)
@@ -3676,7 +3701,7 @@ def _GetMSBuildProjectReferences(project):
36763701
return references
36773702

36783703

3679-
def _GenerateMSBuildProject(project, options, version, generator_flags):
3704+
def _GenerateMSBuildProject(project, options, version, generator_flags, spec):
36803705
spec = project.spec
36813706
configurations = spec["configurations"]
36823707
project_dir, project_file_name = os.path.split(project.path)
@@ -3775,7 +3800,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37753800
},
37763801
]
37773802

3778-
content += _GetMSBuildProjectConfigurations(configurations)
3803+
content += _GetMSBuildProjectConfigurations(configurations, spec)
37793804
content += _GetMSBuildGlobalProperties(
37803805
spec, version, project.guid, project_file_name
37813806
)
@@ -3790,7 +3815,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37903815
if spec.get("msvs_enable_marmasm"):
37913816
content += import_marmasm_props_section
37923817
content += _GetMSBuildExtensions(props_files_of_rules)
3793-
content += _GetMSBuildPropertySheets(configurations)
3818+
content += _GetMSBuildPropertySheets(configurations, spec)
37943819
content += macro_section
37953820
content += _GetMSBuildConfigurationGlobalProperties(
37963821
spec, configurations, project.build_file
@@ -3894,15 +3919,27 @@ def _GenerateActionsForMSBuild(spec, actions_to_add):
38943919
sources_handled_by_action = OrderedSet()
38953920
actions_spec = []
38963921
for primary_input, actions in actions_to_add.items():
3922+
if generator_supports_multiple_toolsets:
3923+
primary_input = primary_input.replace(".exe", "_host.exe")
38973924
inputs = OrderedSet()
38983925
outputs = OrderedSet()
38993926
descriptions = []
39003927
commands = []
39013928
for action in actions:
3929+
3930+
def fixup_host_exe(i):
3931+
if "$(OutDir)" in i:
3932+
i = i.replace(".exe", "_host.exe")
3933+
return i
3934+
3935+
if generator_supports_multiple_toolsets:
3936+
action["inputs"] = [fixup_host_exe(i) for i in action["inputs"]]
39023937
inputs.update(OrderedSet(action["inputs"]))
39033938
outputs.update(OrderedSet(action["outputs"]))
39043939
descriptions.append(action["description"])
39053940
cmd = action["command"]
3941+
if generator_supports_multiple_toolsets:
3942+
cmd = cmd.replace(".exe", "_host.exe")
39063943
# For most actions, add 'call' so that actions that invoke batch files
39073944
# return and continue executing. msbuild_use_call provides a way to
39083945
# disable this but I have not seen any adverse effect from doing that
Collapse file

‎tools/gyp/pylib/gyp/generator/ninja.py‎

Copy file name to clipboardExpand all lines: tools/gyp/pylib/gyp/generator/ninja.py
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,16 +1481,18 @@ def WriteLinkForArch(
14811481
library_dirs = config.get("library_dirs", [])
14821482
if self.flavor == "win":
14831483
library_dirs = [
1484-
self.msvs_settings.ConvertVSMacros(l, config_name) for l in library_dirs
1484+
self.msvs_settings.ConvertVSMacros(library_dir, config_name)
1485+
for library_dir in library_dirs
14851486
]
14861487
library_dirs = [
1487-
"/LIBPATH:" + QuoteShellArgument(self.GypPathToNinja(l), self.flavor)
1488-
for l in library_dirs
1488+
"/LIBPATH:"
1489+
+ QuoteShellArgument(self.GypPathToNinja(library_dir), self.flavor)
1490+
for library_dir in library_dirs
14891491
]
14901492
else:
14911493
library_dirs = [
1492-
QuoteShellArgument("-L" + self.GypPathToNinja(l), self.flavor)
1493-
for l in library_dirs
1494+
QuoteShellArgument("-L" + self.GypPathToNinja(library_dir), self.flavor)
1495+
for library_dir in library_dirs
14941496
]
14951497

14961498
libraries = gyp.common.uniquer(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.