From cf9a783c1cd24dd1378621c4c819c9dce2991581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Wed, 28 Feb 2024 11:48:59 +0100 Subject: [PATCH 01/23] Update to Core 14.0.1 --- CHANGELOG.md | 6 ++++-- .../kotlin/internal/interop/RealmInterop.kt | 18 +++++++++++++++--- .../kotlin/internal/interop/RealmInterop.kt | 12 +++++++++--- packages/external/core | 2 +- packages/jni-swig-stub/realm.i | 4 +++- 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 005102ab14..b9ee711b6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,8 @@ ## 1.14.0 (2024-03-08) +This release will bump the Realm file format from version 23 to 24. Opening a file with an older format will automatically upgrade it from fileformat v10. If you want to upgrade from an earlier file format version you will have to use Realm Kotlin v1.13.1 or earlier. Downgrading to a previous file format is not possible. + ### Breaking Changes * None. @@ -124,9 +126,9 @@ ### Internal * Update to Ktor 2.3.4. * Updated to CMake 3.27.7 -* Updated to Realm Core 13.26.0, commit 5533505d18fda93a7a971d58a191db5005583c92. +* Updated to Realm Core 14.0.1 commit b1d32d3d20fcb80c747aad6b37b4a9d9179e0730. * Adding Sync tests via Github Action. -* Updated to Swig 4.2.0. (Issue [GitHub #1632](https://github.com/realm/realm-kotlin/issues/1632)[JIRA RKOTLIN-1001](https://jira.mongodb.org/browse/RKOTLIN-1001)) +* Updated to Swig 4.2.0. (Issue [GitHub #1632](https://github.com/realm/realm-kotlin/issues/1632) [JIRA RKOTLIN-1001](https://jira.mongodb.org/browse/RKOTLIN-1001)) ## 1.13.1-SNAPSHOT (YYYY-MM-DD) 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 b79c41f4f4..58254b507c 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 @@ -942,7 +942,11 @@ actual object RealmInterop { val deletionCount = LongArray(1) val modificationCount = LongArray(1) val movesCount = LongArray(1) + // Not exposed in SDK yet, but could be used to provide optimized notifications when + // collections are cleared. + // https://github.com/realm/realm-kotlin/issues/1498 val collectionWasCleared = BooleanArray(1) + val collectionWasDeleted = BooleanArray(1) realmc.realm_collection_changes_get_num_changes( change.cptr(), @@ -950,7 +954,8 @@ actual object RealmInterop { insertionCount, modificationCount, movesCount, - collectionWasCleared + collectionWasCleared, + collectionWasDeleted, ) val insertionIndices: LongArray = initIndicesArray(insertionCount) @@ -1042,16 +1047,22 @@ actual object RealmInterop { val deletions = longArrayOf(0) val insertions = longArrayOf(0) val modifications = longArrayOf(0) + val collectionWasDeleted = BooleanArray(1) realmc.realm_dictionary_get_changes( change.cptr(), deletions, insertions, - modifications + modifications, + collectionWasDeleted ) val deletionStructs = realmc.new_valueArray(deletions[0].toInt()) val insertionStructs = realmc.new_valueArray(insertions[0].toInt()) val modificationStructs = realmc.new_valueArray(modifications[0].toInt()) + // Not exposed in SDK yet, but could be used to provide optimized notifications when + // collections are cleared. + // https://github.com/realm/realm-kotlin/issues/1498 + val collectionWasCleared = booleanArrayOf(false) realmc.realm_dictionary_get_changed_keys( change.cptr(), deletionStructs, @@ -1059,7 +1070,8 @@ actual object RealmInterop { insertionStructs, insertions, modificationStructs, - modifications + modifications, + collectionWasCleared, ) // TODO optimize - integrate within mem allocator? diff --git a/packages/cinterop/src/nativeDarwin/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt b/packages/cinterop/src/nativeDarwin/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt index 3b0faf5100..640bd75b4e 100644 --- a/packages/cinterop/src/nativeDarwin/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt +++ b/packages/cinterop/src/nativeDarwin/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt @@ -1864,6 +1864,7 @@ actual object RealmInterop { val modificationCount = allocArray(1) val movesCount = allocArray(1) val collectionWasErased = alloc() + val collectionWasDeleted = alloc() realm_wrapper.realm_collection_changes_get_num_changes( change.cptr(), @@ -1871,7 +1872,8 @@ actual object RealmInterop { insertionCount, modificationCount, movesCount, - collectionWasErased.ptr + collectionWasErased.ptr, + collectionWasDeleted.ptr, ) val deletionIndices = initArray(deletionCount) @@ -1953,12 +1955,15 @@ actual object RealmInterop { val deletions = allocArray(1) val insertions = allocArray(1) val modifications = allocArray(1) + val collectionWasCleared = alloc() + val collectionWasDeleted = alloc() realm_wrapper.realm_dictionary_get_changes( change.cptr(), deletions, insertions, - modifications + modifications, + collectionWasDeleted.ptr ) val deletionStructs = allocArray(deletions[0].toInt()) val insertionStructs = allocArray(insertions[0].toInt()) @@ -1971,7 +1976,8 @@ actual object RealmInterop { insertionStructs, insertions, modificationStructs, - modifications + modifications, + collectionWasCleared.ptr ) val deletedKeys = (0 until deletions[0].toInt()).map { diff --git a/packages/external/core b/packages/external/core index 5533505d18..b1d32d3d20 160000 --- a/packages/external/core +++ b/packages/external/core @@ -1 +1 @@ -Subproject commit 5533505d18fda93a7a971d58a191db5005583c92 +Subproject commit b1d32d3d20fcb80c747aad6b37b4a9d9179e0730 diff --git a/packages/jni-swig-stub/realm.i b/packages/jni-swig-stub/realm.i index bbbad4dcbd..9ea8b25428 100644 --- a/packages/jni-swig-stub/realm.i +++ b/packages/jni-swig-stub/realm.i @@ -365,7 +365,9 @@ import static io.realm.kotlin.internal.interop.realm_errno_e.*; // bool output parameter %apply bool* OUTPUT { bool* out_found, bool* did_create, bool* did_delete_realm, bool* out_inserted, bool* erased, bool* out_erased, bool* did_refresh, bool* did_run, - bool* found, bool* out_collection_was_cleared, bool* did_compact }; + bool* found, bool* out_collection_was_cleared, bool* did_compact, + bool* collection_was_cleared, bool* out_collection_was_deleted, + bool* out_was_deleted}; // uint64_t output parameter for realm_get_num_versions %apply int64_t* OUTPUT { uint64_t* out_versions_count }; From fa657b1f084308e238781a0e729f24f78f529798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Wed, 28 Feb 2024 14:42:47 +0100 Subject: [PATCH 02/23] Dump cmake version on GHA build --- .github/workflows/pr.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 22d6735f4f..0f4e05fe77 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -61,8 +61,11 @@ jobs: - name: Setup cmake uses: jwlawson/actions-setup-cmake@v1.13 with: - cmake-version: ${{ vars.VERSION_CMAKE }} - + cmake-version: '${{ vars.VERSION_CMAKE }}' + + - name: Use cmake + run: cmake --version + # Manually install SWIG 4.1.1 as only 4.0.2 is pre-installed # 4.1.1 is not available in apt-get, so use brew instead # We need to use the formulae directly from GitHub to pin the version as Homebrew does not have From fd081ad764e40aac6f4a3a30af4cb6ebe5aaba97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Wed, 28 Feb 2024 14:50:38 +0100 Subject: [PATCH 03/23] Additional GHA debug info --- .github/workflows/pr.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 0f4e05fe77..a19f1efa45 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -122,6 +122,9 @@ jobs: with: cmake-version: ${{ vars.VERSION_CMAKE }} + - name: Use cmake + run: cmake --version + - name: Restore JNI Swig Stubs uses: actions/download-artifact@v3 with: @@ -550,7 +553,10 @@ jobs: - name: Setup cmake uses: jwlawson/actions-setup-cmake@v1.13 with: - cmake-version: ${{ vars.VERSION_CMAKE }} + cmake-version: '${{ vars.VERSION_CMAKE }}' + + - name: Use cmake + run: cmake --version - name: Setup ninja uses: cmelchior/setup-ninja@master From 8a72ac2738b0e22d2ccf667bc8729abb06b6bb24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Wed, 28 Feb 2024 15:07:16 +0100 Subject: [PATCH 04/23] Update CMAKE on JVM linux docker image --- packages/cinterop/src/jvmMain/generic.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cinterop/src/jvmMain/generic.Dockerfile b/packages/cinterop/src/jvmMain/generic.Dockerfile index 627f1c144f..26da693918 100644 --- a/packages/cinterop/src/jvmMain/generic.Dockerfile +++ b/packages/cinterop/src/jvmMain/generic.Dockerfile @@ -21,7 +21,7 @@ ENV PATH /opt/cmake/bin:/opt/rh/rh-git218/root/usr/bin:/opt/rh/devtoolset-9/root ENV LD_LIBRARY_PATH /opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib:/opt/rh/devtoolset-9/root/usr/lib64/dyninst:/opt/rh/devtoolset-9/root/usr/lib/dyninst:/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib RUN mkdir -p /opt/cmake \ - && curl https://cmake.org/files/v3.18/cmake-3.18.2-Linux-x86_64.sh -o /cmake.sh \ + && curl https://cmake.org/files/v3.27/cmake-3.27.7-linux-x86_64.sh -o /cmake.sh \ && sh /cmake.sh --prefix=/opt/cmake --skip-license \ && rm /cmake.sh From e7e1e56ff5cc5c417d514cb7ee3b0fd4ec172643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Wed, 28 Feb 2024 16:15:57 +0100 Subject: [PATCH 05/23] Bump NDK to fix core link issues --- buildSrc/src/main/kotlin/Config.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index fa440841c2..3e602d36f4 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -102,7 +102,7 @@ object Versions { const val compileSdkVersion = 33 const val buildToolsVersion = "33.0.0" const val buildTools = "7.3.1" // https://maven.google.com/web/index.html?q=gradle#com.android.tools.build:gradle - const val ndkVersion = "23.2.8568313" + const val ndkVersion = "24.0.8215888" const val r8 = "8.0.34" // See https://developer.android.com/build/kotlin-support } const val androidxBenchmarkPlugin = "1.2.0-alpha12" // https://maven.google.com/web/index.html#androidx.benchmark:androidx.benchmark.gradle.plugin From eadb514b0609c9e818956397c16ba57ac0035d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Wed, 28 Feb 2024 17:03:53 +0100 Subject: [PATCH 06/23] Bump NDK to fix core link issues --- buildSrc/src/main/kotlin/Config.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index 3e602d36f4..f4352ed15e 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -102,7 +102,7 @@ object Versions { const val compileSdkVersion = 33 const val buildToolsVersion = "33.0.0" const val buildTools = "7.3.1" // https://maven.google.com/web/index.html?q=gradle#com.android.tools.build:gradle - const val ndkVersion = "24.0.8215888" + const val ndkVersion = "26.2.11394342" const val r8 = "8.0.34" // See https://developer.android.com/build/kotlin-support } const val androidxBenchmarkPlugin = "1.2.0-alpha12" // https://maven.google.com/web/index.html#androidx.benchmark:androidx.benchmark.gradle.plugin From 4f3d482d882feff13f8b7a90cc489bae256dc9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Thu, 29 Feb 2024 09:44:19 +0100 Subject: [PATCH 07/23] Fix expected exception text in query test --- .../commonTest/kotlin/io/realm/kotlin/test/common/QueryTests.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/QueryTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/QueryTests.kt index 1292ea5079..0b6eb5dc3c 100644 --- a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/QueryTests.kt +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/QueryTests.kt @@ -114,7 +114,7 @@ class QueryTests { @Test fun query_wrongArgumentTypeThrows() { - assertFailsWithMessage(" Unsupported comparison between type 'string' and type 'bool'") { + assertFailsWithMessage("Cannot compare argument \$0 with value 'true' to a string") { realm.query("stringField = $0", true) } } From 2309bdd08de37003d58e34b9096f9cfe798d3de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Thu, 29 Feb 2024 10:27:53 +0100 Subject: [PATCH 08/23] Clean up debug output --- .github/workflows/pr.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a19f1efa45..d9f99eaac7 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -61,10 +61,7 @@ jobs: - name: Setup cmake uses: jwlawson/actions-setup-cmake@v1.13 with: - cmake-version: '${{ vars.VERSION_CMAKE }}' - - - name: Use cmake - run: cmake --version + cmake-version: ${{ vars.VERSION_CMAKE }} # Manually install SWIG 4.1.1 as only 4.0.2 is pre-installed # 4.1.1 is not available in apt-get, so use brew instead @@ -122,9 +119,6 @@ jobs: with: cmake-version: ${{ vars.VERSION_CMAKE }} - - name: Use cmake - run: cmake --version - - name: Restore JNI Swig Stubs uses: actions/download-artifact@v3 with: @@ -555,9 +549,6 @@ jobs: with: cmake-version: '${{ vars.VERSION_CMAKE }}' - - name: Use cmake - run: cmake --version - - name: Setup ninja uses: cmelchior/setup-ninja@master with: From 4c9d3ebf3e35c8c2e2d7038e9a1401c02ef62913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Thu, 29 Feb 2024 10:35:21 +0100 Subject: [PATCH 09/23] More clean up --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d9f99eaac7..9d463ceb66 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -547,7 +547,7 @@ jobs: - name: Setup cmake uses: jwlawson/actions-setup-cmake@v1.13 with: - cmake-version: '${{ vars.VERSION_CMAKE }}' + cmake-version: ${{ vars.VERSION_CMAKE }} - name: Setup ninja uses: cmelchior/setup-ninja@master From eb08f08c33a7aaf2a364dd61611873b09b2398f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Mon, 4 Mar 2024 11:16:54 +0100 Subject: [PATCH 10/23] Revert NDK to debug arm7v issues --- .github/workflows/pr.yml | 2 +- buildSrc/src/main/kotlin/Config.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9d463ceb66..e7b4a2e8be 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -587,7 +587,7 @@ jobs: - name: Build packages working-directory: packages - run: ./gradlew publishCIPackages -Prealm.kotlin.targets=android -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false + run: ./gradlew publishCIPackages -Prealm.kotlin.targets=android -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false --info - name: Store build cache uses: actions/cache@v3 diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index f4352ed15e..fa440841c2 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -102,7 +102,7 @@ object Versions { const val compileSdkVersion = 33 const val buildToolsVersion = "33.0.0" const val buildTools = "7.3.1" // https://maven.google.com/web/index.html?q=gradle#com.android.tools.build:gradle - const val ndkVersion = "26.2.11394342" + const val ndkVersion = "23.2.8568313" const val r8 = "8.0.34" // See https://developer.android.com/build/kotlin-support } const val androidxBenchmarkPlugin = "1.2.0-alpha12" // https://maven.google.com/web/index.html#androidx.benchmark:androidx.benchmark.gradle.plugin From 309ffa88398ed9ca297b6bbcfed5aba6600ff683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Mon, 4 Mar 2024 11:24:19 +0100 Subject: [PATCH 11/23] More debug info --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index e7b4a2e8be..9d1b163f43 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -579,11 +579,11 @@ jobs: - name: Build Android Base Test Apk working-directory: packages - run: ./gradlew :test-base:assembleAndroidTest -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false + run: ./gradlew :test-base:assembleAndroidTest -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false --info - name: Build Android Sync Test Apk working-directory: packages - run: ./gradlew :test-sync:packageDebug :test-sync:assembleAndroidTest -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false + run: ./gradlew :test-sync:packageDebug :test-sync:assembleAndroidTest -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false --info - name: Build packages working-directory: packages From c7353cd8037898f9ec0b80e534c8e359f7863c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Wed, 6 Mar 2024 15:00:28 +0100 Subject: [PATCH 12/23] Included core updates in CHANGELOG --- CHANGELOG.md | 133 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 84 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9ee711b6f..c11ce7cede 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,32 +1,96 @@ ## 1.15.0-SNAPSHOT (YYYY-MM-DD) -### Breaking Changes -- None. +[!NOTE] +This release will bump the Realm file format from version 23 to 24. Opening a file with an older format will automatically upgrade it from fileformat v10. If you want to upgrade from an earlier file format version you will have to use Realm Kotlin v1.13.1 or earlier. Downgrading to a previous file format is not possible. + +### Breaking changes +### Core-14.0.0 +* If you want to query using @type operation, you must use 'objectlink' to match links to objects. 'object' is reserved for dictionary types. +### Core-14.0.0-beta0 + + +* BinaryData and StringData are now strongly typed for comparisons and queries. This change is especially relevant when querying for a string constant on a Mixed property, as now only strings will be returned. If searching for BinaryData is desired, then that type must be specified by the constant. In RQL the new way to specify a binary constant is to use `mixed = bin('xyz')` or `mixed = binary('xyz')`. ([6407](https://github.com/realm/realm-core/issues/6407)). + +* Sorting order of strings has changed to use standard unicode codepoint order instead of grouping similar english letters together. A noticeable change will be from "aAbBzZ" to "ABZabz". ([2573](https://github.com/realm/realm-core/issues/2573)) ### Enhancements -- None. +### Core-14.1.0 +* Add support for using aggregate operations on Mixed properties in queries ([PR #7398](https://github.com/realm/realm-core/pull/7398)) +### Core-14.0.0 +* Property keypath in RQL can be substituted with value given as argument. Use '$P' in query string. (Issue [#7033](https://github.com/realm/realm-core/issues/7033)) +* You can now use query substitution for the @type argument ([#7289](https://github.com/realm/realm-core/issues/7289)) +### Core-14.0.0-beta0 +* Storage of Decimal128 properties has been optimised so that the individual values will take up 0 bits (if all nulls), 32 bits, 64 bits or 128 bits depending on what is needed. (PR [#6111](https://github.com/realm/realm-core/pull/6111)) +* Querying a specific entry in a collection (in particular 'first and 'last') is supported. (PR [#4269](https://github.com/realm/realm-core/issues/4269)) +* Index on list of strings property now supported (PR [#7142](https://github.com/realm/realm-core/pull/7142)) +### 13.27.0 + + +* Improved performance of RQL (parsed) queries on a non-linked string property using: >, >=, <, <=, operators and fixed behaviour that a null string should be evaulated as less than everything, previously nulls were not matched. ([#3939](https://github.com/realm/realm-core/issues/3939), this is a prerequisite for https://github.com/realm/realm-swift/issues/8008). +* Updated bundled OpenSSL version to 3.2.0 (PR [#7303](https://github.com/realm/realm-core/pull/7303)) + + + + ### Fixed -- None. +### Core-14.1.0 + + + + + + + + +### Core-14.0.0 + + + + + +* `@count`/`@size` is now supported for mixed properties ([#7280](https://github.com/realm/realm-core/issues/7280), since v10.0.0) + + + + +### Core-14.0.0-beta0 + +* Fixed equality queries on a Mixed property with an index possibly returning the wrong result if values of different types happened to have the same StringIndex hash. ([6407](https://github.com/realm/realm-core/issues/6407) since v11.0.0-beta.5). +* If you have more than 8388606 links pointing to one specific object, the program will crash. ([#6577](https://github.com/realm/realm-core/issues/6577), since v6.0.0) +* Query for NULL value in Dictionary would give wrong results ([6748])(https://github.com/realm/realm-core/issues/6748), since v10.0.0) + +### 13.27.0 +* Fixed queries like `indexed_property == NONE {x}` which mistakenly matched on only x instead of not x. This only applies when an indexed property with equality (==, or IN) matches with `NONE` on a list of one item. If the constant list contained more than one value then it was working correctly. ([realm-js #7862](https://github.com/realm/realm-java/issues/7862), since v12.5.0) +* Uploading the changesets recovered during an automatic client reset recovery may lead to 'Bad server version' errors and a new client reset. ([#7279](https://github.com/realm/realm-core/issues/7279), since v13.24.1) + +* Fixed crash in fulltext index using prefix search with no matches ([#7309](https://github.com/realm/realm-core/issues/7309), since v13.18.0) + + + + +* Fix a minor race condition when backing up Realm files before a client reset which could have lead to overwriting an existing file. ([PR #7341](https://github.com/realm/realm-core/pull/7341)). ### 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.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. - - 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. -- Minimum R8: 8.0.34. +* File format: Generates Realms with file format v24 (reads and upgrades file format v10 or later). +* Realm Studio 15.0.0 or above is required to open Realms created by this version. +* This release is compatible with the following Kotlin releases: + * 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. + * 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. +* Minimum R8: 8.0.34. ### Internal +- Updated to Realm Core 14.1.0 commit b1d32d3d20fcb80c747aad6b37b4a9d9179e0730. - Remove CMake required version. + ## 1.14.2-SNAPSHOT (YYYY-MM-DD) ### Breaking Changes @@ -104,6 +168,8 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi * Cache notification callback JNI references at startup to ensure that symbols can be resolved in core callbacks. (Issue [#1577](https://github.com/realm/realm-kotlin/issues/1577)) * Using `Realm.asFlow()` could miss an update if a write was started right after opening the Realm. (Issue [#1582](https://github.com/realm/realm-kotlin/issues/1582)) * Guarded analytic errors so that they do not fail user builds. +* Using keypaths in Flows could sometimes throw `java.lang.IllegalStateException: [RLM_ERR_WRONG_THREAD]: Realm accessed from incorrect thread.`. (Issue [#1594](https://github.com/realm/realm-kotlin/pull/1594, since 1.13.0) +* Non-`IllegalStateExceptions` in a `write`-block would not cancel transactions, but leave it open. (Issue [#1615](https://github.com/realm/realm-kotlin/issues/1615)). * [Sync] `NullPointerException` while waiting for the synchronization of a subscription set if the client was set in `AwaitingMark` state. (Issue [#1671](https://github.com/realm/realm-kotlin/issues/1671) [JIRA](https://jira.mongodb.org/browse/RKOTLIN-1027)) * Github Action: Snapshot publishing with Github Action. (Issue [#1654](https://github.com/realm/realm-kotlin/issues/1654) [JIRA](https://jira.mongodb.org/browse/RKOTLIN-1018)) * Github Action: automate release process to Maven Central. (Issue [JIRA](https://jira.mongodb.org/browse/RKOTLIN-709)) @@ -126,42 +192,11 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi ### Internal * Update to Ktor 2.3.4. * Updated to CMake 3.27.7 -* Updated to Realm Core 14.0.1 commit b1d32d3d20fcb80c747aad6b37b4a9d9179e0730. +* Updated to Realm Core 13.26.0, commit 5533505d18fda93a7a971d58a191db5005583c92. * Adding Sync tests via Github Action. * Updated to Swig 4.2.0. (Issue [GitHub #1632](https://github.com/realm/realm-kotlin/issues/1632) [JIRA RKOTLIN-1001](https://jira.mongodb.org/browse/RKOTLIN-1001)) -## 1.13.1-SNAPSHOT (YYYY-MM-DD) - -### Breaking Changes -* None. - -### Enhancements -* None. - -### Fixed -* Using keypaths in Flows could sometimes throw `java.lang.IllegalStateException: [RLM_ERR_WRONG_THREAD]: Realm accessed from incorrect thread.`. (Issue [#1594](https://github.com/realm/realm-kotlin/pull/1594, since 1.13.0) -* Non-`IllegalStateExceptions` in a `write`-block would not cancel transactions, but leave it open. (Issue [#1615](https://github.com/realm/realm-kotlin/issues/1615)). - -### 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.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. - * 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. -* Minimum R8: 8.0.34. - -### Internal -* None. - - ## 1.13.0 (2023-12-01) ### Breaking Changes From e8a053e8469b8bd5338e233cb053043c2228019b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Wed, 6 Mar 2024 15:00:28 +0100 Subject: [PATCH 13/23] Included core updates in CHANGELOG --- CHANGELOG.md | 2 +- packages/external/core | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c11ce7cede..1b1dc36a3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -87,7 +87,7 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi * Minimum R8: 8.0.34. ### Internal -- Updated to Realm Core 14.1.0 commit b1d32d3d20fcb80c747aad6b37b4a9d9179e0730. +- Updated to Realm Core 14.1.0 commit 08c61e87add15b0d7fcd52c818c43fb4804e1216. - Remove CMake required version. diff --git a/packages/external/core b/packages/external/core index b1d32d3d20..08c61e87ad 160000 --- a/packages/external/core +++ b/packages/external/core @@ -1 +1 @@ -Subproject commit b1d32d3d20fcb80c747aad6b37b4a9d9179e0730 +Subproject commit 08c61e87add15b0d7fcd52c818c43fb4804e1216 From fd856aeee7d383d5bdb7f2e13b2d05ba152a1b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Wed, 6 Mar 2024 15:20:26 +0100 Subject: [PATCH 14/23] Cleanup CHANGELOG --- CHANGELOG.md | 79 ++++++++++++---------------------------------------- 1 file changed, 18 insertions(+), 61 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b1dc36a3c..1c5e9cf845 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,72 +4,29 @@ This release will bump the Realm file format from version 23 to 24. Opening a file with an older format will automatically upgrade it from fileformat v10. If you want to upgrade from an earlier file format version you will have to use Realm Kotlin v1.13.1 or earlier. Downgrading to a previous file format is not possible. ### Breaking changes -### Core-14.0.0 * If you want to query using @type operation, you must use 'objectlink' to match links to objects. 'object' is reserved for dictionary types. -### Core-14.0.0-beta0 - - -* BinaryData and StringData are now strongly typed for comparisons and queries. This change is especially relevant when querying for a string constant on a Mixed property, as now only strings will be returned. If searching for BinaryData is desired, then that type must be specified by the constant. In RQL the new way to specify a binary constant is to use `mixed = bin('xyz')` or `mixed = binary('xyz')`. ([6407](https://github.com/realm/realm-core/issues/6407)). - -* Sorting order of strings has changed to use standard unicode codepoint order instead of grouping similar english letters together. A noticeable change will be from "aAbBzZ" to "ABZabz". ([2573](https://github.com/realm/realm-core/issues/2573)) +* Binary data and String data are now strongly typed for comparisons and queries. This change is especially relevant when querying for a string constant on a RealmAny property, as now only strings will be returned. If searching for Binary data is desired, then that type must be specified by the constant. In RQL the new way to specify a binary constant is to use `mixed = bin('xyz')` or `mixed = binary('xyz')`. (Core issue [realm/realm-core#6407](https://github.com/realm/realm-core/issues/6407)). +* Sorting order of strings has changed to use standard unicode codepoint order instead of grouping similar english letters together. A noticeable change will be from "aAbBzZ" to "ABZabz". (Core issue [realm/realm-core#2573](https://github.com/realm/realm-core/issues/2573)) ### Enhancements -### Core-14.1.0 -* Add support for using aggregate operations on Mixed properties in queries ([PR #7398](https://github.com/realm/realm-core/pull/7398)) -### Core-14.0.0 -* Property keypath in RQL can be substituted with value given as argument. Use '$P' in query string. (Issue [#7033](https://github.com/realm/realm-core/issues/7033)) -* You can now use query substitution for the @type argument ([#7289](https://github.com/realm/realm-core/issues/7289)) -### Core-14.0.0-beta0 -* Storage of Decimal128 properties has been optimised so that the individual values will take up 0 bits (if all nulls), 32 bits, 64 bits or 128 bits depending on what is needed. (PR [#6111](https://github.com/realm/realm-core/pull/6111)) -* Querying a specific entry in a collection (in particular 'first and 'last') is supported. (PR [#4269](https://github.com/realm/realm-core/issues/4269)) -* Index on list of strings property now supported (PR [#7142](https://github.com/realm/realm-core/pull/7142)) -### 13.27.0 - - -* Improved performance of RQL (parsed) queries on a non-linked string property using: >, >=, <, <=, operators and fixed behaviour that a null string should be evaulated as less than everything, previously nulls were not matched. ([#3939](https://github.com/realm/realm-core/issues/3939), this is a prerequisite for https://github.com/realm/realm-swift/issues/8008). -* Updated bundled OpenSSL version to 3.2.0 (PR [#7303](https://github.com/realm/realm-core/pull/7303)) - - - - +* Add support for using aggregate operations on RealmAny properties in queries (Core issue [realm/realm-core#7398](https://github.com/realm/realm-core/pull/7398)) +* Property keypath in RQL can be substituted with value given as argument. Use '$P' in query string. (Core issue [realm/realm-core#7033](https://github.com/realm/realm-core/issues/7033)) +* You can now use query substitution for the @type argument (Core issue [realm/realm-core#7289](https://github.com/realm/realm-core/issues/7289)) +* Storage of Decimal128 properties has been optimised so that the individual values will take up 0 bits (if all nulls), 32 bits, 64 bits or 128 bits depending on what is needed. (Core issue [realm/realm-core#6111](https://github.com/realm/realm-core/pull/6111)) +* Querying a specific entry in a collection (in particular 'first and 'last') is supported. (Core issue [realm/realm-core#4269](https://github.com/realm/realm-core/issues/4269)) +* Index on list of strings property now supported (Core issue [realm/realm-core#7142](https://github.com/realm/realm-core/pull/7142)) +* Improved performance of RQL (parsed) queries on a non-linked string property using: >, >=, <, <=, operators and fixed behaviour that a null string should be evaulated as less than everything, previously nulls were not matched. (Core issue [realm/realm-core#3939](https://github.com/realm/realm-core/issues/3939). +* Updated bundled OpenSSL version to 3.2.0 (Core issue [realm/realm-core#7303](https://github.com/realm/realm-core/pull/7303)) ### Fixed -### Core-14.1.0 - - - - - - - - -### Core-14.0.0 - - - - - -* `@count`/`@size` is now supported for mixed properties ([#7280](https://github.com/realm/realm-core/issues/7280), since v10.0.0) - - - - -### Core-14.0.0-beta0 - -* Fixed equality queries on a Mixed property with an index possibly returning the wrong result if values of different types happened to have the same StringIndex hash. ([6407](https://github.com/realm/realm-core/issues/6407) since v11.0.0-beta.5). -* If you have more than 8388606 links pointing to one specific object, the program will crash. ([#6577](https://github.com/realm/realm-core/issues/6577), since v6.0.0) -* Query for NULL value in Dictionary would give wrong results ([6748])(https://github.com/realm/realm-core/issues/6748), since v10.0.0) - -### 13.27.0 -* Fixed queries like `indexed_property == NONE {x}` which mistakenly matched on only x instead of not x. This only applies when an indexed property with equality (==, or IN) matches with `NONE` on a list of one item. If the constant list contained more than one value then it was working correctly. ([realm-js #7862](https://github.com/realm/realm-java/issues/7862), since v12.5.0) -* Uploading the changesets recovered during an automatic client reset recovery may lead to 'Bad server version' errors and a new client reset. ([#7279](https://github.com/realm/realm-core/issues/7279), since v13.24.1) - -* Fixed crash in fulltext index using prefix search with no matches ([#7309](https://github.com/realm/realm-core/issues/7309), since v13.18.0) - - - - -* Fix a minor race condition when backing up Realm files before a client reset which could have lead to overwriting an existing file. ([PR #7341](https://github.com/realm/realm-core/pull/7341)). +* `@count`/`@size` is now supported for `RealmAny` properties (Core issue [realm/realm-core#7280](https://github.com/realm/realm-core/issues/7280), since v10.0.0) +* Fixed equality queries on a `RealmAny` property with an index possibly returning the wrong result if values of different types happened to have the same StringIndex hash. (Core issue [realm/realm-core6407](https://github.com/realm/realm-core/issues/6407) since v11.0.0-beta.5). +* If you have more than 8388606 links pointing to one specific object, the program will crash. (Core issue [realm/realm-core#6577](https://github.com/realm/realm-core/issues/6577), since v6.0.0) +* Query for NULL value in `RealmAny` would give wrong results (Core issue [realm/realm-core6748])(https://github.com/realm/realm-core/issues/6748), since v10.0.0) +* Fixed queries like `indexed_property == NONE {x}` which mistakenly matched on only x instead of not x. This only applies when an indexed property with equality (==, or IN) matches with `NONE` on a list of one item. If the constant list contained more than one value then it was working correctly. (Core issue [realm/realm-core#7777](https://github.com/realm/realm-java/issues/7862), since v12.5.0) +* Uploading the changesets recovered during an automatic client reset recovery may lead to 'Bad server version' errors and a new client reset. (Core issue [realm/realm-core7279](https://github.com/realm/realm-core/issues/7279), since v13.24.1) +* Fixed crash in fulltext index using prefix search with no matches (Core issue [realm/realm-core#7309](https://github.com/realm/realm-core/issues/7309), since v13.18.0) +* Fix a minor race condition when backing up Realm files before a client reset which could have lead to overwriting an existing file. (Core issue [realm/realm-core#7341](https://github.com/realm/realm-core/pull/7341)). ### Compatibility * File format: Generates Realms with file format v24 (reads and upgrades file format v10 or later). From 351e74d2f07583a335b5ee87bb7845b814152b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Tue, 2 Apr 2024 15:22:58 +0200 Subject: [PATCH 15/23] Upgrade to Core 14.2.0 --- CHANGELOG.md | 2 +- packages/external/core | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c5e9cf845..449f1d82ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,7 +44,7 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi * Minimum R8: 8.0.34. ### Internal -- Updated to Realm Core 14.1.0 commit 08c61e87add15b0d7fcd52c818c43fb4804e1216. +- Updated to Realm Core 14.2.0 commit 383bdc81e36293b22868ee085a6f5c265115556d. - Remove CMake required version. diff --git a/packages/external/core b/packages/external/core index 08c61e87ad..383bdc81e3 160000 --- a/packages/external/core +++ b/packages/external/core @@ -1 +1 @@ -Subproject commit 08c61e87add15b0d7fcd52c818c43fb4804e1216 +Subproject commit 383bdc81e36293b22868ee085a6f5c265115556d From bd913233fda16a797ab5c8e88c2c0ccdc1070103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Fri, 15 Mar 2024 09:32:00 +0100 Subject: [PATCH 16/23] Update CHANGELOG.md Co-authored-by: clementetb --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 449f1d82ea..8234350eee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ## 1.15.0-SNAPSHOT (YYYY-MM-DD) [!NOTE] -This release will bump the Realm file format from version 23 to 24. Opening a file with an older format will automatically upgrade it from fileformat v10. If you want to upgrade from an earlier file format version you will have to use Realm Kotlin v1.13.1 or earlier. Downgrading to a previous file format is not possible. +This release will bump the Realm file format from version 23 to 24. Opening a file with an older format will automatically upgrade it from file format v10. If you want to upgrade from an earlier file format version you will have to use Realm Kotlin v1.13.1 or earlier. Downgrading to a previous file format is not possible. ### Breaking changes * If you want to query using @type operation, you must use 'objectlink' to match links to objects. 'object' is reserved for dictionary types. From 835fb8de3f94df98699d85cc6e5b970847cbe147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Mon, 18 Mar 2024 10:35:22 +0100 Subject: [PATCH 17/23] Read core version from dependencies.yml --- packages/gradle-plugin/build.gradle.kts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/gradle-plugin/build.gradle.kts b/packages/gradle-plugin/build.gradle.kts index 09ac559bbd..673c3ab092 100644 --- a/packages/gradle-plugin/build.gradle.kts +++ b/packages/gradle-plugin/build.gradle.kts @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import kotlin.text.toBoolean +import org.yaml.snakeyaml.Yaml +import java.io.FileInputStream plugins { kotlin("jvm") @@ -22,6 +23,12 @@ plugins { id("realm-publisher") } +buildscript { + dependencies { + classpath("org.yaml:snakeyaml:1.33") + } +} + dependencies { compileOnly(kotlin("gradle-plugin")) compileOnly("com.android.tools.build:gradle:${Versions.Android.buildTools}") @@ -96,16 +103,16 @@ sourceSets { // Task to generate gradle plugin runtime constants for SDK and core versions tasks.create("versionConstants") { val coreDependenciesFile = layout.projectDirectory.file( - listOf("..", "external", "core", "dependencies.list").joinToString(File.separator) + listOf("..", "external", "core", "dependencies.yml").joinToString(File.separator) ) - val outputDir = file(versionDirectory) - inputs.property("version", project.version) inputs.file(coreDependenciesFile) + inputs.property("version", project.version) + val outputDir = file(versionDirectory) outputs.dir(outputDir) - val versionRegex = "^VERSION=(.*)\$".toRegex() - val coreVersion = providers.fileContents(coreDependenciesFile).asText.get().lineSequence() - .map { dependecy -> versionRegex.find(dependecy)?.groups?.get(1)?.value }.single { it != null } + val yaml = Yaml() + val coreDependencies: Map = yaml.load(FileInputStream(coreDependenciesFile.asFile)) + val coreVersion = coreDependencies["VERSION"] doLast { val versionFile = file("$outputDir/io/realm/kotlin/gradle/version.kt") From 9f17286fafa09e9eac11d553c78d121627e0ce32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Tue, 19 Mar 2024 09:58:41 +0100 Subject: [PATCH 18/23] Apply suggestions from code review Co-authored-by: Nabil Hachicha --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8234350eee..8475b747dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ This release will bump the Realm file format from version 23 to 24. Opening a file with an older format will automatically upgrade it from file format v10. If you want to upgrade from an earlier file format version you will have to use Realm Kotlin v1.13.1 or earlier. Downgrading to a previous file format is not possible. ### Breaking changes -* If you want to query using @type operation, you must use 'objectlink' to match links to objects. 'object' is reserved for dictionary types. +* If you want to query using `@type` operation, you must use 'objectlink' to match links to objects. 'object' is reserved for dictionary types. * Binary data and String data are now strongly typed for comparisons and queries. This change is especially relevant when querying for a string constant on a RealmAny property, as now only strings will be returned. If searching for Binary data is desired, then that type must be specified by the constant. In RQL the new way to specify a binary constant is to use `mixed = bin('xyz')` or `mixed = binary('xyz')`. (Core issue [realm/realm-core#6407](https://github.com/realm/realm-core/issues/6407)). * Sorting order of strings has changed to use standard unicode codepoint order instead of grouping similar english letters together. A noticeable change will be from "aAbBzZ" to "ABZabz". (Core issue [realm/realm-core#2573](https://github.com/realm/realm-core/issues/2573)) From 5c63a0337db167448b3bb798e68005023400b2ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Tue, 19 Mar 2024 10:00:14 +0100 Subject: [PATCH 19/23] Updates according to review comments --- .github/workflows/pr.yml | 6 +++--- CHANGELOG.md | 2 -- buildSrc/src/main/kotlin/Config.kt | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9d1b163f43..9d463ceb66 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -579,15 +579,15 @@ jobs: - name: Build Android Base Test Apk working-directory: packages - run: ./gradlew :test-base:assembleAndroidTest -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false --info + run: ./gradlew :test-base:assembleAndroidTest -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false - name: Build Android Sync Test Apk working-directory: packages - run: ./gradlew :test-sync:packageDebug :test-sync:assembleAndroidTest -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false --info + run: ./gradlew :test-sync:packageDebug :test-sync:assembleAndroidTest -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false - name: Build packages working-directory: packages - run: ./gradlew publishCIPackages -Prealm.kotlin.targets=android -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false --info + run: ./gradlew publishCIPackages -Prealm.kotlin.targets=android -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false - name: Store build cache uses: actions/cache@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8475b747dd..794abee06a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -111,8 +111,6 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi ## 1.14.0 (2024-03-08) -This release will bump the Realm file format from version 23 to 24. Opening a file with an older format will automatically upgrade it from fileformat v10. If you want to upgrade from an earlier file format version you will have to use Realm Kotlin v1.13.1 or earlier. Downgrading to a previous file format is not possible. - ### Breaking Changes * None. diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index fa440841c2..efe9c07a03 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -135,6 +135,7 @@ object Versions { const val relinker = "1.4.5" // https://github.com/KeepSafe/ReLinker const val serialization = "1.6.0" // https://kotlinlang.org/docs/releases.html#release-details const val shadowJar = "6.1.0" // https://mvnrepository.com/artifact/com.github.johnrengelman.shadow/com.github.johnrengelman.shadow.gradle.plugin?repo=gradle-plugins + const val snakeYaml = "1.33" // https://github.com/snakeyaml/snakeyaml val sourceCompatibilityVersion = JavaVersion.VERSION_1_8 // Language level of any Java source code. val targetCompatibilityVersion = JavaVersion.VERSION_1_8 // Version of generated JVM bytecode from Java files. } From b14167ba557489ceab9fd554ac9b9f8b881532cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Tue, 2 Apr 2024 14:39:29 +0200 Subject: [PATCH 20/23] Upgrade to core 14.4.1 --- CHANGELOG.md | 3 ++- packages/external/core | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 794abee06a..9b5443770a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,7 +44,8 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi * Minimum R8: 8.0.34. ### Internal -- Updated to Realm Core 14.2.0 commit 383bdc81e36293b22868ee085a6f5c265115556d. +* Updated to Realm Core 14.4.1 commit 374dd672af357732dccc135fecc905406fec3223. +* Deprecated Jenkins and switching to Github Action ([JIRA]https://jira.mongodb.org/browse/RKOTLIN-825). - Remove CMake required version. diff --git a/packages/external/core b/packages/external/core index 383bdc81e3..374dd672af 160000 --- a/packages/external/core +++ b/packages/external/core @@ -1 +1 @@ -Subproject commit 383bdc81e36293b22868ee085a6f5c265115556d +Subproject commit 374dd672af357732dccc135fecc905406fec3223 From 45fec71450f5fd233325a3049f22ac7d3f56c1a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Tue, 2 Apr 2024 14:57:31 +0200 Subject: [PATCH 21/23] Update CHANGELOG --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b5443770a..97522e2955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,6 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi ### Breaking changes * If you want to query using `@type` operation, you must use 'objectlink' to match links to objects. 'object' is reserved for dictionary types. * Binary data and String data are now strongly typed for comparisons and queries. This change is especially relevant when querying for a string constant on a RealmAny property, as now only strings will be returned. If searching for Binary data is desired, then that type must be specified by the constant. In RQL the new way to specify a binary constant is to use `mixed = bin('xyz')` or `mixed = binary('xyz')`. (Core issue [realm/realm-core#6407](https://github.com/realm/realm-core/issues/6407)). -* Sorting order of strings has changed to use standard unicode codepoint order instead of grouping similar english letters together. A noticeable change will be from "aAbBzZ" to "ABZabz". (Core issue [realm/realm-core#2573](https://github.com/realm/realm-core/issues/2573)) ### Enhancements * Add support for using aggregate operations on RealmAny properties in queries (Core issue [realm/realm-core#7398](https://github.com/realm/realm-core/pull/7398)) @@ -19,6 +18,7 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi * Updated bundled OpenSSL version to 3.2.0 (Core issue [realm/realm-core#7303](https://github.com/realm/realm-core/pull/7303)) ### Fixed +* Sorting order of strings has changed to use standard unicode codepoint order instead of grouping similar english letters together. A noticeable change will be from "aAbBzZ" to "ABZabz". (Core issue [realm/realm-core#2573](https://github.com/realm/realm-core/issues/2573)) * `@count`/`@size` is now supported for `RealmAny` properties (Core issue [realm/realm-core#7280](https://github.com/realm/realm-core/issues/7280), since v10.0.0) * Fixed equality queries on a `RealmAny` property with an index possibly returning the wrong result if values of different types happened to have the same StringIndex hash. (Core issue [realm/realm-core6407](https://github.com/realm/realm-core/issues/6407) since v11.0.0-beta.5). * If you have more than 8388606 links pointing to one specific object, the program will crash. (Core issue [realm/realm-core#6577](https://github.com/realm/realm-core/issues/6577), since v6.0.0) @@ -27,6 +27,10 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi * Uploading the changesets recovered during an automatic client reset recovery may lead to 'Bad server version' errors and a new client reset. (Core issue [realm/realm-core7279](https://github.com/realm/realm-core/issues/7279), since v13.24.1) * Fixed crash in fulltext index using prefix search with no matches (Core issue [realm/realm-core#7309](https://github.com/realm/realm-core/issues/7309), since v13.18.0) * Fix a minor race condition when backing up Realm files before a client reset which could have lead to overwriting an existing file. (Core issue [realm/realm-core#7341](https://github.com/realm/realm-core/pull/7341)). +* Fix opening realm with cached user while offline results in fatal error and session does not retry connection. (Core issue [realm/realm-core#7349](https://github.com/realm/realm-core/issues/7349), since v13.26.0) +* Fixed conflict resolution bug which may result in an crash when the AddInteger instruction on Mixed properties is merged against updates to a non-integer type (Core issue [realm/realm-code#7353](https://github.com/realm/realm-core/pull/7353)) +* Fix a spurious crash related to opening a Realm on background thread while the process was in the middle of exiting (Core issue [realm/realm-core#7420](https://github.com/realm/realm-core/issues/7420)) + ### Compatibility * File format: Generates Realms with file format v24 (reads and upgrades file format v10 or later). From 2b3351336fc3ff86fa56a1d8438ed2723f8a8541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Wed, 3 Apr 2024 10:08:13 +0200 Subject: [PATCH 22/23] Update log callback --- packages/cinterop/build.gradle.kts | 1 + .../io/realm/kotlin/internal/interop/Callback.kt | 2 +- .../realm/kotlin/internal/interop/RealmInterop.kt | 2 +- .../realm/kotlin/internal/interop/RealmInterop.kt | 4 ++-- .../realm/kotlin/internal/interop/RealmInterop.kt | 7 +++---- .../src/main/jni/realm_api_helpers.cpp | 14 ++++++-------- .../jni-swig-stub/src/main/jni/realm_api_helpers.h | 2 +- .../kotlin/io/realm/kotlin/log/RealmLog.kt | 4 ++-- 8 files changed, 17 insertions(+), 19 deletions(-) diff --git a/packages/cinterop/build.gradle.kts b/packages/cinterop/build.gradle.kts index 202ccf5abe..f8d79c2e99 100644 --- a/packages/cinterop/build.gradle.kts +++ b/packages/cinterop/build.gradle.kts @@ -502,6 +502,7 @@ fun Task.buildSharedLibrariesForJVMMacOs() { .copyTo(project.file("$jvmJniPath/macos/librealmc.dylib"), overwrite = true) } + inputs.dir(project.file("src/jvm")) inputs.dir(project.file("$absoluteCorePath/src")) outputs.file(project.file("$jvmJniPath/macos/librealmc.dylib")) } diff --git a/packages/cinterop/src/commonMain/kotlin/io/realm/kotlin/internal/interop/Callback.kt b/packages/cinterop/src/commonMain/kotlin/io/realm/kotlin/internal/interop/Callback.kt index 4d262f206d..a17b3e5698 100644 --- a/packages/cinterop/src/commonMain/kotlin/io/realm/kotlin/internal/interop/Callback.kt +++ b/packages/cinterop/src/commonMain/kotlin/io/realm/kotlin/internal/interop/Callback.kt @@ -43,7 +43,7 @@ interface SyncSessionTransferCompletionCallback { interface LogCallback { // Passes core log levels as shorts to avoid unnecessary jumping between the SDK and JNI - fun log(logLevel: Short, message: String?) + fun log(logLevel: Short, category: String?, message: String?) } interface SyncBeforeClientResetHandler { diff --git a/packages/cinterop/src/commonMain/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt b/packages/cinterop/src/commonMain/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt index 6a846f05f0..1a42b6faac 100644 --- a/packages/cinterop/src/commonMain/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt +++ b/packages/cinterop/src/commonMain/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt @@ -579,7 +579,7 @@ expect object RealmInterop { fun realm_sync_client_config_set_multiplex_sessions(syncClientConfig: RealmSyncClientConfigurationPointer, enabled: Boolean) - fun realm_set_log_callback(level: CoreLogLevel, callback: LogCallback) + fun realm_set_log_callback(callback: LogCallback) fun realm_set_log_level(level: CoreLogLevel) 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 58254b507c..7797adcf14 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 @@ -1287,8 +1287,8 @@ actual object RealmInterop { realmc.realm_sync_client_config_set_multiplex_sessions(syncClientConfig.cptr(), enabled) } - actual fun realm_set_log_callback(level: CoreLogLevel, callback: LogCallback) { - realmc.set_log_callback(level.priority, callback) + actual fun realm_set_log_callback(callback: LogCallback) { + realmc.set_log_callback(callback) } actual fun realm_set_log_level(level: CoreLogLevel) { diff --git a/packages/cinterop/src/nativeDarwin/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt b/packages/cinterop/src/nativeDarwin/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt index 640bd75b4e..af6c2c030e 100644 --- a/packages/cinterop/src/nativeDarwin/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt +++ b/packages/cinterop/src/nativeDarwin/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt @@ -2418,13 +2418,12 @@ actual object RealmInterop { realm_wrapper.realm_sync_client_config_set_multiplex_sessions(syncClientConfig.cptr(), enabled) } - actual fun realm_set_log_callback(level: CoreLogLevel, callback: LogCallback) { + actual fun realm_set_log_callback(callback: LogCallback) { realm_wrapper.realm_set_log_callback( - staticCFunction { userData, logLevel, message -> + staticCFunction { userData, category, logLevel, message -> val userDataLogCallback = safeUserData(userData) - userDataLogCallback.log(logLevel.toShort(), message?.toKString()) + userDataLogCallback.log(logLevel.toShort(), category?.toKString(), message?.toKString()) }, - level.priority.toUInt(), StableRef.create(callback).asCPointer(), staticCFunction { userData -> disposeUserData<() -> LogCallback>(userData) } ) 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 54522828ba..2dfcdfdb39 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 @@ -959,10 +959,9 @@ realm_sync_socket_t* realm_sync_websocket_new(int64_t sync_client_config_ptr, jo // *** END - WebSocket Client (Platform Networking) *** // -void set_log_callback(jint j_log_level, jobject log_callback) { -auto jenv = get_env(false); -auto log_level = static_cast(j_log_level); -realm_set_log_callback([](void *userdata, realm_log_level_e level, const char *message) { +void set_log_callback(jobject log_callback) { +auto jenv = get_env(true); +realm_set_log_callback([](void *userdata, const char* category, realm_log_level_e level, const char *message) { auto log_callback = static_cast(userdata); auto jenv = get_env(true); @@ -971,14 +970,13 @@ realm_set_log_callback([](void *userdata, realm_log_level_e level, const char *m static JavaMethod log_method(jenv, JavaClassGlobalDef::log_callback(), "log", - "(SLjava/lang/String;)V"); + "(SLjava/lang/String;Ljava/lang/String;)V"); - push_local_frame(jenv, 1); - jenv->CallVoidMethod(log_callback, log_method, java_level, to_jstring(jenv, message)); + push_local_frame(jenv, 2); + jenv->CallVoidMethod(log_callback, log_method, java_level, to_jstring(jenv, category), to_jstring(jenv, message)); jni_check_exception(jenv); jenv->PopLocalFrame(NULL); }, - log_level, jenv->NewGlobalRef(log_callback), // userdata is the log callback [](void* userdata) { // The log callback is a static global method that is intended to 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 84caf586dc..34f837dbc0 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 @@ -51,7 +51,7 @@ realm_http_transport_t* realm_network_transport_new(jobject network_transport); void -set_log_callback(jint log_level, jobject log_callback); +set_log_callback(jobject log_callbac); realm_scheduler_t* realm_create_scheduler(jobject dispatchScheduler); diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/log/RealmLog.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/log/RealmLog.kt index e67a9de110..246e89e30f 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/log/RealmLog.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/log/RealmLog.kt @@ -47,12 +47,12 @@ public object RealmLog { init { addDefaultSystemLogger() RealmInterop.realm_set_log_callback( - level.toCoreLogLevel(), object : LogCallback { - override fun log(logLevel: Short, message: String?) { + override fun log(logLevel: Short, category: String?, message: String?) { // Create concatenated up front, since Core should already filter messages // not within the log range. val level: LogLevel = fromCoreLogLevel(CoreLogLevel.valueFromPriority(logLevel)) + // TODO Add category - Will come with https://github.com/realm/realm-kotlin/pull/1692 doLog( level, null, From 6a63eeb520c1ce292173fea0d35cae92382b2dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Wed, 3 Apr 2024 11:32:14 +0200 Subject: [PATCH 23/23] Obtain cmake version from cmake that is on the path --- packages/cinterop/build.gradle.kts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/packages/cinterop/build.gradle.kts b/packages/cinterop/build.gradle.kts index f8d79c2e99..e3fe1b6f0b 100644 --- a/packages/cinterop/build.gradle.kts +++ b/packages/cinterop/build.gradle.kts @@ -15,7 +15,8 @@ */ import org.jetbrains.kotlin.konan.target.KonanTarget -import java.lang.IllegalArgumentException +import java.io.ByteArrayOutputStream +import java.nio.charset.Charset plugins { id("org.jetbrains.kotlin.multiplatform") @@ -328,6 +329,10 @@ android { // Inner externalNativeBuild (inside defaultConfig) does not seem to have correct type for setting path externalNativeBuild { cmake { + // We need to grab cmake version from `cmake --version` on the path and set it here + // otherwise the build system will use the one from the NDK + @Suppress("UnstableApiUsage") + version = project.providers.of(CmakeVersionProvider::class) {}.get() path = project.file("src/jvm/CMakeLists.txt") } } @@ -758,3 +763,22 @@ tasks.named("clean") { delete(project.file(".cxx")) } } + +// Provider that reads the version of cmake that is on the PATH +@Suppress("UnstableApiUsage") +abstract class CmakeVersionProvider : ValueSource { + @get:Inject + abstract val execOperations: ExecOperations + override fun obtain(): String? { + val output = ByteArrayOutputStream() + execOperations.exec { + commandLine("cmake", "--version") + standardOutput = output + } + val cmakeOutput = String(output.toByteArray(), Charset.defaultCharset()) + val regex = "cmake version (?[0-9\\.]*)".toRegex() + val cmakeVersion = regex.find(cmakeOutput)?.groups?.get("version") + ?: throw RuntimeException("Couldn't match cmake version from: '$cmakeOutput'") + return cmakeVersion.value + } +}