mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-23 21:15:41 +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:
Generated
+1
-1
@@ -4832,7 +4832,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "substrate-wasm-builder"
|
name = "substrate-wasm-builder"
|
||||||
version = "1.0.2"
|
version = "1.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"build-helper 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"build-helper 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cargo_metadata 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cargo_metadata 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ fn main() {
|
|||||||
"wasm_binary.rs",
|
"wasm_binary.rs",
|
||||||
WasmBuilderSource::CratesOrPath {
|
WasmBuilderSource::CratesOrPath {
|
||||||
path: "../../utils/wasm-builder",
|
path: "../../utils/wasm-builder",
|
||||||
version: "1.0.2",
|
version: "1.0.3",
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ fn main() {
|
|||||||
"wasm_binary.rs",
|
"wasm_binary.rs",
|
||||||
WasmBuilderSource::CratesOrPath {
|
WasmBuilderSource::CratesOrPath {
|
||||||
path: "../utils/wasm-builder",
|
path: "../utils/wasm-builder",
|
||||||
version: "1.0.2",
|
version: "1.0.3",
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "substrate-wasm-builder"
|
name = "substrate-wasm-builder"
|
||||||
version = "1.0.2"
|
version = "1.0.3"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
description = "Utility for building WASM binaries"
|
description = "Utility for building WASM binaries"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
//! - wasm-gc
|
//! - wasm-gc
|
||||||
//!
|
//!
|
||||||
|
|
||||||
use std::{env, fs, path::PathBuf, process::{Command, Stdio}};
|
use std::{env, fs, path::PathBuf, process::{Command, Stdio, self}};
|
||||||
|
|
||||||
mod prerequisites;
|
mod prerequisites;
|
||||||
mod wasm_project;
|
mod wasm_project;
|
||||||
@@ -107,24 +107,16 @@ pub fn build_project(file_name: &str, cargo_manifest: &str) {
|
|||||||
let cargo_manifest = PathBuf::from(cargo_manifest);
|
let cargo_manifest = PathBuf::from(cargo_manifest);
|
||||||
|
|
||||||
if !cargo_manifest.exists() {
|
if !cargo_manifest.exists() {
|
||||||
create_out_file(
|
panic!("'{}' does not exist!", cargo_manifest.display());
|
||||||
file_name,
|
|
||||||
format!("compile_error!(\"'{}' does not exists!\")", cargo_manifest.display())
|
|
||||||
);
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cargo_manifest.ends_with("Cargo.toml") {
|
if !cargo_manifest.ends_with("Cargo.toml") {
|
||||||
create_out_file(
|
panic!("'{}' no valid path to a `Cargo.toml`!", cargo_manifest.display());
|
||||||
file_name,
|
|
||||||
format!("compile_error!(\"'{}' no valid path to a `Cargo.toml`!\")", cargo_manifest.display())
|
|
||||||
);
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(err_msg) = prerequisites::check() {
|
if let Some(err_msg) = prerequisites::check() {
|
||||||
create_out_file(file_name, format!("compile_error!(\"{}\");", err_msg));
|
eprintln!("{}", err_msg);
|
||||||
return
|
process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
let (wasm_binary, bloaty) = wasm_project::create_and_compile(&cargo_manifest);
|
let (wasm_binary, bloaty) = wasm_project::create_and_compile(&cargo_manifest);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ pub fn check() -> Option<&'static str> {
|
|||||||
.status()
|
.status()
|
||||||
.map(|s| !s.success()).unwrap_or(true)
|
.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() {
|
if !check_wasm_toolchain_installed() {
|
||||||
|
|||||||
@@ -17,5 +17,5 @@
|
|||||||
use wasm_builder_runner::{build_current_project, WasmBuilderSource};
|
use wasm_builder_runner::{build_current_project, WasmBuilderSource};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
build_current_project("wasm_binary.rs", WasmBuilderSource::Crates("1.0.2"));
|
build_current_project("wasm_binary.rs", WasmBuilderSource::Crates("1.0.3"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ fn main() {
|
|||||||
"wasm_binary.rs",
|
"wasm_binary.rs",
|
||||||
WasmBuilderSource::CratesOrPath {
|
WasmBuilderSource::CratesOrPath {
|
||||||
path: "../../core/utils/wasm-builder",
|
path: "../../core/utils/wasm-builder",
|
||||||
version: "1.0.2",
|
version: "1.0.3",
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user