Files
bvandeusenandClaude Opus 5 5d0de7a682
Desktop (Tauri) / Windows installer (cross-compiled) (push) Successful in 2m27s
Android / Kotlin + Rust (debug APK) (push) Failing after 3m51s
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 4m55s
Desktop (Tauri) / Update manifest (push) Successful in 5s
android: the binding generator gets its own crate, free of the app's deps
Third Android run got further than either before it — all four ABIs
cross-compiled, vendored OpenSSL and all — then the generator died:

  error: failed to run custom build command for `openssl-sys v0.9.117`

That is the HOST build. The generator was a [[bin]] inside thoughtsync-ffi, so
building it compiled that crate and therefore the core, reqwest, native-tls and
openssl-sys for linux. The vendored-OpenSSL block is scoped to
`cfg(target_os = "android")`, so the host build went looking for a system
OpenSSL that ci-rust-android has no reason to carry.

Adding libssl-dev to the image would have fixed it and been wrong: a code
generator has no business linking the app's TLS stack to emit Kotlin. Splitting
it into thoughtsync-uniffi-bindgen, whose only dependency is uniffi, removes the
entire chain. Verified from the dependency graph rather than from a build that
happened to succeed — `cargo tree -p thoughtsync-uniffi-bindgen` contains none of
openssl-sys, native-tls, reqwest, thoughtsync-core or rusqlite.

It stays a WORKSPACE MEMBER on purpose. Sharing one lockfile is what keeps uniffi
here and uniffi linked into the .so at one version; they are two halves of one
ABI, and a separate lockfile is precisely how they would drift apart. The cost is
that the desktop lane now compiles ~15 generator crates it never runs — cheap
next to Tauri, and better than leaving the crate unlinted.

Drops the `bindgen` feature and required-features bin from thoughtsync-ffi, which
existed only to keep those crates off the desktop lane and now have nothing to
gate.

Local fmt + clippy + test all green before pushing (107 tests).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 15:54:10 -04:00

32 lines
1.1 KiB
TOML

[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"