Skip to content

Commit

Permalink
Merge branch 'main' into nh/RealmInstant_now
Browse files Browse the repository at this point in the history
  • Loading branch information
nhachicha authored Nov 27, 2023
2 parents 42a84fa + 9d23735 commit 3909160
Show file tree
Hide file tree
Showing 167 changed files with 5,425 additions and 618 deletions.
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
* None.

### Enhancements
* None.
* Support for experimental K2-compilation with `kotlin.experimental.tryK2=true`. (Issue [#1483](https://github.com/realm/realm-kotlin/issues/1483))

### Fixed
* `RealmInstant.now` used an API (`java.time.Clock.systemUTC().instant()`) introduced in API 26, current minSDK is 16. (Issue [#1564](https://github.com/realm/realm-kotlin/issues/1564))
* Fix compiler crash caused by a change in Kotlin 1.9.20 ((toIrConst moved under common IrUtils)[https://github.com/JetBrains/kotlin/commit/ca8db7d0b83f6dfd6afcea7a5fe7556d38f325d8]). (Issue [#1566](https://github.com/realm/realm-kotlin/issues/1566))

### Compatibility
* File format: Generates Realms with file format v23.
* Realm Studio 13.0.0 or above is required to open Realms created by this version.
* This release is compatible with the following Kotlin releases:
* Kotlin 1.8.0 and above. The K2 compiler is not supported yet.
* Kotlin 1.9.0 and above. Support for experimental K2-compilation with `kotlin.experimental.tryK2=true`.
* Ktor 2.1.2 and above.
* Coroutines 1.7.0 and above.
* AtomicFu 0.18.3 and above.
Expand All @@ -22,6 +23,7 @@
* 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.
Expand All @@ -36,7 +38,7 @@
* None.

### Fixed
* Fix craches caused by posting to a released scheduler. (Issue [#1543](https://github.com/realm/realm-kotlin/issues/1543))
* Fix crashes caused by posting to a released scheduler. (Issue [#1543](https://github.com/realm/realm-kotlin/issues/1543))

### Compatibility
* File format: Generates Realms with file format v23.
Expand Down Expand Up @@ -85,7 +87,7 @@ GET requests. (Issue [#1517](https://github.com/realm/realm-kotlin/pull/1517))
* File format: Generates Realms with file format v23.
* Realm Studio 13.0.0 or above is required to open Realms created by this version.
* This release is compatible with the following Kotlin releases:
* Kotlin 1.8.0 and above. The K2 compiler is not supported yet.
* Kotlin 1.8.20 and above. The K2 compiler is not supported yet.
* Ktor 2.1.2 and above.
* Coroutines 1.7.0 and above.
* AtomicFu 0.18.3 and above.
Expand Down
13 changes: 12 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ pipeline {
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 {
Expand Down Expand Up @@ -246,7 +249,14 @@ pipeline {
stage('Gradle Plugin Integration Tests') {
when { expression { runTests } }
steps {
testAndCollect("integration-tests/gradle-plugin-test", "integrationTest")
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")
}
}
}
stage('Tests Android Sample App') {
Expand All @@ -268,6 +278,7 @@ pipeline {
when { expression { runTests } }
steps {
testAndCollect("examples/realm-java-compatibility", "connectedAndroidTest")
testAndCollect("examples/realm-java-compatibility", "-Pkotlin.experimental.tryK2=true connectedAndroidTest")
}
}
stage('Track build metrics') {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fun readAndCacheVersion(): String {
return version
}
val currentVersion = readAndCacheVersion()
val subprojects = listOf("packages", "integration-tests/gradle-plugin-test", "examples/kmm-sample", "benchmarks")
val subprojects = listOf("packages", "examples/kmm-sample", "benchmarks")
fun taskName(subdir: String): String {
return subdir.split("/", "-").map { it.capitalize() }.joinToString(separator = "")
}
Expand Down
10 changes: 5 additions & 5 deletions buildSrc/src/main/kotlin/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ object Versions {
const val buildToolsVersion = "33.0.0"
const val buildTools = "7.3.1" // https://maven.google.com/web/index.html?q=gradle#com.android.tools.build:gradle
const val ndkVersion = "23.2.8568313"
const val r8 = "4.0.48" // See https://developer.android.com/build/kotlin-support
const val r8 = "8.0.34" // See https://developer.android.com/build/kotlin-support
}
const val androidxBenchmarkPlugin = "1.2.0-alpha12" // https://maven.google.com/web/index.html#androidx.benchmark:androidx.benchmark.gradle.plugin
const val androidxStartup = "1.1.1" // https://maven.google.com/web/index.html?q=startup#androidx.startup:startup-runtime
Expand All @@ -119,24 +119,24 @@ object Versions {
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
const val dokka = "1.6.0" // https://github.com/Kotlin/dokka
const val dokka = "1.9.0" // https://github.com/Kotlin/dokka
const val gradlePluginPublishPlugin = "0.15.0" // https://plugins.gradle.org/plugin/com.gradle.plugin-publish
const val jmh = "1.34" // https://github.com/openjdk/jmh
const val jmhPlugin = "0.6.6" // https://github.com/melix/jmh-gradle-plugin
const val junit = "4.13.2" // https://mvnrepository.com/artifact/junit/junit
const val kbson = "0.3.0" // https://github.com/mongodb/kbson
// When updating the Kotlin version, also remember to update /examples/min-android-sample/build.gradle.kts
const val kotlin = "1.8.21" // https://github.com/JetBrains/kotlin and https://kotlinlang.org/docs/releases.html#release-details
const val kotlin = "1.9.0" // https://github.com/JetBrains/kotlin and https://kotlinlang.org/docs/releases.html#release-details
const val kotlinJvmTarget = "1.8" // Which JVM bytecode version is kotlin compiled to.
const val latestKotlin = "1.9.20-Beta" // https://kotlinlang.org/docs/eap.html#build-details
const val latestKotlin = "1.9.20" // https://kotlinlang.org/docs/eap.html#build-details
const val kotlinCompileTesting = "1.5.0" // https://github.com/tschuchortdev/kotlin-compile-testing
const val ktlint = "0.45.2" // https://github.com/pinterest/ktlint
const val ktor = "2.1.2" // https://github.com/ktorio/ktor
const val multidex = "2.0.1" // https://developer.android.com/jetpack/androidx/releases/multidex
const val nexusPublishPlugin = "1.1.0" // https://github.com/gradle-nexus/publish-plugin
const val okio = "3.2.0" // https://square.github.io/okio/#releases
const val relinker = "1.4.5" // https://github.com/KeepSafe/ReLinker
const val serialization = "1.4.0" // https://kotlinlang.org/docs/releases.html#release-details
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
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.
Expand Down
2 changes: 1 addition & 1 deletion examples/kmm-sample/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ kotlin {
implementation("com.google.android.material:material:1.2.0")
}
}
val androidTest by getting {
val androidInstrumentedTest by getting {
dependencies {
implementation(kotlin("test-junit"))
implementation("junit:junit:4.12")
Expand Down
4 changes: 2 additions & 2 deletions examples/min-android-sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.3")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0")
classpath("com.android.tools.build:gradle:4.2.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0")
classpath("io.realm.kotlin:gradle-plugin:${rootProject.extra["realmVersion"]}")
}
}
Expand Down
6 changes: 5 additions & 1 deletion examples/min-android-sample/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# org.gradle.parallel=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
android.useAndroidX=true
android.useAndroidX=true

org.gradle.configuration-cache=true

kotlin.mpp.androidSourceSetLayoutVersion=1
5 changes: 4 additions & 1 deletion integration-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

This folder holds the various integration test projects.

- `gradle-plugin-test` - Smoke test project that verifies that our top level Gradle plugin can be
- `gradle/` - Various smoke test project that verifies that our top level Gradle plugin can be
applied on a both single and a multi platform modules. It is currently testing:
- `single-platform` - Android single module project
- `multi-platform` - Kotlin Multiplatform project with JVM and Native targets running on the host
platform.
There are various project with specific Gradle versions that has been proven troublesome with
regards to collecting analytics data and a `current` project that will use the versions used to
build the SDK.
1 change: 0 additions & 1 deletion integration-tests/gradle-plugin-test/buildSrc

This file was deleted.

1 change: 1 addition & 0 deletions integration-tests/gradle/current/buildSrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ kotlin.mpp.stability.nowarn=true
kotlin.native.binary.memoryModel=experimental
kotlin.native.binary.freezing=disabled

org.gradle.configuration-cache=true
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2022 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.
*/

@file:OptIn(ExperimentalForeignApi::class)

package io.realm.test.multiplatform.util.platform

import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.cstr

actual object PlatformUtils {
actual fun createTempDir(prefix: String): String {
// X is a special char which will be replace by mkdtemp template
val mask = prefix.replace('X', 'Z', ignoreCase = true)
val path = "${platform.Foundation.NSTemporaryDirectory()}$mask-native_tests"
platform.posix.mkdtemp(path.cstr)
return path
}

actual fun deleteTempDir(path: String) {
platform.Foundation.NSFileManager.defaultManager.removeItemAtURL(
platform.Foundation.NSURL(fileURLWithPath = path),
null
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ pluginManagement {
gradlePluginPortal()
google()
mavenCentral()
maven("file://${rootDir.absolutePath}/../../packages/build/m2-buildrepo")
maven("file://${rootDir.absolutePath}/../../../packages/build/m2-buildrepo")
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("file://${rootDir.absolutePath}/../../packages/build/m2-buildrepo")
maven("file://${rootDir.absolutePath}/../../../packages/build/m2-buildrepo")
}
}

Expand Down
51 changes: 51 additions & 0 deletions integration-tests/gradle/gradle6-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2022 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.
*/

// Explicitly adding the plugin to the classpath as it makes it easier to control the version
// centrally (don't need version in the 'plugins' block). Further, snapshots are not published with
// marker interface so would need to be added to the classpath manually anyway.
buildscript {
extra["realmVersion"] = file("${rootProject.rootDir.absolutePath}/../../../buildSrc/src/main/kotlin/Config.kt")
.readLines()
.first { it.contains("const val version") }
.let {
it.substringAfter("\"").substringBefore("\"")
}

repositories {
maven(url = "file://${rootProject.rootDir.absolutePath}/../../../packages/build/m2-buildrepo")
gradlePluginPortal()
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0")
classpath("io.realm.kotlin:gradle-plugin:${rootProject.extra["realmVersion"]}")
}
}
group = "io.realm.test"
version = rootProject.extra["realmVersion"]

// Attempt to make an easy entry point for verifying all modules. Maybe we could do a better split
// when migrating to GHA.
tasks.register("integrationTest") {
dependsOn(":single-platform:connectedDebugAndroidTest")
dependsOn(":multi-platform:cleanAllTests")
dependsOn(":multi-platform:jvmTest")
dependsOn(":multi-platform:nativeTest")
}
31 changes: 31 additions & 0 deletions integration-tests/gradle/gradle6-test/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Copyright 2022 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.
#

kotlin.code.style=official

org.gradle.jvmargs=-Xmx4096M

android.useAndroidX=true
android.enableJetifier=true

kotlin.mpp.stability.nowarn=true

# Enable new memory model as default
kotlin.native.binary.memoryModel=experimental
kotlin.native.binary.freezing=disabled

org.gradle.configuration-cache=true
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 3909160

Please sign in to comment.