Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metric overhaul #1504

Merged
merged 28 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
64d23c6
Metric overhaul
rorbech Sep 6, 2023
902e8f7
Support gradle configuration caching
rorbech Sep 8, 2023
8f869f4
Apply suggestions from code review
rorbech Sep 11, 2023
544a3c4
Updates according to review comments
rorbech Sep 11, 2023
50a79be
Fix json formatting
rorbech Sep 12, 2023
da915cc
Merge remote-tracking branch 'origin/cr/metrics-overhaul' into cr/met…
rorbech Sep 12, 2023
4b7ee93
Merge branch 'main' into cr/metrics-overhaul
rorbech Sep 19, 2023
410bbd4
Read core version through platform agnostic APIs
rorbech Sep 19, 2023
2c861cf
Update documentation of dumping options
rorbech Sep 19, 2023
73501df
Fix windows build.
cmelchior Sep 21, 2023
7dcf74c
Enable collection of metrics in CI builds
rorbech Sep 22, 2023
ddad510
Update builder id string when failing
rorbech Sep 22, 2023
27da2a0
Fix cocoapods reference in collected metrics
rorbech Sep 22, 2023
0cb3003
Bump minimum supported Gradle version
rorbech Sep 27, 2023
cb866a6
Change info message prefix
rorbech Sep 27, 2023
5351adb
Gradle version differentiation and error handling
rorbech Oct 9, 2023
18aaa89
Add gradle version test projects
rorbech Oct 10, 2023
cb61636
Clean up gradle compatibility tests
rorbech Oct 10, 2023
6b51f79
Run Gradle8 tests with JDK 17
rorbech Oct 11, 2023
471a9bb
Fix gradle8 build issue
rorbech Oct 11, 2023
cd59445
Fix jenkins environment for gradle 8 build
rorbech Oct 11, 2023
34f2882
Merge branch 'main' into cr/metrics-overhaul
rorbech Oct 11, 2023
01e10a1
Upgrade minimum supported Kotlin version
rorbech Oct 13, 2023
9f9a301
Add gradle integration project with current version
rorbech Oct 17, 2023
d4b65d6
Revert minimum supported Gradle version
rorbech Oct 17, 2023
aff72ae
Revert project settings
rorbech Oct 17, 2023
a22da77
Merge branch 'main' into cr/metrics-overhaul
rorbech Nov 14, 2023
a3598de
Bump Kotlin version in integration tests to fit new minimum version
rorbech Nov 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ 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.
* 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 Gradle version: 7.1.
* Minimum Android Gradle Plugin version: 4.1.3.
* Minimum Android SDK: 16.

Expand Down
10 changes: 9 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_ANALYICS_FAILONERROR=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,12 @@ pipeline {
stage('Gradle Plugin Integration Tests') {
when { expression { runTests } }
steps {
testAndCollect("integration-tests/gradle-plugin-test", "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 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
2 changes: 1 addition & 1 deletion examples/min-android-sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ buildscript {
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.3")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20")
classpath("io.realm.kotlin:gradle-plugin:${rootProject.extra["realmVersion"]}")
}
}
Expand Down
4 changes: 3 additions & 1 deletion examples/min-android-sample/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ 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
1 change: 0 additions & 1 deletion integration-tests/gradle-plugin-test/buildSrc

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,31 @@
* limitations under the License.
*/

plugins {
id("realm-lint")
}

// 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 {
dependencies {
classpath("io.realm.kotlin:gradle-plugin:${Realm.version}")
}
extra["realmVersion"] = file("${rootProject.rootDir.absolutePath}/../../../buildSrc/src/main/kotlin/Config.kt")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is because you want to decouple the tests completely?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It we use buildSrc to gain access to Config.kt it is problematic to use Kotlin and AGP versions that are different from the ones in Config.kt because buildSrc applies a number of plugins and that will fix the versions.

.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.1.3")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20")
classpath("io.realm.kotlin:gradle-plugin:${rootProject.extra["realmVersion"]}")
}
}
group = "io.realm.test"
version = Realm.version
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.
Expand Down
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation("io.realm.kotlin:library-base:${Realm.version}")
implementation("io.realm.kotlin:library-base:${rootProject.extra["realmVersion"]}")
}
}
val commonTest by getting {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
* limitations under the License.
*/

rootProject.name = "gradle-plugin-test"
rootProject.name = "gradle6-plugin-test"

pluginManagement {
repositories {
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,30 @@ plugins {
}

android {
compileSdk = Versions.Android.compileSdkVersion
compileSdk = 33
cmelchior marked this conversation as resolved.
Show resolved Hide resolved

defaultConfig {
minSdk = Versions.Android.minSdk
targetSdk = Versions.Android.targetSdk
minSdk = 16
targetSdk = 33
multiDexEnabled = true

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = Versions.sourceCompatibilityVersion
targetCompatibility = Versions.targetCompatibilityVersion
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = Versions.kotlinJvmTarget
jvmTarget = "1.8"
}
}

dependencies {
implementation("androidx.appcompat:appcompat:1.5.1")
implementation("androidx.multidex:multidex:2.0.1")
implementation("io.realm.kotlin:library-base:${Realm.version}")
implementation("io.realm.kotlin:library-base:${rootProject.extra["realmVersion"]}")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.3")
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
Expand Down
51 changes: 51 additions & 0 deletions integration-tests/gradle/gradle71-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:7.0.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20")
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/gradle71-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
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading