Skip to content

Commit ad19982

Browse files
committed
Remove packDownload()
1 parent a71ebf3 commit ad19982

File tree

3 files changed

+1
-93
lines changed

3 files changed

+1
-93
lines changed

src/analyze.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ test("status report fields", async (t) => {
4444
for (const language of Object.values(KnownLanguage)) {
4545
const codeql = createStubCodeQL({
4646
databaseRunQueries: async () => {},
47-
packDownload: async () => ({ packs: [] }),
4847
databaseInterpretResults: async (
4948
_db: string,
5049
_queriesRun: string[],

src/codeql.ts

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,6 @@ export interface CodeQL {
136136
language: string,
137137
): Promise<ResolveBuildEnvironmentOutput>;
138138

139-
/**
140-
* Run 'codeql pack download'.
141-
*/
142-
packDownload(
143-
packs: string[],
144-
qlconfigFile: string | undefined,
145-
): Promise<PackDownloadOutput>;
146-
147139
/**
148140
* Clean up all the databases within a database cluster.
149141
*/
@@ -256,17 +248,6 @@ export interface ResolveBuildEnvironmentOutput {
256248
};
257249
}
258250

259-
export interface PackDownloadOutput {
260-
packs: PackDownloadItem[];
261-
}
262-
263-
interface PackDownloadItem {
264-
name: string;
265-
version: string;
266-
packDir: string;
267-
installResult: string;
268-
}
269-
270251
/**
271252
* Stores the CodeQL object, and is populated by `setupCodeQL` or `getCodeQL`.
272253
*/
@@ -478,7 +459,6 @@ export function createStubCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
478459
partialCodeql,
479460
"resolveBuildEnvironment",
480461
),
481-
packDownload: resolveFunction(partialCodeql, "packDownload"),
482462
databaseCleanupCluster: resolveFunction(
483463
partialCodeql,
484464
"databaseCleanupCluster",
@@ -888,59 +868,6 @@ export async function getCodeQLForCmd(
888868
];
889869
return await runCli(cmd, codeqlArgs);
890870
},
891-
892-
/**
893-
* Download specified packs into the package cache. If the specified
894-
* package and version already exists (e.g., from a previous analysis run),
895-
* then it is not downloaded again (unless the extra option `--force` is
896-
* specified).
897-
*
898-
* If no version is specified, then the latest version is
899-
* downloaded. The check to determine what the latest version is is done
900-
* each time this package is requested.
901-
*
902-
* Optionally, a `qlconfigFile` is included. If used, then this file
903-
* is used to determine which registry each pack is downloaded from.
904-
*/
905-
async packDownload(
906-
packs: string[],
907-
qlconfigFile: string | undefined,
908-
): Promise<PackDownloadOutput> {
909-
const qlconfigArg = qlconfigFile
910-
? [`--qlconfig-file=${qlconfigFile}`]
911-
: ([] as string[]);
912-
913-
const codeqlArgs = [
914-
"pack",
915-
"download",
916-
...qlconfigArg,
917-
"--format=json",
918-
"--resolve-query-specs",
919-
...getExtraOptionsFromEnv(["pack", "download"]),
920-
...packs,
921-
];
922-
923-
const output = await runCli(cmd, codeqlArgs);
924-
925-
try {
926-
const parsedOutput: PackDownloadOutput = JSON.parse(output);
927-
if (
928-
Array.isArray(parsedOutput.packs) &&
929-
// TODO PackDownloadOutput will not include the version if it is not specified
930-
// in the input. The version is always the latest version available.
931-
// It should be added to the output, but this requires a CLI change
932-
parsedOutput.packs.every((p) => p.name /* && p.version */)
933-
) {
934-
return parsedOutput;
935-
} else {
936-
throw new Error("Unexpected output from pack download");
937-
}
938-
} catch (e) {
939-
throw new Error(
940-
`Attempted to download specified packs but got an error:\n${output}\n${e}`,
941-
);
942-
}
943-
},
944871
async databaseCleanupCluster(
945872
config: Config,
946873
cleanupLevel: string,

src/config-utils.test.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import * as sinon from "sinon";
99
import * as actionsUtil from "./actions-util";
1010
import * as api from "./api-client";
1111
import { CachingKind } from "./caching-utils";
12-
import { PackDownloadOutput, createStubCodeQL } from "./codeql";
12+
import { createStubCodeQL } from "./codeql";
1313
import * as configUtils from "./config-utils";
1414
import { Feature } from "./feature-flags";
1515
import * as gitUtils from "./git-utils";
@@ -143,9 +143,6 @@ test("load empty config", async (t) => {
143143
},
144144
};
145145
},
146-
async packDownload(): Promise<PackDownloadOutput> {
147-
return { packs: [] };
148-
},
149146
});
150147

151148
const config = await configUtils.initConfig(
@@ -185,9 +182,6 @@ test("loading config saves config", async (t) => {
185182
},
186183
};
187184
},
188-
async packDownload(): Promise<PackDownloadOutput> {
189-
return { packs: [] };
190-
},
191185
});
192186

193187
// Sanity check the saved config file does not already exist
@@ -310,9 +304,6 @@ test("load non-empty input", async (t) => {
310304
},
311305
};
312306
},
313-
async packDownload(): Promise<PackDownloadOutput> {
314-
return { packs: [] };
315-
},
316307
});
317308

318309
// Just create a generic config object with non-default values for all fields
@@ -407,9 +398,6 @@ test("Using config input and file together, config input should be used.", async
407398
},
408399
};
409400
},
410-
async packDownload(): Promise<PackDownloadOutput> {
411-
return { packs: [] };
412-
},
413401
});
414402

415403
// Only JS, python packs will be ignored
@@ -440,9 +428,6 @@ test("API client used when reading remote config", async (t) => {
440428
},
441429
};
442430
},
443-
async packDownload(): Promise<PackDownloadOutput> {
444-
return { packs: [] };
445-
},
446431
});
447432

448433
const inputFileContents = `
@@ -542,9 +527,6 @@ test("No detected languages", async (t) => {
542527
async resolveLanguages() {
543528
return {};
544529
},
545-
async packDownload(): Promise<PackDownloadOutput> {
546-
return { packs: [] };
547-
},
548530
});
549531

550532
try {

0 commit comments

Comments
 (0)