1
1
apply plugin : ' com.diffplug.spotless'
2
2
spotless {
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
15
4
if (project != rootProject) {
16
- // the rootProject doesn't have any java
17
5
java {
18
6
ratchetFrom ' origin/main'
19
7
bumpThisNumberIfACustomStepChanges(1 )
@@ -22,8 +10,20 @@ spotless {
22
10
eclipse(). configFile rootProject. file(' gradle/spotless.eclipseformat.xml' )
23
11
trimTrailingWhitespace()
24
12
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
+ }
27
27
}
28
28
}
29
29
groovyGradle {
0 commit comments