https://kotlinlang.org logo
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
benchmarks
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
confetti
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
lincheck
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by
Title
m

mbonnin

07/12/2021, 9:39 AM
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

Javier

07/12/2021, 10:13 AM
I think the correct semver is
3.3.0-alpha.1
m

mbonnin

07/12/2021, 10:15 AM
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

Javier

07/12/2021, 10:16 AM
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

mbonnin

07/12/2021, 10:19 AM
Last time I used ben manes, I had to write some custom rules for alphas, etc...
j

Javier

07/12/2021, 10:19 AM
yeah, I have a regex too, but not for this issue
l

louiscad

07/12/2021, 11:29 AM
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

Javier

07/12/2021, 11:31 AM
@louiscad hope they fix the browser sorting...
it is annoying
d

Drew Hamilton

07/12/2021, 12:00 PM
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

mbonnin

07/12/2021, 12:05 PM
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

louiscad

07/12/2021, 12:06 PM
#refreshversions does! 😉
m

mbonnin

07/12/2021, 12:06 PM
What algorithm does refreshVersion use?
l

louiscad

07/12/2021, 12:06 PM
Custom
j

Javier

07/12/2021, 12:07 PM
and snapshot > alpha, which shouldnt
l

louiscad

07/12/2021, 12:07 PM
You can see it in the Version.kt file
@Javier That's debatable
j

Javier

07/12/2021, 12:08 PM
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

louiscad

07/12/2021, 12:08 PM
Only stable supersedes it.
m

mbonnin

07/12/2021, 12:09 PM
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

louiscad

07/12/2021, 12:10 PM
No, that not what I said
3.0.0 > anything
m

mbonnin

07/12/2021, 12:10 PM
But
3.0.0-SNAPSHOT > 3.0.0-alpha1
l

louiscad

07/12/2021, 12:10 PM
Yes
j

Javier

07/12/2021, 12:11 PM
it is alphabetically
m

mbonnin

07/12/2021, 12:11 PM
Yea, that seems fair
l

louiscad

07/12/2021, 12:11 PM
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

Javier

07/12/2021, 12:12 PM
znapshot (dont do this XD) > snapshot > rc > milestone
😄 1
m

mbonnin

07/12/2021, 12:13 PM
And SemVer sorts case-sensitive:
Identifiers with letters or hyphens are compared lexically in ASCII sort order.
So
3.0.0-RC < 3.0.0-alpha1
?
Gosh...
l

louiscad

07/12/2021, 12:14 PM
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

Javier

07/12/2021, 12:15 PM
no
l

louiscad

07/12/2021, 12:15 PM
🙃
j

Javier

07/12/2021, 12:15 PM
RC > alpha1
m

mbonnin

07/12/2021, 12:16 PM
@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

Javier

07/12/2021, 12:17 PM
semworld too
are you sure about that?
reckon is very strict with semver, and RC > alpha
m

mbonnin

07/12/2021, 12:18 PM
Well, I'm sure of nothing at this point but the SemVer page says:
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

louiscad

07/12/2021, 12:19 PM
Maybe they mean they don't care about éåñīœ
j

Javier

07/12/2021, 12:19 PM
and b?
l

louiscad

07/12/2021, 12:20 PM
Ÿßč ẞßæ Įįí
m

mbonnin

07/12/2021, 12:20 PM
println("RC" < "alpha")
//true
At least the spec makes it clear non-alphanum are not allowed:
Identifiers MUST comprise only ASCII alphanumerics and hyphens [0-9A-Za-z-].
j

Javier

07/12/2021, 12:21 PM
but with minus it is higher, that is ugly
m

mbonnin

07/12/2021, 12:22 PM
What do you mean?
"-RC" < "-alpha"
?
j

Javier

07/12/2021, 12:24 PM
rc > alpha, but RC < alpha
m

mbonnin

07/12/2021, 12:24 PM
Yep
j

Javier

07/12/2021, 12:24 PM
reckon docs only suggest rc in minus
👀 1
m

mbonnin

07/12/2021, 12:24 PM
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

Javier

07/12/2021, 12:26 PM
I think I saw in Kotlin projects M1, m1 and milestone1
☝️ 1
in RC i dont remember see rc in minus
there are rc in minus in kotlin versions too
Gradle is case insensitive no?, if you import RC or rc, it will work
m

mbonnin

07/12/2021, 12:29 PM
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

Javier

07/12/2021, 12:29 PM
but you can't publish rc + RC no?
🤷 1
m

mbonnin

07/12/2021, 12:30 PM
Taht would be a hosting issue I guess?
If Sonatype is case sensitive, I don't see any reason why not?
j

Javier

07/12/2021, 12:31 PM
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

mbonnin

07/12/2021, 12:32 PM
Yea,
-dev
sounds like the big difference
j

Javier

07/12/2021, 12:32 PM
semver
alpha < beta < dev
, gradle
dev < alpha < beta
Why dev is treated different by Gradle?
m

mbonnin

07/12/2021, 12:34 PM
"Historical reasons" ?
j

Javier

07/12/2021, 12:35 PM
Maybe, yeah
l

louiscad

07/12/2021, 12:36 PM
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

mbonnin

07/12/2021, 12:36 PM
Yea, I'm guilty of doing the same
l

louiscad

07/12/2021, 12:37 PM
Not sure it matters that much nowadays.
m

mbonnin

07/12/2021, 12:37 PM
Well, we should certainly stop using
-dev
, right?
l

louiscad

07/12/2021, 12:38 PM
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

mbonnin

07/12/2021, 12:38 PM
So when you want to pin really unstable developer previews, what version do you use?
l

louiscad

07/12/2021, 12:39 PM
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

Javier

07/12/2021, 12:41 PM
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

louiscad

07/12/2021, 12:44 PM
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

Javier

07/12/2021, 12:46 PM
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

mbonnin

07/12/2021, 1:03 PM
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

Javier

07/12/2021, 1:05 PM
I think dev can be snapshots too no?
m

mbonnin

07/12/2021, 1:13 PM
In my specific case not really because I needed builds to be reproducible even if they could break 100%
l

louiscad

07/12/2021, 1:15 PM
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

Dariusz Kuc

07/12/2021, 2:44 PM
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

mbonnin

07/12/2021, 2:49 PM
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