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: d460084b241c427655497a1de4ed351a13ffb47f
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 40,911 additions and 28,379 deletions.
  1. +52 −0 .github/ISSUE_TEMPLATE.md
  2. +17 −0 .github/PULL_REQUEST_TEMPLATE.md
  3. +41 −0 .github/scripts/check-engines.js
  4. +68 −0 .github/workflows/release-please.yml
  5. +136 −0 .github/workflows/tests.yml
  6. +34 −0 .github/workflows/visual-studio.yml
  7. +5 −0 .gitignore
  8. +0 −7 .jshintrc
  9. +15 −0 .npmignore
  10. +0 −35 0001-gyp-always-install-into-PRODUCT_DIR.patch
  11. +0 −36 0002-gyp-apply-https-codereview.chromium.org-11361103.patch
  12. +0 −39 0003-gyp-don-t-use-links-at-all-just-copy-the-files-inste.patch
  13. +820 −10 CHANGELOG.md
  14. +34 −0 CONTRIBUTING.md
  15. +0 −41 History.md
  16. +164 −117 README.md
  17. +2 −0 SECURITY.md
  18. +93 −5 addon.gypi
  19. +51 −46 bin/node-gyp.js
  20. +94 −0 docs/Error-pre-versions-of-node-cannot-be-installed.md
  21. +47 −0 docs/Force-npm-to-use-global-node-gyp.md
  22. +7 −0 docs/Home.md
  23. +86 −0 docs/Linking-to-OpenSSL.md
  24. +19 −0 docs/README.md
  25. +72 −0 docs/Updating-npm-bundled-node-gyp.md
  26. +49 −0 docs/binding.gyp-files-in-the-wild.md
  27. +37 −0 gyp/.github/workflows/Python_tests.yml
  28. +60 −0 gyp/.github/workflows/node-gyp.yml
  29. +32 −0 gyp/.github/workflows/nodejs-windows.yml
  30. +16 −0 gyp/.github/workflows/release-please.yml
  31. +143 −1 gyp/.gitignore
  32. +8 −3 gyp/AUTHORS
  33. +275 −0 gyp/CHANGELOG.md
  34. +4 −0 gyp/CODE_OF_CONDUCT.md
  35. +32 −0 gyp/CONTRIBUTING.md
  36. +0 −24 gyp/DEPS
  37. +1 −0 gyp/LICENSE
  38. +0 −1 gyp/OWNERS
  39. +0 −137 gyp/PRESUBMIT.py
  40. +30 −0 gyp/README.md
  41. +0 −466 gyp/buildbot/aosp_manifest.xml
  42. +0 −136 gyp/buildbot/buildbot_run.py
  43. +0 −6 gyp/buildbot/commit_queue/OWNERS
  44. +0 −3 gyp/buildbot/commit_queue/README
  45. +0 −15 gyp/buildbot/commit_queue/cq_config.json
  46. +0 −10 gyp/codereview.settings
  47. +35 −6 gyp/gyp_main.py
  48. +0 −274 gyp/gyptest.py
  49. +277 −252 gyp/pylib/gyp/MSVSNew.py
  50. +115 −117 gyp/pylib/gyp/MSVSProject.py
  51. +891 −717 gyp/pylib/gyp/MSVSSettings.py
  52. +1,474 −1,410 gyp/pylib/gyp/MSVSSettings_test.py
  53. +34 −33 gyp/pylib/gyp/MSVSToolFile.py
  54. +112 −106 gyp/pylib/gyp/MSVSUserFile.py
  55. +175 −174 gyp/pylib/gyp/MSVSUtil.py
  56. +466 −335 gyp/pylib/gyp/MSVSVersion.py
  57. +611 −467 gyp/pylib/gyp/__init__.py
  58. +437 −391 gyp/pylib/gyp/common.py
  59. +53 −47 gyp/pylib/gyp/common_test.py
  60. +98 −91 gyp/pylib/gyp/easy_xml.py
  61. +98 −88 gyp/pylib/gyp/easy_xml_test.py
  62. +40 −39 gyp/pylib/gyp/flock_tool.py
  63. +594 −531 gyp/pylib/gyp/generator/analyzer.py
  64. +1,079 −1,001 gyp/pylib/gyp/generator/android.py
  65. +1,112 −1,015 gyp/pylib/gyp/generator/cmake.py
  66. +123 −0 gyp/pylib/gyp/generator/compile_commands_json.py
  67. +79 −75 gyp/pylib/gyp/generator/dump_dependency_json.py
  68. +380 −344 gyp/pylib/gyp/generator/eclipse.py
  69. +34 −39 gyp/pylib/gyp/generator/gypd.py
  70. +28 −26 gyp/pylib/gyp/generator/gypsh.py
  71. +2,214 −1,723 gyp/pylib/gyp/generator/make.py
  72. +3,166 −2,644 gyp/pylib/gyp/generator/msvs.py
  73. +32 −25 gyp/pylib/gyp/generator/msvs_test.py
  74. +2,806 −2,283 gyp/pylib/gyp/generator/ninja.py
  75. +44 −36 gyp/pylib/gyp/generator/ninja_test.py
  76. +1,282 −1,191 gyp/pylib/gyp/generator/xcode.py
  77. +10 −8 gyp/pylib/gyp/generator/xcode_test.py
  78. +2,688 −2,467 gyp/pylib/gyp/input.py
  79. +86 −78 gyp/pylib/gyp/input_test.py
  80. +627 −466 gyp/pylib/gyp/mac_tool.py
  81. +1,187 −1,012 gyp/pylib/gyp/msvs_emulation.py
  82. +69 −55 gyp/pylib/gyp/ninja_syntax.py
  83. +0 −289 gyp/pylib/gyp/ordered_dict.py
  84. +31 −16 gyp/pylib/gyp/simple_copy.py
  85. +331 −272 gyp/pylib/gyp/win_tool.py
  86. +1,664 −1,360 gyp/pylib/gyp/xcode_emulation.py
  87. +257 −225 gyp/pylib/gyp/xcode_ninja.py
  88. +2,486 −2,215 gyp/pylib/gyp/xcodeproj_file.py
  89. +39 −43 gyp/pylib/gyp/xml_fix.py
  90. +3 −0 gyp/pylib/packaging/LICENSE
  91. +177 −0 gyp/pylib/packaging/LICENSE.APACHE
  92. +23 −0 gyp/pylib/packaging/LICENSE.BSD
  93. +15 −0 gyp/pylib/packaging/__init__.py
  94. +108 −0 gyp/pylib/packaging/_elffile.py
  95. +252 −0 gyp/pylib/packaging/_manylinux.py
  96. +83 −0 gyp/pylib/packaging/_musllinux.py
  97. +359 −0 gyp/pylib/packaging/_parser.py
  98. +61 −0 gyp/pylib/packaging/_structures.py
  99. +192 −0 gyp/pylib/packaging/_tokenizer.py
  100. +252 −0 gyp/pylib/packaging/markers.py
  101. +825 −0 gyp/pylib/packaging/metadata.py
  102. 0 gyp/pylib/packaging/py.typed
  103. +90 −0 gyp/pylib/packaging/requirements.py
  104. +1,030 −0 gyp/pylib/packaging/specifiers.py
  105. +553 −0 gyp/pylib/packaging/tags.py
  106. +172 −0 gyp/pylib/packaging/utils.py
  107. +563 −0 gyp/pylib/packaging/version.py
  108. +119 −0 gyp/pyproject.toml
  109. +0 −81 gyp/samples/samples
  110. +0 −5 gyp/samples/samples.bat
  111. +0 −19 gyp/setup.py
  112. +261 −0 gyp/test_gyp.py
  113. +1 −1 gyp/tools/README
  114. +1 −1 gyp/tools/emacs/gyp-tests.el
  115. +1 −1 gyp/tools/emacs/gyp.el
  116. +68 −66 gyp/tools/graphviz.py
  117. +94 −93 gyp/tools/pretty_gyp.py
  118. +142 −130 gyp/tools/pretty_sln.py
  119. +271 −261 gyp/tools/pretty_vcproj.py
  120. +250 −0 lib/Find-VisualStudio.cs
  121. +130 −194 lib/build.js
  122. +9 −16 lib/clean.js
  123. +206 −383 lib/configure.js
  124. +150 −0 lib/create-config-gypi.js
  125. +39 −0 lib/download.js
  126. +26 −24 lib/find-node-directory.js
  127. +310 −0 lib/find-python.js
  128. +443 −0 lib/find-visualstudio.js
  129. +310 −364 lib/install.js
  130. +18 −25 lib/list.js
  131. +169 −0 lib/log.js
  132. +166 −204 lib/node-gyp.js
  133. +86 −93 lib/process-release.js
  134. +6 −8 lib/rebuild.js
  135. +22 −31 lib/remove.js
  136. +81 −0 lib/util.js
  137. +21 −0 macOS_Catalina_acid_test.sh
  138. +21 −22 package.json
  139. +9 −6 src/win_delay_load_hook.cc
  140. +24 −0 test/common.js
  141. +0 −164 test/docker.sh
  142. +1 −0 test/fixtures/VS_2017_BuildTools_minimal.txt
  143. +1 −0 test/fixtures/VS_2017_Community_workload.txt
  144. +1 −0 test/fixtures/VS_2017_Express.txt
  145. +1 −0 test/fixtures/VS_2017_Unusable.txt
  146. +1 −0 test/fixtures/VS_2019_BuildTools_minimal.txt
  147. +1 −0 test/fixtures/VS_2019_Community_workload.txt
  148. +1 −0 test/fixtures/VS_2019_Preview.txt
  149. +569 −0 test/fixtures/VS_2022_Community_workload.txt
  150. +0 −40 test/fixtures/ca-bundle.crt
  151. +0 −21 test/fixtures/ca.crt
  152. +151 −0 test/fixtures/certs.js
  153. +6 −0 test/fixtures/nodedir/include/node/config.gypi
  154. +0 −19 test/fixtures/server.crt
  155. +0 −28 test/fixtures/server.key
  156. +31 −0 test/fixtures/test-charmap.py
  157. +3 −4 test/node_modules/hello_world/hello.cc
  158. +14 −11 test/simple-proxy.js
  159. +128 −22 test/test-addon.js
  160. +77 −0 test/test-configure-python.js
  161. +60 −0 test/test-create-config-gypi.js
  162. +180 −81 test/test-download.js
  163. +56 −69 test/test-find-accessible-sync.js
  164. +101 −101 test/test-find-node-directory.js
  165. +171 −16 test/test-find-python.js
  166. +623 −0 test/test-find-visualstudio.js
  167. +110 −0 test/test-install.js
  168. +43 −18 test/test-options.js
  169. +397 −633 test/test-process-release.js
  170. +64 −0 update-gyp.py
