Skip to content

Commit

Permalink
Merge branch 'main' into feature/github-actions
Browse files Browse the repository at this point in the history
# Conflicts:
#	buildSrc/src/main/kotlin/Config.kt
#	packages/external/core
  • Loading branch information
Christian Melchior committed Dec 6, 2023
2 parents 941c76c + 16abd75 commit ebfb69d
Show file tree
Hide file tree
Showing 52 changed files with 2,317 additions and 215 deletions.
34 changes: 20 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
## 1.13.0-SNAPSHOT (YYYY-MM-DD)
## 1.14.0-SNAPSHOT (YYYY-MM-DD)

### Breaking Changes
* None.

### Enhancements
* Support for experimental K2-compilation with `kotlin.experimental.tryK2=true`. (Issue [#1483](https://github.com/realm/realm-kotlin/issues/1483))
* [Sync] Added support for multiplexing sync connections. When enabled, a single
connection is used per sync user rather than one per synchronized Realm. This
reduces resource consumption when multiple Realms are opened and will
typically improve performance. The behavior can be controlled through [AppConfiguration.Builder.enableSessionMultiplexing]. It will be made the default
in a future release. (Issue [#1578](https://github.com/realm/realm-kotlin/pull/1578))
* [Sync] Various sync timeout options can now be configured through `AppConfiguration.Builder.syncTimeouts()`. (Issue [#971](https://github.com/realm/realm-kotlin/issues/971)).
* None.

### Fixed
* Fix compiler crash caused by a change in Kotlin 1.9.20 ((toIrConst moved under common IrUtils)[https://github.com/JetBrains/kotlin/commit/ca8db7d0b83f6dfd6afcea7a5fe7556d38f325d8]). (Issue [#1566](https://github.com/realm/realm-kotlin/issues/1566))
* None.

### Compatibility
* File format: Generates Realms with file format v23.
Expand All @@ -34,22 +28,33 @@
* None.


## 1.12.1-SNAPSHOT (YYYY-MM-DD)
## 1.13.0 (2023-12-01)

### Breaking Changes
* None.

### Enhancements
* None.
* Support for experimental K2-compilation with `kotlin.experimental.tryK2=true`. (Issue [#1483](https://github.com/realm/realm-kotlin/issues/1483))
* Added support for keypaths in `asFlow()` methods on objects and queries. This makes it possible to control which properties will trigger change events, including properties on objects below the default nested limit of 4. (Issue [#661](https://github.com/realm/realm-kotlin/issues/661))
* [Sync] Added support for multiplexing sync connections. When enabled, a single
connection is used per sync user rather than one per synchronized Realm. This
reduces resource consumption when multiple Realms are opened and will
typically improve performance. The behavior can be controlled through [AppConfiguration.Builder.enableSessionMultiplexing]. It will be made the default
in a future release. (Issue [#1578](https://github.com/realm/realm-kotlin/pull/1578))
* [Sync] Various sync timeout options can now be configured through `AppConfiguration.Builder.syncTimeouts()`. (Issue [#971](https://github.com/realm/realm-kotlin/issues/971)).

### Fixed
* Fix crashes caused by posting to a released scheduler. (Issue [#1543](https://github.com/realm/realm-kotlin/issues/1543))
* `RealmInstant.now` used an API (`java.time.Clock.systemUTC().instant()`) introduced in API 26, current minSDK is 16. (Issue [#1564](https://github.com/realm/realm-kotlin/issues/1564))
* Fix compiler crash caused by a change in Kotlin 1.9.20 ((toIrConst moved under common IrUtils)[https://github.com/JetBrains/kotlin/commit/ca8db7d0b83f6dfd6afcea7a5fe7556d38f325d8]). (Issue [#1566](https://github.com/realm/realm-kotlin/issues/1566))
* Fix craches caused by posting to a released scheduler. (Issue [#1543](https://github.com/realm/realm-kotlin/issues/1543))
* Fix NPE when applying query aggregators on classes annotated with `@PersistedName`. (Issue [1569](https://github.com/realm/realm-kotlin/pull/1569))
* [Sync] Fix crash when syncing data if the log level was set to `LogLevel.TRACE` or `LogLevel.ALL`. (Issue [#1560](https://github.com/realm/realm-kotlin/pull/1560))

### Compatibility
* File format: Generates Realms with file format v23.
* Realm Studio 13.0.0 or above is required to open Realms created by this version.
* This release is compatible with the following Kotlin releases:
* Kotlin 1.8.0 and above. The K2 compiler is not supported yet.
* Kotlin 1.9.0 and above. Support for experimental K2-compilation with `kotlin.experimental.tryK2=true`.
* Ktor 2.1.2 and above.
* Coroutines 1.7.0 and above.
* AtomicFu 0.18.3 and above.
Expand All @@ -58,9 +63,10 @@
* Minimum Gradle version: 6.8.3.
* Minimum Android Gradle Plugin version: 4.1.3.
* Minimum Android SDK: 16.
* Minimum R8: 8.0.34.

### Internal
* Updated to Realm Core 13.23.3, commit 7556b535aa7b27d49c13444894f7e9db778b3203.
* Updated to Realm Core 13.24.0, commit e593a5f19d0dc205db931ec5618a8c10c95cac90.


## 1.12.0 (2023-11-02)
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ SDK supports. In the matrix below, you will find the minimum supported version f

| Realm Version | Requirements |
|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1.13.0 | <ul><li>Kotlin 1.9.0+</li><li>AtomicFu 0.18.3+.</li><li>Ktor 2.1.2+.</li><li>Coroutines 1.7.0+.</li><li>Gradle 6.8.3 - 7.6.1.</li><li>The new memory model only.</li></ul> |
| 1.12.0 | <ul><li>Kotlin 1.8.20+</li><li>AtomicFu 0.18.3+.</li><li>Ktor 2.1.2+.</li><li>Coroutines 1.7.0+.</li><li>Gradle 6.8.3 - 7.6.1.</li><li>The new memory model only.</li></ul> |
| 1.11.0 | <ul><li>Kotlin 1.8.0+</li><li>AtomicFu 0.18.3+.</li><li>Ktor 2.1.2+.</li><li>Coroutines 1.7.0+.</li><li>Gradle 6.8.3 - 7.6.1.</li><li>The new memory model only.</li></ul> |
| 1.10.0 | <ul><li>Kotlin 1.8.0+</li><li>AtomicFu 0.18.3+.</li><li>Ktor 2.1.2+.</li><li>Coroutines 1.7.0+.</li><li>Gradle 6.8.3 - 7.6.1.</li><li>The new memory model only.</li></ul> |
| 1.9.0 | <ul><li>Kotlin 1.8.0+</li><li>AtomicFu 0.18.3+.</li><li>Ktor 2.1.2+.</li><li>Coroutines 1.6.4+.</li><li>Gradle 6.8.3 - 7.6.1.</li><li>The new memory model only.</li></ul> |
| 1.8.0 | <ul><li>Kotlin 1.7.20+</li><li>AtomicFu 0.18.3+.</li><li>Ktor 2.1.2+.</li><li>Coroutines 1.6.4+.</li><li>Gradle 6.7.1 - 7.6.1.</li><li>The new memory model only.</li></ul> |
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ val HOST_OS: OperatingSystem = findHostOs()

object Realm {
val ciBuild = (System.getenv("JENKINS_HOME") != null || System.getenv("CI") != null)
const val version = "1.13.0-gha-SNAPSHOT"
const val version = "1.14.0-gha-SNAPSHOT"
const val group = "io.realm.kotlin"
const val projectUrl = "https://realm.io"
const val pluginPortalId = "io.realm.kotlin"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ interface RealmCallbackTokenT : CapiT
interface RealmNotificationTokenT : CapiT
interface RealmChangesT : CapiT
interface RealmSchedulerT : CapiT
interface RealmKeyPathArrayT : CapiT

// Public type aliases binding to internal verbose type safe type definitions. This should allow us
// to easily change implementation details later on.
Expand All @@ -88,6 +89,7 @@ typealias RealmCallbackTokenPointer = NativePointer<RealmCallbackTokenT>
typealias RealmNotificationTokenPointer = NativePointer<RealmNotificationTokenT>
typealias RealmChangesPointer = NativePointer<RealmChangesT>
typealias RealmSchedulerPointer = NativePointer<RealmSchedulerT>
typealias RealmKeyPathArrayPointer = NativePointer<RealmKeyPathArrayT>

// Sync types
// Pure marker interfaces corresponding to the C-API realm_x_t struct types
Expand Down Expand Up @@ -435,24 +437,30 @@ expect object RealmInterop {
): RealmObjectPointer?
fun realm_object_delete(obj: RealmObjectPointer)

fun realm_create_key_paths_array(realm: RealmPointer, clazz: ClassKey, keyPaths: List<String>): RealmKeyPathArrayPointer
fun realm_object_add_notification_callback(
obj: RealmObjectPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer
fun realm_results_add_notification_callback(
results: RealmResultsPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer
fun realm_list_add_notification_callback(
list: RealmListPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer
fun realm_set_add_notification_callback(
set: RealmSetPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer
fun realm_dictionary_add_notification_callback(
map: RealmMapPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer
fun realm_object_changes_get_modified_properties(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ import org.mongodb.kbson.ObjectId
actual val INVALID_CLASS_KEY: ClassKey by lazy { ClassKey(realmc.getRLM_INVALID_CLASS_KEY()) }
actual val INVALID_PROPERTY_KEY: PropertyKey by lazy { PropertyKey(realmc.getRLM_INVALID_PROPERTY_KEY()) }

// The value to pass to JNI functions that accept longs as replacements for pointers and need
// to represent null.
const val NULL_POINTER_VALUE = 0L

/**
* JVM/Android interop implementation.
*
Expand Down Expand Up @@ -813,14 +817,22 @@ actual object RealmInterop {
return realmc.realm_dictionary_is_valid(dictionary.cptr())
}

actual fun realm_create_key_paths_array(realm: RealmPointer, clazz: ClassKey, keyPaths: List<String>): RealmKeyPathArrayPointer {
val ptr = realmc.realm_create_key_path_array(realm.cptr(), clazz.key, keyPaths.size.toLong(), keyPaths.toTypedArray())
return LongPointerWrapper(ptr)
}

actual fun realm_object_add_notification_callback(
obj: RealmObjectPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer {

return LongPointerWrapper(
realmc.register_notification_cb(
obj.cptr(),
CollectionType.RLM_COLLECTION_TYPE_NONE.nativeValue,
keyPaths?.cptr() ?: NULL_POINTER_VALUE,
object : NotificationCallback {
override fun onChange(pointer: Long) {
callback.onChange(LongPointerWrapper(realmc.realm_clone(pointer), true))
Expand All @@ -833,11 +845,13 @@ actual object RealmInterop {

actual fun realm_results_add_notification_callback(
results: RealmResultsPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer {
return LongPointerWrapper(
realmc.register_results_notification_cb(
results.cptr(),
keyPaths?.cptr() ?: NULL_POINTER_VALUE,
object : NotificationCallback {
override fun onChange(pointer: Long) {
callback.onChange(LongPointerWrapper(realmc.realm_clone(pointer), true))
Expand All @@ -850,12 +864,14 @@ actual object RealmInterop {

actual fun realm_list_add_notification_callback(
list: RealmListPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer {
return LongPointerWrapper(
realmc.register_notification_cb(
list.cptr(),
CollectionType.RLM_COLLECTION_TYPE_LIST.nativeValue,
keyPaths?.cptr() ?: NULL_POINTER_VALUE,
object : NotificationCallback {
override fun onChange(pointer: Long) {
callback.onChange(LongPointerWrapper(realmc.realm_clone(pointer), true))
Expand All @@ -868,12 +884,14 @@ actual object RealmInterop {

actual fun realm_set_add_notification_callback(
set: RealmSetPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer {
return LongPointerWrapper(
realmc.register_notification_cb(
set.cptr(),
CollectionType.RLM_COLLECTION_TYPE_SET.nativeValue,
keyPaths?.cptr() ?: NULL_POINTER_VALUE,
object : NotificationCallback {
override fun onChange(pointer: Long) {
callback.onChange(LongPointerWrapper(realmc.realm_clone(pointer), true))
Expand All @@ -886,12 +904,14 @@ actual object RealmInterop {

actual fun realm_dictionary_add_notification_callback(
map: RealmMapPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer {
return LongPointerWrapper(
realmc.register_notification_cb(
map.cptr(),
CollectionType.RLM_COLLECTION_TYPE_DICTIONARY.nativeValue,
keyPaths?.cptr() ?: NULL_POINTER_VALUE,
object : NotificationCallback {
override fun onChange(pointer: Long) {
callback.onChange(LongPointerWrapper(realmc.realm_clone(pointer), true))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import kotlinx.cinterop.COpaquePointer
import kotlinx.cinterop.CPointed
import kotlinx.cinterop.CPointer
import kotlinx.cinterop.CPointerVar
import kotlinx.cinterop.CPointerVarOf
import kotlinx.cinterop.CValue
import kotlinx.cinterop.CVariable
import kotlinx.cinterop.LongVar
Expand All @@ -70,6 +71,7 @@ import kotlinx.cinterop.readValue
import kotlinx.cinterop.refTo
import kotlinx.cinterop.set
import kotlinx.cinterop.staticCFunction
import kotlinx.cinterop.toCStringArray
import kotlinx.cinterop.toKString
import kotlinx.cinterop.useContents
import kotlinx.cinterop.usePinned
Expand Down Expand Up @@ -1653,8 +1655,17 @@ actual object RealmInterop {
checkedBooleanResult(realm_wrapper.realm_object_delete(obj.cptr()))
}

actual fun realm_create_key_paths_array(realm: RealmPointer, clazz: ClassKey, keyPaths: List<String>): RealmKeyPathArrayPointer {
memScoped {
val userKeyPaths: CPointer<CPointerVarOf<CPointer<ByteVarOf<Byte>>>> = keyPaths.toCStringArray(this)
val keyPathPointer = realm_wrapper.realm_create_key_path_array(realm.cptr(), clazz.key.toUInt(), keyPaths.size.toULong(), userKeyPaths)
return CPointerWrapper(keyPathPointer)
}
}

actual fun realm_object_add_notification_callback(
obj: RealmObjectPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer {
return CPointerWrapper(
Expand All @@ -1667,7 +1678,7 @@ actual object RealmInterop {
?.dispose()
?: error("Notification callback data should never be null")
},
null, // See https://github.com/realm/realm-kotlin/issues/661
keyPaths?.cptr(),
staticCFunction { userdata, change -> // Change callback
try {
userdata?.asStableRef<Callback<RealmChangesPointer>>()
Expand All @@ -1688,6 +1699,7 @@ actual object RealmInterop {

actual fun realm_results_add_notification_callback(
results: RealmResultsPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer {
return CPointerWrapper(
Expand All @@ -1700,7 +1712,7 @@ actual object RealmInterop {
?.dispose()
?: error("Notification callback data should never be null")
},
null, // See https://github.com/realm/realm-kotlin/issues/661
keyPaths?.cptr(),
staticCFunction { userdata, change -> // Change callback
try {
userdata?.asStableRef<Callback<RealmChangesPointer>>()
Expand All @@ -1721,6 +1733,7 @@ actual object RealmInterop {

actual fun realm_list_add_notification_callback(
list: RealmListPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer {
return CPointerWrapper(
Expand All @@ -1732,7 +1745,7 @@ actual object RealmInterop {
userdata?.asStableRef<Callback<RealmChangesPointer>>()?.dispose()
?: error("Notification callback data should never be null")
},
null, // See https://github.com/realm/realm-kotlin/issues/661
keyPaths?.cptr(),
staticCFunction { userdata, change -> // Change callback
try {
userdata?.asStableRef<Callback<RealmChangesPointer>>()
Expand All @@ -1753,6 +1766,7 @@ actual object RealmInterop {

actual fun realm_set_add_notification_callback(
set: RealmSetPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer {
return CPointerWrapper(
Expand All @@ -1765,7 +1779,7 @@ actual object RealmInterop {
?.dispose()
?: error("Notification callback data should never be null")
},
null, // See https://github.com/realm/realm-kotlin/issues/661
keyPaths?.cptr(),
staticCFunction { userdata, change -> // Change callback
try {
userdata?.asStableRef<Callback<RealmChangesPointer>>()
Expand All @@ -1786,6 +1800,7 @@ actual object RealmInterop {

actual fun realm_dictionary_add_notification_callback(
map: RealmMapPointer,
keyPaths: RealmKeyPathArrayPointer?,
callback: Callback<RealmChangesPointer>
): RealmNotificationTokenPointer {
return CPointerWrapper(
Expand All @@ -1798,7 +1813,7 @@ actual object RealmInterop {
?.dispose()
?: error("Notification callback data should never be null")
},
null, // See https://github.com/realm/realm-kotlin/issues/661
keyPaths?.cptr(),
staticCFunction { userdata, change -> // Change callback
try {
userdata?.asStableRef<Callback<RealmChangesPointer>>()
Expand Down
2 changes: 1 addition & 1 deletion packages/external/core
Submodule core updated 112 files
Loading

0 comments on commit ebfb69d

Please sign in to comment.