File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
plugin-gradle/src/main/java/com/diffplug/gradle/spotless Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 20
20
import java .nio .file .Files ;
21
21
import java .nio .file .Path ;
22
22
import java .nio .file .StandardCopyOption ;
23
+ import java .util .List ;
24
+ import java .util .Objects ;
23
25
24
26
import javax .inject .Inject ;
25
27
36
38
37
39
import com .diffplug .common .base .StringPrinter ;
38
40
import com .diffplug .spotless .Formatter ;
41
+ import com .diffplug .spotless .FormatterStep ;
42
+ import com .diffplug .spotless .LineEnding ;
39
43
import com .diffplug .spotless .PaddedCell ;
40
44
41
45
@ CacheableTask
@@ -130,4 +134,26 @@ private File getOutputFile(File input) {
130
134
}
131
135
return new File (outputDirectory , outputFileName );
132
136
}
137
+
138
+ static boolean isHydrated (SpotlessTask task ) {
139
+ return task .lineEndingsPolicy != null ;
140
+ }
141
+
142
+ static class LiveCache {
143
+ LineEnding .Policy lineEndingsPolicy ;
144
+ List <FormatterStep > steps ;
145
+ String ratchetFrom ;
146
+
147
+ LiveCache (SpotlessTask task ) {
148
+ lineEndingsPolicy = Objects .requireNonNull (task .lineEndingsPolicy );
149
+ steps = Objects .requireNonNull (task .steps );
150
+ ratchetFrom = Objects .requireNonNull (task .ratchetFrom );
151
+ }
152
+
153
+ void hydrate (SpotlessTask task ) {
154
+ task .lineEndingsPolicy = lineEndingsPolicy ;
155
+ task .steps = steps ;
156
+ task .setupRatchet (ratchetFrom );
157
+ }
158
+ }
133
159
}
You can’t perform that action at this time.
0 commit comments