mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-10 14:16:15 -06:00
* chore: bump electron@35.0.1
* chore: update types/node@22.x
* chore: update web types for node v22.x
* chore: bump electron@35.1.2
* chore: update node.js build
* chore: update app.dock usage
Refs 71f3ff6bf2
* chore: bump electron@35.1.4
* chore: bump electron@35.1.5
* ci: bump sysroot to glibc 2.28 and gcc 10.5.0
* ci: enable timeout for smoketests
* chore: bump min glibcxx to 3.4.26 for server
* Revert "ci: enable timeout for smoketests"
This reverts commit afb637e85dfb6c553c0e76ccc7063b5c8cf550bb.
* chore: update debian dependencies
* fix: workaround npm.ps1 argument parsing with powershell
* chore: update rpm dependencies
* test: partially revert changes from 242535
* test: remove redudant keybinding dispatch for selectTab
* test: fix test failure from running configured tasks
* test: focus settings editor for preferences.test.ts
* node - adopt compile cache (#246835)
* node - adopt compile cache
* adopt for utility process
* tweaks
* log state of compilation cache
* Revert "log state of compilation cache"
This reverts commit f3840387a583013834762e2c44f6e8424929297f.
* Revert "node - adopt compile cache (#246835)"
This reverts commit 673a00cab66c9bac87f3cd27b80efa41c80150f1.
* chore: update builds
* chore: bump electron@35.2.0
* chore: bump electron@35.2.1
* chore: bump electron@35.2.2
---------
Co-authored-by: Benjamin Pasero <benjamin.pasero@microsoft.com>
175 lines
5.8 KiB
JavaScript
175 lines
5.8 KiB
JavaScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const os = require('os');
|
|
const cp = require('child_process');
|
|
const { dirs } = require('./dirs');
|
|
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
const root = path.dirname(path.dirname(__dirname));
|
|
|
|
function log(dir, message) {
|
|
if (process.stdout.isTTY) {
|
|
console.log(`\x1b[34m[${dir}]\x1b[0m`, message);
|
|
} else {
|
|
console.log(`[${dir}]`, message);
|
|
}
|
|
}
|
|
|
|
function run(command, args, opts) {
|
|
log(opts.cwd || '.', '$ ' + command + ' ' + args.join(' '));
|
|
|
|
const result = cp.spawnSync(command, args, opts);
|
|
|
|
if (result.error) {
|
|
console.error(`ERR Failed to spawn process: ${result.error}`);
|
|
process.exit(1);
|
|
} else if (result.status !== 0) {
|
|
console.error(`ERR Process exited with code: ${result.status}`);
|
|
process.exit(result.status);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param {string} dir
|
|
* @param {*} [opts]
|
|
*/
|
|
function npmInstall(dir, opts) {
|
|
opts = {
|
|
env: { ...process.env },
|
|
...(opts ?? {}),
|
|
cwd: dir,
|
|
stdio: 'inherit',
|
|
shell: true
|
|
};
|
|
|
|
const command = process.env['npm_command'] || 'install';
|
|
|
|
if (process.env['VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME'] && /^(.build\/distro\/npm\/)?remote$/.test(dir)) {
|
|
const userinfo = os.userInfo();
|
|
log(dir, `Installing dependencies inside container ${process.env['VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME']}...`);
|
|
|
|
opts.cwd = root;
|
|
if (process.env['npm_config_arch'] === 'arm64') {
|
|
run('sudo', ['docker', 'run', '--rm', '--privileged', 'multiarch/qemu-user-static', '--reset', '-p', 'yes'], opts);
|
|
}
|
|
run('sudo', ['docker', 'run', '-e', 'GITHUB_TOKEN', '-v', `${process.env['VSCODE_HOST_MOUNT']}:/root/vscode`, '-v', `${process.env['VSCODE_HOST_MOUNT']}/.build/.netrc:/root/.netrc`, '-w', path.resolve('/root/vscode', dir), process.env['VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME'], 'sh', '-c', `\"chown -R root:root ${path.resolve('/root/vscode', dir)} && npm i -g node-gyp-build && npm ci\"`], opts);
|
|
run('sudo', ['chown', '-R', `${userinfo.uid}:${userinfo.gid}`, `${path.resolve(root, dir)}`], opts);
|
|
} else {
|
|
log(dir, 'Installing dependencies...');
|
|
run(npm, command.split(' '), opts);
|
|
}
|
|
removeParcelWatcherPrebuild(dir);
|
|
}
|
|
|
|
function setNpmrcConfig(dir, env) {
|
|
const npmrcPath = path.join(root, dir, '.npmrc');
|
|
const lines = fs.readFileSync(npmrcPath, 'utf8').split('\n');
|
|
|
|
for (const line of lines) {
|
|
const trimmedLine = line.trim();
|
|
if (trimmedLine && !trimmedLine.startsWith('#')) {
|
|
const [key, value] = trimmedLine.split('=');
|
|
env[`npm_config_${key}`] = value.replace(/^"(.*)"$/, '$1');
|
|
}
|
|
}
|
|
|
|
// Force node-gyp to use process.config on macOS
|
|
// which defines clang variable as expected. Otherwise we
|
|
// run into compilation errors due to incorrect compiler
|
|
// configuration.
|
|
// NOTE: This means the process.config should contain
|
|
// the correct clang variable. So keep the version check
|
|
// in preinstall sync with this logic.
|
|
// Change was first introduced in https://github.com/nodejs/node/commit/6e0a2bb54c5bbeff0e9e33e1a0c683ed980a8a0f
|
|
if ((dir === 'remote' || dir === 'build') && process.platform === 'darwin') {
|
|
env['npm_config_force_process_config'] = 'true';
|
|
} else {
|
|
delete env['npm_config_force_process_config'];
|
|
}
|
|
|
|
if (dir === 'build') {
|
|
env['npm_config_target'] = process.versions.node;
|
|
env['npm_config_arch'] = process.arch;
|
|
}
|
|
}
|
|
|
|
function removeParcelWatcherPrebuild(dir) {
|
|
const parcelModuleFolder = path.join(root, dir, 'node_modules', '@parcel');
|
|
if (!fs.existsSync(parcelModuleFolder)) {
|
|
return;
|
|
}
|
|
|
|
const parcelModules = fs.readdirSync(parcelModuleFolder);
|
|
for (const moduleName of parcelModules) {
|
|
if (moduleName.startsWith('watcher-')) {
|
|
const modulePath = path.join(parcelModuleFolder, moduleName);
|
|
fs.rmSync(modulePath, { recursive: true, force: true });
|
|
log(dir, `Removed @parcel/watcher prebuilt module ${modulePath}`);
|
|
}
|
|
}
|
|
}
|
|
|
|
for (let dir of dirs) {
|
|
|
|
if (dir === '') {
|
|
removeParcelWatcherPrebuild(dir);
|
|
continue; // already executed in root
|
|
}
|
|
|
|
let opts;
|
|
|
|
if (dir === 'build') {
|
|
opts = {
|
|
env: {
|
|
...process.env
|
|
},
|
|
}
|
|
if (process.env['CC']) { opts.env['CC'] = 'gcc'; }
|
|
if (process.env['CXX']) { opts.env['CXX'] = 'g++'; }
|
|
if (process.env['CXXFLAGS']) { opts.env['CXXFLAGS'] = ''; }
|
|
if (process.env['LDFLAGS']) { opts.env['LDFLAGS'] = ''; }
|
|
|
|
setNpmrcConfig('build', opts.env);
|
|
npmInstall('build', opts);
|
|
continue;
|
|
}
|
|
|
|
if (/^(.build\/distro\/npm\/)?remote$/.test(dir)) {
|
|
// node modules used by vscode server
|
|
opts = {
|
|
env: {
|
|
...process.env
|
|
},
|
|
}
|
|
if (process.env['VSCODE_REMOTE_CC']) {
|
|
opts.env['CC'] = process.env['VSCODE_REMOTE_CC'];
|
|
} else {
|
|
delete opts.env['CC'];
|
|
}
|
|
if (process.env['VSCODE_REMOTE_CXX']) {
|
|
opts.env['CXX'] = process.env['VSCODE_REMOTE_CXX'];
|
|
} else {
|
|
delete opts.env['CXX'];
|
|
}
|
|
if (process.env['CXXFLAGS']) { delete opts.env['CXXFLAGS']; }
|
|
if (process.env['CFLAGS']) { delete opts.env['CFLAGS']; }
|
|
if (process.env['LDFLAGS']) { delete opts.env['LDFLAGS']; }
|
|
if (process.env['VSCODE_REMOTE_CXXFLAGS']) { opts.env['CXXFLAGS'] = process.env['VSCODE_REMOTE_CXXFLAGS']; }
|
|
if (process.env['VSCODE_REMOTE_LDFLAGS']) { opts.env['LDFLAGS'] = process.env['VSCODE_REMOTE_LDFLAGS']; }
|
|
if (process.env['VSCODE_REMOTE_NODE_GYP']) { opts.env['npm_config_node_gyp'] = process.env['VSCODE_REMOTE_NODE_GYP']; }
|
|
|
|
setNpmrcConfig('remote', opts.env);
|
|
npmInstall(dir, opts);
|
|
continue;
|
|
}
|
|
|
|
npmInstall(dir, opts);
|
|
}
|
|
|
|
cp.execSync('git config pull.rebase merges');
|
|
cp.execSync('git config blame.ignoreRevsFile .git-blame-ignore-revs');
|