Skip to content

Commit 94e5bd6

Browse files
committed
Remove packDownload()
1 parent 4ac0377 commit 94e5bd6

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";
@@ -142,9 +142,6 @@ test("load empty config", async (t) => {
142142
},
143143
};
144144
},
145-
async packDownload(): Promise<PackDownloadOutput> {
146-
return { packs: [] };
147-
},
148145
});
149146

150147
const config = await configUtils.initConfig(
@@ -184,9 +181,6 @@ test("loading config saves config", async (t) => {
184181
},
185182
};
186183
},
187-
async packDownload(): Promise<PackDownloadOutput> {
188-
return { packs: [] };
189-
},
190184
});
191185

192186
// Sanity check the saved config file does not already exist
@@ -309,9 +303,6 @@ test("load non-empty input", async (t) => {
309303
},
310304
};
311305
},
312-
async packDownload(): Promise<PackDownloadOutput> {
313-
return { packs: [] };
314-
},
315306
});
316307

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

414402
// Only JS, python packs will be ignored
@@ -439,9 +427,6 @@ test("API client used when reading remote config", async (t) => {
439427
},
440428
};
441429
},
442-
async packDownload(): Promise<PackDownloadOutput> {
443-
return { packs: [] };
444-
},
445430
});
446431

447432
const inputFileContents = `
@@ -541,9 +526,6 @@ test("No detected languages", async (t) => {
541526
async resolveLanguages() {
542527
return {};
543528
},
544-
async packDownload(): Promise<PackDownloadOutput> {
545-
return { packs: [] };
546-
},
547529
});
548530

549531
try {

0 commit comments

Comments
 (0)