8000 fix(ffi): add lib crate-type to minigraf-ffi; bump to 1.1.2 by adityamukho · Pull Request #266 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

fix(ffi): add lib crate-type to minigraf-ffi; bump to 1.1.2 - #266

Merged
adityamukho merged 1 commit into
mainfrom
fix/ffi-rlib-crate-type
May 17, 2026
Merged

adityamukho merged 1 commit into
mainfrom
fix/ffi-rlib-crate-type

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Summary

  • Adds "lib" to minigraf-ffi's crate-type list (was ["cdylib", "staticlib"], now ["cdylib", "staticlib", "lib"])
  • Bumps minigraf-ffi version from 1.1.1 → 1.1.2
  • Adds .github/workflows/publish-ffi.yml — a ffi-v* tag-triggered workflow for future FFI-only patch releases

Root Cause

The minigraf-python (and minigraf-node/minigraf-wasm) binding repos need to create their own cdylib that re-exports from minigraf-ffi to give maturin a [lib] target. This requires minigraf-ffi to be usable as a Rust library dependency — which means Cargo must produce an .rlib for it.

Without "lib" in crate-type, Cargo only builds .so and .a artifacts and never passes --extern minigraf_ffi=... when compiling dependents, making use minigraf_ffi::* impossible.

Test Plan

  • cargo build -p minigraf-ffi succeeds
  • All 962 tests pass (pre-push hook)
  • After merge: push ffi-v1.1.2 tag to publish to crates.io
  • Update minigraf-python to depend on minigraf-ffi = "1.1.2" and verify CI passes

🤖 Generated with Claude Code

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>
@codecov
codecov Bot commented May 17, 2026
Copy link
Copy Markdown

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>
@adityamukho
adityamukho merged commit 7f552a4 into main May 17, 2026
25 checks passed
@adityamukho
adityamukho deleted the fix/ffi-rlib-crate-type branch May 17, 2026 17:27
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

0