Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Breaking Changes

- The SDK is now compiled for Java 11 instead of Java 8. JVM applications need Java 11 or newer ([#6459](https://github.com/getsentry/sentry-java/pull/6459))
- Kotlin applications need Kotlin 1.9 or newer. The SDK is built with Kotlin 2.4 for language and API version 2.0 (previously 1.9), and its Kotlin modules depend on `kotlin-stdlib` 2.0.21 (previously 1.9.24) ([#6487](https://github.com/getsentry/sentry-java/pull/6487))
- Default trace context status to `ok` when an active span has no explicit status ([#6418](https://github.com/getsentry/sentry-java/pull/6418))
- Remove the deprecated user feedback APIs ([#6337](https://github.com/getsentry/sentry-java/pull/6337))
- `UserFeedback` and `Sentry.captureUserFeedback(...)`: use `Sentry.feedback().capture(...)` with `io.sentry.protocol.Feedback` instead
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

/** The JDK every module compiles and tests with, whatever JDK runs Gradle. */
Expand All @@ -33,6 +35,7 @@ private val PUBLISHED_JAVA_VERSION = JavaVersion.VERSION_11
* archives are checked for it
* - published Android modules main code targets Java 11
* - minSdk is set for Android libraries
* - Kotlin module names stay the project name
*/
class JdkTargetConvention : Plugin<Project> {
override fun apply(project: Project) {
Expand Down Expand Up @@ -98,6 +101,36 @@ class JdkTargetConvention : Plugin<Project> {
listOf("com.android.library", "com.android.application").forEach { pluginId ->
project.plugins.withId(pluginId) { project.targetBuildJdkForUnitTests() }
}

project.keepKotlinModuleNameWithoutGroup()
}

/**
* KGP 2.4 prefixes the Kotlin module name with the group, e.g. `io.sentry:sentry-okhttp`. R8 copies
* that name into the names of the `.kotlin_module` entries it writes under `META-INF`, and app
* bundles reject the colon, so the module name stays the project name, as before KGP 2.4.
*/
private fun Project.keepKotlinModuleNameWithoutGroup() {
val moduleName = name
plugins.withId("org.jetbrains.kotlin.jvm") {
extensions.getByType(KotlinJvmProjectExtension::class.java).compilerOptions.moduleName.set(
moduleName
)
}
plugins.withId("org.jetbrains.kotlin.android") {
extensions.getByType(KotlinAndroidProjectExtension::class.java).compilerOptions.moduleName.set(
moduleName
)
}
plugins.withId("org.jetbrains.kotlin.multiplatform") {
val targets = extensions.getByType(KotlinMultiplatformExtension::class.java).targets
targets.withType(KotlinJvmTarget::class.java).configureEach {
compilerOptions.moduleName.set(moduleName)
}
targets.withType(KotlinAndroidTarget::class.java).configureEach {
compilerOptions.moduleName.set(moduleName)
}
}
}

private fun Project.minSdk(): Int =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package io.sentry.gradle

import org.gradle.api.GradleException
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.ExtensionAware
import org.gradle.kotlin.dsl.create
import org.jetbrains.kotlin.gradle.dsl.abi.AbiValidationExtension
import org.jetbrains.kotlin.gradle.dsl.abi.AbiValidationMultiplatformExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension
import org.jetbrains.kotlin.gradle.dsl.abi.ExperimentalAbiValidation

private val KOTLIN_PLUGIN_IDS =
Expand Down Expand Up @@ -34,14 +31,12 @@ class SentryApiValidationPlugin : Plugin<Project> {
}

private fun enable(project: Project, extension: ApiValidationExtension) {
val kotlin = project.extensions.getByName("kotlin") as ExtensionAware
when (val abi = kotlin.extensions.getByName("abiValidation")) {
is AbiValidationMultiplatformExtension -> abi.also { it.enabled.set(true) }
is AbiValidationExtension -> abi.also { it.enabled.set(true) }
else -> throw GradleException("Unexpected abiValidation extension: ${abi.javaClass.name}")
}.filters {
// Lazy, because the module configures the extension after this plugin has been applied.
exclude { byNames.addAll(extension.ignoredPackages.map { it.map { pkg -> "$pkg.**" } }) }
val kotlin = project.extensions.getByName("kotlin") as KotlinTopLevelExtension
kotlin.abiValidation {
filters {
// Lazy, because the module configures the extension after this plugin has been applied.
exclude { byNames.addAll(extension.ignoredPackages.map { it.map { pkg -> "$pkg.**" } }) }
}
}
}
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
object Config {
val AGP = System.getenv("VERSION_AGP") ?: "9.4.0"
val kotlinStdLib = "stdlib-jdk8"
val kotlinStdLibVersionAndroid = "1.9.24"
val kotlinStdLibVersionAndroid = "2.0.21"
val kotlinTestJunit = "test-junit"

object BuildPlugins {
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ feign = "11.6"
gummyBears = "0.12.0"
jackson = "2.18.3"
jetbrainsCompose = "1.6.11"
kotlin = "2.3.21"
kotlin-compatible-version = "1.9"
kotlin = "2.4.21"
kotlin-compatible-version = "2.0"
ksp = "2.3.9"
ktorClient = "3.0.0"
logback = "1.2.9"
Expand Down
2 changes: 1 addition & 1 deletion sentry-android-distribution/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ android {

kotlin {
compilerOptions.jvmTarget = JVM_11
compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.languageVersion = KotlinVersion.KOTLIN_2_0
explicitApi()
}

Expand Down
1 change: 1 addition & 0 deletions sentry-android-fragment/api/sentry-android-fragment.api
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public final class io/sentry/android/fragment/FragmentLifecycleState : java/lang
public static final field STOPPED Lio/sentry/android/fragment/FragmentLifecycleState;
public static final field VIEW_CREATED Lio/sentry/android/fragment/FragmentLifecycleState;
public static final field VIEW_DESTROYED Lio/sentry/android/fragment/FragmentLifecycleState;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public static fun valueOf (Ljava/lang/String;)Lio/sentry/android/fragment/FragmentLifecycleState;
public static fun values ()[Lio/sentry/android/fragment/FragmentLifecycleState;
}
Expand Down
4 changes: 2 additions & 2 deletions sentry-android-fragment/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ android {

kotlin {
compilerOptions.jvmTarget = JvmTarget.JVM_11
compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.languageVersion = KotlinVersion.KOTLIN_2_0
compilerOptions.apiVersion = KotlinVersion.KOTLIN_2_0
}

testOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
-dontwarn timber.log.Timber$Tree
-dontwarn kotlin.Deprecated
-dontwarn kotlin.Function
-dontwarn kotlin.jvm.JvmField
-dontwarn kotlin.jvm.JvmStatic
-dontwarn kotlin.jvm.functions.Function2
-dontwarn kotlin.jvm.functions.Function3
Expand Down
4 changes: 2 additions & 2 deletions sentry-android-navigation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ android {

kotlin {
compilerOptions.jvmTarget = JVM_11
compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.languageVersion = KotlinVersion.KOTLIN_2_0
compilerOptions.apiVersion = KotlinVersion.KOTLIN_2_0
}

testOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public final class io/sentry/compose/navigation3/SentryNavEffectKt {

public final class io/sentry/compose/navigation3/SentryNavOptions {
public static final field $stable I
public synthetic fun <init> (ZZZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun equals (Ljava/lang/Object;)Z
public final fun getCaptureBackStack ()Z
public final fun getEnableNavigationBreadcrumbs ()Z
Expand Down
4 changes: 2 additions & 2 deletions sentry-android-navigation3/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ android {

kotlin {
compilerOptions.jvmTarget = JVM_11
compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.languageVersion = KotlinVersion.KOTLIN_2_0
compilerOptions.apiVersion = KotlinVersion.KOTLIN_2_0
}

testOptions {
Expand Down
4 changes: 2 additions & 2 deletions sentry-android-replay/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ android {

kotlin {
compilerOptions.jvmTarget = JvmTarget.JVM_11
compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.languageVersion = KotlinVersion.KOTLIN_2_0
compilerOptions.apiVersion = KotlinVersion.KOTLIN_2_0
}

testOptions {
Expand Down
2 changes: 0 additions & 2 deletions sentry-android-sqlite/api/sentry-android-sqlite.api
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public final class io/sentry/android/sqlite/BuildConfig {

public final class io/sentry/android/sqlite/SentrySupportSQLiteOpenHelper : androidx/sqlite/db/SupportSQLiteOpenHelper {
public static final field Companion Lio/sentry/android/sqlite/SentrySupportSQLiteOpenHelper$Companion;
public synthetic fun <init> (Landroidx/sqlite/db/SupportSQLiteOpenHelper;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun close ()V
public static final fun create (Landroidx/sqlite/db/SupportSQLiteOpenHelper;)Landroidx/sqlite/db/SupportSQLiteOpenHelper;
public fun getDatabaseName ()Ljava/lang/String;
Expand All @@ -23,7 +22,6 @@ public final class io/sentry/android/sqlite/SentrySupportSQLiteOpenHelper$Compan

public final class io/sentry/sqlite/SentrySQLiteDriver : androidx/sqlite/SQLiteDriver {
public static final field Companion Lio/sentry/sqlite/SentrySQLiteDriver$Companion;
public synthetic fun <init> (Landroidx/sqlite/SQLiteDriver;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public static final fun create (Landroidx/sqlite/SQLiteDriver;)Landroidx/sqlite/SQLiteDriver;
public fun hasConnectionPool ()Z
public fun open (Ljava/lang/String;)Landroidx/sqlite/SQLiteConnection;
Expand Down
4 changes: 2 additions & 2 deletions sentry-android-sqlite/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ android {

kotlin {
compilerOptions.jvmTarget = JvmTarget.JVM_11
compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.languageVersion = KotlinVersion.KOTLIN_2_0
compilerOptions.apiVersion = KotlinVersion.KOTLIN_2_0
}

testOptions {
Expand Down
4 changes: 2 additions & 2 deletions sentry-android-timber/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ android {

kotlin {
compilerOptions.jvmTarget = JvmTarget.JVM_11
compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.languageVersion = KotlinVersion.KOTLIN_2_0
compilerOptions.apiVersion = KotlinVersion.KOTLIN_2_0
}

testOptions {
Expand Down
4 changes: 2 additions & 2 deletions sentry-apollo-3/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ plugins {

tasks.named<KotlinCompile>("compileKotlin") {
compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0
compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0
}

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions sentry-apollo-4/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ plugins {

tasks.named<KotlinCompile>("compileKotlin") {
compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0
compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0
}

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions sentry-apollo-5/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ plugins {

tasks.named<KotlinCompile>("compileKotlin") {
compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0
compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0
}

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions sentry-apollo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ plugins {

tasks.named<KotlinCompile>("compileKotlin") {
compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0
compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0
}

dependencies {
Expand Down
14 changes: 7 additions & 7 deletions sentry-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ kotlin {
androidTarget {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
apiVersion.set(KotlinVersion.KOTLIN_1_9)
languageVersion.set(KotlinVersion.KOTLIN_1_9)
apiVersion.set(KotlinVersion.KOTLIN_2_0)
languageVersion.set(KotlinVersion.KOTLIN_2_0)
}
publishLibraryVariants("release")
}
jvm("desktop") {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
apiVersion.set(KotlinVersion.KOTLIN_1_9)
languageVersion.set(KotlinVersion.KOTLIN_1_9)
apiVersion.set(KotlinVersion.KOTLIN_2_0)
languageVersion.set(KotlinVersion.KOTLIN_2_0)
}
}

coreLibrariesVersion = "1.8"
coreLibrariesVersion = "2.0.21"

sourceSets.all {
// Allow all experimental APIs, since MPP projects are themselves experimental
Expand All @@ -47,8 +47,8 @@ kotlin {
sourceSets {
getByName("commonMain") {
compilerOptions {
apiVersion.set(KotlinVersion.KOTLIN_1_9)
languageVersion.set(KotlinVersion.KOTLIN_1_9)
apiVersion.set(KotlinVersion.KOTLIN_2_0)
languageVersion.set(KotlinVersion.KOTLIN_2_0)
}
}
getByName("androidMain") {
Expand Down
Loading
Loading