Is there any difference between kt or kts file for...
# community-support
н
Is there any difference between kt or kts file format for convention plugins in includeBuild project?
👀 1
m
.kts is usually for "precompiled scripts plugins", they use the same Kotlin syntax as "regular"
build.gradle.kts
files (sam with receiver for
Action<T>
, assignment plugin, generated accessors, etc...) I use
.kt
all the time because I find it easier to understand how the API work under the hood this way.
н
Yeah but at the same time it becomes more hard to understand for developers who not familiar with this API, underlying extensions etc. and more familiar with API’s they use in build.gradle.kts. So my thought process maybe it’s better to write convention plugins in kts files so it will be more accessible for other developers. My main concerns with kts: • Is there any limitations in gradle API usage • Any compilation speed or caching issues
m
precompiled script plugins are slower
it will be more accessible for other developers
My hot take is that the Kotlin DSL isn’t making anything more accessible. It was made so that Kotlin syntax looks closer to the Groovy one but it’s adding complexity you don’t really need if you’re only doing Kotlin
l
Personally I like to recommend
.kts
for convention plugins and
.kt
for "regular/other" plugins
m
I think
.kts
is really more of an habbit. In a declarative Gradle world, there is very little upside to using
.kts
And it's slower