Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/executor/runtime-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn main() {
"wasm_binary.rs",
WasmBuilderSource::CratesOrPath {
path: "../../utils/wasm-builder",
version: "1.0.7",
version: "1.0.8",
},
// This instructs LLD to export __heap_base as a global variable, which is used by the
// external memory allocator.
Expand Down
2 changes: 1 addition & 1 deletion core/test-runtime/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn main() {
"wasm_binary.rs",
WasmBuilderSource::CratesOrPath {
path: "../utils/wasm-builder",
version: "1.0.7",
version: "1.0.8",
},
// Note that we set the stack-size to 1MB explicitly even though it is set
// to this value by default. This is because some of our tests (`restoration_of_globals`)
Expand Down
2 changes: 1 addition & 1 deletion core/utils/wasm-builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "substrate-wasm-builder"
version = "1.0.7"
version = "1.0.8"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Utility for building WASM binaries"
edition = "2018"
Expand Down
23 changes: 13 additions & 10 deletions core/utils/wasm-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,7 @@ impl CargoCommand {
}

fn args(&mut self, args: &[&str]) -> &mut Self {
for arg in args {
self.arg(arg);
}
args.into_iter().for_each(|a| { self.arg(a); });
self
}

Expand All @@ -227,12 +225,17 @@ impl CargoCommand {

/// Check if the supplied cargo command is a nightly version
fn is_nightly(&self) -> bool {
self.command()
.arg("--version")
.output()
.map_err(|_| ())
.and_then(|o| String::from_utf8(o.stdout).map_err(|_| ()))
.unwrap_or_default()
.contains("-nightly")
// `RUSTC_BOOTSTRAP` tells a stable compiler to behave like a nightly. So, when this env
// variable is set, we can assume that whatever rust compiler we have, it is a nightly compiler.
// For "more" information, see:
// https://github.com/rust-lang/rust/blob/fa0f7d0080d8e7e9eb20aa9cbf8013f96c81287f/src/libsyntax/feature_gate/check.rs#L891
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line width check is complaining about this line 😓.

env::var("RUSTC_BOOTSTRAP").is_ok() ||
self.command()
.arg("--version")
.output()
.map_err(|_| ())
.and_then(|o| String::from_utf8(o.stdout).map_err(|_| ()))
.unwrap_or_default()
.contains("-nightly")
}
}
12 changes: 4 additions & 8 deletions core/utils/wasm-builder/src/prerequisites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,24 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

use std::{env, fs};
use std::fs;

use tempfile::tempdir;

/// Checks that all prerequisites are installed.
///
/// # Returns
/// Returns `None` if everything was found and `Some(ERR_MSG)` if something could not be found.
pub fn check() -> Option<&'static str> {
if !rustc_stable_forced_to_nightly() && !check_nightly_installed(){
if !check_nightly_installed(){
return Some("Rust nightly not installed, please install it!")
}

check_wasm_toolchain_installed()
}

fn rustc_stable_forced_to_nightly() -> bool {
env::var("RUSTC_BOOTSTRAP") == Ok("1".to_string())
}

fn check_nightly_installed() -> bool {
let command = crate::get_nightly_cargo();
command.is_nightly()
crate::get_nightly_cargo().is_nightly()
}

fn check_wasm_toolchain_installed() -> Option<&'static str> {
Expand Down
2 changes: 1 addition & 1 deletion node-template/runtime/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use wasm_builder_runner::{build_current_project_with_rustflags, WasmBuilderSourc
fn main() {
build_current_project_with_rustflags(
"wasm_binary.rs",
WasmBuilderSource::Crates("1.0.7"),
WasmBuilderSource::Crates("1.0.8"),
// This instructs LLD to export __heap_base as a global variable, which is used by the
// external memory allocator.
"-Clink-arg=--export=__heap_base",
Expand Down
2 changes: 1 addition & 1 deletion node/runtime/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn main() {
"wasm_binary.rs",
WasmBuilderSource::CratesOrPath {
path: "../../core/utils/wasm-builder",
version: "1.0.7",
version: "1.0.8",
},
// This instructs LLD to export __heap_base as a global variable, which is used by the
// external memory allocator.
Expand Down