Remove support for CodeQL CLI v2.12.7 and v2.11.6 (#3371)
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
## [UNRELEASED]
|
||||
|
||||
- Remove support for CodeQL CLI versions older than 2.13.5. [#3371](https://github.com/github/vscode-codeql/pull/3371)
|
||||
|
||||
## 1.12.2 - 14 February 2024
|
||||
|
||||
- Stop allowing running variant analyses with a query outside of the workspace. [#3302](https://github.com/github/vscode-codeql/pull/3302)
|
||||
|
||||
@@ -1432,7 +1432,7 @@
|
||||
},
|
||||
{
|
||||
"command": "codeQL.quickEvalCount",
|
||||
"when": "editorLangId == ql && codeql.supportsQuickEvalCount"
|
||||
"when": "editorLangId == ql"
|
||||
},
|
||||
{
|
||||
"command": "codeQL.quickEvalContextEditor",
|
||||
|
||||
@@ -1271,12 +1271,6 @@ export class CodeQLCliServer implements Disposable {
|
||||
): Promise<QlpacksInfo> {
|
||||
const args = this.getAdditionalPacksArg(additionalPacks);
|
||||
if (extensionPacksOnly) {
|
||||
if (!(await this.cliConstraints.supportsQlpacksKind())) {
|
||||
void this.logger.log(
|
||||
"Warning: Running with extension packs is only supported by CodeQL CLI v2.12.3 or later.",
|
||||
);
|
||||
return {};
|
||||
}
|
||||
args.push("--kind", "extension", "--no-recursive");
|
||||
} else if (kind) {
|
||||
args.push("--kind", kind);
|
||||
@@ -1412,15 +1406,13 @@ export class CodeQLCliServer implements Disposable {
|
||||
args.push("--mode", "update");
|
||||
}
|
||||
if (workspaceFolders?.length > 0) {
|
||||
if (await this.cliConstraints.supportsAdditionalPacksInstall()) {
|
||||
args.push(
|
||||
// Allow prerelease packs from the ql submodule.
|
||||
"--allow-prerelease",
|
||||
// Allow the use of --additional-packs argument without issueing a warning
|
||||
"--no-strict-mode",
|
||||
...this.getAdditionalPacksArg(workspaceFolders),
|
||||
);
|
||||
}
|
||||
args.push(
|
||||
// Allow prerelease packs from the ql submodule.
|
||||
"--allow-prerelease",
|
||||
// Allow the use of --additional-packs argument without issueing a warning
|
||||
"--no-strict-mode",
|
||||
...this.getAdditionalPacksArg(workspaceFolders),
|
||||
);
|
||||
}
|
||||
return this.runJsonCodeQlCliCommandWithAuthentication(
|
||||
["pack", "install"],
|
||||
@@ -1521,15 +1513,7 @@ export class CodeQLCliServer implements Disposable {
|
||||
this._versionChangedListeners.forEach((listener) =>
|
||||
listener(newVersionAndFeatures),
|
||||
);
|
||||
|
||||
// this._version is only undefined upon config change, so we reset CLI-based context key only when necessary.
|
||||
await this.app.commands.execute(
|
||||
"setContext",
|
||||
"codeql.supportsQuickEvalCount",
|
||||
newVersionAndFeatures.version.compare(
|
||||
CliVersionConstraint.CLI_VERSION_WITH_QUICK_EVAL_COUNT,
|
||||
) >= 0,
|
||||
);
|
||||
await this.app.commands.execute(
|
||||
"setContext",
|
||||
"codeql.supportsTrimCache",
|
||||
@@ -1573,11 +1557,8 @@ export class CodeQLCliServer implements Disposable {
|
||||
return paths.length ? ["--additional-packs", paths.join(delimiter)] : [];
|
||||
}
|
||||
|
||||
public async useExtensionPacks(): Promise<boolean> {
|
||||
return (
|
||||
this.cliConfig.useExtensionPacks &&
|
||||
(await this.cliConstraints.supportsQlpacksKind())
|
||||
);
|
||||
public useExtensionPacks(): boolean {
|
||||
return this.cliConfig.useExtensionPacks;
|
||||
}
|
||||
|
||||
public async setUseExtensionPacks(useExtensionPacks: boolean) {
|
||||
@@ -1694,26 +1675,7 @@ function shouldDebugCliServer() {
|
||||
export class CliVersionConstraint {
|
||||
// The oldest version of the CLI that we support. This is used to determine
|
||||
// whether to show a warning about the CLI being too old on startup.
|
||||
public static OLDEST_SUPPORTED_CLI_VERSION = new SemVer("2.11.6");
|
||||
|
||||
/**
|
||||
* CLI version that supports the `--kind` option for the `resolve qlpacks` command.
|
||||
*/
|
||||
public static CLI_VERSION_WITH_QLPACKS_KIND = new SemVer("2.12.3");
|
||||
|
||||
/**
|
||||
* CLI version that supports the `--additional-packs` option for the `pack install` command.
|
||||
*/
|
||||
public static CLI_VERSION_WITH_ADDITIONAL_PACKS_INSTALL = new SemVer(
|
||||
"2.12.4",
|
||||
);
|
||||
|
||||
public static CLI_VERSION_GLOBAL_CACHE = new SemVer("2.12.4");
|
||||
|
||||
/**
|
||||
* CLI version where the query server supports quick-eval count mode.
|
||||
*/
|
||||
public static CLI_VERSION_WITH_QUICK_EVAL_COUNT = new SemVer("2.13.3");
|
||||
public static OLDEST_SUPPORTED_CLI_VERSION = new SemVer("2.13.5");
|
||||
|
||||
/**
|
||||
* CLI version where the `generate extensible-predicate-metadata`
|
||||
@@ -1753,34 +1715,12 @@ export class CliVersionConstraint {
|
||||
return (await this.cli.getVersion()).compare(v) >= 0;
|
||||
}
|
||||
|
||||
async supportsQlpacksKind() {
|
||||
return this.isVersionAtLeast(
|
||||
CliVersionConstraint.CLI_VERSION_WITH_QLPACKS_KIND,
|
||||
);
|
||||
}
|
||||
|
||||
async supportsAdditionalPacksInstall() {
|
||||
return this.isVersionAtLeast(
|
||||
CliVersionConstraint.CLI_VERSION_WITH_ADDITIONAL_PACKS_INSTALL,
|
||||
);
|
||||
}
|
||||
|
||||
async usesGlobalCompilationCache() {
|
||||
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_GLOBAL_CACHE);
|
||||
}
|
||||
|
||||
async supportsVisibilityNotifications() {
|
||||
return this.isVersionAtLeast(
|
||||
CliVersionConstraint.CLI_VERSION_WITH_VISIBILITY_NOTIFICATIONS,
|
||||
);
|
||||
}
|
||||
|
||||
async supportsQuickEvalCount() {
|
||||
return this.isVersionAtLeast(
|
||||
CliVersionConstraint.CLI_VERSION_WITH_QUICK_EVAL_COUNT,
|
||||
);
|
||||
}
|
||||
|
||||
async supportsGenerateExtensiblePredicateMetadata() {
|
||||
return this.isVersionAtLeast(
|
||||
CliVersionConstraint.CLI_VERSION_WITH_EXTENSIBLE_PREDICATE_METADATA,
|
||||
|
||||
@@ -41,7 +41,6 @@ import { LocalQueryInfo } from "../query-results";
|
||||
import type { WebviewReveal } from "./webview";
|
||||
import { asError, getErrorMessage } from "../common/helpers-pure";
|
||||
import type { CodeQLCliServer } from "../codeql-cli/cli";
|
||||
import { CliVersionConstraint } from "../codeql-cli/cli";
|
||||
import type { LocalQueryCommands } from "../common/commands";
|
||||
import { DisposableObject } from "../common/disposable-object";
|
||||
import { SkeletonQueryWizard } from "./skeleton-query-wizard";
|
||||
@@ -256,11 +255,6 @@ export class LocalQueries extends DisposableObject {
|
||||
private async quickEvalCount(uri: Uri): Promise<void> {
|
||||
await withProgress(
|
||||
async (progress, token) => {
|
||||
if (!(await this.cliServer.cliConstraints.supportsQuickEvalCount())) {
|
||||
throw new Error(
|
||||
`Quick evaluation count is only supported by CodeQL CLI v${CliVersionConstraint.CLI_VERSION_WITH_QUICK_EVAL_COUNT} or later.`,
|
||||
);
|
||||
}
|
||||
await this.compileAndRunQuery(
|
||||
QuickEvalType.QuickEvalCount,
|
||||
uri,
|
||||
@@ -594,7 +588,7 @@ export class LocalQueries extends DisposableObject {
|
||||
public async getDefaultExtensionPacks(
|
||||
additionalPacks: string[],
|
||||
): Promise<string[]> {
|
||||
return (await this.cliServer.useExtensionPacks())
|
||||
return this.cliServer.useExtensionPacks()
|
||||
? Object.keys(await this.cliServer.resolveQlpacks(additionalPacks, true))
|
||||
: [];
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { ModelEditorView } from "./model-editor-view";
|
||||
import type { ModelEditorCommands } from "../common/commands";
|
||||
import type { CodeQLCliServer } from "../codeql-cli/cli";
|
||||
import { CliVersionConstraint } from "../codeql-cli/cli";
|
||||
import type { QueryRunner } from "../query-server";
|
||||
import type {
|
||||
DatabaseItem,
|
||||
@@ -169,14 +168,6 @@ export class ModelEditorModule extends DisposableObject {
|
||||
async (progress, token) => {
|
||||
const maxStep = 4;
|
||||
|
||||
if (!(await this.cliServer.cliConstraints.supportsQlpacksKind())) {
|
||||
void showAndLogErrorMessage(
|
||||
this.app.logger,
|
||||
`This feature requires CodeQL CLI version ${CliVersionConstraint.CLI_VERSION_WITH_QLPACKS_KIND.format()} or later.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const modelFile = await pickExtensionPack(
|
||||
this.cliServer,
|
||||
db,
|
||||
|
||||
@@ -131,16 +131,7 @@ async function generateQueryPack(
|
||||
...extensionPacks.map((p) => `--extension-pack=${p}@*`),
|
||||
];
|
||||
} else {
|
||||
if (await cliServer.cliConstraints.usesGlobalCompilationCache()) {
|
||||
precompilationOpts = ["--qlx"];
|
||||
} else {
|
||||
const cache = join(qlPackDetails.qlPackRootPath, ".cache");
|
||||
precompilationOpts = [
|
||||
"--qlx",
|
||||
"--no-default-compilation-cache",
|
||||
`--compilation-cache=${cache}`,
|
||||
];
|
||||
}
|
||||
precompilationOpts = ["--qlx"];
|
||||
|
||||
if (extensionPacks.length > 0) {
|
||||
await addExtensionPacksAsDependencies(targetPackPath, extensionPacks);
|
||||
@@ -408,7 +399,7 @@ async function getExtensionPacksToInject(
|
||||
workspaceFolders: string[],
|
||||
): Promise<string[]> {
|
||||
const result: string[] = [];
|
||||
if (await cliServer.useExtensionPacks()) {
|
||||
if (cliServer.useExtensionPacks()) {
|
||||
const extensionPacks = await cliServer.resolveQlpacks(
|
||||
workspaceFolders,
|
||||
true,
|
||||
|
||||
@@ -3,7 +3,5 @@
|
||||
"v2.15.5",
|
||||
"v2.14.6",
|
||||
"v2.13.5",
|
||||
"v2.12.7",
|
||||
"v2.11.6",
|
||||
"nightly"
|
||||
]
|
||||
|
||||
@@ -20,7 +20,6 @@ import {
|
||||
getActivatedExtension,
|
||||
} from "../global.helper";
|
||||
import type { CodeQLCliServer } from "../../../src/codeql-cli/cli";
|
||||
import { CliVersionConstraint } from "../../../src/codeql-cli/cli";
|
||||
import { describeWithCodeQL } from "../cli";
|
||||
import type {
|
||||
CoreCompletedQuery,
|
||||
@@ -151,23 +150,12 @@ describeWithCodeQL()("Queries", () => {
|
||||
);
|
||||
|
||||
it("should run a query that has an extension without looking for extensions in the workspace", async () => {
|
||||
if (!(await supportsExtensionPacks())) {
|
||||
console.log(
|
||||
`Skipping test because it is only supported for CodeQL CLI versions >= ${CliVersionConstraint.CLI_VERSION_WITH_QLPACKS_KIND}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
await cli.setUseExtensionPacks(false);
|
||||
const parsedResults = await runQueryWithExtensions();
|
||||
expect(parsedResults).toEqual([1]);
|
||||
});
|
||||
|
||||
it("should run a query that has an extension and look for extensions in the workspace", async () => {
|
||||
if (!(await supportsExtensionPacks())) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Starting 'extensions' ${mode}`);
|
||||
console.log("Setting useExtensionPacks to true");
|
||||
await cli.setUseExtensionPacks(true);
|
||||
@@ -176,16 +164,6 @@ describeWithCodeQL()("Queries", () => {
|
||||
expect(parsedResults).toEqual([1, 2, 3, 4]);
|
||||
});
|
||||
|
||||
async function supportsExtensionPacks(): Promise<boolean> {
|
||||
if (await qs.cliServer.cliConstraints.supportsQlpacksKind()) {
|
||||
return true;
|
||||
}
|
||||
console.log(
|
||||
`Skipping test because it is only supported for CodeQL CLI versions >= ${CliVersionConstraint.CLI_VERSION_WITH_QLPACKS_KIND}`,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
async function runQueryWithExtensions() {
|
||||
console.log("Calling compileAndRunQuery");
|
||||
const result = await compileAndRunQuery(
|
||||
|
||||
@@ -271,12 +271,6 @@ describe("Variant Analysis Manager", () => {
|
||||
});
|
||||
|
||||
it("should run a remote query with extension packs inside a qlpack", async () => {
|
||||
if (!(await cli.cliConstraints.supportsQlpacksKind())) {
|
||||
console.log(
|
||||
`Skipping test because qlpacks kind is only suppported in CLI version ${CliVersionConstraint.CLI_VERSION_WITH_QLPACKS_KIND} or later.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
await cli.setUseExtensionPacks(true);
|
||||
await doVariantAnalysisTest({
|
||||
queryPaths: ["data-remote-qlpack-nested/subfolder/in-pack.ql"],
|
||||
|
||||
Reference in New Issue
Block a user