Gradle Orb with alternative caching strategy

Hi, I’ve created a new orb for Gradle. It is based on the official CircleCI Gradle orb, but applies a different caching strategy.

In a nutshell, it looks into the git history for changes to the Gradle build files, and so is able to restore the cache more often than the official orb - which uses a hash of the Gradle build files and thus cannot restore the cache for all (even whitespace) changes to the build files.

For incremental application updates, this results in less dependency downloads, saving time and transfer capacity.

Feedback is welcome.

2 Likes

Very cool. If many people agree that this is a better caching strategy, you might want to submit it as a PR to the official orb.

Thanks, that is a good idea. I assume that the official orb can not apply this strategy unless Gradle adds proper support for cleaning up unusted dependencies (the part which now runs on internal Gradle classes). We’re now testing the orb in a few projects to see whether something breaks. See this issue.

Also, would git support be sufficient, what about other code revision systems?

This strategy is also relevant for the Maven orb; again the most problematic part being cleaning up unused dependencies.