Skip to content

Commit fe81542

Browse files
authored
fix(build): Gradle caching effectively not working (#1922)
Using a `custom()` spotless formatter check effectively disables caching, see `com.diffplug.gradle.spotless.FormatExtension#custom(java.lang.String, com.diffplug.spotless.FormatterFunc)` using `globalState`, which is a `NeverUpToDateBetweenRuns`. This change refactors this to be cachable. We also already have a errorprone rule, so we can get rid entirely of the spotless step.
1 parent f5871c5 commit fe81542

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

build-logic/src/main/kotlin/polaris-spotless.gradle.kts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
* under the License.
1818
*/
1919

20-
import com.diffplug.spotless.FormatterFunc
21-
import java.io.Serializable
22-
import org.gradle.api.GradleException
23-
2420
plugins { id("com.diffplug.spotless") }
2521

2622
// skip spotless check for duplicated projects
@@ -31,18 +27,6 @@ if (!project.extra.has("duplicated-project-sources")) {
3127
googleJavaFormat()
3228
// licenseHeaderFile(rootProject.file("codestyle/copyright-header-java.txt"))
3329
endWithNewline()
34-
custom(
35-
"disallowWildcardImports",
36-
object : Serializable, FormatterFunc {
37-
override fun apply(text: String): String {
38-
val regex = "~/import .*\\.\\*;/".toRegex()
39-
if (regex.matches(text)) {
40-
throw GradleException("Wildcard imports disallowed - ${regex.findAll(text)}")
41-
}
42-
return text
43-
}
44-
},
45-
)
4630
toggleOffOn()
4731
}
4832
kotlinGradle {

0 commit comments

Comments
 (0)