I see libs prefixing their `alpha` versions with `...
# library-development
m
I see libs prefixing their
alpha
versions with
"0"
but not doing it for their releases: •
3.2.1
3.3.0-alpha01
Is there a reason for this? If I read https://docs.gradle.org/current/userguide/single_versions.html#version_ordering correctly, it will also work without the leading
"0"
, Gradle should consider
alpha10 > alpha2
in all cases ?
j
I think the correct semver is
3.3.0-alpha.1
👍 1
m
Alright, no one does that 😅
From that doc above, I understand Gradle will split parts if they contain both numeric and non-numeric subparts. ie
3.3.0-alpha1
==
3.0.0-alpha.1
==
3.0.0-alpha-1
j
yeah, it is not usual
Thinking on it, I use dependabot and/or ben manes plugin
I think dependabot has its own mechanism to decide what is the newest version, but not sure if ben manes just use the Gradle implementation to check the order
m
Last time I used ben manes, I had to write some custom rules for alphas, etc...
j
yeah, I have a regex too, but not for this issue
message has been deleted
l
I prefix with zero in case there's more than 9 versions, so your (our) eyes never need to jump if looking into a maven repo in the browser like MavenCentral, or in a filesystem like in MavenLocal.
j
@louiscad hope they fix the browser sorting...
it is annoying
d
IIRC, SemVer rules treat any alphanumeric part as alphabetical, so alpha10 would come before alpha2. On the other hand, SemVer does recognize fully numeric parts as numeric, so alpha.10 would come after alpha.9 – but as you said, many don’t do this. Maybe Gradle implements its own rules but publishers are probably trying to respect SemVer.
Not reading it again right now but I’m referring to https://semver.org/
👍 1
m
SemVer doesn't know anything about
-SNAPSHOT
or
-dev
though 😕
If I read correctly, according to SemVer,
3.0.0-dev12 > 3.0.0-alpha01
l
#refreshversions does! 😉
m
What algorithm does refreshVersion use?
l
Custom
j
and snapshot > alpha, which shouldnt
l
You can see it in the Version.kt file
@Javier That's debatable
j
mmm yeah
you have right
indeed snapshot are usually the most recent version
I was wrong because a tricky thing I have to do with reckon
l
Only stable supersedes it.
m
Yea,
-SNAPSHOT
is "another dimmension" I think, it's orthogonal to
alpha, dev, rc
1
mmmm
3.0.0-SNAPSHOT > 3.0.0
then?
Ah no
l
No, that not what I said
3.0.0 > anything
m
But
3.0.0-SNAPSHOT > 3.0.0-alpha1
l
Yes
j
it is alphabetically
m
Yea, that seems fair
l
There's unfortunately no static way to know which of the two is actually the most recent, but I don't depend on snapshots for too long anyway.
j
znapshot (dont do this XD) > snapshot > rc > milestone
😄 1
m
And SemVer sorts case-sensitive:
Copy code
Identifiers with letters or hyphens are compared lexically in ASCII sort order.
So
3.0.0-RC < 3.0.0-alpha1
?
Gosh...
l
SemVer is only 2.0.0 though
I just chose to ignore it personally, going closer to AndroidX versioning inferred conventions instead.
BTW, are we going to talk about how Kotlin 1.5.1 doesn't exist?
😂 1
j
no
l
🙃
j
RC > alpha1
m
@Javier in Gradle world yes but not in SemVer wolrd IIUC
upper case chars are less than their equivalent lower case
'R' (82) < 'a' (97)
j
semworld too
are you sure about that?
reckon is very strict with semver, and RC > alpha
m
Well, I'm sure of nothing at this point but the SemVer page says:
Copy code
ASCII sort order.
And "RC" < "alpha" in ascii sort order
(writing this in a playground now because I start to doubt everything at this point 😅 )
l
Maybe they mean they don't care about éåñīœ
j
and b?
l
Ÿßč ẞßæ Įįí
m
Copy code
println("RC" < "alpha")
//true
At least the spec makes it clear non-alphanum are not allowed:
Copy code
Identifiers MUST comprise only ASCII alphanumerics and hyphens [0-9A-Za-z-].
j
but with minus it is higher, that is ugly
m
What do you mean?
Copy code
"-RC" < "-alpha"
?
j
message has been deleted
rc > alpha, but RC < alpha
m
Yep
j
reckon docs only suggest rc in minus
👀 1
m
That SemVer document should say case sensitive...
reckon docs only suggest rc in minus
Ah, this is why then
But then Kotlin and many others use
-RC
...
j
I think I saw in Kotlin projects M1, m1 and milestone1
☝️ 1
in RC i dont remember see rc in minus
message has been deleted
there are rc in minus in kotlin versions too
message has been deleted
Gradle is case insensitive no?, if you import RC or rc, it will work
m
That's not 100% clear. https://docs.gradle.org/current/userguide/single_versions.html#version_ordering says the order is case sensitive
But also the section about special values like
rc
uses both
rc
and
RC
j
but you can't publish rc + RC no?
🤷 1
m
Taht would be a hosting issue I guess?
If Sonatype is case sensitive, I don't see any reason why not?
j
I havent tested it to be honest
but I think the safest way is just all in lowercase
the only different thing is dev one no?
1
m
Yea,
-dev
sounds like the big difference
j
semver
alpha < beta < dev
, gradle
dev < alpha < beta
Why dev is treated different by Gradle?
m
"Historical reasons" ?
j
Maybe, yeah
l
dev
is subject to interpretation. When bintray was around, it was my "better snapshots" for reproducible builds. That said, Google used dev before alpha for #compose
m
Yea, I'm guilty of doing the same
l
Not sure it matters that much nowadays.
m
Well, we should certainly stop using
-dev
, right?
l
I moved to develop mostly on the main branch and have short lived branches whenever possible, when I need branches, and I semi-automated releasing, so it's less of a concern for me now.
m
So when you want to pin really unstable developer previews, what version do you use?
l
One thing though: I'd use dev if conveniently possible the same way I use to, and I'd use 0.x for the #compose like pre-alpha stage.
If I really needed to, I'd find the timestamps on the snapshot, knowing it's set to go away at some point. At least, it'd make the build reproducible within a given timeframe. Not sure how doable it'd be regarding multi-module publications though, since there's no staging for repos, so I guess the timestamps would be different for every artifact 😅
j
Personally I just use
alpha
,
beta
, and
rc
. It is enough
and snapshot for publishing every commit on
main
branch
maybe you can just treat alpha as dev, and if you need one more, you can just add
m
or
milestone
l
I publish snapshots manually (via button click, aka. workflow_dispatch). Doing it for every commit would just make climate change worse for no reason.
j
different strategy, I want to have the snapshot with all commits, similar to what happens in... tivi Chris banes app? or accompanist? I dont remember
for specific commit versions, I just use an alpha
m
Alphas have a different meaning for me. I'd expect an alpha to be kind of usable, even if it has bugs.
-dev
are wildy untested and can break completely
j
I think dev can be snapshots too no?
m
In my specific case not really because I needed builds to be reproducible even if they could break 100%
l
Another maven group (e.g. a com.github.xxx project) where you publish dev versions can do.
Then you use a resolutionStrategy to swap the artifacts.
It's effectively case-insensitive for special values
👀 1
d
I'd just follow proper semver so
1.2.3-alpha.0
(in lowercase so you avoid issues with cases sensitive ordering)) -> guess as long as you are consistent then it shouldn't matter
you could even create an action that verifies that suffix is one of
-alpha/-beta/-rc
or whatever valid values
m
I ultimately went with
3.0.0-alpha01
because of ... "historical reasons" I guess
🙂 2
I ended up writing all this before I forget about it: https://github.com/martinbonnin/PragmaVer/tree/main#readme