xtask
xtask is the repository's task runner. It is a workspace member, so cargo xtask works from the repository root.
cargo xtask --helpnew
cargo xtask new ../my-app
cargo xtask new ../my-app --name my-app --title "My App"Copies templates/app to the destination, replaces:
| Placeholder | Value |
|---|---|
NaN | Crate name (--name or derived from the directory) |
| Window title (--title or derived from the name) |
| Canonical path to this crate |
The same template works with cargo generate --git … --subfolder templates/app; the cargo-generate manifest asks for the title and an optional checkout path (empty means egui-workbench = "0.3" from crates.io).
It also copies LICENSE-APACHE and LICENSE-MIT. The destination must not exist. The generated app is a standalone workspace with a path dependency on this crate and the lints.
check
cargo xtask checkRuns, in order:
cargo fmt --all --checkcargo xtask style-lintcargo clippy --workspace --all-targets -- -D warningscargo doc --workspace --no-depswithRUSTDOCFLAGS=-D warningscargo test --workspace
This is the gate for a contribution. Fix the first failure before looking at the next.
style-lint
cargo xtask style-lintScans src/ for literal radii and font sizes, so a custom WorkbenchStyle reaches every pixel. It reports path:line for a non-zero number literal as:
- the argument of
CornerRadius::same,.corner_radius,FontId::proportional,FontId::monospace, orFontId::new; - the radius (second argument) of
.rect,.rect_filled, or.rect_stroke, also when the call spans several lines.
src/foundation/style.rs (which owns the values) and the plot's export scene (sizes come from PlotConfig) are exempt. A line that really needs a fixed value ends with // style: fixed. Replace a violation with the matching helper: style.control(), style.inner(), style.container(), style.font(13.0), and so on (see Style and density).
snapshots
cargo xtask snapshotsRuns UPDATE_SNAPSHOTS=1 cargo test --test snapshots. It refreshes the workbench frame, settings, palette, and context-menu references. Component and plot snapshots have their own test binaries:
UPDATE_SNAPSHOTS=1 cargo test --test snapshots_components
UPDATE_SNAPSHOTS=1 cargo test --test snapshots_plotLook at every changed PNG. A snapshot-only commit should not include logic changes.
template-check
cargo xtask template-checkRemoves and regenerates target/template-check, then runs fmt --check, clippy --all-targets -- -D warnings, and test in the generated app. This catches placeholder substitutions or template API drift before release.
fmt
cargo xtask fmtRuns cargo fmt --all. The repository uses max_width = 120.
CI
The GitHub workflow runs:
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
xvfb-run -a cargo test --workspace
cargo xtask template-checkon Ubuntu with the X11/Wayland/GL/Vulkan development packages and Rust 1.97.1.
Docs
| What | Command |
|---|---|
| Rust API docs | cargo doc --workspace --no-deps --open |
| Docs with warnings denied | RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps |
| VitePress dev server | cd docs-site && npm run dev |
| VitePress production build | cd docs-site && npm run build |
| Compile-check doc examples | cd docs-site && npm run check-examples |
The check task builds rustdoc; it does not build the VitePress site. Run the site build separately when you change docs-site/.