#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

11 unstable releases (3 breaking)

new 0.4.4 Feb 13, 2025
0.4.3 Jan 22, 2025
0.4.2 Dec 19, 2024
0.3.2 Nov 19, 2024
0.1.1 Sep 13, 2024

#567 in Magic Beans

Download history 1023/week @ 2024-10-29 605/week @ 2024-11-05 1240/week @ 2024-11-12 834/week @ 2024-11-19 540/week @ 2024-11-26 721/week @ 2024-12-03 821/week @ 2024-12-10 1487/week @ 2024-12-17 591/week @ 2024-12-24 644/week @ 2024-12-31 970/week @ 2025-01-07 1286/week @ 2025-01-14 1218/week @ 2025-01-21 1637/week @ 2025-01-28 1581/week @ 2025-02-04 2877/week @ 2025-02-11

7,487 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–29MB
~487K SLoC