Brais Gabin
03/14/2023, 10:12 AMbuild.gradle.kts
in all the modules for that reason I want to move all that to a gradle plugin. My problem is how to translate val androidMain by getting
.CLOVIS
03/14/2023, 10:15 AMandroid
block etc as well)Brais Gabin
03/14/2023, 10:21 AMkt
instead of kts
. Extending from `Plugin`:
class KmpModule : Plugin<Project> {
override fun apply(target: Project) {
...
CLOVIS
03/14/2023, 10:22 AMAdam S
03/14/2023, 12:00 PMPlugin<Project>
, or a pre-compiled script plugin.
Either work fine, but pre-compiled script plugins are nice because they look more like regular .gradle.kts
files.
The quick-guide for creating convention plugins is:
1. create a ./buildSrc dir
2. in ./buildSrc/build.gradle.kts
make sure to apply the kotlin-dsl plugin
3. also in ./buildSrc/build.gradle.kts
add the Gradle plugins you want to use in conventions. Make sure to use the Maven coordinates (not the plugin ID) as implementation-dependencies.
4. Create a convention plugin in ./buildSrc/src/main/kotlin/my-convention.gradle.kts
5. in any subproject you can use your convention plugin in the plugins block with id("my-convention")
CLOVIS
03/14/2023, 12:09 PMbuildSrc/settings.gradle.kts
too, even if you leave it empty