Include base database OIDs when bundling database

This commit is contained in:
Henry Mercer
2026-01-09 18:58:32 +00:00
parent d6efb85cdf
commit d32cd4ddde
12 changed files with 156 additions and 43 deletions
+16 -5
View File
@@ -129063,6 +129063,7 @@ var maximumVersion = "3.20";
var minimumVersion = "3.14";
// src/util.ts
var BASE_DATABASE_OIDS_FILE_NAME = "base-database-oids.json";
var BROKEN_VERSIONS = ["0.0.0-20211207"];
var GITHUB_DOTCOM_URL = "https://github.com";
var MINIMUM_CGROUP_MEMORY_LIMIT_BYTES = 1024 * 1024;
@@ -129208,13 +129209,18 @@ function getCachedCodeQlVersion() {
async function codeQlVersionAtLeast(codeql, requiredVersion) {
return semver.gte((await codeql.getVersion()).version, requiredVersion);
}
function getBaseDatabaseOidsFilePath(config) {
return path.join(config.dbLocation, BASE_DATABASE_OIDS_FILE_NAME);
}
async function bundleDb(config, language, codeql, dbName) {
const databasePath = getCodeQLDatabasePath(config, language);
const databaseBundlePath = path.resolve(config.dbLocation, `${dbName}.zip`);
if (fs.existsSync(databaseBundlePath)) {
await fs.promises.rm(databaseBundlePath, { force: true });
}
await codeql.databaseBundle(databasePath, databaseBundlePath, dbName);
await codeql.databaseBundle(databasePath, databaseBundlePath, dbName, [
BASE_DATABASE_OIDS_FILE_NAME
]);
return databaseBundlePath;
}
async function delay(milliseconds, opts) {
@@ -130308,9 +130314,6 @@ async function readBaseDatabaseOidsFile(config, logger) {
throw e;
}
}
function getBaseDatabaseOidsFilePath(config) {
return path3.join(config.dbLocation, "base-database-oids.json");
}
async function writeOverlayChangesFile(config, sourceRoot, logger) {
const baseFileOids = await readBaseDatabaseOidsFile(config, logger);
const overlayFileOids = await getFileOidsUnderPath(sourceRoot);
@@ -132219,7 +132222,7 @@ ${output}`
await runCli(cmd, codeqlArgs);
}
},
async databaseBundle(databasePath, outputFilePath, databaseName) {
async databaseBundle(databasePath, outputFilePath, databaseName, tryAlsoIncludeRelativePaths) {
const args = [
"database",
"bundle",
@@ -132228,6 +132231,14 @@ ${output}`
`--name=${databaseName}`,
...getExtraOptionsFromEnv(["database", "bundle"])
];
if (await this.supportsFeature("bundleSupportsIncludeOption" /* BundleSupportsIncludeOption */)) {
args.push(
...tryAlsoIncludeRelativePaths.flatMap((relativePath) => [
"--include",
relativePath
])
);
}
await new toolrunner3.ToolRunner(cmd, args).exec();
},
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId) {