mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 11:38:01 +00:00
End build when wasm-builder does not find a prerequisite (#3030)
* End build when `wasm-builder` does not find a prerequisite Using `compile_error!` was a stupid idea by me, as rust would not re-execute the build.rs. * Increment the `wasm-builder` version * Update core/utils/wasm-builder/src/lib.rs Co-Authored-By: André Silva <andre.beat@gmail.com>
This commit is contained in:
@@ -78,7 +78,7 @@
|
||||
//! - wasm-gc
|
||||
//!
|
||||
|
||||
use std::{env, fs, path::PathBuf, process::{Command, Stdio}};
|
||||
use std::{env, fs, path::PathBuf, process::{Command, Stdio, self}};
|
||||
|
||||
mod prerequisites;
|
||||
mod wasm_project;
|
||||
@@ -107,24 +107,16 @@ pub fn build_project(file_name: &str, cargo_manifest: &str) {
|
||||
let cargo_manifest = PathBuf::from(cargo_manifest);
|
||||
|
||||
if !cargo_manifest.exists() {
|
||||
create_out_file(
|
||||
file_name,
|
||||
format!("compile_error!(\"'{}' does not exists!\")", cargo_manifest.display())
|
||||
);
|
||||
return
|
||||
panic!("'{}' does not exist!", cargo_manifest.display());
|
||||
}
|
||||
|
||||
if !cargo_manifest.ends_with("Cargo.toml") {
|
||||
create_out_file(
|
||||
file_name,
|
||||
format!("compile_error!(\"'{}' no valid path to a `Cargo.toml`!\")", cargo_manifest.display())
|
||||
);
|
||||
return
|
||||
panic!("'{}' no valid path to a `Cargo.toml`!", cargo_manifest.display());
|
||||
}
|
||||
|
||||
if let Some(err_msg) = prerequisites::check() {
|
||||
create_out_file(file_name, format!("compile_error!(\"{}\");", err_msg));
|
||||
return
|
||||
eprintln!("{}", err_msg);
|
||||
process::exit(1);
|
||||
}
|
||||
|
||||
let (wasm_binary, bloaty) = wasm_project::create_and_compile(&cargo_manifest);
|
||||
|
||||
@@ -33,7 +33,7 @@ pub fn check() -> Option<&'static str> {
|
||||
.status()
|
||||
.map(|s| !s.success()).unwrap_or(true)
|
||||
{
|
||||
return Some("wasm-gc not installed, please install it!")
|
||||
return Some("`wasm-gc` not installed, please install it!")
|
||||
}
|
||||
|
||||
if !check_wasm_toolchain_installed() {
|
||||
|
||||
Reference in New Issue
Block a user