Crate contract_build
source ·Expand description
contract-build
A crate for building ink!
smart contracts. Used by
cargo-contract
.
Usage
use contract_build::{
ManifestPath,
Verbosity,
BuildArtifacts,
BuildMode,
Features,
Network,
OptimizationPasses,
OutputType,
UnstableFlags,
};
let manifest_path = ManifestPath::new("my-contract/Cargo.toml").unwrap();
let args = contract_build::ExecuteArgs {
manifest_path,
verbosity: Verbosity::Default,
build_mode: BuildMode::Release,
features: Features::default(),
network: Network::Online,
build_artifact: BuildArtifacts::All,
unstable_flags: UnstableFlags::default(),
optimization_passes: Some(OptimizationPasses::default()),
keep_debug_symbols: false,
lint: false,
output_type: OutputType::Json,
skip_wasm_validation: false,
};
contract_build::execute(args);
Re-exports
pub use self::metadata::MetadataArtifacts as MetadataResult;
pub use self::metadata::BuildInfo;
pub use self::metadata::MetadataArtifacts;
pub use self::metadata::WasmOptSettings;
pub use self::util::DEFAULT_KEY_COL_WIDTH;
Modules
Macros
- Prints to stdout if
verbosity.is_verbose()
istrue
. - Pretty print name value, name right aligned with colour.
Structs
- Result of the build process.
- Track and display the current and total number of steps.
- Relevant metadata obtained from Cargo.toml.
- Arguments to use when executing
build
orcheck
commands. - Define the standard
cargo
features args to be passed through. - Create, amend and save a copy of the specified
Cargo.toml
. - Path to a
Cargo.toml
file - Result of the optimization process.
- Subset of cargo profile settings to configure defaults for building contracts
- Make a copy of a contract project manifest, allow modifications to be made to it, rewrite the paths to point to the original project files, then write to a temporary directory.
Enums
- Describes which artifacts to generate
- The mode to build the contract in.
- Use network connection to build contracts and generate metadata or use cached dependencies only.
- The type of output to display at the end of a build.
- Denotes if output should be printed to stdout.
Functions
- Checks whether the supplied
ink_version
already contains the debug feature. - Returns the blake2 hash of the code slice.
- Executes build of the smart contract which produces a Wasm binary that is ready for deploying.
- Creates a new contract project from the template.