Skip to content

Commit 9763561

Browse files
committed
tools: update gyp-next to v0.10.0
PR-URL: #39857 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent 5851994 commit 9763561

File tree

6 files changed

+52
-11
lines changed

6 files changed

+52
-11
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
python -m pip install --upgrade pip
2424
pip install -r requirements_dev.txt
2525
- name: Lint with flake8
26-
run: flake8 . --count --show-source --statistics
26+
run: flake8 . --ignore=E203,W503 --max-complexity=101 --max-line-length=88 --show-source --statistics
2727
- name: Test with pytest
2828
run: pytest
2929
# - name: Run doctests with pytest

tools/gyp/CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
## [0.10.0](https://www.github.com/nodejs/gyp-next/compare/v0.9.6...v0.10.0) (2021-08-26)
4+
5+
6+
### Features
7+
8+
* **msvs:** add support for Visual Studio 2022 ([#124](https://www.github.com/nodejs/gyp-next/issues/124)) ([4bd9215](https://www.github.com/nodejs/gyp-next/commit/4bd9215c44d300f06e916aec1d6327c22b78272d))
9+
10+
### [0.9.6](https://www.github.com/nodejs/gyp-next/compare/v0.9.5...v0.9.6) (2021-08-23)
11+
12+
13+
### Bug Fixes
14+
15+
* align flake8 test ([#122](https://www.github.com/nodejs/gyp-next/issues/122)) ([f1faa8d](https://www.github.com/nodejs/gyp-next/commit/f1faa8d3081e1a47e917ff910892f00dff16cf8a))
16+
* **msvs:** fix paths again in action command arguments ([#121](https://www.github.com/nodejs/gyp-next/issues/121)) ([7159dfb](https://www.github.com/nodejs/gyp-next/commit/7159dfbc5758c9ec717e215f2c36daf482c846a1))
17+
318
### [0.9.5](https://www.github.com/nodejs/gyp-next/compare/v0.9.4...v0.9.5) (2021-08-18)
419

520

tools/gyp/pylib/gyp/MSVSVersion.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,18 @@ def _CreateVersion(name, path, sdk_based=False):
269269
if path:
270270
path = os.path.normpath(path)
271271
versions = {
272+
"2022": VisualStudioVersion(
273+
"2022",
274+
"Visual Studio 2022",
275+
solution_version="12.00",
276+
project_version="17.0",
277+
flat_sln=False,
278+
uses_vcxproj=True,
279+
path=path,
280+
sdk_based=sdk_based,
281+
default_toolset="v143",
282+
compatible_sdks=["v8.1", "v10.0"],
283+
),
272284
"2019": VisualStudioVersion(
273285
"2019",
274286
"Visual Studio 2019",
@@ -436,6 +448,7 @@ def _DetectVisualStudioVersions(versions_to_check, force_express):
436448
2015 - Visual Studio 2015 (14)
437449
2017 - Visual Studio 2017 (15)
438450
2019 - Visual Studio 2019 (16)
451+
2022 - Visual Studio 2022 (17)
439452
Where (e) is e for express editions of MSVS and blank otherwise.
440453
"""
441454
version_to_year = {
@@ -447,6 +460,7 @@ def _DetectVisualStudioVersions(versions_to_check, force_express):
447460
"14.0": "2015",
448461
"15.0": "2017",
449462
"16.0": "2019",
463+
"17.0": "2022",
450464
}
451465
versions = []
452466
for version in versions_to_check:
@@ -522,7 +536,7 @@ def SelectVisualStudioVersion(version="auto", allow_fallback=True):
522536
if version == "auto":
523537
version = os.environ.get("GYP_MSVS_VERSION", "auto")
524538
version_map = {
525-
"auto": ("16.0", "15.0", "14.0", "12.0", "10.0", "9.0", "8.0", "11.0"),
539+
"auto": ("17.0", "16.0", "15.0", "14.0", "12.0", "10.0", "9.0", "8.0", "11.0"),
526540
"2005": ("8.0",),
527541
"2005e": ("8.0",),
528542
"2008": ("9.0",),
@@ -536,6 +550,7 @@ def SelectVisualStudioVersion(version="auto", allow_fallback=True):
536550
"2015": ("14.0",),
537551
"2017": ("15.0",),
538552
"2019": ("16.0",),
553+
"2022": ("17.0",),
539554
}
540555
override_path = os.environ.get("GYP_MSVS_OVERRIDE_PATH")
541556
if override_path:

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

+17-6
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _NormalizedSource(source):
152152
return source
153153

154154

155-
def _FixPath(path):
155+
def _FixPath(path, separator="\\"):
156156
"""Convert paths to a form that will make sense in a vcproj file.
157157
158158
Arguments:
@@ -168,9 +168,12 @@ def _FixPath(path):
168168
and not _IsWindowsAbsPath(path)
169169
):
170170
path = os.path.join(fixpath_prefix, path)
171-
path = path.replace("/", "\\")
171+
if separator == "\\":
172+
path = path.replace("/", "\\")
172173
path = _NormalizedSource(path)
173-
if path and path[-1] == "\\":
174+
if separator == "/":
175+
path = path.replace("\\", "/")
176+
if path and path[-1] == separator:
174177
path = path[:-1]
175178
return path
176179

@@ -185,9 +188,9 @@ def _IsWindowsAbsPath(path):
185188
return path.startswith("c:") or path.startswith("C:")
186189

187190

188-
def _FixPaths(paths):
191+
def _FixPaths(paths, separator="\\"):
189192
"""Fix each of the paths of the list."""
190-
return [_FixPath(i) for i in paths]
193+
return [_FixPath(i, separator) for i in paths]
191194

192195

193196
def _ConvertSourcesToFilterHierarchy(
@@ -418,7 +421,15 @@ def _BuildCommandLineForRuleRaw(
418421
# file out of the raw command string, and some commands (like python) are
419422
# actually batch files themselves.
420423
command.insert(0, "call")
421-
arguments = [i.replace("$(InputDir)", "%INPUTDIR%") for i in cmd[1:]]
424+
# Fix the paths
425+
# TODO(quote): This is a really ugly heuristic, and will miss path fixing
426+
# for arguments like "--arg=path" or "/opt:path".
427+
# If the argument starts with a slash or dash, it's probably a command line
428+
# switch
429+
# Return the path with forward slashes because the command using it might
430+
# not support backslashes.
431+
arguments = [i if (i[:1] in "/-") else _FixPath(i, "/") for i in cmd[1:]]
432+
arguments = [i.replace("$(InputDir)", "%INPUTDIR%") for i in arguments]
422433
arguments = [MSVSSettings.FixVCMacroSlashes(i) for i in arguments]
423434
if quote_cmd:
424435
# Support a mode for using cmd directly.

tools/gyp/pylib/gyp/msvs_emulation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def EncodeRspFileList(args, quote_cmd):
7474
program = call + " " + os.path.normpath(program)
7575
else:
7676
program = os.path.normpath(args[0])
77-
return (program + " " +
78-
" ".join(QuoteForRspFile(arg, quote_cmd) for arg in args[1:]))
77+
return (program + " "
78+
+ " ".join(QuoteForRspFile(arg, quote_cmd) for arg in args[1:]))
7979

8080

8181
def _GenericRetrieve(root, default, path):

tools/gyp/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
setup(
1717
name="gyp-next",
18-
version="0.9.5",
18+
version="0.10.0",
1919
description="A fork of the GYP build system for use in the Node.js projects",
2020
long_description=long_description,
2121
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)