Build Cache key and build numbers


we are trying to make our CI use a distributed build cache and make as many tasks cachable as possible.

We build an Android app at Groupon and use the CI build number (a counter incremented for each build) as the android app version number. This allows QA to test upgrade scenarios and also to quickly be able to check which version has a potential issue either in prod or during testing.

But this breaks cachability of a task (generating resource) and all its dependent.
How can we workaround this ?

It’s a hammer, but you can tell Gradle to ignore a particular file as not important to the behavior of the software:

So if your version number is confined to a single input file, you may be able to ignore it. This only affects the “runtime classpath” understanding of the file (compilation should already be unaffected) and would cause tests to be pulled from the cache if only the “version file” has changed.