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 all 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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,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: 11 additions & 2 deletions 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=false
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,8 +249,14 @@ pipeline {
stage('Gradle Plugin Integration Tests') {
when { expression { runTests } }
steps {
testAndCollect("integration-tests/gradle-plugin-test", "integrationTest")
testAndCollect("integration-tests/gradle-plugin-test", "-Pkotlin.experimental.tryK2=true 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 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
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
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")
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.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