diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 00000000000..f992c78e168 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,17 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 365 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 30 +# Issues with these labels will never be considered stale +exemptLabels: + - "🐞 bug" +# Label to use when marking an issue as stale +staleLabel: "🏚 stale" +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: > + Feel free to reopen the issue if it has been closed by mistake. diff --git a/Makefile b/Makefile index 999928aa84e..3cd96fb15a6 100644 --- a/Makefile +++ b/Makefile @@ -329,9 +329,25 @@ $(info --------------) $(info ) $(info ) -############ -# Building # -############ +##### +# +# Configure `sed -i` for a cross-platform usage. +# +##### + +SEDI ?= + +ifeq ($(IS_DARWIN), 1) + SEDI := "-i ''" +else ifeq ($(IS_LINUX), 1) + SEDI := "-i" +endif + +##### +# +# Building. +# +##### # Not really "all", just the default target that builds enough so make # install will go through. @@ -363,13 +379,11 @@ build-wasmer-headless-minimal: RUSTFLAGS="${RUSTFLAGS}" xargo build --target $(HOST_TARGET) --release --manifest-path=lib/cli/Cargo.toml --no-default-features --features headless-minimal --bin wasmer-headless ifeq ($(IS_DARWIN), 1) strip -u target/$(HOST_TARGET)/release/wasmer-headless -else -ifeq ($(IS_WINDOWS), 1) +else ifeq ($(IS_WINDOWS), 1) strip --strip-unneeded target/$(HOST_TARGET)/release/wasmer-headless.exe else strip --strip-unneeded target/$(HOST_TARGET)/release/wasmer-headless endif -endif WAPM_VERSION = v0.5.1 get-wapm: @@ -395,9 +409,9 @@ build-docs-capi: capi-setup # `wasmer-c-api` lib's name is `wasmer`. To avoid a conflict # when generating the documentation, we rename it to its # crate's name. Then we restore the lib's name. - sed -i '' -e 's/name = "wasmer" # ##lib.name##/name = "wasmer_c_api" # ##lib.name##/' lib/c-api/Cargo.toml + sed "$(SEDI)" -e 's/name = "wasmer" # ##lib.name##/name = "wasmer_c_api" # ##lib.name##/' lib/c-api/Cargo.toml RUSTFLAGS="${RUSTFLAGS}" cargo doc --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,universal,staticlib,dylib,cranelift,wasi - sed -i '' -e 's/name = "wasmer_c_api" # ##lib.name##/name = "wasmer" # ##lib.name##/' lib/c-api/Cargo.toml + sed "$(SEDI)" -e 's/name = "wasmer_c_api" # ##lib.name##/name = "wasmer" # ##lib.name##/' lib/c-api/Cargo.toml build-capi: capi-setup RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ @@ -469,10 +483,11 @@ build-capi-headless-all: capi-setup RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features universal,dylib,staticlib,wasi - -########### -# Testing # -########### +##### +# +# Testing. +# +##### test: test-compilers test-packages test-examples @@ -488,9 +503,12 @@ test-packages: test-js: cd lib/js-api && wasm-pack test --node -- --features=wat -######################## -# Testing (Compatible) # -######################## + +##### +# +# Testing compilers. +# +##### test-compilers-compat: $(foreach compiler,$(compilers),test-$(compiler)) @@ -541,9 +559,11 @@ test-examples: test-integration: cargo test -p wasmer-integration-tests-cli -############# -# Packaging # -############# +##### +# +# Packaging. +# +##### package-wapm: mkdir -p "package/bin" @@ -629,9 +649,11 @@ endif tar -C package -zcvf wasmer.tar.gz bin lib include LICENSE ATTRIBUTIONS mv wasmer.tar.gz dist/ -######################## -# (Distro-) Installing # -######################## +##### +# +# Installating (for Distros). +# +##### DESTDIR ?= /usr/local @@ -672,9 +694,11 @@ install-pkgconfig: install-wasmer-headless-minimal: install -Dm755 target/release/wasmer-headless $(DESTDIR)/bin/wasmer-headless -################# -# Miscellaneous # -################# +##### +# +# Miscellaneous. +# +##### # Updates the spectests from the repo update-testsuite: diff --git a/lib/api/Cargo.toml b/lib/api/Cargo.toml index 95926231340..4868f5ccd6d 100644 --- a/lib/api/Cargo.toml +++ b/lib/api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wasmer" version = "2.0.0" -description = "High-performant WebAssembly runtime" +description = "High-performance WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "runtime", "vm"] authors = ["Wasmer Engineering Team "] diff --git a/lib/c-api/CHANGELOG.md b/lib/c-api/CHANGELOG.md index 140e63793b7..e8a5bc5e429 100644 --- a/lib/c-api/CHANGELOG.md +++ b/lib/c-api/CHANGELOG.md @@ -11,6 +11,9 @@ Looking for changes to the Wasmer CLI and the Rust API? See our [Primary Changel ### Added - [#2449](https://github.com/wasmerio/wasmer/pull/2449) Configure `soname`, `install_name`, `out-implib`, etc. +### Changed +- [#2478](https://github.com/wasmerio/wasmer/pull/2478) Rename `traps` input to `wasm_instance_new()` to `trap`. + ### Fixed - [#2444](https://github.com/wasmerio/wasmer/pull/2444) Trap's messages are always null terminated. diff --git a/lib/c-api/examples/features.c b/lib/c-api/examples/features.c index b9f01258b5e..c42215d1eb1 100644 --- a/lib/c-api/examples/features.c +++ b/lib/c-api/examples/features.c @@ -40,8 +40,8 @@ int main(int argc, const char* argv[]) { printf("Instantiating module...\n"); wasm_extern_vec_t imports = WASM_EMPTY_VEC; - wasm_trap_t* traps = NULL; - wasm_instance_t* instance = wasm_instance_new(store, module, &imports,&traps); + wasm_trap_t* trap = NULL; + wasm_instance_t* instance = wasm_instance_new(store, module, &imports,&trap); if (!instance) { printf("> Error instantiating module!\n"); @@ -67,7 +67,7 @@ int main(int argc, const char* argv[]) { wasm_val_vec_t arguments_as_array = WASM_ARRAY_VEC(arguments); wasm_val_vec_t results_as_array = WASM_ARRAY_VEC(results); - wasm_trap_t* trap = wasm_func_call(swap, &arguments_as_array, &results_as_array); + trap = wasm_func_call(swap, &arguments_as_array, &results_as_array); if (trap != NULL) { printf("> Failed to call `swap`.\n"); diff --git a/lib/c-api/src/wasm_c_api/externals/mod.rs b/lib/c-api/src/wasm_c_api/externals/mod.rs index ca1cb279762..0a701db1c78 100644 --- a/lib/c-api/src/wasm_c_api/externals/mod.rs +++ b/lib/c-api/src/wasm_c_api/externals/mod.rs @@ -275,9 +275,9 @@ mod tests { assert(module); wasm_extern_vec_t imports = WASM_EMPTY_VEC; - wasm_trap_t* traps = NULL; + wasm_trap_t* trap = NULL; - wasm_instance_t* instance = wasm_instance_new(store, module, &imports, &traps); + wasm_instance_t* instance = wasm_instance_new(store, module, &imports, &trap); assert(instance); wasm_extern_vec_t exports; diff --git a/lib/c-api/src/wasm_c_api/instance.rs b/lib/c-api/src/wasm_c_api/instance.rs index 0774c6ae43a..67b11d3e7a6 100644 --- a/lib/c-api/src/wasm_c_api/instance.rs +++ b/lib/c-api/src/wasm_c_api/instance.rs @@ -25,7 +25,7 @@ pub struct wasm_instance_t { /// 2. Runtime errors that happen when running the module `start` /// function. /// -/// Failures are stored in the `traps` argument; the program doesn't +/// The failure is stored in the `trap` argument; the program doesn't /// panic. /// /// # Notes @@ -41,7 +41,7 @@ pub unsafe extern "C" fn wasm_instance_new( _store: Option<&wasm_store_t>, module: Option<&wasm_module_t>, imports: Option<&wasm_extern_vec_t>, - traps: *mut *mut wasm_trap_t, + trap: *mut *mut wasm_trap_t, ) -> Option> { let module = module?; let imports = imports?; @@ -67,8 +67,8 @@ pub unsafe extern "C" fn wasm_instance_new( } Err(InstantiationError::Start(runtime_error)) => { - let trap: Box = Box::new(runtime_error.into()); - *traps = Box::into_raw(trap); + let this_trap: Box = Box::new(runtime_error.into()); + *trap = Box::into_raw(this_trap); return None; } @@ -124,9 +124,9 @@ pub unsafe extern "C" fn wasm_instance_delete(_instance: Option Result<()> { let (store, _engine_type, _compiler_type) = self.store.get_store()?; let module_contents = std::fs::read(&self.path)?; + if !is_wasm(&module_contents) { + bail!("`wasmer validate` only validates WebAssembly files"); + } Module::validate(&store, &module_contents)?; eprintln!("Validation passed for `{}`.", self.path.display()); Ok(())