-
Notifications
You must be signed in to change notification settings - Fork 380
C++: Handle codeql_action_cpp_build_mode_none feature flag #2568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -546,6 +546,20 @@ async function run() { | |
} | ||
} | ||
|
||
// Set CODEQL_EXTRACTOR_CPP_BUILD_MODE_NONE | ||
if (config.languages.includes(Language.cpp)) { | ||
const bmn_var = "CODEQL_EXTRACTOR_CPP_BUILD_MODE_NONE"; | ||
if (process.env[bmn_var]) { | ||
logger.info("CODEQL_EXTRACTOR_CPP_BUILD_MODE_NONE is already set"); | ||
} else if (await features.getValue(Feature.CppBuildModeNone, codeql)) { | ||
logger.info("Enabling C++ build-mode: none"); | ||
core.exportVariable(bmn_var, "true"); | ||
} else { | ||
logger.info("Disabling C++ build-mode: none"); | ||
core.exportVariable(bmn_var, "false"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume the reason why you are doing this is because the extractor requires this same env var to be set? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not required, just setting it for completeness. |
||
} | ||
} | ||
|
||
// For CLI versions <2.15.1, build tracing caused errors in MacOS ARM machines with | ||
// System Integrity Protection (SIP) disabled. | ||
if ( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably a linter error. Here's a more canonical name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this simpler?
features.getValue
is guaranteed to return a boolean and if the env var is already set, it will use that as an override.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That didn't quite compile, but I managed to simplify things. The code in init-action.ts is not written in this idiomatic way, and the docs to
exportVariable()
don't mention the behaviour when the variable is already set. Most of the code ininit-action.ts
defensively checks the environment.I would suggest refactoring this file as most people will just adapt code that's already there.