native icon indicating copy to clipboard operation
native copied to clipboard

[native_assets_builder] Purge old directories

Open dcharkes opened this issue 1 year ago • 3 comments
trafficstars

The native assets builder creates directories in the form of .dart_tool/native_assets_builder/<some-hash-of-the-config>. These directories should be purged at some point:

https://github.com/dart-lang/native/blob/4c5fca965acecc0256489c9b0398518629cb9045/pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart#L255

Possible purging strategy:

  • touch the config.json (or a last_read.json) every time it's read. And with a 1% chance delete everything that hasn't been read in a week.

dcharkes avatar Jul 17 '24 14:07 dcharkes

@jonasfj @sigurdm Does pub delete unused packages versions? Or do they just stay around forever (until a dart pub cache clean)?

dcharkes avatar Jul 17 '24 14:07 dcharkes

Currently they stay in the cache forever.

We have a cool idea for how we could "garbage collect" the cache, but no immediate plans for realizing it.

sigurdm avatar Jul 29 '24 12:07 sigurdm

Version-specific cache directories are checked periodically (at most, every 24 hours) to determine whether they are still in use. They are deleted if they haven’t been used for 7 days. https://docs.gradle.org/current/userguide/directory_layout.html#dir:project_root

Thanks @reidbaker!

We might follow a similar strategy of 24h and 7d. 👍

dcharkes avatar Oct 01 '24 06:10 dcharkes