zipTree does not clean up the build/tmp/.cache/expanded directory #31881
Labels
a:bug
has:workaround
Indicates that the issue has a workaround
in:file-tasks
copy sync zip tar rename delete
Current Behavior
Usage of files accessible via
ArchiveOperations.zipTree
leads to unpacking them to a temporary directory likebuild/tmp/.cache/expanded/zip_%hash%
. That's fine.However, the observable behavior is that the directory is never cleaned up unless tasks like
clean
are called explicitly or the files are removed manually.Expected Behavior
The temporary expanded directory should be either cleaned up after work with the zip tree is finished or there should be some regular cleanup routine.
Another solution is to document this behavior and mention that it's user's responsibility to remove the temporary directory. Is there even a reliable way to know the temporary directory path related to a specific zip file tree?
Context (optional)
As a reference, in Kotlin we are using
zipTree
for repackaging jar files. Currently, the directory is taking 21 GB by 272 different expanded archives on my machine.Self-contained Reproducer Project
https://github.com/ALikhachev/gradle-reproducers/tree/main/zipTree-does-not-clean-up
Gradle version
8.12
Build scan URL (optional)
No response
Your Environment (optional)
No response
The text was updated successfully, but these errors were encountered: