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

Update wit-bindgen 0.17.1 -> 0.25.0 #60

Merged
Merged
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
133 changes: 110 additions & 23 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 @@ -53,4 +53,4 @@ wasmparser = "0.121.2"

[workspace.dependencies]
anyhow = "1"
wit-bindgen = "0.17.1"
wit-bindgen = "0.25.0"
Binary file modified lib/virtual_adapter.debug.wasm
Binary file not shown.
Binary file modified lib/virtual_adapter.wasm
Binary file not shown.
24 changes: 21 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,30 @@ impl WasiVirt {
Default::default()
};

let component_type_section_id = module
.customs
.iter()
.find_map(|(id, section)| {
let name = section.name();
if name.starts_with("component-type:")
&& section.as_any().is::<walrus::RawCustomSection>()
{
Some(id)
} else {
None
}
})
.context("Unable to find component type section")?;

// decode the component custom section to strip out the unused world exports
// before reencoding.
let mut component_section = module
let mut component_section = *module
.customs
.remove_raw("component-type:virtual-adapter")
.context("Unable to find component section")?;
.delete(component_type_section_id)
.context("Unable to find component section")?
.into_any()
.downcast::<walrus::RawCustomSection>()
.unwrap();

let (mut resolve, pkg_id) = match wit_component::decode(VIRT_WIT_METADATA)? {
DecodedWasm::WitPackage(resolve, pkg_id) => (resolve, pkg_id),
Expand Down
5 changes: 2 additions & 3 deletions tests/components/do-everything/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ extern crate rand;
wit_bindgen::generate!({
path: "../../../wit",
world: "virt-test",
exports: {
world: VirtTestComponent
},
});

struct VirtTestComponent;
Expand All @@ -34,3 +31,5 @@ impl Guest for VirtTestComponent {
unimplemented!();
}
}

export!(VirtTestComponent);
5 changes: 2 additions & 3 deletions tests/components/file-read/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ use std::{fs, io::ErrorKind};
wit_bindgen::generate!({
path: "../../../wit",
world: "virt-test",
exports: {
world: VirtTestComponent
},
});

struct VirtTestComponent;
Expand Down Expand Up @@ -67,3 +64,5 @@ impl Guest for VirtTestComponent {
unimplemented!();
}
}

export!(VirtTestComponent);
5 changes: 2 additions & 3 deletions tests/components/get-env/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ use std::env;
wit_bindgen::generate!({
path: "../../../wit",
world: "virt-test",
exports: {
world: VirtTestComponent
},
});

struct VirtTestComponent;
Expand All @@ -21,3 +18,5 @@ impl Guest for VirtTestComponent {
unimplemented!();
}
}

export!(VirtTestComponent);
5 changes: 2 additions & 3 deletions tests/components/stdio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ use std::env;
wit_bindgen::generate!({
path: "../../../wit",
world: "virt-test",
exports: {
world: VirtTestComponent
},
});

struct VirtTestComponent;
Expand All @@ -21,3 +18,5 @@ impl Guest for VirtTestComponent {
println!("Hello world");
}
}

export!(VirtTestComponent);
Loading