-
Notifications
You must be signed in to change notification settings - Fork 7
Fix local build error when no BUILD_NUMBER_CACHE exist #9
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
Conversation
Summary of ChangesHello @kota-yata, I'm Gemini Code Assist1! 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 addresses a critical local build failure encountered when a project is built for the very first time and no build number cache exists. Previously, this scenario would lead to a CMake error due to an undefined build number. The change ensures that in the absence of an existing build number cache, the Highlights
Using Gemini Code AssistThe 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
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 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 👍 and 👎 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. Footnotes
|
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.
Code Review
This pull request correctly fixes a build error that occurs on the first local build when the build number cache file doesn't exist. The change ensures a default build number of '1' is set in this scenario, preventing the set_target_properties error. I've included one suggestion to refactor the logic slightly to improve maintainability by removing some code duplication that was introduced.
| else() | ||
| # Local builds without an existing cache default to 1 | ||
| set(PLUGIN_BUILD_NUMBER "1") |
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.
While this change correctly fixes the bug for local builds, it introduces some code duplication. The line set(PLUGIN_BUILD_NUMBER "1") now appears in two places (here and on line 25).
To improve maintainability and reduce redundancy, you could refactor the logic to set the default value first and then override it if specific CI environment variables are present.
Consider refactoring the if("$ENV{CI}") block (lines 19-30) to something like this:
# Default to 1 for local builds or CI without a specific run ID
set(PLUGIN_BUILD_NUMBER "1")
if("$ENV{CI}")
if("$ENV{GITHUB_RUN_ID}")
set(PLUGIN_BUILD_NUMBER "$ENV{GITHUB_RUN_ID}")
elseif("$ENV{GITLAB_RUN_ID}")
set(PLUGIN_BUILD_NUMBER "$ENV{GITLAB_RUN_ID}")
endif()
endif()This makes the logic clearer by establishing a default and then handling the exceptional cases.
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 change wouldn't make the code more readable nor clearer, so I'm going to keep the current one
|
I'm not sure why this is needed, but yolo seems harmless. |
At the very first build, neither PLUGIN_BUILD_NUMBER nor _BUILD_NUMBER_CACHE exist, resulting following error on build:
This PR sets 1 to the build number in that situation.
Environment: MacOS 15.6.1