Skip to content

nickgerace/cargo-xtask-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cargo xtask Example

License Language

This is an example repository for cargo xtask. For more information on @matklad's cargo xtask pattern, visit the original repository.

Quickstart

In the root of the repository, run the following command:

cargo xtask

A 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.

Repository Structure

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.

Why cargo xtask?

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.

About

An example repository for @matklad's cargo xtask pattern

Topics

Resources

License

Stars

Watchers

Forks

Languages