Realm is a mobile database that runs directly inside phones, tablets or wearables. This repository holds the source code for the Kotlin SDK for Realm, which runs on Kotlin Multiplatform and Android.
The Realm Kotlin SDK is in Developer Preview. All API's might change without warning and no guarantees are given about stability. Do not use in production.
The public API of the SDK has not been finalized. Design discussions will happen in both Google Doc and this Github repository. Most bigger features will first undergo a design process that might not involve code. These design documents can be found using the following links:
- 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 have three branches for shared development: master
, releases
and next-major
. Tagged releases are only made from releases
.
master
:
- Target branch for new features.
- Cotains the latest publishable state of the SDK.
- SNAPSHOT releases are being created for every commit.
releases
:
- All tagged releases are made from this branch.
- Target branch for bug fixes.
- Every commit should be merged back to master
master
. - Minor changes (e.g. to documentation, tests, and the build system) may not affect end users but should still be merged to
releases
to avoid diverging too far frommaster
and to reduce the likelihood of merge conflicts.
next-major
:
- Target branch for breaking changes that would result in a major version bump.
Note: We currently only have the master
branch, as no tagged releases have been made yet.
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.
We love contributions to Realm! If you'd like to contribute code, documentation, or any other improvements, please file a Pull Request on our GitHub repository. Make sure to accept our CLA!
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].
Realm welcomes all contributions! The only requirement we have is that, like many other projects, we need to have a Contributor License Agreement (CLA) in place before we can accept any external code. Our own CLA is a modified version of the Apache Software Foundation’s CLA.
Please submit your CLA electronically using our Google form so we can accept your submissions. The GitHub username you file there will need to match that of your Pull Requests. If you have any questions or cannot file the CLA electronically, you can email [email protected].
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
.