-
Notifications
You must be signed in to change notification settings - Fork 42
Fix cross-variant KSP task dependency issue with AGP 8.12+ #735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix cross-variant KSP task dependency issue with AGP 8.12+ #735
Conversation
WalkthroughOutput directory for GenerateComposePreviewRobolectricTestsTask changed from a shared path to a per-variant path: generated/roborazzi/preview-screenshot/${variant.name}. No other task properties were modified. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Developer
participant Gradle
participant Task as GenerateComposePreviewRobolectricTestsTask
participant FS as FileSystem
Developer->>Gradle: Run build (assemble/test)
Gradle->>Task: Configure for each variant
Note over Task: Changed: outputDir = generated/roborazzi/preview-screenshot/${variant.name}
Gradle->>Task: Execute per variant
Task->>FS: Write generated tests/screenshots to per-variant directory
FS-->>Task: Files created
Task-->>Gradle: Task completed per variant
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
include-build/roborazzi-gradle-plugin/src/main/java/io/github/takahirom/roborazzi/GenerateComposePreviewRobolectricTestsExtension.kt (1)
106-113
: Optional: align directory with Gradle “generated/source” conventionNot required for correctness, but placing generated code under a conventional path can improve IDE/tooling expectations.
Proposed change (only if it doesn’t conflict with existing consumer assumptions):
- it.outputDir.set(project.layout.buildDirectory.dir("generated/roborazzi/preview-screenshot/${variant.name}")) + it.outputDir.set(project.layout.buildDirectory.dir("generated/source/roborazzi/${variant.name}"))
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
include-build/roborazzi-gradle-plugin/src/main/java/io/github/takahirom/roborazzi/GenerateComposePreviewRobolectricTestsExtension.kt
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: test
- GitHub Check: store-screenshot-test
- GitHub Check: report
- GitHub Check: compare-screenshot-test
- GitHub Check: build
- GitHub Check: ollama-test
- GitHub Check: test
🔇 Additional comments (3)
include-build/roborazzi-gradle-plugin/src/main/java/io/github/takahirom/roborazzi/GenerateComposePreviewRobolectricTestsExtension.kt (3)
106-113
: Per-variant outputDir fixes AGP 8.12+ cross-variant overlap — good changeScoping the generated tests to "generated/roborazzi/preview-screenshot/${variant.name}" removes output/input sharing between Debug/Release and aligns with AGP’s stricter task dependency validation. This should prevent concurrent variant builds from clobbering each other and satisfy validation.
106-113
: No remaining references to the old shared path detected
I ran a global search for “generated/roborazzi/preview-screenshot” across non-build files and only found its intended use in GenerateComposePreviewRobolectricTestsExtension.kt (lines 106–108). There are no stray hard-coded occurrences elsewhere in the plugin. All variant-scoped task invocations also correctly pass the per-variant output directory.
120-123
: No cross-variant coupling detected:testTaskProvider
is variant-scopedThe
testTaskProvider
passed into the extension is created viaproject.tasks.withType(Test::class.java) .matching { it.name == testTaskName }where
testTaskName
is computed per-variant as"test" + unitTest.name.capitalizeUS()
(e.g."testDebugUnitTest"
). This ensures only the current variant’s Test task is selected, so configuring its inputs directory cannot accidentally wire in other variants’ tasks.– No changes required here; resolving this comment.
What
Fixes cross-variant task dependency error in AGP 8.12+ by separating output directories per variant.
Why
Summary by CodeRabbit
New Features
Chores