Skip to content

Conversation

@pchickey
Copy link
Contributor

@pchickey pchickey commented Sep 25, 2019

Based on #96

Over in Lucet, we need to consume the witx description of the WASI spec in several different rust crates. Rather than put each crate in charge of finding and parsing .witx files from the filesystem, and and to provide an easy mechanism to use the same version of the spec across the project, I have created the wasi-spec crate in this project.

wasi-spec has a build.rs step to serialize the witx document into a single file, and uses include_str! and witx::parse to make the document available in the crate. At the moment it only packages wasi_unstable_preview0. We can package the other phases as well if desired.

I'm not sure if packaging the spec as a crate is exactly the right thing to do, but it is useful to me, and might be useful to others as well, so I figured it can live here rather than in the Lucet crate. I am open to feedback about whether this is the right way to package it or the right place for this code to live.

Pat Hickey added 4 commits September 24, 2019 13:56
…l invariants

the definitions/entries pattern involves upgrading Weak into Rc and also
its not super intuitive, especially given ive written zero (0) docs.
This is a bit nicer to use
this makes it easier for others to use the spec without depending
on this repo directly
because there are multiple crates now
@pchickey pchickey changed the title Make witx document describing wasi spec available as a wasi crate Make witx document describing wasi spec available as the wasi-spec crate Sep 25, 2019
the wasi name is already taken on crates.io by the official wasi
bindings. i never even looked, sloppy work!
for (phase, version) in WASI_VERSIONS {
let doc =
load_wasi_spec(phase, version).expect(&format!("load wasi {} {}", phase, version));
serialize_wasi_spec(phase, version, &doc);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not immediately clear what this build.rs program is doing. Why do we need to load and serialize the witx here?

@pchickey pchickey closed this Sep 25, 2019
@pchickey
Copy link
Contributor Author

Sorry, this was a bad idea, I didn't realize this won't work unless built from the git repo. The spec .witx files won't be present if this crate is downloaded from crates.io and the build.rs will fail.

@pchickey pchickey deleted the pch/wasi_crate branch October 16, 2019 21:36
yoshuawuyts pushed a commit to yoshuawuyts/WASI that referenced this pull request Nov 25, 2025
yoshuawuyts pushed a commit to yoshuawuyts/WASI that referenced this pull request Nov 25, 2025
…-wasi-sockets

Update to the latest wasi-sockets.
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.

3 participants