fix: Check hotfix before checking stage weight

This commit is contained in:
Ahmad Ansori Palembani 2024-07-30 10:31:01 +07:00
parent bc51e60bb3
commit bf7ece49d9
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -24,10 +24,10 @@ data class Version(
var rt = (major.compareTo(other.major) +
minor.compareTo(other.minor) +
patch.compareTo(other.patch)).compareTo(0)
// if semver is equal, check version stage (release (3) > beta (2) > alpha (1))
if (rt == 0) rt = stage.weight.compareTo(other.stage.weight)
// check if it's a hotfix (1.2.3 vs 1.2.3.1)
if (rt == 0) rt = hotfix.compareTo(other.hotfix)
// if semver is equal, check version stage (release (3) > beta (2) > alpha (1))
if (rt == 0) rt = stage.weight.compareTo(other.stage.weight)
// if everything are equal, we compare build number. This only matters on unstable (beta and nightly) releases
if (rt == 0) rt = build.compareTo(other.build)