diff --git a/rust-bins/xtask/src/main.rs b/rust-bins/xtask/src/main.rs index ed7c83bc394e48f4e52bb113f1c20b9e25eb3651..ad20790ad475129c3a74751b1cbc37481889ba98 100644 --- a/rust-bins/xtask/src/main.rs +++ b/rust-bins/xtask/src/main.rs @@ -14,7 +14,7 @@ // along with this program. If not, see <https://www.gnu.org/licenses/>. use anyhow::Result; -use std::process::{Command, Output}; +use std::process::{Command, Output, Stdio}; use structopt::StructOpt; use version_compare::Version; @@ -101,7 +101,7 @@ fn exec_and_get_stdout(command: &mut Command) -> Result<String> { } fn exec_should_success(command: &mut Command) -> Result<()> { - if !command.status()?.success() { + if !command.stdout(Stdio::piped()).status()?.success() { std::process::exit(1); } else { Ok(()) @@ -109,27 +109,33 @@ fn exec_should_success(command: &mut Command) -> Result<()> { } fn build(skip_npm: bool, production: bool) -> Result<()> { + println!("skip npm ? {}", skip_npm); if !skip_npm { - exec_should_success(Command::new("npm").args(&["add", "duniter-ui"]))?; + println!("npm add duniter-ui"); + exec_should_success(Command::new("C:\\Program Files\\nodejs\\npm.cmd").args(&["add", "duniter-ui"]))?; + println!("npm ci"); exec_should_success( - Command::new("npm") - .env("NEON_BUILD_RELEASE", "true") + Command::new("C:\\Program Files\\nodejs\\npm.cmd") + // .env("PATH", "true") .arg("ci"), )?; if production { - exec_should_success(Command::new("npm").args(&["prune", "--production"]))?; + println!("npm prune --production"); + exec_should_success(Command::new("C:\\Program Files\\nodejs\\npm.cmd").args(&["prune", "--production"]))?; } } println!("Build duniter-cli …"); exec_should_success(Command::new("cargo").args(&["build", "--release"]))?; - std::fs::copy("target/release/duniter", "bin/duniter")?; + println!("Copy final binary to bin/duniter"); + std::fs::copy("target/release/duniter.exe", "bin/duniter")?; + println!("Build success."); Ok(()) } fn test(skip_npm: bool) -> Result<()> { exec_should_success(Command::new("cargo").args(&["test", "--all"]))?; if !skip_npm { - exec_should_success(Command::new("npm").arg("test"))?; + exec_should_success(Command::new("C:\\Program Files\\nodejs\\npm.cmd").arg("test"))?; } Ok(()) }