app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

commit 11b6337eba8948a2f01635cbf63b8cfdd59a3cf8
parent bb8c76c25027b2c8871c35fec82fe3b75bab6d05
Author: triesap <tyson@radroots.org>
Date:   Sun,  2 Aug 2026 19:37:50 +0000

build(desktop): add the Rust core task

- expose the native FFI build through the desktop Gradle module
- track Rust manifests sources migrations and lockfile inputs
- retain the canonical core target directory for artifacts
- document the Gradle-to-Cargo build boundary

Diffstat:
Mapp/desktop/build.gradle.kts | 28++++++++++++++++++++++++++++
Mdocs/architecture/rust-ffi-boundary.md | 5+++++
Mdocs/implementation/nostr-runtime-rcld.md | 2+-
3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/app/desktop/build.gradle.kts b/app/desktop/build.gradle.kts @@ -5,6 +5,7 @@ import org.gradle.api.file.ConfigurableFileCollection import org.gradle.api.provider.Property import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputFiles +import org.gradle.api.tasks.Exec import org.gradle.api.tasks.PathSensitive import org.gradle.api.tasks.PathSensitivity import org.gradle.api.tasks.TaskAction @@ -19,6 +20,33 @@ plugins { alias(libs.plugins.compose.compiler) } +val rustManifest = rootProject.layout.projectDirectory.file("core/Cargo.toml") +val rustSources = rootProject.fileTree("core") { + include("Cargo.toml", "Cargo.lock", "rust-toolchain.toml", "crates/**/*.rs", "crates/**/*.sql") + exclude("target/**") +} +val rustLibraryName = when { + System.getProperty("os.name").startsWith("Mac") -> "libradroots_studio_ffi.dylib" + System.getProperty("os.name").startsWith("Windows") -> "radroots_studio_ffi.dll" + else -> "libradroots_studio_ffi.so" +} +val rustDebugLibrary = rootProject.layout.projectDirectory + .file("core/target/debug/$rustLibraryName") + +val buildRustCore by tasks.registering(Exec::class) { + workingDir(rootProject.projectDir) + commandLine( + "cargo", + "build", + "--manifest-path", + rustManifest.asFile.absolutePath, + "-p", + "radroots-studio-ffi", + ) + inputs.files(rustSources) + outputs.file(rustDebugLibrary) +} + dependencies { implementation(compose.desktop.currentOs) implementation(libs.compose.foundation) diff --git a/docs/architecture/rust-ffi-boundary.md b/docs/architecture/rust-ffi-boundary.md @@ -39,3 +39,8 @@ On macOS this produces `core/target/debug/libradroots_studio_ffi.dylib`. Other desktop hosts use the platform-equivalent `radroots_studio_ffi` dynamic-library filename under the same Cargo profile directory. + +Gradle exposes the same operation as `:app:desktop:buildRustCore`. The task +tracks Rust manifests, lockfile, sources, and migrations as inputs and the +current-host debug dynamic library as its output. It does not redirect Cargo's +target directory. diff --git a/docs/implementation/nostr-runtime-rcld.md b/docs/implementation/nostr-runtime-rcld.md @@ -525,7 +525,7 @@ handoff commit sequence. - [x] 42. Expose approved AppCore commands through UniFFI. - [x] 43. Expose observer callback and deregistration through UniFFI. - [x] 44. Build native library artifacts from Cargo. -- [ ] 45. Add Gradle task for Cargo build. +- [x] 45. Add Gradle task for Cargo build. - [ ] 46. Add Gradle UniFFI binding generation and generated source set. - [ ] 47. Stage native library for development, tests, and packaged app.