Skip to content

Commit

Permalink
sc-meta install wasm32 target
Browse files Browse the repository at this point in the history
  • Loading branch information
laurci committed Apr 5, 2024
1 parent 605aa85 commit 2b6f7a7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
6 changes: 6 additions & 0 deletions framework/meta/src/cli_args/cli_args_standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -315,3 +318,6 @@ pub struct InstallMxScenarioGoArgs {
#[arg(long, verbatim_doc_comment)]
pub tag: Option<String>,
}

#[derive(Default, Clone, PartialEq, Eq, Debug, Args)]
pub struct InstallWasm32Args {}
9 changes: 8 additions & 1 deletion framework/meta/src/cmd/standalone/install.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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();
}
12 changes: 12 additions & 0 deletions framework/meta/src/cmd/standalone/install/install_wasm32.rs
Original file line number Diff line number Diff line change
@@ -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");
}

0 comments on commit 2b6f7a7

Please sign in to comment.