lwansbrough opened issue #9249:
wit-bindgen includes the option to provide a list of paths for the wit sources. This makes it more practical to satisfy the requirements of imports from other packages. Enabling this behaviour for the component bindgen macro would be helpful.
wit-bindgen docs:
// Path to parse WIT and its dependencies from. Defaults to the `wit` // folder adjacent to your `Cargo.toml`. // // This parameter also supports the form of a list, such as: // ["../path/to/wit1", "../path/to/wit2"] // Usually used in testing, our test suite may want to generate code // from wit files located in multiple paths within a single mod, and we // don't want to copy these files again. path: "../path/to/wit",
alexcrichton commented on issue #9249:
Thanks for the report! To link things here this was implemented in wit-bindgen in https://github.com/bytecodealliance/wit-bindgen/pull/1003 and I think it'd be reasonable to copy over a similar structure into Wasmtime as well. @lwansbrough would you be interested in creating a PR perhaps?
lwansbrough commented on issue #9249:
@alexcrichton I'll see what I can do.
I was looking through that commit and this looks like a bug to me. https://github.com/bytecodealliance/wit-bindgen/blob/3e3877da85daf1ed98bd1aee7007e496461c3bd1/crates/guest-rust/macro/src/lib.rs#L215
Line 237 passes
root.join("wit")
which would meanroot
is joined toroot
.
alexcrichton commented on issue #9249:
Good catch! Semantically that'll work out ok since
"/a".join("/b")
yields"/b"
, so the end result is the same. That being said it's unnecessarily complex, and just passing in"wit"
instead ofroot.join("wit")
should also work and be cleaner.
MarinPostma commented on issue #9249:
Will this enable importing transitive dependencies of the package? Say I am generating binding for package A, but package
A
includes packageB
in a different directory, should I just be able to add the path toB
and have it all work?
alexcrichton closed issue #9249:
wit-bindgen includes the option to provide a list of paths for the wit sources. This makes it more practical to satisfy the requirements of imports from other packages. Enabling this behaviour for the component bindgen macro would be helpful.
wit-bindgen docs:
// Path to parse WIT and its dependencies from. Defaults to the `wit` // folder adjacent to your `Cargo.toml`. // // This parameter also supports the form of a list, such as: // ["../path/to/wit1", "../path/to/wit2"] // Usually used in testing, our test suite may want to generate code // from wit files located in multiple paths within a single mod, and we // don't want to copy these files again. path: "../path/to/wit",
alexcrichton commented on issue #9249:
@MarinPostma I believe so yeah, but it if it doesn't
alexcrichton edited a comment on issue #9249:
@MarinPostma I believe so yeah, but if it doesn't let me know!
MarinPostma commented on issue #9249:
I'll give it a try then :)
Last updated: Dec 23 2024 at 12:05 UTC