Skip to content

Releases

v0.2

Choose a tag to compare

@github-actions github-actions released this 01 Dec 01:39
  • cargo gc run, test and bench collect only directories Cargo builds into. A program
    they start writes to the same stderr as Cargo's log, so a line it printed in that log's
    format made cargo-gc collect whatever directory it named, without any lock
    (#1, reported by @cantoramann).
  • cargo-gc is published on crates.io.

Full changelog

v0.1

Choose a tag to compare

@github-actions github-actions released this 28 Nov 16:38

The first version.

  • cargo gc <command> runs any Cargo command with its output, colors, progress bar and exit
    code unchanged, then collects its build directory generationally: what no build in the
    last --keep generations (default 8) used is removed. --max-size also removes the
    oldest generations while a profile directory is over a size. --unused removes what no
    command run through cargo gc has used, to reclaim space in a build directory that grew
    before it. cargo gc alone collects without building.
  • Cargo config files can set --keep and --max-size as gc.keep and gc.max-size: a
    project's .cargo/config.toml, or ~/.cargo/config.toml for every project, found as Cargo
    finds them. CARGO_GC_KEEP and CARGO_GC_MAX_SIZE override them, and flags override both.
  • Units built from package versions no Cargo.lock lists any more, or by a toolchain no build
    uses any more, are removed after the first run that moved on, with everything built on them
    and their incremental caches, whatever --keep says: a dependency bump no longer leaves
    its old builds behind for --keep generations.
  • Object files that later rustc invocations superseded are removed from the units that stay:
    on macOS, debug builds keep every compile's object files, so editing and rebuilding grew a
    build directory without bound.
  • Removal only ever costs a rebuild: only recognized units, incremental caches and superseded
    object files go, only while cargo-gc holds Cargo's locks on the profile directory, one
    rename per unit, fingerprint first.
  • Both build directory layouts: build/<package>/<hash>/ (Cargo 1.100 and newer) and
    .fingerprint/, deps/, build/<package>-<hash>/ (older Cargo).
  • macOS, Linux and Windows, with Cargo 1.89 and newer: CI runs the integration tests against
    Cargo 1.89 too.
  • If Cargo builds units its log does not name, as a Cargo release that changed its log would,
    cargo-gc warns and removes nothing. A build that compiles nothing is not warned about.
  • A GitHub Action, leostera/cargo-gc@main, that installs cargo-gc (building it once per
    runner OS, then from its cache), and can cache the build directory between runs while
    cargo gc keeps it collected.

Full changelog