dart-lang / native

Dart packages related to FFI and native assets bundling.
BSD 3-Clause "New" or "Revised" License
155 stars 43 forks source link

[native_assets_builder] Purge old directories #1353

Open dcharkes opened 3 months ago

dcharkes commented 3 months ago

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:

dcharkes commented 3 months ago

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

sigurdm commented 3 months ago

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.

dcharkes commented 1 month ago

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. 👍