diff --git a/extensions/ql-vscode/src/codeql-cli/cli-version.ts b/extensions/ql-vscode/src/codeql-cli/cli-version.ts index 975ed7d7981..94f1169c30a 100644 --- a/extensions/ql-vscode/src/codeql-cli/cli-version.ts +++ b/extensions/ql-vscode/src/codeql-cli/cli-version.ts @@ -12,6 +12,7 @@ interface VersionResult { export interface CliFeatures { featuresInVersionResult?: boolean; mrvaPackCreate?: boolean; + generateSummarySymbolMap?: boolean; } export interface VersionAndFeatures { diff --git a/extensions/ql-vscode/src/codeql-cli/cli.ts b/extensions/ql-vscode/src/codeql-cli/cli.ts index b0526187f0e..9728b3150fc 100644 --- a/extensions/ql-vscode/src/codeql-cli/cli.ts +++ b/extensions/ql-vscode/src/codeql-cli/cli.ts @@ -1211,10 +1211,15 @@ export class CodeQLCliServer implements Disposable { outputPath: string, endSummaryPath: string, ): Promise { + const supportsGenerateSummarySymbolMap = + await this.cliConstraints.supportsGenerateSummarySymbolMap(); const subcommandArgs = [ "--format=text", `--end-summary=${endSummaryPath}`, "--sourcemap", + ...(supportsGenerateSummarySymbolMap + ? ["--summary-symbol-map", "--minify-output"] + : []), inputPath, outputPath, ]; @@ -1953,4 +1958,8 @@ export class CliVersionConstraint { async supportsMrvaPackCreate(): Promise { return (await this.cli.getFeatures()).mrvaPackCreate === true; } + + async supportsGenerateSummarySymbolMap(): Promise { + return (await this.cli.getFeatures()).generateSummarySymbolMap === true; + } } diff --git a/extensions/ql-vscode/src/run-queries-shared.ts b/extensions/ql-vscode/src/run-queries-shared.ts index 779b9ed7e29..4a91cad5e58 100644 --- a/extensions/ql-vscode/src/run-queries-shared.ts +++ b/extensions/ql-vscode/src/run-queries-shared.ts @@ -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); + } } }