Improving gradle-home-cache-cleanup
detection of unused files
#46
Labels
bug
Something isn't working
in:caching
Issue with caching of Gradle User Home
in:gradle
A bug that needs to be fixed in Gradle
Milestone
Hi! 👋
Our Gradle home cache is getting so big in our project that is taking long times loading and storing the cache, so we enabled the
gradle-home-cache-cleanup
flag to remove unused files from Gradle User Home before saving to the cache.After enabling this flag, the home cache entry dropped from
3.6 GB
to2.3 GB
. While this is an improvement, we expected more. If we remove all the caches in Github actions and we start a fresh new runner without any cache, it only generates457 MB
. Therefore it is still keeping 80% of data that was actually not used in the last build. Please note that I only refer to theGradle User Home
entry.After doing some debugging in a sample project (by enabling logging and exploring the section
Gradle User Home (directories >5M): after extracting common artifacts
) I observed that it keeps multipletransforms-x
folders, which represent a big part of the contents stored in the home cache. In theory a certain version of Gradle should use a consistent X value for that folder, so most likely the cleanup is not properly removing these unused folders left behind after a Gradle bump.This is an Android project, mostly Kotlin code. The cache was never cleaned up in the last 4 months. It started with Gradle 8.4, later we migrated to 8.5 and last week to 8.6.
I also observed the home increasing significantly when bumping some dependencies (please note that I do not refer to the
dependencies
entry, which is stored separately, but still talking about the home), but I didn't research this thoroughly. Most likely this could be the next step to explore after figuring out why the transforms folder is still there.You can check the thread in the slack community for a few other details.
Thanks!
The text was updated successfully, but these errors were encountered: