Cache MRVA queries correctly (#2435)

This commit is contained in:
Alexander Eyers-Taylor
2023-05-30 14:12:26 +01:00
committed by GitHub
parent 5a66d6ff2d
commit af3be543f5
2 changed files with 16 additions and 6 deletions

View File

@@ -1818,6 +1818,8 @@ export class CliVersionConstraint {
"2.12.4",
);
public static CLI_VERSION_GLOBAL_CACHE = new SemVer("2.12.4");
constructor(private readonly cli: CodeQLCliServer) {
/**/
}
@@ -1887,4 +1889,8 @@ export class CliVersionConstraint {
CliVersionConstraint.CLI_VERSION_WITH_ADDITIONAL_PACKS_INSTALL,
);
}
async usesGlobalCompilationCache() {
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_GLOBAL_CACHE);
}
}

View File

@@ -116,12 +116,16 @@ async function generateQueryPack(
let precompilationOpts: string[] = [];
if (await cliServer.cliConstraints.supportsQlxRemote()) {
const ccache = join(originalPackRoot, ".cache");
precompilationOpts = [
"--qlx",
"--no-default-compilation-cache",
`--compilation-cache=${ccache}`,
];
if (await cliServer.cliConstraints.usesGlobalCompilationCache()) {
precompilationOpts = ["--qlx"];
} else {
const ccache = join(originalPackRoot, ".cache");
precompilationOpts = [
"--qlx",
"--no-default-compilation-cache",
`--compilation-cache=${ccache}`,
];
}
} else {
precompilationOpts = ["--no-precompile"];
}