Skip to content

Commit

Permalink
chore: use newest node-gyp for SDL pipeline (#199820)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rzhao271 authored Jan 30, 2024
1 parent c95fb56 commit e284396
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 94 deletions.
2 changes: 1 addition & 1 deletion build/.cachesalt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-12-07T16:21:36.646Z
2024-01-29T19:26:27.993Z
25 changes: 6 additions & 19 deletions build/azure-pipelines/sdl-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,29 +95,16 @@ stages:
displayName: CodeQL Initialize
condition: eq(variables['Codeql.enabled'], 'True')

- powershell: |
mkdir -Force .build/node-gyp
displayName: Create custom node-gyp directory
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
- powershell: |
. ../../build/azure-pipelines/win32/exec.ps1
$ErrorActionPreference = "Stop"
# TODO: Should be replaced with upstream URL once https://github.com/nodejs/node-gyp/pull/2825
# gets merged.
exec { git clone https://github.com/rzhao271/node-gyp.git . } "Cloning rzhao271/node-gyp failed"
exec { git checkout 102b347da0c92c29f9c67df22e864e70249cf086 } "Checking out 102b347 failed"
exec { npm install } "Building rzhao271/node-gyp failed"
exec { python3 -m pip install setuptools } "Installing setuptools failed"
displayName: Install custom node-gyp
workingDirectory: .build/node-gyp
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
- powershell: |
. build/azure-pipelines/win32/exec.ps1
. build/azure-pipelines/win32/retry.ps1
$ErrorActionPreference = "Stop"
$env:npm_config_node_gyp = "$(Join-Path $pwd.Path '.build/node-gyp/bin/node-gyp.js')"
# TODO: remove custom node-gyp when updating to Node v20,
# refs https://github.com/npm/cli/releases/tag/v10.2.3 which is available with Node >= 20.10.0
$nodeGypDir = "$(Agent.TempDirectory)/custom-packages"
mkdir "$nodeGypDir"
npm install [email protected] -g --prefix "$nodeGypDir"
$env:npm_config_node_gyp = "${nodeGypDir}/node_modules/node-gyp/bin/node-gyp.js"
$env:npm_config_arch = "$(NPM_ARCH)"
retry { exec { yarn --frozen-lockfile --check-files } }
env:
Expand Down
30 changes: 7 additions & 23 deletions build/azure-pipelines/win32/product-build-win32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,33 +89,17 @@ steps:
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
displayName: Setup NPM Authentication

- powershell: |
mkdir -Force .build/node-gyp
displayName: Create custom node-gyp directory
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
- powershell: |
. ../../build/azure-pipelines/win32/exec.ps1
$ErrorActionPreference = "Stop"
# TODO: Should be replaced with upstream URL once https://github.com/nodejs/node-gyp/pull/2825
# gets merged.
exec { git config --global user.email "[email protected]" } "git config user.email failed"
exec { git config --global user.name "VSCode" } "git config user.name failed"
exec { git clone https://github.com/nodejs/node-gyp.git . } "Cloning nodejs/node-gyp failed"
exec { git checkout v9.4.0 } "Checking out v9.4.0 failed"
exec { git am --3way --whitespace=fix ../../build/npm/gyp/patches/gyp_spectre_mitigation_support.patch } "Apply spectre patch failed"
exec { npm install } "Building node-gyp failed"
exec { python3 -m pip install setuptools } "Installing setuptools failed"
displayName: Install custom node-gyp
workingDirectory: .build/node-gyp
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
- powershell: |
. build/azure-pipelines/win32/exec.ps1
. build/azure-pipelines/win32/retry.ps1
$ErrorActionPreference = "Stop"
$env:npm_config_node_gyp="$(Join-Path $pwd.Path '.build/node-gyp/bin/node-gyp.js')"
$env:npm_config_arch="$(VSCODE_ARCH)"
# TODO: remove custom node-gyp when updating to Node v20,
# refs https://github.com/npm/cli/releases/tag/v10.2.3 which is available with Node >= 20.10.0
$nodeGypDir = "$(Agent.TempDirectory)/custom-packages"
mkdir "$nodeGypDir"
npm install [email protected] -g --prefix "$nodeGypDir"
$env:npm_config_node_gyp = "${nodeGypDir}/node_modules/node-gyp/bin/node-gyp.js"
$env:npm_config_arch = "$(VSCODE_ARCH)"
$env:CHILD_CONCURRENCY="1"
retry { exec { yarn --frozen-lockfile --check-files } }
env:
Expand Down
51 changes: 0 additions & 51 deletions build/npm/gyp/patches/gyp_spectre_mitigation_support.patch

This file was deleted.

0 comments on commit e284396

Please sign in to comment.