Revert change to resolveExtractor

This is secondary work that will follow from the main purpose of this PR.
This commit is contained in:
Mario Campos
2026-07-01 09:41:56 -05:00
parent bba0d6c67c
commit 7f4f27e7e6

View File

@@ -920,17 +920,32 @@ async function getCodeQLForCmd(
await new toolrunner.ToolRunner(cmd, args).exec();
},
async resolveExtractor(language: Language): Promise<string> {
// A previous implementation executed `codeql resolve extractor`.
// This can be a bit slow due to the JVM startup cost. Instead, get
// the extractor path from resolveLanguages(), which caches its output.
const output = await this.resolveLanguages();
const extractors = output.extractors[language];
if (extractors === undefined) {
throw new Error(
`Unable to resolve an extractor for the language '${language}'.`,
);
}
return extractors[0].extractor_root;
// Request it using `format=json` so we don't need to strip the trailing new line generated by
// the CLI.
let extractorPath = "";
await new toolrunner.ToolRunner(
cmd,
[
"resolve",
"extractor",
"--format=json",
`--language=${language}`,
"--extractor-include-aliases",
...getExtraOptionsFromEnv(["resolve", "extractor"]),
],
{
silent: true,
listeners: {
stdout: (data) => {
extractorPath += data.toString();
},
stderr: (data) => {
process.stderr.write(data);
},
},
},
).exec();
return JSON.parse(extractorPath) as string;
},
async resolveQueriesStartingPacks(queries: string[]): Promise<string[]> {
const codeqlArgs = [