Skip to content

feat: make uniffi optional behind the ffi feature - #8

Merged
dubadub merged 1 commit into
mainfrom
feat/optional-uniffi
Jul 14, 2026
Merged

feat: make uniffi optional behind the ffi feature#8
dubadub merged 1 commit into
mainfrom
feat/optional-uniffi

Conversation

@dubadub

@dubadub dubadub commented Jul 13, 2026

Copy link
Copy Markdown
Member

Part of the dependency reduction for cooklang/cookcli#366 ("Dependency Hell").

Problem

uniffi is an unconditional dependency of cooklang-find. It exists to generate the iOS/Android bindings — but every Rust consumer compiles it anyway, along with its bindgen chain: uniffi_bindgen, goblin, weedle2, cargo_metadata, scroll, bincode, basic-toml, fs-err, ...

For CookCLI that is ~22 crates of pure dead weight, and uniffi_bindgen is a heavyweight build-time dependency that must compile before anything else in the graph.

Change

  • uniffi becomes optional = true, gated behind a new ffi feature.
  • ffi is ON by default, so the mobile bindings (cooklang-android, cooklang-kotlin) keep building with no change on their side. Rust-only consumers opt out with default-features = false.
  • cli now implies ffi, since the uniffi-bindgen binary needs it.
  • Dropped the [build-dependencies] uniffi entry — the crate has no build.rs, so it was never used.

I chose default-on rather than the arguably cleaner default-off specifically to avoid silently breaking the mobile builds. Happy to flip it if you would rather have the FFI be opt-in.

Verification

build tests clippy rustdoc
default (ffi on) ✅ 100 passed clean 0 warnings
--no-default-features ✅ 94 passed clean 0 warnings

cargo fmt --check clean.

Follow-on

This only removes uniffi from CookCLI's graph in combination with:

  1. chore(deps): move to cooklang-find 0.6 cooklang-reports#8 — moves cooklang-reports onto cooklang-find 0.6 (it is the last crate on the 0.5 line, so CookCLI currently compiles cooklang-find twice)
  2. a CookCLI bump to cooklang-reports 0.5.x + default-features = false on both

With all three, CookCLI goes 418 → 396 crates and uniffi leaves the graph entirely.

uniffi was an unconditional dependency, so every Rust consumer compiled
it plus its bindgen chain (goblin, weedle2, cargo_metadata, scroll,
bincode) purely to support the iOS/Android bindings. That is ~22 crates
of dead weight for CLI and server consumers.

Gate it behind an 'ffi' feature, left ON by default so the mobile
bindings keep building unchanged. Rust-only consumers opt out with
default-features = false.

Also drop the [build-dependencies] uniffi entry: the crate has no
build.rs, so it was never used.

Refs cooklang/cookcli#366
dubadub added a commit to cooklang/cooklang-reports that referenced this pull request Jul 13, 2026
cooklang-find enables uniffi by default for the mobile bindings. As a
Rust-only consumer we don't need it, and pulling it in forces the whole
bindgen chain (goblin, weedle2, cargo_metadata) on every downstream.

Depends on cooklang/cooklang-find#8.
@dubadub
dubadub merged commit 34e5bde into main Jul 14, 2026
12 checks passed
@dubadub
dubadub deleted the feat/optional-uniffi branch July 14, 2026 10:58
dubadub added a commit to cooklang/cooklang-reports that referenced this pull request Jul 14, 2026
* chore(deps): move to cooklang-find 0.6

cooklang-reports was the last crate holding the 0.5 line, which forced
downstreams to compile cooklang-find twice (0.5 and 0.6) in the same
graph. The only call site, get_recipe_str(), is API-compatible in 0.6.

Refs cooklang/cookcli#366

* chore(deps): opt out of cooklang-find's ffi feature

cooklang-find enables uniffi by default for the mobile bindings. As a
Rust-only consumer we don't need it, and pulling it in forces the whole
bindgen chain (goblin, weedle2, cargo_metadata) on every downstream.

Depends on cooklang/cooklang-find#8.
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.

1 participant