diff --git a/framework/meta/src/cli_args/cli_args_standalone.rs b/framework/meta/src/cli_args/cli_args_standalone.rs index 2f6c435e9c..02b5ac9f24 100644 --- a/framework/meta/src/cli_args/cli_args_standalone.rs +++ b/framework/meta/src/cli_args/cli_args_standalone.rs @@ -307,6 +307,9 @@ pub enum InstallCommand { #[command(about = "Installs the `mx-scenario-go` tool")] MxScenarioGo(InstallMxScenarioGoArgs), + + #[command(name = "wasm32", about = "Installs the `wasm32` target")] + Wasm32(InstallWasm32Args), } #[derive(Default, Clone, PartialEq, Eq, Debug, Args)] @@ -315,3 +318,6 @@ pub struct InstallMxScenarioGoArgs { #[arg(long, verbatim_doc_comment)] pub tag: Option, } + +#[derive(Default, Clone, PartialEq, Eq, Debug, Args)] +pub struct InstallWasm32Args {} diff --git a/framework/meta/src/cmd/standalone/install.rs b/framework/meta/src/cmd/standalone/install.rs index e96f23ad70..2c2befef95 100644 --- a/framework/meta/src/cmd/standalone/install.rs +++ b/framework/meta/src/cmd/standalone/install.rs @@ -1,7 +1,8 @@ mod install_scenario_go; +mod install_wasm32; mod system_info; -use crate::cli_args::{InstallArgs, InstallCommand, InstallMxScenarioGoArgs}; +use crate::cli_args::{InstallArgs, InstallCommand, InstallMxScenarioGoArgs, InstallWasm32Args}; use self::install_scenario_go::ScenarioGoInstaller; @@ -14,11 +15,17 @@ pub fn install(args: &InstallArgs) { match command { InstallCommand::All => { install_scenario_go(&InstallMxScenarioGoArgs::default()); + install_wasm32(&InstallWasm32Args::default()); }, InstallCommand::MxScenarioGo(sg_args) => install_scenario_go(sg_args), + InstallCommand::Wasm32(wam32_args) => install_wasm32(wam32_args), } } fn install_scenario_go(sg_args: &InstallMxScenarioGoArgs) { ScenarioGoInstaller::new(sg_args.tag.clone()).install(); } + +fn install_wasm32(_wasm32_args: &InstallWasm32Args) { + install_wasm32::install_wasm32_target(); +} diff --git a/framework/meta/src/cmd/standalone/install/install_wasm32.rs b/framework/meta/src/cmd/standalone/install/install_wasm32.rs new file mode 100644 index 0000000000..dbe6cc5eb7 --- /dev/null +++ b/framework/meta/src/cmd/standalone/install/install_wasm32.rs @@ -0,0 +1,12 @@ +use std::process::Command; + +pub fn install_wasm32_target() { + let cmd = Command::new("rustup") + .args(vec!["target", "add", "wasm32-unknown-unknown"]) + .status() + .expect("failed to execute `rustup`"); + + assert!(cmd.success(), "failed to install wasm32 target"); + + println!("wasm32 target installed successfully"); +}