xtask
Reusable building blocks for Rust xtask crates.
This crate is deliberately not a framework for defining one universal xtask
CLI. Each repository should keep its own clap command tree and product-specific
build flow. xtask provides the small, reusable primitives that tend to be copied
between repositories: repository paths, file checks, process helpers, artifact
hashing, Apple signing, DMG packaging, Sparkle appcasts, and GitHub Actions outputs.
Feature flags
| Feature | Default | Purpose |
|---|---|---|
process |
yes | xshell setup and command lookup helpers. |
hash |
yes | SHA-256 and human-readable artifact sizes. |
github-actions |
no | Append values to GITHUB_OUTPUT. |
latest-json |
no | Update simple channel-based latest.json manifests. |
sparkle |
no | Generate and merge Sparkle RSS appcasts. |
apple |
no | macOS-only Xcode, plist, codesign, provisioning profile, and notarization helpers. |
dmg |
no | macOS-only create-dmg wrapper. Implies apple and hash. |
Apple modules are compiled on target_os = "macos" only. This keeps Linux CI and
non-Apple xtask crates from accidentally depending on platform-specific APIs.
Repository root discovery
Library crates cannot use their own env!("CARGO_MANIFEST_DIR") to discover a
downstream repository. Pass the manifest directory from your repository's xtask
crate instead:
let root = root_from_xtask_manifest?;
# Ok
Basic usage
use ;
let root = root_from_xtask_manifest?;
let app = root.join;
ensure_dir?;
let sha = sha256_file?;
println!;
# Ok
macOS signing example
#
# sign_app?;
# Ok
DMG example
#
# package?;
# Ok
Publishing
The package name xtask is intentionally short. Before publishing, run:
Then publish with a crates.io token from an account that should own the crate.