Add option to remove cache after build
herbertjones opened this issue · 3 comments
Would it be possible to add an option to remove all files except the built binary? For instance in Rust for even a simple script runs over 100MB, but the built binary is only a megabyte or two. Writing several small scripts can become very wasteful.
For instance, a new configuration option field named clean_cache_after_build
which removes all cache files except the target_bin
could be added so that excessive disk space isn't wasted.
This could also be done manually by updating all scripts with a custom build_cmd
. Might still be a useful option though.
// build_cmd: cargo build --release && strip ./target/release/script && rm -rf ./target/release/deps && rm -rf ./target/release/build
It looks like this is very language specific. Here are few examples when this does not work as expected:
- Build produced multiple files require for the program to work.
target_bin
is just a starter script. - The majority of space is occupied outside of the cache dir
~/.cargo
,~/.m2
, and other caches of package managers- Docker layers and volumes
Is there really a reliable way to determine all transient files that were produced for all languages, warranting this a first class feature?
Probably just having a cleanup_comand
option is better, but that benefit is still marginal.
Thoughts?
Sounds like it isn't worth the effort then.