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:
Bastian Köcher
2019-07-05 15:02:14 +02:00
committed by GitHub
parent 22ec13cf65
commit 0ed2b26c96
8 changed files with 12 additions and 20 deletions
+5 -13
View File
@@ -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() {