mirror of
https://github.com/microsoft/vscode.git
synced 2026-10-09 20:02:22 +01:00
* chore: bump electron@43.4.1 * linux: align desktop name and StartupWMClass Give DEB and RPM installs a package owned reverse DNS desktop name so runtime wayland portal identity resolves to an installed desktop file. Keep snap and archive runtime identities aligned with their distribution specific desktop file behavior. Set StartupWMClass to the same identity used by the runtime. * linux: respect native window controls layout Reserve both left and right WCO safe areas so custom title bar content does not overlap controls when the desktop environment places them on either side. * dialogs: preserve native locations Electron 43 defaults native dialogs without a defaultPath to the Downloads directory instead of allowing the platform to retain its last location. Resolve existing file or folder history before invoking native open and save dialogs, while preserving an explicit caller-provided URI. * protocol: migrate from deprecated handlers Replace deprecated registerFileProtocol, registerBufferProtocol, registerHttpProtocol, and interceptFileProtocol APIs with protocol.handle(). * test: migrate unit test protocol handler * chore: remove obsolete WebSQL preferences Electron 43 removes WebSQL and its enableWebSQL web preference. * fix: wco position for windows * protocol: avoid exposing managed resource errors * test: preserve file URLs in protocol handler * test: adopt worker parent identifiers in CDP golden Electron 43 target lifecycle payloads include parentId and parentFrameId for worker targets. * build: support V8 headers with GCC 12 * test: use platform native dialog paths * build: install custom electron headers * build: bootstrap electron headers in compile job * build: bootstrap Electron headers for Alpine and web * chore: bump electron@43.5.1 * chore: revert system fontconfig init workaround * temp: bump distro * chore: bump electron@43.6.0 * test: skip Dev Container agent host smoke test for exploration The exploration update channel serves an outdated agent host server that does not include the bundled Copilot CLI, causing the smoke test to time out. * chore: bump distro
116 lines
4.8 KiB
TypeScript
116 lines
4.8 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
import { spawnSync } from 'child_process';
|
|
import path from 'path';
|
|
import { getChromiumSysroot, getVSCodeSysroot } from './debian/install-sysroot.ts';
|
|
import { generatePackageDeps as generatePackageDepsDebian } from './debian/calculate-deps.ts';
|
|
import { generatePackageDeps as generatePackageDepsRpm } from './rpm/calculate-deps.ts';
|
|
import { referenceGeneratedDepsByArch as debianGeneratedDeps } from './debian/dep-lists.ts';
|
|
import { referenceGeneratedDepsByArch as rpmGeneratedDeps } from './rpm/dep-lists.ts';
|
|
import { type DebianArchString, isDebianArchString } from './debian/types.ts';
|
|
import { isRpmArchString, type RpmArchString } from './rpm/types.ts';
|
|
import product from '../../product.json' with { type: 'json' };
|
|
|
|
// A flag that can easily be toggled.
|
|
// Make sure to compile the build directory after toggling the value.
|
|
// If false, we warn about new dependencies if they show up
|
|
// while running the prepare package tasks for a release.
|
|
// If true, we fail the build if there are new dependencies found during that task.
|
|
// The reference dependencies, which one has to update when the new dependencies
|
|
// are valid, are in dep-lists.ts
|
|
const FAIL_BUILD_FOR_NEW_DEPENDENCIES: boolean = true;
|
|
|
|
// Based on https://source.chromium.org/chromium/chromium/src/+/refs/tags/150.0.7871.250:chrome/installer/linux/BUILD.gn;l=64-80
|
|
// and the Linux Archive build
|
|
// Shared library dependencies that we already bundle.
|
|
const bundledDeps = [
|
|
'libEGL.so',
|
|
'libGLESv2.so',
|
|
'libvulkan.so.1',
|
|
'libvk_swiftshader.so',
|
|
'libffmpeg.so',
|
|
];
|
|
|
|
export async function getDependencies(packageType: 'deb' | 'rpm', buildDir: string, applicationName: string, arch: string): Promise<string[]> {
|
|
if (packageType === 'deb') {
|
|
if (!isDebianArchString(arch)) {
|
|
throw new Error('Invalid Debian arch string ' + arch);
|
|
}
|
|
}
|
|
if (packageType === 'rpm' && !isRpmArchString(arch)) {
|
|
throw new Error('Invalid RPM arch string ' + arch);
|
|
}
|
|
|
|
// Get the files for which we want to find dependencies.
|
|
// Native modules are unpacked next to the ASAR archive in `node_modules.asar.unpacked`.
|
|
const nativeModulesPath = path.join(buildDir, 'resources', 'app', 'node_modules.asar.unpacked');
|
|
const findResult = spawnSync('find', [nativeModulesPath, '-name', '*.node']);
|
|
if (findResult.status) {
|
|
console.error('Error finding files:');
|
|
console.error(findResult.stderr.toString());
|
|
return [];
|
|
}
|
|
|
|
const appPath = path.join(buildDir, applicationName);
|
|
// Add the native modules
|
|
const files = findResult.stdout.toString().trimEnd().split('\n');
|
|
// Add the tunnel binary.
|
|
files.push(path.join(buildDir, 'bin', product.tunnelApplicationName));
|
|
// Add the main executable.
|
|
files.push(appPath);
|
|
// Add chrome sandbox and crashpad handler.
|
|
files.push(path.join(buildDir, 'chrome-sandbox'));
|
|
files.push(path.join(buildDir, 'chrome_crashpad_handler'));
|
|
|
|
// Generate the dependencies.
|
|
let dependencies: Set<string>[];
|
|
if (packageType === 'deb') {
|
|
const chromiumSysroot = await getChromiumSysroot(arch as DebianArchString);
|
|
const vscodeSysroot = await getVSCodeSysroot(arch as DebianArchString);
|
|
dependencies = generatePackageDepsDebian(files, arch as DebianArchString, chromiumSysroot, vscodeSysroot);
|
|
} else {
|
|
dependencies = generatePackageDepsRpm(files);
|
|
}
|
|
|
|
// Merge all the dependencies.
|
|
const mergedDependencies = mergePackageDeps(dependencies);
|
|
|
|
// Exclude bundled dependencies and sort
|
|
const sortedDependencies: string[] = Array.from(mergedDependencies).filter(dependency => {
|
|
return !bundledDeps.some(bundledDep => dependency.startsWith(bundledDep));
|
|
}).sort();
|
|
|
|
const referenceGeneratedDeps = packageType === 'deb' ?
|
|
debianGeneratedDeps[arch as DebianArchString] :
|
|
rpmGeneratedDeps[arch as RpmArchString];
|
|
if (JSON.stringify(sortedDependencies) !== JSON.stringify(referenceGeneratedDeps)) {
|
|
const failMessage = 'The dependencies list has changed.'
|
|
+ '\nOld:\n' + referenceGeneratedDeps.join('\n')
|
|
+ '\nNew:\n' + sortedDependencies.join('\n');
|
|
if (FAIL_BUILD_FOR_NEW_DEPENDENCIES) {
|
|
throw new Error(failMessage);
|
|
} else {
|
|
console.warn(failMessage);
|
|
}
|
|
}
|
|
|
|
return sortedDependencies;
|
|
}
|
|
|
|
|
|
// Based on https://source.chromium.org/chromium/chromium/src/+/main:chrome/installer/linux/rpm/merge_package_deps.py.
|
|
function mergePackageDeps(inputDeps: Set<string>[]): Set<string> {
|
|
const requires = new Set<string>();
|
|
for (const depSet of inputDeps) {
|
|
for (const dep of depSet) {
|
|
const trimmedDependency = dep.trim();
|
|
if (trimmedDependency.length && !trimmedDependency.startsWith('#')) {
|
|
requires.add(trimmedDependency);
|
|
}
|
|
}
|
|
}
|
|
return requires;
|
|
}
|