Justin Tullgren
06/11/2025, 1:00 PMimplementation
dependency for a custom gradle plugin without applying the kotlin-dsl plugin to the custom gradle plugin build? I tried depending on this target but a lot of the kotlin extension functions weren’t found (same with others in the group).mbonnin
06/11/2025, 1:16 PMimplementation(gradleKotlinDsl())
mbonnin
06/11/2025, 1:17 PMString.invoke()
val foo by creating {}
, etc.. Using the "DSL" term is a bit misleading. It's all imperative under the hood.efemoney
06/11/2025, 2:35 PM::class.java
everywhere) & the dsl syntax is in most cases nicer than calling it imperatively. Personally, I encourage plugin authors to use the dsl if possiblembonnin
06/11/2025, 2:43 PM::class.java
aroundmbonnin
06/11/2025, 2:45 PMmbonnin
06/11/2025, 2:45 PMkotlin-dsl
(which they shouldn't add because it is slow) then they have to figure out how to translate againmbonnin
06/11/2025, 2:46 PMefemoney
06/11/2025, 3:05 PMbecause its slowTo be clear I am also very much against using precompiled script plugins & applying the
kotlin-dsl
plugin.
I am saying that plugin devs writing binary plugins in kotlin should add gradleKotlinDsl()
dependency and use it, thats all. Its already on the classpath so no / negligible overhead.
not copy/pastable anymore … fragmentationThere’s already 3 languages for writing plugins (Java, Kt, Groovy) so its pretty fragmented already. Personally, I dont think being “copy pastable” should be a goal when you are writing a plugin but if it is then of course it makes more sense not to use the kotlin DSL in your examples / code.
mbonnin
06/11/2025, 3:07 PMmbonnin
06/11/2025, 3:07 PMefemoney
06/11/2025, 3:10 PMmbonnin
06/11/2025, 3:11 PMJustin Tullgren
06/11/2025, 5:20 PMJustin Tullgren
06/11/2025, 5:30 PMJustin Tullgren
06/11/2025, 5:59 PMdependencyManagement
?Vampire
06/11/2025, 11:37 PMThere’s already 3 languages for writing plugins (Java, Kt, Groovy) so its pretty fragmented already.
Why only those? You can use any JVM language. And that's fine.
efemoney
06/12/2025, 8:29 AMorg.jetbrains.kotlin.plugin.sam-with-receiver
and configure it like this:
samWithReceiver.annotation("org.gradle.api.HasImplicitReceiver")
(OR you could apply the kotlin-dsl-base
plugin which gives you all of the above functionality w/o the precompiled scripts part)
(I know its a lot of info, sorry)mbonnin
06/12/2025, 8:45 AMefemoney
06/12/2025, 8:49 AMgradleKotlinDsl()
dependency of cos).
I can’t give up assignment overloading & implicit receivers. They are just sooo convenient & way more readable (imo)mbonnin
06/12/2025, 8:52 AMefemoney
06/12/2025, 8:56 AMmbonnin
06/12/2025, 8:58 AMmbonnin
06/12/2025, 8:58 AMmbonnin
06/12/2025, 8:58 AMefemoney
06/12/2025, 9:10 AMefemoney
06/12/2025, 9:12 AMmbonnin
06/12/2025, 9:13 AMmbonnin
06/12/2025, 9:14 AMmbonnin
06/12/2025, 9:14 AMefemoney
06/12/2025, 9:14 AMmyProperty.set(myValue)
over myProperty = myValue
. It IS regular kotlin code 😅mbonnin
06/12/2025, 9:15 AMmbonnin
06/12/2025, 9:16 AM[1,2]
instead of listOf(1,2)
but then you need to teach both versions to everyonembonnin
06/12/2025, 9:16 AMmbonnin
06/12/2025, 9:17 AMefemoney
06/12/2025, 9:18 AMmbonnin
06/12/2025, 9:19 AMmbonnin
06/12/2025, 9:19 AMmbonnin
06/12/2025, 9:20 AMefemoney
06/12/2025, 9:21 AMefemoney
06/12/2025, 9:21 AMmbonnin
06/12/2025, 9:24 AM@DslMarker
annotation (I have been burnt multiple times with resolving the wrong name
) and there was a compile-time safe way to represent a non-optional Property
mbonnin
06/12/2025, 9:24 AMJustin Tullgren
06/12/2025, 11:23 AM