-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add uiVersion API #143
base: master
Are you sure you want to change the base?
Add uiVersion API #143
Conversation
Thanks. I downloaded the shared library for Linux from GitHub Actions and tried it. There was a little strange behavior. #include <stdio.h>
#include "./ui.h"
int main(void){
const char *version = uiVersion();
printf("%s\n", version);
return 0;
} The output is I think this may not be the expected behavior. If so, I would like to fix it... |
4251607 is here. |
Wow, good find .. I don't understand why the GitHub Actions CI runner would insert its own custom git tag into the build!?
Yes it should be fine once merged into master, but still this is very strange behavior. Merits further investigation. |
I like the option of getting the current commit hash for displaying debugging information. Apart from that I see limited usefulness for developers, as this is runtime and the hash is not incremental. Being able to probe for minimum API version would be more useful to me. I outlined how other popular libraries do this in the ticket. I do see the usefulness of getting the hash though, maybe it would make sense to have both? Compile time constants with version number (once the first release is tagged, we would probably want do increment these manually directly in the header) and a |
I prefer a simpler approach. For example, "5.0.0-f77fae9a" |
As much as I'd like to keep this API very simple .. after thinking about it some more, the design requirements here are actually somewhat complex. Our version info API needs to support all these scenarios:
|
Hi, I have an idea about the versioning API. You can try this to see how it will work in
Then, we can define constants like this.
I think we don't need semantic version when the library have no tags in 5 years. |
I made a commit for the calendar versioning (matyalatte@291a474). Before running // config.h
#define UI_VERSION "2022.09.29.f77fae9a"
#define UI_VERSION_YEAR 2022
#define UI_VERSION_MONTH 9
#define UI_VERSION_DAY 29
#define UI_VERSION_HASH 0xf77fae9a After the commit // config.h
#define UI_VERSION "2023.09.24.291a4740"
#define UI_VERSION_YEAR 2023
#define UI_VERSION_MONTH 9
#define UI_VERSION_DAY 24
#define UI_VERSION_HASH 0x291a4740 |
I haven't tested it yet, but I found this. |
While I'm not against adding calendar versioning as well, my original list of requirements would need to be added first. |
What does "Runtime and compile-time" mean? At least, the calendar versioning can meets the rest of your list, I think. |
Correct. See the requirements I posted here. What is missing here would possibly be something like Runtime would essentially just be I would personally voice my opinion against date versioning. I see little benefit for a library in doing so and it complicates things immensely. Dates give zero context on what the API provides. Will I face breaking changes when upgrading to a newer version? Semver solves this problem elegantly. I see a lot of benefit in including the git hash for git based builds to identify possible bugs. For any API related stability questions @cody271 regarding your PR/proposal in particular: what about packaged releases? This code will not give any meaningful version number if the git tree is not present. I know we are not distributing packages yet but to me it seems that distributing snapshots would be a major point for introducing version numbers? Having though about this some more: We most likely need to separate git versioning and point release versioning entirely. Every new commit would otherwise need to incease the |
So, you mean we should generate a hash when compiling, not only the commit hash?
Well, to be honest, I also prefer the manual semver.
It'll get the last commit date via git. But it's just a suggession. |
I think we can increment the patch number with PRs, not for each commit. I made a repo as an example for the semver automation. It can update version info when a PR is merged like this. |
No, I actually meant something like
Fair point. I understand your reasoning for calver now. I would personally hope that through the introductions of semver we would actually start tagging releases. All the current tags are still from
We would need to test what it does for rebased commits or merges from commits with a commit date in the past.
I don't believe we can actually automate any of this. Some commit will want to increase the patch number, new features would however require an increase in minor number (and breaking ones major, at least once we reach 1.0.0). Another thing to keep in mind are multiple build systems. See the |
You can use PR labels to set which number should be incremented like this.
You can get merged commits, PR titiles, comments, etc. from the merged PR.
Right. We have to add another commit if we do that things. Or using the merged date might be better? // ui_version.h
#define UI_VERSION "${merged_date}.${git_hash}"
#define UI_VERSION_YEAR ${merged_year}
#define UI_VERSION_MONTH ${merged_month}
#define UI_VERSION_DAY ${merged_day}
#define UI_VERSION_NUMBER ${merged_date}
#define UI_GIT_HASH "${git_hash}" Then, we can use it with any build systems, and no need git for building. |
So in the last example, people would check against the constant For instance, in ruby, while it is no standard at all, often the version
And perhaps if one refers to kojix2' bindings then it may be:
Perhaps I should also explain a bit why it is important for downstream https://github.com/libui-ng/libui-ng/blob/master/CHANGELOG.md However had, when I update my own add-on code for libui-stuff, a) libui-ng repository here, logically, but more importantly And then I am also a bit slow sometimes, so I may be inactive This is why I think being able to pinpoint towards specific libui-ng |
Fixes #141