ziglang / www.ziglang.org

https://ziglang.org/
MIT License
281 stars 168 forks source link

Mark current stable release in download.json #357

Closed AMythicDev closed 5 months ago

AMythicDev commented 5 months ago

I am writing a version manager for Zig called zigvm and currently it can install releases from semver or master. Additionally I would also like to be able to install the latest stable release with it by saying something like zigvm install stable.

My current approach to this would be to loop over the semver and compare them till I find the greatest of them. But I find this more of a naive and slow solution. I think if the download.json can describe the current stable release by something like "stable": true or "tags": ["stable"] or maybe a separate entry like stable that would basically be an alias to the current stable release, we can avoid all the comparisons an simply check which release has the stable tag.

nektro commented 5 months ago

in practice it's always the second entry in the file

AMythicDev commented 5 months ago

That's mostly because of how zig is being released. Let's say if there's a 0.11.1, will it be at the top or right right above 0.11.0 or where? I feel there are quite a many possibilities of failure by taking this assumption.

andrewrk commented 5 months ago

you have all the data you need with semantic versioning.

AMythicDev commented 4 months ago

@andrewrk just a side question, if there's a patch release, say 0.11.1 where will it be placed in the download.json file? Will it be right under master like where 0.12.0 is right now or will be somewhere adjacent to 0.11.0?

andrewrk commented 4 months ago

JSON object keys are not ordered.

AMythicDev commented 4 months ago

Thanks, I am going with the semantic version analysis method.