This message was deleted.
# caching
s
This message was deleted.
c
how is the caching of modules-2 implemented?
f
As a newbie, my first answer is another questions, there is a different way to cache modules-2? 😅 Could you give some hints to better understand where check our configuration?
c
Travis is ephemeral. Each build will start with a clean slate (nothing is cached between builds). To enact caching between build requires configuring Travis accordingly (e.g. https://docs.gradle.org/current/userguide/travis-ci.html). If that isn’t done, nothing is cached, and the behaviour of re-downloading dependencies each time would be expected.
f
Ok, know I understand you question. Yep is set, initially was the same of your url, but every time the cache was uploaded as Travis found something change and took 3 mins or more to upload and download. At that point I used the same configuration for github gradle action:
Copy code
cache:
  directories:
    - $HOME/.gradle/caches/jars-*/
    - $HOME/.gradle/caches/modules-*/files-*/*/*/*/*
    - $HOME/.gradle/wrapper/
    - $HOME/.gradle/configuration-cache/
That at least reduced the amount of cache, after I added:
Copy code
before_cache:
  - F=CleanupGradleCache sh -x -c 'curl -O <https://raw.githubusercontent.com/vlsi/cleanup-gradle-cache/v1.x/$F.java> && javac -J-Xmx128m $F.java && java -Xmx128m $F'
Now the only folder that are found with different file is jars-9 and modules-2/files2.1
c
hmmm. not a good idea to selectively do the caching. Would suggest going back to the documented approach (for your Gradle version) and baseline from there.
this:
- $HOME/.gradle/configuration-cache/
is wrong. There is no configuration cache in ~/.gradle (it’s in the project directory). And, its not relocatable and shouldn’t be cached.
if your build is using dynamic/snapshot versions those may dirty the cache (adding new versions).
f
I didn’t like the idea to do selectively but 30% of my build was uploading every time the cache because a .lock file o .txt changed in each build, Ok thank you I will remove the configuration-cache
c
the lock files should not be there, if the example is followed. Try again with the documented baseline and list our what has changed.
doing it selectively will only make it worse - there’s lots of moving parts in that cache structure, all of which are internal to Gradle and we shouldn’t be concerned about. That’s why they document the recommended approach, to avoid footguns from selectively grabbing directories.
f
Ok I’m going to configuring Travis accordingly the sites and give you an update. Thanks for helping me
👍 1
HI @Chris Lee, here the result. This are two consecutive build, as you can see we upload the cache every time and we spend ~2 min., the build is 8 min. We spent 1/4 in uploading cache even we don’t change anything.
c
thanks. This isn’t all of it (more to come): 1. Add ./gradlew daemon --stop to the start of the before cache steps, to stop the daemon before cleaning up the cache
It may be an idea to create a small reproducer with just a few dependencies to iterate on.