Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [UNRELEASED]

- Add a prompt to the "Quick query" command to encourage users in single-folder workspaces to use "Create query" instead. [#3082](https://github.com/github/vscode-codeql/pull/3082)
- Remove support for CodeQL CLI versions older than 2.11.6. [#3087](https://github.com/github/vscode-codeql/pull/3087)

## 1.10.0 - 16 November 2023

Expand Down
88 changes: 6 additions & 82 deletions extensions/ql-vscode/src/codeql-cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -881,10 +881,9 @@ export class CodeQLCliServer implements Disposable {
additionalPacks: string[],
queryPath: string,
): Promise<MlModelsInfo> {
const args = (await this.cliConstraints.supportsPreciseResolveMlModels())
? // use the dirname of the path so that we can handle query libraries
[...this.getAdditionalPacksArg(additionalPacks), dirname(queryPath)]
: this.getAdditionalPacksArg(additionalPacks);
const args =
// use the dirname of the path so that we can handle query libraries
[...this.getAdditionalPacksArg(additionalPacks), dirname(queryPath)];
return await this.runJsonCodeQlCliCommand<MlModelsInfo>(
["resolve", "ml-models"],
args,
Expand Down Expand Up @@ -988,9 +987,7 @@ export class CodeQLCliServer implements Disposable {
const subcommandArgs = [
"--format=text",
`--end-summary=${endSummaryPath}`,
...((await this.cliConstraints.supportsSourceMap())
? ["--sourcemap"]
: []),
"--sourcemap",
inputPath,
outputPath,
];
Expand Down Expand Up @@ -1712,41 +1709,7 @@ export 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.9.4");

/**
* CLI version where building QLX packs for remote queries is supported.
* (The options were _accepted_ by a few earlier versions, but only from
* 2.11.3 will it actually use the existing compilation cache correctly).
*/
public static CLI_VERSION_QLX_REMOTE = new SemVer("2.11.3");

/**
* CLI version where the `resolve ml-models` subcommand was enhanced to work with packaging.
*/
public static CLI_VERSION_WITH_PRECISE_RESOLVE_ML_MODELS = new SemVer(
"2.10.0",
);

/**
* CLI version where the `resolve extensions` subcommand exists.
*/
public static CLI_VERSION_WITH_RESOLVE_EXTENSIONS = new SemVer("2.10.2");

/**
* CLI version that supports the `--sourcemap` option for log generation.
*/
public static CLI_VERSION_WITH_SOURCEMAP = new SemVer("2.10.3");

/**
* CLI version that supports the new query server.
*/
public static CLI_VERSION_WITH_NEW_QUERY_SERVER = new SemVer("2.11.1");

/**
* CLI version that supports `${workspace}` references in qlpack.yml files.
*/
public static CLI_VERSION_WITH_WORKSPACE_RFERENCES = new SemVer("2.11.3");
public static OLDEST_SUPPORTED_CLI_VERSION = new SemVer("2.11.6");

/**
* CLI version that supports the `--kind` option for the `resolve qlpacks` command.
Expand Down Expand Up @@ -1796,48 +1759,9 @@ export class CliVersionConstraint {
return (await this.cli.getVersion()).compare(v) >= 0;
}

async supportsQlxRemote() {
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_QLX_REMOTE);
}

async supportsPreciseResolveMlModels() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_PRECISE_RESOLVE_ML_MODELS,
);
}

async supportsResolveExtensions() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_RESOLVE_EXTENSIONS,
);
}

async supportsSourceMap() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_SOURCEMAP,
);
}

async supportsNewQueryServer() {
// This allows users to explicitly opt-out of the new query server.
return (
allowCanaryQueryServer() &&
this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_NEW_QUERY_SERVER,
)
);
}

async supportsNewQueryServerForTests() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_NEW_QUERY_SERVER,
);
}

async supportsWorkspaceReferences() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_WORKSPACE_RFERENCES,
);
return allowCanaryQueryServer();
}

async supportsQlpacksKind() {
Expand Down
10 changes: 0 additions & 10 deletions extensions/ql-vscode/src/model-editor/model-editor-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,6 @@ export class ModelEditorModule extends DisposableObject {
return;
}

if (
!(await this.cliServer.cliConstraints.supportsResolveExtensions())
) {
void showAndLogErrorMessage(
this.app.logger,
`This feature requires CodeQL CLI version ${CliVersionConstraint.CLI_VERSION_WITH_RESOLVE_EXTENSIONS.format()} or later.`,
);
return;
}

const modelFile = await pickExtensionPack(
this.cliServer,
db,
Expand Down
22 changes: 9 additions & 13 deletions extensions/ql-vscode/src/variant-analysis/run-remote-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,15 @@ async function generateQueryPack(
await cliServer.clearCache();

let precompilationOpts: string[] = [];
if (await cliServer.cliConstraints.supportsQlxRemote()) {
if (await cliServer.cliConstraints.usesGlobalCompilationCache()) {
precompilationOpts = ["--qlx"];
} else {
const ccache = join(originalPackRoot, ".cache");
precompilationOpts = [
"--qlx",
"--no-default-compilation-cache",
`--compilation-cache=${ccache}`,
];
}
if (await cliServer.cliConstraints.usesGlobalCompilationCache()) {
precompilationOpts = ["--qlx"];
} else {
precompilationOpts = ["--no-precompile"];
const ccache = join(originalPackRoot, ".cache");
precompilationOpts = [
"--qlx",
"--no-default-compilation-cache",
`--compilation-cache=${ccache}`,
];
}

if (await cliServer.useExtensionPacks()) {
Expand Down Expand Up @@ -540,7 +536,7 @@ async function getControllerRepoFromApi(
}
}

export function removeWorkspaceRefs(qlpack: QlPackFile) {
function removeWorkspaceRefs(qlpack: QlPackFile) {
if (!qlpack.dependencies) {
return;
}
Expand Down
2 changes: 0 additions & 2 deletions extensions/ql-vscode/supported_cli_versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@
"v2.13.5",
"v2.12.7",
"v2.11.6",
"v2.9.4",
"v2.10.5",
"nightly"
]
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,6 @@ describeWithCodeQL()("Debugger", () => {
});

it("should pass additionalArgs through to query server", async () => {
if (!(await cli.cliConstraints.supportsNewQueryServerForTests())) {
// Only works with the new query server.
return;
}
await withDebugController(appCommands, async (controller) => {
await controller.startDebugging(
{
Expand Down
Loading