Add RAT check target
git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1756315 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/build.properties b/build.properties
index 6232286..b9a705f 100644
--- a/build.properties
+++ b/build.properties
@@ -383,3 +383,14 @@
checkstyle-all.jar = checkstyle-${checkstyle-all.version}-all.jar
checkstyle-all.loc = http://downloads.sourceforge.net/checkstyle/checkstyle/${checkstyle-all.version}/checkstyle-${checkstyle-all.version}-all.jar?ts=${EPOCHSECONDS}&use_mirror=autoselect
checkstyle-all.md5 = ac6e1e81d09bcaf4c0c22181e9bda1d9
+
+# Optional for use by rat
+rat.version = 0.12
+rat.jar = apache-rat-${rat.version}.jar
+rat.loc = ${maven2.repo}/org/apache/rat/apache-rat/${rat.version}
+rat.md5 = f4cc7b4de337e9f250a949467c5e1b42
+
+rat-tasks.jar = apache-rat-tasks-${rat.version}.jar
+rat-tasks.loc = ${maven2.repo}/org/apache/rat/apache-rat-tasks/${rat.version}
+rat-tasks.md5 = 96b699581b4475ed5756a0c24af745e8
+
diff --git a/build.xml b/build.xml
index 0eaaa8b..3b19b7c 100644
--- a/build.xml
+++ b/build.xml
@@ -15,7 +15,9 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<project name="JMeter" default="install" basedir=".">
+<project name="JMeter" default="install" basedir="."
+ xmlns:rat="antlib:org.apache.rat.anttasks"
+ xmlns="antlib:org.apache.tools.ant">
<description>
N.B. To build JMeter from a release you need both the binary and source archives,
@@ -899,7 +901,7 @@
<target name="package" depends="compile, prepare-resources, package-only"
description="Compile everything and create the jars"/>
- <target name="package-and-check" depends="clean, package, checkstyle"
+ <target name="package-and-check" depends="clean, package, checkstyle, rat"
description="Compile, create jars and apply checkstyle before commiting code"/>
<target name="prepare-resources"
@@ -3025,6 +3027,11 @@
<process_jarfile jarname="checkstyle-all" dest.dir="${lib.opt}"/>
</target>
+ <target name="_process_rat_jars">
+ <process_jarfile jarname="rat" dest.dir="${lib.opt}"/>
+ <process_jarfile jarname="rat-tasks" dest.dir="${lib.opt}"/>
+ </target>
+
<!-- Update a jar (clean, download, package in one shot.-->
<target name="update_jar" depends="clean, download_jars, package">
</target>
@@ -3068,6 +3075,14 @@
</antcall>
</target>
+ <target name="download_rat">
+ <!-- build.dir may be needed as a temporary work area -->
+ <mkdir dir="${build.dir}" />
+ <antcall target="_process_rat_jars">
+ <param name="_get_file" value="true"/>
+ </antcall>
+ </target>
+
<target name="_check_exists" if="_check_exists">
<fail message="Invalid call sequence - file.exists should not be defined" if="file.exists"/>
<available file="${file}" property="file.exists"/>
@@ -3143,6 +3158,32 @@
</target>
+ <target name="rat">
+ <available property="rat.jar.available" file="${lib.opt}/apache-rat-tasks-${rat.version}.jar"/>
+ <fail message="This task requires Apache Creadur RAT, please run download_rat target to download it" unless="rat.jar.available"/>
+ <taskdef
+ uri="antlib:org.apache.rat.anttasks"
+ resource="org/apache/rat/anttasks/antlib.xml">
+ <classpath>
+ <pathelement location="${lib.opt}/apache-rat-${rat.version}.jar"/>
+ <pathelement location="${lib.opt}/apache-rat-tasks-${rat.version}.jar"/>
+ <!--pathelement location="${lib.dir}/${commons-io.jar}"/-->
+ </classpath>
+ </taskdef>
+ <rat:report reportfile="reports/rat-report.txt">
+ <fileset dir="." excludesfile="rat-excludes.txt"/>
+ </rat:report>
+ <loadfile property="rat-errors" srcFile="reports/rat-report.txt">
+ <filterchain>
+ <linecontains>
+ <contains value="Unknown"/>
+ </linecontains>
+ </filterchain>
+ </loadfile>
+ <echo message="reports/rat-report.txt:"/>
+ <echo message="${rat-errors}"/>
+ </target>
+
<target name="sign_dist"
description="Sign release artifacts in dist and dist/maven. Usage: ant sign_dist -Dgpg.keyname=key-id [-Dgpg.secretKeyring=path-to-keyring] ">
<scriptdef name="gpg" language="beanshell">