Crate cargo_near_build

Crate cargo_near_build 

Source
Expand description

§Crate features

  • build_external - Exports crate::build_with_cli function which builds contracts by running external cargo-near binary with std::process::Command
  • build_internal - The whole functionality, needed for build and ABI generation, mostly for internal use by cargo-near CLI implementation
  • docker - Adds docker module for functionality of building in docker with WASM reproducibility.
  • test_code - Adds exports needed for integration tests.

§Default features

build_external

§Re-exports

  1. camino is re-exported, because it is used in BuildOpts as type of some of fields
  2. near_abi is re-exported (under build_internal feature), because details of ABI generated depends on specific version of near-abi dependency
  3. bon is re-exported for the convenience of bon::vec helper macro

§Sample usage:

Default:

let artifact = cargo_near_build::build_with_cli(Default::default()).expect("some error during build");

With some options set:

let build_opts = cargo_near_build::BuildOpts::builder().features("some_contract_feature_1").build();
let artifact = cargo_near_build::build_with_cli(build_opts).expect("some error during build");

Re-exports§

pub use bon;
pub use camino;

Modules§

env_keys
module contains names of environment variables, exported during various operations of the library
extended
Set of examples how to do a factory build script with crate::extended::build_with_cli api is presented.

Structs§

BuildOpts
argument of build_with_cli function
CliDescription
used as field in BuildOpts
SHA256Checksum
convenience helper to compute resulting artifact hashsum if needed

Enums§

ColorPreference
used as field in BuildOpts

Functions§

build_with_cli
Return value: Result::Ok is path to the wasm artifact obtained.