Skip to content

Commit aba993e

Browse files
committed
Remove packDownload()
1 parent c7dd894 commit aba993e

File tree

3 files changed

+1
-97
lines changed

3 files changed

+1
-97
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
setCodeQL({
4646
databaseRunQueries: async () => {},
47-
packDownload: async () => ({ packs: [] }),
4847
databaseInterpretResults: async (
4948
_db: string,
5049
_queriesRun: string[],

src/codeql.ts

Lines changed: 0 additions & 72 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
* Run 'codeql database cleanup'.
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
* Can be overridden in tests using `setCodeQL`.
@@ -468,7 +449,6 @@ export function setCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
468449
partialCodeql,
469450
"resolveBuildEnvironment",
470451
),
471-
packDownload: resolveFunction(partialCodeql, "packDownload"),
472452
databaseCleanup: resolveFunction(partialCodeql, "databaseCleanup"),
473453
databaseBundle: resolveFunction(partialCodeql, "databaseBundle"),
474454
databaseRunQueries: resolveFunction(partialCodeql, "databaseRunQueries"),
@@ -891,58 +871,6 @@ export async function getCodeQLForCmd(
891871
return await runCli(cmd, codeqlArgs);
892872
},
893873

894-
/**
895-
* Download specified packs into the package cache. If the specified
896-
* package and version already exists (e.g., from a previous analysis run),
897-
* then it is not downloaded again (unless the extra option `--force` is
898-
* specified).
899-
*
900-
* If no version is specified, then the latest version is
901-
* downloaded. The check to determine what the latest version is is done
902-
* each time this package is requested.
903-
*
904-
* Optionally, a `qlconfigFile` is included. If used, then this file
905-
* is used to determine which registry each pack is downloaded from.
906-
*/
907-
async packDownload(
908-
packs: string[],
909-
qlconfigFile: string | undefined,
910-
): Promise<PackDownloadOutput> {
911-
const qlconfigArg = qlconfigFile
912-
? [`--qlconfig-file=${qlconfigFile}`]
913-
: ([] as string[]);
914-
915-
const codeqlArgs = [
916-
"pack",
917-
"download",
918-
...qlconfigArg,
919-
"--format=json",
920-
"--resolve-query-specs",
921-
...getExtraOptionsFromEnv(["pack", "download"]),
922-
...packs,
923-
];
924-
925-
const output = await runCli(cmd, codeqlArgs);
926-
927-
try {
928-
const parsedOutput: PackDownloadOutput = JSON.parse(output);
929-
if (
930-
Array.isArray(parsedOutput.packs) &&
931-
// TODO PackDownloadOutput will not include the version if it is not specified
932-
// in the input. The version is always the latest version available.
933-
// It should be added to the output, but this requires a CLI change
934-
parsedOutput.packs.every((p) => p.name /* && p.version */)
935-
) {
936-
return parsedOutput;
937-
} else {
938-
throw new Error("Unexpected output from pack download");
939-
}
940-
} catch (e) {
941-
throw new Error(
942-
`Attempted to download specified packs but got an error:\n${output}\n${e}`,
943-
);
944-
}
945-
},
946874
async databaseCleanup(
947875
databasePath: string,
948876
cleanupLevel: string,

src/config-utils.test.ts

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +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 {
13-
CodeQL,
14-
getCachedCodeQL,
15-
PackDownloadOutput,
16-
setCodeQL,
17-
} from "./codeql";
12+
import { CodeQL, getCachedCodeQL, setCodeQL } from "./codeql";
1813
import * as configUtils from "./config-utils";
1914
import { Feature } from "./feature-flags";
2015
import * as gitUtils from "./git-utils";
@@ -139,9 +134,6 @@ test("load empty config", async (t) => {
139134
},
140135
};
141136
},
142-
async packDownload(): Promise<PackDownloadOutput> {
143-
return { packs: [] };
144-
},
145137
});
146138

147139
const config = await configUtils.initConfig(
@@ -181,9 +173,6 @@ test("loading config saves config", async (t) => {
181173
},
182174
};
183175
},
184-
async packDownload(): Promise<PackDownloadOutput> {
185-
return { packs: [] };
186-
},
187176
});
188177

189178
// Sanity check the saved config file does not already exist
@@ -309,9 +298,6 @@ test("load non-empty input", async (t) => {
309298
},
310299
};
311300
},
312-
async packDownload(): Promise<PackDownloadOutput> {
313-
return { packs: [] };
314-
},
315301
});
316302

317303
// Just create a generic config object with non-default values for all fields
@@ -406,9 +392,6 @@ test("Using config input and file together, config input should be used.", async
406392
},
407393
};
408394
},
409-
async packDownload(): Promise<PackDownloadOutput> {
410-
return { packs: [] };
411-
},
412395
});
413396

414397
// Only JS, python packs will be ignored
@@ -439,9 +422,6 @@ test("API client used when reading remote config", async (t) => {
439422
},
440423
};
441424
},
442-
async packDownload(): Promise<PackDownloadOutput> {
443-
return { packs: [] };
444-
},
445425
});
446426

447427
const inputFileContents = `
@@ -543,9 +523,6 @@ test("No detected languages", async (t) => {
543523
async resolveLanguages() {
544524
return {};
545525
},
546-
async packDownload(): Promise<PackDownloadOutput> {
547-
return { packs: [] };
548-
},
549526
});
550527

551528
try {

0 commit comments

Comments
 (0)