Skip to content

feat: add Gradle and Maven support with Surefire parser (75-90% savings)#782

Open
romualdbassinot-efficy wants to merge 4 commits intortk-ai:developfrom
romualdbassinot-efficy:feat/gradle-maven-support
Open

feat: add Gradle and Maven support with Surefire parser (75-90% savings)#782
romualdbassinot-efficy wants to merge 4 commits intortk-ai:developfrom
romualdbassinot-efficy:feat/gradle-maven-support

Conversation

@romualdbassinot-efficy
Copy link

Summary

  • Add rtk gradle command with sub-commands: build, test, check, dependencies — filtering Gradle output to errors/failures only (75-90% savings)
  • Add rtk mvn command with sub-commands: compile, test, package, verify, install, dependency:tree — with Surefire XML parser for structured test failure output (75-90% savings)
  • Add real fixtures for both tools (build success/fail, test pass/fail)
  • Register both commands in src/main.rs Commands enum following the Go sub-enum pattern
  • Update CHANGELOG.md and src/discover/rules.rs for missed-savings detection

Test plan

  • cargo test passes
  • rtk gradle build filters Gradle build output to errors only
  • rtk gradle test shows only failed tests
  • rtk mvn compile filters Maven compile errors
  • rtk mvn test uses Surefire XML when available, falls back to text parser
  • Token savings ≥75% verified via unit tests
  • Fallback to raw command on filter failure

🤖 Generated with Claude Code

Add rtk gradle and rtk mvn commands following the Go sub-enum pattern.

- gradle_cmd.rs: test (state machine, 85-90%), build (noise filter, 75-85%),
  other (passthrough). Auto-detects ./gradlew wrapper vs gradle on PATH.
- maven_cmd.rs: test (Surefire parser, 85-90%), compile/package (70-80%),
  other (passthrough). Strips [INFO] noise, groups failures with stack context.
- 22 new unit tests (11 gradle + 11 maven), all passing with savings assertions.
- Discover rules: Gradle rewrite rule added, Maven subcmd savings updated.
- 8 real-world fixtures from E-deal (Maven) and hub-webservices (Gradle) output formats.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@CLAassistant
Copy link

CLAassistant commented Mar 22, 2026

CLA assistant check
All committers have signed the CLA.

@pszymkowiak pszymkowiak added effort-large Plusieurs jours, nouveau module enhancement New feature or request labels Mar 22, 2026
@pszymkowiak
Copy link
Collaborator

[w] wshm · Automated triage by AI

📊 Automated PR Analysis

Type feature
🟡 Risk medium

Summary

Adds Gradle and Maven command support to rtk with output filtering that achieves 75-90% token savings. Includes Gradle wrapper auto-detection, Surefire XML test parser for Maven, discovery rules for both build tools, and comprehensive test fixtures.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Analyzed automatically by wshm · This is an automated analysis, not a human review.

@romualdbassinot-efficy romualdbassinot-efficy changed the base branch from master to develop March 22, 2026 20:19
romualdbassinot-efficy and others added 3 commits March 23, 2026 23:26
- Reorder [Unreleased] to match develop convention (Bug Fixes before Features)
- Remove [0.31.0] section that came from master commits (not relevant for develop PR)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Integrate upstream changes up to v0.33.0-rc.54
- Resolve CHANGELOG conflict: keep [Unreleased] for Gradle/Maven only,
  move Ruby/cargo entries (already released in 0.33.0-rc.54) to their
  proper release section

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Collaborator

@pszymkowiak pszymkowiak left a comment

Choose a reason for hiding this comment

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

Review — Gradle & Maven support

Good work — real fixtures, savings assertions, gradlew auto-detection, sub-enum pattern. A few things to fix before merge.

P0 — Must Fix

1. CHANGELOG rebase conflict
The diff deletes the Ruby feature entries and the ## [0.31.0] section. Looks like a merge artifact — the [Unreleased] block got duplicated and the old one was removed with its surrounding context. Please check that the full changelog history is intact after your upstream merge.

2. TOML filter conflict
src/filters/gradle.toml and src/filters/mvn-build.toml already exist on develop and match the same commands. The Rust modules are strictly better (Surefire parsing, gradlew detection, sub-enum routing), so please delete the two TOML filters to avoid undefined routing behavior.

P1 — Should Fix

3. Vec<Regex> for noise patterns — O(N×M) per line
Both modules define 17-19 separate Regex objects in a Vec, iterated for every output line. Collapse into a single alternation regex (like rspec_cmd.rs does). Not a blocker but measurable on large Maven reactor builds.

4. ^ - noise pattern too broad (gradle_cmd.rs)
This strips any line starting with -, which catches legitimate output beyond the Gradle welcome banner. Narrow to the welcome block context or use a more specific pattern.

5. run_other missing tee integration
Both gradle_cmd::run_other and maven_cmd::run_other skip tee::tee_and_hint() — if the filter produces wrong output for an unsupported subcommand, the raw output is lost with no recovery path. See run_test/run_build for the pattern to follow.

6. Missing test for compile-failure in filter_gradle_test
The total == 0 && !build_errors.is_empty() path in filter_gradle_test is never exercised. Add a test calling filter_gradle_test with the gradle_build_fail_raw.txt fixture.

P2 — Nice to Have

7. mvn verify falls through to Other instead of the Surefire parser — consider adding a Verify subcommand routing to run_test.

8. All fixtures from a single project — a multi-module reactor fixture would strengthen coverage.


Overall solid implementation. Fix P0 #1 and #2, and I'll re-review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort-large Plusieurs jours, nouveau module enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants