#build #cargo #build-script #near #smart-contracts #docker #abi

cargo-near-build

Library for building Rust smart contracts on NEAR, basis of cargo-near crate/CLI

9 unstable releases (3 breaking)

new 0.4.2 Dec 19, 2024
0.4.1 Dec 18, 2024
0.3.2 Nov 19, 2024
0.3.0 Oct 30, 2024
0.1.1 Sep 13, 2024

#223 in Magic Beans

Download history 135/week @ 2024-08-30 286/week @ 2024-09-06 437/week @ 2024-09-13 378/week @ 2024-09-20 226/week @ 2024-09-27 496/week @ 2024-10-04 877/week @ 2024-10-11 946/week @ 2024-10-18 1037/week @ 2024-10-25 559/week @ 2024-11-01 1026/week @ 2024-11-08 1063/week @ 2024-11-15 492/week @ 2024-11-22 739/week @ 2024-11-29 718/week @ 2024-12-06 1028/week @ 2024-12-13

3,073 downloads per month
Used in 6 crates (2 directly)

MIT/Apache

145KB
3.5K SLoC

Crate features

  • build_script - Adds [extended] module for use in build scripts
  • abi_build - Additional functionality, needed for build of ABI separately
  • docker - Adds docker module for functionality of building in docker with WASM reproducibility.

Default features

None are enabled by default

Re-exports

  1. [camino] is re-exported, because it is used in [BuildOpts], and [BuildArtifact] as type of some of fields
  2. [near_abi] is re-exported, 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(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(build_opts).expect("some error during build");

Dependencies

~16–28MB
~467K SLoC