File tree 1 file changed +6
-3
lines changed
plugin-gradle/src/main/java/com/diffplug/gradle/spotless
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 24
24
import java .util .List ;
25
25
import java .util .Objects ;
26
26
import java .util .Random ;
27
+ import java .util .Set ;
27
28
import java .util .regex .Pattern ;
29
+ import java .util .stream .Collectors ;
28
30
import java .util .stream .Stream ;
29
31
30
32
import org .gradle .api .GradleException ;
@@ -136,9 +138,10 @@ protected FileCollection parseTarget(Object target) {
136
138
} else if (target instanceof String ||
137
139
(target instanceof List && ((List <?>) target ).stream ().allMatch (o -> o instanceof String ))) {
138
140
File dir = getProject ().getProjectDir ();
139
- Iterable <String > excludes = Arrays .asList (
140
- getProject ().getBuildDir ().toString () + File .separatorChar + "**" ,
141
- getProject ().getProjectDir ().toString () + File .separatorChar + ".gradle" + File .separatorChar + "**" );
141
+ Set <Project > subprojects = getProject ().getSubprojects ();
142
+ Stream <String > buildDirs = subprojects .stream ().map (subproject -> subproject .getBuildDir ().toString () + File .separatorChar + "**" );
143
+ Stream <String > localDotGradleDirs = subprojects .stream ().map (subproject -> subproject .getProjectDir ().toString () + File .separatorChar + ".gradle" + File .separatorChar + "**" );
144
+ Iterable <String > excludes = Stream .concat (buildDirs , localDotGradleDirs ).collect (Collectors .toList ());
142
145
if (target instanceof String ) {
143
146
return (FileCollection ) getProject ().fileTree (dir ).include ((String ) target ).exclude (excludes );
144
147
} else {
You can’t perform that action at this time.
0 commit comments