Skip to content

Commit 428f2be

Browse files
runningcodeclaude
andauthored
ref(build): Consolidate sentry-java version into version catalog (#1245)
* ref(build): Consolidate sentry-java version into version catalog The sentry SDK version was declared twice: once in libs.versions.toml (7.0.0, used for the plugin's own compile dependency) and once in gradle.properties as sdk_version (8.43.0, used as BuildConfig.SdkVersion for auto-installation defaults and telemetry). Consolidate into a single source of truth in libs.versions.toml and read it via libs.versions.sentry in build.gradle.kts. Dependabot (gradle package ecosystem, directory "/") now handles updates to the sentry version via libs.versions.toml, making the custom getsentry/github-workflows/updater job and scripts/update-android.sh redundant. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ref(build): Consolidate sentry-java version into version catalog The sentry SDK version was declared twice: once in libs.versions.toml (7.0.0, used for the plugin's own compile dependency) and once in gradle.properties as sdk_version (8.43.0, used as BuildConfig.SdkVersion for auto-installation defaults and telemetry). Consolidate into a single source of truth in libs.versions.toml and read it via libs.versions.sentry in build.gradle.kts. Update scripts/update-android.sh to read/write the version from libs.versions.toml instead of gradle.properties. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(build): Replace removed sentry-android-okhttp with sentry-okhttp sentry-android-okhttp was removed in sentry-java 8.0.0 and replaced by sentry-okhttp, which is a plain java-library (JAR) rather than an AAR. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(build): Fix update-android.sh regex to match full version string [0-9\.]+ stops at the first non-numeric character, so when the current version in libs.versions.toml has a prerelease suffix (e.g. 9.0.0-RC1), set-version only matches the numeric prefix and leaves the suffix in place, producing corrupt entries like sentry = "9.1.0-RC1". Switch to [^"]+ so the entire value up to the closing quote is captured and replaced in one shot. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test(instrumentation): Stub removed sentry-android-okhttp event listener VisitorTest verifies instrumented bytecode against the real classes on the test classpath. After bumping sentry to 8.43.0, the test classpath provides sentry-okhttp instead of sentry-android-okhttp, so io.sentry.android.okhttp.SentryOkHttpEventListener no longer resolves. The classloader then generated an empty stub extending Object, which is not an okhttp3.EventListener subtype, so the eventListener() call in the legacy useSentryAndroidOkHttp path failed bytecode verification. Generate a stub for it that extends io.sentry.okhttp.SentryOkHttpEventListener, mirroring the real inheritance so the verifier accepts the call. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test(build): Drop redundant AAR dependency on sentry-okhttp sentry-okhttp is a plain JVM library, so pulling it through the testImplementationAar (.aar -> .jar) configuration is unnecessary; the testImplementation entry already provides it on the test classpath. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test(instrumentation): Pin sentry-android-okhttp for legacy okhttp test Verify the legacy useSentryAndroidOkHttp instrumentation path against the real io.sentry.android.okhttp.SentryOkHttpEventListener instead of a hand-written stub. The module was removed from the SDK in 8.0.0, so pin the test dependency to 7.22.6, its last release. No updater can bump it since no newer version of the artifact exists. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 616e411 commit 428f2be

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

gradle/libs.versions.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ agp = "8.10.1"
55
asm = "9.4" # // compatibility matrix -> https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/instrumentation/InstrumentationContext#apiversion
66
ktfmt = "0.51"
77
sqlite = "2.1.0"
8-
sentry = "7.0.0"
8+
sentry = "8.43.0"
9+
# Pinned to the last release that shipped sentry-android-okhttp; the module was removed
10+
# in 8.0.0, so there is no newer version to update to. Used only to verify the legacy
11+
# okhttp instrumentation path in tests.
12+
sentryAndroidOkhttp = "7.22.6"
913

1014
sampleCoroutines = "1.5.2"
1115
sampleRoom = "2.7.2"
@@ -51,8 +55,8 @@ sqlite = { group = "androidx.sqlite", name = "sqlite", version.ref = "sqlite" }
5155
sqliteFramework = { group = "androidx.sqlite", name = "sqlite-framework", version.ref = "sqlite" }
5256
sentry = { group = "io.sentry", name = "sentry", version.ref = "sentry" }
5357
sentryAndroid = { group = "io.sentry", name = "sentry-android", version.ref = "sentry" }
54-
sentryAndroidOkhttp = { group = "io.sentry", name = "sentry-android-okhttp", version.ref = "sentry" }
5558
sentryOkhttp = { group = "io.sentry", name = "sentry-okhttp", version.ref = "sentry" }
59+
sentryAndroidOkhttp = { group = "io.sentry", name = "sentry-android-okhttp", version.ref = "sentryAndroidOkhttp" }
5660
sentrySpringBootJakarta = { group = "io.sentry", name = "sentry-spring-boot-starter-jakarta", version.ref = "sentry" }
5761

5862
# test

plugin-build/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ dependencies {
5959
testImplementationAar(libs.sqliteFramework)
6060
testRuntimeOnly(files(androidSdkPath))
6161
testImplementationAar(libs.sentryAndroid)
62+
testImplementation(libs.sentryOkhttp)
6263
testImplementationAar(libs.sentryAndroidOkhttp)
63-
testImplementationAar(libs.sentryOkhttp)
6464

6565
// Needed to read contents from APK/Source Bundles
6666
testImplementation(libs.arscLib)
@@ -322,7 +322,7 @@ buildConfig {
322322
className("BuildConfig")
323323

324324
buildConfigField("String", "Version", provider { "\"${project.version}\"" })
325-
buildConfigField("String", "SdkVersion", provider { "\"${project.property("sdk_version")}\"" })
325+
buildConfigField("String", "SdkVersion", libs.versions.sentry.map { "\"$it\"" })
326326
buildConfigField("String", "AgpVersion", provider { "\"${BuildPluginsVersion.AGP}\"" })
327327
buildConfigField("String", "CliVersion", propertyVersionProvider("sentry-cli.properties"))
328328
buildConfigField(

plugin-build/gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ org.gradle.parallel=true
88
name = sentry-android-gradle-plugin
99
group = io.sentry
1010
version = 6.9.0
11-
sdk_version = 8.43.0
1211

1312
# publication pom properties
1413
POM_NAME=Sentry Android Gradle Plugin

scripts/update-android.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
set -euo pipefail
33

44
cd $(dirname "$0")/../
5-
file='plugin-build/gradle.properties'
5+
file='gradle/libs.versions.toml'
66
content=$(cat $file)
77

8-
regex='(sdk_version = *)([0-9\.]+)'
8+
regex='(sentry = ")([^"]+)'
99
if ! [[ $content =~ $regex ]]; then
1010
echo "Failed to find the Android SDK version in $file"
1111
exit 1

0 commit comments

Comments
 (0)