Skip to content

Commit 649f3e8

Browse files
committed
Bump verbosity when running autobuild script directly in debug mode
1 parent 362c407 commit 649f3e8

File tree

9 files changed

+30
-8
lines changed

9 files changed

+30
-8
lines changed

lib/autobuild.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/autobuild.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/environment.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/environment.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/autobuild.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export async function runAutobuild(
162162
if (language === Language.cpp) {
163163
await setupCppAutobuild(codeQL, logger);
164164
}
165-
await codeQL.runAutobuild(language);
165+
await codeQL.runAutobuild(language, config.debugMode);
166166
if (language === Language.go) {
167167
core.exportVariable(EnvVar.DID_AUTOBUILD_GOLANG, "true");
168168
}

src/codeql.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export interface CodeQL {
8282
/**
8383
* Runs the autobuilder for the given language.
8484
*/
85-
runAutobuild(language: Language): Promise<void>;
85+
runAutobuild(language: Language, enableDebugLogging: boolean): Promise<void>;
8686
/**
8787
* Extract code for a scanned language using 'codeql database trace-command'
8888
* and running the language extractor.
@@ -637,7 +637,7 @@ export async function getCodeQLForCmd(
637637
throw e;
638638
}
639639
},
640-
async runAutobuild(language: Language) {
640+
async runAutobuild(language: Language, enableDebugLogging: boolean) {
641641
const autobuildCmd = path.join(
642642
await this.resolveExtractor(language),
643643
"tools",
@@ -656,6 +656,12 @@ export async function getCodeQLForCmd(
656656
"-Dmaven.wagon.http.pool=false",
657657
].join(" ");
658658

659+
// Bump the verbosity of the autobuild command if we're in debug mode
660+
if (enableDebugLogging) {
661+
process.env[EnvVar.CLI_VERBOSITY] =
662+
process.env[EnvVar.CLI_VERBOSITY] || EXTRACTION_DEBUG_MODE_VERBOSITY;
663+
}
664+
659665
// On macOS, System Integrity Protection (SIP) typically interferes with
660666
// CodeQL build tracing of protected binaries.
661667
// The usual workaround is to prefix `$CODEQL_RUNNER` to build commands:

src/environment.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ export enum EnvVar {
1111
/** Whether the `autobuild` Action completes successfully. */
1212
AUTOBUILD_DID_COMPLETE_SUCCESSFULLY = "CODEQL_ACTION_AUTOBUILD_DID_COMPLETE_SUCCESSFULLY",
1313

14+
/**
15+
* The verbosity level of the CLI. One of the following: `errors`, `warnings`, `progress`,
16+
* `progress+`, `progress++`, `progress+++`.
17+
*/
18+
CLI_VERBOSITY = "CODEQL_VERBOSITY",
19+
1420
/** Whether the CodeQL Action has invoked the Go autobuilder. */
1521
DID_AUTOBUILD_GOLANG = "CODEQL_ACTION_DID_AUTOBUILD_GOLANG",
1622

0 commit comments

Comments
 (0)