plushie/build

Build the plushie renderer binary or WASM bundle.

Ships in the hex package. Users run:

gleam run -m plushie/build                        # native binary (default)
gleam run -m plushie/build -- --release            # optimized build
gleam run -m plushie/build -- --wasm               # WASM renderer only
gleam run -m plushie/build -- --bin --wasm         # both
gleam run -m plushie/build -- --verbose            # print cargo output
gleam run -m plushie/build -- --bin-file PATH      # custom binary dest
gleam run -m plushie/build -- --wasm-dir PATH      # custom WASM dest

The heavy lifting is delegated to cargo-plushie. This module only prepares a tiny virtual app crate under _build/plushie-renderer-spec/ that declares the project’s native widget crates as path dependencies, then shells out to:

build –manifest-path /Cargo.toml [–release]

cargo-plushie resolves its workspace under _build/plushie-renderer-spec/target/plushie-renderer/, generates a main.rs registering every widget, and runs cargo build.

Resolution for cargo-plushie:

  1. PLUSHIE_RUST_SOURCE_PATH env var points at a plushie-rust checkout: invoke via cargo run -p cargo-plushie ....
  2. cargo-plushie on PATH at matching version: invoke directly.
  3. Fail with install instructions.

See plushie/cargo_plushie for details.

Native widget metadata (important)

Each widget crate listed under [plushie].native_widgets in the project’s gleam.toml MUST declare [package.metadata.plushie.widget] in its own Cargo.toml with type_name and constructor keys. cargo-plushie discovers widgets via cargo metadata and refuses to build a crate without that table. Use cargo plushie new-widget <name> to scaffold a widget crate with the correct layout.

Values

pub fn main() -> Nil

Entry point for gleam run -m plushie/build.

pub fn missing_binary_message(
  path: String,
  verbose: Bool,
) -> String
pub fn render_virtual_cargo_toml(
  cwd: String,
  project: String,
  bin_name: String,
  version: String,
  widgets: List(config.NativeWidgetConfig),
) -> String

Render the virtual app Cargo.toml that cargo-plushie consumes.

Declares every native widget crate as a path dependency and carries metadata overrides under [package.metadata.plushie]:

  • binary_name fixes the produced binary name to {proj}-renderer.
  • source_path, if PLUSHIE_RUST_SOURCE_PATH is set, pins patch deps at the local plushie-rust checkout.
Search Document