Skip to content

Commit

Permalink
tools: update gyp-next to v0.10.0
Browse files Browse the repository at this point in the history
PR-URL: #39857
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
  • Loading branch information
targos committed Sep 6, 2021
1 parent 5851994 commit 9763561
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tools/gyp/.github/workflows/Python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: Lint with flake8
run: flake8 . --count --show-source --statistics
run: flake8 . --ignore=E203,W503 --max-complexity=101 --max-line-length=88 --show-source --statistics
- name: Test with pytest
run: pytest
# - name: Run doctests with pytest
Expand Down
15 changes: 15 additions & 0 deletions tools/gyp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## [0.10.0](https://www.github.com/nodejs/gyp-next/compare/v0.9.6...v0.10.0) (2021-08-26)


### Features

* **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))

### [0.9.6](https://www.github.com/nodejs/gyp-next/compare/v0.9.5...v0.9.6) (2021-08-23)


### Bug Fixes

* align flake8 test ([#122](https://www.github.com/nodejs/gyp-next/issues/122)) ([f1faa8d](https://www.github.com/nodejs/gyp-next/commit/f1faa8d3081e1a47e917ff910892f00dff16cf8a))
* **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))

### [0.9.5](https://www.github.com/nodejs/gyp-next/compare/v0.9.4...v0.9.5) (2021-08-18)


Expand Down
17 changes: 16 additions & 1 deletion tools/gyp/pylib/gyp/MSVSVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,18 @@ def _CreateVersion(name, path, sdk_based=False):
if path:
path = os.path.normpath(path)
versions = {
"2022": VisualStudioVersion(
"2022",
"Visual Studio 2022",
solution_version="12.00",
project_version="17.0",
flat_sln=False,
uses_vcxproj=True,
path=path,
sdk_based=sdk_based,
default_toolset="v143",
compatible_sdks=["v8.1", "v10.0"],
),
"2019": VisualStudioVersion(
"2019",
"Visual Studio 2019",
Expand Down Expand Up @@ -436,6 +448,7 @@ def _DetectVisualStudioVersions(versions_to_check, force_express):
2015 - Visual Studio 2015 (14)
2017 - Visual Studio 2017 (15)
2019 - Visual Studio 2019 (16)
2022 - Visual Studio 2022 (17)
Where (e) is e for express editions of MSVS and blank otherwise.
"""
version_to_year = {
Expand All @@ -447,6 +460,7 @@ def _DetectVisualStudioVersions(versions_to_check, force_express):
"14.0": "2015",
"15.0": "2017",
"16.0": "2019",
"17.0": "2022",
}
versions = []
for version in versions_to_check:
Expand Down Expand Up @@ -522,7 +536,7 @@ def SelectVisualStudioVersion(version="auto", allow_fallback=True):
if version == "auto":
version = os.environ.get("GYP_MSVS_VERSION", "auto")
version_map = {
"auto": ("16.0", "15.0", "14.0", "12.0", "10.0", "9.0", "8.0", "11.0"),
"auto": ("17.0", "16.0", "15.0", "14.0", "12.0", "10.0", "9.0", "8.0", "11.0"),
"2005": ("8.0",),
"2005e": ("8.0",),
"2008": ("9.0",),
Expand All @@ -536,6 +550,7 @@ def SelectVisualStudioVersion(version="auto", allow_fallback=True):
"2015": ("14.0",),
"2017": ("15.0",),
"2019": ("16.0",),
"2022": ("17.0",),
}
override_path = os.environ.get("GYP_MSVS_OVERRIDE_PATH")
if override_path:
Expand Down
23 changes: 17 additions & 6 deletions tools/gyp/pylib/gyp/generator/msvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def _NormalizedSource(source):
return source


def _FixPath(path):
def _FixPath(path, separator="\\"):
"""Convert paths to a form that will make sense in a vcproj file.
Arguments:
Expand All @@ -168,9 +168,12 @@ def _FixPath(path):
and not _IsWindowsAbsPath(path)
):
path = os.path.join(fixpath_prefix, path)
path = path.replace("/", "\\")
if separator == "\\":
path = path.replace("/", "\\")
path = _NormalizedSource(path)
if path and path[-1] == "\\":
if separator == "/":
path = path.replace("\\", "/")
if path and path[-1] == separator:
path = path[:-1]
return path

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


def _FixPaths(paths):
def _FixPaths(paths, separator="\\"):
"""Fix each of the paths of the list."""
return [_FixPath(i) for i in paths]
return [_FixPath(i, separator) for i in paths]


def _ConvertSourcesToFilterHierarchy(
Expand Down Expand Up @@ -418,7 +421,15 @@ def _BuildCommandLineForRuleRaw(
# file out of the raw command string, and some commands (like python) are
# actually batch files themselves.
command.insert(0, "call")
arguments = [i.replace("$(InputDir)", "%INPUTDIR%") for i in cmd[1:]]
# Fix the paths
# TODO(quote): This is a really ugly heuristic, and will miss path fixing
# for arguments like "--arg=path" or "/opt:path".
# If the argument starts with a slash or dash, it's probably a command line
# switch
# Return the path with forward slashes because the command using it might
# not support backslashes.
arguments = [i if (i[:1] in "/-") else _FixPath(i, "/") for i in cmd[1:]]
arguments = [i.replace("$(InputDir)", "%INPUTDIR%") for i in arguments]
arguments = [MSVSSettings.FixVCMacroSlashes(i) for i in arguments]
if quote_cmd:
# Support a mode for using cmd directly.
Expand Down
4 changes: 2 additions & 2 deletions tools/gyp/pylib/gyp/msvs_emulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def EncodeRspFileList(args, quote_cmd):
program = call + " " + os.path.normpath(program)
else:
program = os.path.normpath(args[0])
return (program + " " +
" ".join(QuoteForRspFile(arg, quote_cmd) for arg in args[1:]))
return (program + " "
+ " ".join(QuoteForRspFile(arg, quote_cmd) for arg in args[1:]))


def _GenericRetrieve(root, default, path):
Expand Down
2 changes: 1 addition & 1 deletion tools/gyp/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name="gyp-next",
version="0.9.5",
version="0.10.0",
description="A fork of the GYP build system for use in the Node.js projects",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 9763561

Please sign in to comment.