From 02decfd86462b213279e331da570f5881fb30179 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 25 Sep 2019 14:29:19 +0100 Subject: [PATCH] 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 --- build.gradle | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index aa5f7e32604..c36ee86d99c 100644 --- a/build.gradle +++ b/build.gradle @@ -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" } } }