bytecodealliance / cargo-component

A Cargo subcommand for creating WebAssembly components based on the component model proposal.
Apache License 2.0
435 stars 48 forks source link

`cargo component build` always produces a `bindings.rs` file #314

Open yoshuawuyts opened 1 month ago

yoshuawuyts commented 1 month ago

I've been working on a number of projects which just directly pull the wasi crate, but don't do anything with a local wit/ directory. This produces a src/bindings.rs file, despite not actually ever being used. This can be a little confusing for people trying to read the code, because there is currently always an unused but important-sounding file sitting in the project hierarchy.

Can we make generating this file conditional on, say, whether there is a local wit/ directory present?

iawia002 commented 3 weeks ago

I also encountered the same problem. If I did not have wit files, cargo component still generated the bindings for me, and its content actually made no sense. I'll submit a PR for this.