Skip to content

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

Merged
merged 3 commits into from
Oct 25, 2024
Merged
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
12 changes: 3 additions & 9 deletions lib/feature-flags.js

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

2 changes: 1 addition & 1 deletion lib/feature-flags.js.map

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions lib/init-action.js

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

2 changes: 1 addition & 1 deletion lib/init-action.js.map

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions src/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ export interface FeatureEnablement {
export enum Feature {
ArtifactV4Upgrade = "artifact_v4_upgrade",
CleanupTrapCaches = "cleanup_trap_caches",
CppBuildModeNoneDisabled = "cpp_build_mode_none_disabled",
CppBuildModeNoneEnabled = "cpp_build_mode_none",
CppBuildModeNone = "cpp_build_mode_none",
CppDependencyInstallation = "cpp_dependency_installation_enabled",
DiffInformedQueries = "diff_informed_queries",
DisableCsharpBuildless = "disable_csharp_buildless",
Expand Down Expand Up @@ -105,14 +104,9 @@ export const featureConfig: Record<
envVar: "CODEQL_ACTION_CLEANUP_TRAP_CACHES",
minimumVersion: undefined,
},
[Feature.CppBuildModeNoneDisabled]: {
[Feature.CppBuildModeNone]: {
defaultValue: false,
envVar: "CODEQL_EXTRACTOR_CPP_BUILD_MODE_NONE_DISABLED",
minimumVersion: undefined,
},
[Feature.CppBuildModeNoneEnabled]: {
defaultValue: false,
envVar: "CODEQL_EXTRACTOR_CPP_BUILD_MODE_NONE_ENABLED",
envVar: "CODEQL_EXTRACTOR_CPP_BUILD_MODE_NONE",
minimumVersion: undefined,
},
[Feature.CppDependencyInstallation]: {
Expand Down
10 changes: 10 additions & 0 deletions src/init-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,16 @@ async function run() {
}
}

// Set CODEQL_EXTRACTOR_CPP_BUILD_MODE_NONE
if (config.languages.includes(Language.cpp)) {
const bmnVar = "CODEQL_EXTRACTOR_CPP_BUILD_MODE_NONE";
Comment on lines +549 to +551
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think we might want users to interact with this option, we should make this an extractor option by changing the name to CODEQL_EXTRACTOR_CPP_OPTION_BUILD_MODE_NONE and including an entry in codeql-extractor.yml. That gives customers more options for configuring it. If this is only going to be used by the Action, then we can leave it as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is internal and short-lived, so I don't think we should give customers the option of configuring it.

const value =
process.env[bmnVar] ||
(await features.getValue(Feature.CppBuildModeNone, codeql));
logger.info(`Setting C++ build-mode: none to ${value}`);
core.exportVariable(bmnVar, value);
}

// For CLI versions <2.15.1, build tracing caused errors in MacOS ARM machines with
// System Integrity Protection (SIP) disabled.
if (
Expand Down
Loading