Skip to content

feat(gradlew): Gradle support for Android/Kotlin developers#312

Open
kherembourg wants to merge 1 commit intortk-ai:masterfrom
kherembourg:feat/gradlew-android-support
Open

feat(gradlew): Gradle support for Android/Kotlin developers#312
kherembourg wants to merge 1 commit intortk-ai:masterfrom
kherembourg:feat/gradlew-android-support

Conversation

@kherembourg
Copy link

Summary

Comprehensive Gradle support for Android and Kotlin developers using ./gradlew (or gradle). Filters verbose Gradle output down to what matters — status, errors, and results — with 60–85% token savings depending on the task.

This PR covers the full Android development workflow: building, testing, linting, installing to devices, dependency inspection, and project cleanup.

Commands Handled

Command Filter Token Savings
rtk gradlew assembleDebug Build (streaming) — status + errors only ~75%
rtk gradlew bundleRelease Build (streaming) — same filter ~75%
rtk gradlew clean Build (streaming) — strips task noise ~70%
rtk gradlew installDebug Build (streaming) — install to device ~75%
rtk gradlew uninstallDebug Build (streaming) — uninstall from device ~75%
rtk gradlew check Build (streaming) — full check (test + lint) ~70%
rtk gradlew testDebugUnitTest Test (batch) — failures only ~85%
rtk gradlew connectedDebugAndroidTest Connected test (batch) — failures + device summary ~80%
rtk gradlew lint Lint (batch) — violations grouped by file ~75%
rtk gradlew dependencies Dependencies (batch) — top-level deps only per configuration ~60%
rtk gradlew <other> Passthrough — raw output 0%

Features

  • Streaming output: Build tasks stream filtered output line-by-line (no buffering)
  • Progress spinner: Real-time stderr spinner with elapsed time and current task name during long builds. Zero stdout contamination — only appears in interactive terminals (is_terminal() guard)
  • Gradle fallback: Automatically uses system gradle when ./gradlew wrapper is not found in the project
  • Verbose bypass: --stacktrace, --info, --debug flags bypass all filtering for full output
  • CLI aliases: rtk ./gradlew and rtk gradle both work as aliases for rtk gradlew
  • Hook rewrites: ./gradlew <cmd> and gradle <cmd> are automatically rewritten to rtk gradlew <cmd> by the hook
  • Windows support: gradlew.bat detected automatically
  • Exit code preservation: Non-zero exit codes propagated correctly for CI/CD

Architecture

  • Task detection: Last non-flag, non-clean argument determines the filter strategy
  • 5 filter strategies: Build (streaming), Test (batch), Connected Test (batch), Lint (batch), Dependencies (batch), plus passthrough for unknown tasks
  • Build filter: Strips > Task : progress lines, daemon messages, configuration noise; keeps BUILD SUCCESSFUL/FAILED, error lines, and warnings
  • Test filter: Keeps only test class results and failure details
  • Dependencies filter: Parses Gradle tree format, keeps config headers and top-level deps only

Quality Checks

  • cargo fmt --all --check — clean
  • cargo clippy --all-targets — no new warnings
  • cargo test --all494 passed, 0 failed
  • 48 gradlew-specific tests covering task detection, all filters, edge cases
  • Test fixtures from real ./gradlew output on an Android project
  • Token savings verified ≥60% on all filters
  • README, CHANGELOG, CLAUDE.md updated
  • Hook updated with gradle rewrite support

Manual Testing

Manually tested on a real Android project with ./gradlew:

  • rtk gradlew assembleDebug — build filtered correctly, progress spinner visible in terminal
  • rtk gradlew testDebugUnitTest — only test results shown
  • rtk gradlew clean — task noise stripped, BUILD result preserved
  • rtk gradlew check — mixed test+lint output filtered correctly
  • rtk gradlew installDebug — install filtered like build
  • rtk gradlew dependencies — only top-level deps shown per configuration
  • rtk ./gradlew testDebugUnitTest — alias works
  • Verbose flags bypass filtering (confirmed with --stacktrace)
  • Piped output has no spinner artifacts (rtk gradlew assembleDebug | cat)
  • Exit codes propagated on build failure

🤖 Generated with Claude Code

… indicator

Comprehensive Gradle/Android support: build, test, lint, clean, install,
uninstall, check, and dependencies filters with live progress spinner.
Falls back to system gradle when wrapper not found. Hook rewrites
./gradlew and gradle commands automatically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kherembourg kherembourg force-pushed the feat/gradlew-android-support branch from 655e291 to d407be4 Compare March 3, 2026 21:42
@FlorianBruniaux
Copy link
Collaborator

Hi @yonatankarp, @rubixhacker, @kherembourg! Three Gradle PRs are open at the same time (#263, #288, #312) — they overlap significantly on gradle_cmd.rs. Could you coordinate? We'd like to pick the best base and have the others contribute additions rather than landing three competing implementations. Pinging all three to discuss approach before we do deep review.

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