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

Re-introduce create-exe to wasmer-cli v3.0 #3038

Merged
merged 3 commits into from
Jul 29, 2022
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
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions lib/api/src/js/module_info_polyfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ impl ModuleInfoPolyfill {
field: &str,
) -> WasmResult<()> {
self.info.imports.insert(
(
String::from(module),
String::from(field),
self.info.imports.len() as u32,
),
wasmer_types::ImportKey {
module: String::from(module),
field: String::from(field),
import_idx: self.info.imports.len() as u32,
},
import,
);
Ok(())
Expand Down
10 changes: 9 additions & 1 deletion lib/c-api/src/wasm_c_api/wasi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

pub use super::unstable::wasi::wasi_get_unordered_imports;
use super::{
externals::{wasm_extern_t, wasm_extern_vec_t, wasm_func_t},
externals::{wasm_extern_t, wasm_extern_vec_t, wasm_func_t, wasm_memory_t},
instance::wasm_instance_t,
module::wasm_module_t,
store::{wasm_store_t, StoreRef},
Expand Down Expand Up @@ -197,6 +197,14 @@ pub unsafe extern "C" fn wasi_env_new(
#[no_mangle]
pub extern "C" fn wasi_env_delete(_state: Option<Box<wasi_env_t>>) {}

/// Set the memory on a [`wasi_env_t`].
#[no_mangle]
pub unsafe extern "C" fn wasi_env_set_memory(env: &mut wasi_env_t, memory: &wasm_memory_t) {
let mut store_mut = env.store.store_mut();
let wasi_env = env.inner.data_mut(&mut store_mut);
wasi_env.set_memory(memory.extern_.memory());
}

#[no_mangle]
pub unsafe extern "C" fn wasi_env_read_stdout(
env: &mut wasi_env_t,
Expand Down
1 change: 1 addition & 0 deletions lib/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ wasmer-wast = { version = "=2.3.0", path = "../../tests/lib/wast", optional = tr
wasmer-cache = { version = "=2.3.0", path = "../cache", optional = true }
wasmer-types = { version = "=2.3.0", path = "../types" }
wasmer-vfs = { version = "=2.3.0", path = "../vfs", default-features = false, features = ["host-fs"] }
wasmer-object = { version = "=2.3.0", path = "../object" }
atty = "0.2"
colored = "2.0"
anyhow = "1.0"
Expand Down
9 changes: 9 additions & 0 deletions lib/cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
use crate::commands::Binfmt;
#[cfg(feature = "compiler")]
use crate::commands::Compile;
#[cfg(feature = "compiler")]
use crate::commands::CreateExe;
#[cfg(feature = "wast")]
use crate::commands::Wast;
use crate::commands::{Cache, Config, Inspect, Run, SelfUpdate, Validate};
Expand Down Expand Up @@ -44,6 +46,11 @@ enum WasmerCLIOptions {
#[structopt(name = "compile")]
Compile(Compile),

/// Compile a WebAssembly binary into a native executable
#[cfg(feature = "compiler")]
#[structopt(name = "create-exe")]
CreateExe(CreateExe),

/// Get various configuration information needed
/// to compile programs which use Wasmer
#[structopt(name = "config")]
Expand Down Expand Up @@ -77,6 +84,8 @@ impl WasmerCLIOptions {
Self::Validate(validate) => validate.execute(),
#[cfg(feature = "compiler")]
Self::Compile(compile) => compile.execute(),
#[cfg(feature = "compiler")]
Self::CreateExe(create_exe) => create_exe.execute(),
Self::Config(config) => config.execute(),
Self::Inspect(inspect) => inspect.execute(),
#[cfg(feature = "wast")]
Expand Down
4 changes: 4 additions & 0 deletions lib/cli/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ mod cache;
#[cfg(feature = "compiler")]
mod compile;
mod config;
#[cfg(feature = "compiler")]
mod create_exe;
mod inspect;
mod run;
mod self_update;
Expand All @@ -16,6 +18,8 @@ mod wast;
pub use binfmt::*;
#[cfg(feature = "compiler")]
pub use compile::*;
#[cfg(feature = "compiler")]
pub use create_exe::*;
#[cfg(feature = "wast")]
pub use wast::*;
pub use {cache::*, config::*, inspect::*, run::*, self_update::*, validate::*};
Loading