File tree 1 file changed +10
-0
lines changed
src/main/java/com/diffplug/gradle/spotless/java 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 24
24
25
25
import com .diffplug .gradle .spotless .FormatExtension ;
26
26
import com .diffplug .gradle .spotless .FormatTask ;
27
+ import com .diffplug .gradle .spotless .LicenseHeaderStep ;
27
28
import com .diffplug .gradle .spotless .SpotlessExtension ;
28
29
29
30
public class JavaExtension extends FormatExtension {
@@ -69,6 +70,15 @@ protected void setupTask(FormatTask task) throws Exception {
69
70
}
70
71
target = union ;
71
72
}
73
+ // LicenseHeaderStep completely blows apart package-info.java - this common-sense check ensures that
74
+ // it skips package-info.java. See https://github.com/diffplug/spotless/issues/1
75
+ steps .replaceAll (step -> {
76
+ if (LicenseHeaderStep .NAME .equals (step .getName ())) {
77
+ return step .filterByFile (file -> !file .getName ().equals ("package-info.java" ));
78
+ } else {
79
+ return step ;
80
+ }
81
+ });
72
82
super .setupTask (task );
73
83
}
74
84
}
You can’t perform that action at this time.
0 commit comments