fix(cmake): do not disable feature if option `GOOGLE_CLOUD_CPP_ENABLE_*` does not exist
GOOGLE_CLOUD_CPP_ENABLE features which do not have a corresponding GOOGLE_CPP_CPP_ENABLE_<name> feature are getting filtered out wrongfully.
Indeed, google_cloud_cpp_enable_cleanup will disable a feature when NOT "${${feature_flag}}".
This statement will be true in two cases:
- When
GOOGLE_CPP_CPP_ENABLE_<name>is explicitly disabled (which is the intended behavior) - When
GOOGLE_CPP_CPP_ENABLE_<name>does not exist (unintended)
Indeed, this leads to universe_domain being filtered out as GOOGLE_CPP_CPP_ENABLE_UNIVERSE_DOMAIN was not declared in google_cloud_cpp_define_legacy_feature_options.
This PR fixes the google_cloud_cpp_enable_cleanup behavior by disabling a feature when both DEFINED "${${feature_flag}}" and NOT "${${feature_flag}}".
Another alternative would be to declare GOOGLE_CPP_CPP_ENABLE_UNIVERSE_DOMAIN, but I understood that these options were "legacy" and that their usage is discouraged.
Summary of Changes
Hello @GaetanLepage, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request resolves a bug in the CMake build system's feature management, specifically within the google_cloud_cpp_enable_cleanup macro. Previously, features were unintentionally disabled if their dedicated GOOGLE_CLOUD_CPP_ENABLE_* option was not defined, rather than only when explicitly set to false. The change introduces a DEFINED check, ensuring that features are now correctly enabled by default unless explicitly opted out, thereby preventing erroneous feature removals like the one observed with universe_domain.
Highlights
-
Incorrect Feature Disabling: The
google_cloud_cpp_enable_cleanupmacro was incorrectly disabling features when their correspondingGOOGLE_CLOUD_CPP_ENABLE_*CMake option was undefined, rather than explicitly set to false. -
Impact on 'universe_domain': This bug specifically led to features like
universe_domainbeing filtered out becauseGOOGLE_CLOUD_CPP_ENABLE_UNIVERSE_DOMAINwas not declared, causing unintended behavior. -
Conditional Logic Fix: The fix introduces a
DEFINEDcheck within the macro's conditional logic, ensuring that a feature is only disabled if its enable flag is both explicitly defined and set to a false value.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.
/gcbrun
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 92.94%. Comparing base (826dd38) to head (d482482).
:warning: Report is 6 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #15820 +/- ##
==========================================
- Coverage 92.95% 92.94% -0.01%
==========================================
Files 2458 2458
Lines 227589 227589
==========================================
- Hits 211547 211537 -10
- Misses 16042 16052 +10
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.