Cleaning up minor things in rat task.

This commit is contained in:
Dawid Weiss 2020-01-15 10:07:10 +01:00
parent 0e686c6701
commit e6d85cd4bc
1 changed files with 66 additions and 80 deletions

View File

@ -21,11 +21,11 @@ import groovy.xml.NamespaceBuilder
configure(rootProject) { configure(rootProject) {
configurations { configurations {
rat ratDeps
} }
dependencies { dependencies {
rat "org.apache.rat:apache-rat" ratDeps "org.apache.rat:apache-rat"
} }
} }
@ -34,98 +34,84 @@ allprojects {
group = 'Verification' group = 'Verification'
description = 'Runs Apache Rat checks.' description = 'Runs Apache Rat checks.'
} }
}
if (project == rootProject) { configure(rootProject) {
rat { rat {
includes += [ includes += [
"buildSrc/**/*.java", "buildSrc/**/*.java",
"lucene/tools/forbiddenApis/**", "lucene/tools/forbiddenApis/**",
"lucene/tools/prettify/**", "lucene/tools/prettify/**",
// "dev-tools/**" ]
] excludes += [
excludes += [ // Unclear if this needs ASF header, depends on how much was copied from ElasticSearch
// Unclear if this needs ASF header, depends on how much was copied from ElasticSearch "**/ErrorReportingTestListener.java"
"**/ErrorReportingTestListener.java" ]
]
}
} }
}
if (project.path == ":lucene:analysis:common") { configure(project(":lucene:analysis:common")) {
rat { rat {
srcExcludes += [ srcExcludes += [
"**/*.aff", "**/*.aff",
"**/*.dic", "**/*.dic",
"**/charfilter/*.htm*", "**/charfilter/*.htm*",
"**/*LuceneResourcesWikiPage.html" "**/*LuceneResourcesWikiPage.html"
] ]
}
} }
}
if (project.path == ":lucene:analysis:kuromoji") { configure(project(":lucene:analysis:kuromoji")) {
rat { rat {
srcExcludes += [ srcExcludes += [
// whether rat detects this as binary or not is platform dependent?! // whether rat detects this as binary or not is platform dependent?!
"**/bocchan.utf-8" "**/bocchan.utf-8"
] ]
}
} }
}
if (project.path == ":lucene:analysis:opennlp") { configure(project(":lucene:analysis:opennlp")) {
rat { rat {
excludes += [ excludes += [
"src/tools/test-model-data/*.txt", "src/tools/test-model-data/*.txt",
] ]
}
} }
}
if (project.path == ":lucene:highlighter") { configure(project(":lucene:highlighter")) {
rat { rat {
srcExcludes += [ srcExcludes += [
"**/CambridgeMA.utf8" "**/CambridgeMA.utf8"
] ]
}
} }
}
if (project.path == ":lucene:suggest") { configure(project(":lucene:suggest")) {
rat { rat {
srcExcludes += [ srcExcludes += [
"**/Top50KWiki.utf8", "**/Top50KWiki.utf8",
"**/stop-snowball.txt" "**/stop-snowball.txt"
] ]
}
} }
}
if (project.path == ":lucene:tools") { configure(project(":solr:core")) {
rat { rat {
includes += [ srcExcludes += [
"forbiddenApis/**", "**/htmlStripReaderTest.html"
"prettify/**", ]
// If/when :lucene:tools becomes a gradle project, then the following line will fail
// It is safe to remove it, but also remove the check for lucene/tools in rootProject above
"javadoc/ecj.javadocs.prefs"
]
}
} }
}
configure(project(":solr:webapp")) {
if (project.path == ":solr:core") { rat {
rat { includes = [ "**" ]
srcExcludes += [ excludes += [
"**/htmlStripReaderTest.html" "web/img/**",
] "*.iml",
} "build.gradle",
} "build/**",
]
if (project.path == ":solr:webapp") {
rat {
includes = [ "**" ]
excludes += [
"web/img/**",
"*.iml",
"build.gradle",
"build/**",
]
}
} }
} }
@ -154,7 +140,7 @@ class RatTask extends DefaultTask {
def generateXmlReport() { def generateXmlReport() {
def uri = 'antlib:org.apache.rat.anttasks' def uri = 'antlib:org.apache.rat.anttasks'
def ratClasspath = project.rootProject.configurations.rat.asPath def ratClasspath = project.rootProject.configurations.ratDeps.asPath
ant.taskdef(resource: 'org/apache/rat/anttasks/antlib.xml', uri: uri, classpath: ratClasspath) ant.taskdef(resource: 'org/apache/rat/anttasks/antlib.xml', uri: uri, classpath: ratClasspath)
def rat = NamespaceBuilder.newInstance(ant, uri) def rat = NamespaceBuilder.newInstance(ant, uri)