https://kotlinlang.org logo
#android
Title
# android
l

Loboda Deni

07/14/2020, 2:24 PM
Does anyone know if there have been studies regarding the build speed of a project on kts vs groovy?
o

okarm

07/14/2020, 2:25 PM
You will probably have more luck asking in #gradle channel
l

Loboda Deni

07/14/2020, 2:26 PM
Thanks
c

Casey Brooks

07/14/2020, 2:27 PM
I know I’ve seen articles on this before, but can’t seem to find them now. The general conclusion is that a clean run is a fair bit slower due to the additional code generation and compilation required for Kotlin scripts (which gets cached), but subsequent runs are comparable in performance.
Personally, I’ve been using the Kotlin DSL for over a year now, and don’t notice the performance impact in day-to-day development, and the type-safety and introspection far outweight the performance hit IMO
l

Loboda Deni

07/14/2020, 2:30 PM
That is, it is advisable to transfer all projects to kts?
Do you can somehow transfer build scripts from buildSrc between projects?
c

Casey Brooks

07/14/2020, 2:33 PM
I always use kts for new projects, that’s an easy decision. It’s quite a bit more difficult to migrate existing projects to using it, especially if you’re using shared scripts (
apply from: 'common.gradle'
) or configuration injection (
subprojects { apply plugin: 'java'
)
Precompiled script plugins are the way I like to set up shared configurations among subprojects from buildSrc https://docs.gradle.org/current/userguide/custom_plugins.html#sec:precompiled_plugins
l

Loboda Deni

07/14/2020, 2:37 PM
Thanks