https://kotlinlang.org logo
Title
b

bod

04/25/2020, 1:22 PM
Hello, World! I'm migrating to
kts
. Let's say I want some globally accessible map for dependency versions (for instance
"gradle" to "6.3", "kotlin" to "1.3.70"
and so on) - and I'd like to be able to access it from the root's build.gradle.kts, and also the other module's. What's the simplest way to do this? Currently I have a solution using
extra
but is there a way to simply add my own
object
to the classpath or something like that?
p

Peter

04/25/2020, 1:38 PM
i'm new to gradle/kotlin but yes indeed, i just did this: https://github.com/peterfigure/Greetings
b

bod

04/25/2020, 1:45 PM
Thanks a lot! Very simple indeed 🙂
p

Peter

04/25/2020, 1:46 PM
np!
m

mbonnin

04/25/2020, 10:46 PM
I'm doing that too. The main drawaback is that changing a lib version invalidates your whole build so the next build will take a loong time.
There's some discussion abouot it (https://github.com/gradle/gradle/issues/9008) but I don't think this will change any time soon.
apollo-android has versions in a
dependencies.gradle
file so it can also be shared with test projects. I believe this will play nicer with incremental builds too.
Itt uses groovy
eval()
to pull that in the
build.gradle.kts
p

Peter

04/26/2020, 2:41 AM
thanks for sharing .. i guess that could be annoying if you're working with snapshot dependencies
b

bod

04/26/2020, 9:39 AM
thanks a lot 🙂 👍