File tree Expand file tree Collapse file tree
vscode-tests/cli-integration Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1199,6 +1199,11 @@ export class CliVersionConstraint {
11991199 */
12001200 public static CLI_VERSION_WITH_OLD_EVAL_STATS = new SemVer ( '2.7.4' ) ;
12011201
1202+ /**
1203+ * CLI version where packaging was introduced.
1204+ */
1205+ public static CLI_VERSION_WITH_PACKAGING = new SemVer ( '2.6.0' ) ;
1206+
12021207 constructor ( private readonly cli : CodeQLCliServer ) {
12031208 /**/
12041209 }
@@ -1250,4 +1255,8 @@ export class CliVersionConstraint {
12501255 async supportsOldEvalStats ( ) {
12511256 return this . isVersionAtLeast ( CliVersionConstraint . CLI_VERSION_WITH_OLD_EVAL_STATS ) ;
12521257 }
1258+
1259+ async supportsPackaging ( ) {
1260+ return this . isVersionAtLeast ( CliVersionConstraint . CLI_VERSION_WITH_PACKAGING ) ;
1261+ }
12531262}
Original file line number Diff line number Diff line change 1- import { CodeQLCliServer } from './cli' ;
1+ import { CliVersionConstraint , CodeQLCliServer } from './cli' ;
22import {
33 getOnDiskWorkspaceFolders ,
44 showAndLogErrorMessage ,
@@ -30,6 +30,10 @@ export async function handleDownloadPacks(
3030 cliServer : CodeQLCliServer ,
3131 progress : ProgressCallback ,
3232) : Promise < void > {
33+ if ( ! ( await cliServer . cliConstraints . supportsPackaging ( ) ) ) {
34+ throw new Error ( `Packaging commands are not supported by this version of CodeQL. Please upgrade to v${ CliVersionConstraint . CLI_VERSION_WITH_PACKAGING
35+ } or later.`) ;
36+ }
3337 progress ( {
3438 message : 'Choose packs to download' ,
3539 step : 1 ,
@@ -87,6 +91,10 @@ export async function handleInstallPacks(
8791 cliServer : CodeQLCliServer ,
8892 progress : ProgressCallback ,
8993) : Promise < void > {
94+ if ( ! ( await cliServer . cliConstraints . supportsPackaging ( ) ) ) {
95+ throw new Error ( `Packaging commands are not supported by this version of CodeQL. Please upgrade to v${ CliVersionConstraint . CLI_VERSION_WITH_PACKAGING
96+ } or later.`) ;
97+ }
9098 progress ( {
9199 message : 'Choose packs to install' ,
92100 step : 1 ,
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import * as path from 'path';
55
66import * as pq from 'proxyquire' ;
77
8- import { CodeQLCliServer } from '../../cli' ;
8+ import { CliVersionConstraint , CodeQLCliServer } from '../../cli' ;
99import { CodeQLExtensionInterface } from '../../extension' ;
1010import { expect } from 'chai' ;
1111
@@ -40,7 +40,11 @@ describe('Packaging commands', function() {
4040 'Extension not initialized. Make sure cli is downloaded and installed properly.'
4141 ) ;
4242 }
43-
43+ if ( ! ( await cli . cliConstraints . supportsPackaging ( ) ) ) {
44+ console . log ( `Packaging commands are not supported on CodeQL CLI v${ CliVersionConstraint . CLI_VERSION_WITH_PACKAGING
45+ } . Skipping this test.`) ;
46+ this . skip ( ) ;
47+ }
4448 progress = sandbox . spy ( ) ;
4549 quickPickSpy = sandbox . stub ( window , 'showQuickPick' ) ;
4650 inputBoxSpy = sandbox . stub ( window , 'showInputBox' ) ;
You can’t perform that action at this time.
0 commit comments