Skip to content

Commit 47a48fe

Browse files
committed
Experimental: cache Java database only
1 parent ef02f74 commit 47a48fe

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

lib/overlay-database-utils.js

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

lib/overlay-database-utils.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/overlay-database-utils.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { type CodeQL } from "./codeql";
88
import { type Config } from "./config-utils";
99
import { getFileOidsUnderPath } from "./git-utils";
1010
import { Logger } from "./logging";
11-
import { isInTestMode, withTimeout } from "./util";
11+
import { getCodeQLDatabasePath, isInTestMode, withTimeout } from "./util";
12+
import { Language } from "./languages";
1213

1314
export enum OverlayDatabaseMode {
1415
Overlay = "overlay",
@@ -68,7 +69,7 @@ async function readBaseDatabaseOidsFile(
6869
}
6970

7071
function getBaseDatabaseOidsFilePath(config: Config): string {
71-
return path.join(config.dbLocation, "base-database-oids.json");
72+
return path.join(config.dbLocation, "java", "base-database-oids.json");
7273
}
7374

7475
/**
@@ -203,7 +204,7 @@ export async function uploadOverlayBaseDatabaseToCache(
203204
return false;
204205
}
205206

206-
const dbLocation = config.dbLocation;
207+
const dbLocation = getCodeQLDatabasePath(config, Language.java);
207208
const cacheKey = generateCacheKey((await codeql.getVersion()).version);
208209
logger.info(
209210
`Uploading overlay-base database to Actions cache with key ${cacheKey}`,
@@ -267,7 +268,7 @@ export async function downloadOverlayBaseDatabaseFromCache(
267268
return false;
268269
}
269270

270-
const dbLocation = config.dbLocation;
271+
const dbLocation = getCodeQLDatabasePath(config, Language.java);
271272
const codeQlVersion = (await codeql.getVersion()).version;
272273
const restoreKey = getCacheRestoreKey(codeQlVersion);
273274

@@ -329,5 +330,5 @@ function getCacheRestoreKey(codeQlVersion: string): string {
329330
// we are analyzing. However, since overlay-base databases are built from the
330331
// default branch and used in PR analysis, it is exceedingly unlikely that
331332
// the commit SHA will ever be the same, so we can just leave it out.
332-
return `${CACHE_PREFIX}-${CACHE_VERSION}-${codeQlVersion}-`;
333+
return `${CACHE_PREFIX}-${CACHE_VERSION}-${codeQlVersion}-java-`;
333334
}

0 commit comments

Comments
 (0)