mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-23 20:11:06 +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:
Generated
+8
-8
@@ -2326,7 +2326,7 @@ dependencies = [
|
|||||||
"substrate-keyring 2.0.0",
|
"substrate-keyring 2.0.0",
|
||||||
"substrate-offchain-primitives 2.0.0",
|
"substrate-offchain-primitives 2.0.0",
|
||||||
"substrate-primitives 2.0.0",
|
"substrate-primitives 2.0.0",
|
||||||
"substrate-wasm-builder-runner 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"substrate-wasm-builder-runner 1.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2380,7 +2380,7 @@ dependencies = [
|
|||||||
"substrate-consensus-aura-primitives 2.0.0",
|
"substrate-consensus-aura-primitives 2.0.0",
|
||||||
"substrate-offchain-primitives 2.0.0",
|
"substrate-offchain-primitives 2.0.0",
|
||||||
"substrate-primitives 2.0.0",
|
"substrate-primitives 2.0.0",
|
||||||
"substrate-wasm-builder-runner 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"substrate-wasm-builder-runner 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4609,7 +4609,7 @@ dependencies = [
|
|||||||
"sr-sandbox 2.0.0",
|
"sr-sandbox 2.0.0",
|
||||||
"sr-std 2.0.0",
|
"sr-std 2.0.0",
|
||||||
"substrate-primitives 2.0.0",
|
"substrate-primitives 2.0.0",
|
||||||
"substrate-wasm-builder-runner 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"substrate-wasm-builder-runner 1.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4765,7 +4765,7 @@ dependencies = [
|
|||||||
"substrate-primitives 2.0.0",
|
"substrate-primitives 2.0.0",
|
||||||
"substrate-test-runtime-client 2.0.0",
|
"substrate-test-runtime-client 2.0.0",
|
||||||
"substrate-trie 2.0.0",
|
"substrate-trie 2.0.0",
|
||||||
"substrate-wasm-builder-runner 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"substrate-wasm-builder-runner 1.0.1",
|
||||||
"trie-db 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"trie-db 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -4833,7 +4833,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "substrate-wasm-builder"
|
name = "substrate-wasm-builder"
|
||||||
version = "1.0.1"
|
version = "1.0.2"
|
||||||
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)",
|
||||||
@@ -4845,11 +4845,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "substrate-wasm-builder-runner"
|
name = "substrate-wasm-builder-runner"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "substrate-wasm-builder-runner"
|
name = "substrate-wasm-builder-runner"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6171,7 +6171,7 @@ dependencies = [
|
|||||||
"checksum strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1810e25f576e7ffce1ff5243b37066da5ded0310b3274c20baaeccb1145b2806"
|
"checksum strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1810e25f576e7ffce1ff5243b37066da5ded0310b3274c20baaeccb1145b2806"
|
||||||
"checksum strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "572a2f4e53dd4c3483fd79e5cc10ddd773a3acb1169bbfe8762365e107110579"
|
"checksum strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "572a2f4e53dd4c3483fd79e5cc10ddd773a3acb1169bbfe8762365e107110579"
|
||||||
"checksum substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)" = "<none>"
|
"checksum substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)" = "<none>"
|
||||||
"checksum substrate-wasm-builder-runner 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3533b62b476e5058947b9509038f9d5a72f7363a54a088821329fa76b990a485"
|
"checksum substrate-wasm-builder-runner 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "131fa5f29b2a2e459f226411e4718ecda62e360123b7cfd76ae6a7da5bcaeb0d"
|
||||||
"checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee"
|
"checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee"
|
||||||
"checksum subtle 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "01dca13cf6c3b179864ab3292bd794e757618d35a7766b7c46050c614ba00829"
|
"checksum subtle 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "01dca13cf6c3b179864ab3292bd794e757618d35a7766b7c46050c614ba00829"
|
||||||
"checksum syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d960b829a55e56db167e861ddb43602c003c7be0bee1d345021703fac2fb7c"
|
"checksum syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d960b829a55e56db167e861ddb43602c003c7be0bee1d345021703fac2fb7c"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ sandbox = { package = "sr-sandbox", path = "../../sr-sandbox", default-features
|
|||||||
substrate-primitives = { path = "../../primitives", default-features = false }
|
substrate-primitives = { path = "../../primitives", default-features = false }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.0" }
|
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.1", path = "../../utils/wasm-builder-runner" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = [ "std" ]
|
default = [ "std" ]
|
||||||
|
|||||||
@@ -17,5 +17,11 @@
|
|||||||
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.1"));
|
build_current_project(
|
||||||
|
"wasm_binary.rs",
|
||||||
|
WasmBuilderSource::CratesOrPath {
|
||||||
|
path: "../../utils/wasm-builder",
|
||||||
|
version: "1.0.2",
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ substrate-executor = { path = "../executor" }
|
|||||||
substrate-test-runtime-client = { path = "./client" }
|
substrate-test-runtime-client = { path = "./client" }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.0" }
|
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.1", path = "../utils/wasm-builder-runner" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = [
|
default = [
|
||||||
|
|||||||
@@ -17,5 +17,11 @@
|
|||||||
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.1"));
|
build_current_project(
|
||||||
|
"wasm_binary.rs",
|
||||||
|
WasmBuilderSource::CratesOrPath {
|
||||||
|
path: "../utils/wasm-builder",
|
||||||
|
version: "1.0.2",
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "substrate-wasm-builder-runner"
|
name = "substrate-wasm-builder-runner"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
description = "Runner for substrate-wasm-builder"
|
description = "Runner for substrate-wasm-builder"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
//!
|
//!
|
||||||
//! For more information see <https://crates.io/substrate-wasm-builder>
|
//! For more information see <https://crates.io/substrate-wasm-builder>
|
||||||
|
|
||||||
use std::{env, process::Command, fs, path::{PathBuf, Path}};
|
use std::{env, process::{Command, self}, fs, path::{PathBuf, Path}};
|
||||||
|
|
||||||
/// Environment variable that tells us to skip building the WASM binary.
|
/// Environment variable that tells us to skip building the WASM binary.
|
||||||
const SKIP_BUILD_ENV: &str = "SKIP_WASM_BUILD";
|
const SKIP_BUILD_ENV: &str = "SKIP_WASM_BUILD";
|
||||||
@@ -56,8 +56,13 @@ pub enum WasmBuilderSource {
|
|||||||
repo: &'static str,
|
repo: &'static str,
|
||||||
rev: &'static str,
|
rev: &'static str,
|
||||||
},
|
},
|
||||||
/// Use the given version released on crates.io
|
/// Use the given version released on crates.io.
|
||||||
Crates(&'static str),
|
Crates(&'static str),
|
||||||
|
/// Use the given version released on crates.io or from the given path.
|
||||||
|
CratesOrPath {
|
||||||
|
version: &'static str,
|
||||||
|
path: &'static str,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WasmBuilderSource {
|
impl WasmBuilderSource {
|
||||||
@@ -75,6 +80,15 @@ impl WasmBuilderSource {
|
|||||||
WasmBuilderSource::Crates(version) => {
|
WasmBuilderSource::Crates(version) => {
|
||||||
format!("version = \"{}\"", version)
|
format!("version = \"{}\"", version)
|
||||||
}
|
}
|
||||||
|
WasmBuilderSource::CratesOrPath { version, path } => {
|
||||||
|
replace_back_slashes(
|
||||||
|
format!(
|
||||||
|
"path = \"{}\", version = \"{}\"",
|
||||||
|
manifest_dir.join(path).display(),
|
||||||
|
version
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,9 +101,9 @@ impl WasmBuilderSource {
|
|||||||
/// constant `WASM_BINARY` which contains the build wasm binary.
|
/// constant `WASM_BINARY` which contains the build wasm binary.
|
||||||
/// `wasm_builder_path` - Path to the wasm-builder project, relative to `CARGO_MANIFEST_DIR`.
|
/// `wasm_builder_path` - Path to the wasm-builder project, relative to `CARGO_MANIFEST_DIR`.
|
||||||
pub fn build_current_project(file_name: &str, wasm_builder_source: WasmBuilderSource) {
|
pub fn build_current_project(file_name: &str, wasm_builder_source: WasmBuilderSource) {
|
||||||
generate_rerun_if_changed_instructions();
|
|
||||||
|
|
||||||
if check_skip_build() {
|
if check_skip_build() {
|
||||||
|
// If we skip the build, we still want to make sure to be called when an env variable changes
|
||||||
|
generate_rerun_if_changed_instructions();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,6 +124,10 @@ pub fn build_current_project(file_name: &str, wasm_builder_source: WasmBuilderSo
|
|||||||
create_project(&project_folder, &file_path, &manifest_dir, wasm_builder_source, &cargo_toml_path);
|
create_project(&project_folder, &file_path, &manifest_dir, wasm_builder_source, &cargo_toml_path);
|
||||||
run_project(&project_folder);
|
run_project(&project_folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// As last step we need to generate our `rerun-if-changed` stuff. If a build fails, we don't
|
||||||
|
// want to spam the output!
|
||||||
|
generate_rerun_if_changed_instructions();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_project(
|
fn create_project(
|
||||||
@@ -164,7 +182,8 @@ fn run_project(project_folder: &Path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !cmd.status().map(|s| s.success()).unwrap_or(false) {
|
if !cmd.status().map(|s| s.success()).unwrap_or(false) {
|
||||||
panic!("Running WASM build runner failed!");
|
// Don't spam the output with backtraces when a build failed!
|
||||||
|
process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "substrate-wasm-builder"
|
name = "substrate-wasm-builder"
|
||||||
version = "1.0.1"
|
version = "1.0.2"
|
||||||
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};
|
use std::{env, fs, path::PathBuf, process::{Command, Stdio}};
|
||||||
|
|
||||||
mod prerequisites;
|
mod prerequisites;
|
||||||
mod wasm_project;
|
mod wasm_project;
|
||||||
@@ -156,8 +156,12 @@ fn create_out_file(file_name: &str, content: String) {
|
|||||||
|
|
||||||
/// Get a cargo command that compiles with nightly
|
/// Get a cargo command that compiles with nightly
|
||||||
fn get_nightly_cargo() -> Command {
|
fn get_nightly_cargo() -> Command {
|
||||||
if Command::new("rustup").args(&["run", "nightly", "cargo"])
|
if Command::new("rustup")
|
||||||
.status().map(|s| s.success()).unwrap_or(false)
|
.args(&["run", "nightly", "cargo"])
|
||||||
|
.stdout(Stdio::null())
|
||||||
|
.stderr(Stdio::null())
|
||||||
|
.status()
|
||||||
|
.map(|s| s.success()).unwrap_or(false)
|
||||||
{
|
{
|
||||||
let mut cmd = Command::new("rustup");
|
let mut cmd = Command::new("rustup");
|
||||||
cmd.args(&["run", "nightly", "cargo"]);
|
cmd.args(&["run", "nightly", "cargo"]);
|
||||||
|
|||||||
@@ -27,7 +27,12 @@ pub fn check() -> Option<&'static str> {
|
|||||||
return Some("Rust nightly not installed, please install it!")
|
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!")
|
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();
|
let manifest_path = manifest_path.display().to_string();
|
||||||
crate::get_nightly_cargo()
|
crate::get_nightly_cargo()
|
||||||
.args(&["build", "--target=wasm32-unknown-unknown", "--manifest-path", &manifest_path])
|
.args(&["build", "--target=wasm32-unknown-unknown", "--manifest-path", &manifest_path])
|
||||||
|
.stdout(Stdio::null())
|
||||||
|
.stderr(Stdio::null())
|
||||||
.status()
|
.status()
|
||||||
.map(|s| s.success())
|
.map(|s| s.success())
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
// 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;
|
use toml::value::Table;
|
||||||
|
|
||||||
@@ -266,7 +266,8 @@ fn build_project(project: &Path) {
|
|||||||
|
|
||||||
match build_cmd.status().map(|s| s.success()) {
|
match build_cmd.status().map(|s| s.success()) {
|
||||||
Ok(true) => {},
|
Ok(true) => {},
|
||||||
_ => panic!("Failed to compile WASM binary"),
|
// Use `process.exit(1)` to have a clean error output.
|
||||||
|
_ => process::exit(1),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ consensus-aura = { package = "substrate-consensus-aura-primitives", path = "../.
|
|||||||
offchain-primitives = { package = "substrate-offchain-primitives", path = "../../core/offchain/primitives", default-features = false }
|
offchain-primitives = { package = "substrate-offchain-primitives", path = "../../core/offchain/primitives", default-features = false }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.0" }
|
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.1" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
|
|||||||
@@ -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.1"));
|
build_current_project("wasm_binary.rs", WasmBuilderSource::Crates("1.0.2"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ serde = { version = "1.0", optional = true }
|
|||||||
substrate-keyring = { path = "../../core/keyring", optional = true }
|
substrate-keyring = { path = "../../core/keyring", optional = true }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.0" }
|
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.1", path = "../../core/utils/wasm-builder-runner" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ use wasm_builder_runner::{build_current_project, WasmBuilderSource};
|
|||||||
fn main() {
|
fn main() {
|
||||||
build_current_project(
|
build_current_project(
|
||||||
"wasm_binary.rs",
|
"wasm_binary.rs",
|
||||||
WasmBuilderSource::Crates("1.0.1"),
|
WasmBuilderSource::CratesOrPath {
|
||||||
|
path: "../../core/utils/wasm-builder",
|
||||||
|
version: "1.0.2",
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user