chore(samples-android): Support mavenLocal for builds that apply the SAGP#5539
Conversation
📲 Install BuildsAndroid
|
…SAGP Adds wiring that lets us prefer mavenLocal SAGP artifacts, when present, for Android sample app builds that set -PuseSagp=true. If no local artifact is found, we fall back to libs.versions.toml.
1ef72b0 to
f521ffd
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f521ffd. Configure here.
| pluginManagement { | ||
| repositories { | ||
| // Prefer local SAGP artifact if one exists; otherwise fall back to libs.versions.toml. | ||
| if (providers.gradleProperty("useSagp").orNull.equals("true", ignoreCase = true)) { |
There was a problem hiding this comment.
Missing useSagp property NPE
High Severity
When useSagp is absent, providers.gradleProperty("useSagp").orNull is null and calling .equals("true", …) on that receiver throws a null-pointer exception during settings evaluation, so default builds without the property can fail before configuration.
Reviewed by Cursor Bugbot for commit f521ffd. Configure here.
| sagpVersion == null -> "unknown origin" | ||
| sagpLocalJar?.isFile == true -> | ||
| "mavenLocal (published ${Instant.ofEpochMilli(sagpLocalJar.lastModified())})" | ||
| else -> "remote repository" |
There was a problem hiding this comment.
SAGP origin log misleading
Low Severity
logSagpOrigin labels the plugin as mavenLocal whenever a matching JAR exists under ~/.m2, even when Gradle actually loaded SAGP from a remote cache, so the lifecycle message can misstate which artifact was applied.
Reviewed by Cursor Bugbot for commit f521ffd. Configure here.
| otelSemanticConventions = "1.40.0" | ||
| otelSemanticConventionsAlpha = "1.40.0-alpha" | ||
| retrofit = "2.9.0" | ||
| sagp = "6.6.0" |
| sagpVersion?.let { | ||
| File( | ||
| System.getProperty("user.home"), | ||
| ".m2/repository/io/sentry/sentry-android-gradle-plugin/$it/sentry-android-gradle-plugin-$it.jar", |
There was a problem hiding this comment.
Do you know if we can rely on the artifact always being here? This seems prone to breaking.
Is this configuration cache compatible?
| pluginManagement { | ||
| repositories { | ||
| // Prefer local SAGP artifact if one exists; otherwise fall back to libs.versions.toml. | ||
| if (providers.gradleProperty("useSagp").orNull.equals("true", ignoreCase = true)) { |
|
|
||
| fun Project.logSagpOrigin() { | ||
| // A locally published SAGP in ~/.m2 silently shadows the released artifact (see README, | ||
| // "Testing an unpublished SAGP build"); we log so developers don't wonder what's going on. |
There was a problem hiding this comment.
This seems prone to breaking. I would just make sure to use a unique version for publishing and then you are sure that you are using it.
If you are still unsure you can check a build scan to verify where it came from.


Follow-on to #5538
📜 Description
Adds wiring that lets us prefer mavenLocal SAGP artifacts, when present, for Android sample app builds that set
-PuseSagp=true. If no local artifact is found, we fall back tolibs.versions.toml.💡 Motivation and Context
Lets us use local / under-development versions of SAGP with the Android sample app.
Output
Logs the provenance of the SAGP artifact so developers don't forget they have a Maven Local version that's getting picked up:
Build applied mavenLocal SAGP
Build applied remote /
libs.versions.tomlSAGP💚 How did you test it?
Manually.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps