FabricMC / fabric-loader

Fabric's mostly-version-independent mod loader.
Apache License 2.0
617 stars 262 forks source link

Add Git commit hash version comparing #954

Closed xpple closed 2 months ago

xpple commented 2 months ago

This PR proposes the addition of a new method to compare version strings that are commit hashes. It is very common for snapshot releases to set their version to the commit hash. Before they were not comparable, and would just use String#compare instead, which is completely arbitrary.

The comparison is done by extracting the commit metadata from GitHub's API. For this it must be the case that a sources entry is present in the contact object of the fabric.mod.json, and that it is set before the JSON reader reaches the version entry. Mod developers would have to be made aware of this. Note that due to the nature of this comparison, it will not be available when not connected to the internet.

xpple commented 2 months ago

I think I have garnered enough downvotes to close the PR 🤣. Though, I am under the sincere impression this could be very useful for when the loader has to decide which version of a library included by multiple mods it should use. In that case there would be no risk of any problems due to internet unavailability, as it would just defaults back to string comparison as it used to.