net.twisterrob.gradle icon indicating copy to clipboard operation
net.twisterrob.gradle copied to clipboard

Use kotlin-dsl everywhere

Open TWiStErRob opened this issue 3 years ago • 2 comments
trafficstars

Based on https://github.com/liutikas/gradle-best-practices/issues/1#issuecomment-1256260998

  1. Double-check this works if the consumer doesn't use the plugin by checking bytecode with/out the dsl plugin.
  2. remove add("compileOnly", deps.kotlin.dsl) hack
  3. apply plugin to all modules
  4. fix compilation

TWiStErRob avatar Sep 23 '22 14:09 TWiStErRob

Careful, KotlinDslCompilerPlugins hardcodes Kotlin 1.4.

TWiStErRob avatar Sep 23 '22 14:09 TWiStErRob

(1): there's barely any difference in compiled code, kotlin-dsl just lets Kotlin use nice receiver syntax, but still compiles to Action anonymous inner classes.

(Diff: line numbers are different because I copy-pasted the relevant function, didn't change the plugin.)

PublishingPluginKt-setupLinks-java-library.jad.txt PublishingPluginKt-setupLinks-kotlin-dsl.jad.txt image

TWiStErRob avatar Sep 23 '22 16:09 TWiStErRob