Fix the Gradle plugin not to break the clean
task when Gradle's configuration cache is enabled
#797
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using the project at execution time is not allowed when Gradle's configuration cache is enabled.
https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
Before this commit, the spotless plugin registered a
doLast
task action on theclean
task that accessed the projet at execution time. The effect of this is to break using theclean
task on all builds that have the Spotless plugin applied when the configuration cache is enabled.This manifests the following way:
Here is a ZIP of the HTML configuration cache report for your curiosity: configuration-cache-report.zip
This PR changes the way the Spotless plugin configures the
clean
task to not access a project in the addeddoLast
task action by computing the Spotless cache key upfront at configuration time. The effect is that builds with the Spotless plugin applied can now run theclean
task with the configuration cache enabled.This is a fix for #796