mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-06 17:23:53 -05:00
* Compile build folder * Fix build compile issues (#22813) * Revert changes * Update gulp-shell * Test * Update * Update modifiers * Try reverting minimist * Generates linux deb artifact (#22922) * Remove deb files that were brought in with the latest merge. * Add debian back to linux gulp file * Remove async from anonymous function. * Remove run core integration tests build step in pipeline * Revert "Remove async from anonymous function." This reverts commit 7ad1ce2942954fce58939b9965343b46b9311a7e. * Revert "Add debian back to linux gulp file" This reverts commit 96b7c0f0995c8024ef67ed886da34255a5caa325. * Revert "Remove deb files that were brought in with the latest merge." This reverts commit bf3aae233b8da1f9111a149a96d77cc78d376094. * Removes dependency checks * Fix dependency gen errors * Reenable "Build Deb" step * Reenable publish deb * Run core integration tests * Revert "Run core integration tests" This reverts commit 7cafbada194feebe771862af796fb3416b5dd686. * Revert "Try reverting minimist" This reverts commit 38fd843c1d5c33318a92f4bbc7057e951c5a9f71. * Disable code coverage step intermin --------- Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> Co-authored-by: Lewis Sanchez <87730006+lewis-sanchez@users.noreply.github.com>
98 lines
4.6 KiB
JavaScript
98 lines
4.6 KiB
JavaScript
"use strict";
|
|
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.getDependencies = void 0;
|
|
const child_process_1 = require("child_process");
|
|
const fs_1 = require("fs");
|
|
const path = require("path");
|
|
const dep_lists_1 = require("./dep-lists");
|
|
// 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 rpm prepare package task 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 = false;
|
|
function getDependencies(buildDir, applicationName, arch) {
|
|
// Get the files for which we want to find dependencies.
|
|
const nativeModulesPath = path.join(buildDir, 'resources', 'app', 'node_modules.asar.unpacked');
|
|
const findResult = (0, child_process_1.spawnSync)('find', [nativeModulesPath, '-name', '*.node']);
|
|
if (findResult.status) {
|
|
console.error(`Error finding files for ${arch}:`);
|
|
console.error(findResult.stderr.toString());
|
|
return [];
|
|
}
|
|
const files = findResult.stdout.toString().trimEnd().split('\n');
|
|
const appPath = path.join(buildDir, applicationName);
|
|
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 = files.map((file) => calculatePackageDeps(file));
|
|
// Add additional dependencies.
|
|
const additionalDepsSet = new Set(dep_lists_1.additionalDeps);
|
|
dependencies.push(additionalDepsSet);
|
|
// Merge all the dependencies.
|
|
const mergedDependencies = mergePackageDeps(dependencies);
|
|
let sortedDependencies = [];
|
|
for (const dependency of mergedDependencies) {
|
|
sortedDependencies.push(dependency);
|
|
}
|
|
sortedDependencies.sort();
|
|
// Exclude bundled dependencies
|
|
sortedDependencies = sortedDependencies.filter(dependency => {
|
|
return !dep_lists_1.bundledDeps.some(bundledDep => dependency.startsWith(bundledDep));
|
|
});
|
|
/* {{SQL CARBON EDIT}} - Not needed for SQL
|
|
const referenceGeneratedDeps = referenceGeneratedDepsByArch[arch];
|
|
if (JSON.stringify(sortedDependencies) !== JSON.stringify(referenceGeneratedDeps)) {
|
|
const failMessage = 'The dependencies list has changed. '
|
|
+ 'Printing newer dependencies list that one can use to compare against referenceGeneratedDeps:\n'
|
|
+ sortedDependencies.join('\n');
|
|
if (FAIL_BUILD_FOR_NEW_DEPENDENCIES) {
|
|
throw new Error(failMessage);
|
|
} else {
|
|
console.warn(failMessage);
|
|
}
|
|
}
|
|
*/
|
|
return sortedDependencies;
|
|
}
|
|
exports.getDependencies = getDependencies;
|
|
// Based on https://source.chromium.org/chromium/chromium/src/+/main:chrome/installer/linux/rpm/calculate_package_deps.py.
|
|
function calculatePackageDeps(binaryPath) {
|
|
try {
|
|
if (!((0, fs_1.statSync)(binaryPath).mode & fs_1.constants.S_IXUSR)) {
|
|
throw new Error(`Binary ${binaryPath} needs to have an executable bit set.`);
|
|
}
|
|
}
|
|
catch (e) {
|
|
// The package might not exist. Don't re-throw the error here.
|
|
console.error('Tried to stat ' + binaryPath + ' but failed.');
|
|
}
|
|
const findRequiresResult = (0, child_process_1.spawnSync)('/usr/lib/rpm/find-requires', { input: binaryPath + '\n' });
|
|
if (findRequiresResult.status !== 0) {
|
|
throw new Error(`find-requires failed with exit code ${findRequiresResult.status}.\nstderr: ${findRequiresResult.stderr}`);
|
|
}
|
|
const requires = new Set(findRequiresResult.stdout.toString('utf-8').trimEnd().split('\n'));
|
|
return requires;
|
|
}
|
|
// Based on https://source.chromium.org/chromium/chromium/src/+/main:chrome/installer/linux/rpm/merge_package_deps.py.
|
|
function mergePackageDeps(inputDeps) {
|
|
const requires = new Set();
|
|
for (const depSet of inputDeps) {
|
|
for (const dep of depSet) {
|
|
const trimmedDependency = dep.trim();
|
|
if (trimmedDependency.length && !trimmedDependency.startsWith('#')) {
|
|
requires.add(trimmedDependency);
|
|
}
|
|
}
|
|
}
|
|
return requires;
|
|
}
|