Looking for any recommended examples of a KMP or C...
# gradle
p
Looking for any recommended examples of a KMP or CMP binary convention plugin, especially one you might have authored.
@jendrik does provide a very good example that provides Java-centric convention plugins (in many flavors) at https://github.com/jjohannes/gradle-plugins-howto/tree/main/kotlin/gradle-build-logic but so far I have found it very difficult to morph his examples to Kotlin/Compose MultiPlatform.
c
What are you searching for exactly?
p
I want to see how someone wrote a working binary Gradle plugin (preferably tested as well) to encapsulate plugins such as kotlin-multiplatform, maven-publish, ktlint, kover, etc that are used in many, many independent Gradle projects. Not talking Gradle modules here but independent projects that each do one thing and live in their own git repo. I hope that is the clarity you are looking for. 🙂
c
Maybe mine does what you want? https://gitlab.com/opensavvy/automation/gradle-conventions It has KMP, Compose Multiplatform, Dokkatoo, Kover, maven-publish (including Maven Central), and helpers to create & publish other Gradle plugins. You can find a small sample using it here. All Kotlin projects in the OpenSavvy group & subgroups use it.
p
@CLOVIS I think your project will answer my questions but it is more of a framework than a simple example. Thanks for the link. It appears to be an impressive piece of work. I tend not to use Frameworks for the most part because I only tend to use a very small fraction of the total code. Thank you, thank you for making this project FOSS code.
c
Yeah, you're probably right. This one is very opinionated towards my own needs. I'm not sure what you want, so it's unlikely to fit in exactly with what you're searching for, but at the very least you can take inspiration.
x
Your repo looks appealing Ivan! I've been applying the convention over configuration approach for a while and love it. If you allow me to go a little bit off-topic here, I was trying to setup a convention plugin for Room but I haven't been able to figure out the dependency needed to access
RoomExtension
in
buildSrc
. Do you know how to do that?
c
No idea, but if you ctrl q (quick documentation) on it, IDEA should tell you which Maven coordinates it comes from
gratitude thank you 1
j
FWIW - I setup a little example showing a KMP Convention Plugin written in Kotlin (as Class, not Gradle Kotlin DSL). https://github.com/jjohannes/gradle-demos/tree/main/kotlin-multi-platform-convention-plugins