52 changes: 52 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!--
Thank you for reporting an issue!
Remember, this issue tracker is for reporting issues ONLY with node-gyp.
If you have an issue installing a specific module, please file an issue on
that module's issue tracker (`npm issues modulename`). Open issue here only if
you are sure this is an issue with node-gyp, not with the module you are
trying to build.
Fill out the form below. We probably won't investigate an issue that does not
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/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.

* **Node Version**: <!-- `node -v` and `npm -v` -->
* **Platform**: <!-- `uname -a` (UNIX), or `systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type"` (Windows) -->
* **Compiler**: <!-- `cc -v` (UNIX) or `msbuild /version & cl` (Windows) -->
* **Module**: <!-- what you tried to build/install -->

<details><summary>Verbose output (from npm or node-gyp):</summary>

```
Paste your log here, between the backticks. It can be:
- npm --verbose output,
- or contents of npm-debug.log,
- or output of node-gyp rebuild --verbose.
Include the command you were trying to run.
This should look like this:
>npm --verbose
npm info it worked if it ends with ok
npm verb cli [
npm verb cli 'C:\\...\\node\\13.9.0\\x64\\node.exe',
npm verb cli 'C:\\...\\node\\13.9.0\\x64\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli '--verbose'
npm verb cli ]
npm info using npm@6.13.7
npm info using node@v13.9.0
Usage: npm <command>
(...)
```

</details>

<!-- Any further details -->
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--
Thank you for your pull request. Please review the below requirements.
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 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)

##### Description of change
<!-- Provide a description of the change -->

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
})
68 changes: 68 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: release-please

on:
push:
branches:
- 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}]
# 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
136 changes: 136 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# 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:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_call:

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

jobs:
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:
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@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
env:
PYTHON_VERSION: ${{ matrix.python }} # Why do this?
- name: Install Dependencies
run: |
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: Run Python Tests
run: python -m pytest
- 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' }}
34 changes: 34 additions & 0 deletions .github/workflows/visual-studio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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:
visual-studio:
strategy:
fail-fast: false
max-parallel: 8
matrix:
include:
- os: windows-2019
msvs-verison: 2019
- os: windows-2022
msvs-version: 2022
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Dependencies
run: npm install
- name: Run Node tests
shell: pwsh
run: |
$pythonLocation = (Get-Command python).Source
npm run test --python="${pythonLocation}" --msvs-version="${{ matrix.msvs-version }}"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.ncu
.nyc_output
*.swp
gyp/test
node_modules
node-gyp-*.tgz
package-lock.json
test/.node-gyp
7 changes: 0 additions & 7 deletions .jshintrc

This file was deleted.

15 changes: 15 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.ncu
.nyc_output
*.swp
/.github/
/docs/
/gyp/.github/
/gyp/*.md
/gyp/AUTHORS
/gyp/test
/gyp/tools/
/node-gyp-*.tgz
/test/
/test/.node-gyp
/update-gyp.py
node-gyp-*.tgz
Loading