crates/gunnar-build-thing/src/lib.rs
//! # gunnar's build thing, as the forge loads it
//!
//! **This crate is a shim and holds no logic.** The recipe — atoms, columns,
//! variants, the receipt writer, the reachability gate — is
//! [`gunnar_recipe`], and every name below is that crate's, re-exported so a
//! caller needs one dependency rather than two.
//!
//! What lives here is the one thing that cannot live there: the plugin ABI
//! export. `nornir_build_thing::export_build_thing!` emits four `bt_*` symbols
//! under `cfg(target_arch = "wasm32")`, and they have to come out of a
//! `cdylib` — which is also what dwarves demands of a crate named
//! `<repo>-build-thing`
//! (`dwarves/crates/dwarves/src/build_thing/code.rs:125-133`: a wasm32 build
//! of an rlib emits no `.wasm` to load).
//!
//! ## Why that is worth its own crate
//!
//! A lib target whose `crate-type` contains `cdylib` gets **no
//! `--extra-filename`** from cargo, so every unit of it writes one filename.
//! The recipe is reached both as a `[build-dependencies]` and as a normal
//! dependency, which under resolver 2 is two units — two `-C metadata` hashes,
//! one path, last writer wins, and the build script links the loser with
//! `undefined symbol` for a function that is in the rlib. MEASURED 2026-09-03:
//! `cargo build --workspace` **red 6 of 8 from cold**, always green warm.
//! rust-lang/cargo#6313. Nothing build-depends on this crate, so it has one
//! unit and the collision cannot arise.
//!
//! ## The shim stays empty on purpose
//!
//! A receipt addresses its recipe as `krate:version:hash`, and the `hash` is
//! computed by `gunnar-recipe`'s `build.rs` over `gunnar-recipe/src/**/*.rs`.
//! Anything that ran from *this* crate's sources would sit outside that hash —
//! provenance the coordinate would silently fail to cover.
//! `tests/no_logic_in_the_shim.rs` asserts there is nothing here to miss.
// Everything, re-exported. `GunnarBuildThing` in particular is ONE type with
// one definition: the macro below exports the ABI over the same impl the build
// scripts link, so the wasm module and the native binaries cannot answer
// differently. `tests/wasm_plugin.rs` holds them to that.
pub use gunnar_recipe::*;
// **The ABI, and the only line of substance in this crate.**
//
// Four `bt_*` exports under `cfg(target_arch = "wasm32")` only, over the
// re-exported `GunnarBuildThing`. Template: edda
// `crates/nornir-buildspec-holger`.
nornir_build_thing::export_build_thing!(GunnarBuildThing);