[package] name = "thoughtsync-ffi" version = "0.1.0" description = "uniffi bindings exposing thoughtsync-core to the native Android client" authors = ["bvandeusen"] edition = "2021" [lib] # cdylib is the `.so` Android's System.loadLibrary opens. `lib` alongside it so the # bindgen binary below — and this crate's own tests — can use the crate normally; # a cdylib-only crate is unusable from Rust. crate-type = ["cdylib", "lib"] name = "thoughtsync_ffi" [dependencies] thoughtsync-core = { path = "../../core" } serde_json = { workspace = true } log = { workspace = true } # tokio lets an exported `async fn` be driven by a tokio runtime, which the sync # engine needs: it is reqwest all the way down. uniffi = { version = "0.32", features = ["tokio"] } # reqwest requires a reactor; uniffi's `async_runtime = "tokio"` needs one to exist. # rt-multi-thread rather than current_thread: a sync cycle is network-bound and a # Compose UI may have more than one call in flight. tokio = { version = "1", features = ["rt-multi-thread"] } # Display + Error impls for the error enum uniffi turns into a Kotlin exception. thiserror = "2" [features] # The Kotlin generator, off by default. # # uniffi's `cli` feature drags in clap, askama and goblin — ~15 crates that exist # only to serve a three-line binary. Until the Android lane lands, this crate is # compiled on every DESKTOP push (it is a workspace member, so `cargo clippy # --all-targets` picks it up), and paying for a code generator on a lane that never # runs one is the wrong trade. `required-features` on the bin means # `--all-targets` skips it rather than failing. # # Generate bindings with: # cargo run --features bindgen --bin uniffi-bindgen -- generate ... bindgen = ["uniffi/cli"] [[bin]] name = "uniffi-bindgen" path = "src/bin/uniffi-bindgen.rs" required-features = ["bindgen"]