From 3747d211026f540e0702c014395b1b73dc5d16a5 Mon Sep 17 00:00:00 2001 From: Christian Melchior Date: Thu, 7 Sep 2023 09:29:05 +0200 Subject: [PATCH 1/2] Fix missing scheduler on Linux and Windows (JVM) (#1503) --- CHANGELOG.md | 26 +++++++++++++++++++ .../kotlin/internal/interop/RealmInterop.kt | 2 +- .../src/main/jni/realm_api_helpers.cpp | 5 ++++ .../src/main/jni/realm_api_helpers.h | 3 +++ .../kotlin/types/annotations/FullText.kt | 5 ++-- .../test/common/VersionTrackingTests.kt | 6 ++++- 6 files changed, 43 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 701de24d39..4a760031e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,29 @@ +## 1.11.1 (YYYY-MM-DD) + +### Enhancements +* None. + +### Fixed +* Opening a Realm would crash with `No built-in scheduler implementation for this platform` on Linux (JVM) and Windows. (Issue [#1502](https://github.com/realm/realm-kotlin/issues/1502), since 1.11.0) + +### 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. + * Ktor 2.1.2 and above. + * Coroutines 1.7.0 and above. + * AtomicFu 0.18.3 and above. + * The new memory model only. See https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility +* Minimum Kbson 0.3.0. +* Minimum Gradle version: 6.8.3. +* Minimum Android Gradle Plugin version: 4.1.3. +* Minimum Android SDK: 16. + +### Internal +* None. + + ## 1.11.0 (2023-09-01) ### Breaking Changes diff --git a/packages/cinterop/src/jvm/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt b/packages/cinterop/src/jvm/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt index b5965d8106..c2b2a07d8f 100644 --- a/packages/cinterop/src/jvm/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt +++ b/packages/cinterop/src/jvm/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt @@ -182,7 +182,7 @@ actual object RealmInterop { } actual fun realm_create_scheduler(): RealmSchedulerPointer = - LongPointerWrapper(realmc.realm_scheduler_make_default()) + LongPointerWrapper(realmc.realm_create_generic_scheduler()) actual fun realm_create_scheduler(dispatcher: CoroutineDispatcher): RealmSchedulerPointer = LongPointerWrapper(realmc.realm_create_scheduler(JVMScheduler(dispatcher))) diff --git a/packages/jni-swig-stub/src/main/jni/realm_api_helpers.cpp b/packages/jni-swig-stub/src/main/jni/realm_api_helpers.cpp index e22bec122e..392e1a7797 100644 --- a/packages/jni-swig-stub/src/main/jni/realm_api_helpers.cpp +++ b/packages/jni-swig-stub/src/main/jni/realm_api_helpers.cpp @@ -1048,3 +1048,8 @@ realm_sync_thread_error(realm_userdata_t userdata, const char* error) { env->CallVoidMethod(static_cast(userdata), java_callback_method, to_jstring(env, msg)); jni_check_exception(env); } + +realm_scheduler_t* +realm_create_generic_scheduler() { + return new realm_scheduler_t { realm::util::Scheduler::make_dummy() }; +} diff --git a/packages/jni-swig-stub/src/main/jni/realm_api_helpers.h b/packages/jni-swig-stub/src/main/jni/realm_api_helpers.h index cc845116ed..210202a6c9 100644 --- a/packages/jni-swig-stub/src/main/jni/realm_api_helpers.h +++ b/packages/jni-swig-stub/src/main/jni/realm_api_helpers.h @@ -134,4 +134,7 @@ realm_sync_thread_destroyed(realm_userdata_t userdata); void realm_sync_thread_error(realm_userdata_t userdata, const char* error); +realm_scheduler_t* +realm_create_generic_scheduler(); + #endif //TEST_REALM_API_HELPERS_H diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/FullText.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/FullText.kt index 59f0a1bd39..8352bf3e1d 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/FullText.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/FullText.kt @@ -16,10 +16,11 @@ package io.realm.kotlin.types.annotations * * The full-text index currently support this set of features: * - * - Only token or word search, e.g. `bio TEXT 'computer dancing'` will find all objects that + * - Token or word search, e.g. `bio TEXT 'computer dancing'` will find all objects that * contains the words `computer` and `dancing` in their `bio` property. * - Tokens are diacritics- and case-insensitive, e.g.`bio TEXT 'cafe dancing'` and * `bio TEXT 'café DANCING'` will return the same set of matches. + * - Token prefix search can be done using `*`, like `bio TEXT comp*`. * - Ignoring results with certain tokens are done using `-`, e.g. `bio TEXT 'computer -dancing'` * will find all objects that contain `computer` but not `dancing`. * - Tokens are defined by a simple tokenizer that uses the following rules: @@ -29,7 +30,7 @@ package io.realm.kotlin.types.annotations * * Note the following constraints before using full-text search: * - * - Token prefix or suffix search like `bio TEXT 'comp* *cing'` is not supported. + * - Token suffix search like `bio TEXT '*cing'` is not supported. * - Only ASCII and Latin-1 alphanumerical chars are included in the index (most western languages). * - Only boolean match is supported, i.e. "found" or "not found". It is not possible to sort * results by "relevance" . diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/VersionTrackingTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/VersionTrackingTests.kt index 37d59c81fb..919c21ba0d 100644 --- a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/VersionTrackingTests.kt +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/VersionTrackingTests.kt @@ -81,7 +81,11 @@ class VersionTrackingTests { realm.activeVersions().run { assertEquals(1, all.size) assertEquals(1, allTracked.size) - assertNull(notifier) + // The notifier might or might not had time to run + notifier?.let { + assertEquals(2, it.current.version) + assertEquals(0, it.active.size) + } assertNull(writer) } } From 4a13372c76f73e580166eb81bad03cd0157a84f0 Mon Sep 17 00:00:00 2001 From: Christian Melchior Date: Thu, 7 Sep 2023 11:37:01 +0200 Subject: [PATCH 2/2] Release v1.11.1 --- CHANGELOG.md | 2 +- buildSrc/src/main/kotlin/Config.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a760031e7..c3503f7247 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 1.11.1 (YYYY-MM-DD) +## 1.11.1 (2023-09-07) ### Enhancements * None. diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index 3904ff661d..35da021942 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -62,7 +62,7 @@ val HOST_OS: OperatingSystem = findHostOs() object Realm { val ciBuild = (System.getenv("JENKINS_HOME") != null) - const val version = "1.11.1-SNAPSHOT" + const val version = "1.11.1" const val group = "io.realm.kotlin" const val projectUrl = "https://realm.io" const val pluginPortalId = "io.realm.kotlin"