This is an example repository for cargo xtask.
For more information on @matklad's cargo xtask pattern, visit the original repository.
In the root of the repository, run the following command:
cargo xtaskA list of "tasks" should print alongside their descriptions. This command works via an alias in the repository's cargo configuration file. The alias allows you to run tasks from any directory within the repository, like other command runners.
This repository contains two crates: xtask and your-crate.
The former contains the "tasks" and ability to run them.
The latter represents the crate(s) that xtask would help orchestrate "tasks" for.
.
├── .cargo
│ └── config.toml
│
├── Cargo.lock
├── Cargo.toml
│
├── README.md
│
├── xtask
│ ├── Cargo.toml
│ └── src
│ └── main.rs
│
└── your-crate
├── Cargo.toml
└── src
└── main.rs
Tip
Running cargo run will execute your-crate because it is the default crate in the root Cargo.toml file.
This means that running standard cargo commands will not require you to specify which crate you are targeting.
The cargo xtask pattern provides repository automation without needing to install another dependency.
If a contributor can compile Rust code, they can use cargo xtask.