Skip to content

Commit b498ef0

Browse files
JLLeitschuhnedtwigg
authored andcommitted
LicenseHeaderStep exclude module-info.java (#272)
* LicenseHeaderStep exclude module-info.java Closes #270 * Add note about module-info to CHANGES.md
1 parent d985ead commit b498ef0

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

plugin-gradle/CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
### Version 3.15.0-SNAPSHOT - TBD ([javadoc](https://diffplug.github.io/spotless/javadoc/snapshot/), [snapshot](https://oss.sonatype.org/content/repositories/snapshots/com/diffplug/spotless/spotless-plugin-gradle/))
44

5+
* LicenseHeaderStep now wont attempt to add license to `module-info.java` ([#272](https://github.com/diffplug/spotless/pull/272)).
6+
57
### Version 3.14.0 - July 24th 2018 ([javadoc](https://diffplug.github.io/spotless/javadoc/spotless-plugin-gradle/3.14.0/), [jcenter](https://bintray.com/diffplug/opensource/spotless-plugin-gradle/3.14.0))
68

79
* Updated default eclipse-jdt from 4.7.2 to 4.7.3a ([#263](https://github.com/diffplug/spotless/issues/263)). New version fixes a bug preventing Java code formatting within JavaDoc comments ([#191](https://github.com/diffplug/spotless/issues/191)).

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,17 @@ protected void setupTask(SpotlessTask task) {
187187
}
188188
target = union;
189189
}
190-
// LicenseHeaderStep completely blows apart package-info.java - this common-sense check ensures that
191-
// it skips package-info.java. See https://github.com/diffplug/spotless/issues/1
190+
// LicenseHeaderStep completely blows apart package-info.java & module-info.java;
191+
// this common-sense check ensures that it skips package-info.java & module-info.java.
192+
//
193+
// See:
194+
// - https://github.com/diffplug/spotless/issues/1
195+
// - https://github.com/diffplug/spotless/issues/270
192196
steps.replaceAll(step -> {
193197
if (LicenseHeaderStep.name().equals(step.getName())) {
194-
return step.filterByFile(SerializableFileFilter.skipFilesNamed("package-info.java"));
198+
return step.filterByFile(SerializableFileFilter.skipFilesNamed(
199+
"package-info.java",
200+
"module-info.java"));
195201
} else {
196202
return step;
197203
}

0 commit comments

Comments
 (0)