Skip to content

Commit

Permalink
Allow compatible CLIs to generate summary symbols file
Browse files Browse the repository at this point in the history
This should be much faster than generating it in the extension.
  • Loading branch information
nickrolfe committed Jul 12, 2024
1 parent 75ab23b commit a069ae4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions extensions/ql-vscode/src/codeql-cli/cli-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface VersionResult {
export interface CliFeatures {
featuresInVersionResult?: boolean;
mrvaPackCreate?: boolean;
generateSummarySymbolMap?: boolean;
}

export interface VersionAndFeatures {
Expand Down
9 changes: 9 additions & 0 deletions extensions/ql-vscode/src/codeql-cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1211,10 +1211,15 @@ export class CodeQLCliServer implements Disposable {
outputPath: string,
endSummaryPath: string,
): Promise<string> {
const supportsGenerateSummarySymbolMap =
await this.cliConstraints.supportsGenerateSummarySymbolMap();
const subcommandArgs = [
"--format=text",
`--end-summary=${endSummaryPath}`,
"--sourcemap",
...(supportsGenerateSummarySymbolMap
? ["--summary-symbol-map", "--minify-output"]
: []),
inputPath,
outputPath,
];
Expand Down Expand Up @@ -1953,4 +1958,8 @@ export class CliVersionConstraint {
async supportsMrvaPackCreate(): Promise<boolean> {
return (await this.cli.getFeatures()).mrvaPackCreate === true;
}

async supportsGenerateSummarySymbolMap(): Promise<boolean> {
return (await this.cli.getFeatures()).generateSummarySymbolMap === true;
}
}
11 changes: 9 additions & 2 deletions extensions/ql-vscode/src/run-queries-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,16 @@ export async function generateEvalLogSummaries(
await cliServer.generateJsonLogSummary(log, jsonSummary);

if (humanReadableSummary !== undefined) {
progress(progressUpdate(3, 3, "Generating summary symbols file"));
summarySymbols = outputDir.evalLogSummarySymbolsPath;
await generateSummarySymbolsFile(humanReadableSummary, summarySymbols);
if (
!(await cliServer.cliConstraints.supportsGenerateSummarySymbolMap())
) {
// We're using an old CLI that cannot generate the summary symbols file while generating the
// human-readable log summary. As a fallback, create it by parsing the human-readable
// summary.
progress(progressUpdate(3, 3, "Generating summary symbols file"));
await generateSummarySymbolsFile(humanReadableSummary, summarySymbols);
}
}
}

Expand Down

0 comments on commit a069ae4

Please sign in to comment.