Skip to content

Commit 3e20e62

Browse files
committed
Support overlay modes for "codeql database init"
1 parent 8c69433 commit 3e20e62

File tree

6 files changed

+34
-2
lines changed

6 files changed

+34
-2
lines changed

lib/codeql.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/codeql.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import assert from "assert";
12
import * as fs from "fs";
23
import * as path from "path";
34

@@ -585,6 +586,15 @@ export async function getCodeQLForCmd(
585586
extraArgs.push(`--qlconfig-file=${qlconfigFile}`);
586587
}
587588

589+
const overlayDatabaseEnv = process.env["CODEQL_OVERLAY_DATABASE_INIT"];
590+
if (overlayDatabaseEnv === "overlay") {
591+
assert(config.buildMode === BuildMode.None);
592+
extraArgs.push("--overlay");
593+
} else if (overlayDatabaseEnv === "overlay-base") {
594+
assert(config.buildMode === BuildMode.None);
595+
extraArgs.push("--overlay-base");
596+
}
597+
588598
const overwriteFlag = isSupportedToolsFeature(
589599
await this.getVersion(),
590600
ToolsFeature.ForceOverwrite,

src/init.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ export function cleanupDatabaseClusterDirectory(
163163
// for testing.
164164
rmSync = fs.rmSync,
165165
): void {
166+
const overlayDatabaseEnv = process.env["CODEQL_OVERLAY_DATABASE_INIT"];
167+
if (overlayDatabaseEnv === "overlay") {
168+
return;
169+
}
170+
166171
if (
167172
fs.existsSync(config.dbLocation) &&
168173
(fs.statSync(config.dbLocation).isFile() ||

0 commit comments

Comments
 (0)