Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nodejs/node-gyp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b1ad49229272492cf9e030083d3cb4ea81afabb1
Choose a base ref
...
head repository: nodejs/node-gyp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9acb4c73675a67f3f660621e367024daaec1092c
Choose a head ref
Loading
Showing with 9,594 additions and 3,576 deletions.
  1. +1 −1 .github/ISSUE_TEMPLATE.md
  2. +2 −2 .github/PULL_REQUEST_TEMPLATE.md
  3. +41 −0 .github/scripts/check-engines.js
  4. +57 −45 .github/workflows/release-please.yml
  5. +114 −23 .github/workflows/tests.yml
  6. +25 −16 .github/workflows/visual-studio.yml
  7. +4 −3 .gitignore
  8. +15 −0 .npmignore
  9. +171 −0 CHANGELOG.md
  10. +1 −1 CONTRIBUTING.md
  11. +30 −25 README.md
  12. +31 −12 addon.gypi
  13. +27 −29 bin/node-gyp.js
  14. +11 −3 docs/README.md
  15. +1 −1 docs/Updating-npm-bundled-node-gyp.md
  16. +0 −4 gyp/.flake8
  17. +17 −10 gyp/.github/workflows/Python_tests.yml
  18. +31 −13 gyp/.github/workflows/node-gyp.yml
  19. +8 −3 gyp/.github/workflows/nodejs-windows.yml
  20. +2 −2 gyp/.github/workflows/release-please.yml
  21. +1 −0 gyp/AUTHORS
  22. +98 −0 gyp/CHANGELOG.md
  23. +23 −0 gyp/README.md
  24. +12 −14 gyp/pylib/gyp/MSVSNew.py
  25. +1 −1 gyp/pylib/gyp/MSVSProject.py
  26. +1 −1 gyp/pylib/gyp/MSVSSettings.py
  27. +27 −1 gyp/pylib/gyp/__init__.py
  28. +17 −17 gyp/pylib/gyp/common.py
  29. +5 −1 gyp/pylib/gyp/easy_xml.py
  30. +4 −0 gyp/pylib/gyp/easy_xml_test.py
  31. +1 −1 gyp/pylib/gyp/flock_tool.py
  32. +11 −15 gyp/pylib/gyp/generator/analyzer.py
  33. +1 −1 gyp/pylib/gyp/generator/android.py
  34. +3 −6 gyp/pylib/gyp/generator/cmake.py
  35. +6 −3 gyp/pylib/gyp/generator/compile_commands_json.py
  36. +2 −5 gyp/pylib/gyp/generator/eclipse.py
  37. +234 −41 gyp/pylib/gyp/generator/make.py
  38. +46 −43 gyp/pylib/gyp/generator/msvs.py
  39. +6 −9 gyp/pylib/gyp/generator/ninja.py
  40. +2 −5 gyp/pylib/gyp/generator/xcode.py
  41. +28 −50 gyp/pylib/gyp/input.py
  42. +8 −17 gyp/pylib/gyp/msvs_emulation.py
  43. +4 −5 gyp/pylib/gyp/win_tool.py
  44. +3 −9 gyp/pylib/gyp/xcode_emulation.py
  45. +23 −22 gyp/pylib/gyp/xcodeproj_file.py
  46. +3 −0 gyp/pylib/packaging/LICENSE
  47. +177 −0 gyp/pylib/packaging/LICENSE.APACHE
  48. +23 −0 gyp/pylib/packaging/LICENSE.BSD
  49. +15 −0 gyp/pylib/packaging/__init__.py
  50. +108 −0 gyp/pylib/packaging/_elffile.py
  51. +252 −0 gyp/pylib/packaging/_manylinux.py
  52. +83 −0 gyp/pylib/packaging/_musllinux.py
  53. +359 −0 gyp/pylib/packaging/_parser.py
  54. +61 −0 gyp/pylib/packaging/_structures.py
  55. +192 −0 gyp/pylib/packaging/_tokenizer.py
  56. +252 −0 gyp/pylib/packaging/markers.py
  57. +825 −0 gyp/pylib/packaging/metadata.py
  58. 0 gyp/pylib/packaging/py.typed
  59. +90 −0 gyp/pylib/packaging/requirements.py
  60. +1,030 −0 gyp/pylib/packaging/specifiers.py
  61. +553 −0 gyp/pylib/packaging/tags.py
  62. +172 −0 gyp/pylib/packaging/utils.py
  63. +563 −0 gyp/pylib/packaging/version.py
  64. +119 −0 gyp/pyproject.toml
  65. +0 −2 gyp/requirements_dev.txt
  66. +0 −42 gyp/setup.py
  67. +1 −0 gyp/test_gyp.py
  68. +1 −1 gyp/tools/pretty_gyp.py
  69. +2 −2 gyp/tools/pretty_sln.py
  70. +1 −1 gyp/tools/pretty_vcproj.py
  71. +105 −89 lib/build.js
  72. +5 −5 lib/clean.js
  73. +166 −181 lib/configure.js
  74. +14 −11 lib/create-config-gypi.js
  75. +39 −0 lib/download.js
  76. +5 −5 lib/find-node-directory.js
  77. +128 −162 lib/find-python.js
  78. +123 −126 lib/find-visualstudio.js
  79. +187 −148 lib/install.js
  80. +14 −15 lib/list.js
  81. +169 −0 lib/log.js
  82. +147 −174 lib/node-gyp.js
  83. +22 −23 lib/process-release.js
  84. +1 −2 lib/rebuild.js
  85. +18 −21 lib/remove.js
  86. +62 −45 lib/util.js
  87. +0 −104 macOS_Catalina.md
  88. +14 −13 package.json
  89. +22 −1 test/common.js
  90. +569 −0 test/fixtures/VS_2022_Community_workload.txt
  91. +0 −40 test/fixtures/ca-bundle.crt
  92. +0 −21 test/fixtures/ca.crt
  93. +151 −0 test/fixtures/certs.js
  94. +0 −21 test/fixtures/server.crt
  95. +0 −27 test/fixtures/server.key
  96. +0 −140 test/process-exec-sync.js
  97. +2 −2 test/simple-proxy.js
  98. +97 −113 test/test-addon.js
  99. +52 −57 test/test-configure-python.js
  100. +42 −52 test/test-create-config-gypi.js
  101. +181 −187 test/test-download.js
  102. +46 −57 test/test-find-accessible-sync.js
  103. +97 −101 test/test-find-node-directory.js
  104. +144 −195 test/test-find-python.js
  105. +420 −473 test/test-find-visualstudio.js
  106. +100 −36 test/test-install.js
  107. +36 −28 test/test-options.js
  108. +359 −392 test/test-process-release.js
  109. +19 −1 update-gyp.py
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ provide the basic information we require.
-->

