Repository navigation
fix(ffi): add lib crate-type to minigraf-ffi; bump to 1.1.2 - #266
Merged
Merged
Conversation
Without rlib output, minigraf-ffi could not be used as a Rust library dependency, breaking the standalone Python/Node/WASM binding repos that need to re-export its UniFFI scaffolding symbols from their own cdylib. Adding "lib" alongside "cdylib" and "staticlib" makes Cargo produce an .rlib so binding shims can do `pub use minigraf_ffi::*;` and have the uniffi scaffold symbols included in their cdylib output. Also adds publish-ffi.yml: a ffi-v* tag-triggered workflow for publishing minigraf-ffi patches independently of core releases. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 of 3 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
adityamukho
added a commit
to project-minigraf/minigraf-python
that referenced
this pull request
May 17, 2026
* fix(shim): add cdylib lib target; re-export from minigraf-ffi Root cause of maturin failure: the shim Cargo.toml had no [lib] target, so maturin (bindings = "uniffi") had no cdylib to build into a wheel. Fix: - Add [lib] name = "minigraf_ffi" crate-type = ["cdylib"] so maturin finds its target - src/lib.rs re-exports everything from minigraf-ffi; this pulls the UniFFI scaffolding symbols (setup_scaffolding! extern "C" fns) into the cdylib output - Rename the dep to avoid crate-name collision with [lib] name above (Cargo passes it as --extern minigraf_ffi_upstream so lib.rs can reference it unambiguously) Requires minigraf-ffi >= 1.1.2 (project-minigraf/minigraf#266) which adds "lib" to crate-type so Cargo produces the .rlib needed for this pattern. Will not build until that tag is published to crates.io. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(shim): embed FFI layer directly; depend on minigraf core only Instead of wrapping minigraf-ffi (which has no rlib output), the Python repo now owns its FFI layer directly. src/lib.rs is the UniFFI binding definition, depending on minigraf core (which has crate-type rlib). This approach: - Builds with minigraf 1.1.1 — no new crates.io publish needed - Eliminates the minigraf-ffi intermediary for language binding repos - Gives the Python repo ownership of its own Python API surface minigraf-ffi on crates.io remains useful for Rust projects that need the C ABI directly; it doesn't change the Python binding design. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
"lib"tominigraf-ffi'scrate-typelist (was["cdylib", "staticlib"], now["cdylib", "staticlib", "lib"])minigraf-ffiversion from 1.1.1 → 1.1.2.github/workflows/publish-ffi.yml— affi-v*tag-triggered workflow for future FFI-only patch releasesRoot Cause
The
minigraf-python(andminigraf-node/minigraf-wasm) binding repos need to create their owncdylibthat re-exports fromminigraf-ffito give maturin a[lib]target. This requiresminigraf-ffito be usable as a Rust library dependency — which means Cargo must produce an.rlibfor it.Without
"lib"incrate-type, Cargo only builds.soand.aartifacts and never passes--extern minigraf_ffi=...when compiling dependents, makinguse minigraf_ffi::*impossible.Test Plan
cargo build -p minigraf-ffisucceedsffi-v1.1.2tag to publish to crates.iominigraf-pythonto depend onminigraf-ffi = "1.1.2"and verify CI passes🤖 Generated with Claude Code