I’ve hit a snag in our development related to the gradle home cache and would like to know if what I’m trying to do simply isn’t possible, or if there’s an alternate way to go about it.
To give you some background, we build dynamically generated Android apps on a server (multiple build servers and build jobs), which results in thousands of different apps being built. The Android builds are initiated from a java app which does some initial work which then calls the generated project’s gradle wrapper (gradle isn’t installed on the server). The generation of the project is a combination of gradle and ant scripts. Only the final compiled app (.apk) is saved when the build completes.
The goal was to provide the gradle cache (gradle home cache) as a component of our product’s git repository so that each app’s dependencies don’t have to be downloaded every time a build is performed since there will be a finite set of dependencies that would be required by apps built with our product. The cache would be populated manually on a linux system containing the same folder structure and all of the possible dependencies required and committed to the git repo before deploying the product. This would occur every time a service release was required/deployed.
So what I’ve done is defined a folder in the repository to serve as the gradle home and used that for the build process by passing it’s location using --gradle-user-home. All works well except that I’ve noticed that this folder’s contents changes on every new build, in particular, new folders are created in:
And the modules lock file changes:
I’m not really sure of the full effects or what kind of issues would result from it, but I suppose one possibility would be to ignore the modules-2.lock change, and delete the contents of “/gradle_home/caches/2.8/scripts” after each build, leaving the modules there.
So is there some way to go about having a gradle home cache that doesn’t change with every app’s build after it has been initially populated? Again, the goal is simply to prevent having to download the dependencies every time for every app. Any help or guidance would be greatly appreciated.