Skip to content
Open
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
41 changes: 20 additions & 21 deletions lib/entry-points.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/analyze-action-post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function runWrapper() {
logger,
);
if (config !== undefined) {
const codeql = await getCodeQL(config.codeQLCmd);
const codeql = await getCodeQL(logger, config.codeQLCmd);
const version = await codeql.getVersion();
await debugArtifacts.uploadCombinedSarifArtifacts(
logger,
Expand Down
2 changes: 1 addition & 1 deletion src/analyze-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ async function run({ startedAt, logger }: ActionState<["Base", "Logger"]>) {
);
}

const codeql = await getCodeQL(config.codeQLCmd);
const codeql = await getCodeQL(logger, config.codeQLCmd);

if (hasBadExpectErrorInput()) {
throw new util.ConfigurationError(
Expand Down
2 changes: 1 addition & 1 deletion src/autobuild-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async function run({ startedAt, logger }: ActionState<["Base", "Logger"]>) {
);
}

const codeql = await getCodeQL(config.codeQLCmd);
const codeql = await getCodeQL(logger, config.codeQLCmd);

languages = await determineAutobuildLanguages(codeql, config, logger);
if (languages !== undefined) {
Expand Down
2 changes: 1 addition & 1 deletion src/autobuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export async function runAutobuild(
logger: Logger,
) {
logger.startGroup(`Attempting to automatically build ${language} code`);
const codeQL = await getCodeQL(config.codeQLCmd);
const codeQL = await getCodeQL(logger, config.codeQLCmd);
if (language === BuiltInLanguage.cpp) {
await setupCppAutobuild(codeQL, logger);
}
Expand Down
4 changes: 0 additions & 4 deletions src/codeql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,6 @@ const injectedConfigMacro = makeMacro({
"",
undefined,
undefined,
getRunnerLogger(true),
);

const args = runnerConstructorStub.firstCall.args[1] as string[];
Expand Down Expand Up @@ -856,7 +855,6 @@ test.serial(
"",
undefined,
"/path/to/qlconfig.yml",
getRunnerLogger(true),
);

const args = runnerConstructorStub.firstCall.args[1] as string[];
Expand Down Expand Up @@ -887,7 +885,6 @@ test.serial(
"",
undefined,
undefined, // undefined qlconfigFile
getRunnerLogger(true),
);

const args = runnerConstructorStub.firstCall.args[1] as any[];
Expand Down Expand Up @@ -1066,7 +1063,6 @@ test.serial(
"sourceRoot",
undefined,
undefined,
getRunnerLogger(false),
);

t.true(runnerConstructorStub.calledOnce);
Expand Down
14 changes: 7 additions & 7 deletions src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
} from "./feature-flags";
import { isAnalyzingDefaultBranch } from "./git-utils";
import { Language } from "./languages";
import { Logger } from "./logging";
import { getRunnerLogger, Logger } from "./logging";
import { writeBaseDatabaseOidsFile, writeOverlayChangesFile } from "./overlay";
import { OverlayDatabaseMode } from "./overlay/overlay-database-mode";
import * as setupCodeql from "./setup-codeql";
Expand Down Expand Up @@ -91,7 +91,6 @@ export interface CodeQL {
sourceRoot: string,
processName: string | undefined,
qlconfigFile: string | undefined,
logger: Logger,
): Promise<void>;
/**
* Runs the autobuilder for the given language.
Expand Down Expand Up @@ -346,7 +345,7 @@ export async function setupCodeQL(
);
}

cachedCodeQL = await getCodeQLForCmd(codeqlCmd, checkVersion);
cachedCodeQL = await getCodeQLForCmd(logger, codeqlCmd, checkVersion);
return {
codeql: cachedCodeQL,
toolsDownloadStatusReport,
Expand All @@ -372,9 +371,9 @@ export async function setupCodeQL(
/**
* Use the CodeQL executable located at the given path.
*/
export async function getCodeQL(cmd: string): Promise<CodeQL> {
export async function getCodeQL(logger: Logger, cmd: string): Promise<CodeQL> {
if (cachedCodeQL === undefined) {
cachedCodeQL = await getCodeQLForCmd(cmd, true);
cachedCodeQL = await getCodeQLForCmd(logger, cmd, true);
}
return cachedCodeQL;
}
Expand Down Expand Up @@ -481,8 +480,9 @@ export function createStubCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
*/
export async function getCodeQLForTesting(
cmd = "codeql-for-testing",
logger: Logger = getRunnerLogger(true),
): Promise<CodeQL> {
return getCodeQLForCmd(cmd, false);
return getCodeQLForCmd(logger, cmd, false);
}

/**
Expand All @@ -494,6 +494,7 @@ export async function getCodeQLForTesting(
* @returns A new CodeQL object
*/
async function getCodeQLForCmd(
logger: Logger,
cmd: string,
checkVersion: boolean,
): Promise<CodeQL> {
Expand Down Expand Up @@ -539,7 +540,6 @@ async function getCodeQLForCmd(
sourceRoot: string,
processName: string | undefined,
qlconfigFile: string | undefined,
logger: Logger,
) {
Comment thread
mbg marked this conversation as resolved.
const extraArgs = config.languages.map(
(language) => `--language=${language}`,
Expand Down
5 changes: 4 additions & 1 deletion src/init-action-post-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ async function prepareFailedSarif(
const category = `/language:${language}`;
const checkoutPath = ".";
const result = await generateFailedSarif(
logger,
features,
config,
category,
Expand All @@ -146,6 +147,7 @@ async function prepareFailedSarif(
const checkoutPath = getCheckoutPathInputOrThrow(workflow, jobName, matrix);

const result = await generateFailedSarif(
logger,
features,
config,
category,
Expand All @@ -156,14 +158,15 @@ async function prepareFailedSarif(
}

async function generateFailedSarif(
logger: Logger,
features: FeatureEnablement,
config: Config,
category: string | undefined,
checkoutPath: string,
sarifFile?: string,
) {
const databasePath = config.dbLocation;
const codeql = await getCodeQL(config.codeQLCmd);
const codeql = await getCodeQL(logger, config.codeQLCmd);

// Set the filename for the SARIF file if not already set.
if (sarifFile === undefined) {
Expand Down
2 changes: 1 addition & 1 deletion src/init-action-post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async function run(startedAt: Date) {
"Debugging artifacts are unavailable since the 'init' Action failed before it could produce any.",
);
} else {
const codeql = await getCodeQL(config.codeQLCmd);
const codeql = await getCodeQL(logger, config.codeQLCmd);

uploadFailedSarifResult = await initActionPostHelper.uploadFailureInfo(
debugArtifacts.tryUploadAllAvailableDebugArtifacts,
Expand Down
2 changes: 0 additions & 2 deletions src/init-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,6 @@ async function run(
sourceRoot,
"Runner.Worker.exe",
qlconfigFile,
logger,
);

// To check custom query packs for compatibility with overlay analysis, we
Expand Down Expand Up @@ -718,7 +717,6 @@ async function run(
sourceRoot,
"Runner.Worker.exe",
qlconfigFile,
logger,
);
}

Expand Down
2 changes: 0 additions & 2 deletions src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export async function runDatabaseInitCluster(
sourceRoot: string,
processName: string | undefined,
qlconfigFile: string | undefined,
logger: Logger,
): Promise<void> {
fs.mkdirSync(config.dbLocation, { recursive: true });
await configUtils.wrapEnvironment(
Expand All @@ -100,7 +99,6 @@ export async function runDatabaseInitCluster(
sourceRoot,
processName,
qlconfigFile,
logger,
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/resolve-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function runResolveBuildEnvironment(
) {
logger.startGroup(`Attempting to resolve build environment for ${language}`);

const codeql = await getCodeQL(cmd);
const codeql = await getCodeQL(logger, cmd);

if (workingDir !== undefined) {
logger.info(`Using ${workingDir} as the working directory.`);
Expand Down
2 changes: 1 addition & 1 deletion src/upload-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ async function combineSarifFilesUsingCLI(

const config = await getConfig(tempDir, logger);
if (config !== undefined) {
codeQL = await getCodeQL(config.codeQLCmd);
codeQL = await getCodeQL(logger, config.codeQLCmd);
tempDir = config.tempDir;
} else {
logger.info(
Expand Down
Loading