Tools Team: tell us your sorrows

Area: Clean up after Cargo

One of many hard jobs that Cargo has is when to reuse resources between projects and when to isolate the builds from separate projects. Cargo manages to make it easy to have different projects with different setting and never compile a mismatched set. Unfortunately this least to a major problem. The Dependencies that are rebuilt once per project never get cleaned up. There is cargo clean, but it triggers a full rebuild. This means that it is impractical to use a Global cache for build Dependencies, as cleaning it would triggers a full rebuild of every project on the system.

Existing tools: cargo-sweep

cargo-sweep is a tool that mucks around in the target folder to use cargos fingerprint files and file system access time to decide when a artifact can be deleted. Unfortunately it requires “file system access time” witch is maintained on ~0% of real systems. There was an attempt to get Cargo to touch files to make cargo-sweep work, but it broke the playground. So it is now an unstable feature with insufficient testing to determine if it can ever be stabilized.

There is a big opportunity to get some testing on CI, but at the moment cargo-sweep needs to be installed from source. (More than defeating the time saved.) I have not figured out how to use trust well enough to get binary releases working.

5 Likes