Slackbot
02/01/2022, 10:58 AMJavi
02/01/2022, 11:00 AMBig Chungus
02/01/2022, 11:01 AMid(kotlin("jvm")) gives you kotlin {} accessor?grossws
02/01/2022, 11:15 AMkotlin { ... } you mentioned. IIRC they are generated based on registering extension no matter how exactly plugin in written.
Also for org.example.my-plugin.gradle.kts in either buildSrc or included build gradle would generate accessor so you can apply it using `plugins { org.example.\`my-plugin\` }` in build.gradle.kts as well as via plugins { id("org.example.my-plugin") }. I avoid using former variant (using accessors) since IDEA has bad habit to either insert imports for generated accessors or just break a build at inconvenient time.
Term convention plugin is a bit a confusing one since some call precompiled script plugins that. As I understand plugin should be called convention plugin if it configures some defaults/conventions for your build. For example apply java-library plugin, configure target java version, configure publication etc. And it can be written as plain java/groovy/kotlin binary plugin or kotlin/groovy precompiled script plugin.grossws
02/01/2022, 11:18 AMplugin { org.example.`my-plugin` }Big Chungus
02/01/2022, 11:19 AMmy.plugin.gradle.kts in either buildSrc or included build from my-convention-plugins-moduleBig Chungus
02/01/2022, 11:20 AMJavi
02/01/2022, 11:41 AMsome-plugin.gradle.kts , you can apply it via
plugins {
`some-plugin` // same as id("some-plugin")
}Javi
02/01/2022, 11:42 AMBig Chungus
02/01/2022, 11:42 AMJavi
02/01/2022, 11:42 AMVampire
02/01/2022, 5:45 PMAlso forĀThat's exactly not true. That's one of the differences ofĀ in eitherĀorg.example.my-plugin.gradle.ktsĀ or included build gradle would generate accessor so you can apply it usingĀ `plugins { org.example.\`my-plugin\` }` inĀbuildSrcĀ as well as viaĀbuild.gradle.kts.plugins { id("org.example.my-plugin") }
buildSrc vs. included build.
With buildSrc you get the accessors for doing `plugins { org.example.my-plugin }`, with included builds you don't.
The other slight differences are usually more on the positive side.
buildSrc is always executed before your build whether you use something or not, its tests task is also always exectued (except if it is up-to-date of course), and the whole result is prepended to all build scripts of the main build.
The included build is only executed if actually used. It is only added to the build script class paths where it actually is used and only the necessary work (no tests) is done to get the jar you need at that situation. If you want the tests to be executed, you can wire them to your main builds check task for example.Vampire
02/01/2022, 5:46 PMSorry, slack formatting doesn't allow escaping backtick symbol in inline code.It allows, with trick 17. Make an inline code word so that Slack already has the inline code formatting, then paste in the backtick.
grossws
02/01/2022, 11:10 PMbuildSrc could be used only from one buildgrossws
02/01/2022, 11:16 PMjava-common-conventions, than java-library-conventions that use it etc), so I prefer simple id("java-common-conventions") syntax.
As for the trick it may work from slack on android, never tried. Usually has opposite problem with ending inline code span)