TWiStErRob / net.twisterrob.gradle

Quality plugin for Gradle that supports Android flavors
https://github.com/TWiStErRob/net.twisterrob.gradle#features
The Unlicense
18 stars 5 forks source link

Use kotlin-dsl everywhere #296

Open TWiStErRob opened 2 years ago

TWiStErRob commented 2 years ago

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 commented 2 years ago

Careful, KotlinDslCompilerPlugins hardcodes Kotlin 1.4.

TWiStErRob commented 2 years ago

(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