let’s hope you’ll never get to “-10”, because buil...
# announcements
p
let’s hope you’ll never get to “-10”, because build tools would probably get that wrong (“-2" > “-10”)
r
pniederw: That's a good point
i
AFAIK build tools are capable of sorting numbers in versions as if they are numbers.
r
I was under the impression (though it may just be a semver thing) that sorting by number happened with the three numbers surrounding the `.`s, and everything after was treated as a string. I could be wrong though. EDIT I was wrong, see below
I stand corrected
identifiers consisting of only digits are compared numerically and identifiers with letters or hyphens are compared lexically in ASCII sort order
i
What source are you quoting by the way?
r
That's from the semver spec http://semver.org/#spec-item-11 I'm not sure how that applies to the various build tools though.
i
Probably semver applies to none of the relevant ones (maven, gradle)
😅 1
👍 1
p
@ilya.gorbunov I’m pretty sure maven and gradle compare anything after the hyphen lexicographically
p
ok, might just be ivy and gradle 🙂
I wrote some of that code, but don’t remember for sure.
p
all I remember is that the goal was to remain compatible with ivy, even though we ripped out the ivy impl
r
It looks like it has pretty similar rules to Maven. Version parts are broken on
{'.', '_', '-'. '+'}
and boundaries between digits and non-digits, and there can be an arbitrary amount of them. https://github.com/gradle/gradle/blob/master/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/ivyresolve/strategy/VersionParser.java