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
Make zig version
compliant with SemVer
#1113
Conversation
The git revision is build metadata and should be appended with a plus sign. https://semver.org/#spec-item-10
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. CI failure is infrastructural (llvm download failed.)
Reading the entire spec, I think what we really want is status quo, except bump the release number directly after a release. https://semver.org/#spec-item-9 So here's the plan:
|
Pre-release identifiers (stuff that goes after a dash) are used for version ordering. Using commit hash in that section doesn't make sense. It would be better to do something like |
You're right. My mistake. I thought about this some more, and builds from source that are not official release tags are not intended to follow semver. They cannot be meaningfully semver-compared with actual releases. Semver is for zig releases, not for all source builds. |
FWIW, the reason I lgtm'd this is that while you're right they can't be meaningfully compared, people will try to parse the version number anyway. At least now they can do it using standard tooling. |
Alright that's fair. I hope it doesn't break the appveyor script, but let's deal with that if it happens. |
Thanks for accepting the PR. Before I saw the PR got merged, I wrote this out as a final appeal. I guess it's still worth sharing. My thoughts on the version string through the lens of zen:
Building from untagged source is an edge case.
SemVer compliance, even for untagged source builds, means that users can take any build of Zig and pass the version string to a SemVer-aware tool. They won't need to know about the possibility of a second, non-SemVer format.
SemVer facilitates precision, even when the intent is "these builds cannot be meaningfully compared". Using the same pre-release identifier (e.g. Finally, if Zig is going to mandate SemVer for its package ecosystem (my current understanding of the plan), consistent use of SemVer is a form of dog-fooding and sets a good example. |
The git revision is build metadata and should be appended with a plus sign.
https://semver.org/#spec-item-10