-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3177 from wasmerio/wasi-types-generation-2
Auto-generate wasi-types from .wit files
- Loading branch information
Showing
56 changed files
with
14,156 additions
and
4,454 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,7 @@ macro_rules! primitives { | |
)*) | ||
} | ||
primitives! { | ||
bool | ||
i8 u8 | ||
i16 u16 | ||
i32 u32 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
wit-bindgen/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
# `wasmer-wasi-types` [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/master/LICENSE) [![crates.io](https://img.shields.io/crates/v/wasmer-wasi-types.svg)](https://crates.io/crates/wasmer-wasi-types) | ||
|
||
This crate contains the WASI types necessary for `wasmer-wasi`. Please check this crate to learn more! | ||
|
||
--- | ||
|
||
Run `regenerate.sh` to regenerate the wasi-types from | ||
the `wasi-clean/typenames.wit` into the final Rust bindings. | ||
|
||
The `wasi-types-generator-extra` generates some extra code | ||
that wit-bindgen currently can't provide. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
BASEDIR=$(dirname "$0") | ||
|
||
rm -f \ | ||
"$BASEDIR"/src/bindings.rs \ | ||
"$BASEDIR"/src/*/bindings.rs | ||
|
||
cat "$BASEDIR"/wit-clean/typenames.wit "$BASEDIR"/wit-clean/wasi_unstable.wit > "$BASEDIR"/wit-clean/output.wit | ||
|
||
git clone https://github.com/wasmerio/wit-bindgen --branch force-generate-structs --single-branch | ||
git pull origin force-generate-structs | ||
cd wit-bindgen | ||
cargo build | ||
cd .. | ||
|
||
./wit-bindgen/target/debug/wit-bindgen rust-wasm \ | ||
--import "$BASEDIR"/wit-clean/output.wit \ | ||
--force-generate-structs \ | ||
--out-dir "$BASEDIR"/src/wasi \ | ||
|
||
awk '{sub(/mod output/,"pub mod output")}1' src/wasi/bindings.rs > src/wasi/bindings2.rs | ||
cargo fmt --all | ||
cp src/wasi/bindings2.rs src/wasi/bindings.rs | ||
rm src/wasi/bindings2.rs | ||
|
||
cd ./wasi-types-generator-extra | ||
cargo build | ||
pwd | ||
../../../target/debug/wasi-types-generator-extra | ||
cd .. | ||
|
||
cargo fmt --all |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.