fileTree('src/main/java/').matching() {
include "*/**/*.java"
+ exclude "*/**/package-info.java"
}.forEach {
allPathsContainingJavaFiles << it.toPath().toFile().getParent();
}
packageInfoFile << packageInfoContent
}
}
+
+ def allPackageInfoFiles = [] as Set
+
+ fileTree('src/main/java/').matching() {
+ include "*/**/package-info.java"
+ }.forEach {
+ allPackageInfoFiles << it.toPath().toFile();
+ }
+
+ allPackageInfoFiles.forEach {
+ File packageInfoFile = it;
+ if (!allPathsContainingJavaFiles.contains(packageInfoFile.getParent())) {
+ logger.warn("Deleting package info file: " + packageInfoFile)
+ packageInfoFile.delete();
+ }
+ }
+
}
}
build.dependsOn(generatePackageInfo)