diff --git a/Cargo.toml b/Cargo.toml index dfc92d2e8..7d1f78474 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,7 @@ include = [ "/README.md", "rustfmt.toml" ] +autoexamples = false [dependencies] atty = "0.2" @@ -123,9 +124,10 @@ managed = ["backend-singlepass", "wasmer-runtime-core/managed"] [[example]] name = "plugin" -required-features = ["wasi"] +required-features = ["wasi", "backend-cranelift"] crate-type = ["bin"] [[example]] name = "callback" crate-type = ["bin"] +required-features = ["backend-cranelift"] diff --git a/Makefile b/Makefile index 0ed81f588..10de2c591 100644 --- a/Makefile +++ b/Makefile @@ -216,9 +216,9 @@ integration-tests: release-clif examples ./tests/integration_tests/cowsay/test.sh examples: - cargo run --example plugin - cargo run --example callback - + cargo build --release $(backend_features) --examples + test -f target/release/examples/callbackx && ./target/release/examples/callback || echo "skipping callback test" + test -f target/release/examples/pluginx && ./target/release/examples/plugin || echo "skipping plugin test" # Utils lint: diff --git a/examples/callback.rs b/examples/callback.rs index 1b30b69d1..1622f1132 100644 --- a/examples/callback.rs +++ b/examples/callback.rs @@ -1,6 +1,6 @@ /// This example demonstrates the use of callbacks: calling functions (Host and Wasm) /// passed to us from the Wasm via hostcall -use wasmer_runtime::{compile_with, compiler_for_backend, func, imports, Backend, Ctx, Func}; +use wasmer::{compiler::compile, func, imports, vm::Ctx, Func}; use wasmer_runtime_core::{structures::TypedIndex, types::TableIndex}; static WASM: &'static str = "examples/callback-guest/callback-guest.wasm"; @@ -34,8 +34,7 @@ fn main() { }, }; - let compiler = compiler_for_backend(Backend::default()).unwrap(); - let module = compile_with(&wasm_bytes[..], compiler.as_ref()).unwrap(); + let module = compile(&wasm_bytes[..]).unwrap(); let instance = module .instantiate(&imports) .expect("failed to instantiate wasm module"); diff --git a/examples/plugin.rs b/examples/plugin.rs index 8d9dc8995..357944d8f 100644 --- a/examples/plugin.rs +++ b/examples/plugin.rs @@ -1,5 +1,6 @@ use serde::{Deserialize, Serialize}; -use wasmer_runtime::{compile, func, imports, Ctx, Func}; +use wasmer::compiler::compile; +use wasmer::{func, imports, vm::Ctx, Func}; use wasmer_wasi::{ generate_import_object_for_version, state::{self, WasiFile, WasiFsError},