diff --git a/Cargo.lock b/Cargo.lock index fbd8d522b6a..ac5b2662e9a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2397,7 +2397,7 @@ checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" [[package]] name = "wasmer" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "anyhow", "cfg-if 0.1.10", @@ -2423,7 +2423,7 @@ dependencies = [ [[package]] name = "wasmer-c-api" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "cbindgen", "cfg-if 1.0.0", @@ -2451,7 +2451,7 @@ dependencies = [ [[package]] name = "wasmer-cache" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "blake3", "hex", @@ -2461,7 +2461,7 @@ dependencies = [ [[package]] name = "wasmer-cli" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "anyhow", "atty", @@ -2493,7 +2493,7 @@ dependencies = [ [[package]] name = "wasmer-compiler" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "enumset", "hashbrown 0.9.1", @@ -2510,7 +2510,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-cranelift" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "cranelift-codegen 0.67.0", "cranelift-codegen 0.68.0", @@ -2531,7 +2531,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-llvm" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "byteorder", "cc", @@ -2553,7 +2553,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-singlepass" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "byteorder", "dynasm", @@ -2572,7 +2572,7 @@ dependencies = [ [[package]] name = "wasmer-derive" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "compiletest_rs", "proc-macro-error", @@ -2584,7 +2584,7 @@ dependencies = [ [[package]] name = "wasmer-emscripten" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "byteorder", "getrandom 0.2.0", @@ -2597,7 +2597,7 @@ dependencies = [ [[package]] name = "wasmer-engine" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "backtrace", "bincode", @@ -2616,7 +2616,7 @@ dependencies = [ [[package]] name = "wasmer-engine-dummy" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "bincode", "serde", @@ -2629,7 +2629,7 @@ dependencies = [ [[package]] name = "wasmer-engine-jit" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "bincode", "cfg-if 0.1.10", @@ -2645,7 +2645,7 @@ dependencies = [ [[package]] name = "wasmer-engine-native" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "bincode", "cfg-if 0.1.10", @@ -2664,7 +2664,7 @@ dependencies = [ [[package]] name = "wasmer-engine-object-file" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "bincode", "cfg-if 0.1.10", @@ -2682,7 +2682,7 @@ dependencies = [ [[package]] name = "wasmer-integration-tests-cli" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "anyhow", "tempfile", @@ -2690,7 +2690,7 @@ dependencies = [ [[package]] name = "wasmer-middlewares" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "wasmer", "wasmer-types", @@ -2699,7 +2699,7 @@ dependencies = [ [[package]] name = "wasmer-object" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "object", "thiserror", @@ -2709,7 +2709,7 @@ dependencies = [ [[package]] name = "wasmer-types" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "cranelift-entity 0.68.0", "serde", @@ -2718,7 +2718,7 @@ dependencies = [ [[package]] name = "wasmer-vm" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "backtrace", "cc", @@ -2736,7 +2736,7 @@ dependencies = [ [[package]] name = "wasmer-wasi" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "bincode", "byteorder", @@ -2754,7 +2754,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-experimental-io-devices" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "minifb", "ref_thread_local", @@ -2766,7 +2766,7 @@ dependencies = [ [[package]] name = "wasmer-wast" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "anyhow", "serde", @@ -2780,7 +2780,7 @@ dependencies = [ [[package]] name = "wasmer-workspace" -version = "1.0.0-beta1" +version = "1.0.0-beta2" dependencies = [ "anyhow", "blake3", diff --git a/lib/c-api/build.rs b/lib/c-api/build.rs index 5c0539f8f0a..470379ab198 100644 --- a/lib/c-api/build.rs +++ b/lib/c-api/build.rs @@ -417,15 +417,25 @@ fn exclude_items_from_wasm_c_api(builder: Builder) -> Builder { fn build_inline_c_env_vars() { use std::ffi::OsStr; - let mut shared_object_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); + let mut shared_object_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); - assert_eq!(shared_object_dir.file_name(), Some(OsStr::new("c-api"))); + assert_eq!(shared_object_dir.file_name(), Some(OsStr::new("out"))); shared_object_dir.pop(); - assert_eq!(shared_object_dir.file_name(), Some(OsStr::new("lib"))); + assert!(shared_object_dir + .file_name() + .as_ref() + .unwrap() + .to_string_lossy() + .to_string() + .starts_with("wasmer-c-api")); shared_object_dir.pop(); - shared_object_dir.push("target"); + assert_eq!(shared_object_dir.file_name(), Some(OsStr::new("build"))); + shared_object_dir.pop(); + shared_object_dir.pop(); + + assert_eq!(shared_object_dir.file_name(), Some(OsStr::new("target"))); shared_object_dir.push(env::var("PROFILE").unwrap()); let shared_object_dir = shared_object_dir.as_path().to_string_lossy(); diff --git a/lib/c-api/wasmer.h b/lib/c-api/wasmer.h index d277656ed78..5eeb148597e 100644 --- a/lib/c-api/wasmer.h +++ b/lib/c-api/wasmer.h @@ -32,11 +32,11 @@ #define WASMER_WASI_ENABLED // This file corresponds to the following Wasmer version. -#define WASMER_VERSION "1.0.0-beta1" +#define WASMER_VERSION "1.0.0-beta2" #define WASMER_VERSION_MAJOR 1 #define WASMER_VERSION_MINOR 0 #define WASMER_VERSION_PATCH 0 -#define WASMER_VERSION_PRE "beta1" +#define WASMER_VERSION_PRE "beta2" #endif // WASMER_H_PRELUDE diff --git a/lib/c-api/wasmer.hh b/lib/c-api/wasmer.hh index aa9a6a0af5b..0b664f28a8e 100644 --- a/lib/c-api/wasmer.hh +++ b/lib/c-api/wasmer.hh @@ -32,11 +32,11 @@ #define WASMER_WASI_ENABLED // This file corresponds to the following Wasmer version. -#define WASMER_VERSION "1.0.0-beta1" +#define WASMER_VERSION "1.0.0-beta2" #define WASMER_VERSION_MAJOR 1 #define WASMER_VERSION_MINOR 0 #define WASMER_VERSION_PATCH 0 -#define WASMER_VERSION_PRE "beta1" +#define WASMER_VERSION_PRE "beta2" #endif // WASMER_H_PRELUDE diff --git a/lib/c-api/wasmer_wasm.h b/lib/c-api/wasmer_wasm.h index 12543ee153e..e11a38dc706 100644 --- a/lib/c-api/wasmer_wasm.h +++ b/lib/c-api/wasmer_wasm.h @@ -39,11 +39,11 @@ #define WASMER_WASI_ENABLED // This file corresponds to the following Wasmer version. -#define WASMER_VERSION "1.0.0-beta1" +#define WASMER_VERSION "1.0.0-beta2" #define WASMER_VERSION_MAJOR 1 #define WASMER_VERSION_MINOR 0 #define WASMER_VERSION_PATCH 0 -#define WASMER_VERSION_PRE "beta1" +#define WASMER_VERSION_PRE "beta2" #endif // WASMER_WASM_H_PRELUDE @@ -287,9 +287,125 @@ void wasm_config_set_compiler(wasm_config_t *config, wasmer_compiler_t compiler) */ void wasm_config_set_engine(wasm_config_t *config, wasmer_engine_t engine); +/** + * Non-standard Wasmer-specific API to get the module's name, + * otherwise `out->size` is set to `0` and `out->data` to `NULL`. + * + * # Example + * + * ```rust + * # use inline_c::assert_c; + * # fn main() { + * # (assert_c! { + * # #include "tests/wasmer_wasm.h" + * # + * int main() { + * // Create the engine and the store. + * wasm_engine_t* engine = wasm_engine_new(); + * wasm_store_t* store = wasm_store_new(engine); + * + * // Create a WebAssembly module from a WAT definition. + * wasm_byte_vec_t wat; + * wasmer_byte_vec_new_from_string(&wat, "(module $moduleName)"); + * // ^~~~~~~~~~~ that's the name! + * wasm_byte_vec_t wasm; + * wat2wasm(&wat, &wasm); + * + * // Create the module. + * wasm_module_t* module = wasm_module_new(store, &wasm); + * + * // Read the module's name. + * wasm_name_t name; + * wasm_module_name(module, &name); + * + * // It works! + * wasmer_assert_name(&name, "moduleName"); + * + * // Free everything. + * wasm_byte_vec_delete(&name); + * wasm_module_delete(module); + * wasm_byte_vec_delete(&wasm); + * wasm_byte_vec_delete(&wat); + * wasm_store_delete(store); + * wasm_engine_delete(engine); + * + * return 0; + * } + * # }) + * # .success(); + * # } + * ``` + */ void wasm_module_name(const wasm_module_t *module, wasm_name_t *out); -bool wasm_module_set_name(wasm_module_t *module, wasm_name_t *name); +/** + * Non-standard Wasmer-specific API to set the module's name. The + * function returns `true` if the name has been updated, `false` + * otherwise. + * + * # Example + * + * ```rust + * # use inline_c::assert_c; + * # fn main() { + * # (assert_c! { + * # #include "tests/wasmer_wasm.h" + * # + * int main() { + * // Create the engine and the store. + * wasm_engine_t* engine = wasm_engine_new(); + * wasm_store_t* store = wasm_store_new(engine); + * + * // Create a WebAssembly module from a WAT definition. + * wasm_byte_vec_t wat; + * wasmer_byte_vec_new_from_string(&wat, "(module)"); + * wasm_byte_vec_t wasm; + * wat2wasm(&wat, &wasm); + * + * // Create the module. + * wasm_module_t* module = wasm_module_new(store, &wasm); + * + * // Read the module's name. There is none for the moment. + * { + * wasm_name_t name; + * wasm_module_name(module, &name); + * + * assert(name.size == 0); + * } + * + * // So, let's set a new name. + * { + * wasm_name_t name; + * wasmer_byte_vec_new_from_string(&name, "hello"); + * wasm_module_set_name(module, &name); + * } + * + * // And now, let's see the new name. + * { + * wasm_name_t name; + * wasm_module_name(module, &name); + * + * // It works! + * wasmer_assert_name(&name, "hello"); + * + * wasm_byte_vec_delete(&name); + * } + * + * // Free everything. + * wasm_module_delete(module); + * wasm_byte_vec_delete(&wasm); + * wasm_byte_vec_delete(&wat); + * wasm_store_delete(store); + * wasm_engine_delete(engine); + * + * return 0; + * } + * # }) + * # .success(); + * # } + * ``` + */ +bool wasm_module_set_name(wasm_module_t *module, const wasm_name_t *name); /** * Gets the length in bytes of the last error if any, zero otherwise. diff --git a/lib/middlewares/Cargo.toml b/lib/middlewares/Cargo.toml index 01eec6c69fc..bef51a44103 100644 --- a/lib/middlewares/Cargo.toml +++ b/lib/middlewares/Cargo.toml @@ -3,7 +3,7 @@ name = "wasmer-middlewares" version = "1.0.0-beta2" authors = ["Wasmer Engineering Team "] description = "A collection of various useful middlewares" -license = "(Apache-2.0 WITH LLVM-exception) or MIT" +license = "MIT OR Apache-2.0 WITH LLVM-exception" categories = ["wasm"] keywords = ["webassembly", "wasm"] repository = "https://github.com/wasmerio/wasmer" diff --git a/scripts/publish.py b/scripts/publish.py index a7f6259dfad..1419459dc79 100644 --- a/scripts/publish.py +++ b/scripts/publish.py @@ -74,6 +74,7 @@ "wasmer-emscripten": "emscripten", "wasmer-wasi-experimental-io-devices": "wasi-experimental-io-devices", "wasmer-c-api": "c-api", + "wasmer-middlewares": "middlewares", } no_dry_run = False