refactor: use sysroots on linux prod pipeline (#192513)

* ci: use sysroots on linux prod pipeline to build native modules

* ci: rebuild after electron update
This commit is contained in:
Robo
2023-12-12 19:39:00 +09:00
committed by GitHub
parent 9c679f1e07
commit e7b5076dd7
19 changed files with 597 additions and 170 deletions

View File

@@ -7,12 +7,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.getDependencies = void 0;
const child_process_1 = require("child_process");
const path = require("path");
const install_sysroot_1 = require("./debian/install-sysroot");
const calculate_deps_1 = require("./debian/calculate-deps");
const calculate_deps_2 = require("./rpm/calculate-deps");
const dep_lists_1 = require("./debian/dep-lists");
const dep_lists_2 = require("./rpm/dep-lists");
const types_1 = require("./debian/types");
const types_2 = require("./rpm/types");
const product = require("../../product.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
@@ -31,14 +33,11 @@ const bundledDeps = [
'libvk_swiftshader.so',
'libffmpeg.so'
];
function getDependencies(packageType, buildDir, applicationName, arch, sysroot) {
async function getDependencies(packageType, buildDir, applicationName, arch) {
if (packageType === 'deb') {
if (!(0, types_1.isDebianArchString)(arch)) {
throw new Error('Invalid Debian arch string ' + arch);
}
if (!sysroot) {
throw new Error('Missing sysroot parameter');
}
}
if (packageType === 'rpm' && !(0, types_2.isRpmArchString)(arch)) {
throw new Error('Invalid RPM arch string ' + arch);
@@ -51,16 +50,26 @@ function getDependencies(packageType, buildDir, applicationName, arch, sysroot)
console.error(findResult.stderr.toString());
return [];
}
const files = findResult.stdout.toString().trimEnd().split('\n');
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.
const dependencies = packageType === 'deb' ?
(0, calculate_deps_1.generatePackageDeps)(files, arch, sysroot) :
(0, calculate_deps_2.generatePackageDeps)(files);
let dependencies;
if (packageType === 'deb') {
const chromiumSysroot = await (0, install_sysroot_1.getChromiumSysroot)(arch);
const vscodeSysroot = await (0, install_sysroot_1.getVSCodeSysroot)(arch);
dependencies = (0, calculate_deps_1.generatePackageDeps)(files, arch, chromiumSysroot, vscodeSysroot);
}
else {
dependencies = (0, calculate_deps_2.generatePackageDeps)(files);
}
// Merge all the dependencies.
const mergedDependencies = mergePackageDeps(dependencies);
// Exclude bundled dependencies and sort