Install
Kotlin/Multiplatform
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:
buildscript {
repositories {
mavenCentral()
}
}
Then add the dependency:
kotlin {
sourceSets {
named("commonMain") {
dependencies {
implementation("org.kodein.db:kodein-db:0.6.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
|
Furthermore, you need to add the serializer you are going to use. When targeting Multiplatform, you can only use KotlinX Serialization:
kotlin {
sourceSets {
named("commonMain") {
dependencies {
implementation("org.kodein.db:kodein-db-serializer-kotlinx:0.6.1-beta")
}
}
}
}
Android only
Add the repository:
buildscript {
repositories {
mavenCentral()
}
}
Then add the dependency:
dependencies {
debugImplementation("org.kodein.db:kodein-db-android-debug:0.6.1-beta")
releaseImplementation("org.kodein.db:kodein-db-android:0.6.1-beta")
}
If you are developing a library and not an application, use
|
Furthermore, you need to add the serializer you are going to use. When targetting Android only, you can use either KotlinX.Serialization:
dependencies {
implementation("org.kodein.db:kodein-db-serializer-kotlinx:0.6.1-beta")
}
…or Kryo (which is JVM & Android only):
dependencies {
implementation("org.kodein.db:kodein-db-serializer-kryo-jvm:0.6.1-beta")
}
Desktop JVM
Add the repository:
buildscript {
repositories {
mavenCentral()
}
}
Then add the dependency:
implementation("org.kodein.db:kodein-db-jvm:0.6.1-beta")
If you are developing a library and not an application, use
|
Furthermore, you need to add the serializer you are going to use. When targetting JVM only, you can use either KotlinX.Serialization:
dependencies {
implementation("org.kodein.db:kodein-db-serializer-kotlinx:0.6.1-beta")
}
…or Kryo (which is JVM & Android only):
dependencies {
implementation("org.kodein.db:kodein-db-serializer-kryo-jvm:0.6.1-beta")
}
Finally, you must add the OS specific leveldb native build dependency:
dependencies {
implementation("org.kodein.db:kodein-leveldb-jni-jvm-linux:0.6.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.
|