|
17 | 17 | * under the License.
|
18 | 18 | */
|
19 | 19 |
|
| 20 | +import com.diffplug.spotless.FormatterFunc |
| 21 | +import java.io.Serializable |
20 | 22 | import net.ltgt.gradle.errorprone.errorprone
|
21 | 23 | import org.gradle.api.tasks.compile.JavaCompile
|
22 | 24 | import org.gradle.api.tasks.testing.Test
|
@@ -74,25 +76,29 @@ tasks.withType(Jar::class).configureEach {
|
74 | 76 | // manifests for release(-like) builds.
|
75 | 77 | "Implementation-Title" to "Apache Polaris(TM) (incubating)",
|
76 | 78 | "Implementation-Vendor" to "Apache Software Foundation",
|
77 |
| - "Implementation-URL" to "https://polaris.apache.org/" |
| 79 | + "Implementation-URL" to "https://polaris.apache.org/", |
78 | 80 | )
|
79 | 81 | }
|
80 | 82 | }
|
81 | 83 |
|
82 | 84 | spotless {
|
83 |
| - val disallowWildcardImports = { text: String -> |
84 |
| - val regex = "~/import .*\\.\\*;/".toRegex() |
85 |
| - if (regex.matches(text)) { |
86 |
| - throw GradleException("Wildcard imports disallowed - ${regex.findAll(text)}") |
87 |
| - } |
88 |
| - text |
89 |
| - } |
90 | 85 | java {
|
91 | 86 | target("src/main/java/**/*.java", "src/testFixtures/java/**/*.java", "src/test/java/**/*.java")
|
92 | 87 | googleJavaFormat()
|
93 | 88 | licenseHeaderFile(rootProject.file("codestyle/copyright-header-java.txt"))
|
94 | 89 | endWithNewline()
|
95 |
| - custom("disallowWildcardImports", disallowWildcardImports) |
| 90 | + custom( |
| 91 | + "disallowWildcardImports", |
| 92 | + object : Serializable, FormatterFunc { |
| 93 | + override fun apply(text: String): String { |
| 94 | + val regex = "~/import .*\\.\\*;/".toRegex() |
| 95 | + if (regex.matches(text)) { |
| 96 | + throw GradleException("Wildcard imports disallowed - ${regex.findAll(text)}") |
| 97 | + } |
| 98 | + return text |
| 99 | + } |
| 100 | + }, |
| 101 | + ) |
96 | 102 | toggleOffOn()
|
97 | 103 | }
|
98 | 104 | kotlinGradle {
|
|
0 commit comments