Is there a solution for multiple gradle versions a...
# community-support
e
Is there a solution for multiple gradle versions and sharing same cache?
Maybe stupid question since it is not sharable
m
Wait, the dependency cache is cachable I believe?
(there are many different caches)
e
Yeah, that is fine
m
Dependencies are under
~/.gradle/caches/modules-2/
. It's the same directory for all Gradle versions
Which cache are you talking about? Build cache?
e
We share build agents between apps and usually in different grade versions and sometimes even a couple of them
And I'm also punished by trying pre-testing RC versions upfront
v
Can you maybe elaborate a bit on what you actually mean with your question? It might be a bit too blurry for us to understand what you mean without your context knowledge.
e
We have 1TB of the hard drive for physical CI agent. That space goes off because of gradle cache recently.
v
And your question is what?
e
if different gradle versions could share build cache
v
They technically do share the build cache, it is
<GRADLE_USER_HOME>/caches/build-cache-1/
. The problem is, that the runtime classpath is an input, so for different Gradle versions the runtime classpath is different, so the cache fingerprints are different, and so you will not have cache hits across Gradle versions.
If you have a central remote build cache, you could clear the build cache regularly on the build agents and it will pull the entries from the remote one if they are needed again if that helps your situation.
e
We don't have a remote build cache yet
t
The safest route is probably to get your gradle versions aligned 🤔
v
Not that it would change too much, even if different projects use the same Gradle version, usually other task inputs are different anyway. 🤷‍♂️
t
True...very much depends on the build... it might help if multiple projects had the same included builds But as you say...likely not
v
if multiple projects had the same included builds
Then those should anyway best have identical Gradle versions or you come rather quickly in devil's kitchen
🧑‍🍳 1
👿 1