https://kotlinlang.org logo
Title
l

louiscad

12/02/2018, 11:36 AM
Hi, I'm tired of javascript Groovy in my gradle files, but I have dozens of files to migrate across several projects, so I'm writing a Kotlin script to convert them to Kotlin. If anyone have some experience finding text patterns and replacing them properly (avoiding code comments) and can give some time to help, you're welcome! Note that I'm focused on Android and JVM projects, but if I can get help to support more projects types, and more gradle plugins, it's a good thing!
g

gildor

12/02/2018, 12:38 PM
Why do you want migrate existing projects? If you have complicated code you cannot just use auto replace, for simple configs it's just pointless imo
l

louiscad

12/02/2018, 1:50 PM
I want to migrate because I want auto-completion to just work and to not make the IDE lag, and use Kotlin features in my gradle files to make them more readable. But with probably more than a hundred gradle scripts across the projects, I do not want to do it by hand. Most
build.gradle
files do not have complicated code right now (because not needed, and also because it was a pain to use Groovy with the IDE without being a Gradle guru, as discovery was much harder). So it's not pointless. I'm just struggling with polymorphism right now (productFlavors, defaultConfig, buildTypes, BaseConfigImpl share some properties and functions)
t

thanksforallthefish

12/02/2018, 3:52 PM
generally speaking, I think you can just migrate a project next time you have to work on it. That is how I usually handle technical migration (I am not an android dev, I do microservices and it usually ends up in several services with different library dependency, when there is a library update I don't go through all projects updating, I do it when I have to work on it). If it ain't broken, don't fix it
on a side note, we are using maven (mostly), now 2 projects are migrated to gradle and next will come when I need to work on them.
oth, if you really have to work in parallel on tens of projects, this approach would probably not work and I see the pain in doing manually