Skip to content

Commit

Permalink
LicenseHeaderStep exclude module-info.java (#272)
Browse files Browse the repository at this point in the history
* LicenseHeaderStep exclude module-info.java

Closes #270

* Add note about module-info to CHANGES.md
  • Loading branch information
JLLeitschuh authored and nedtwigg committed Aug 1, 2018
1 parent d985ead commit b498ef0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### 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/))

* LicenseHeaderStep now wont attempt to add license to `module-info.java` ([#272](https://github.com/diffplug/spotless/pull/272)).

### 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))

* 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)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,17 @@ protected void setupTask(SpotlessTask task) {
}
target = union;
}
// LicenseHeaderStep completely blows apart package-info.java - this common-sense check ensures that
// it skips package-info.java. See https://github.com/diffplug/spotless/issues/1
// LicenseHeaderStep completely blows apart package-info.java & module-info.java;
// this common-sense check ensures that it skips package-info.java & module-info.java.
//
// See:
// - https://github.com/diffplug/spotless/issues/1
// - https://github.com/diffplug/spotless/issues/270
steps.replaceAll(step -> {
if (LicenseHeaderStep.name().equals(step.getName())) {
return step.filterByFile(SerializableFileFilter.skipFilesNamed("package-info.java"));
return step.filterByFile(SerializableFileFilter.skipFilesNamed(
"package-info.java",
"module-info.java"));
} else {
return step;
}
Expand Down

0 comments on commit b498ef0

Please sign in to comment.