mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 11:38:01 +00:00
Make wasm-builder less spammy (#3020)
* Don't clutter the output that much * Support building from `crates` or from `path` * Upgrade the versions * Update `Cargo.lock`
This commit is contained in:
@@ -78,7 +78,7 @@
|
||||
//! - wasm-gc
|
||||
//!
|
||||
|
||||
use std::{env, fs, path::PathBuf, process::Command};
|
||||
use std::{env, fs, path::PathBuf, process::{Command, Stdio}};
|
||||
|
||||
mod prerequisites;
|
||||
mod wasm_project;
|
||||
@@ -156,8 +156,12 @@ fn create_out_file(file_name: &str, content: String) {
|
||||
|
||||
/// Get a cargo command that compiles with nightly
|
||||
fn get_nightly_cargo() -> Command {
|
||||
if Command::new("rustup").args(&["run", "nightly", "cargo"])
|
||||
.status().map(|s| s.success()).unwrap_or(false)
|
||||
if Command::new("rustup")
|
||||
.args(&["run", "nightly", "cargo"])
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::null())
|
||||
.status()
|
||||
.map(|s| s.success()).unwrap_or(false)
|
||||
{
|
||||
let mut cmd = Command::new("rustup");
|
||||
cmd.args(&["run", "nightly", "cargo"]);
|
||||
|
||||
@@ -27,7 +27,12 @@ pub fn check() -> Option<&'static str> {
|
||||
return Some("Rust nightly not installed, please install it!")
|
||||
}
|
||||
|
||||
if Command::new("wasm-gc").stdout(Stdio::null()).status().map(|s| !s.success()).unwrap_or(true) {
|
||||
if Command::new("wasm-gc")
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::null())
|
||||
.status()
|
||||
.map(|s| !s.success()).unwrap_or(true)
|
||||
{
|
||||
return Some("wasm-gc not installed, please install it!")
|
||||
}
|
||||
|
||||
@@ -83,6 +88,8 @@ fn check_wasm_toolchain_installed() -> bool {
|
||||
let manifest_path = manifest_path.display().to_string();
|
||||
crate::get_nightly_cargo()
|
||||
.args(&["build", "--target=wasm32-unknown-unknown", "--manifest-path", &manifest_path])
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::null())
|
||||
.status()
|
||||
.map(|s| s.success())
|
||||
.unwrap_or(false)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::{fs, path::{Path, PathBuf}, borrow::ToOwned, process::Command, env};
|
||||
use std::{fs, path::{Path, PathBuf}, borrow::ToOwned, process::{Command, self}, env};
|
||||
|
||||
use toml::value::Table;
|
||||
|
||||
@@ -266,7 +266,8 @@ fn build_project(project: &Path) {
|
||||
|
||||
match build_cmd.status().map(|s| s.success()) {
|
||||
Ok(true) => {},
|
||||
_ => panic!("Failed to compile WASM binary"),
|
||||
// Use `process.exit(1)` to have a clean error output.
|
||||
_ => process::exit(1),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user