bytecodealliance / bytecodealliance/cargo-component

build.rs support for cargo-component

Open
#407 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
593
Forks
68
PR merge metrics
No merged PRs in 30d

Description

hi folks,

playing with building wasm components and it seems the current approach requires one to run `cargo component bindings` to generate a `src/bindings.rs` file, which then has to be committed into the repository for whatever component (and re-committed on any changes).

a more common/rusty way to do this that avoids generated files being included in the source tree would be to [invoke the binding generation from `build.rs`](https://rust-lang.github.io/rust-bindgen/tutorial-3.html) then [import the generated bindings](https://rust-lang.github.io/rust-bindgen/tutorial-4.html) (like `bindgen` does).

have you considered supporting this approach? i see adding `build.rs` support was discussed in https://github.com/bytecodealliance/cargo-component/issues/362 but not actioned. it seems like generating the bindings from `build.rs` should be straightforward, then `cargo component` would need to pick up a flag or something to say that it shouldn't generate bindings itself.

cheers,

ryan

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.