11apply plugin : ' com.diffplug.spotless'
22spotless {
3- // the rootProject doesn't have any java
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+ }
415 if (project != rootProject) {
16+ // the rootProject doesn't have any java
517 java {
618 ratchetFrom ' origin/main'
719 bumpThisNumberIfACustomStepChanges(1 )
@@ -10,20 +22,8 @@ spotless {
1022 eclipse(). configFile rootProject. file(' gradle/spotless.eclipseformat.xml' )
1123 trimTrailingWhitespace()
1224 removeUnusedImports()
13- removeWildcardImports()
1425 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- }
26+ custom ' noInternalDeps' , noInternalDepsClosure
2727 }
2828 }
2929 groovyGradle {
0 commit comments