holmgr / cargo-sweep

A cargo subcommand for cleaning up unused build files generated by Cargo
MIT License
694 stars 31 forks source link

Be compatible with CI caches #5

Closed epage closed 5 years ago

epage commented 5 years ago

Not sure if this is actually a concern, of whether the atime is preserved on caches or not.

The goal would be for us to be able to run cargo-sweep before cache creation to remove everything unnecessary to make caches smaller so creation and load are faster (and because we'd be better citizens with Travis who gives this stuff to us for free)

epage commented 5 years ago

If this is a problem...

So the main thing we need is a way to identify the start and end of the build to know what was accessed in that window because if it wasn't access, it probably can be cleared.

holmgr commented 5 years ago

So I started looking into it a bit and found this on Travis https://docs.travis-ci.com/user/caching#how-does-caching-work, I am guessing other hosted providers use a similar underlying solution. The thing about this is that this will instead involve accessing all cache files as part of the unpacking. Therefor making it impossible to distinguish between older and newer target files.

As for your idea about a timestamp generation step I think it is pretty neat, but I would have liked a single command to solve this problem but it seems hard to achieve :/ Then we would have something like: cargo sweep --stamp then cargo build ... and finally cargo sweep -f <sweep-file>

This also be a replacement/related to #2