Skip to content

Commit 8314a54

Browse files
authored
Merge pull request #2627 from github/charisk/remove-deprecated-version-support
Remove conditionals and version constraints for unsupported CLI versions
2 parents 0617e3e + e80ef7c commit 8314a54

6 files changed

Lines changed: 16 additions & 83 deletions

File tree

extensions/ql-vscode/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,17 +1077,17 @@
10771077
{
10781078
"command": "codeQLQueryHistory.showEvalLog",
10791079
"group": "4_queryHistory@1",
1080-
"when": "codeql.supportsEvalLog && viewItem == rawResultsItem || codeql.supportsEvalLog && viewItem == interpretedResultsItem || codeql.supportsEvalLog && viewItem == cancelledResultsItem"
1080+
"when": "viewItem == rawResultsItem || viewItem == interpretedResultsItem || viewItem == cancelledResultsItem"
10811081
},
10821082
{
10831083
"command": "codeQLQueryHistory.showEvalLogSummary",
10841084
"group": "4_queryHistory@2",
1085-
"when": "codeql.supportsEvalLog && viewItem == rawResultsItem || codeql.supportsEvalLog && viewItem == interpretedResultsItem || codeql.supportsEvalLog && viewItem == cancelledResultsItem"
1085+
"when": "viewItem == rawResultsItem || viewItem == interpretedResultsItem || viewItem == cancelledResultsItem"
10861086
},
10871087
{
10881088
"command": "codeQLQueryHistory.showEvalLogViewer",
10891089
"group": "4_queryHistory@3",
1090-
"when": "config.codeQL.canary && codeql.supportsEvalLog && viewItem == rawResultsItem || config.codeQL.canary && codeql.supportsEvalLog && viewItem == interpretedResultsItem || config.codeQL.canary && codeql.supportsEvalLog && viewItem == cancelledResultsItem"
1090+
"when": "config.codeQL.canary && viewItem == rawResultsItem || config.codeQL.canary && viewItem == interpretedResultsItem || config.codeQL.canary && viewItem == cancelledResultsItem"
10911091
},
10921092
{
10931093
"command": "codeQLQueryHistory.showQueryText",

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

Lines changed: 6 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,21 +1428,13 @@ export class CodeQLCliServer implements Disposable {
14281428

14291429
async packPacklist(dir: string, includeQueries: boolean): Promise<string[]> {
14301430
const args = includeQueries ? [dir] : ["--no-include-queries", dir];
1431-
// since 2.7.1, packlist returns an object with a "paths" property that is a list of packs.
1432-
// previous versions return a list of packs.
1433-
const results: { paths: string[] } | string[] =
1434-
await this.runJsonCodeQlCliCommand(
1435-
["pack", "packlist"],
1436-
args,
1437-
"Generating the pack list",
1438-
);
1431+
const results: { paths: string[] } = await this.runJsonCodeQlCliCommand(
1432+
["pack", "packlist"],
1433+
args,
1434+
"Generating the pack list",
1435+
);
14391436

1440-
// Once we no longer need to support 2.7.0 or earlier, we can remove this and assume all versions return an object.
1441-
if ("paths" in results) {
1442-
return results.paths;
1443-
} else {
1444-
return results;
1445-
}
1437+
return results.paths;
14461438
}
14471439

14481440
async packResolveDependencies(
@@ -1476,13 +1468,6 @@ export class CodeQLCliServer implements Disposable {
14761468
);
14771469

14781470
// this._version is only undefined upon config change, so we reset CLI-based context key only when necessary.
1479-
await this.app.commands.execute(
1480-
"setContext",
1481-
"codeql.supportsEvalLog",
1482-
newVersion.compare(
1483-
CliVersionConstraint.CLI_VERSION_WITH_PER_QUERY_EVAL_LOG,
1484-
) >= 0,
1485-
);
14861471
await this.app.commands.execute(
14871472
"setContext",
14881473
"codeql.supportsQuickEvalCount",
@@ -1811,23 +1796,6 @@ export class CliVersionConstraint {
18111796
*/
18121797
public static CLI_VERSION_WITH_RESOLVE_EXTENSIONS = new SemVer("2.10.2");
18131798

1814-
/**
1815-
* CLI version where the `--evaluator-log` and related options to the query server were introduced,
1816-
* on a per-query server basis.
1817-
*/
1818-
public static CLI_VERSION_WITH_STRUCTURED_EVAL_LOG = new SemVer("2.8.2");
1819-
1820-
/**
1821-
* CLI version that supports rotating structured logs to produce one per query.
1822-
*
1823-
* Note that 2.8.4 supports generating the evaluation logs and summaries,
1824-
* but 2.9.0 includes a new option to produce the end-of-query summary logs to
1825-
* the query server console. For simplicity we gate all features behind 2.9.0,
1826-
* but if a user is tied to the 2.8 release, we can enable evaluator logs
1827-
* and summaries for them.
1828-
*/
1829-
public static CLI_VERSION_WITH_PER_QUERY_EVAL_LOG = new SemVer("2.9.0");
1830-
18311799
/**
18321800
* CLI version that supports the `--sourcemap` option for log generation.
18331801
*/
@@ -1893,18 +1861,6 @@ export class CliVersionConstraint {
18931861
);
18941862
}
18951863

1896-
async supportsStructuredEvalLog() {
1897-
return this.isVersionAtLeast(
1898-
CliVersionConstraint.CLI_VERSION_WITH_STRUCTURED_EVAL_LOG,
1899-
);
1900-
}
1901-
1902-
async supportsPerQueryEvalLog() {
1903-
return this.isVersionAtLeast(
1904-
CliVersionConstraint.CLI_VERSION_WITH_PER_QUERY_EVAL_LOG,
1905-
);
1906-
}
1907-
19081864
async supportsSourceMap() {
19091865
return this.isVersionAtLeast(
19101866
CliVersionConstraint.CLI_VERSION_WITH_SOURCEMAP,

extensions/ql-vscode/src/query-history/query-history-manager.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import {
3636
} from "./query-status";
3737
import { readQueryHistoryFromFile, writeQueryHistoryToFile } from "./store";
3838
import { pathExists } from "fs-extra";
39-
import { CliVersionConstraint } from "../codeql-cli/cli";
4039
import { HistoryItemLabelProvider } from "./history-item-label-provider";
4140
import { ResultsView, WebviewReveal } from "../local-queries";
4241
import { EvalLogTreeBuilder, EvalLogViewer } from "../query-evaluation-logging";
@@ -760,7 +759,7 @@ export class QueryHistoryManager extends DisposableObject {
760759
private warnNoEvalLogs() {
761760
void showAndLogWarningMessage(
762761
this.app.logger,
763-
`Evaluator log, summary, and viewer are not available for this run. Perhaps it failed before evaluation, or you are running with a version of CodeQL before ' + ${CliVersionConstraint.CLI_VERSION_WITH_PER_QUERY_EVAL_LOG}?`,
762+
`Evaluator log, summary, and viewer are not available for this run. Perhaps it failed before evaluation?`,
764763
);
765764
}
766765

extensions/ql-vscode/src/query-server/legacy/query-server-client.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -146,22 +146,11 @@ export class QueryServerClient extends DisposableObject {
146146

147147
args.push("--require-db-registration");
148148

149-
if (!(await this.cliServer.cliConstraints.supportsPerQueryEvalLog())) {
150-
args.push("--old-eval-stats");
151-
}
152-
153-
if (await this.cliServer.cliConstraints.supportsStructuredEvalLog()) {
154-
const structuredLogFile = `${this.opts.contextStoragePath}/structured-evaluator-log.json`;
155-
await ensureFile(structuredLogFile);
149+
const structuredLogFile = `${this.opts.contextStoragePath}/structured-evaluator-log.json`;
150+
await ensureFile(structuredLogFile);
156151

157-
args.push("--evaluator-log");
158-
args.push(structuredLogFile);
159-
160-
// We hard-code the verbosity level to 5 and minify to false.
161-
// This will be the behavior of the per-query structured logging in the CLI after 2.8.3.
162-
args.push("--evaluator-log-level");
163-
args.push("5");
164-
}
152+
args.push("--evaluator-log");
153+
args.push(structuredLogFile);
165154

166155
if (this.config.debug) {
167156
args.push("--debug", "--tuple-counting");

extensions/ql-vscode/src/query-server/legacy/run-queries.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,7 @@ async function runQuery(
129129
dbDir: dbContents.datasetUri.fsPath,
130130
workingSet: "default",
131131
};
132-
if (
133-
generateEvalLog &&
134-
(await qs.cliServer.cliConstraints.supportsPerQueryEvalLog())
135-
) {
132+
if (generateEvalLog) {
136133
await qs.sendRequest(messages.startLog, {
137134
db: dataset,
138135
logPath: outputDir.evalLogPath,
@@ -149,10 +146,7 @@ async function runQuery(
149146
await qs.sendRequest(messages.runQueries, params, token, progress);
150147
} finally {
151148
qs.unRegisterCallback(callbackId);
152-
if (
153-
generateEvalLog &&
154-
(await qs.cliServer.cliConstraints.supportsPerQueryEvalLog())
155-
) {
149+
if (generateEvalLog) {
156150
await qs.sendRequest(messages.endLog, {
157151
db: dataset,
158152
logPath: outputDir.evalLogPath,

extensions/ql-vscode/src/query-server/query-server-client.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,6 @@ export class QueryServerClient extends DisposableObject {
194194
args.push("--evaluator-log");
195195
args.push(structuredLogFile);
196196

197-
// We hard-code the verbosity level to 5 and minify to false.
198-
// This will be the behavior of the per-query structured logging in the CLI after 2.8.3.
199-
args.push("--evaluator-log-level");
200-
args.push("5");
201-
202197
if (this.config.debug) {
203198
args.push("--debug", "--tuple-counting");
204199
}

0 commit comments

Comments
 (0)