Skip to content

fix(android): Wire dependencies report through asset transform task#1115

Open
runningcode wants to merge 2 commits intomainfrom
no/fix-addGeneratedSourceDirectory-compat
Open

fix(android): Wire dependencies report through asset transform task#1115
runningcode wants to merge 2 commits intomainfrom
no/fix-addGeneratedSourceDirectory-compat

Conversation

@runningcode
Copy link
Contributor

Summary

  • Removes addGeneratedSourceDirectory call that exposed a task-backed Provider<Directory> via variant.sources.assets?.all, causing configuration-time errors for plugins like Paparazzi that query asset sources before tasks execute
  • Instead wires the dependencies report (sentry-external-modules.txt) through the existing InjectSentryMetaPropertiesIntoAssetsTask, which already transforms SingleArtifact.ASSETS and copies all assets into the output directory
  • configureDependenciesTask() now returns the task provider, and InjectSentryMetaPropertiesIntoAssetsTask gains an optional dependenciesReportDir input that copies the report files into the transformed assets output

🤖 Generated with Claude Code

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>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 23, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • (android) Wire dependencies report through asset transform task by runningcode in #1115

Internal Changes 🔧

  • Pin GitHub Actions to full-length commit SHAs by joshuarli in #1116

🤖 This preview updates automatically when you update the PR.

Copy link

@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 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.

Create PR

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.

Copy link
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.

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))
Copy link
Contributor

Choose a reason for hiding this comment

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

  • 🚫 The changelog entry seems to be part of an already released section ## 6.2.0.
    Consider moving the entry to the ## Unreleased section, please.

task.output.set(output)
} else {
task.output.set(
project.layout.buildDirectory.dir(
Copy link
Member

Choose a reason for hiding this comment

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

could you maybe extract this into OutputPaths to not diverge from the existing pattern?

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.

2 participants