Skip to content

Installation

Android (single-module)

1. Configure repositories

settings.gradle.kts
pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
    }
}

2. Apply the plugin and add dependencies

app/build.gradle.kts
plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android") version "2.3.20"
    id("io.github.sufarook.kiln") version "1.0.0-alpha08"
}

dependencies {
    implementation("io.github.sufarook.kiln:annotations:1.0.0-alpha08")
    implementation("io.github.sufarook.kiln:runtime:1.0.0-alpha08")
}

Plugin handles KSP

You do not need to apply com.google.devtools.ksp manually. The Kiln plugin detects your project type and applies KSP with the correct configuration.


Kotlin Multiplatform

For KMP projects the plugin configures kspCommonMainMetadata automatically — entities defined in commonMain are processed and their repositories are available on all targets.

shared/build.gradle.kts
plugins {
    kotlin("multiplatform")
    id("com.android.library")
    id("io.github.sufarook.kiln") version "1.0.0-alpha08"
}

kotlin {
    androidTarget()
    iosArm64()
    iosX64()
    iosSimulatorArm64()

    sourceSets {
        commonMain.dependencies {
            implementation("io.github.sufarook.kiln:annotations:1.0.0-alpha08")
            implementation("io.github.sufarook.kiln:runtime:1.0.0-alpha08")
        }
    }
}

iOS driver factory

On iOS use IosDatabaseDriverFactory instead of the Android one:

iosMain
val driver = IosDatabaseDriverFactory().create("myapp.db")
val noteRepo = NoteRepository(driver).also { it.createTable() }

Desktop / JVM

For pure JVM or Compose Desktop projects, use JvmDatabaseDriverFactory:

build.gradle.kts
plugins {
    kotlin("jvm")
    id("io.github.sufarook.kiln") version "1.0.0-alpha08"
}

dependencies {
    implementation("io.github.sufarook.kiln:annotations:1.0.0-alpha08")
    implementation("io.github.sufarook.kiln:runtime:1.0.0-alpha08")
}
main.kt
val driver = JvmDatabaseDriverFactory().create("myapp.db")
val repo = ProductRepository(driver).also { it.createTable() }

For tests or ephemeral use, create an in-memory database:

val driver = JvmDatabaseDriverFactory().createInMemory()

Tip

The generated code has no Android dependency — the runtime module is pure Kotlin.


Maven coordinates

Artifact Coordinate
Annotations io.github.sufarook.kiln:annotations:1.0.0-alpha08
Runtime io.github.sufarook.kiln:runtime:1.0.0-alpha08
Gradle plugin io.github.sufarook.kiln (plugin id)

Alpha release

Version 1.0.0-alpha08 is stable for Android production use. The public API is stable but minor breaking changes may occur before the 1.0.0 stable release. Watch the GitHub releases page for updates.