From d99eba9cb9b98e2f28de19e95b44fd5e5f8d8874 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 9 Mar 2024 14:39:08 +0000 Subject: [PATCH 01/11] Prepare next dev iteration --- 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 9ff5443096..90ff0279e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 1.14.1-SNAPSHOT (YYYY-MM-DD) +## 1.15.0-SNAPSHOT (YYYY-MM-DD) ### Breaking Changes diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index 95508209b5..b6631f5b29 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 || System.getenv("CI") != null) - const val version = "1.14.1-SNAPSHOT" + const val version = "1.15.0-SNAPSHOT" const val group = "io.realm.kotlin" const val projectUrl = "https://realm.io" const val pluginPortalId = "io.realm.kotlin" From 82400535535e3801d6b72a13abdb0b5e3de5a3d8 Mon Sep 17 00:00:00 2001 From: Yavor Georgiev Date: Thu, 14 Mar 2024 20:42:59 +0000 Subject: [PATCH 02/11] =?UTF-8?q?=F0=9F=94=84=20Synced=20file(s)=20with=20?= =?UTF-8?q?realm/ci-actions=20(#1689)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: realm-ci --- .github/workflows/lock-threads.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/lock-threads.yml diff --git a/.github/workflows/lock-threads.yml b/.github/workflows/lock-threads.yml new file mode 100644 index 0000000000..dc1d483a8e --- /dev/null +++ b/.github/workflows/lock-threads.yml @@ -0,0 +1,24 @@ +name: 'Lock Threads' + +on: + schedule: + - cron: '0 * * * *' + workflow_dispatch: + +permissions: + issues: write + pull-requests: write + discussions: write + +concurrency: + group: lock-threads + +jobs: + action: + runs-on: ubuntu-latest + steps: + - uses: dessant/lock-threads@v5 + with: + issue-inactive-days: 30 + pr-inactive-days: 30 + log-output: true From 0fb9fc1d05998af023d739d23bc39ba5602bfe84 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Mon, 18 Mar 2024 23:19:49 +0000 Subject: [PATCH 03/11] Removing Jenkins switching to Github Action for CI/CD (#1698) --- CHANGELOG.md | 3 +- Jenkinsfile | 780 ------------------ benchmarks/settings.gradle.kts | 2 +- buildSrc/src/main/kotlin/Config.kt | 2 +- .../src/main/kotlin/realm-lint.gradle.kts | 2 +- examples/kmm-sample/settings.gradle.kts | 2 +- .../settings.gradle.kts | 2 +- packages/cinterop/build.gradle.kts | 2 +- 8 files changed, 8 insertions(+), 787 deletions(-) delete mode 100644 Jenkinsfile diff --git a/CHANGELOG.md b/CHANGELOG.md index 90ff0279e1..b4caacf000 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,7 +30,8 @@ ### Internal -- None. +- Deprecated Jenkins and switching to Github Action ([JIRA]https://jira.mongodb.org/browse/RKOTLIN-825). + ## 1.14.0 (2024-03-08) diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index effc4e006d..0000000000 --- a/Jenkinsfile +++ /dev/null @@ -1,780 +0,0 @@ -/* - * Copyright 2020 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import groovy.json.JsonOutput - -@Library('realm-ci') _ - -// Branches from which we release SNAPSHOT's. Only release branches need to run on actual hardware. -releaseBranches = [ 'main', 'releases', 'next-major' ] -// Branches that are "important", so if they do not compile they will generate a Slack notification -slackNotificationBranches = [ 'main', 'releases', 'next-major' ] -// Shortcut to current branch name that is being tested -currentBranch = (env.CHANGE_BRANCH == null) ? env.BRANCH_NAME : env.CHANGE_BRANCH - -// Will be set to `true` if this build is a full release that should be available on Bintray. -// This is determined by comparing the current git tag to the version number of the build. -publishBuild = false -// Version of Realm Kotlin being tested. This values is defined in `buildSrc/src/main/kotlin/Config.kt`. -version = null -// Wether or not to run test steps -runTests = true -isReleaseBranch = releaseBranches.contains(currentBranch) -// Manually wipe the workspace before checking out the code. This happens automatically on release branches. -forceWipeWorkspace = false -// Whether or not to use platform networking for tests -usePlatformNetworking = false - -// References to Docker containers holding the MongoDB Test server and infrastructure for -// controlling it. -mongoDbRealmContainer = null - -// Mac CI dedicated machine -node_label = 'osx_kotlin' - -// When having multiple executors available, Jenkins might append @2/@3/etc. to workspace folders in order -// to allow multiple parallel builds on the same branch. Unfortunately this breaks Ninja and thus us -// building native code. To work around this, we force the workspace to mirror the git path. -// This has two side-effects: 1) It isn't possible to use this JenkinsFile on a worker with multiple -// executors. At least not if we want to support building multiple versions of the same PR. -workspacePath = "/Users/realm/workspace-realm-kotlin/${currentBranch}" - -// Build type for native libraries for Linux and Windows. Should either be "Release" or "Debug" -jvmNativeBuildType="Release" - -pipeline { - agent none - options { - // In Realm Java, we had to lock the entire build as sharing the global Gradle - // cache was causing issues. We never discovered the root cause, but - // https://github.com/gradle/gradle/issues/851 seems to indicate that the problem - // is when running builds inside Docker containers that share a host .gradle - // folder. - // - // This isn't the case for Kotlin, so it seems safe to remove the lock. - // Locking is furthermore complicated by the fact that there doesn't seem an - // easy way to grap a node-lock for pipeline syntax builds. - // https://stackoverflow.com/a/44758361/1389357. - // - // So in summary, removing the lock should work fine. I'm mostly keeping this - // description in case we run into problems down the line. - - // lock resource: 'kotlin_build_lock' - // Overall job timeout. This doesn't include time for waiting on the agent. - // Setting 'activity'-timeouts here doesn't clear the overall job timeout, so - // not an option. More finegrained timeouts can be targeted at specific - // stages, but these will include the time waiting for resources/nodes. - timeout(time: 180, unit: 'MINUTES') - } - environment { - ANDROID_HOME='/Users/realm/Library/Android/sdk/' - ANDROID_SDK_ROOT='/Users/realm/Library/Android/sdk/' - NDK_HOME='/Users/realm/Library/Android/sdk/ndk/22.0.6917172' - ANDROID_NDK="${NDK_HOME}" - ANDROID_NDK_HOME="${NDK_HOME}" - REALM_DISABLE_ANALYTICS=true - REALM_PRINT_ANALYTICS=true - REALM_FAIL_ON_ANALYTICS_ERRORS=true - JAVA_8='/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home' - JAVA_11='/Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home' - JAVA_17='/Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home' - JAVA_HOME="${JAVA_11}" - } - stages { - stage('Prepare CI') { - // Force all stages to use the same node, so we can take advantage - // of the gradle cache between steps, otherwise Jenkins are free - // to move a stage to a different node. - agent { - node { - label node_label - customWorkspace workspacePath - } - } - stages { - stage('SCM') { - steps { - runScm() - setBuildDetails() - genAndStashSwigJNI() - } - } - - stage('build-jvm-native-libs') { - parallel{ - stage('build_jvm_linux') { - when { expression { shouldBuildJvmABIs() } } - agent { - node { - label 'docker' - } - } - steps { - // It is an order of magnitude faster to checkout the repo - // rather then stashing/unstashing all files to build Linux and Win - runScm() - build_jvm_linux(jvmNativeBuildType) - } - } - stage('build_jvm_windows') { - when { expression { shouldBuildJvmABIs() } } - agent { - node { - // FIXME aws-windows-02 has issue with checking out the repo with symlinks - label 'aws-windows-01' - } - } - steps { - runScm() - build_jvm_windows(jvmNativeBuildType) - } - } - } - } - - stage('Build') { - steps { - runBuild() - } - } - stage('Static Analysis') { - when { expression { runTests } } - steps { - runStaticAnalysis() - } - } - stage('Benchmarks') { - steps { - runBenchmarks() - } - } - stage('Tests Compiler Plugin') { - when { expression { runTests } } - steps { - runCompilerPluginTest() - } - } - stage('Tests macOS - Unit Tests') { - when { expression { runTests } } - steps { - testAndCollect("packages", "cleanAllTests macosTest -PincludeTestModules=false") - } - } - stage('Tests Android - Unit Tests') { - when { expression { runTests } } - steps { - withLogcatTrace( - "unittest", - { - testAndCollect("packages", "cleanAllTests connectedAndroidTest -PincludeTestModules=false") - } - ) - } - } - stage('Integration Tests - Android') { - when { expression { runTests } } - steps { - testWithServer([ - { - withLogcatTrace( - "integrationtest", - { - forwardAdbPorts() - testAndCollect("packages", "cleanAllTests -PsyncUsePlatformNetworking=${usePlatformNetworking} -PincludeSdkModules=false connectedAndroidTest") - } - ) - } - ]) - } - } - stage('Integration Tests - macOS - New memory model') { - when { expression { runTests } } - steps { - testWithServer([ - // This will overwrite previous test results, but should be ok as we would not get here - // if previous stages failed. - { - testAndCollect("packages", "cleanAllTests macosTest -PincludeSdkModules=false") - }, - ]) - } - } - stage('Tests JVM') { - when { expression { runTests } } - steps { - testWithServer([ - { - testAndCollect("packages", "cleanAllTests jvmTest -PsyncUsePlatformNetworking=${usePlatformNetworking} -PincludeSdkModules=false") - } - ]) - } - } - stage('Integration Tests - iOS') { - when { expression { runTests } } - steps { - testWithServer([ - { - testAndCollect("packages", "cleanAllTests iosTest -PincludeSdkModules=false") - } - ]) - } - } - stage('Minified Sync Tests - Android') { - when { expression { runTests } } - steps { - testWithServer([ - { - testAndCollect("packages", "cleanAllTests :test-sync:connectedAndroidtest -PsyncUsePlatformNetworking=${usePlatformNetworking} -PincludeSdkModules=false -PtestBuildType=debugMinified") - } - ]) - sh 'rm mapping.zip || true' - zip([ - 'zipFile': 'mapping.zip', - 'archive': true, - 'glob': 'packages/test-sync/build/outputs/mapping/debugMinified/mapping.txt' - ]) - } - } - stage('Gradle Plugin Integration Tests') { - when { expression { runTests } } - steps { - testAndCollect("integration-tests/gradle/current", "integrationTest") - testAndCollect("integration-tests/gradle/current", "-Pkotlin.experimental.tryK2=true integrationTest") - testAndCollect("integration-tests/gradle/gradle6-test", "integrationTest") - testAndCollect("integration-tests/gradle/gradle71-test", "integrationTest") - testAndCollect("integration-tests/gradle/gradle75-test", "integrationTest") - withEnv(["JAVA_HOME=${JAVA_17}"]) { - testAndCollect("integration-tests/gradle/gradle8-test", "integrationTest") - testAndCollect("integration-tests/gradle/gradle85-test", "integrationTest") - } - } - } - stage('Tests Android Sample App') { - when { expression { runTests } } - steps { - catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { - runMonkey() - } - runAndroidUnitTestsOnJvm() - } - } - stage('Build Android on minimum versions') { - when { expression { runTests } } - steps { - runBuildMinAndroidApp() - } - } - stage('Test Realm Java Compatibility App') { - when { expression { runTests } } - steps { - testAndCollect("examples/realm-java-compatibility", "connectedAndroidTest") - testAndCollect("examples/realm-java-compatibility", "-Pkotlin.experimental.tryK2=true connectedAndroidTest") - } - } - stage('Track build metrics') { - when { expression { currentBranch == "main" } } - steps { - trackBuildMetrics(version) - } - } - stage('Publish SNAPSHOT to Maven Central') { - when { expression { shouldPublishSnapshot(version) } } - steps { - runPublishSnapshotToMavenCentral() - } - } - stage('Publish Release to Maven Central') { - when { expression { publishBuild } } - steps { - runPublishReleaseOnMavenCentral() - } - } - } - } - } - post { - failure { - notifySlackIfRequired("*The realm-kotlin/${currentBranch} branch is broken!*") - } - unstable { - notifySlackIfRequired("*The realm-kotlin/${currentBranch} branch is unstable!*") - } - fixed { - notifySlackIfRequired("*The realm-kotlin/${currentBranch} branch has been fixed!*") - } - } -} - -def runScm() { - def repoExtensions = [ - [$class: 'SubmoduleOption', recursiveSubmodules: true] - ] - if (isReleaseBranch || forceWipeWorkspace) { - repoExtensions += [ - [$class: 'WipeWorkspace'], - [$class: 'CleanCheckout'], - ] - } - checkout([ - $class : 'GitSCM', - branches : scm.branches, - gitTool : 'native git', - extensions : scm.extensions + repoExtensions, - userRemoteConfigs: scm.userRemoteConfigs - ]) -} - -def setBuildDetails() { - // Check type of Build. We are treating this as a release build if we are building - // the exact Git SHA that was tagged. - gitTag = readGitTag() - version = sh(returnStdout: true, script: 'grep "const val version" buildSrc/src/main/kotlin/Config.kt | cut -d \\" -f2').trim() - echo "Git branch/tag: ${currentBranch}/${gitTag ?: 'none'}" - if (!gitTag) { - gitSha = sh(returnStdout: true, script: 'git rev-parse HEAD').trim().take(8) - echo "Building commit: ${version} - ${gitSha}" - setBuildName(gitSha) - publishBuild = false - } else { - if (gitTag != "v${version}") { - error "Git tag '${gitTag}' does not match v${version}" - } else { - echo "Building release: '${gitTag}'" - setBuildName("Tag ${gitTag}") - publishBuild = true - } - } -} - -def genAndStashSwigJNI() { - withEnv(['PATH+USER_BIN=/usr/local/bin']) { - sh """ - cd packages/jni-swig-stub - ../gradlew assemble - """ - } - stash includes: 'packages/jni-swig-stub/build/generated/sources/jni/realmc.cpp,packages/jni-swig-stub/build/generated/sources/jni/realmc.h', name: 'swig_jni' -} -def runBuild() { - def buildJvmAbiFlag = "-Prealm.kotlin.copyNativeJvmLibs=" - if (shouldBuildJvmABIs()) { - unstash name: 'linux_so_file' - unstash name: 'win_dll' - buildJvmAbiFlag = "-Prealm.kotlin.copyNativeJvmLibs=windows,linux" // Macos is built in-place - } - - withCredentials([ - [$class: 'StringBinding', credentialsId: 'maven-central-kotlin-ring-file', variable: 'SIGN_KEY'], - [$class: 'StringBinding', credentialsId: 'maven-central-kotlin-ring-file-password', variable: 'SIGN_KEY_PASSWORD'], - ]) { - withEnv(['PATH+USER_BIN=/usr/local/bin']) { - startEmulatorInBgIfNeeded() - def signingFlags = "" - if (isReleaseBranch) { - signingFlags = "-PsignBuild=true -PsignSecretRingFileKotlin=\"${env.SIGN_KEY}\" -PsignPasswordKotlin=${env.SIGN_KEY_PASSWORD}" - } - sh """ - cd packages - chmod +x gradlew && ./gradlew publishCIPackages ${buildJvmAbiFlag} ${signingFlags} --info --stacktrace --no-daemon - """ - } - } - archiveArtifacts artifacts: 'packages/cinterop/src/jvmMain/resources/**/*.*', allowEmptyArchive: true -} - - -def runBenchmarks() { - // For now, just make sure that the benchmarks compile. - sh ''' - cd benchmarks - chmod +x gradlew && ./gradlew assembleAndroidTest jmhCompileGeneratedClasses --stacktrace --no-daemon - ''' -} - - -def runStaticAnalysis() { - try { - sh ''' - ./gradlew --no-daemon ktlintCheck detekt - ''' - } finally { - // CheckStyle Publisher plugin is deprecated and does not support multiple Checkstyle files - // New Generation Warnings plugin throw a NullPointerException when used with recordIssues() - // As a work-around we just stash the output of Ktlint and Detekt for manual inspection. - sh ''' - rm -rf /tmp/ktlint - rm -rf /tmp/detekt - mkdir /tmp/ktlint - mkdir /tmp/detekt - rsync -a --delete --ignore-errors examples/kmm-sample/androidApp/build/reports/ktlint/ /tmp/ktlint/example/ || true - rsync -a --delete --ignore-errors test/build/reports/ktlint/ /tmp/ktlint/test/ || true - rsync -a --delete --ignore-errors packages/library-base/build/reports/ktlint/ /tmp/ktlint/library-base/ || true - rsync -a --delete --ignore-errors packages/library-sync/build/reports/ktlint/ /tmp/ktlint/library-sync/ || true - rsync -a --delete --ignore-errors packages/plugin-compiler/build/reports/ktlint/ /tmp/ktlint/plugin-compiler/ || true - rsync -a --delete --ignore-errors packages/gradle-plugin/build/reports/ktlint/ /tmp/ktlint/plugin-gradle/ || true - rsync -a --delete --ignore-errors packages/runtime-api/build/reports/ktlint/ /tmp/ktlint/runtime-api/ || true - rsync -a --delete --ignore-errors examples/kmm-sample/androidApp/build/reports/detekt/ /tmp/detekt/example/ || true - rsync -a --delete --ignore-errors test/build/reports/detekt/ /tmp/detekt/test/ || true - rsync -a --delete --ignore-errors packages/library-base/build/reports/detekt/ /tmp/detekt/library-base/ || true - rsync -a --delete --ignore-errors packages/library-sync/build/reports/detekt/ /tmp/detekt/library-sync/ || true - rsync -a --delete --ignore-errors packages/plugin-compiler/build/reports/detekt/ /tmp/detekt/plugin-compiler/ || true - rsync -a --delete --ignore-errors packages/gradle-plugin/build/reports/detekt/ /tmp/detekt/plugin-gradle/ || true - rsync -a --delete --ignore-errors packages/runtime-api/build/reports/detekt/ /tmp/detekt/runtime-api/ || true - ''' - sh 'rm ktlint.zip || true' - zip([ - 'zipFile': 'ktlint.zip', - 'archive': true, - 'dir' : '/tmp/ktlint' - ]) - sh 'rm detekt.zip || true' - zip([ - 'zipFile': 'detekt.zip', - 'archive': true, - 'dir' : '/tmp/detekt' - ]) - } -} - -def runPublishSnapshotToMavenCentral() { - withEnv(['PATH+USER_BIN=/usr/local/bin']) { - withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'maven-central-credentials', passwordVariable: 'MAVEN_CENTRAL_PASSWORD', usernameVariable: 'MAVEN_CENTRAL_USER']]) { - sh """ - cd packages - ./gradlew publishToSonatype -PossrhUsername=${env.MAVEN_CENTRAL_USER} -PossrhPassword=${env.MAVEN_CENTRAL_PASSWORD} --no-daemon - """ - } - } -} - -def runPublishReleaseOnMavenCentral() { - withCredentials([ - [$class: 'StringBinding', credentialsId: 'maven-central-kotlin-ring-file', variable: 'SIGN_KEY'], - [$class: 'StringBinding', credentialsId: 'maven-central-kotlin-ring-file-password', variable: 'SIGN_KEY_PASSWORD'], - [$class: 'StringBinding', credentialsId: 'slack-webhook-java-ci-channel', variable: 'SLACK_URL_CI'], - [$class: 'StringBinding', credentialsId: 'slack-webhook-releases-channel', variable: 'SLACK_URL_RELEASE'], - [$class: 'StringBinding', credentialsId: 'gradle-plugin-portal-key', variable: 'GRADLE_PORTAL_KEY'], - [$class: 'StringBinding', credentialsId: 'gradle-plugin-portal-secret', variable: 'GRADLE_PORTAL_SECRET'], - [$class: 'UsernamePasswordMultiBinding', credentialsId: 'maven-central-credentials', passwordVariable: 'MAVEN_CENTRAL_PASSWORD', usernameVariable: 'MAVEN_CENTRAL_USER'], - [$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'DOCS_S3_ACCESS_KEY', credentialsId: 'mongodb-realm-docs-s3', secretKeyVariable: 'DOCS_S3_SECRET_KEY'], - [$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'REALM_S3_ACCESS_KEY', credentialsId: 'tightdb-s3-ci', secretKeyVariable: 'REALM_S3_SECRET_KEY'] - ]) { - sh """ - set +x - sh tools/publish_release.sh '$MAVEN_CENTRAL_USER' '$MAVEN_CENTRAL_PASSWORD' \ - '$REALM_S3_ACCESS_KEY' '$REALM_S3_SECRET_KEY' \ - '$DOCS_S3_ACCESS_KEY' '$DOCS_S3_SECRET_KEY' \ - '$SLACK_URL_RELEASE' '$SLACK_URL_CI' \ - '$GRADLE_PORTAL_KEY' '$GRADLE_PORTAL_SECRET' \ - '-PsignBuild=true -PsignSecretRingFileKotlin="$SIGN_KEY" -PsignPasswordKotlin=$SIGN_KEY_PASSWORD' - """ - } -} - -def runCompilerPluginTest() { - withEnv(['PATH+USER_BIN=/usr/local/bin']) { - sh """ - cd packages - ./gradlew --no-daemon :plugin-compiler:test --info --stacktrace - """ - // See https://stackoverflow.com/a/51206394/1389357 - script { - def testResults = findFiles(glob: "packages/plugin-compiler/build/**/TEST-*.xml") - for(xml in testResults) { - touch xml.getPath() - } - } - step([ $class: 'JUnitResultArchiver', allowEmptyResults: true, testResults: "packages/plugin-compiler/build/**/TEST-*.xml"]) - } -} - -def testWithServer(tasks) { - // Work-around for https://github.com/docker/docker-credential-helpers/issues/82 - withCredentials([ - [$class: 'StringBinding', credentialsId: 'realm-kotlin-ci-password', variable: 'PASSWORD'], - [$class: 'AmazonWebServicesCredentialsBinding', credentialsId: 'realm-kotlin-baas-aws-credentials', accessKeyVariable: 'BAAS_AWS_ACCESS_KEY_ID', secretKeyVariable: 'BAAS_AWS_SECRET_ACCESS_KEY'] - ]) { - sh "security -v unlock-keychain -p $PASSWORD" - try { - // Prepare Docker containers with MongoDB Realm Test Server infrastructure for - // integration tests. - // TODO: How much of this logic can be moved to start_server.sh for shared logic with local testing. - def props = readProperties file: 'dependencies.list' - echo "Version in dependencies.list: ${props.MONGODB_REALM_SERVER}" - def mdbRealmImage = docker.image("docker.pkg.github.com/realm/ci/mongodb-realm-test-server:${props.MONGODB_REALM_SERVER}") - docker.withRegistry('https://docker.pkg.github.com', 'github-packages-token') { - mdbRealmImage.pull() - } - - mongoDbRealmContainer = mdbRealmImage.run("--rm -i -t -d -p9090:9090 -p26000:26000 -e AWS_ACCESS_KEY_ID='$BAAS_AWS_ACCESS_KEY_ID' -e AWS_SECRET_ACCESS_KEY='$BAAS_AWS_SECRET_ACCESS_KEY'") - - // Technically, this is only needed for Android, but since all tests are - // executed on same host and tasks are grouped in same stage we just do it - // here - forwardAdbPorts() - - tasks.each { task -> - task() - } - } finally { - // We assume that creating these containers and the docker network can be considered an atomic operation. - if (mongoDbRealmContainer != null) { - try { - archiveServerLogs(mongoDbRealmContainer.id) - } finally { - mongoDbRealmContainer.stop() - } - } - } - } -} - -def withLogcatTrace(name, task) { - try { - backgroundPid = startLogCatCollector(name) - task() - } finally { - stopLogCatCollector(backgroundPid, name) - } -} -String startLogCatCollector(name) { - // Cancel build quickly if no device is available. The lock acquired already should - // ensure we have access to a device. If not, it is most likely a more severe problem. - timeout(time: 1, unit: 'MINUTES') { - // Need ADB as root to clear all buffers: https://stackoverflow.com/a/47686978/1389357 - sh '$ANDROID_SDK_ROOT/platform-tools/adb devices' - sh """ - $ANDROID_SDK_ROOT/platform-tools/adb root - $ANDROID_SDK_ROOT/platform-tools/adb logcat -b all -c - $ANDROID_SDK_ROOT/platform-tools/adb logcat -v time > 'logcat-${name}.txt' & - echo \$! > pid - """ - return readFile("pid").trim() - } -} - -def stopLogCatCollector(String backgroundPid, name) { - // The pid might not be available if the build was terminated early or stopped due to - // a build error. - if (backgroundPid != null) { - sh "kill ${backgroundPid}" - // Zip file generation will fail if the file is already there - // Pipeline Utility Steps Plugin 2.6.1 introduces 'overwrite' property - // https://issues.jenkins.io/browse/JENKINS-42591 - sh "rm -f logcat-${name}.zip" - zip([ - 'zipFile': "logcat-${name}.zip", - 'archive': true, - 'glob' : "logcat-${name}.txt" - ]) - sh "rm logcat-${name}.txt" - } -} - -def forwardAdbPorts() { - sh """ - $ANDROID_SDK_ROOT/platform-tools/adb reverse tcp:9080 tcp:9080 - $ANDROID_SDK_ROOT/platform-tools/adb reverse tcp:9443 tcp:9443 - $ANDROID_SDK_ROOT/platform-tools/adb reverse tcp:9090 tcp:9090 - """ -} - -def testAndCollect(dir, tasks) { - withEnv(['PATH+USER_BIN=/usr/local/bin']) { - try { - sh """ - pushd $dir - ./gradlew $tasks --info --stacktrace --no-daemon - popd - """ - } finally { - step([$class: 'JUnitResultArchiver', allowEmptyResults: true, testResults: "$dir/**/build/**/TEST-*.xml"]) - } - } -} - -def runMonkey() { - try { - withEnv(['PATH+USER_BIN=/usr/local/bin']) { - sh """ - cd examples/kmm-sample - ./gradlew uninstallAll installRelease --stacktrace --no-daemon - $ANDROID_SDK_ROOT/platform-tools/adb shell monkey --pct-syskeys 0 -p io.realm.example.kmmsample.androidApp -v 500 --kill-process-after-error - """ - } - } catch (err) { - currentBuild.result = 'FAILURE' - currentBuild.stageResult = 'FAILURE' - } -} - -def runAndroidUnitTestsOnJvm() { - try { - sh """ - cd examples/kmm-sample - ./gradlew androidApp:testDebugUnitTest --stacktrace --no-daemon - """ - } catch (err) { - currentBuild.result = 'FAILURE' - currentBuild.stageResult = 'FAILURE' - } -} - - -def runBuildMinAndroidApp() { - try { - sh """ - cd examples/min-android-sample - java -version - ./gradlew assembleDebug jvmJar --stacktrace --no-daemon - """ - } catch (err) { - currentBuild.result = 'FAILURE' - currentBuild.stageResult = 'FAILURE' - } -} - -def notifySlackIfRequired(String slackMessage) { - // We should only generate Slack notifications for important branches that all team members use. - if (slackNotificationBranches.contains(currentBranch)) { - node { - withCredentials([[$class: 'StringBinding', credentialsId: 'slack-webhook-java-ci-channel', variable: 'SLACK_URL']]) { - def payload = JsonOutput.toJson([ - username: "Realm CI", - icon_emoji: ":realm_new:", - text: "${slackMessage}\n<${env.BUILD_URL}|Click here> to check the build." - ]) - - sh "curl -X POST --data-urlencode \'payload=${payload}\' ${env.SLACK_URL}" - } - } - } -} - -def readGitTag() { - def command = 'git describe --exact-match --tags HEAD' - def returnStatus = sh(returnStatus: true, script: command) - if (returnStatus != 0) { - return null - } - return sh(returnStdout: true, script: command).trim() -} - -def startEmulatorInBgIfNeeded() { - def command = '$ANDROID_SDK_ROOT/platform-tools/adb shell pidof com.android.phone' - def returnStatus = sh(returnStatus: true, script: command) - if (returnStatus != 0) { - // Changing the name of the emulator image requires that this emulator image is - // present on both atlanta_host13 and atlanta_host14. - sh '/usr/local/Cellar/daemonize/1.7.8/sbin/daemonize -E JENKINS_NODE_COOKIE=dontKillMe $ANDROID_SDK_ROOT/emulator/emulator -avd Pixel_2_API_30_x86_64 -no-boot-anim -no-window -wipe-data -noaudio -partition-size 4098 -memory 2048' - } -} - -boolean shouldPublishSnapshot(version) { - if (!releaseBranches.contains(currentBranch)) { - return false - } - if (version == null || !version.endsWith("-SNAPSHOT")) { - return false - } - return true -} - -def archiveServerLogs(String mongoDbRealmContainerId) { - sh "docker cp ${mongoDbRealmContainerId}:/var/log/stitch.log ./stitch.log" - sh 'rm stitchlog.zip || true' - zip([ - 'zipFile': 'stitchlog.zip', - 'archive': true, - 'glob': 'stitch.log' - ]) - sh 'rm stitch.log' - - sh "docker cp ${mongoDbRealmContainerId}:/var/log/mongodb.log ./mongodb.log" - sh 'rm mongodb.zip || true' - zip([ - 'zipFile': 'mongodb.zip', - 'archive': true, - 'glob': 'mongodb.log' - ]) - sh 'rm mongodb.log' -} - -def runCommand(String command){ - return sh(script: command, returnStdout: true).trim() -} - -def shouldBuildJvmABIs() { - if (publishBuild || shouldPublishSnapshot(version)) return true else return false -} - -def build_jvm_linux(String buildType) { - // Any change to CMAKE properties here, should be reflected in /packages/cinterop/build.gradle.kts - // In the `buildSharedLibrariesForJVM` task as well as `build_jvm_windows` in this JenkinsFile. - unstash name: 'swig_jni' - docker.build('jvm_linux', '-f packages/cinterop/src/jvmMain/generic.Dockerfile .').inside { - sh """ - cd packages/cinterop - mkdir build - cd build - rm -rf realmLinuxBuild - mkdir realmLinuxBuild - cd realmLinuxBuild - cmake -DCMAKE_BUILD_TYPE=${buildType} \ - -DREALM_ENABLE_SYNC=1 \ - -DREALM_NO_TESTS=1 \ - -DREALM_BUILD_LIB_ONLY=true \ - ../../src/jvm - make -j8 - """ - - stash includes:'packages/cinterop/build/realmLinuxBuild/librealmc.so', name: 'linux_so_file' - } -} - -def build_jvm_windows(String buildType) { - // Any change to CMAKE properties here, should be reflected in /packages/cinterop/build.gradle.kts - // In the `buildSharedLibrariesForJVM` task as well as `build_jvm_linux` in this JenkinsFile. - unstash name: 'swig_jni' - def cmakeOptions = [ - CMAKE_GENERATOR_PLATFORM: 'x64', - CMAKE_BUILD_TYPE: "${buildType}", - REALM_ENABLE_SYNC: "ON", - CMAKE_TOOLCHAIN_FILE: "c:\\src\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake", - CMAKE_SYSTEM_VERSION: '8.1', - REALM_NO_TESTS: '1', - REALM_BUILD_LIB_ONLY: "true", - VCPKG_TARGET_TRIPLET: 'x64-windows-static' - ] - - def cmakeDefinitions = cmakeOptions.collect { k,v -> "-D$k=$v" }.join(' ') - dir('packages') { - bat "cd cinterop && rmdir /s /q build & mkdir build & cd build && rmdir /s /q realmWindowsBuild & mkdir realmWindowsBuild && cd realmWindowsBuild && \"${tool 'cmake'}\" ${cmakeDefinitions} ..\\..\\src\\jvm && \"${tool 'cmake'}\" --build . --config Release" - } - stash includes: 'packages/cinterop/build/realmWindowsBuild/Release/realmc.dll', name: 'win_dll' -} - -def trackBuildMetrics(version) { - withCredentials([[$class: 'StringBinding', credentialsId: 'kotlin-build-metrics-url', variable: 'METRICS_URL']]) { - sh """ - sh ./tools/collect_metrics.sh '${version}' result.json - curl --location --request POST '${METRICS_URL}' \ - --header 'Content-Type: application/json' \ - --data-binary @result.json - """ - } -} - diff --git a/benchmarks/settings.gradle.kts b/benchmarks/settings.gradle.kts index 75f6d9c7d8..df4ac92675 100644 --- a/benchmarks/settings.gradle.kts +++ b/benchmarks/settings.gradle.kts @@ -18,7 +18,7 @@ // For CI buils, the packages are expected to have // been built and deployed to a local filesystem // maven repo. -if (System.getenv("JENKINS_HOME") == null && System.getenv("CI") == null) { +if (System.getenv("CI") == null) { includeBuild("../packages") } diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index b6631f5b29..293752aa34 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -61,7 +61,7 @@ private fun findHostOs(): OperatingSystem { val HOST_OS: OperatingSystem = findHostOs() object Realm { - val ciBuild = (System.getenv("JENKINS_HOME") != null || System.getenv("CI") != null) + val ciBuild = (System.getenv("CI") != null) const val version = "1.15.0-SNAPSHOT" const val group = "io.realm.kotlin" const val projectUrl = "https://realm.io" diff --git a/buildSrc/src/main/kotlin/realm-lint.gradle.kts b/buildSrc/src/main/kotlin/realm-lint.gradle.kts index 73714d8f5e..8a4a1cdc2b 100644 --- a/buildSrc/src/main/kotlin/realm-lint.gradle.kts +++ b/buildSrc/src/main/kotlin/realm-lint.gradle.kts @@ -108,7 +108,7 @@ allprojects { reports { html.enabled = true // observe findings in your browser with structure and code snippets - xml.enabled = false // checkstyle like format mainly for integrations like Jenkins + xml.enabled = false // checkstyle like format mainly for integrations like GHA txt.enabled = false // similar to the console output, contains issue signature to manually edit baseline files } } diff --git a/examples/kmm-sample/settings.gradle.kts b/examples/kmm-sample/settings.gradle.kts index b6c2f49fff..0b31e27353 100644 --- a/examples/kmm-sample/settings.gradle.kts +++ b/examples/kmm-sample/settings.gradle.kts @@ -3,7 +3,7 @@ // been built and deployed to a local filesystem // maven repo. We cannot reference `Realm.ciBuild` // from buildSrc here. -if (System.getenv("JENKINS_HOME") == null && System.getenv("CI") == null) { +if (System.getenv("CI") == null) { includeBuild("../../packages") } diff --git a/examples/realm-java-compatibility/settings.gradle.kts b/examples/realm-java-compatibility/settings.gradle.kts index 3cdeb134c2..134553c98c 100644 --- a/examples/realm-java-compatibility/settings.gradle.kts +++ b/examples/realm-java-compatibility/settings.gradle.kts @@ -19,7 +19,7 @@ // been built and deployed to a local filesystem // maven repo. We cannot reference `Realm.ciBuild` // from buildSrc here. -if (System.getenv("JENKINS_HOME") == null && System.getenv("CI") == null) { +if (System.getenv("CI") == null) { includeBuild("../../packages") } diff --git a/packages/cinterop/build.gradle.kts b/packages/cinterop/build.gradle.kts index 3016f75207..9484baf0e9 100644 --- a/packages/cinterop/build.gradle.kts +++ b/packages/cinterop/build.gradle.kts @@ -449,7 +449,7 @@ val copyJVMSharedLibs: TaskProvider by tasks.registering { * Consolidate shared CMake flags used across all configurations */ fun getSharedCMakeFlags(buildType: BuildType, ccache: Boolean = true): Array { - // Any change to CMAKE properties here, should be reflected in /JenkinsFile, specifically + // Any change to CMAKE properties here, should be reflected in GHA(.github/workflows/pr.yml), specifically // the `build_jvm_linux` and `build_jvm_windows` functions. val args = mutableListOf() if (ccache) { From ef064efc59cab6f7fdc57f694c90a4db47e19a4f Mon Sep 17 00:00:00 2001 From: clementetb Date: Tue, 26 Mar 2024 14:27:55 +0100 Subject: [PATCH 04/11] Remove cmake required version (#1710) --- CHANGELOG.md | 2 +- buildSrc/src/main/kotlin/Config.kt | 3 --- packages/cinterop/build.gradle.kts | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b916f438e7..005102ab14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ - Minimum R8: 8.0.34. ### Internal -- None +- Remove CMake required version. ## 1.14.2-SNAPSHOT (YYYY-MM-DD) diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index 293752aa34..fa440841c2 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -113,9 +113,6 @@ object Versions { const val atomicfu = "0.18.5" // https://github.com/Kotlin/kotlinx.atomicfu const val autoService = "1.0" // https://mvnrepository.com/artifact/com.google.auto.service/auto-service const val buildkonfig = "0.13.3" // https://github.com/yshrsmz/BuildKonfig - // Not currently used, so mostly here for documentation. Core requires minimum 3.15, but 3.18.1 is available through the Android SDK. - // Build also tested successfully with 3.21.4 (latest release). - const val cmake = "3.27.7" const val coroutines = "1.7.0" // https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core const val datetime = "0.4.0" // https://github.com/Kotlin/kotlinx-datetime const val detektPlugin = "1.22.0-RC2" // https://github.com/detekt/detekt diff --git a/packages/cinterop/build.gradle.kts b/packages/cinterop/build.gradle.kts index 9484baf0e9..202ccf5abe 100644 --- a/packages/cinterop/build.gradle.kts +++ b/packages/cinterop/build.gradle.kts @@ -328,7 +328,6 @@ android { // Inner externalNativeBuild (inside defaultConfig) does not seem to have correct type for setting path externalNativeBuild { cmake { - version = Versions.cmake path = project.file("src/jvm/CMakeLists.txt") } } From ede4de1c2c3e2bda497ec55ffbde82823877678b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Thu, 4 Apr 2024 09:03:29 +0200 Subject: [PATCH 05/11] [RKOTLIN-1031] Update to Core 14.4.1 (#1668) --- .github/workflows/pr.yml | 2 +- CHANGELOG.md | 95 +++++++++---------- buildSrc/src/main/kotlin/Config.kt | 1 + packages/cinterop/build.gradle.kts | 27 +++++- .../realm/kotlin/internal/interop/Callback.kt | 2 +- .../kotlin/internal/interop/RealmInterop.kt | 2 +- .../kotlin/internal/interop/RealmInterop.kt | 22 ++++- .../cinterop/src/jvmMain/generic.Dockerfile | 2 +- .../kotlin/internal/interop/RealmInterop.kt | 19 ++-- packages/external/core | 2 +- packages/gradle-plugin/build.gradle.kts | 21 ++-- packages/jni-swig-stub/realm.i | 4 +- .../src/main/jni/realm_api_helpers.cpp | 14 ++- .../src/main/jni/realm_api_helpers.h | 2 +- .../kotlin/io/realm/kotlin/log/RealmLog.kt | 4 +- .../io/realm/kotlin/test/common/QueryTests.kt | 2 +- 16 files changed, 134 insertions(+), 87 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 22d6735f4f..9d463ceb66 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -62,7 +62,7 @@ jobs: uses: jwlawson/actions-setup-cmake@v1.13 with: 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 # We need to use the formulae directly from GitHub to pin the version as Homebrew does not have diff --git a/CHANGELOG.md b/CHANGELOG.md index 005102ab14..97522e2955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,32 +1,58 @@ ## 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 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. +* 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)). ### Enhancements -- None. +* 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 -- None. +* 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) +* 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)). +* 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 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.4.1 commit 374dd672af357732dccc135fecc905406fec3223. +* Deprecated Jenkins and switching to Github Action ([JIRA]https://jira.mongodb.org/browse/RKOTLIN-825). - Remove CMake required version. + ## 1.14.2-SNAPSHOT (YYYY-MM-DD) ### Breaking Changes @@ -102,6 +128,8 @@ * 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,38 +154,7 @@ * Updated to CMake 3.27.7 * 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. +* 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.0 (2023-12-01) 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. } diff --git a/packages/cinterop/build.gradle.kts b/packages/cinterop/build.gradle.kts index 202ccf5abe..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") } } @@ -502,6 +507,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")) } @@ -757,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 + } +} 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 b79c41f4f4..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 @@ -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? @@ -1275,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/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 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..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 @@ -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 { @@ -2412,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/external/core b/packages/external/core index 5533505d18..374dd672af 160000 --- a/packages/external/core +++ b/packages/external/core @@ -1 +1 @@ -Subproject commit 5533505d18fda93a7a971d58a191db5005583c92 +Subproject commit 374dd672af357732dccc135fecc905406fec3223 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") 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 }; 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, 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 b77ebc1c5aea04ce3aea5c8484538e0cdb72fe40 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 4 Apr 2024 08:04:34 +0100 Subject: [PATCH 06/11] [RKOTLIN-825] Remove unused docker image (#1699) --- Dockerfile.android | 96 ---------------------------------------------- 1 file changed, 96 deletions(-) delete mode 100644 Dockerfile.android diff --git a/Dockerfile.android b/Dockerfile.android deleted file mode 100644 index 1f2799afcb..0000000000 --- a/Dockerfile.android +++ /dev/null @@ -1,96 +0,0 @@ -FROM ubuntu:18.04 - -# Locales -RUN apt-get clean && apt-get -y update && apt-get install -y locales && locale-gen en_US.UTF-8 -ENV LANG "en_US.UTF-8" -ENV LANGUAGE "en_US.UTF-8" -ENV LC_ALL "en_US.UTF-8" -ENV TZ=Europe/Copenhagen -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -# Set the environment variables -ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64 -ENV ANDROID_HOME /opt/android-sdk-linux -# Need by cmake -ENV ANDROID_NDK_HOME /opt/android-ndk -ENV ANDROID_NDK /opt/android-ndk -ENV PATH ${PATH}:${ANDROID_HOME}/emulator:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools -ENV PATH ${PATH}:${NDK_HOME} -ENV NDK_CCACHE /usr/bin/ccache -ENV CCACHE_CPP2 yes - -# Keep the packages in alphabetical order to make it easy to avoid duplication -# tzdata needs to be installed first. See https://askubuntu.com/questions/909277/avoiding-user-interaction-with-tzdata-when-installing-certbot-in-a-docker-contai -# `file` is need by the Android Emulator -RUN DEBIAN_FRONTEND=noninteractive \ - && apt-get update -qq \ - && apt-get install -y tzdata \ - && apt-get install -y bsdmainutils \ - bridge-utils \ - build-essential \ - ccache \ - curl \ - file \ - git \ - jq \ - libc6 \ - libgcc1 \ - libglu1 \ - libncurses5 \ - libssl-dev \ - libstdc++6 \ - libz1 \ - libvirt-clients \ - libvirt-daemon-system \ - openjdk-8-jdk-headless \ - openjdk-11-jdk-headless \ - qemu-kvm \ - s3cmd \ - swig \ - unzip \ - virt-manager \ - wget \ - zip \ - && apt-get clean - -# Install the Android SDK -RUN cd /opt && \ - wget -q https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -O android-tools-linux.zip && \ - unzip android-tools-linux.zip -d ${ANDROID_HOME} && \ - rm -f android-tools-linux.zip - -# Grab what's needed in the SDK -RUN sdkmanager --update - -# Accept licenses before installing components, no need to echo y for each component -# License is valid for all the standard components in versions installed from this file -# Non-standard components: MIPS system images, preview versions, GDK (Google Glass) and Android Google TV require separate licenses, not accepted there -RUN yes | sdkmanager --licenses - -# SDKs -# The `yes` is for accepting all non-standard tool licenses. -# Please keep all sections in descending order! -RUN yes | sdkmanager \ - 'build-tools;29.0.3' \ - 'cmake;3.6.4111459' \ - 'emulator' \ - 'extras;android;m2repository' \ - 'platforms;android-29' \ - 'platform-tools' \ - 'ndk;21.0.6113669' \ - 'system-images;android-29;default;x86_64' - - -# Make the SDK universally writable -RUN chmod -R a+rwX ${ANDROID_HOME} - -ENV PATH "$ANDROID_HOME/cmake/3.6.4111459/bin:$PATH" - -# Building core from source requires CMake 3.15 or higher -# Install CMake -RUN cd /opt \ - && wget https://cmake.org/files/v3.15/cmake-3.15.2-Linux-x86_64.tar.gz \ - && tar zxvf cmake-3.15.2-Linux-x86_64.tar.gz - -ENV PATH "/opt/cmake-3.15.2-Linux-x86_64/bin:$PATH" - From 3723ff7172110db206dd0bd4af97fe3785397be7 Mon Sep 17 00:00:00 2001 From: Kenneth Geisshirt Date: Fri, 5 Apr 2024 12:45:11 +0200 Subject: [PATCH 07/11] Update URL to documentation --- CHANGELOG.md | 2 +- README.md | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97522e2955..5436cd709b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,7 +51,7 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi * 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. - +* Updated URL to documentation. ## 1.14.2-SNAPSHOT (YYYY-MM-DD) diff --git a/README.md b/README.md index 85f2b47878..0d0375c782 100644 --- a/README.md +++ b/README.md @@ -18,19 +18,19 @@ This repository holds the source code for the Kotlin SDK for Realm, which runs o * **Intuitive to Developers:** Realm’s object-oriented data model is simple to learn, doesn’t need an ORM, and lets you write less code. * **Built for Mobile:** Realm is fully-featured, lightweight, and efficiently uses memory, disk space, and battery life. * **Designed for Offline Use:** Realm’s local database persists data on-disk, so apps work as well offline as they do online. -* **[MongoDB Atlas Device Sync](https://www.mongodb.com/atlas/app-services/device-sync)**: Makes it simple to keep data in sync across users, devices, and your backend in real-time. Get started for free with [a template application](https://github.com/mongodb/template-app-kotlin-todo) and [create the cloud backend](http://mongodb.com/realm/register?utm_medium=github_atlas_CTA&utm_source=realm_kotlin_github). +* **[Atlas Device Sync](https://www.mongodb.com/docs/atlas/app-services/sync/)**: Makes it simple to keep data in sync across users, devices, and your backend in real-time. Get started for free with [a template application](https://github.com/mongodb/template-app-kotlin-todo) and [create the cloud backend](http://mongodb.com/realm/register?utm_medium=github_atlas_CTA&utm_source=realm_kotlin_github). # General Availability The Realm Kotlin SDK is GA. -Documentation can be found [here](https://docs.mongodb.com/realm/sdk/kotlin-multiplatform/). +Documentation can be found [here](https://www.mongodb.com/docs/atlas/device-sdks/sdk/kotlin/). Sample projects can be found [here](https://github.com/realm/realm-kotlin-samples). If you are upgrading from a previous beta release of Realm Kotlin, please see the [CHANGELOG](CHANGELOG.md) for the full list of changes. -If you are migrating from [Realm Java](https://github.com/realm/realm-java), please see the [Migration Guide](https://www.mongodb.com/docs/realm/sdk/kotlin/migrate-from-java-sdk-to-kotlin-sdk/). +If you are migrating from [Realm Java](https://github.com/realm/realm-java), please see the [Migration Guide](https://www.mongodb.com/docs/atlas/device-sdks/sdk/kotlin/migrate-from-java-sdk-to-kotlin-sdk/). # Usage @@ -39,8 +39,8 @@ If you are migrating from [Realm Java](https://github.com/realm/realm-java), ple Installation differs slightly depending on the type of project and whether or not you are using Device Sync. See the details in the documentation: -* [Android](https://www.mongodb.com/docs/realm/sdk/kotlin/install/android/#installation) -* [Kotlin Multiplatform](https://www.mongodb.com/docs/realm/sdk/kotlin/install/kotlin-multiplatform/#installation) +* [Android](https://www.mongodb.com/docs/atlas/device-sdks/sdk/kotlin/install/#std-label-kotlin-install-android) +* [Kotlin Multiplatform](https://www.mongodb.com/docs/atlas/device-sdks/sdk/kotlin/install/#std-label-kotlin-install-kotlin-multiplatform) Also pay attention to restrictions on which versions of Kotlin and other dependencies that are supported. You can read more in the [version compatibility matrix](#version-compatibility-matrix). @@ -97,7 +97,7 @@ CoroutineScope(context).async { ## Query -The query language supported by Realm is inspired by Apple’s [NSPredicate](https://developer.apple.com/documentation/foundation/nspredicate), see more examples [here](https://docs.mongodb.com/realm/sdk/kotlin/realm-database/query-language/) +The query language supported by Realm is inspired by Apple’s [NSPredicate](https://developer.apple.com/documentation/foundation/nspredicate), see more examples [here](https://www.mongodb.com/docs/atlas/device-sdks/realm-query-language/) ```Kotlin // All persons From d8c839d395f9122fb093ce6ff9566de6ebd25981 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Mon, 8 Apr 2024 11:57:26 +0200 Subject: [PATCH 08/11] RKOTLIN-1033: Update default base url (#1718) --- CHANGELOG.md | 59 ++++++++++--------- .../realm/kotlin/mongodb/AppConfiguration.kt | 2 +- .../mongodb/common/AppConfigurationTests.kt | 2 +- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5436cd709b..7ed745c5c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi * 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)) +* The default base url in `AppConfiguration` has been updated to point to `services.cloud.mongodb.com`. See https://www.mongodb.com/docs/atlas/app-services/domain-migration/ for more information. (Issue [#1685](https://github.com/realm/realm-kotlin/issues/1685)) ### 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)) @@ -23,7 +24,7 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi * 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) +* 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)). @@ -126,7 +127,7 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi ### Fixed * 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)) +* 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)). @@ -169,7 +170,7 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi 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)) + 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 @@ -217,9 +218,9 @@ This release upgrades the Sync metadata in a way that is not compatible with old * `Realm.close()` is now idempotent. * Fix error in `RealmAny.equals` that would sometimes return `true` when comparing RealmAnys wrapping same type but different values. (Issue [#1523](https://github.com/realm/realm-kotlin/pull/1523)) * [Sync] If calling a function on App Services that resulted in a redirect, it would only redirect for GET requests. (Issue [#1517](https://github.com/realm/realm-kotlin/pull/1517)) -* [Sync] Manual client reset on Windows would not trigger correctly when run inside `onManualResetFallback`. (Issue [#1515](https://github.com/realm/realm-kotlin/pull/1515)) -* [Sync] `ClientResetRequiredException.executeClientReset()` now returns a boolean indicating if the manual reset fully succeeded or not. (Issue [#1515](https://github.com/realm/realm-kotlin/pull/1515)) -* [Sync] If calling a function on App Services that resulted in a redirect, it would only redirect for +* [Sync] Manual client reset on Windows would not trigger correctly when run inside `onManualResetFallback`. (Issue [#1515](https://github.com/realm/realm-kotlin/pull/1515)) +* [Sync] `ClientResetRequiredException.executeClientReset()` now returns a boolean indicating if the manual reset fully succeeded or not. (Issue [#1515](https://github.com/realm/realm-kotlin/pull/1515)) +* [Sync] If calling a function on App Services that resulted in a redirect, it would only redirect for GET requests. (Issue [#1517](https://github.com/realm/realm-kotlin/pull/1517)) * [Sync] If calling a function on App Services that resulted in a redirect, it would only redirect for GET requests. (Issue [#1517](https://github.com/realm/realm-kotlin/pull/1517)) @@ -292,8 +293,8 @@ childA == childC ### Enhancements * Fulltext queries now support prefix search by using the * operator, like `description TEXT 'alex*'`. (Core issue [#6860](https://github.com/realm/realm-core/issues/6860)) -* Realm model classes now generate custom `toString`, `equals` and `hashCode` implementations. This makes it possible to compare by object reference across multiple collections. Note that two objects at different versions will not be considered equal, even -if the content is the same. Custom implementations of these methods will be respected if they are present. (Issue [#1097](https://github.com/realm/realm-kotlin/issues/1097)) +* Realm model classes now generate custom `toString`, `equals` and `hashCode` implementations. This makes it possible to compare by object reference across multiple collections. Note that two objects at different versions will not be considered equal, even +if the content is the same. Custom implementations of these methods will be respected if they are present. (Issue [#1097](https://github.com/realm/realm-kotlin/issues/1097)) * Support for performing geospatial queries using the new classes: `GeoPoint`, `GeoCircle`, `GeoBox`, and `GeoPolygon`. See `GeoPoint` documentation on how to persist locations. (Issue [#1403](https://github.com/realm/realm-kotlin/pull/1403)) * Support for automatic resolution of embedded object constraints during migration through `RealmConfiguration.Builder.migration(migration: AutomaticSchemaMigration, resolveEmbeddedObjectConstraints: Boolean)`. (Issue [#1464](https://github.com/realm/realm-kotlin/issues/1464) * [Sync] Add support for customizing authorization headers and adding additional custom headers to all Atlas App service requests with `AppConfiguration.Builder.authorizationHeaderName()` and `AppConfiguration.Builder.addCustomRequestHeader(...)`. (Issue [#1453](https://github.com/realm/realm-kotlin/pull/1453)) @@ -364,7 +365,7 @@ if the content is the same. Custom implementations of these methods will be resp * [Sync] Optimized the opening of Flexible Sync Realms when `waitForInitialRemoteData` is used. (Issue [#1438](https://github.com/realm/realm-kotlin/issues/1438)) ### Fixed -* [Sync] Using `SyncConfiguration.waitForInitialRemoteData()` would require a network connection, even after opening the realm file for the first time. (Issue [#1439](https://github.com/realm/realm-kotlin/pull/1439)) +* [Sync] Using `SyncConfiguration.waitForInitialRemoteData()` would require a network connection, even after opening the realm file for the first time. (Issue [#1439](https://github.com/realm/realm-kotlin/pull/1439)) ### Compatibility * File format: Generates Realms with file format v23. @@ -429,7 +430,7 @@ if the content is the same. Custom implementations of these methods will be resp * None. ### Fixed -* Deleting `RealmResults` created by `by backlinks()` would crash with `Cannot delete custom Deleteable objects: ObjectBoundRealmResults`. (Issue [#1413](https://github.com/realm/realm-kotlin/issues/1413)) +* Deleting `RealmResults` created by `by backlinks()` would crash with `Cannot delete custom Deleteable objects: ObjectBoundRealmResults`. (Issue [#1413](https://github.com/realm/realm-kotlin/issues/1413)) * Incremental compilation in combination with `@PersistedName` on model class names could result in schema errors when opening the Realm (Issue [#1401](https://github.com/realm/realm-kotlin/issues/1401)). * [Sync] Native crash if a server error was reported while using `SyncConfiguration.waitForInitialRemoteData()`. (Issue [#1401](https://github.com/realm/realm-kotlin/issues/1401)) @@ -487,12 +488,12 @@ This release bumps the minimum supported version of Kotlin from 1.7.20 to 1.8.0. ### Internal * Updated to Realm Core 13.11.0, commit d8721d7baec39571e7e5373c3f407a50d144307e. -* Updated to Sync Protocol version 9. +* Updated to Sync Protocol version 9. * Updated BAAS test server to v2023-05-15. * Updated R8 used by tests to 4.0.48. ### Contributors -* [Tim Klingeleers](https://github.com/Mardaneus86) for fixing the default `compactOnLaunch` logic. +* [Tim Klingeleers](https://github.com/Mardaneus86) for fixing the default `compactOnLaunch` logic. ## 1.8.0 (2023-05-01) @@ -538,7 +539,7 @@ This release bumps the minimum supported version of Kotlin from 1.7.20 to 1.8.0. ### Enhancements * None. - + ### Fixed * Fix compilation issue with Kotlin 1.8.20. (Issue [1346](https://github.com/realm/realm-kotlin/issues/1346)) * [Sync] Client Reset on JVM on Linux would crash with `No built-in scheduler implementation for this platform. Register your own with Scheduler::set_default_factory()` @@ -576,7 +577,7 @@ This release bumps the minimum supported version of Kotlin from 1.7.20 to 1.8.0. * [Sync] Add support for setting App Services connection identifiers through `AppConfiguration.appName` and `AppConfiguration.appVersion`, making it easier to identify connections in the server logs. (Issue (#407)[https://github.com/realm/realm-kotlin/issues/407]) * [Sync] Added `RecoverUnsyncedChangesStrategy`, an alternative automatic client reset strategy that tries to automatically recover any unsynced data from the client. * [Sync] Added `RecoverOrDiscardUnsyncedChangesStrategy`, an alternative automatic client reset strategy that tries to automatically recover any unsynced data from the client, and discards any unsynced data if recovery is not possible. This is now the default policy. - + ### Fixed * Fixed implementation of `RealmSet.iterator()` to throw `ConcurrentModificationException`s when the underlying set has been modified while iterating over it. (Issue [#1220](https://github.com/realm/realm-kotlin/issues/1220)) * Accessing an invalidated `RealmResults` now throws an `IllegalStateException` instead of a `RealmException`. (Issue [#1188](https://github.com/realm/realm-kotlin/pull/1188)) @@ -687,7 +688,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi * Added support for `@PersistedName` annotations for mapping a Kotlin field name to the underlying field name persisted in the Realm. (Issue [#590](https://github.com/realm/realm-kotlin/issues/590)) * [Sync] `App.close()` have been added so it is possible to close underlying ressources used by the app instance. * [Sync] Add support for progress listeners with `SyncSession.progressAsFlow(...)`. (Issue [#428](https://github.com/realm/realm-kotlin/issues/428))lin/issues/1086)) -* [Sync] `Realm.writeCopyTo(syncConfig)` now support copying a Flexible Sync Realm to another Flexible Sync Realm. +* [Sync] `Realm.writeCopyTo(syncConfig)` now support copying a Flexible Sync Realm to another Flexible Sync Realm. * [Sync] Added support for App functions, see documentation for more details. (Issue [#1110](https://github.com/realm/realm-kotlin/pull/1110)) * [Sync] Added support for custom App Services Function authentication. (Issue [#741](https://github.com/realm/realm-kotlin/issues/741)) * [Sync] Add support for accessing user auth profile metadata and custom data through the extension functions 'User.profileAsBsonDocument()' and 'User.customDataAsBsonDocument()'. (Issue [#750](https://github.com/realm/realm-kotlin/pull/750)) @@ -701,7 +702,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi * Realm finalizer thread would prevent JVM main thread from exiting. (Issue [#818](https://github.com/realm/realm-kotlin/issues/818)) * `RealmUUID` did not calculate the correct `hashCode`, so putting it in a `HashSet` resulted in duplicates. * JVM apps on Mac and Linux would use a native file built in debug mode, making it slower than needed. The correct native binary built in release mode is now used. Windows was not affected. (Issue [#1124](https://github.com/realm/realm-kotlin/pull/1124)) -* `RealmUUID.random()` would generate the same values when an app was re-launched from Android Studio during development. (Issue [#1123](https://github.com/realm/realm-kotlin/pull/1123)) +* `RealmUUID.random()` would generate the same values when an app was re-launched from Android Studio during development. (Issue [#1123](https://github.com/realm/realm-kotlin/pull/1123)) * Complete flows with an IllegalStateException instead of crashing when notifications cannot be delivered due to insufficient channel capacity (Issue [#1147](https://github.com/realm/realm-kotlin/issues/1147)) * Prevent "Cannot listen for changes on a deleted Realm reference"-exceptions when notifier is not up-to-date with newest updates from write transaction. * [Sync] Custom loggers now correctly see both normal and sync events. Before, sync events were just logged directly to LogCat/StdOut. @@ -834,7 +835,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi ### Breaking Changes * Minimum Kotlin version has been raised from 1.6.10 to 1.7.20. -* Support for the original (old) memory model on Kotlin Native has been dropped. Only the new Kotlin Native memory model is supported. +* Support for the original (old) memory model on Kotlin Native has been dropped. Only the new Kotlin Native memory model is supported. * Minimum Gradle version has been raised from 6.1.1 to 6.7.1. * Minimum Ktor version has been raised from 1.6.8 to 2.1.2. @@ -954,7 +955,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi * Kotlin 1.6.10 and above. * Coroutines 1.6.0-native-mt. Also compatible with Coroutines 1.6.0 but requires enabling of the new memory model and disabling of freezing, see https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility for details on that. * AtomicFu 0.17.0. -* Minimum Gradle version: 6.1.1. +* Minimum Gradle version: 6.1.1. * Minimum Android Gradle Plugin version: 4.0.0. * Minimum Android SDK: 16. @@ -986,7 +987,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi * Kotlin 1.6.10 and above. * Coroutines 1.6.0-native-mt. Also compatible with Coroutines 1.6.0 but requires enabling of the new memory model and disabling of freezing, see https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility for details on that. * AtomicFu 0.17.0. -* Minimum Gradle version: 6.1.1. +* Minimum Gradle version: 6.1.1. * Minimum Android Gradle Plugin version: 4.0.0. * Minimum Android SDK: 16. @@ -1015,7 +1016,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi * Kotlin 1.6.10 and above. * Coroutines 1.6.0-native-mt. Also compatible with Coroutines 1.6.0 but requires enabling of the new memory model and disabling of freezing, see https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility for details on that. * AtomicFu 0.17.0. -* Minimum Gradle version: 6.1.1. +* Minimum Gradle version: 6.1.1. * Minimum Android Gradle Plugin version: 4.0.0. * Minimum Android SDK: 16. @@ -1073,7 +1074,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi * Kotlin 1.6.10 and above. * Coroutines 1.6.0-native-mt. Also compatible with Coroutines 1.6.0 but requires enabling of the new memory model and disabling of freezing, see https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility for details on that. * AtomicFu 0.17.0. -* Minimum Gradle version: 6.1.1. +* Minimum Gradle version: 6.1.1. * Minimum Android Gradle Plugin version: 4.0.0. * Minimum Android SDK: 16. @@ -1097,7 +1098,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi * Kotlin 1.6.10 and above. * Coroutines 1.6.0-native-mt. Also compatible with Coroutines 1.6.0 but requires enabling of the new memory model and disabling of freezing, see https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility for details on that. * AtomicFu 0.17.0. -* Minimum Gradle version: 6.1.1. +* Minimum Gradle version: 6.1.1. * Minimum Android Gradle Plugin version: 4.0.0. * Minimum Android SDK: 16. @@ -1135,7 +1136,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi * Kotlin 1.6.10 and above. * Coroutines 1.6.0-native-mt. Also compatible with Coroutines 1.6.0 but requires enabling of the new memory model and disabling of freezing, see https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility for details on that. * AtomicFu 0.17.0. -* Minimum Gradle version: 6.1.1. +* Minimum Gradle version: 6.1.1. * Minimum Android Gradle Plugin version: 4.0.0. * Minimum Android SDK: 16. @@ -1164,7 +1165,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi * Kotlin 1.6.10. * Coroutines 1.6.0-native-mt. Also compatible with Coroutines 1.6.0 but requires enabling of the new memory model and disabling of freezing, see https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility for details on that. * AtomicFu 0.17.0. -* Minimum Gradle version: 6.1.1. +* Minimum Gradle version: 6.1.1. * Minimum Android Gradle Plugin version: 4.0.0. * Minimum Android SDK: 16. @@ -1189,7 +1190,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi * Kotlin 1.6.10. * Coroutines 1.6.0-native-mt. Also compatible with Coroutines 1.6.0 but requires enabling of the new memory model and disabling of freezing, see https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility for details on that. * AtomicFu 0.17.0. -* Minimum Gradle version: 6.1.1. +* Minimum Gradle version: 6.1.1. * Minimum Android Gradle Plugin version: 4.0.0. * Minimum Android SDK: 16. @@ -1241,7 +1242,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi * Kotlin 1.6.10. * Coroutines 1.6.0-native-mt. Also compatible with Coroutines 1.6.0 but requires enabling of the new memory model and disabling of freezing, see https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility for details on that. * AtomicFu 0.17.0. -* Minimum Gradle version: 6.1.1. +* Minimum Gradle version: 6.1.1. * Minimum Android Gradle Plugin version: 4.0.0. * Minimum Android SDK: 16. @@ -1271,7 +1272,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi * Kotlin 1.6.10. * Coroutines 1.6.0-native-mt. Also compatible with Coroutines 1.6.0 but requires enabling of the new memory model and disabling of freezing, see https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility for details on that. * AtomicFu 0.17.0. -* Minimum Gradle version: 6.1.1. +* Minimum Gradle version: 6.1.1. * Minimum Android Gradle Plugin version: 4.0.0. * Minimum Android SDK: 16. @@ -1324,7 +1325,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi * Kotlin 1.6.10. * Coroutines 1.5.2-native-mt. * AtomicFu 0.17.0. -* Minimum Gradle version: 6.1.1. +* Minimum Gradle version: 6.1.1. * Minimum Android Gradle Plugin version: 4.0.0. * Minimum Android SDK: 16. @@ -1356,7 +1357,7 @@ This release will bump the Realm file format from version 22 to 23. Opening a fi * Kotlin 1.6.10. * Coroutines 1.5.2-native-mt. * AtomicFu 0.17.0. -* Minimum Gradle version: 6.1.1. +* Minimum Gradle version: 6.1.1. * Minimum Android Gradle Plugin version: 4.0.0. * Minimum Android SDK: 16. diff --git a/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/AppConfiguration.kt b/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/AppConfiguration.kt index 1644a1d7e9..d5e35e37b1 100644 --- a/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/AppConfiguration.kt +++ b/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/AppConfiguration.kt @@ -129,7 +129,7 @@ public interface AppConfiguration { * * @see Builder#baseUrl(String) */ - public const val DEFAULT_BASE_URL: String = "https://realm.mongodb.com" + public const val DEFAULT_BASE_URL: String = "https://services.cloud.mongodb.com" /** * The default header name used to carry authorization data when making network requests diff --git a/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/AppConfigurationTests.kt b/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/AppConfigurationTests.kt index af8475f50c..3b97a3b0fe 100644 --- a/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/AppConfigurationTests.kt +++ b/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/AppConfigurationTests.kt @@ -239,7 +239,7 @@ class AppConfigurationTests { @Test fun baseUrl_defaultValue() { - val url = "https://realm.mongodb.com" + val url = "https://services.cloud.mongodb.com" val config = AppConfiguration.Builder("foo").build() assertEquals(url, config.baseUrl) } From 7fe46e8cf60a228528bb70941c595f069d369981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Tue, 9 Apr 2024 22:04:01 +0200 Subject: [PATCH 09/11] Upgrade to Core 14.5.0 --- CHANGELOG.md | 2 +- .../kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt | 3 ++- packages/external/core | 2 +- packages/jni-swig-stub/src/main/jni/realm_api_helpers.cpp | 3 ++- packages/jni-swig-stub/src/main/jni/realm_api_helpers.h | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ed745c5c0..fc0f62bad3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,7 +49,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.4.1 commit 374dd672af357732dccc135fecc905406fec3223. +* Updated to Realm Core 14.5.0 commit f9212cc5db8599278cd3d1d73d95df3188b5c3b9. * Deprecated Jenkins and switching to Github Action ([JIRA]https://jira.mongodb.org/browse/RKOTLIN-825). - Remove CMake required version. * Updated URL to documentation. 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 af6c2c030e..10b979dafa 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 @@ -2703,8 +2703,9 @@ actual object RealmInterop { return CPointerWrapper( realm_wrapper.realm_sync_session_register_progress_notifier( syncSession.cptr(), - staticCFunction { userData, transferred_bytes, total_bytes -> + staticCFunction { userData, transferred_bytes, total_bytes, _ -> safeUserData(userData).run { + // TODO Progress ignored until https://github.com/realm/realm-kotlin/pull/1575 onChange(transferred_bytes.toLong(), total_bytes.toLong()) } }, diff --git a/packages/external/core b/packages/external/core index 374dd672af..f9212cc5db 160000 --- a/packages/external/core +++ b/packages/external/core @@ -1 +1 @@ -Subproject commit 374dd672af357732dccc135fecc905406fec3223 +Subproject commit f9212cc5db8599278cd3d1d73d95df3188b5c3b9 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 2dfcdfdb39..df18021fc7 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 @@ -1244,9 +1244,10 @@ sync_after_client_reset_handler(realm_sync_config_t* config, jobject after_handl } void -realm_sync_session_progress_notifier_callback(void *userdata, uint64_t transferred_bytes, uint64_t total_bytes) { +realm_sync_session_progress_notifier_callback(void *userdata, uint64_t transferred_bytes, uint64_t total_bytes, double progress) { auto env = get_env(true); + // TODO Progress ignored until https://github.com/realm/realm-kotlin/pull/1575 static JavaMethod java_callback_method(env, JavaClassGlobalDef::progress_callback(), "onChange", "(JJ)V"); jni_check_exception(env); 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 34f837dbc0..2fae610c7b 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 @@ -107,7 +107,7 @@ void sync_after_client_reset_handler(realm_sync_config_t* config, jobject after_handler); void -realm_sync_session_progress_notifier_callback(void *userdata, uint64_t transferred_bytes, uint64_t total_bytes); +realm_sync_session_progress_notifier_callback(void *userdata, uint64_t transferred_bytes, uint64_t total_bytes, double progress); void realm_sync_session_connection_state_change_callback(void *userdata, realm_sync_connection_state_e old_state, realm_sync_connection_state_e new_state); From bf0c7aa0fc15acab98901d0af0139f06567a8e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Fri, 12 Apr 2024 14:27:20 +0200 Subject: [PATCH 10/11] Upgrade to Core 14.5.1. --- CHANGELOG.md | 2 +- packages/external/core | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc0f62bad3..42b9ff130a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,7 +49,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.5.0 commit f9212cc5db8599278cd3d1d73d95df3188b5c3b9. +* Updated to Realm Core 14.5.1 commit 316889b967f845fbc10b4422f96c7eadd47136f2. * Deprecated Jenkins and switching to Github Action ([JIRA]https://jira.mongodb.org/browse/RKOTLIN-825). - Remove CMake required version. * Updated URL to documentation. diff --git a/packages/external/core b/packages/external/core index f9212cc5db..316889b967 160000 --- a/packages/external/core +++ b/packages/external/core @@ -1 +1 @@ -Subproject commit f9212cc5db8599278cd3d1d73d95df3188b5c3b9 +Subproject commit 316889b967f845fbc10b4422f96c7eadd47136f2 From 663187fbd79af06c6ad31ca48078768fc5a56bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Wed, 17 Apr 2024 09:23:56 +0200 Subject: [PATCH 11/11] Apply suggestions from code review Co-authored-by: Kenneth Geisshirt --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42b9ff130a..8a05c2d84b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi ### 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)) -* 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)) +* 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)) @@ -21,7 +21,7 @@ This release will bump the Realm file format from version 23 to 24. Opening a fi ### 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). +* 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)