Google Java Format step is not compatible with configuration cache

Open
#2,459 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
32/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
java, kotlin
Domain
build-system

Research direction

Start with the stack-trace entry points in GoogleJavaFormatStep.java, JarState.java, GradleProvisioner.java, and FormatterStepSerializationRoundtrip.java. Reproduce the failure using configuration cache, predeclare, and google-java-format 1.26.0, then verify that the reported exception no longer occurs while the predeclared formatter remains usable.

Written by the indexing model from the issue text.

Description

bug

When running spotless with CC enabled and using predeclare, we still see this error reported:

Caused by: org.gradle.api.GradleException: Add a step with [com.google.googlejavaformat:google-java-format:1.26.0] into the `spotlessPredeclare` block in the root project.	
	at com.diffplug.gradle.spotless.GradleProvisioner$DedupingProvisioner.lambda$new$0(GradleProvisioner.java:99)	
	at com.diffplug.spotless.JarState.provisionWithTransitives(JarState.java:109)	
	at com.diffplug.spotless.JarState.from(JarState.java:98)	
	at com.diffplug.spotless.JarState.from(JarState.java:93)	
	at com.diffplug.spotless.java.GoogleJavaFormatStep.lambda$createInternally$1(GoogleJavaFormatStep.java:106)	
	at com.diffplug.spotless.JarState$Promised.get(JarState.java:53)	
	at com.diffplug.spotless.java.GoogleJavaFormatStep.equalityState(GoogleJavaFormatStep.java:152)	
	at com.diffplug.spotless.FormatterStepSerializationRoundtrip.stateSupplier(FormatterStepSerializationRoundtrip.java:57)	
	at com.diffplug.spotless.ThrowingEx.get(ThrowingEx.java:67)	
	at com.diffplug.spotless.FormatterStepSerializationRoundtrip$HackClone.writeObject(FormatterStepSerializationRoundtrip.java:113)

We are configuring GJF's formatter in our predeclare block and you can find our configuration logic here: https://github.com/slackhq/foundry/blob/5d970a56341e0cd703ab20c344f0df3a55a6c826/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryBasePlugin.kt#L185-L200

Dominant language
Java
Stars
5.7k
Forks
560
Avg merge
1d 13h
Merged PRs (30d)
43

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from diffplug/spotless

All issues in diffplug/spotless

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.