one last thing, constants, currenrly in ext block, kotlin dsl samples use buildSrc -- ill need to move to kotlin dsl incrementally -- can groovy code see buildSrc objects? or will kotlin dsl files I migrate work with ext constants? (dependency artigact names)
g
gildor
10/13/2020, 4:37 AM
can groovy code see buildSrc objects
Sure, buildSrc is just a part of build classpath
gildor
10/13/2020, 4:38 AM
will kotlin dsl files I migrate work with ext constants
Also will work, but it will be something like
ext[“someConstant”]
gildor
10/13/2020, 4:39 AM
but I wouldn’t recommend to move version to buildSrc, though, it very handy, autocomplete in Kotlin dsl and so on, but every change in buildSrc cause full recompilation of the project, so it quite painful
I don’t have perfect solution, but even just keeping constants in gradle.properties is better imo
Also recently we stopped using constants, and define version using java-platfrom plugin and use them in all modules without version, something like this:
implementation “some:library”
But it’s not something kotlin dsl specificc
kotlin
val foo: Any? by project // ext["foo"]
var bar by ext("1") // ext["bar"] = "1"
g
gildor
10/13/2020, 6:59 AM
using included builds should be the way forward
Included builds will not help, if you have only 1 included build with all your dependencies which applied to all modules, it will still trigger recompilation of everyhing
You can split dependencies to multiple modules, but it looks as huge overkill for this use case for me and I would just avoid using any constants for dependencies until gradle provide proper way to handle this (java-platform mitigates this problem thoug)