feat(xtask): cross-platform release build via cargo-zigbuild
Some checks failed
CI / Test (Linux) (push) Has been cancelled
CI / Test (Windows MSVC) (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Format (push) Has been cancelled

Replace build-all.sh shell script with a Rust xtask workspace member.
Uses cargo-zigbuild + zig as a universal cross-linker -- no VMs, no
containers, no root required.

Produces all three release binaries from a single FreeBSD machine:
  anvil-X.Y.Z-freebsd-x86_64.tar.gz  (native cargo build)
  anvil-X.Y.Z-linux-x86_64.tar.gz    (cargo zigbuild)
  anvil-X.Y.Z-windows-x86_64.zip     (cargo zigbuild)

Commands:
  cargo xtask --fix     install zig, zip, cargo-zigbuild, rustup targets
  cargo xtask --check   verify all dependencies
  cargo xtask           build all three binaries + SHA256SUMS
  cargo xtask --clean   remove cross-compile artifacts
  cargo xtask --suffix rc1  build with version suffix

Also converts Cargo.toml to a workspace (members: anvil, xtask).
build-all.sh retained as a thin wrapper around cargo xtask.
This commit is contained in:
Eric Ratliff
2026-03-16 19:54:33 -05:00
parent 13ab202880
commit e7995de547
8 changed files with 768 additions and 209 deletions

19
xtask/Cargo.toml Normal file
View File

@@ -0,0 +1,19 @@
[package]
name = "xtask"
version = "0.1.0"
edition = "2021"
publish = false
[[bin]]
name = "xtask"
path = "src/main.rs"
[dependencies]
# CLI argument parsing
clap = { version = "4.4", features = ["derive"] }
# Error handling
anyhow = "1.0"
# Colors
colored = "2.1"
# Command existence check
which = "5.0"