#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)

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

#68 in #near

Download history 364/week @ 2024-09-22 239/week @ 2024-09-29 534/week @ 2024-10-06 1134/week @ 2024-10-13 719/week @ 2024-10-20 1052/week @ 2024-10-27 600/week @ 2024-11-03 1165/week @ 2024-11-10 909/week @ 2024-11-17 394/week @ 2024-11-24 823/week @ 2024-12-01 735/week @ 2024-12-08 1561/week @ 2024-12-15 654/week @ 2024-12-22 367/week @ 2024-12-29 1035/week @ 2025-01-05

3,652 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
~481K SLoC