Skip to content

Commit

Permalink
Use custom node-gyp for SDL pipeline (#179723)
Browse files Browse the repository at this point in the history
* Use custom node-gyp
* Avoid using relative cd
* Remove ia32 for Linux
* Bump gulp-atom-electron; unblocks downloading PDBs
* Add native-is-elevated to the scan
  • Loading branch information
rzhao271 authored Apr 21, 2023
1 parent 175cd6b commit ee76f10
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 181 deletions.
20 changes: 19 additions & 1 deletion build/azure-pipelines/sdl-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,31 @@ 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"
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 = "$(NPM_ARCH)"
retry { exec { yarn --frozen-lockfile --check-files } }
env:
npm_config_arch: "$(NPM_ARCH)"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
GITHUB_TOKEN: "$(github-distro-mixin-password)"
CHILD_CONCURRENCY: 1
Expand Down
6 changes: 2 additions & 4 deletions build/gulpfile.scan.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const gulp = require('gulp');
const path = require('path');
const task = require('./lib/task');
const util = require('./lib/util');
const electron = require('gulp-atom-electron');
const electron = require('@vscode/gulp-electron');
const { config } = require('./lib/electron');
const filter = require('gulp-filter');
const deps = require('./lib/dependencies');
Expand All @@ -21,7 +21,6 @@ const BUILD_TARGETS = [
{ platform: 'win32', arch: 'x64' },
{ platform: 'win32', arch: 'arm64' },
{ platform: 'darwin', arch: null, opts: { stats: true } },
{ platform: 'linux', arch: 'ia32' },
{ platform: 'linux', arch: 'x64' },
{ platform: 'linux', arch: 'armhf' },
{ platform: 'linux', arch: 'arm64' },
Expand Down Expand Up @@ -81,8 +80,7 @@ function nodeModules(destinationExe, destinationPdb, platform) {
// We don't build the prebuilt node files so we don't scan them
'!**/prebuilds/**/*.node',
// These are 3rd party modules that we should ignore
'!**/@parcel/watcher/**/*',
'!**/native-is-elevated/**/*']))
'!**/@parcel/watcher/**/*']))
.pipe(gulp.dest(destinationExe));
};

Expand Down
2 changes: 1 addition & 1 deletion build/gulpfile.vscode.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
platform = platform || process.platform;

return () => {
const electron = require('gulp-atom-electron');
const electron = require('@vscode/gulp-electron');
const json = require('gulp-json-editor');

const out = sourceFolderName;
Expand Down
4 changes: 2 additions & 2 deletions build/lib/electron.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/lib/electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export const config = {

function getElectron(arch: string): () => NodeJS.ReadWriteStream {
return () => {
const electron = require('gulp-atom-electron');
const electron = require('@vscode/gulp-electron');
const json = require('gulp-json-editor') as typeof import('gulp-json-editor');

const electronOpts = _.extend({}, config, {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/experimental-utils": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"@vscode/gulp-electron": "^1.33.0",
"@vscode/l10n-dev": "0.0.21",
"@vscode/telemetry-extractor": "^1.9.9",
"@vscode/test-web": "^0.0.41",
Expand All @@ -151,7 +152,6 @@
"file-loader": "^6.2.0",
"glob": "^5.0.13",
"gulp": "^4.0.0",
"gulp-atom-electron": "^1.33.0",
"gulp-azure-storage": "^0.12.1",
"gulp-bom": "^3.0.0",
"gulp-buffer": "0.0.2",
Expand Down
Loading

0 comments on commit ee76f10

Please sign in to comment.