google-java-format-gradle-plugin icon indicating copy to clipboard operation
google-java-format-gradle-plugin copied to clipboard

VerifyGoogleJavaFormat task is not cacheable

Open davidburstrom opened this issue 5 years ago • 4 comments

To speed up CI builds for multi-module builds, it would help if VerifyGoogleJavaFormat was made cacheable. https://docs.gradle.org/current/userguide/build_cache.html#enable_caching_of_non_cacheable_tasks

davidburstrom avatar Feb 26 '20 13:02 davidburstrom

We have an internal caching mechanism that is more efficient than what would be possible with Gradle's inputs/outputs based caching approach. Since we format source files, our inputs and outputs are the same. If we run the formatting task and something changes, Gradle would consider the task not up-to-date on a second run. We do (the task is run, but it's a no-op)!

Also have a look at UpToDateSpec.groovy.

sherter avatar Jun 07 '20 15:06 sherter

Also see https://github.com/sherter/google-java-format-gradle-plugin/issues/18.

sherter avatar Jun 07 '20 15:06 sherter

That is all good and well, but I was referring to CI builds (clean builds, as per Gradle recommendations), in which I believe your caching mechanism does not come into play.

davidburstromspotify avatar Jun 07 '20 15:06 davidburstromspotify

That's probably right. This whole distributed build cache thing came after this plugin was conceived. I'll have to look into this...

sherter avatar Jun 07 '20 15:06 sherter