Skip to content

Commit af3be54

Browse files
author
Alexander Eyers-Taylor
authored
Cache MRVA queries correctly (#2435)
1 parent 5a66d6f commit af3be54

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

extensions/ql-vscode/src/codeql-cli/cli.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,6 +1818,8 @@ export class CliVersionConstraint {
18181818
"2.12.4",
18191819
);
18201820

1821+
public static CLI_VERSION_GLOBAL_CACHE = new SemVer("2.12.4");
1822+
18211823
constructor(private readonly cli: CodeQLCliServer) {
18221824
/**/
18231825
}
@@ -1887,4 +1889,8 @@ export class CliVersionConstraint {
18871889
CliVersionConstraint.CLI_VERSION_WITH_ADDITIONAL_PACKS_INSTALL,
18881890
);
18891891
}
1892+
1893+
async usesGlobalCompilationCache() {
1894+
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_GLOBAL_CACHE);
1895+
}
18901896
}

extensions/ql-vscode/src/variant-analysis/run-remote-query.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,16 @@ async function generateQueryPack(
116116

117117
let precompilationOpts: string[] = [];
118118
if (await cliServer.cliConstraints.supportsQlxRemote()) {
119-
const ccache = join(originalPackRoot, ".cache");
120-
precompilationOpts = [
121-
"--qlx",
122-
"--no-default-compilation-cache",
123-
`--compilation-cache=${ccache}`,
124-
];
119+
if (await cliServer.cliConstraints.usesGlobalCompilationCache()) {
120+
precompilationOpts = ["--qlx"];
121+
} else {
122+
const ccache = join(originalPackRoot, ".cache");
123+
precompilationOpts = [
124+
"--qlx",
125+
"--no-default-compilation-cache",
126+
`--compilation-cache=${ccache}`,
127+
];
128+
}
125129
} else {
126130
precompilationOpts = ["--no-precompile"];
127131
}

0 commit comments

Comments
 (0)