Skip to content

Commit 3986fe6

Browse files
committed
But this classloader solution isn't perfect, because Gradle throws deserialization error:
``` Caused by: java.lang.InstantiationError: [B at org.gradle.instantexecution.serialization.beans.BeanPropertyReader.newBean(BeanPropertyReader.kt:58) at org.gradle.instantexecution.serialization.beans.BeanStateReader$DefaultImpls.newBeanWithId(BeanStateReader.kt:25) at org.gradle.instantexecution.serialization.beans.BeanPropertyReader.newBeanWithId(BeanPropertyReader.kt:37) ```
1 parent a8f4798 commit 3986fe6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ConfigurationCacheTest.java

+25
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,29 @@ public void spotlessWorksForSimpleStep() throws IOException {
9191
runTasks("spotlessApply");
9292
assertFile("test.txt").hasContent("abc");
9393
}
94+
95+
@Test
96+
public void spotlessWorksForComplexStep() throws IOException {
97+
setFile("build.gradle").toLines(
98+
"buildscript { repositories { mavenCentral() } }",
99+
"plugins {",
100+
" id 'com.diffplug.spotless'",
101+
"}",
102+
"apply plugin: 'java'",
103+
"spotless {",
104+
" java {",
105+
" target 'test.java'",
106+
" googleJavaFormat('1.2')",
107+
" }",
108+
"}");
109+
setFile("test.java").toResource("java/googlejavaformat/JavaCodeUnformatted.test");
110+
runTasks("spotlessApply");
111+
assertFile("test.java").sameAsResource("java/googlejavaformat/JavaCodeFormatted.test");
112+
runTasks("spotlessApply");
113+
runTasks("spotlessApply");
114+
115+
setFile("test.java").toResource("java/googlejavaformat/JavaCodeUnformatted.test");
116+
runTasks("spotlessApply");
117+
assertFile("test.java").sameAsResource("java/googlejavaformat/JavaCodeFormatted.test");
118+
}
94119
}

0 commit comments

Comments
 (0)