Skip to content

ref(build): Consolidate sentry-java version into version catalog#1245

Open
runningcode wants to merge 6 commits into
mainfrom
claude/bold-cori-c103a0
Open

ref(build): Consolidate sentry-java version into version catalog#1245
runningcode wants to merge 6 commits into
mainfrom
claude/bold-cori-c103a0

Conversation

@runningcode
Copy link
Copy Markdown
Contributor

@runningcode runningcode commented Jun 1, 2026

Remove the duplicate sdk_version property from plugin-build/gradle.properties and consolidate the sentry SDK version into a single declaration in gradle/libs.versions.toml.

I have a feeling that there is a bug here with included builds and libs.versions.toml files, so let's keep the custom script but it will update a single source of truth now.

@runningcode runningcode force-pushed the claude/bold-cori-c103a0 branch from 40f1eec to 27eace0 Compare June 1, 2026 14:16
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>
@runningcode runningcode force-pushed the claude/bold-cori-c103a0 branch from 521eeeb to 91a36c2 Compare June 1, 2026 14:22
Comment thread gradle/libs.versions.toml
asm = "9.4" # // compatibility matrix -> https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/instrumentation/InstrumentationContext#apiversion
ktfmt = "0.51"
sqlite = "2.1.0"
sentry = "7.0.0"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i'm wondering why dependabot never updated this.

name: CLI
ssh-key: ${{ secrets.CI_DEPLOY_KEY }}

android:
Copy link
Copy Markdown
Contributor Author

@runningcode runningcode Jun 1, 2026

Choose a reason for hiding this comment

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

technically we don't need this if dependabot updates the libs.versions.toml.

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>
Comment thread scripts/update-android.sh

cd $(dirname "$0")/../
file='plugin-build/gradle.properties'
file='gradle/libs.versions.toml'
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have a feeling that there is a bug here with dependabot and included builds and libs.versions.toml files since this was never updated. So let's keep the custom updater script but it will update a single source of truth now.

@runningcode runningcode marked this pull request as ready for review June 1, 2026 14:31
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 30df376. Configure here.

Comment thread scripts/update-android.sh Outdated
runningcode and others added 2 commits June 1, 2026 16:37
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>
[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>
Copy link
Copy Markdown
Member

@0xadam-brown 0xadam-brown left a comment

Choose a reason for hiding this comment

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

One comment, but doesn't have to block you.

Comment thread plugin-build/build.gradle.kts Outdated
testImplementationAar(libs.sentryAndroid)
testImplementationAar(libs.sentryAndroidOkhttp)
testImplementation(libs.sentryOkhttp)
testImplementationAar(libs.sentryOkhttp)
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.

l: Seems we should be able to get rid of the AAR config now that we're depending on the JAR directly.

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>
Comment thread plugin-build/build.gradle.kts Outdated
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>
Comment thread gradle/libs.versions.toml
ktfmt = "0.51"
sqlite = "2.1.0"
sentry = "7.0.0"
sentry = "8.43.0"
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.

potentially bumping this all the time would require us adapting SentryTelemetryService, but that's probably a good thing

Comment thread gradle/libs.versions.toml
sqliteFramework = { group = "androidx.sqlite", name = "sqlite-framework", version.ref = "sqlite" }
sentry = { group = "io.sentry", name = "sentry", version.ref = "sentry" }
sentryAndroid = { group = "io.sentry", name = "sentry-android", version.ref = "sentry" }
sentryAndroidOkhttp = { group = "io.sentry", name = "sentry-android-okhttp", version.ref = "sentry" }
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.

could we still keep it at a fixed version and drop that codepath (and the dep) in the next major of the plugin altogether?

Copy link
Copy Markdown
Member

@romtsn romtsn left a comment

Choose a reason for hiding this comment

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

1 comment, but LGTM otherwise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants