Skip to content

Commit 696d0fc

Browse files
tools: update gyp-next to 0.22.0
1 parent f2fda60 commit 696d0fc

File tree

12 files changed

+124
-50
lines changed

12 files changed

+124
-50
lines changed

tools/gyp/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,7 @@ static
144144

145145
test/fixtures/out
146146
*.actual
147+
*.sln
148+
*.vcproj
149+
!test/fixtures/expected-win32/**/*.sln
150+
!test/fixtures/expected-win32/**/*.vcproj

tools/gyp/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## [0.22.0](https://github.com/nodejs/gyp-next/compare/v0.21.1...v0.22.0) (2026-04-02)
4+
5+
6+
### Features
7+
8+
* Windows ARM64 target architecture support ([#331](https://github.com/nodejs/gyp-next/issues/331)) ([652a346](https://github.com/nodejs/gyp-next/commit/652a346bbd3b077a4b08a3c37d48100ce200758a))
9+
10+
11+
### Bug Fixes
12+
13+
* drop deprecated Python module pkg_resources ([#333](https://github.com/nodejs/gyp-next/issues/333)) ([5b180d5](https://github.com/nodejs/gyp-next/commit/5b180d52d03aff062bdea1ad0209b82271c7eb4a))
14+
315
## [0.21.1](https://github.com/nodejs/gyp-next/compare/v0.21.0...v0.21.1) (2026-01-24)
416

517

tools/gyp/pylib/gyp/MSVSVersion.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def DefaultToolset(self):
8787
def _SetupScriptInternal(self, target_arch):
8888
"""Returns a command (with arguments) to be used to set up the
8989
environment."""
90-
assert target_arch in ("x86", "x64"), "target_arch not supported"
90+
assert target_arch in ("x86", "x64", "arm64"), "target_arch not supported"
9191
# If WindowsSDKDir is set and SetEnv.Cmd exists then we are using the
9292
# depot_tools build tools and should run SetEnv.Cmd to set up the
9393
# environment. The check for WindowsSDKDir alone is not sufficient because
@@ -109,8 +109,16 @@ def _SetupScriptInternal(self, target_arch):
109109
)
110110

111111
# Always use a native executable, cross-compiling if necessary.
112-
host_arch = "amd64" if is_host_arch_x64 else "x86"
113-
msvc_target_arch = "amd64" if target_arch == "x64" else "x86"
112+
host_arch = (
113+
"amd64"
114+
if is_host_arch_x64
115+
else (
116+
"arm64"
117+
if os.environ.get("PROCESSOR_ARCHITECTURE") == "ARM64"
118+
else "x86"
119+
)
120+
)
121+
msvc_target_arch = {"x64": "amd64"}.get(target_arch, target_arch)
114122
arg = host_arch
115123
if host_arch != msvc_target_arch:
116124
arg += "_" + msvc_target_arch

tools/gyp/pylib/gyp/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import shlex
1414
import sys
1515
import traceback
16+
from importlib.metadata import version
1617

1718
import gyp.input
1819
from gyp.common import GypError
@@ -491,9 +492,7 @@ def gyp_main(args):
491492

492493
options, build_files_arg = parser.parse_args(args)
493494
if options.version:
494-
import pkg_resources # noqa: PLC0415
495-
496-
print(f"v{pkg_resources.get_distribution('gyp-next').version}")
495+
print(f"v{version('gyp-next')}")
497496
return 0
498497
build_files = build_files_arg
499498

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def __init__(
246246
if flavor == "win":
247247
# See docstring of msvs_emulation.GenerateEnvironmentFiles().
248248
self.win_env = {}
249-
for arch in ("x86", "x64"):
249+
for arch in ("x86", "x64", "arm64"):
250250
self.win_env[arch] = "environment." + arch
251251

252252
# Relative path from build output dir to base dir.
@@ -2339,6 +2339,7 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, config_name
23392339
master_ninja.variable("rc", "rc.exe")
23402340
master_ninja.variable("ml_x86", "ml.exe")
23412341
master_ninja.variable("ml_x64", "ml64.exe")
2342+
master_ninja.variable("ml_arm64", "armasm64.exe")
23422343
master_ninja.variable("mt", "mt.exe")
23432344
else:
23442345
master_ninja.variable("ld", CommandWithWrapper("LINK", wrappers, ld))

tools/gyp/pylib/gyp/generator/ninja_test.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,36 @@
1111
from pathlib import Path
1212

1313
from gyp.generator import ninja
14+
from gyp.MSVSVersion import SelectVisualStudioVersion
15+
16+
17+
def _has_visual_studio():
18+
"""Check if Visual Studio can be detected by gyp's registry-based detection."""
19+
if not sys.platform.startswith("win"):
20+
return False
21+
try:
22+
SelectVisualStudioVersion("auto", allow_fallback=False)
23+
return True
24+
except ValueError:
25+
return False
1426

1527

1628
class TestPrefixesAndSuffixes(unittest.TestCase):
29+
@unittest.skipUnless(
30+
_has_visual_studio(),
31+
"requires Windows with a Visual Studio installation detected via the registry",
32+
)
1733
def test_BinaryNamesWindows(self):
18-
# These cannot run on non-Windows as they require a VS installation to
19-
# correctly handle variable expansion.
20-
if sys.platform.startswith("win"):
21-
writer = ninja.NinjaWriter(
22-
"foo", "wee", ".", ".", "build.ninja", ".", "build.ninja", "win"
23-
)
24-
spec = {"target_name": "wee"}
25-
self.assertTrue(
26-
writer.ComputeOutputFileName(spec, "executable").endswith(".exe")
27-
)
28-
self.assertTrue(
29-
writer.ComputeOutputFileName(spec, "shared_library").endswith(".dll")
30-
)
31-
self.assertTrue(
32-
writer.ComputeOutputFileName(spec, "static_library").endswith(".lib")
33-
)
34+
writer = ninja.NinjaWriter(
35+
"foo", "wee", ".", ".", "build.ninja", ".", "build.ninja", "win"
36+
)
37+
spec = {"target_name": "wee"}
38+
for key, ext in {
39+
"executable": ".exe",
40+
"shared_library": ".dll",
41+
"static_library": ".lib",
42+
}:
43+
self.assertTrue(writer.ComputeOutputFileName(spec, key).endswith(ext))
3444

3545
def test_BinaryNamesLinux(self):
3646
writer = ninja.NinjaWriter(

tools/gyp/pylib/gyp/mac_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ def _FindProvisioningProfile(self, profile, bundle_identifier):
545545
# If the user has multiple provisioning profiles installed that can be
546546
# used for ${bundle_identifier}, pick the most specific one (ie. the
547547
# provisioning profile whose pattern is the longest).
548-
selected_key = max(valid_provisioning_profiles, key=lambda v: len(v))
548+
selected_key = max(valid_provisioning_profiles, key=len)
549549
return valid_provisioning_profiles[selected_key]
550550

551551
def _LoadProvisioningProfile(self, profile_path):

tools/gyp/pylib/gyp/msvs_emulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ def GenerateEnvironmentFiles(
11741174
meet your requirement (e.g. for custom toolchains), you can pass
11751175
"-G ninja_use_custom_environment_files" to the gyp to suppress file
11761176
generation and use custom environment files prepared by yourself."""
1177-
archs = ("x86", "x64")
1177+
archs = ("x86", "x64", "arm64")
11781178
if generator_flags.get("ninja_use_custom_environment_files", 0):
11791179
cl_paths = {}
11801180
for arch in archs:

tools/gyp/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "gyp-next"
7-
version = "0.21.1"
7+
version = "0.22.0"
88
authors = [
99
{ name="Node.js contributors", email="ryzokuken@disroot.org" },
1010
]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Microsoft Visual Studio Solution File, Format Version 9.00
2+
# Visual Studio 2005
3+
Project("{*}") = "test", "test.vcproj", "{*}"
4+
EndProject
5+
Global
6+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7+
Default|Win32 = Default|Win32
8+
EndGlobalSection
9+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
10+
{*}.Default|Win32.ActiveCfg = Default|Win32
11+
{*}.Default|Win32.Build.0 = Default|Win32
12+
EndGlobalSection
13+
GlobalSection(SolutionProperties) = preSolution
14+
HideSolutionNode = FALSE
15+
EndGlobalSection
16+
EndGlobal

0 commit comments

Comments
 (0)