fix(android): Wire dependencies report through asset transform task#1115
fix(android): Wire dependencies report through asset transform task#1115runningcode wants to merge 2 commits intomainfrom
Conversation
Instead of using `addGeneratedSourceDirectory` to add the dependencies report to the asset source set, wire it through the existing `InjectSentryMetaPropertiesIntoAssetsTask` which already transforms `SingleArtifact.ASSETS`. This avoids exposing a task-backed `Provider<Directory>` via `variant.sources.assets?.all`, which causes errors when other plugins (like Paparazzi) try to resolve it during configuration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
plugin-build/src/main/kotlin/io/sentry/android/gradle/AndroidComponentsConfig.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Missing output directory for dependencies report task
- Added explicit output directory configuration using project.layout.buildDirectory.dir() to set the required output property on SentryExternalDependenciesReportTaskV2.
Or push these changes by commenting:
@cursor push 2904c9c146
Preview (2904c9c146)
diff --git a/plugin-build/src/main/kotlin/io/sentry/android/gradle/AndroidComponentsConfig.kt b/plugin-build/src/main/kotlin/io/sentry/android/gradle/AndroidComponentsConfig.kt
--- a/plugin-build/src/main/kotlin/io/sentry/android/gradle/AndroidComponentsConfig.kt
+++ b/plugin-build/src/main/kotlin/io/sentry/android/gradle/AndroidComponentsConfig.kt
@@ -342,6 +342,7 @@
sentryTelemetryProvider: Provider<SentryTelemetryService>,
): TaskProvider<SentryExternalDependenciesReportTaskV2>? {
if (extension.includeDependenciesReport.get()) {
+ val outputDir = project.layout.buildDirectory.dir("generated${sep}sentry${sep}dependencies${sep}${name}")
val reportDependenciesTask =
SentryExternalDependenciesReportTaskV2.register(
project = project,
@@ -349,6 +350,7 @@
sentryTelemetryProvider,
configurationName = "${name}RuntimeClasspath",
attributeValueJar = "android-classes",
+ output = outputDir,
includeReport = extension.includeDependenciesReport,
taskSuffix = name.capitalized,
)This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
plugin-build/src/main/kotlin/io/sentry/android/gradle/AndroidComponentsConfig.kt
Show resolved
Hide resolved
romtsn
left a comment
There was a problem hiding this comment.
LGTM with one thing to address!
The removal of `addGeneratedSourceDirectory` left the `output` DirectoryProperty unset when no explicit output was provided, causing a `MissingValueException` at task execution time. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
|
||
| ### Fixes | ||
|
|
||
| - Fix `includeDependenciesReport` failing with `MissingValueException` due to unset output directory ([#1115](https://github.com/getsentry/sentry-android-gradle-plugin/pull/1115)) |
There was a problem hiding this comment.
- 🚫 The changelog entry seems to be part of an already released section
## 6.2.0.
Consider moving the entry to the## Unreleasedsection, please.
| task.output.set(output) | ||
| } else { | ||
| task.output.set( | ||
| project.layout.buildDirectory.dir( |
There was a problem hiding this comment.
could you maybe extract this into OutputPaths to not diverge from the existing pattern?


Summary
addGeneratedSourceDirectorycall that exposed a task-backedProvider<Directory>viavariant.sources.assets?.all, causing configuration-time errors for plugins like Paparazzi that query asset sources before tasks executesentry-external-modules.txt) through the existingInjectSentryMetaPropertiesIntoAssetsTask, which already transformsSingleArtifact.ASSETSand copies all assets into the output directoryconfigureDependenciesTask()now returns the task provider, andInjectSentryMetaPropertiesIntoAssetsTaskgains an optionaldependenciesReportDirinput that copies the report files into the transformed assets output🤖 Generated with Claude Code