Skip to content

Commit e284396

Browse files
authored
chore: use newest node-gyp for SDL pipeline (microsoft#199820)
* chore: use latest upstream node-gyp * fix: use node-gyp.js file directly * apply PR feedback * chore: delete patch file * Apply PR feedback * Update cache salt
1 parent c95fb56 commit e284396

File tree

4 files changed

+14
-94
lines changed

4 files changed

+14
-94
lines changed

build/.cachesalt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2023-12-07T16:21:36.646Z
1+
2024-01-29T19:26:27.993Z

build/azure-pipelines/sdl-scan.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -95,29 +95,16 @@ stages:
9595
displayName: CodeQL Initialize
9696
condition: eq(variables['Codeql.enabled'], 'True')
9797

98-
- powershell: |
99-
mkdir -Force .build/node-gyp
100-
displayName: Create custom node-gyp directory
101-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
102-
103-
- powershell: |
104-
. ../../build/azure-pipelines/win32/exec.ps1
105-
$ErrorActionPreference = "Stop"
106-
# TODO: Should be replaced with upstream URL once https://github.com/nodejs/node-gyp/pull/2825
107-
# gets merged.
108-
exec { git clone https://github.com/rzhao271/node-gyp.git . } "Cloning rzhao271/node-gyp failed"
109-
exec { git checkout 102b347da0c92c29f9c67df22e864e70249cf086 } "Checking out 102b347 failed"
110-
exec { npm install } "Building rzhao271/node-gyp failed"
111-
exec { python3 -m pip install setuptools } "Installing setuptools failed"
112-
displayName: Install custom node-gyp
113-
workingDirectory: .build/node-gyp
114-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
115-
11698
- powershell: |
11799
. build/azure-pipelines/win32/exec.ps1
118100
. build/azure-pipelines/win32/retry.ps1
119101
$ErrorActionPreference = "Stop"
120-
$env:npm_config_node_gyp = "$(Join-Path $pwd.Path '.build/node-gyp/bin/node-gyp.js')"
102+
# TODO: remove custom node-gyp when updating to Node v20,
103+
# refs https://github.com/npm/cli/releases/tag/v10.2.3 which is available with Node >= 20.10.0
104+
$nodeGypDir = "$(Agent.TempDirectory)/custom-packages"
105+
mkdir "$nodeGypDir"
106+
npm install [email protected] -g --prefix "$nodeGypDir"
107+
$env:npm_config_node_gyp = "${nodeGypDir}/node_modules/node-gyp/bin/node-gyp.js"
121108
$env:npm_config_arch = "$(NPM_ARCH)"
122109
retry { exec { yarn --frozen-lockfile --check-files } }
123110
env:

build/azure-pipelines/win32/product-build-win32.yml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -89,33 +89,17 @@ steps:
8989
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
9090
displayName: Setup NPM Authentication
9191

92-
- powershell: |
93-
mkdir -Force .build/node-gyp
94-
displayName: Create custom node-gyp directory
95-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
96-
97-
- powershell: |
98-
. ../../build/azure-pipelines/win32/exec.ps1
99-
$ErrorActionPreference = "Stop"
100-
# TODO: Should be replaced with upstream URL once https://github.com/nodejs/node-gyp/pull/2825
101-
# gets merged.
102-
exec { git config --global user.email "[email protected]" } "git config user.email failed"
103-
exec { git config --global user.name "VSCode" } "git config user.name failed"
104-
exec { git clone https://github.com/nodejs/node-gyp.git . } "Cloning nodejs/node-gyp failed"
105-
exec { git checkout v9.4.0 } "Checking out v9.4.0 failed"
106-
exec { git am --3way --whitespace=fix ../../build/npm/gyp/patches/gyp_spectre_mitigation_support.patch } "Apply spectre patch failed"
107-
exec { npm install } "Building node-gyp failed"
108-
exec { python3 -m pip install setuptools } "Installing setuptools failed"
109-
displayName: Install custom node-gyp
110-
workingDirectory: .build/node-gyp
111-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
112-
11392
- powershell: |
11493
. build/azure-pipelines/win32/exec.ps1
11594
. build/azure-pipelines/win32/retry.ps1
11695
$ErrorActionPreference = "Stop"
117-
$env:npm_config_node_gyp="$(Join-Path $pwd.Path '.build/node-gyp/bin/node-gyp.js')"
118-
$env:npm_config_arch="$(VSCODE_ARCH)"
96+
# TODO: remove custom node-gyp when updating to Node v20,
97+
# refs https://github.com/npm/cli/releases/tag/v10.2.3 which is available with Node >= 20.10.0
98+
$nodeGypDir = "$(Agent.TempDirectory)/custom-packages"
99+
mkdir "$nodeGypDir"
100+
npm install [email protected] -g --prefix "$nodeGypDir"
101+
$env:npm_config_node_gyp = "${nodeGypDir}/node_modules/node-gyp/bin/node-gyp.js"
102+
$env:npm_config_arch = "$(VSCODE_ARCH)"
119103
$env:CHILD_CONCURRENCY="1"
120104
retry { exec { yarn --frozen-lockfile --check-files } }
121105
env:

build/npm/gyp/patches/gyp_spectre_mitigation_support.patch

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)