Description
This is a prerequisite to making the gradle build cache useful across machines (#280). Here is why:
-
spotless formats by applying a series of steps - every step is capable of serializing its entire state, including config files, for the purpose of up-to-date checks
-
spotless/lib/src/main/java/com/diffplug/spotless/FormatterStep.java
Lines 58 to 72 in eb783cd
-
so far so good, this means that most steps will work with the gradle build cache. The problem is for some formatters that have config files.
- Some formatters capture the state of these config files by loading their content into a String, these will relocate okay
- e.g.
LicenseHeaderStep
- But most of them use
FileSignature
, which will not relocate. - e.g.
ScalaFmtStep
-
FileSignature
uses filesystem absolute paths and lastModified timestamptsspotless/lib/src/main/java/com/diffplug/spotless/FileSignature.java
Lines 43 to 45 in eb783cd
-
Worst of all,
JarState
is used by almost every single FormatterStep, and it has aFileSignature
inside itspotless/lib/src/main/java/com/diffplug/spotless/JarState.java
Lines 42 to 47 in eb783cd