Conversation
…ce tree The Android Gradle plugin collected `modules.json` into the version-controlled `src/main/assets` directory on release builds via an `Exec` task with no declared inputs/outputs, then removed it afterward with a cleanup task. That broke up-to-date checks and build caching for asset merging, and a failed build could leave the file behind in the source tree. Replace it with a typed `CollectModulesTask` that writes into `build/generated/sentry/modules/<variant>`, registered as a generated assets source via the AGP Variant API (with a classic source-set fallback), so AGP merges and orders it into `merge<Variant>Assets` with correct up-to-date/caching behavior. Lint tasks depend on it explicitly (Gradle 9 rejects the previously implicit dependency), and the source-map cleanup now runs after it. Mirrors the `sentry.options.json` fix (#6751); closes the same anti-pattern for `modules.json` from #6750. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
11 tasks
📲 Install BuildsAndroid
|
Contributor
Android (legacy) Performance metrics 🚀
|
…arn on stale copy Addresses review feedback on the modules.json generated-assets change: - Source-set fallback (old AGP < 7.3) now registers each variant's generated modules dir into that variant's own source set instead of the shared "main". Adding per-variant dirs to "main" leaked modules.json into debug and caused a duplicate-asset merge conflict between multiple non-debug variants. Because each variant is now isolated, no dedup guard is required (unlike the shared-dir options fallback). The primary AGP 7.3+ variant-API path was already scoped and is unchanged. - Warn on a stale modules.json left in src/main/assets by older plugin versions (mirrors the sentry.options.json warning), since a leftover copy would clash with the generated one during asset merge on upgrade. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Android (new) Performance metrics 🚀
|
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8208e15. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Stacked on #6751 (base branch
al/fix-gradle-sentry-options-generated-assets). Please merge #6751 first; this PR's diff will collapse to modules-only once it does.📢 Type of change
📜 Description
This replaces the
Exec+Deletecleanup tasks with a typedCollectModulesTaskthat:build/generated/sentry/modules/<variant>/— never intosrc/main/assets.variant.sources.assets.addGeneratedSourceDirectory, reached reflectively since a script plugin can't depend on AGP types), so AGP wires it intomerge<Variant>Assetswith correct ordering. A classicsourceSets["main"].assets.srcDir+ scopedmerge<Variant>Assets dependsOnfallback covers older AGP.ExecOperations, so it stays Configuration Cache compatible.💡 Motivation and Context
Follow-up to #6751. The Android Gradle plugin generated
modules.jsoninto the version-controlledandroid/app/src/main/assetsdirectory on release builds (via anExectask), then removed it afterward with a cleanup task. ThatExectask declared no Gradle inputs/outputs, so it broke up-to-date checks and build caching for the asset-merge tasks, and a failed build could leave the file behind in the source tree — the same anti-pattern reported in #6750, of whichsentry.options.json(#6751) was the first instance.💚 How did you test it?
Manually, on
samples/react-native(AGP 9.x / Gradle 9.4.1, JDK 17), since there is no Gradle test harness for the script plugin:📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps