Skip to content

Commit

Permalink
test-programs: reorganize wasi content generated by wit and remove un…
Browse files Browse the repository at this point in the history
…necessary deps (#9080)
  • Loading branch information
iawia002 authored Aug 6, 2024
1 parent 0077817 commit 25ea52a
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 825 deletions.
1 change: 0 additions & 1 deletion ci/vendor-wit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ make_vendor "wasi" "
io@v0.2.1
random@v0.2.1
sockets@v0.2.1
http@v0.2.1
"

make_vendor "wasi-http" "
Expand Down
6 changes: 3 additions & 3 deletions crates/test-programs/src/bin/cli_serve_keyvalue.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use test_programs::keyvalue::wasi::keyvalue;
use test_programs::proxy;
use test_programs::wasi::http::types::{
Fields, IncomingRequest, OutgoingBody, OutgoingResponse, ResponseOutparam,
use test_programs::wasi::{
http::types::{Fields, IncomingRequest, OutgoingBody, OutgoingResponse, ResponseOutparam},
keyvalue,
};

struct T;
Expand Down
6 changes: 3 additions & 3 deletions crates/test-programs/src/bin/cli_serve_runtime_config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use test_programs::config::wasi::config::runtime;
use test_programs::proxy;
use test_programs::wasi::http::types::{
Fields, IncomingRequest, OutgoingBody, OutgoingResponse, ResponseOutparam,
use test_programs::wasi::{
config::runtime,
http::types::{Fields, IncomingRequest, OutgoingBody, OutgoingResponse, ResponseOutparam},
};

struct T;
Expand Down
2 changes: 1 addition & 1 deletion crates/test-programs/src/bin/keyvalue_main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use test_programs::keyvalue::wasi::keyvalue::{atomics, batch, store};
use test_programs::wasi::keyvalue::{atomics, batch, store};

fn main() {
let bucket = store::open("").unwrap();
Expand Down
2 changes: 1 addition & 1 deletion crates/test-programs/src/bin/runtime_config_get.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use test_programs::config::wasi::config::runtime;
use test_programs::wasi::config::runtime;

fn main() {
let v = runtime::get("hello").unwrap().unwrap();
Expand Down
34 changes: 17 additions & 17 deletions crates/test-programs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,23 @@ pub mod preview1;
pub mod sockets;

wit_bindgen::generate!({
world: "test-command",
path: "../wasi/wit",
inline: "
package wasmtime:test;
world test {
include wasi:cli/imports@0.2.1;
include wasi:config/imports@0.2.0-draft;
include wasi:keyvalue/imports@0.2.0-draft;
import wasi:http/types@0.2.1;
import wasi:http/outgoing-handler@0.2.1;
}
",
path: [
"../wasi-http/wit",
"../wasi-runtime-config/wit",
"../wasi-keyvalue/wit",
],
world: "wasmtime:test/test",
generate_all,
});

Expand All @@ -30,18 +45,3 @@ pub mod proxy {
},
});
}

pub mod config {
wit_bindgen::generate!({
path: "../wasi-runtime-config/wit",
world: "wasi:config/imports",
});
}

pub mod keyvalue {
wit_bindgen::generate!({
path: "../wasi-keyvalue/wit",
world: "wasi:keyvalue/imports",
type_section_suffix: "keyvalue",
});
}
6 changes: 0 additions & 6 deletions crates/wasi-http/wit/command-extended.wit

This file was deleted.

22 changes: 0 additions & 22 deletions crates/wasi-http/wit/test.wit

This file was deleted.

6 changes: 6 additions & 0 deletions crates/wasi-http/wit/world.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// We actually don't use this; it's just to let bindgen! find the corresponding world in wit/deps.
package wasmtime:wasi-http;

world bindings {
include wasi:http/proxy@0.2.1;
}
2 changes: 1 addition & 1 deletion crates/wasi-keyvalue/wit/world.wit
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// We actually don't use this; it's just to let bindgen! find the corresponding world in wit/deps.
package wasmtime:wasi;
package wasmtime:wasi-keyvalue;

world bindings {
include wasi:keyvalue/imports@0.2.0-draft;
Expand Down
1 change: 1 addition & 0 deletions crates/wasi-preview1-component-adapter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ pub mod bindings {
import wasi:cli/stdin@0.2.1;
}
"#,
world: "wasmtime:adapter/adapter",
std_feature,
raw_strings,
runtime_path: "crate::bindings::wit_bindgen_rt_shim",
Expand Down
2 changes: 1 addition & 1 deletion crates/wasi-runtime-config/wit/world.wit
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// We actually don't use this; it's just to let bindgen! find the corresponding world in wit/deps.
package wasmtime:wasi;
package wasmtime:wasi-config;

world bindings {
include wasi:config/imports@0.2.0-draft;
Expand Down
6 changes: 0 additions & 6 deletions crates/wasi/wit/command-extended.wit

This file was deleted.

49 changes: 0 additions & 49 deletions crates/wasi/wit/deps/http/handler.wit

This file was deleted.

50 changes: 0 additions & 50 deletions crates/wasi/wit/deps/http/proxy.wit

This file was deleted.

Loading

0 comments on commit 25ea52a

Please sign in to comment.