Skip to content

Commit 1bfc2c7

Browse files
author
Vincent Potucek
committed
activate formatAnnotations()
1 parent 9dc5b8b commit 1bfc2c7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

gradle/spotless.gradle

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
apply plugin: 'com.diffplug.spotless'
22
spotless {
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

Comments
 (0)