refreshVersions icon indicating copy to clipboard operation
refreshVersions copied to clipboard

Older version with dash shows as newer

Open brewin opened this issue 5 years ago • 7 comments

refreshVersions incorrectly shows 'x.y-whatever' as newer than 'x.y.z'

version.com.russhwolf..multiplatform-settings-no-arg=0.6.1
##                                       # available=0.6-1.4-M1
##                                       # available=0.6-1.4-M2
##                                       # available=0.6-1.4-M3
##                                       # available=0.6-1.4.0-rc

brewin avatar Aug 20 '20 17:08 brewin

Thanks for the report! Indeed, for simplicity (on my end), dots and dashes are treated the same for now.

That gives more examples to tune a better version sorter.

Adding another (tricky) real-world example:

As of version 0.9.5 (release coming this week), we can have the following:

version.kotlinx.coroutines=1.3.8
##             # available=1.3.8-1.4-rc-154
##             # available=1.3.8-1.4.0-rc
##             # available=1.3.8-1.4.0-rc-218
##             # available=1.3.9-native-mt
##             # available=1.3.9

but the correct order would be:

version.kotlinx.coroutines=1.3.8
##             # available=1.3.8-1.4-rc-154
##             # available=1.3.8-1.4.0-rc-218
##             # available=1.3.8-1.4.0-rc
##             # available=1.3.9
##             # available=1.3.9-native-mt

LouisCAD avatar Aug 21 '20 10:08 LouisCAD

@brewin developers are crazy creative with their naming scheme

The simplest solution is to use a rejectVersionIf https://jmfayard.github.io/refreshVersions/update-dependencies/#filter-which-versions-are-added-to-versionsproperties

jmfayard avatar Sep 13 '22 22:09 jmfayard

We can still tweak the version ordering system some day, because the scheme described here is quite common.

I might do it sometime next year as a mental exercise.

LouisCAD avatar Sep 14 '22 05:09 LouisCAD

Is there any update on this? I currently reject snapshots with same version as release using candidate.value.startsWith(current.value) && candidate.stabilityLevel == StabilityLevel.Snapshot, but a custom sorting would be better.

rlatapy-luna avatar Jan 29 '24 10:01 rlatapy-luna

No changes to expect on that in the foreseeable future, it's low priority, I already tuned the sorting algorithm to make it better, and you have a workaround.

LouisCAD avatar Jan 29 '24 17:01 LouisCAD

Also, snapshots for the same release should not be shown.

LouisCAD avatar Jan 29 '24 17:01 LouisCAD

Also, snapshots for the same release should not be shown.

Yes but in our case we bump the version immediately after releasing a new version. So our snapshots during feature dev are like 1.5.0-my_feature_under_dev-SNAPSHOT and won't be superseded by 1.5.0 after release. I agree that this may not be the main case, but an api to inject a kind of custom comparator could be nice.

rlatapy-luna avatar Jan 29 '24 18:01 rlatapy-luna