-
Notifications
You must be signed in to change notification settings - Fork 544
Handle Missing Tags in Versioning by Setting Default to 0 #3359
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
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.
Looks good to me but I'll hold off on merging in case @pshriwise or @MicahGale have any feedback.
if(VERSION_STRING STREQUAL "") | ||
message(FATAL_ERROR "No git tags found. Run 'git fetch --tags' and try again.") | ||
set(VERSION_STRING "0.0.0") | ||
message(WARNING "No git tags found. Version set to 0. Run 'git fetch --tags' to ensure proper versioning.") |
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.
There's more to it than just fetching for forks. One must add the upstream remove (this repo) and fetch tags from there. If the tags aren't in their forked repo this won't help sadly.
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.
Yeah I think maybe drop the "here's how to fix it" bit, because it's a bit too nuanced for cmake
. I think the bigger thing is having a guide in the developer docs.
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.
I think more detail in the dev guide, yes. The warning here can provide direction to that section ideally.
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.
I think updating developer docs should be part of this PR, unless this needs to be deployed asap.
I have created a new section in the doc for this since it is optional. However, we can update the documentation if needed. |
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.
The docs look good and really help with "minimizing astonishment"
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.
LGTM (GH didn't include comment in last review???)
Co-authored-by: Micah Gale <[email protected]>
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.
Teeny tiny clarification and then I'm happy. Thanks @ahnaf-tahmid-chowdhury!
Co-authored-by: Patrick Shriwise <[email protected]>
It seems the workflow run was canceled. Is there anything else to update @pshriwise? |
…#3359) Co-authored-by: Micah Gale <[email protected]> Co-authored-by: Patrick Shriwise <[email protected]>
…#3359) Co-authored-by: Micah Gale <[email protected]> Co-authored-by: Patrick Shriwise <[email protected]>
…#3359) Co-authored-by: Micah Gale <[email protected]> Co-authored-by: Patrick Shriwise <[email protected]>
Problem
When forking and cloning OpenMC, all tags are not always present in the resulting clone. This causes issues with CMake's git-based versioning pathway:
Failure case: If
git
is available but no tags exist, version detection fails.Incorrect versioning: The git SHA is correct, but the displayed version is incorrect.
Solution
Updated
GetVersionFromGit.cmake
to follow thesetuptools_scm
convention.If no git tags are found, the version defaults to
0.0.0
instead of failing.A warning message is displayed, instructing users to run
git fetch --tags
.Notes
Users who wish to fetch tags can do so manually:
Ready for Review
Tagging @pshriwise and @MicahGale for feedback.