Improve exclusions of checkstyleNoHttp task

This commit adds the following exclusions to the source of the
checkstyleNoHttp tasks for each project in the build and for buildSrc:

- bin/ directory (created by Eclipse Buildship)
- .settings directory (created by Eclipse)
- .classpath file (created by Eclipse)
- .project file (created by Eclipse)

An exclusion for the build/ directory is also configured as the
NoHttp plugin does not exclude it by default for buildSrc.

Closes gh-23702
This commit is contained in:
Andy Wilkinson 2019-09-25 14:29:19 +01:00 committed by Sam Brannen
parent 1aa0ea0281
commit 02decfd864
1 changed files with 9 additions and 5 deletions

View File

@ -406,11 +406,15 @@ configure(rootProject) {
nohttp {
source.exclude "**/test-output/**"
whitelistFile = project.file("src/nohttp/whitelist.lines")
def projectDirURI = project.projectDir.toURI()
allprojects.forEach { p ->
def outURI = p.file("out").toURI()
def pattern = projectDirURI.relativize(outURI).path + "**"
source.exclude pattern
def rootPath = file(rootDir).toPath()
def projectDirs = allprojects.collect { it.projectDir } + "${rootDir}/buildSrc"
projectDirs.forEach { dir ->
[ 'bin', 'build', 'out', '.settings' ]
.collect { rootPath.relativize(new File(dir, it).toPath()) }
.forEach { source.exclude "$it/**" }
[ '.classpath', '.project' ]
.collect { rootPath.relativize(new File(dir, it).toPath()) }
.forEach { source.exclude "$it" }
}
}