You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support Gradle configuration cache on multiple JVMs #1274
Gradle configuration cache requires task state to be round-trip serializable. As outlined at #987, this is a signficant constraint on plugin developers and it slows down the end-user experience of change-test-change-test on a single JVM daemon. We built a workaround (JvmLocalCache) that complies with Gradle's requirement by making our tasks round-trip serializable without requiring much work from plugin developers or the end user's machine, but it only works within a single JVM.
To work on multiple JVMs, we need to
make every step round-trip serializable
remove JvmLocalCache
Reacted by Marc Philipp, Javier Segovia Córdoba, Jonathan Bluett-Duncan, Vladi Stoliar, Ji Sungbin, Suresh, trietbui85, Patrick Schmitt, davidburstrom, Rohan Harrison and 1 more
Reacted by Remco van der Heijden, tkramarczyk-vgw, Suresh and davidburstrom
FYI Gradle 8 will do a full roundtrip on the first invocation with CC enabled.
See work in progress here gradle/gradle#21985 (comment)
The goal is for this to be the default in 8.0.
Full roundtrip will work great on the same JVM, so Spotless will still work and not work under the same conditions it does currently. EDIT: Compatibility with configuration cache within a single JVM on Gradle 8 is confirmed.
In this comment, I'm going to maintain a list of remaining TODOs before we will fully support Gradle's configuration cache model without any workarounds. If you'd like to help: comment in this issue when you start on a given step, follow-up with a PR (draft is fine) and I will update the checklist below
I checked npm.EslintFormatterStep, npm.PrettierFormatterStep, npm.TsFmtFormatterStep and sql.DBeaverSQLFormatterStep. They all use StepHarness for testing which has roundtrip serialization testing enabled by default. Since their tests do not fail, it should mean they are already serializable, am I correct?
For NativeCmdStep I created a PR #2108 which adds a test using StepHarness.
Thanks mostly to @Goooler's tireless dedication, we have finally shipped:
plugin-gradle 3.0.0.BETA1
plugin-maven 2.44.0.BETA1
These contain a bazillion fixes. Please test and let us know if you encounter any issues!
Reacted by Christopher-Marcel Esser, Marc Philipp, Scott Grissom, Suresh, Jaehyun An, Remco van der Heijden, Brais Gabín, Paul Merlin and Edward Ciambra
Could not load the value of field `steps` of task `:spotlessInternalRegisterDependencies` of type `com.diffplug.gradle.spotless.RegisterDependenciesTask`.
> Could not load the value of field `excluded` of `com.diffplug.spotless.java.CleanthatJavaStep` bean found in field `roundtripStateInternal` of `com.diffplug.spotless.FormatterStepSerializationRoundtrip` bean found in field `steps` of task `:spotlessInternalRegisterDependencies` of type `com.diffplug.gradle.spotless.RegisterDependenciesTask`.
I just removed it as it looks like googleJavaFormat already takes care of that.
I get a similar error to @bddckr if I use any prettier steps, and only while using the Gradle Configuration Cache, like:
Could not load the value of field `steps` of task `:spotlessJava` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`.
> Could not load the value of field `additionalNpmrcLocations` of `com.diffplug.spotless.npm.NpmPathResolver` bean found in field `resolver` of `com.diffplug.spotless.npm.NpmFormatterStepLocations` bean found in field `locations` of `com.diffplug.spotless.npm.PrettierFormatterStep$State` bean found in field `roundtripStateInternal` of `com.diffplug.spotless.FormatterStepSerializationRoundtrip` bean found in field `steps` of task `:spotlessJava` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`.
or:
Could not load the value of field `steps` of task `:spotlessPrettierGeneric` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`.
> Could not load the value of field `additionalNpmrcLocations` of `com.diffplug.spotless.npm.NpmPathResolver` bean found in field `resolver` of `com.diffplug.spotless.npm.NpmFormatterStepLocations` bean found in field `locations` of `com.diffplug.spotless.npm.PrettierFormatterStep$State` bean found in field `roundtripStateInternal` of `com.diffplug.spotless.FormatterStepSerializationRoundtrip` bean found in field `steps` of task `:spotlessPrettierGeneric` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`.
I've worked around it by declaring Spotless incompatible with the configuration cache, like:
tasks.withType<SpotlessTask>().configureEach {
notCompatibleWithConfigurationCache(
"Spotless 7.0.0.BETA1 with prettier steps does not support the configuration cache.")
}
Activity
eskatos commentedon Sep 28, 2022
FYI Gradle 8 will do a full roundtrip on the first invocation with CC enabled.
See work in progress here gradle/gradle#21985 (comment)
The goal is for this to be the default in 8.0.
nedtwigg commentedon Sep 28, 2022
Full roundtrip will work great on the same JVM, so Spotless will still work and not work under the same conditions it does currently. EDIT: Compatibility with configuration cache within a single JVM on Gradle 8 is confirmed.
nedtwigg commentedon Dec 4, 2023
I think we now have a way to incrementally build this until we can eventually remove our workaround. See:
FormatterSteproundtrip serializable. #1945In this comment, I'm going to maintain a list of remaining TODOs before we will fully support Gradle's configuration cache model without any workarounds. If you'd like to help: comment in this issue when you start on a given step, follow-up with a PR (draft is fine) and I will update the checklist below
LineEnding.GIT_ATTRIBUTES(at least for Gradle) because very difficult to make it serializable Support Gradle configuration cache on multiple JVMs #1274GIT_ATTRIBUTES_FAST_ALLSAMEwhich is the default anywayFormatterSteproundtrip serializable. #1945FormatterSteproundtrip serializable. #1945Make the Equo-based steps round-trip serializable (#1950 towards #1274)
lehmanju commentedon May 6, 2024
I checked
npm.EslintFormatterStep,npm.PrettierFormatterStep,npm.TsFmtFormatterStepandsql.DBeaverSQLFormatterStep. They all use StepHarness for testing which has roundtrip serialization testing enabled by default. Since their tests do not fail, it should mean they are already serializable, am I correct?For
NativeCmdStepI created a PR #2108 which adds a test using StepHarness.nedtwigg commentedon Jun 4, 2024
Thanks mostly to @Goooler's tireless dedication, we have finally shipped:
plugin-gradle 3.0.0.BETA1plugin-maven 2.44.0.BETA1These contain a bazillion fixes. Please test and let us know if you encounter any issues!
marcphilipp commentedon Jun 5, 2024
JUnit build updated ✅
bddckr commentedon Jun 5, 2024
All working fine for me as well, except I used
removeUnusedImports("cleanthat-javaparser-unnecessaryimport")as seen in the docs. That one seems to not support the config cache yet:
I just removed it as it looks like
googleJavaFormatalready takes care of that.ZachCallear commentedon Jun 13, 2024
I get a similar error to @bddckr if I use any
prettiersteps, and only while using the Gradle Configuration Cache, like:or:
I've worked around it by declaring Spotless incompatible with the configuration cache, like:
davidburstrom commentedon Sep 18, 2024
FWIW, I've upgraded to 7.0.0.BETA2 in all my repositories and everything seems to be in order! Great job!
nedtwigg commentedon Oct 24, 2024
With
7.0.0.BETA4I think this is now just about fully solved. Last chance for feedback before these APIs all get baked!ZacSweers commentedon Oct 28, 2024
Just filed a regression on #2318
cloudshiftchris commentedon Dec 21, 2024
CC issue w/ prettier on 7.0.0BETA4: #2372
build: Windows에서 spotlessApply가 shell script를 CRLF로 바꾸지 않게 한다