test-programs: reorganize wasi content generated by wit#8939
test-programs: reorganize wasi content generated by wit#8939iawia002 wants to merge 1 commit intobytecodealliance:mainfrom
Conversation
alexcrichton
left a comment
There was a problem hiding this comment.
If we go this route I'd prefer to restructure things a little bit to make it a bit more maintainable over time. Of bindings to generate they basically fall into the categories of "what to import" and "what to export" where imports are a union of everything supported and exports are separated per-world.
For imports I think it would be best to use the inline WIT syntax that generate! supports and to include wasi:cli/imports for all the relevant WIT packages. For exports there would then be a single generate!-per-world supported which uses with to point all dependencies to the main "soup of imports".
Does that make sense? It would avoid the need to weave everything back together in Rust code and would enable keeping things separate.
|
Yes, that makes sense. However, to support this model, we need the Hope I didn't misunderstand your point. |
|
The solution we've had for that is to have copies of WIT files in multiple locations. It's not a great solution but it's why |
Oh right, since test programs don't need to be published to crates.io, I forgot to consider that. I'll make an update soon. |
|
Could the WIT folder not be duplicated here? Since test-programs isn't published to crates.io it should be able to refer to the folder defined in the wasmtime-wasi or wasmtime-wasi-http crate |
|
Nope, it has to, as I mentioned before, this change is mainly for the upcoming addition of APIs like |
|
And I plan to make some improvements to the |
|
It's a bit difficult to review this as it's setting up for future changes I at least personally have not yet seen or reviewed. In that sense it's difficult to review changes when only half the motivation is apparent, so I'd ask you bear with me in my questions and review feedback here. Ideally we only have one copy of all WIT files in-tree. Even today it's a bummer we have one copy in wasmtime-wasi and one copy in wasmtime-wasi-http. How we manage WIT has changed over time but we've never settled on something everyone's happy with. The current status quo is the sort of "local maximum" where it's low-overhead to maintain and the management in CI is relatively simple. In-tree there's also two main "styles" of sorts (not many data points to draw from) of managing WIT. One is wasmtime-wasi/wasmtime-wasi-http which are somewhat "tied at the hip". They're managed similarly and have the same WIT files. Another is wasi-nn which, like wasi-runtime-config, has no other WIT dependencies and is managed differently. Everything has a With the eventual goal of adding wasi-runtime-config, I would recommend one of two routes:
With the (1) route it should be possible to add everything today without changes. With (2) I would recommend first refactoring the wit_bindgen::generate!({
path: ["../wasmtime-wasi/wit", "../wasmtime-wasi-http/wit", "../wasi-nn/wit"],
inline: "
include wasi:cli/imports;
include wasi:http/imports;
include wasi:nn/imports;
",
});I don't think that's fully supported in |
|
Thanks for getting back to me, let's hold this for now. My original intention for making these changes before implementing the I was too fixated on getting these future tasks done beforehand. It seems I got the sequence of everything wrong. Let's go back to the beginning, after I have implemented the |
This patch reorganizes the modules generated by wit, merging all wit-generated wasi content into a single mod like wasi-rs.
This will facilitate the addition of new WASI APIs like wasi-runtime-config and make the import paths more straightforward (for the wasi-runtime-config case, it will be
test_programs::wasi::config).And I believe this could make the wit dependencies of the
wasicrate don't rely on thehttpworld as I mentioned in #8928 (comment).cc @alexcrichton