Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-5055: "rat-sources" target now checks also build.xml, ivy.xml, forbidden-api signatures, and parts of resources folders.

Uwe Schindler57d23ada87dd
diff --git a/build.xml b/build.xml
index fb107be4833..58d9687f8ed 100644
--- a/build.xml
+++ b/build.xml
@@ -90,6 +90,7 @@
<target name="rat-sources" description="Runs rat across all sources and tests">
<subant target="rat-sources" inheritall="false" failonerror="true">
+ <fileset dir="." includes="extra-targets.xml" /><!-- run rat-sources also for root directory -->
<fileset dir="lucene" includes="build.xml" />
<fileset dir="solr" includes="build.xml" />
</subant>
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 8cadf4977e3..d000f4ea9ba 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -236,6 +236,10 @@ Build
project name. This also enforces UTF-8 encoding when files are copied with
filtering.
+* LUCENE-5055: "rat-sources" target now checks also build.xml, ivy.xml,
+ forbidden-api signatures, and parts of resources folders. (Ryan Ernst,
+ Uwe Schindler)
+
Tests
* LUCENE-4901: TestIndexWriterOnJRECrash should work on any
diff --git a/lucene/analysis/common/build.xml b/lucene/analysis/common/build.xml
index d9f4889caaa..75de0e75524 100644
--- a/lucene/analysis/common/build.xml
+++ b/lucene/analysis/common/build.xml
@@ -25,6 +25,7 @@
<!-- some files for testing that do not have license headers -->
<property name="rat.excludes" value="**/*.aff,**/*.dic,**/*.txt,**/charfilter/*.htm*,**/*LuceneResourcesWikiPage.html"/>
+ <property name="rat.additional-includes" value="src/tools/**"/>
<import file="../analysis-module-build.xml"/>
diff --git a/lucene/analysis/icu/build.xml b/lucene/analysis/icu/build.xml
index fcd9201b5e6..5d3c76db1bd 100644
--- a/lucene/analysis/icu/build.xml
+++ b/lucene/analysis/icu/build.xml
@@ -23,6 +23,8 @@
Analysis integration with ICU (International Components for Unicode).
</description>
+ <property name="rat.additional-includes" value="src/tools/**"/>
+
<import file="../analysis-module-build.xml"/>
<path id="icujar">
@@ -59,7 +61,7 @@
<property name="gennorm2.src.files"
value="nfc.txt nfkc.txt nfkc_cf.txt BasicFoldings.txt DiacriticFolding.txt DingbatFolding.txt HanRadicalFolding.txt NativeDigitFolding.txt"/>
<property name="gennorm2.tmp" value="${build.dir}/gennorm2/utr30.tmp"/>
- <property name="gennorm2.dst" value="src/resources/org/apache/lucene/analysis/icu/utr30.nrm"/>
+ <property name="gennorm2.dst" value="${resources.dir}/org/apache/lucene/analysis/icu/utr30.nrm"/>
<target name="gennorm2" depends="gen-utr30-data-files">
<echo>Note that the gennorm2 and icupkg tools must be on your PATH. These tools
are part of the ICU4C package. See http://site.icu-project.org/ </echo>
@@ -82,7 +84,7 @@ are part of the ICU4C package. See http://site.icu-project.org/ </echo>
</target>
<property name="rbbi.src.dir" location="src/data/uax29"/>
- <property name="rbbi.dst.dir" location="src/resources/org/apache/lucene/analysis/icu/segmentation"/>
+ <property name="rbbi.dst.dir" location="${resources.dir}/org/apache/lucene/analysis/icu/segmentation"/>
<target name="genrbbi" depends="compile-tools">
<mkdir dir="${rbbi.dst.dir}"/>
diff --git a/lucene/analysis/kuromoji/build.xml b/lucene/analysis/kuromoji/build.xml
index 7ec776b8901..2428bac1f2a 100644
--- a/lucene/analysis/kuromoji/build.xml
+++ b/lucene/analysis/kuromoji/build.xml
@@ -26,6 +26,7 @@
<!-- currently whether rat detects this as binary or not
is platform dependent?! -->
<property name="rat.excludes" value="**/*.txt,**/bocchan.utf-8"/>
+ <property name="rat.additional-includes" value="src/tools/**"/>
<!-- we don't want to pull in ipadic/naist etc -->
<property name="ivy.default.configuration" value="default"/>
@@ -45,7 +46,7 @@
<property name="dict.encoding" value="euc-jp"/>
<property name="dict.format" value="ipadic"/>
<property name="dict.normalize" value="false"/>
- <property name="dict.target.dir" location="./src/resources"/>
+ <property name="dict.target.dir" location="${resources.dir}"/>
<available type="dir" file="${build.dir}/${ipadic.version}" property="dict.available"/>
@@ -83,7 +84,7 @@
<target name="build-dict" depends="compile-tools, download-dict">
<sequential>
<delete verbose="true">
- <fileset dir="src/resources/org/apache/lucene/analysis/ja/dict" includes="**/*"/>
+ <fileset dir="${resources.dir}/org/apache/lucene/analysis/ja/dict" includes="**/*"/>
</delete>
<!-- TODO: optimize the dictionary construction a bit so that you don't need 1G -->
<java fork="true" failonerror="true" maxmemory="1g" classname="org.apache.lucene.analysis.ja.util.DictionaryBuilder">
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index e08ee519f0b..0aeba453a87 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -186,6 +186,7 @@
<property name="build.encoding" value="utf-8"/>
<property name="src.dir" location="src/java"/>
+ <property name="resources.dir" location="${src.dir}/../resources"/>
<property name="tests.src.dir" location="src/test"/>
<available property="module.has.tests" type="dir" file="${tests.src.dir}"/>
<property name="build.dir" location="build"/>
@@ -255,6 +256,8 @@
<!-- a reasonable default exclusion set, can be overridden for special cases -->
<property name="rat.excludes" value="**/TODO,**/*.txt,**/*.iml"/>
+ <!-- This pattern can be defined to add additional files for checks, relative to module's home dir -->
+ <property name="rat.additional-includes" value=""/>
<propertyset id="uptodate.and.compiled.properties" dynamic="true">
<propertyref regex=".*\.uptodate$$"/>
@@ -489,7 +492,7 @@
<!-- Copy the resources folder (if existent) -->
<copy todir="${build.dir}/classes/java">
- <fileset dir="${src.dir}/../resources" erroronmissingdir="no"/>
+ <fileset dir="${resources.dir}" erroronmissingdir="no"/>
</copy>
</target>
@@ -1339,7 +1342,7 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
<sequential>
<mkdir dir="${build.dir}" />
<jarify basedir="${src.dir}" destfile="${build.dir}/${final.name}-src.jar">
- <fileset dir="${src.dir}/../resources" erroronmissingdir="no"/>
+ <fileset dir="${resources.dir}" erroronmissingdir="no"/>
</jarify>
</sequential>
</target>
@@ -1515,7 +1518,6 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
<target name="rat-sources" depends="rat-sources-typedef"
description="runs the tasks over source and test files">
- <sequential>
<!-- create a temp file for the log to go to -->
<tempfile property="rat.sources.logfile"
prefix="rat"
@@ -1523,11 +1525,12 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
<!-- run rat, going to the file -->
<rat:report xmlns:rat="antlib:org.apache.rat.anttasks"
reportFile="${rat.sources.logfile}">
- <fileset dir="${src.dir}" excludes="${rat.excludes}"/>
+ <fileset dir="." includes="*.xml ${rat.additional-includes}"/>
+ <fileset dir="${src.dir}" excludes="${rat.excludes}" erroronmissingdir="false"/>
<fileset dir="${tests.src.dir}" excludes="${rat.excludes}" erroronmissingdir="false"/>
- <!-- some modules have a src/tools/[java,test] -->
- <fileset dir="src/tools/java" excludes="${rat.excludes}" erroronmissingdir="false"/>
- <fileset dir="src/tools/test" excludes="${rat.excludes}" erroronmissingdir="false"/>
+
+ <!-- TODO: Check all resource files. Currently not all stopword and similar files have no header! -->
+ <fileset dir="${resources.dir}" includes="META-INF/**" erroronmissingdir="false"/>
<!-- bsd-like stuff -->
<rat:substringMatcher licenseFamilyCategory="BSD "
@@ -1594,7 +1597,6 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
<available file="${rat.sources.logfile}"/>
</condition>
</fail>
- </sequential>
</target>
<!--+
diff --git a/lucene/demo/build.xml b/lucene/demo/build.xml
index b1cd4b48410..074601aac24 100644
--- a/lucene/demo/build.xml
+++ b/lucene/demo/build.xml
@@ -58,7 +58,7 @@
<echo>Compiling XML QueryParser Demo WAR</echo>
<war destfile="${build.dir}/lucene-xml-query-demo.war" webxml="src/resources/org/apache/lucene/demo/xmlparser/WEB-INF/web.xml">
- <fileset dir="src/resources/org/apache/lucene/demo/xmlparser/"/>
+ <fileset dir="${resources.dir}/org/apache/lucene/demo/xmlparser/"/>
<lib dir="${build.dir}">
<include name="${final.name}.jar"/>
</lib>
diff --git a/lucene/join/build.xml b/lucene/join/build.xml
index 1cb7133c73b..80d384cbec1 100644
--- a/lucene/join/build.xml
+++ b/lucene/join/build.xml
@@ -1,4 +1,22 @@
<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
<project name="join" default="default">
<description>
Index-time and Query-time joins for normalized content
diff --git a/lucene/spatial/build.xml b/lucene/spatial/build.xml
index 37505e60d75..463ae433237 100644
--- a/lucene/spatial/build.xml
+++ b/lucene/spatial/build.xml
@@ -1,4 +1,22 @@
<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
<project name="spatial" default="default">
<description>
Geospatial search
diff --git a/lucene/tools/build.xml b/lucene/tools/build.xml
index 35310bc1f2b..462bf381ec6 100644
--- a/lucene/tools/build.xml
+++ b/lucene/tools/build.xml
@@ -21,6 +21,9 @@
<description>Lucene Tools</description>
<property name="build.dir" location="../build/tools"/>
+
+ <!-- TODO: Add prettify ASF license header. Currently they have no header because they were compressed without License header! -->
+ <property name="rat.additional-includes" value="forbiddenApis/**"/>
<import file="../common-build.xml"/>
diff --git a/lucene/tools/custom-tasks.xml b/lucene/tools/custom-tasks.xml
index 074059b27d0..a0e175a48ed 100644
--- a/lucene/tools/custom-tasks.xml
+++ b/lucene/tools/custom-tasks.xml
@@ -1,4 +1,21 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
<project name="custom-tasks">
<description>
This file is designed for importing into a main build file, and not intended