Skip to content

Commit 2d3be6a

Browse files
nodejs-github-botaduh95
authored andcommitted
tools: update gyp-next to 0.22.3
PR-URL: #66397 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Xuguang Mei <meixuguang@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent 6b5ac2a commit 2d3be6a

13 files changed

Lines changed: 180 additions & 28 deletions

File tree

β€Žtools/gyp/CHANGELOG.mdβ€Ž

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

3+
## [0.22.3](https://github.com/nodejs/gyp-next/compare/v0.22.2...v0.22.3) (2026-09-29)
4+
5+
6+
### Bug Fixes
7+
8+
* add Python 3.15 beta to the testing ([#344](https://github.com/nodejs/gyp-next/issues/344)) ([bb6522f](https://github.com/nodejs/gyp-next/commit/bb6522fbacc620da2cc382484d75c75ee35d780c))
9+
* **ci:** add zizmor security linter for github actions ([#358](https://github.com/nodejs/gyp-next/issues/358)) ([3d4c42b](https://github.com/nodejs/gyp-next/commit/3d4c42b386582df54368c29fcd7c3121737451a2))
10+
* **ci:** enable Python 3.15 release candidate on Windows ([#357](https://github.com/nodejs/gyp-next/issues/357)) ([e2080d2](https://github.com/nodejs/gyp-next/commit/e2080d25c31a0c1f08178a52802be7fd56848376))
11+
* **ci:** test on npm@12 ([#359](https://github.com/nodejs/gyp-next/issues/359)) ([1729f6e](https://github.com/nodejs/gyp-next/commit/1729f6e3bf8071d95cda85129cdf4ebab0a877ef))
12+
* **ci:** update ruff github aactio to v4.0.0 ([#348](https://github.com/nodejs/gyp-next/issues/348)) ([8d213cd](https://github.com/nodejs/gyp-next/commit/8d213cd35cec96e91dc98359ccd247404f71f27b))
13+
* **cmake:** add a dummy source to libraries without sources ([#362](https://github.com/nodejs/gyp-next/issues/362)) ([391165e](https://github.com/nodejs/gyp-next/commit/391165e76f682a318216b8b5c6ca1de0ef5f8f24))
14+
* **cmake:** require CMake 3.10 and quote custom command comments ([#361](https://github.com/nodejs/gyp-next/issues/361)) ([b418211](https://github.com/nodejs/gyp-next/commit/b418211c49705c0fb42177b666c140cf96d0149f))
15+
* write pch cflags as a list instead of a map object ([#355](https://github.com/nodejs/gyp-next/issues/355)) ([fe8188c](https://github.com/nodejs/gyp-next/commit/fe8188c6af0cf53488960b0ec655b1dcc01a7c94))
16+
317
## [0.22.2](https://github.com/nodejs/gyp-next/compare/v0.22.1...v0.22.2) (2026-04-22)
418

519

β€Žtools/gyp/README.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ When used as a command line utility, __gyp-next__ can also be installed with [pi
1111
* `uv tool install gyp-next`
1212
```
1313
Installing to a new venv 'gyp-next'
14-
installed package gyp-next 0.13.0, installed using Python 3.10.6
14+
installed package gyp-next 0.13.0, installed using Python 3.14.7
1515
These apps are now globally available
1616
- gyp
1717
done! ✨ 🌟 ✨
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
'body-max-line-length': [0, 'always'],
5+
},
6+
};

β€Žtools/gyp/pylib/gyp/generator/cmake.pyβ€Ž

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,9 @@ def WriteActions(target_name, actions, extra_sources, extra_deps, path_to_gyp, o
304304
output.write(path_to_gyp)
305305
output.write("\n")
306306

307-
output.write(" COMMENT ")
308-
if "message" in action:
309-
output.write(action["message"])
310-
else:
311-
output.write(action_target_name)
312-
output.write("\n")
307+
output.write(' COMMENT "')
308+
output.write(CMakeStringEscape(action.get("message", action_target_name)))
309+
output.write('"\n')
313310

314311
output.write(" VERBATIM\n")
315312
output.write(")\n")
@@ -415,12 +412,9 @@ def WriteRules(target_name, rules, extra_sources, extra_deps, path_to_gyp, outpu
415412
output.write(path_to_gyp)
416413
output.write("\n")
417414

418-
output.write(" COMMENT ")
419-
if "message" in rule:
420-
output.write(rule["message"])
421-
else:
422-
output.write(action_name)
423-
output.write("\n")
415+
output.write(' COMMENT "')
416+
output.write(CMakeStringEscape(rule.get("message", action_name)))
417+
output.write('"\n')
424418

425419
output.write(" VERBATIM\n")
426420
output.write(")\n")
@@ -537,9 +531,9 @@ def __init__(self, ext, command):
537531
output.write(path_to_gyp)
538532
output.write("\n")
539533

540-
output.write("COMMENT Copying for ")
541-
output.write(target_name)
542-
output.write("\n")
534+
output.write('COMMENT "Copying for ')
535+
output.write(CMakeStringEscape(target_name))
536+
output.write('"\n')
543537

544538
output.write("VERBATIM\n")
545539
output.write(")\n")
@@ -779,8 +773,10 @@ def WriteTarget(
779773
other_sources_name = cmake_target_name + "__other_srcs"
780774
SetVariableList(output, other_sources_name, other_sources)
781775

782-
# CMake gets upset when executable targets provide no sources.
776+
# CMake gets upset when executable or library targets provide no sources.
783777
# http://www.cmake.org/pipermail/cmake/2010-July/038461.html
778+
# Libraries without sources are used to aggregate dependencies; build an
779+
# empty library for them, as the make generator does.
784780
dummy_sources_name = None
785781
has_sources = (
786782
s_sources_name
@@ -789,7 +785,7 @@ def WriteTarget(
789785
or linkable_sources_name
790786
or other_sources_name
791787
)
792-
if target_type == "executable" and not has_sources:
788+
if target_type != "none" and not has_sources:
793789
dummy_sources_name = cmake_target_name + "__dummy_srcs"
794790
SetVariable(
795791
output, dummy_sources_name, "${obj}.${TOOLSET}/${TARGET}/genc/dummy.c"
@@ -1160,8 +1156,7 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, config_to_u
11601156
gyp.common.EnsureDirExists(output_file)
11611157

11621158
output = open(output_file, "w")
1163-
output.write("cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)\n")
1164-
output.write("cmake_policy(VERSION 2.8.8)\n")
1159+
output.write("cmake_minimum_required(VERSION 3.10)\n")
11651160

11661161
gyp_file, project_target, _ = gyp.common.ParseQualifiedTarget(target_list[-1])
11671162
output.write("project(")
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/usr/bin/env python3
2+
3+
"""Unit tests for the cmake.py file."""
4+
5+
import io
6+
import types
7+
import unittest
8+
9+
from gyp.generator import cmake
10+
11+
12+
class TestCustomCommandComment(unittest.TestCase):
13+
def test_ActionMessageIsQuotedAndEscaped(self):
14+
output = io.StringIO()
15+
action = {
16+
"action_name": "gen",
17+
"inputs": ["in.txt"],
18+
"outputs": ["out.txt"],
19+
"action": ["python", "gen.py"],
20+
"message": 'Generating "out.txt"; (see #1)',
21+
}
22+
cmake.WriteActions("tgt", [action], [], [], ".", output)
23+
self.assertIn(
24+
' COMMENT "Generating \\"out.txt\\"\\; (see #1)"\n', output.getvalue()
25+
)
26+
27+
def test_ActionWithoutMessageUsesTargetName(self):
28+
output = io.StringIO()
29+
action = {
30+
"action_name": "gen",
31+
"inputs": [],
32+
"outputs": ["out.txt"],
33+
"action": ["python", "gen.py"],
34+
}
35+
cmake.WriteActions("tgt", [action], [], [], ".", output)
36+
self.assertIn(' COMMENT "tgt__gen"\n', output.getvalue())
37+
38+
def test_RuleMessageKeepsVariableReferences(self):
39+
output = io.StringIO()
40+
rule = {
41+
"rule_name": "compile",
42+
"outputs": ["${RULE_INPUT_ROOT}.o"],
43+
"action": ["cc", "${RULE_INPUT_PATH}"],
44+
"rule_sources": ["foo.c"],
45+
"message": "Compiling ${RULE_INPUT_NAME}",
46+
}
47+
cmake.WriteRules("tgt", [rule], [], [], ".", output)
48+
self.assertIn(' COMMENT "Compiling ${RULE_INPUT_NAME}"\n', output.getvalue())
49+
50+
def test_CopiesMessageIsQuoted(self):
51+
output = io.StringIO()
52+
copies = [{"files": ["a.txt"], "destination": "out"}]
53+
cmake.WriteCopies("tgt", copies, [], ".", output)
54+
self.assertIn('COMMENT "Copying for tgt"\n', output.getvalue())
55+
56+
57+
class TestTargetWithoutSources(unittest.TestCase):
58+
def _WriteTarget(self, target_type, sources=()):
59+
qualified_target = "foo.gyp:foo#target"
60+
spec = {
61+
"target_name": "foo",
62+
"type": target_type,
63+
"toolset": "target",
64+
"sources": list(sources),
65+
}
66+
output = io.StringIO()
67+
cmake.WriteTarget(
68+
cmake.CMakeNamer([qualified_target]),
69+
qualified_target,
70+
{qualified_target: spec},
71+
"out/Default",
72+
"Default",
73+
types.SimpleNamespace(toplevel_dir="."),
74+
{},
75+
[qualified_target],
76+
"linux",
77+
output,
78+
)
79+
return output.getvalue()
80+
81+
def test_DummySourceForEmptyTargets(self):
82+
for target_type, add_target in (
83+
("executable", "add_executable(foo"),
84+
("static_library", "add_library(foo STATIC"),
85+
("shared_library", "add_library(foo SHARED"),
86+
("loadable_module", "add_library(foo MODULE"),
87+
):
88+
with self.subTest(target_type=target_type):
89+
output = self._WriteTarget(target_type)
90+
self.assertIn(' file(WRITE "${foo__dummy_srcs}" "")\n', output)
91+
self.assertIn(add_target + " ${foo__dummy_srcs})\n", output)
92+
93+
def test_NoDummySourceForLibraryWithSources(self):
94+
output = self._WriteTarget("static_library", ["foo.c"])
95+
self.assertIn("add_library(foo STATIC ${foo__c_srcs})\n", output)
96+
self.assertNotIn("dummy", output)
97+
98+
def test_NoDummySourceForNoneTarget(self):
99+
output = self._WriteTarget("none")
100+
self.assertIn("add_custom_target(foo SOURCES)\n", output)
101+
self.assertNotIn("dummy", output)
102+
103+
104+
if __name__ == "__main__":
105+
unittest.main()

β€Žtools/gyp/pylib/gyp/msvs_emulation.pyβ€Ž

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,13 +1057,18 @@ def GetFlagsModifications(
10571057
pch_output = ["/Yc" + self._PchHeader()]
10581058
if command == "cxx":
10591059
return (
1060-
[("cflags_cc", map(expand_special, cflags_cc + pch_output))],
1060+
[
1061+
(
1062+
"cflags_cc",
1063+
[expand_special(x) for x in cflags_cc + pch_output],
1064+
)
1065+
],
10611066
self.output_obj,
10621067
[],
10631068
)
10641069
elif command == "cc":
10651070
return (
1066-
[("cflags_c", map(expand_special, cflags_c + pch_output))],
1071+
[("cflags_c", [expand_special(x) for x in cflags_c + pch_output])],
10671072
self.output_obj,
10681073
[],
10691074
)

β€Ž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.22.2"
7+
version = "0.22.3"
88
authors = [
99
{ name="Node.js contributors", email="ryzokuken@disroot.org" },
1010
]

β€Žtools/gyp/test/fixtures/expected-darwin/cmake/CMakeLists.txtβ€Ž

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
2-
cmake_policy(VERSION 2.8.8)
1+
cmake_minimum_required(VERSION 3.10)
32
project(test)
43
set(configuration "Default")
54
enable_language(ASM)

β€Žtools/gyp/test/fixtures/expected-linux/cmake/CMakeLists.txtβ€Ž

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
2-
cmake_policy(VERSION 2.8.8)
1+
cmake_minimum_required(VERSION 3.10)
32
project(test)
43
set(configuration "Default")
54
enable_language(ASM)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "pch.h"

0 commit comments

Comments
Β (0)