Please look thru your error log for the string `gyp info using node-gyp@` and if the version number is less than the [current release of node-gyp](https://github.com/nodejs/node-gyp/releases) then __please upgrade__ using the instructions at https://github.com/nodejs/node-gyp/blob/master/docs/Updating-npm-bundled-node-gyp.md and try your command again.
Please look thru your error log for the string `gyp info using node-gyp@` and if the version number is less than the [current release of node-gyp](https://github.com/nodejs/node-gyp/releases) then __please upgrade__ using the instructions at https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md and try your command again.

Requests for help with [`node-sass` are very common](https://github.com/nodejs/node-gyp/issues?q=label%3A%22Node+Sass+--%3E+Dart+Sass%22). Please be aware that this package is deprecated, you should seek alternatives and avoid opening new issues about it here.

4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!--
Thank you for your pull request. Please review the below requirements.
Contributor guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md
Contributor guide: https://github.com/nodejs/node/blob/main/CONTRIBUTING.md
-->

##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [ ] `npm install && npm test` passes
- [ ] `npm install && npm run lint && npm test` passes
- [ ] tests are included <!-- Bug fixes and new features should include tests -->
- [ ] documentation is changed or added
- [ ] commit message follows [commit guidelines](https://github.com/googleapis/release-please#how-should-i-write-my-commits)
41 changes: 41 additions & 0 deletions .github/scripts/check-engines.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const { join } = require('path')
const semver = require('semver')
const Arborist = require('@npmcli/arborist')

const run = async (path, useEngines) => {
const pkgPath = join(path, 'package.json')
const pkg = require(pkgPath)

const engines = useEngines || pkg.engines.node

const arb = new Arborist({ path })
const tree = await arb.loadActual({ forceActual: true })
const deps = await tree.querySelectorAll(`#${pkg.name} > .prod:attr(engines, [node])`)

const invalid = []
for (const dep of deps) {
const depEngines = dep.target.package.engines.node
if (!semver.subset(engines, depEngines)) {
invalid.push({
name: `${dep.name}@${dep.version}`,
location: dep.location,
engines: depEngines
})
}
}

if (invalid.length) {
const msg = 'The following production dependencies are not compatible with ' +
`\`engines.node: ${engines}\` found in \`${pkgPath}\`:\n` + invalid.map((dep) => [
`${dep.name}:`,
` engines.node: ${dep.engines}`,
` location: ${dep.location}`
].join('\n')).join('\n')
throw new Error(msg)
}
}

run(process.cwd(), ...process.argv.slice(2)).then(() => console.log('Success')).catch((err) => {
console.error(err)
process.exitCode = 1
})
102 changes: 57 additions & 45 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -3,54 +3,66 @@ name: release-please
on:
push:
branches:
- master
- main
pull_request:

jobs:
release-please:
outputs:
pr: ${{ steps.release.outputs.pr }}
permissions:
contents: write # to create release commit (google-github-actions/release-please-action)
pull-requests: write # to create release PR (google-github-actions/release-please-action)

runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v2
id: release
with:
package-name: node-gyp
release-type: node
changelog-types: >
[{"type":"feat","section":"Features","hidden":false},
{"type":"fix","section":"Bug Fixes","hidden":false},
{"type":"bin","section":"Core","hidden":false},
{"type":"gyp","section":"Core","hidden":false},
{"type":"lib","section":"Core","hidden":false},
{"type":"src","section":"Core","hidden":false},
{"type":"test","section":"Tests","hidden":false},
{"type":"build","section":"Core","hidden":false},
{"type":"clean","section":"Core","hidden":false},
{"type":"configure","section":"Core","hidden":false},
{"type":"install","section":"Core","hidden":false},
{"type":"list","section":"Core","hidden":false},
{"type":"rebuild","section":"Core","hidden":false},
{"type":"remove","section":"Core","hidden":false},
{"type":"deps","section":"Core","hidden":false},
{"type":"python","section":"Core","hidden":false},
{"type":"lin","section":"Core","hidden":false},
{"type":"linux","section":"Core","hidden":false},
{"type":"mac","section":"Core","hidden":false},
{"type":"macos","section":"Core","hidden":false},
{"type":"win","section":"Core","hidden":false},
{"type":"windows","section":"Core","hidden":false},
{"type":"zos","section":"Core","hidden":false},
{"type":"doc","section":"Doc","hidden":false},
{"type":"docs","section":"Doc","hidden":false},
{"type":"readme","section":"Doc","hidden":false},
{"type":"chore","section":"Miscellaneous","hidden":false},
{"type":"refactor","section":"Miscellaneous","hidden":false},
{"type":"ci","section":"Miscellaneous","hidden":false},
{"type":"meta","section":"Miscellaneous","hidden":false}]
- uses: google-github-actions/release-please-action@v2
id: release
with:
package-name: node-gyp
release-type: node
changelog-types: >
[{"type":"feat","section":"Features","hidden":false},
{"type":"fix","section":"Bug Fixes","hidden":false},
{"type":"bin","section":"Core","hidden":false},
{"type":"gyp","section":"Core","hidden":false},
{"type":"lib","section":"Core","hidden":false},
{"type":"src","section":"Core","hidden":false},
{"type":"test","section":"Tests","hidden":false},
{"type":"build","section":"Core","hidden":false},
{"type":"clean","section":"Core","hidden":false},
{"type":"configure","section":"Core","hidden":false},
{"type":"install","section":"Core","hidden":false},
{"type":"list","section":"Core","hidden":false},
{"type":"rebuild","section":"Core","hidden":false},
{"type":"remove","section":"Core","hidden":false},
{"type":"deps","section":"Core","hidden":false},
{"type":"python","section":"Core","hidden":false},
{"type":"lin","section":"Core","hidden":false},
{"type":"linux","section":"Core","hidden":false},
{"type":"mac","section":"Core","hidden":false},
{"type":"macos","section":"Core","hidden":false},
{"type":"win","section":"Core","hidden":false},
{"type":"windows","section":"Core","hidden":false},
{"type":"zos","section":"Core","hidden":false},
{"type":"doc","section":"Doc","hidden":false},
{"type":"docs","section":"Doc","hidden":false},
{"type":"readme","section":"Doc","hidden":false},
{"type":"chore","section":"Miscellaneous","hidden":false},
{"type":"refactor","section":"Miscellaneous","hidden":false},
{"type":"ci","section":"Miscellaneous","hidden":false},
{"type":"meta","section":"Miscellaneous","hidden":false}]
# Standard Conventional Commits: `feat` and `fix`
# node-gyp subdirectories: `bin`, `gyp`, `lib`, `src`, `test`
# node-gyp subcommands: `build`, `clean`, `configure`, `install`, `list`, `rebuild`, `remove`
# Core abstract category: `deps`
# Languages/platforms: `python`, `lin`, `linux`, `mac`, `macos`, `win`, `window`, `zos`
# Documentation: `doc`, `docs`, `readme`
# Standard Conventional Commits: `chore` (under "Miscellaneous")
# Miscellaneous abstract categories: `refactor`, `ci`, `meta`

# Standard Conventional Commits: `feat` and `fix`
# node-gyp subdirectories: `bin`, `gyp`, `lib`, `src`, `test`
# node-gyp subcommands: `build`, `clean`, `configure`, `install`, `list`, `rebuild`, `remove`
# Core abstract category: `deps`
# Languages/platforms: `python`, `lin`, `linux`, `mac`, `macos`, `win`, `window`, `zos`
# Documentation: `doc`, `docs`, `readme`
# Standard Conventional Commits: `chore` (under "Miscellaneous")
# Miscellaneous abstract categories: `refactor`, `ci`, `meta`
test:
name: Release Test
needs: [ release-please ]
if: needs.release-please.outputs.pr
uses: ./.github/workflows/tests.yml
137 changes: 114 additions & 23 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,136 @@
# TODO: Line 43, enable pytest --doctest-modules
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
# TODO: add `python -m pytest --doctest-modules`

name: Tests
on: [push, pull_request]
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_call:

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
Tests:
lint-python:
name: Lint Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install --user ruff
- run: ruff --output-format=github --select="E,F,PLC,PLE,UP,W,YTT" --ignore="E721,PLC1901,S101,UP031" --target-version=py38 .

lint-js:
name: Lint JS
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install Dependencies
run: npm install
- name: Lint
run: npm run lint

check-engines:
name: Check Engines
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install Dependencies
run: npm install
- name: Check Engines
run: |
# TODO: move this to its own action
npm install @npmcli/arborist@7 semver@7 --no-save
node .github/scripts/check-engines.js
test-pack:
name: Test Pack
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Update npm
run: npm install npm@latest -g
- name: Install Dependencies
run: npm install
- name: Pack
id: pack
env:
NODE_GYP_TEMP_DIR: '${{ runner.temp }}/node-gyp'
run: |
mkdir -p $NODE_GYP_TEMP_DIR
npm pack
tar xzf *.tgz -C $NODE_GYP_TEMP_DIR --strip-components=1
cp -r test/ $NODE_GYP_TEMP_DIR/test/
echo "dir=$NODE_GYP_TEMP_DIR" >> "$GITHUB_OUTPUT"
- name: Test
working-directory: ${{ steps.pack.outputs.dir }}
env:
FULL_TEST: '1'
run: |
npm install
npm test
tests:
# lint-python takes ~5 seconds, so wait for it to pass before running the full matrix of tests.
needs: [lint-python]
strategy:
fail-fast: false
max-parallel: 15
matrix:
node: [12.x, 14.x, 16.x]
python: ["3.6", "3.8", "3.10"]
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
os: [macos, ubuntu, windows]
python: ["3.8", "3.10", "3.12"]
node: [16.x, 18.x, 20.x]
name: ${{ matrix.os }} - ${{ matrix.python }} - ${{ matrix.node }}
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
env:
PYTHON_VERSION: ${{ matrix.python }}
PYTHON_VERSION: ${{ matrix.python }} # Why do this?
- name: Install Dependencies
run: |
npm install --no-progress
pip install flake8 pytest
- name: Set Windows environment
if: matrix.os == 'windows-latest'
npm install
pip install pytest
- name: Set Windows Env
if: runner.os == 'Windows'
run: |
echo 'GYP_MSVS_VERSION=2015' >> $Env:GITHUB_ENV
echo 'GYP_MSVS_OVERRIDE_PATH=C:\\Dummy' >> $Env:GITHUB_ENV
- name: Lint Python
if: matrix.os == 'ubuntu-latest'
run: flake8 . --ignore=E203,W503 --max-complexity=101 --max-line-length=88 --show-source --statistics
- name: Run Python tests
- name: Run Python Tests
run: python -m pytest
# - name: Run doctests with pytest
# run: python -m pytest --doctest-modules
- name: Run Node tests
run: npm test
- name: Run Tests (macOS or Linux)
if: runner.os != 'Windows'
shell: bash
run: npm test --python="${pythonLocation}/python"
env:
FULL_TEST: ${{ (matrix.node == '20.x' && matrix.python == '3.12') && '1' || '0' }}
- name: Run Tests (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: npm run test --python="${env:pythonLocation}\\python.exe"
env:
FULL_TEST: ${{ (matrix.node == '20.x' && matrix.python == '3.12') && '1' || '0' }}
41 changes: 25 additions & 16 deletions .github/workflows/visual-studio.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
name: Tests on Windows
on: [push, pull_request]
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources

name: visual-studio
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
Tests:
visual-studio:
strategy:
fail-fast: false
max-parallel: 15
max-parallel: 8
matrix:
os: [windows-2022]
include:
- os: windows-2019
msvs-verison: 2019
- os: windows-2022
msvs-version: 2022
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install Dependencies
run: |
npm install --no-progress
- name: Set Windows environment
if: matrix.os == 'windows-latest'
run: |
echo 'GYP_MSVS_VERSION=2015' >> $Env:GITHUB_ENV
echo 'GYP_MSVS_OVERRIDE_PATH=C:\\Dummy' >> $Env:GITHUB_ENV
- name: Environment Information
run: npx envinfo
run: npm install
- name: Run Node tests
run: npm test
shell: pwsh
run: |
$pythonLocation = (Get-Command python).Source
npm run test --python="${pythonLocation}" --msvs-version="${{ matrix.msvs-version }}"
Loading