Skip to content

Wire build-rust.sh into Gradle preBuild#221

Merged
kwsantiago merged 4 commits into
mainfrom
gradle-rust-task
Apr 13, 2026
Merged

Wire build-rust.sh into Gradle preBuild#221
kwsantiago merged 4 commits into
mainfrom
gradle-rust-task

Conversation

@kwsantiago
Copy link
Copy Markdown
Contributor

@kwsantiago kwsantiago commented Apr 13, 2026

Summary

  • buildRust Gradle task now declares inputs (Rust sources, Cargo.toml, build-rust.sh, TARGETS) and outputs (jniLibs, generated bindings), so it is incremental.
  • :app:preBuild depends on :buildRust, so ./gradlew assembleDebug rebuilds Rust only when sources change.
  • Clear error if the sibling keep workspace is missing.
  • README simplified: one command to build.

CI is unchanged. The explicit build-rust.sh step still runs; the subsequent Gradle invocation finds outputs up-to-date and no-ops.

Test plan

  • Fresh checkout: ./gradlew assembleDebug builds Rust and APK
  • Second run: buildRust reports up-to-date
  • Missing ../keep: clear actionable error

Summary by CodeRabbit

  • Documentation

    • Streamlined building documentation by removing legacy setup instructions and clarifying required toolchain versions (Rust 1.85+, Android NDK r29, cargo-ndk).
  • Chores

    • Optimized build system to automatically compile Rust libraries as part of the standard Android build process, with automatic recompilation when source files change.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 13, 2026

Warning

Rate limit exceeded

@wksantiago has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 37 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 59 minutes and 37 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d6b2880c-f425-4c48-826c-6370ddf5a799

📥 Commits

Reviewing files that changed from the base of the PR and between 5ac6b79 and 3610cc8.

📒 Files selected for processing (2)
  • README.md
  • build.gradle.kts

Walkthrough

The pull request streamlines the Rust build integration for Android by automating it into the standard Gradle build lifecycle, updating task dependencies to ensure Rust compilation runs before Android pre-build steps, and simplifying build documentation to reflect the automated workflow.

Changes

Cohort / File(s) Summary
Documentation
README.md
Simplified "Building" section by removing detailed clone and build-rust.sh instructions, replacing with required toolchain versions and a single ./gradlew assembleDebug command; added note about automatic Rust library rebuilding and KEEP_REPO environment variable usage.
Build Configuration
app/build.gradle.kts, build.gradle.kts
Wired Rust compilation into Android build lifecycle by making preBuild depend on buildRust task; enhanced buildRust task with incremental build metadata (input/output declarations) and environment variable handling for repository path resolution.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Optimize CI with Rust caching and combined Gradle tasks #80 — Directly related Rust build integration: adds TARGETS environment variable and updates build-rust.sh, which aligns with this PR's new task input/output metadata and environment variable configuration.
  • Update README #151 — Updates README's "Building" section documentation with overlapping changes to build instructions and workflow simplification.

Poem

🐰 ✨ A Gradle task dances with Rust so fine,
Prebuild and buildRust now intertwine,
No manual cloning, just ./gradlew we say,
The rabbits built pipelines to speed up the day! 🚀

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: wiring the build-rust.sh script into Gradle's preBuild task lifecycle.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gradle-rust-task

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kwsantiago kwsantiago linked an issue Apr 13, 2026 that may be closed by this pull request
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@build.gradle.kts`:
- Line 7: The default KEEP_REPO path currently uses "${rootDir}/keep" which
conflicts with the documented clone flow; update the keepRepo initialization
(val keepRepo) to default to the repository parent directory (e.g., use
"${rootDir.parent}/keep" or an equivalent parent-based path expression instead
of "${rootDir}/keep"), and apply the same change to the other occurrences that
build the KEEP_REPO default later in the file so the documented "../keep" clone
workflow works without requiring users to set KEEP_REPO explicitly.
- Around line 17-20: The Gradle task input configuration only includes
keep-mobile/src and Cargo.toml so changes to Cargo.lock and build.rs won't
invalidate the task; update the inputs inside the existing if
(keepRepo.exists()) block (where inputs.dir("${keepRepo}/keep-mobile/src") and
inputs.file("${keepRepo}/keep-mobile/Cargo.toml") are set) to also register
inputs.file("${keepRepo}/keep-mobile/Cargo.lock") and
inputs.file("${keepRepo}/keep-mobile/build.rs") (using the same
withPathSensitivity(PathSensitivity.RELATIVE) pattern) so Rust dependency and
build-script changes correctly trigger task cache invalidation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ac8f9f86-f04f-4712-982e-0a9941d7b796

📥 Commits

Reviewing files that changed from the base of the PR and between 9c8be68 and 5ac6b79.

📒 Files selected for processing (3)
  • README.md
  • app/build.gradle.kts
  • build.gradle.kts

Comment thread build.gradle.kts
Comment thread build.gradle.kts
@wksantiago
Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 13, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

Improve Build UX

2 participants