11apply plugin : ' com.diffplug.spotless'
22spotless {
3- def noInternalDepsClosure = {
4- String text = it
5- /*
6- * No good way to get around using this import:
7- * https://github.com/gradle/gradle/issues/3191
8- */
9- String regex = " import org\\ .gradle\\ .api\\ .internal\\ .(?!plugins\\ .DslObject)(?!project\\ .ProjectInternal)"
10- if ((text. contains(' import org.gradle.internal.' ) || text. find(regex)) &&
11- ! text. contains(' def noInternalDepsClosure' )) {
12- throw new AssertionError (" Accidental internal import" )
13- }
14- }
3+ // the rootProject doesn't have any java
154 if (project != rootProject) {
16- // the rootProject doesn't have any java
175 java {
186 ratchetFrom ' origin/main'
197 bumpThisNumberIfACustomStepChanges(1 )
@@ -22,8 +10,20 @@ spotless {
2210 eclipse(). configFile rootProject. file(' gradle/spotless.eclipseformat.xml' )
2311 trimTrailingWhitespace()
2412 removeUnusedImports()
25- // TODO: formatAnnotations()
26- custom ' noInternalDeps' , noInternalDepsClosure
13+ removeWildcardImports()
14+ formatAnnotations()
15+ custom ' noInternalDeps' , {
16+ /*
17+ * No good way to get around using this import:
18+ * https://github.com/gradle/gradle/issues/3191
19+ */
20+ var regex = " import org\\ .gradle\\ .api\\ .internal\\ .(?!plugins\\ .DslObject)(?!project\\ .ProjectInternal)"
21+ if (it. contains(' import org.gradle.internal.' )
22+ || it. find(regex as Closure )
23+ && ! it. contains(' def noInternalDepsClosure' )) {
24+ throw new AssertionError (" Accidental internal import" )
25+ }
26+ }
2727 }
2828 }
2929 groovyGradle {
0 commit comments