Skip to content

Commit ea99fea

Browse files
authoredJun 12, 2024··
feat(gyp): update gyp to v0.18.1 (#3039)
* feat(gyp): update gyp to v0.18.1 * ci: setup ninja * ci: visual-studio job use python 3.12
1 parent c495083 commit ea99fea

34 files changed

+3669
-89
lines changed
 

‎.github/workflows/tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ jobs:
115115
python-version: ${{ matrix.python }}
116116
env:
117117
PYTHON_VERSION: ${{ matrix.python }} # Why do this?
118+
- uses: seanmiddleditch/gha-setup-ninja@v4
118119
- name: Install Dependencies
119120
run: |
120121
npm install

‎.github/workflows/visual-studio.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ jobs:
2525
steps:
2626
- name: Checkout Repository
2727
uses: actions/checkout@v4
28+
- name: Use Python 3.12
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: "3.12"
2832
- name: Install Dependencies
2933
run: npm install
3034
- name: Run Node tests
3135
shell: pwsh
32-
run: |
33-
$pythonLocation = (Get-Command python).Source
34-
npm run test --python="${pythonLocation}" --msvs-version="${{ matrix.msvs-version }}"
36+
run: npm run test --python="${env:pythonLocation}\\python.exe" --msvs-version="${{ matrix.msvs-version }}"

‎gyp/.github/dependabot.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Keep GitHub Actions up to date with Dependabot...
2+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
3+
version: 2
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
groups:
8+
GitHub_Actions:
9+
patterns:
10+
- "*" # Group all Actions updates into a single larger pull request
11+
schedule:
12+
interval: weekly
13+
- package-ecosystem: "pip"
14+
directory: "/"
15+
groups:
16+
pip:
17+
patterns:
18+
- "*" # Group all pip updates into a single larger pull request
19+
schedule:
20+
interval: weekly

‎gyp/.github/workflows/Python_tests.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ jobs:
1515
fail-fast: false
1616
max-parallel: 5
1717
matrix:
18-
os: [macos-latest, ubuntu-latest] # , windows-latest]
19-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
18+
os: [macos-13, macos-14, ubuntu-latest] # , windows-latest]
19+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
2020
steps:
2121
- uses: actions/checkout@v4
2222
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v4
23+
uses: actions/setup-python@v5
2424
with:
2525
python-version: ${{ matrix.python-version }}
2626
allow-prereleases: true
27+
- uses: seanmiddleditch/gha-setup-ninja@v4
2728
- name: Install dependencies
2829
run: |
2930
python -m pip install --upgrade pip setuptools
@@ -35,3 +36,7 @@ jobs:
3536
run: pytest
3637
# - name: Run doctests with pytest
3738
# run: pytest --doctest-modules
39+
- name: Test CLI commands on a pipx install
40+
run: |
41+
pipx run --no-cache --spec ./ gyp --help
42+
pipx run --no-cache --spec ./ gyp --version

‎gyp/.github/workflows/node-gyp.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
os: [macos-latest, ubuntu-latest, windows-latest]
14-
python: ["3.8", "3.10", "3.12"]
15-
13+
node-version: ["22"]
14+
os: [macos-13, macos-14, ubuntu-latest, windows-latest]
15+
python-version: ["3.8", "3.10", "3.12", "3.13"]
1616
runs-on: ${{ matrix.os }}
1717
steps:
1818
- name: Clone gyp-next
@@ -24,12 +24,12 @@ jobs:
2424
with:
2525
repository: nodejs/node-gyp
2626
path: node-gyp
27-
- uses: actions/setup-node@v3
27+
- uses: actions/setup-node@v4
2828
with:
29-
node-version: 18.x
30-
- uses: actions/setup-python@v4
29+
node-version: ${{ matrix.node-version }}
30+
- uses: actions/setup-python@v5
3131
with:
32-
python-version: ${{ matrix.python }}
32+
python-version: ${{ matrix.python-version }}
3333
allow-prereleases: true
3434
- name: Install Python dependencies
3535
run: |

‎gyp/.github/workflows/release-please.yml

+87-6
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,91 @@ name: release-please
77
jobs:
88
release-please:
99
runs-on: ubuntu-latest
10+
outputs:
11+
release_created: ${{ steps.release.outputs.release_created }}
12+
tag_name: ${{ steps.release.outputs.tag_name }}
13+
permissions:
14+
contents: write
15+
pull-requests: write
1016
steps:
11-
- uses: google-github-actions/release-please-action@v3
12-
with:
13-
token: ${{ secrets.GITHUB_TOKEN }}
14-
release-type: python
15-
package-name: gyp-next
16-
bump-minor-pre-major: true
17+
- uses: google-github-actions/release-please-action@v4
18+
id: release
19+
20+
build:
21+
name: Build distribution
22+
needs:
23+
- release-please
24+
if: ${{ needs.release-please.outputs.release_created }} # only publish on release
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: "3.12"
32+
- name: Install pypa/build
33+
run: >-
34+
python3 -m pip install build --user
35+
- name: Build a binary wheel and a source tarball
36+
run: python3 -m build
37+
- name: Store the distribution packages
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: python-package-distributions
41+
path: dist/
42+
43+
publish-to-pypi:
44+
name: >-
45+
Publish Python distribution to PyPI
46+
needs:
47+
- release-please
48+
- build
49+
if: ${{ needs.release-please.outputs.release_created }} # only publish on release
50+
runs-on: ubuntu-latest
51+
environment:
52+
name: pypi
53+
url: https://pypi.org/p/gyp-next
54+
permissions:
55+
id-token: write # IMPORTANT: mandatory for trusted publishing
56+
steps:
57+
- name: Download all the dists
58+
uses: actions/download-artifact@v4
59+
with:
60+
name: python-package-distributions
61+
path: dist/
62+
- name: Publish distribution to PyPI
63+
uses: pypa/gh-action-pypi-publish@release/v1
64+
65+
github-release:
66+
name: >-
67+
Publish Python distribution to GitHub Release
68+
needs:
69+
- release-please
70+
- build
71+
if: ${{ needs.release-please.outputs.release_created }} # only publish on release
72+
runs-on: ubuntu-latest
73+
permissions:
74+
contents: write # IMPORTANT: mandatory for making GitHub Releases
75+
id-token: write # IMPORTANT: mandatory for sigstore
76+
steps:
77+
- name: Download all the dists
78+
uses: actions/download-artifact@v4
79+
with:
80+
name: python-package-distributions
81+
path: dist/
82+
- name: Sign the dists with Sigstore
83+
uses: sigstore/gh-action-sigstore-python@v2.1.1
84+
with:
85+
inputs: >-
86+
./dist/*.tar.gz
87+
./dist/*.whl
88+
- name: Upload artifact signatures to GitHub Release
89+
env:
90+
GITHUB_TOKEN: ${{ github.token }}
91+
# Upload to GitHub Release using the `gh` CLI.
92+
# `dist/` contains the built packages, and the
93+
# sigstore-produced signatures and certificates.
94+
run: >-
95+
gh release upload
96+
${{ needs.release-please.outputs.tag_name }} dist/**
97+
--repo '${{ github.repository }}'

‎gyp/.release-please-manifest.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.18.1"
3+
}

‎gyp/CHANGELOG.md

+41
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
# Changelog
22

3+
## [0.18.1](https://github.com/nodejs/gyp-next/compare/v0.18.0...v0.18.1) (2024-05-26)
4+
5+
6+
### Bug Fixes
7+
8+
* **ci:** add Python 3.13 pre-release to test matrix ([#257](https://github.com/nodejs/gyp-next/issues/257)) ([8597203](https://github.com/nodejs/gyp-next/commit/8597203b687325c7516367135e026586279d0583))
9+
10+
11+
### Documentation
12+
13+
* vendor docs from gyp.gsrc.io ([#254](https://github.com/nodejs/gyp-next/issues/254)) ([8d7ba6e](https://github.com/nodejs/gyp-next/commit/8d7ba6e784dedf1122a0456150c739d2a09ecf57))
14+
15+
## [0.18.0](https://github.com/nodejs/gyp-next/compare/v0.17.0...v0.18.0) (2024-05-08)
16+
17+
18+
### Features
19+
20+
* support language standard keys in msvs_settings ([#252](https://github.com/nodejs/gyp-next/issues/252)) ([322f6d5](https://github.com/nodejs/gyp-next/commit/322f6d5d5233967522f3e55c623a8e7d7281e024))
21+
22+
## [0.17.0](https://github.com/nodejs/gyp-next/compare/v0.16.2...v0.17.0) (2024-04-29)
23+
24+
25+
### Features
26+
27+
* generate compile_commands.json with ninja ([#228](https://github.com/nodejs/gyp-next/issues/228)) ([7b20b46](https://github.com/nodejs/gyp-next/commit/7b20b4673d8cf46ff61898eb19569007d55c854a))
28+
29+
30+
### Bug Fixes
31+
32+
* failed to detect flavor if compiler path include white spaces ([#240](https://github.com/nodejs/gyp-next/issues/240)) ([f3b9753](https://github.com/nodejs/gyp-next/commit/f3b9753e7526377020e7d40e66b624db771cf84a))
33+
* support cross compiling for wasm with make generator ([#222](https://github.com/nodejs/gyp-next/issues/222)) ([de0e1c9](https://github.com/nodejs/gyp-next/commit/de0e1c9a5791d1bf4bc3103f878ab74814864ab4))
34+
* support empty dictionary keys in input ([#245](https://github.com/nodejs/gyp-next/issues/245)) ([178459f](https://github.com/nodejs/gyp-next/commit/178459ff343a2771d5f30f04467d2f032d6b3565))
35+
* update Ruff to 0.3.1 ([876ccaf](https://github.com/nodejs/gyp-next/commit/876ccaf5629e1b95e13aaa2b0eb6cbd08fa80593))
36+
37+
## [0.16.2](https://github.com/nodejs/gyp-next/compare/v0.16.1...v0.16.2) (2024-03-07)
38+
39+
40+
### Bug Fixes
41+
42+
* avoid quoting cflag name and parameter with space separator ([#223](https://github.com/nodejs/gyp-next/issues/223)) ([2b9703d](https://github.com/nodejs/gyp-next/commit/2b9703dbd5b3b8a935faf257c6103033b47bf8bf))
43+
344
## [0.16.1](https://github.com/nodejs/gyp-next/compare/v0.16.0...v0.16.1) (2023-10-25)
445

546

‎gyp/CONTRIBUTING.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Contributing to gyp-next
22

3+
## Start contributing
4+
5+
Read the docs at [`./docs/Hacking.md`](./docs/Hacking.md) to get started.
6+
37
## Code of Conduct
48

59
This project is bound to the [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md).

‎gyp/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GYP can Generate Your Projects.
22
===================================
33

4-
Documents are available at [gyp.gsrc.io](https://gyp.gsrc.io), or you can check out ```md-pages``` branch to read those documents offline.
4+
Documents are available at [`./docs`](./docs).
55

66
__gyp-next__ is [released](https://github.com/nodejs/gyp-next/releases) to the [__Python Packaging Index__](https://pypi.org/project/gyp-next) (PyPI) and can be installed with the command:
77
* `python3 -m pip install gyp-next`

‎gyp/data/ninja/build.ninja

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
rule cc
2+
command = cc $in $out
3+
4+
build my.out: cc my.in

‎gyp/docs/GypVsCMake.md

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# vs. CMake
2+
3+
GYP was originally created to generate native IDE project files (Visual Studio, Xcode) for building [Chromium](http://www.chromim.org).
4+
5+
The functionality of GYP is very similar to the [CMake](http://www.cmake.org)
6+
build tool. Bradley Nelson wrote up the following description of why the team
7+
created GYP instead of using CMake. The text below is copied from
8+
http://www.mail-archive.com/webkit-dev@lists.webkit.org/msg11029.html
9+
10+
```
11+
12+
Re: [webkit-dev] CMake as a build system?
13+
Bradley Nelson
14+
Mon, 19 Apr 2010 22:38:30 -0700
15+
16+
Here's the innards of an email with a laundry list of stuff I came up with a
17+
while back on the gyp-developers list in response to Mike Craddick regarding
18+
what motivated gyp's development, since we were aware of cmake at the time
19+
(we'd even started a speculative port):
20+
21+
22+
I did an exploratory port of portions of Chromium to cmake (I think I got as
23+
far as net, base, sandbox, and part of webkit).
24+
There were a number of motivations, not all of which would apply to other
25+
projects. Also, some of the design of gyp was informed by experience at
26+
Google with large projects built wholly from source, leading to features
27+
absent from cmake, but not strictly required for Chromium.
28+
29+
1. Ability to incrementally transition on Windows. It took us about 6 months
30+
to switch fully to gyp. Previous attempts to move to scons had taken a long
31+
time and failed, due to the requirement to transition while in flight. For a
32+
substantial period of time, we had a hybrid of checked in vcproj and gyp generated
33+
vcproj. To this day we still have a good number of GUIDs pinned in the gyp files,
34+
because different parts of our release pipeline have leftover assumptions
35+
regarding manipulating the raw sln/vcprojs. This transition occurred from
36+
the bottom up, largely because modules like base were easier to convert, and
37+
had a lower churn rate. During early stages of the transition, the majority
38+
of the team wasn't even aware they were using gyp, as it integrated into
39+
their existing workflow, and only affected modules that had been converted.
40+
41+
2. Generation of a more 'normal' vcproj file. Gyp attempts, particularly on
42+
Windows, to generate vcprojs which resemble hand generated projects. It
43+
doesn't generate any Makefile type projects, but instead produces msvs
44+
Custom Build Steps and Custom Build Rules. This makes the resulting projects
45+
easier to understand from the IDE and avoids parts of the IDE that simply
46+
don't function correctly if you use Makefile projects. Our early hope with
47+
gyp was to support the least common denominator of features present in each
48+
of the platform specific project file formats, rather than falling back on
49+
generated Makefiles/shell scripts to emulate some common abstraction. CMake by
50+
comparison makes a good faith attempt to use native project features, but
51+
falls back on generated scripts in order to preserve the same semantics on
52+
each platforms.
53+
54+
3. Abstraction on the level of project settings, rather than command line
55+
flags. In gyp's syntax you can add nearly any option present in a hand
56+
generated xcode/vcproj file. This allows you to use abstractions built into
57+
the IDEs rather than reverse engineering them possibly incorrectly for
58+
things like: manifest generation, precompiled headers, bundle generation.
59+
When somebody wants to use a particular menu option from msvs, I'm able to
60+
do a web search on the name of the setting from the IDE and provide them
61+
with a gyp stanza that does the equivalent. In many cases, not all project
62+
file constructs correspond to command line flags.
63+
64+
4. Strong notion of module public/private interface. Gyp allows targets to
65+
publish a set of direct_dependent_settings, specifying things like
66+
include_dirs, defines, platforms specific settings, etc. This means that
67+
when module A depends on module B, it automatically acquires the right build
68+
settings without module A being filled with assumptions/knowledge of exactly
69+
how module B is built. Additionally, all of the transitive dependencies of
70+
module B are pulled in. This avoids their being a single top level view of
71+
the project, rather each gyp file expresses knowledge about its immediate
72+
neighbors. This keep local knowledge local. CMake effectively has a large
73+
shared global namespace.
74+
75+
5. Cross platform generation. CMake is not able to generate all project
76+
files on all platforms. For example xcode projects cannot be generated from
77+
windows (cmake uses mac specific libraries to do project generation). This
78+
means that for instance generating a tarball containing pregenerated
79+
projects for all platforms is hard with Cmake (requires distribution to
80+
several machine types).
81+
82+
6. Gyp has rudimentary cross compile support. Currently we've added enough
83+
functionality to gyp to support x86 -> arm cross compiles. Last I checked
84+
this functionality wasn't present in cmake. (This occurred later).
85+
86+
87+
That being said there are a number of drawbacks currently to gyp:
88+
89+
1. Because platform specific settings are expressed at the project file
90+
level (rather than the command line level). Settings which might otherwise
91+
be shared in common between platforms (flags to gcc on mac/linux), end up
92+
being repeated twice. Though in fairness there is actually less sharing here
93+
than you'd think. include_dirs and defines actually represent 90% of what
94+
can be typically shared.
95+
96+
2. CMake may be more mature, having been applied to a broader range of
97+
projects. There a number of 'tool modules' for cmake, which are shared in a
98+
common community.
99+
100+
3. gyp currently makes some nasty assumptions about the availability of
101+
chromium's hermetic copy of cygwin on windows. This causes you to either
102+
have to special case a number of rules, or swallow this copy of cygwin as a
103+
build time dependency.
104+
105+
4. CMake includes a fairly readable imperative language. Currently Gyp has a
106+
somewhat poorly specified declarative language (variable expansion happens
107+
in sometimes weird and counter-intuitive ways). In fairness though, gyp assumes
108+
that external python scripts can be used as an escape hatch. Also gyp avoids
109+
a lot of the things you'd need imperative code for, by having a nice target
110+
settings publication mechanism.
111+
112+
5. (Feature/drawback depending on personal preference). Gyp's syntax is
113+
DEEPLY nested. It suffers from all of Lisp's advantages and drawbacks.
114+
115+
-BradN
116+
```

0 commit comments

Comments
 (0)
Please sign in to comment.