Valkyrie
Valkyrie copied to clipboard
Add Gradle Plugin
As mentioned in https://github.com/ComposeGears/Valkyrie/issues/28, there hasn't yet been a gradle plugin to add to this project. Main use case for me is to help automate the generation logic.
Here's my initial stab at it - it's maybe not 100% fully featured but I thought I'd put it out there and see what people think. There are a few test cases to show basic usage too.
One thing to be aware of: it depends on the various components modules. So if/when you publish the gradle plugin, you'll either need to:
- also publish the components modules, or
- figure out some kind of fat-JAR logic to bundle them all together when publishing.
The second one will be a fair bit more complicated than the one you've already done in the CLI app, but it might be possible. Publishing them all is probably best though.
- Closes #28.
[!WARNING] There is an error in the Gemini Code Assist config file for this repository at
.gemini/config.yamland the configuration cannot be used until the file is fixed.
[!WARNING] There is an error in the Gemini Code Assist config file for this repository at
.gemini/config.yamland the configuration cannot be used until the file is fixed.
[!WARNING] There is an error in the Gemini Code Assist config file for this repository at
.gemini/config.yamland the configuration cannot be used until the file is fixed.
[!WARNING] There is an error in the Gemini Code Assist config file for this repository at
.gemini/config.yamland the configuration cannot be used until the file is fixed.
I'll review the rest carefully later.
@jonapoul hello, thank you for contribution โค๏ธ Will you able to complete PR?
@egorikftp I'll be honest - it completely slipped my mind! Will take another look over the next few days
Reworked a big chunk of the PR (finally!) - should be good for re-review now
@Goooler could you please take a look? ๐
@egorikftp I can't reply to the comment directly but the compose dependency is only there to verify that the project compiles once the codegen has been run. It's not being auto-added to any project outside of unit tests
@jonapoul Hello, sorry for ping again ๐ Could you please resolve conflicts, I would like to merge changes and prepare first release) Thanks for your time! โค๏ธ
@egorikftp Squashed/rebased and got the tests running (locally at least), but no functional changes since I last looked at it. Do you still want the compose UI dependency removed? That'll get rid of a good chunk of the unit tests for the plugin.
@jonapoul Thank you! โค๏ธ Please keep the dependency for now, I will check it after merging.
[!NOTE]
Other AI code review bot(s) detected
CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.
Walkthrough
Adds a new Gradle plugin module (tools/gradle-plugin) including ValkyrieGradlePlugin, ValkyrieExtension, GenerateImageVectorsTask, and utility wiring for per-source-set task registration. Introduces plugin build configuration, tests (Gradle TestKit integration), and test utilities. Registers the plugin in settings.gradle.kts and includes it in kover test coverage. Updates gradle/libs.versions.toml (AGP and compose-ui). Changes PathUtils writeToKt/writeToFile to return java.nio.file.Path. Minor README bullet split.
Estimated code review effort
๐ฏ 5 (Critical) | โฑ๏ธ ~120 minutes
Points requiring extra attention:
- API change: PathUtils.writeToKt / writeToFile return type changed to java.nio.file.Path โ verify callers and binary compatibility.
- New public Gradle API surface: GenerateImageVectorsTask and ValkyrieExtension โ validate property types, defaults, and task caching/inputs/outputs.
- Plugin wiring in ValkyrieGradlePlugin and Utils.registerTask โ ensure sourceSet handling, Android/AGP detection, and task dependencies are correct.
- Extensive Gradle TestKit tests and test utilities โ confirm environment guards and test reliability.
- build.gradle.kts plugin test config including androidHome() resolution and plugin classpath handling.
- gradle/libs.versions.toml additions (AGP) โ check version alignment and compatibility.
Possibly related PRs
- ComposeGears/Valkyrie#634 โ Modifies the same PathUtilsKt writeToKt API (related return-type/signature changes).
Suggested labels
feature-plugin
Suggested reviewers
- egorikftp
Pre-merge checks and finishing touches
โ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | โ ๏ธ Warning | Docstring coverage is 3.57% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
โ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title Check | โ Passed | The title "Add Gradle Plugin" directly reflects the primary objective of this changeset. The PR introduces a new Gradle plugin module (tools/gradle-plugin/) with comprehensive implementation including ValkyrieGradlePlugin, GenerateImageVectorsTask, ValkyrieExtension interface, and test coverage. The title is concise, clear, and accurately summarizes the main contribution without being overly broad or vague. |
| Linked Issues Check | โ Passed | The PR fulfills the coding requirements from issue #28. It adds a Gradle plugin project under tools/gradle-plugin/ with a structured layout similar to detekt, including API definitions (gradle-plugin.api), implementation files (ValkyrieGradlePlugin, GenerateImageVectorsTask, ValkyrieExtension), and comprehensive tests (ValkyrieGradlePluginTest). The plugin is properly integrated into the build system via settings.gradle.kts using include("tools:gradle-plugin"). The implementation provides the core functionality to automate generation logic as intended by issue #28. |
| Out of Scope Changes Check | โ Passed | |
| Description Check | โ Passed | The pull request description is directly related to the changeset. It explains the purpose of adding a Gradle plugin to automate generation logic, references the issue being closed (#28), acknowledges the implementation includes test cases, and discusses important considerations regarding dependencies and publishing options. The description provides meaningful context about the change without being vague or off-topic. |
โจ Finishing touches
- [ ] ๐ Generate docstrings
๐งช Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
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.
Comment @coderabbitai help to get the list of available commands and usage tips.
@Goooler is it finalized from your side? ๐
@jonapoul thanks so much for your contribution on the project! โค๏ธ
We got there in the end!