Hasty Briefsbeta

Show HN: Cargo-rail: graph-aware monorepo tooling for Rust; 11 deps

6 days ago
  • #rust
  • #workspace-management
  • #cargo
  • cargo-rail is a tool for managing Rust workspaces with features like dependency unification, dead feature pruning, and graph-aware change detection.
  • It replaces multiple tools like cargo-hakari, cargo-udeps, and cargo-msrv with a single unified solution.
  • Key features include:
  • - Unifying dependency versions across the workspace.
  • - Pruning dead features and detecting unused dependencies.
  • - Computing the Minimum Supported Rust Version (MSRV) from the dependency graph.
  • - Graph-aware change detection to only test affected crates in CI.
  • - Extracting crates with full git history and bidirectional sync.
  • - Dependency-order publishing with changelog generation.
  • It integrates with CI systems like GitHub Actions to reduce CI time by testing only affected crates.
  • Configuration is managed via a .config/rail.toml file, which can be generated and customized.
  • cargo-rail is designed to work with existing Cargo workflows and supports features like workspace inheritance and private registries.
  • It aims to provide the benefits of build systems like Bazel/Buck2 for Rust workspaces without leaving the Cargo ecosystem.
  • The tool has been tested on large production workspaces like tikv, meilisearch, and tokio, showing significant reductions in unified dependencies and dead features.
  • It addresses common issues like undeclared features, which can lead to cryptic compile errors when testing or publishing crates in isolation.