Onchain.Precompiled (onchain_evm v0.7.0)

Copy Markdown View Source

Shared RustlerPrecompiled options for both NIF crates.

The :targets list is the set scripts/build-precompiled.sh actually produces. Windows is omitted on purpose — cargo-zigbuild cannot produce x86_64-pc-windows-msvc, so Windows consumers source-build.

A missing checksum-*.exs source-builds in this repo's checkout so mix ci is green before the first GitHub Release. The same missing file fails the load for a Hex-installed package, where files: guarantees the checksum ships. A checksum mismatch always fails; it never falls back to source.

Summary

Types

Whether checksum-Elixir.<Module>.exs exists on disk.

Hex tarball vs this repo (or a git/path dep).

Functions

Artifact filename rustler_precompiled downloads for a crate/target.

True when the NIF should compile from source instead of downloading.

Shipped OTP NIF versions. Must match RUSTLER_NIF_VERSION in the build script.

Keyword options for use RustlerPrecompiled.

Shipped Rust target triples. Must match scripts/build-precompiled.sh.

Types

checksum_presence()

@type checksum_presence() :: :missing | :present

Whether checksum-Elixir.<Module>.exs exists on disk.

install_source()

@type install_source() :: :hex | :checkout

Hex tarball vs this repo (or a git/path dep).

Functions

artifact_filename(crate, version, target)

@spec artifact_filename(String.t(), String.t(), String.t()) :: String.t()

Artifact filename rustler_precompiled downloads for a crate/target.

force_build?(target, env, checksum, source)

@spec force_build?(
  String.t() | nil,
  String.t() | nil,
  checksum_presence(),
  install_source()
) ::
  boolean()

True when the NIF should compile from source instead of downloading.

checksum :missing source-builds only for :checkout. A Hex install with a missing checksum must not source-build — rustler_precompiled then fails the load. A mismatch is never a reason to force-build.

nif_versions()

@spec nif_versions() :: [String.t()]

Shipped OTP NIF versions. Must match RUSTLER_NIF_VERSION in the build script.

opts(crate)

@spec opts(String.t()) :: keyword()

Keyword options for use RustlerPrecompiled.

Omits :force_build when the host should download, so the library's application-env put_new still applies. Sets it to true for an unsupported host, ONCHAIN_EVM_BUILD=1, or a missing checksum in this checkout.

targets()

@spec targets() :: [String.t()]

Shipped Rust target triples. Must match scripts/build-precompiled.sh.