Realm is a mobile database that runs directly inside phones, tablets or wearables. This repository holds the source code for the Kotlin version of Realm, which runs on Kotlin Multiplatform and Android.
- Swig. On Mac this can be installed using Homebrew:
brew install swig
.
git submodule update --init --recursive
cd test
./gradlew assemble
In Android Studio open the test
project, which will open also the realm-library
and the compiler projects
If you want to test recent bugfixes or features that have not been packaged in an official release yet, you can use a -SNAPSHOT release of the current development version of Realm via Gradle, available on JFrog OSS
// Global build.gradle
buildscript {
repositories {
google()
jcenter()
maven {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
maven {
url 'https://dl.bintray.com/kotlin/kotlin-dev'
}
}
dependencies {
classpath 'io.realm.kotlin:plugin-gradle:<VERSION>'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
maven {
url 'https://dl.bintray.com/kotlin/kotlin-dev'
}
}
}
See Config.kt for the latest version number.
We use the offical style guide from Kotlin which is enforced using ktlint and detekt.
# Call from root folder to check if code is compliant.
./gradlew ktlintCheck
./gradlew detekt
# Call from root folder to automatically format all Kotlin code according to the code style rules.
./gradlew ktlintFormat
Note: ktlint does not allow group imports using .*
. You can configure IntelliJ to disallow this by going to preferences Editor > Code Style > Kotlin > Imports
and select "Use single name imports".
All dependency versions and other constants we might want to share between projects are defined inside the file
buildSrc/src/main/kotlin/Config.kt
. Any new dependencies should be added to this file as well, so we only have one
location for these.
The folder examples/kmm-sample
contains an example showing how to use Realm in a multiplatform
project, sharing code for using Realm in the shared
module. The project is based on
https://github.com/Kotlin/kmm-sample
.