Install
JVM
Add the repository:
build.gradle.kts
buildscript {
repositories {
maven(url = "https://dl.bintray.com/kodein-framework/Kodein-DB")
}
}
Kodein-DB will eventually be sync’d with JCenter, when it exits beta. |
Then add the dependency:
build.gradle.kts
dependencies {
implementation("org.kodein.db:kodein-db-jvm:0.4.1-beta")
}
If you are developing a library and not an application, use the artifact org.kodein.db:kodein-db-api-jvm:0.4.1-beta instead, which only provides the Kodein-DB API, and not its implementation.
|
Furthermore, you need to add the serializer you are going to use. When targetting JVM only, you can use Kryo:
build.gradle.kts
dependencies {
implementation("org.kodein.db:kodein-db-serializer-kryo-jvm:0.4.1-beta")
}
Finally, if you are targeting a desktop OS, you must add the OS specific leveldb native build dependency:
build.gradle.kts
dependencies {
implementation("org.kodein.db:kodein-leveldb-jni-jvm-linux:0.4.1-beta")
// -linux, -macos or -windows
}
If you are targeting multiple desktop OS, you can use the kodein-leveldb-jni-jvm dependency, which imports all three (Linux, MacOS & Windows) artifacts.
|
Multiplatform and/or Native (Gradle)
Kodein-DB supports the following targets: iosArm32, iosArm64, iosX64, linuxX64, macosX64, mingwX64 |
Kodein-DB uses the new gradle native dependency model featured in Gradle 5.3 and later.
In your build.gradle.kts
file, add the repository:
build.gradle.kts
buildscript {
repositories {
maven(url = "https://dl.bintray.com/kodein-framework/Kodein-DB")
}
}
Kodein-DB will eventually be sync’d with JCenter, when it exits beta. |
Then add the dependency:
build.gradle
kotlin {
sourceSets {
commonMain {
dependencies {
implementation("org.kodein.db:kodein-db:0.4.1-beta")
}
}
}
}
Thanks to Gradle Metadata, you don’t need to add any additional dependency to your targets.
If you are developing a library and not an application, use the artifact org.kodein.db:kodein-db-api:0.4.1-beta instead, which only provides the Kodein-DB API, and not its implementation.
|
Furthermore, you need to add the serializer you are going to use. When targeting Multiplatform, you need to use KotlinX Serialization:
build.gradle
kotlin {
sourceSets {
commonMain {
dependencies {
implementation("org.kodein.db:kodein-db-serializer-kotlinx:0.4.1-beta")
}
}
}
}