A Kotlin compiler plugin to simplify development with Kava. It ships with a Gradle-Plugin to integrate it into your project and an IntelliJ-Plugin to gain better IDE - assistance.
The Gradle-Plugin does currently only a few things:
- Adding dependencies to your JVM - compilations
- Configuring the annotation processor as well as the generated source directories of it
- Wrapping the KSP options into a typesafe gradle extension
- Enabling support for Context Receivers, which is required for using Kava.
See Demo.
The plugin is hosted on the Gradle Plugin Portal. Simply apply it in your build.gradle.kts.
plugins {
id("io.github.merlinths.kava") version "1.0.0"
}
If you want to use the Kavas Annotation Processor, you also need to apply the KSP Compiler - Plugin to your project.
plugins {
id("io.github.merlinths.kava") version "1.0.0"
id("com.google.devtools.ksp") version "1.8.0-1.0.8"
}
It's important to include kava first! Otherwise, the current Kava version will not be able to generate code properly.
Now you can configure the options in a typesafe manner.
kava {
processor {
generatedFiles = GeneratedFiles.Separate(
packageName = GeneratedPackage.Infer,
fileExtension = GeneratedFileExtension.Static("Extensions")
)
}
}
Kavas gradle-plugin can be added to any kotlin project, but will only be applied on
- JVM compilations
- Android (JVM) compilations
Since it's a compiler plugin, its implementation is tightly coupled to a specific compiler version.
Kotlin Compiler | Kava Plugin |
---|---|
1.8.0 |
1.0.0 |