Skip to content
Merged
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
10 changes: 3 additions & 7 deletions .github/workflows/test-matrix-agp-gradle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,13 @@ jobs:
strategy:
fail-fast: false
matrix:
agp: [ "7.2.1" ]
gradle: [ "7.4" ]
agp: [ "7.3.0" ]
gradle: [ "7.6.4" ]
java: [ "11" ]
groovy: [ "1.2" ]
include:
- agp: "7.3.0"
gradle: "7.5"
java: "11"
groovy: "1.2"
- agp: "7.4.0"
gradle: "7.6"
gradle: "7.6.4"
java: "11"
groovy: "1.2"
- agp: "8.0.0"
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Fixes

- Fix another API incompatibility with Kotlin 2.1.20 ([#871](https://github.com/getsentry/sentry-android-gradle-plugin/pull/871))

### Dependencies

- Bump CLI from v2.43.0 to v2.43.1 ([#872](https://github.com/getsentry/sentry-android-gradle-plugin/pull/872))
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ proguard = { group = "com.guardsquare", name = "proguard-gradle", version = "7.1
# this allows us to develop against a fixed version of Gradle, as opposed to depending on the
# locally available version. kotlin-gradle-plugin follows the same approach.
# More info: https://docs.nokee.dev/manual/gradle-plugin-development-plugin.html
gradleApi = { group = "dev.gradleplugins", name = "gradle-api", version = "7.6" }
gradleApi = { group = "dev.gradleplugins", name = "gradle-api", version = "7.6.4" }
agp = { group = "com.android.tools.build", name = "gradle", version.ref = "agp" }
kotlinCompilerEmbeddable = { group = "org.jetbrains.kotlin", name = "kotlin-compiler-embeddable" }
autoService = { group = "com.google.auto.service", name = "auto-service", version = "1.0.1" }
autoServiceAnnotatons = { group = "com.google.auto.service", name = "auto-service-annotations", version = "1.0.1" }
kotlinJunit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin" }
kotlinCompileTesting = { group = "com.github.tschuchortdev", name = "kotlin-compile-testing", version = "1.6.0" }
kotlinCompileTesting = { group = "dev.zacsweers.kctfork", name = "core", version = "0.7.0" }
composeDesktop = { group = "org.jetbrains.compose.desktop", name = "desktop", version = "1.6.10" }

# bytecode instrumentation
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
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.6.4-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion plugin-build/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sourceSets {
// we cannot use the version from Dependencies.kt because it's not available at this moment, the
// proper way to share the dependency notation is to use libs.versions.toml, but that's for later
dependencies {
compileOnly("dev.gradleplugins:gradle-api:7.6")
compileOnly("dev.gradleplugins:gradle-api:7.6.4")
}

gradlePlugin {
Expand Down
35 changes: 33 additions & 2 deletions sentry-kotlin-compiler-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
alias(libs.plugins.kotlin) version "1.9.24"
alias(libs.plugins.kapt) version "1.9.24"
alias(libs.plugins.kotlin) version "2.1.0"
alias(libs.plugins.kapt) version "2.1.0"
id("distribution")
alias(libs.plugins.mavenPublish)
alias(libs.plugins.spotless)
}

val kotlin1920: SourceSet by sourceSets.creating
val kotlin2120: SourceSet by sourceSets.creating

allprojects {
repositories {
google()
Expand Down Expand Up @@ -62,6 +68,14 @@ dependencies {
testImplementation(libs.kotlinCompilerEmbeddable)
testImplementation(libs.kotlinCompileTesting)
testImplementation(libs.composeDesktop)
testImplementation(kotlin1920.output)
testImplementation(kotlin2120.output)

kotlin1920.compileOnlyConfigurationName("org.jetbrains.kotlin:kotlin-compiler-embeddable:1.9.24")
kotlin2120.compileOnlyConfigurationName("org.jetbrains.kotlin:kotlin-compiler-embeddable:2.1.20")

compileOnly(kotlin1920.output)
compileOnly(kotlin2120.output)
}

kapt { correctErrorTypes = true }
Expand All @@ -76,3 +90,20 @@ plugins.withId("com.vanniktech.maven.publish.base") {
}
}
}

tasks.withType<Jar> {
from(kotlin1920.output)
from(kotlin2120.output)
}

// see
// https://youtrack.jetbrains.com/issue/KTIJ-24311/task-current-target-is-17-and-kaptGenerateStubsProductionDebugKotlin-task-current-target-is-1.8-jvm-target-compatibility-should
kotlin { jvmToolchain(11) }

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
languageVersion = "1.9"
Copy link
Copy Markdown
Member

@romtsn romtsn Apr 30, 2025

Choose a reason for hiding this comment

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

not sure if it has to be a breaking change, but probably impact is quite low as it's nearly 2 years old.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Let me try to switch to the same version as the main plugin

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess it's fine, we just have to check if the compiler plugin is going to work on kotlin < 1.9 with this options? I assume it probably should

apiVersion = "1.9"
}
}
2 changes: 0 additions & 2 deletions sentry-kotlin-compiler-plugin/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,3 @@ POM_LICENCE_URL=https://github.com/getsentry/sentry-android-gradle-plugin/blob/m
POM_DEVELOPER_ID=getsentry
POM_DEVELOPER_NAME=Sentry Team and Contributors
POM_DEVELOPER_URL=https://github.com/getsentry/

kotlin.experimental.tryK2=true
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.6.4-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ import org.jetbrains.kotlin.ir.util.kotlinFqName
import org.jetbrains.kotlin.name.CallableId
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.name.SpecialNames

// required only for Kotlin 2.0.0
// @UnsafeDuringIrConstructionAPI
class JetpackComposeTracingIrExtension(private val messageCollector: MessageCollector) :
class JetpackComposeTracingIrExtension19(private val messageCollector: MessageCollector) :
IrGenerationExtension {

override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) {
Expand Down Expand Up @@ -213,7 +214,7 @@ class JetpackComposeTracingIrExtension(private val messageCollector: MessageColl
val sentryTagCall = generateSentryTagCall(builder, composableName)

// Modifier.then()
val thenCall = builder.irCall(modifierThen, modifierType)
val thenCall = builder.irCall(modifierThen, type = modifierType)
thenCall.putValueArgument(0, expression)
thenCall.dispatchReceiver = sentryTagCall

Expand All @@ -226,7 +227,7 @@ class JetpackComposeTracingIrExtension(private val messageCollector: MessageColl
composableName: String,
): IrCall {
val sentryTagCall =
builder.irCall(sentryModifierTagFunctionRef, modifierType).also {
builder.irCall(sentryModifierTagFunctionRef, type = modifierType).also {
it.extensionReceiver =
builder.irGetObjectValue(
type = modifierCompanionClassRef.createType(false, emptyList()),
Expand All @@ -243,9 +244,9 @@ class JetpackComposeTracingIrExtension(private val messageCollector: MessageColl
}

fun FqName.classId(name: String): ClassId {
return ClassId(this, org.jetbrains.kotlin.name.Name.identifier(name))
return ClassId(this, Name.identifier(name))
}

fun ClassId.callableId(name: String): CallableId {
return CallableId(this, org.jetbrains.kotlin.name.Name.identifier(name))
return CallableId(this, Name.identifier(name))
}
Loading
Loading