mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 13:31:10 +00:00
wasm-builder: allow default cargo nightly (#3195)
* wasm-builder: use default cargo command if nightly is default toolchain * wasm-builder: use get_nightly_cargo in prereq check * wasm-builder: fix check_nightly_installed * wasm-builder: add cargo command builder struct * wasm-builder: remove unnecessary stuff * wasm-builder: just use Strings
This commit is contained in:
committed by
Bastian Köcher
parent
f7ff339ebd
commit
407970406d
@@ -44,21 +44,8 @@ pub fn check() -> Option<&'static str> {
|
||||
}
|
||||
|
||||
fn check_nightly_installed() -> bool {
|
||||
let version = Command::new("cargo")
|
||||
.arg("--version")
|
||||
.output()
|
||||
.map_err(|_| ())
|
||||
.and_then(|o| String::from_utf8(o.stdout).map_err(|_| ()))
|
||||
.unwrap_or_default();
|
||||
|
||||
let version2 = Command::new("rustup")
|
||||
.args(&["run", "nightly", "cargo", "--version"])
|
||||
.output()
|
||||
.map_err(|_| ())
|
||||
.and_then(|o| String::from_utf8(o.stdout).map_err(|_| ()))
|
||||
.unwrap_or_default();
|
||||
|
||||
version.contains("-nightly") || version2.contains("-nightly")
|
||||
let command = crate::get_nightly_cargo();
|
||||
command.is_nightly()
|
||||
}
|
||||
|
||||
fn check_wasm_toolchain_installed() -> bool {
|
||||
@@ -87,10 +74,11 @@ fn check_wasm_toolchain_installed() -> bool {
|
||||
|
||||
let manifest_path = manifest_path.display().to_string();
|
||||
crate::get_nightly_cargo()
|
||||
.command()
|
||||
.args(&["build", "--target=wasm32-unknown-unknown", "--manifest-path", &manifest_path])
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::null())
|
||||
.status()
|
||||
.map(|s| s.success())
|
||||
.unwrap_or(false)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user