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) {
configurations {
rat
ratDeps
}
dependencies {
rat "org.apache.rat:apache-rat"
ratDeps "org.apache.rat:apache-rat"
}
}
@ -34,14 +34,14 @@ allprojects {
group = 'Verification'
description = 'Runs Apache Rat checks.'
}
}
if (project == rootProject) {
configure(rootProject) {
rat {
includes += [
"buildSrc/**/*.java",
"lucene/tools/forbiddenApis/**",
"lucene/tools/prettify/**",
// "dev-tools/**"
]
excludes += [
// Unclear if this needs ASF header, depends on how much was copied from ElasticSearch
@ -50,7 +50,7 @@ allprojects {
}
}
if (project.path == ":lucene:analysis:common") {
configure(project(":lucene:analysis:common")) {
rat {
srcExcludes += [
"**/*.aff",
@ -61,7 +61,7 @@ allprojects {
}
}
if (project.path == ":lucene:analysis:kuromoji") {
configure(project(":lucene:analysis:kuromoji")) {
rat {
srcExcludes += [
// whether rat detects this as binary or not is platform dependent?!
@ -70,7 +70,7 @@ allprojects {
}
}
if (project.path == ":lucene:analysis:opennlp") {
configure(project(":lucene:analysis:opennlp")) {
rat {
excludes += [
"src/tools/test-model-data/*.txt",
@ -78,7 +78,7 @@ allprojects {
}
}
if (project.path == ":lucene:highlighter") {
configure(project(":lucene:highlighter")) {
rat {
srcExcludes += [
"**/CambridgeMA.utf8"
@ -86,7 +86,7 @@ allprojects {
}
}
if (project.path == ":lucene:suggest") {
configure(project(":lucene:suggest")) {
rat {
srcExcludes += [
"**/Top50KWiki.utf8",
@ -95,20 +95,7 @@ allprojects {
}
}
if (project.path == ":lucene:tools") {
rat {
includes += [
"forbiddenApis/**",
"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"
]
}
}
if (project.path == ":solr:core") {
configure(project(":solr:core")) {
rat {
srcExcludes += [
"**/htmlStripReaderTest.html"
@ -116,7 +103,7 @@ allprojects {
}
}
if (project.path == ":solr:webapp") {
configure(project(":solr:webapp")) {
rat {
includes = [ "**" ]
excludes += [
@ -127,7 +114,6 @@ allprojects {
]
}
}
}
// Structure inspired by existing task from Apache Kafka, heavily modified since then.
class RatTask extends DefaultTask {
@ -154,7 +140,7 @@ class RatTask extends DefaultTask {
def generateXmlReport() {
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)
def rat = NamespaceBuilder.newInstance(ant, uri)