mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 02:17:58 +00:00
Rewrap all comments to 100 line width (#9490)
* reformat everything again * manual formatting * last manual fix * Fix build
This commit is contained in:
@@ -215,12 +215,17 @@ fn generate_rerun_if_changed_instructions() {
|
||||
/// The current project is determined by using the `CARGO_MANIFEST_DIR` environment variable.
|
||||
///
|
||||
/// `file_name` - The name + path of the file being generated. The file contains the
|
||||
/// constant `WASM_BINARY`, which contains the built WASM binary.
|
||||
/// constant `WASM_BINARY`, which contains the built WASM binary.
|
||||
///
|
||||
/// `project_cargo_toml` - The path to the `Cargo.toml` of the project that should be built.
|
||||
///
|
||||
/// `default_rustflags` - Default `RUSTFLAGS` that will always be set for the build.
|
||||
///
|
||||
/// `features_to_enable` - Features that should be enabled for the project.
|
||||
/// `wasm_binary_name` - The optional wasm binary name that is extended with `.compact.compressed.wasm`.
|
||||
/// If `None`, the project name will be used.
|
||||
///
|
||||
/// `wasm_binary_name` - The optional wasm binary name that is extended with
|
||||
///
|
||||
/// `.compact.compressed.wasm`. If `None`, the project name will be used.
|
||||
fn build_project(
|
||||
file_name: PathBuf,
|
||||
project_cargo_toml: PathBuf,
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
//! # Wasm builder is a utility for building a project as a Wasm binary
|
||||
//!
|
||||
//! The Wasm builder is a tool that integrates the process of building the WASM binary of your project into the main
|
||||
//! `cargo` build process.
|
||||
//! The Wasm builder is a tool that integrates the process of building the WASM binary of your
|
||||
//! project into the main `cargo` build process.
|
||||
//!
|
||||
//! ## Project setup
|
||||
//!
|
||||
@@ -51,14 +51,14 @@
|
||||
//! include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||
//! ```
|
||||
//!
|
||||
//! This will include the generated Wasm binary as two constants `WASM_BINARY` and `WASM_BINARY_BLOATY`.
|
||||
//! The former is a compact Wasm binary and the latter is the Wasm binary as being generated by the compiler.
|
||||
//! Both variables have `Option<&'static [u8]>` as type.
|
||||
//! This will include the generated Wasm binary as two constants `WASM_BINARY` and
|
||||
//! `WASM_BINARY_BLOATY`. The former is a compact Wasm binary and the latter is the Wasm binary as
|
||||
//! being generated by the compiler. Both variables have `Option<&'static [u8]>` as type.
|
||||
//!
|
||||
//! ### Feature
|
||||
//!
|
||||
//! Wasm builder supports to enable cargo features while building the Wasm binary. By default it will
|
||||
//! enable all features in the wasm build that are enabled for the native build except the
|
||||
//! Wasm builder supports to enable cargo features while building the Wasm binary. By default it
|
||||
//! will enable all features in the wasm build that are enabled for the native build except the
|
||||
//! `default` and `std` features. Besides that, wasm builder supports the special `runtime-wasm`
|
||||
//! feature. This `runtime-wasm` feature will be enabled by the wasm builder when it compiles the
|
||||
//! Wasm binary. If this feature is not present, it will not be enabled.
|
||||
@@ -67,24 +67,26 @@
|
||||
//!
|
||||
//! By using environment variables, you can configure which Wasm binaries are built and how:
|
||||
//!
|
||||
//! - `SKIP_WASM_BUILD` - Skips building any Wasm binary. This is useful when only native should be recompiled.
|
||||
//! If this is the first run and there doesn't exist a Wasm binary, this will set both
|
||||
//! variables to `None`.
|
||||
//! - `WASM_BUILD_TYPE` - Sets the build type for building Wasm binaries. Supported values are `release` or `debug`.
|
||||
//! By default the build type is equal to the build type used by the main build.
|
||||
//! - `FORCE_WASM_BUILD` - Can be set to force a Wasm build. On subsequent calls the value of the variable
|
||||
//! needs to change. As wasm-builder instructs `cargo` to watch for file changes
|
||||
//! this environment variable should only be required in certain circumstances.
|
||||
//! - `WASM_BUILD_RUSTFLAGS` - Extend `RUSTFLAGS` given to `cargo build` while building the wasm binary.
|
||||
//! - `SKIP_WASM_BUILD` - Skips building any Wasm binary. This is useful when only native should be
|
||||
//! recompiled. If this is the first run and there doesn't exist a Wasm binary, this will set both
|
||||
//! variables to `None`.
|
||||
//! - `WASM_BUILD_TYPE` - Sets the build type for building Wasm binaries. Supported values are
|
||||
//! `release` or `debug`. By default the build type is equal to the build type used by the main
|
||||
//! build.
|
||||
//! - `FORCE_WASM_BUILD` - Can be set to force a Wasm build. On subsequent calls the value of the
|
||||
//! variable needs to change. As wasm-builder instructs `cargo` to watch for file changes this
|
||||
//! environment variable should only be required in certain circumstances.
|
||||
//! - `WASM_BUILD_RUSTFLAGS` - Extend `RUSTFLAGS` given to `cargo build` while building the wasm
|
||||
//! binary.
|
||||
//! - `WASM_BUILD_NO_COLOR` - Disable color output of the wasm build.
|
||||
//! - `WASM_TARGET_DIRECTORY` - Will copy any build Wasm binary to the given directory. The path needs
|
||||
//! to be absolute.
|
||||
//! - `WASM_TARGET_DIRECTORY` - Will copy any build Wasm binary to the given directory. The path
|
||||
//! needs to be absolute.
|
||||
//! - `WASM_BUILD_TOOLCHAIN` - The toolchain that should be used to build the Wasm binaries. The
|
||||
//! format needs to be the same as used by cargo, e.g. `nightly-2020-02-20`.
|
||||
//! format needs to be the same as used by cargo, e.g. `nightly-2020-02-20`.
|
||||
//!
|
||||
//! Each project can be skipped individually by using the environment variable `SKIP_PROJECT_NAME_WASM_BUILD`.
|
||||
//! Where `PROJECT_NAME` needs to be replaced by the name of the cargo project, e.g. `node-runtime` will
|
||||
//! be `NODE_RUNTIME`.
|
||||
//! Each project can be skipped individually by using the environment variable
|
||||
//! `SKIP_PROJECT_NAME_WASM_BUILD`. Where `PROJECT_NAME` needs to be replaced by the name of the
|
||||
//! cargo project, e.g. `node-runtime` will be `NODE_RUNTIME`.
|
||||
//!
|
||||
//! ## Prerequisites:
|
||||
//!
|
||||
@@ -92,9 +94,10 @@
|
||||
//!
|
||||
//! - rust nightly + `wasm32-unknown-unknown` toolchain
|
||||
//!
|
||||
//! If a specific rust nightly is installed with `rustup`, it is important that the wasm target is installed
|
||||
//! as well. For example if installing the rust nightly from 20.02.2020 using `rustup install nightly-2020-02-20`,
|
||||
//! the wasm target needs to be installed as well `rustup target add wasm32-unknown-unknown --toolchain nightly-2020-02-20`.
|
||||
//! If a specific rust nightly is installed with `rustup`, it is important that the wasm target is
|
||||
//! installed as well. For example if installing the rust nightly from 20.02.2020 using `rustup
|
||||
//! install nightly-2020-02-20`, the wasm target needs to be installed as well `rustup target add
|
||||
//! wasm32-unknown-unknown --toolchain nightly-2020-02-20`.
|
||||
|
||||
use std::{
|
||||
env, fs,
|
||||
@@ -234,8 +237,8 @@ impl CargoCommand {
|
||||
/// Check if the supplied cargo command is a nightly version
|
||||
fn is_nightly(&self) -> bool {
|
||||
// `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:
|
||||
// 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
|
||||
env::var("RUSTC_BOOTSTRAP").is_ok() ||
|
||||
self.command()
|
||||
|
||||
@@ -432,9 +432,9 @@ fn build_project(project: &Path, default_rustflags: &str, cargo_cmd: CargoComman
|
||||
.args(&["rustc", "--target=wasm32-unknown-unknown"])
|
||||
.arg(format!("--manifest-path={}", manifest_path.display()))
|
||||
.env("RUSTFLAGS", rustflags)
|
||||
// Unset the `CARGO_TARGET_DIR` to prevent a cargo deadlock (cargo locks a target dir exclusive).
|
||||
// The runner project is created in `CARGO_TARGET_DIR` and executing it will create a sub target
|
||||
// directory inside of `CARGO_TARGET_DIR`.
|
||||
// Unset the `CARGO_TARGET_DIR` to prevent a cargo deadlock (cargo locks a target dir
|
||||
// exclusive). The runner project is created in `CARGO_TARGET_DIR` and executing it will
|
||||
// create a sub target directory inside of `CARGO_TARGET_DIR`.
|
||||
.env_remove("CARGO_TARGET_DIR")
|
||||
// We don't want to call ourselves recursively
|
||||
.env(crate::SKIP_BUILD_ENV, "");
|
||||
@@ -642,8 +642,9 @@ fn package_rerun_if_changed(package: &DeduplicatePackage) {
|
||||
.into_iter()
|
||||
.filter_entry(|p| {
|
||||
// Ignore this entry if it is a directory that contains a `Cargo.toml` that is not the
|
||||
// `Cargo.toml` related to the current package. This is done to ignore sub-crates of a crate.
|
||||
// If such a sub-crate is a dependency, it will be processed independently anyway.
|
||||
// `Cargo.toml` related to the current package. This is done to ignore sub-crates of a
|
||||
// crate. If such a sub-crate is a dependency, it will be processed independently
|
||||
// anyway.
|
||||
p.path() == manifest_path || !p.path().is_dir() || !p.path().join("Cargo.toml").exists()
|
||||
})
|
||||
.filter_map(|p| p.ok().map(|p| p.into_path()))
|
||||
|
||||
Reference in New Issue
Block a user