Skip to main content

Crate yatr

Crate yatr 

Source
Expand description

YATR - A fast, polyglot, single-binary task runner.

This crate provides both a CLI tool and a library for task automation.

§Features

  • Simple TOML configuration - Define tasks in a familiar format
  • Rhai scripting - Embedded scripting for complex task logic
  • Content-addressable caching - Skip unchanged tasks
  • File watching - Re-run tasks on file changes
  • Parallel execution - Run independent tasks concurrently
  • Dependency resolution - Automatic task ordering

§Example

# YATR.toml

[tasks.test]
desc = "Run all tests"
run = ["cargo test --all-targets"]

[tasks.build]
desc = "Build release"
depends = ["test"]
run = ["cargo build --release"]

§Library Usage

use yatr::{Config, TaskGraph, Executor, ExecutorConfig};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let (config, _) = Config::load(None)?;
    let graph = TaskGraph::from_config(&config)?;
     
    let executor = Executor::new(config, ExecutorConfig::default(), None);
    executor.execute(&graph, "build").await?;
     
    Ok(())
}

Re-exports§

pub use cache::Cache;
pub use config::Config;
pub use error::Result;
pub use error::YatrError;
pub use executor::Executor;
pub use executor::ExecutorConfig;
pub use executor::TaskResult;
pub use graph::ExecutionPlan;
pub use graph::TaskGraph;
pub use graph::TaskNode;
pub use remote::RemoteCache;
pub use script::ScriptEngine;

Modules§

affected
Git-based “what’s affected” detection.
cache
Content-addressable cache for task results
config
Configuration parsing for yatr.toml
error
Error types for YATR
executor
Task execution engine
graph
Task graph construction and dependency resolution
lsp
A small language server for yatr.toml.
reapi
Bazel Remote Execution API (REAPI) cache interop.
remote
HTTP client for a shared (remote) cache.
script
Rhai scripting engine integration
toolchain
Toolchain management: pin, download, and expose language runtimes.
trace
Lightweight IO tracing for cache correctness.
wasm
WASM plugin runtime.
watch
File watching for automatic task re-execution