Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace WASI WITs with binary form #7929

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -501,12 +501,6 @@ jobs:
RUST_BACKTRACE: 1
if: matrix.target == '' && matrix.os != 'windows-latest' && needs.determine.outputs.test-capi

# Ensure wit definitions are in sync: both wasmtime-wasi and wasmtime-wasi-http need their own
# copy of the wit definitions so publishing works, but we need to ensure they are identical copies.
- name: Check that the wasi and wasi-http wit directories agree
run: |
diff -ru crates/wasi/wit crates/wasi-http/wit

# Record some CPU details; this is helpful information if tests fail due
# to CPU-specific features.
- name: CPU information
Expand Down
68 changes: 15 additions & 53 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ io-lifetimes = { version = "2.0.3", default-features = false }
io-extras = "0.18.1"
rustix = "0.38.31"
# wit-bindgen:
wit-bindgen = { version = "0.17.0", default-features = false }
wit-bindgen = { version = "0.18.0", default-features = false }

# wasm-tools family:
wasmparser = "0.121.2"
Expand Down
11 changes: 7 additions & 4 deletions crates/component-macro/src/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,16 @@ pub fn expand(input: &Config) -> Result<TokenStream> {
}
let mut contents = src.parse::<TokenStream>().unwrap();

// Include a dummy `include_str!` for any files we read so rustc knows that
// Include a dummy `include_bytes!` for any files we read so rustc knows that
// we depend on the contents of those files.
for file in input.files.iter() {
contents.extend(
format!("const _: &str = include_str!(r#\"{}\"#);\n", file.display())
.parse::<TokenStream>()
.unwrap(),
format!(
"const _: &[u8] = include_bytes!(r#\"{}\"#);\n",
file.display()
)
.parse::<TokenStream>()
.unwrap(),
);
}

Expand Down
1 change: 0 additions & 1 deletion crates/test-programs/src/bin/api_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ pub mod bindings {
use super::T;

wit_bindgen::generate!({
path: "../wasi-http/wit",
world: "wasi:http/proxy",
exports: {
"wasi:http/incoming-handler": T,
Expand Down
1 change: 0 additions & 1 deletion crates/test-programs/src/bin/api_proxy_streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ mod bindings {
use super::Handler;

wit_bindgen::generate!({
path: "../wasi-http/wit",
world: "wasi:http/proxy",
exports: {
"wasi:http/incoming-handler": Handler,
Expand Down
1 change: 0 additions & 1 deletion crates/test-programs/src/bin/api_reactor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
wit_bindgen::generate!({
world: "test-reactor",
path: "../wasi/wit",
exports: {
world: T,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/test-programs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ pub mod http;
pub mod preview1;
pub mod sockets;

wit_bindgen::generate!("test-command" in "../wasi/wit");
wit_bindgen::generate!("test-command");
Binary file not shown.
Binary file not shown.
File renamed without changes.
2 changes: 1 addition & 1 deletion crates/wasi-http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub mod types_impl;

pub mod bindings {
wasmtime::component::bindgen!({
path: "wit",
path: "[email protected]",
interfaces: "
import wasi:http/[email protected];
import wasi:http/[email protected];
Expand Down
2 changes: 2 additions & 0 deletions crates/wasi-http/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::{bindings, WasiHttpView};
use wasmtime_wasi::preview2;

wasmtime::component::bindgen!({
path: "[email protected]",
world: "wasi:http/proxy",
tracing: true,
async: true,
Expand Down Expand Up @@ -54,6 +55,7 @@ pub mod sync {
use wasmtime_wasi::preview2;

wasmtime::component::bindgen!({
path: "[email protected]",
world: "wasi:http/proxy",
tracing: true,
async: false,
Expand Down
Binary file added crates/wasi-http/[email protected]
Binary file not shown.
6 changes: 0 additions & 6 deletions crates/wasi-http/wit/command-extended.wit

This file was deleted.

7 changes: 0 additions & 7 deletions crates/wasi-http/wit/deps/cli/command.wit

This file was deleted.

18 changes: 0 additions & 18 deletions crates/wasi-http/wit/deps/cli/environment.wit

This file was deleted.

4 changes: 0 additions & 4 deletions crates/wasi-http/wit/deps/cli/exit.wit

This file was deleted.

20 changes: 0 additions & 20 deletions crates/wasi-http/wit/deps/cli/imports.wit

This file was deleted.

4 changes: 0 additions & 4 deletions crates/wasi-http/wit/deps/cli/run.wit

This file was deleted.

17 changes: 0 additions & 17 deletions crates/wasi-http/wit/deps/cli/stdio.wit

This file was deleted.

49 changes: 0 additions & 49 deletions crates/wasi-http/wit/deps/cli/terminal.wit

This file was deleted.

Loading