Skip to content

Core Setup

MerlinTHS edited this page Feb 17, 2023 · 3 revisions

Dependencies

Kavas dependencies are hosted on Maven Central, so make sure to include it as a repository.

repositories {
    mavenCentral()
}

Add the core dependency.

dependencies {
    implementation("io.github.merlinths:kava-core:1.0.0")   
}

Context Receivers

Kava uses Context Receivers, a feature introduced in Kotlin 1.6.20, which is currently JVM-only. Since it's still experimental you have to add -Xcontext-receivers as an additional compiler argument.

For jvm single-platform projects.

tasks.withType<KotlinCompile> {
    kotlinOptions {
        freeCompilerArgs = listOf("-Xcontext-receivers")
    }
}

For a multi-platform projects.

kotlin {
    jvm {
        compilations.all {
            kotlinOptions {
                freeCompilerArgs = listOf("-Xcontext-receivers")
            }
        }
    }
}

Templates

There are two templates to get started a bit easier.

Clone this wiki locally