Repository navigation
build: gate uniffi cli behind uniffi-bindgen feature - #1153
Conversation
There was a problem hiding this comment.
ACK 160301a. Thanks for the work.
One thing to note here is that this will require bdk-jvm, bdk-python, bdk-dart, and bdk-rn to also upgrade their build script (but they also benefit from the change so I'm happy about that). Since they're all using bdk-ffi submodules, nothing breaks right at the moment, but we should open issues on these repos to remind devs that when they bump their submodules to the latest on master (after this is merged) their build script will fail.
This needs a rebase. Also, can you open the issues on the given repos to remind us of this required update? Thanks!
|
Thanks for the review! I'll rebase and open issues on bdk-jvm, bdk-python, bdk-dart and bdk-rn noting that when they bump their submodules to the latest on master their build script will fail. |
160301a to
d0cf343
Compare
|
Opened the reminder issues on bdk-rn, bdk-jvm, bdk-dart and bdk-python. |
The cli feature was enabled on the library's uniffi dependency, so the bindgen toolchain was bundled into every libbdkffi.a. Move cli behind an opt-in uniffi-bindgen feature and set resolver = "2" so the bindgen toolchain stays out of the library.
d0cf343 to
8295cd6
Compare
Description
The
clifeature was enabled on the library'suniffidependency, so the bindgen toolchain (uniffi_bindgen,clap,goblin,weedle2,askama, ...) was bundled into everylibbdkffi.a.This PR:
moves
cliinto auniffi-bindgenfeature that is off by default and required by theuniffi-bindgenbinary, adds--features uniffi-bindgento the 8cargo run --bin uniffi-bindgencalls in the Swift and Android build scripts and setsresolver = "2"Fixes #1124
Notes to the reviewers
I confirmed the bug before changing anything. I built the iOS (
aarch64-apple-ios) and macOS (aarch64-apple-darwin) static libraries on master with therelease-smallerprofile, the same waybuild-xcframework.shdoes. Both archives were about 125 MB, and each contained 4,748 symbols from the bindgen toolchain (uniffi_bindgen,clap,goblin,weedle, ...).cargo treealso showedclapas a normal dependency of the library, pulled in throughuniffi.I first applied only the fix proposed in the issue. The iOS library went from about 125 MB to about 122 MB (3.3 MB smaller), and 3,824 bindgen symbols were still there. That led to the resolver finding below.
After adding
resolver = "2", I rebuilt both libraries the same way. Both are now about 93 MB, 37.4 MB smaller each, and contain no bindgen symbols. The bindgen crates are gone from the library's dependency graph. The tests pass, and the generated Swift bindings are identical to master.The crate is on edition 2018, so Cargo uses the v1 feature resolver, which unifies features across normal, build and dev dependencies.
uniffi'sbuildfeature (from[build-dependencies]) andbindgen-tests(from[dev-dependencies]) were therefore also enabled on the library, and both pull inuniffi_bindgen.Documentation
unifficli,build,bindgen-tests)Changelog
changelog: fixedAll Submissions:
cargo fmtandcargo clippybefore committingchangelog:*label