Skip to content

Commit 57b6e19

Browse files
committed
Not sure why tests are failing, does this fix it?
1 parent 842bacc commit 57b6e19

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessExtension.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public Object doCall(TaskExecutionGraph graph) {
321321
System.err.println("Argument passed to " + IDE_HOOK_PROPERTY + " must be an absolute path");
322322
return;
323323
}
324-
if (spotlessTask.getTarget().contains(file)) {
324+
if (spotlessTask.getTargetAsFileCollection().contains(file)) {
325325
try (Formatter formatter = spotlessTask.buildFormatter()) {
326326
PaddedCell.DirtyState dirty = PaddedCell.calculateDirtyState(formatter, file);
327327
if (dirty.isClean()) {

plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessTask.java

+12-7
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,24 @@ public FormatExceptionPolicy getExceptionPolicy() {
105105
return exceptionPolicy;
106106
}
107107

108-
protected FileCollection target;
108+
@Internal
109+
FileCollection getTargetAsFileCollection() {
110+
if (target instanceof FileCollection) {
111+
return (FileCollection) target;
112+
} else {
113+
return getProject().files(target);
114+
}
115+
}
116+
117+
protected Iterable<File> target;
109118

110119
@Internal
111-
public FileCollection getTarget() {
120+
public Iterable<File> getTarget() {
112121
return target;
113122
}
114123

115124
public void setTarget(Iterable<File> target) {
116-
if (target instanceof FileCollection) {
117-
this.target = (FileCollection) target;
118-
} else {
119-
this.target = getProject().files(target);
120-
}
125+
this.target = target;
121126
}
122127

123128
/** Internal use only. */

0 commit comments

Comments
 (0)