build.xml revision 9a1e70e767e0c59951953549dbb20c4d47901840
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenCDDL HEADER START
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenThe contents of this file are subject to the terms of the
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenCommon Development and Distribution License (the "License").
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenYou may not use this file except in compliance with the License.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenSee LICENSE.txt included in this distribution for the specific
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersenlanguage governing permissions and limitations under the License.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenWhen distributing Covered Code, include this CDDL HEADER in each
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersenfile and include the License file at LICENSE.txt.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenIf applicable, add the following below this CDDL HEADER, with the
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersenfields enclosed by brackets "[]" replaced with your own identifying
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gunderseninformation: Portions Copyright [yyyy] [name of copyright owner]
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenCDDL HEADER END
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenCopyright 2007 Sun Microsystems, Inc. All rights reserved.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenUse is subject to license terms.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen<project name="OpenGrok" default="jar" basedir=".">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <description>Builds, tests, and runs the project opengrok.</description>
f5be560181d092c5f52a2b819aedcd48220f36abTom Gundersen <import file="nbproject/profiler-build-impl.xml"/> <!--
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen There exist several targets which are by default empty and which can be
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen used for execution of your tasks. These targets are usually executed
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen before and after some main targets. They are:
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen -pre-init: called before initialization of project properties
06f021a8048583d66202e3ac5cd0a12386d33ac2Tom Gundersen -post-init: called after initialization of project properties
2cc412b59353576cece2d5b30c6a39c70552f0a0Tom Gundersen -pre-compile: called before javac compilation
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen -post-compile: called after javac compilation
aba496a58acf9d9c61314de71353550e579f85eeUmut Tezduyar Lindskog -pre-compile-single: called before javac compilation of single file
aba496a58acf9d9c61314de71353550e579f85eeUmut Tezduyar Lindskog -post-compile-single: called after javac compilation of single file
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen -pre-compile-test: called before javac compilation of JUnit tests
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen -post-compile-test: called after javac compilation of JUnit tests
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen -pre-compile-test-single: called before javac compilation of single JUnit test
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen -post-compile-test-single: called after javac compilation of single JUunit test
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen -pre-jar: called before JAR building
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen -post-jar: called after JAR building
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen -post-clean: called after cleaning build products
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen (Targets beginning with '-' are not intended to be called on their own.)
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen Example of inserting an obfuscator after compilation could look like this:
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <target name="-post-compile">
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <fileset dir="${build.classes.dir}"/>
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen For list of available properties check the imported
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen Another way to customize the build is by overriding existing main targets.
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen The targets of interest are:
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen -init-macrodef-javac: defines macro for javac compilation
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen -init-macrodef-junit: defines macro for junit execution
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen -init-macrodef-debug: defines macro for class debugging
54abf461d6b10dc270c4bb2aeac65f240ff1c5cdTom Gundersen -init-macrodef-java: defines macro for class execution
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen -do-jar-with-manifest: JAR building (if you are using a manifest)
7951dea20911969287878e6897b3eca348721adeSusant Sahani -do-jar-without-manifest: JAR building (if you are not using a manifest)
7951dea20911969287878e6897b3eca348721adeSusant Sahani run: execution of project
7951dea20911969287878e6897b3eca348721adeSusant Sahani -javadoc-build: Javadoc generation
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen test-report: JUnit report generation
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen An example of overriding the target for project execution could look like this:
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen <target name="run" depends="opengrok-impl.jar">
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen <exec dir="bin" executable="launcher.exe">
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen <arg file="${dist.jar}"/>
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen Notice that the overridden target depends on the jar target and not only on
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen the compile target as the regular run target does. Again, for a list of available
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen properties which you can use, check the target you are overriding in the
edbb03e95a3c31bf719d5c6c46eec14d0bcb9c8fTom Gundersen <property name="findbugs.home" value="${user.home}/.ant/lib/findbugs"/>
edbb03e95a3c31bf719d5c6c46eec14d0bcb9c8fTom Gundersen <property name="checkstyle.home" value="${user.home}/.ant/lib/checkstyle"/>
edbb03e95a3c31bf719d5c6c46eec14d0bcb9c8fTom Gundersen <property name="pmd.home" value="${user.home}/.ant/lib/pmd"/>
54abf461d6b10dc270c4bb2aeac65f240ff1c5cdTom Gundersen <pathelement path="${java.class.path}/findbugs/lib/"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani <pathelement path="${java.class.path}/checkstyle/"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <pathelement path="${java.class.path}/pmd/lib/"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <available file="JFlex.jar" type="file" property="JFlex.present">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <fail unless="JFlex.present" message="Please download JFlex (http://jflex.de/) and put JFlex.jar it into /lib directory (or in ant classpath)."/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpath="lib/JFlex.jar"/>
2cc412b59353576cece2d5b30c6a39c70552f0a0Tom Gundersen <property name="gensrcdir" value="generatedsrc"/>
edbb03e95a3c31bf719d5c6c46eec14d0bcb9c8fTom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/c/CSymbolTokenizer.lex" destdir="${gensrcdir}"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/c/CXref.lex" destdir="${gensrcdir}"/>
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/java/JavaSymbolTokenizer.lex" destdir="${gensrcdir}"/>
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/java/JavaXref.lex" destdir="${gensrcdir}"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispSymbolTokenizer.lex" destdir="${gensrcdir}"/>
672682a6b9d6fb6a3722c3fea1a93b4831747b54Tom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispXref.lex" destdir="${gensrcdir}"/>
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/tcl/TclSymbolTokenizer.lex" destdir="${gensrcdir}"/>
f5be560181d092c5f52a2b819aedcd48220f36abTom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/tcl/TclXref.lex" destdir="${gensrcdir}"/>
5be4d38e31281727b6f45ae869136bb01a1f7790Tom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainFullTokenizer.lex" destdir="${gensrcdir}"/>
4f882b2a5007e51032459e29d15a86df6b5ea9f4Tom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainSymbolTokenizer.lex" destdir="${gensrcdir}"/>
1346b1f0388f4100bb3c2a2bb23bc881769c020cTom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
039ebe6aebaebcaa18375b33caf1db5fe2551621Tom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/plain/XMLXref.lex" destdir="${gensrcdir}"/>
eb27aeca247a4cf8816fffc4c0dbcab55ead3864Tom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/sql/SQLXref.lex" destdir="${gensrcdir}"/>
5c1d3fc93d91384bbac29adf01074fa4375317eaUmut Tezduyar Lindskog <jflex file="src/org/opensolaris/opengrok/analysis/document/TroffXref.lex" destdir="${gensrcdir}"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/document/TroffFullTokenizer.lex" destdir="${gensrcdir}"/>
f048a16b464295a4e0a4f4c1210f06343ad31231Tom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/sh/ShSymbolTokenizer.lex" destdir="${gensrcdir}"/>
f048a16b464295a4e0a4f4c1210f06343ad31231Tom Gundersen <jflex file="src/org/opensolaris/opengrok/analysis/sh/ShXref.lex" destdir="${gensrcdir}"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <jflex file="src/org/opensolaris/opengrok/search/context/HistoryLineTokenizer.lex" destdir="${gensrcdir}"/>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <jflex file="src/org/opensolaris/opengrok/search/context/PlainLineTokenizer.lex" destdir="${gensrcdir}"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen failifexecutionfails="no"
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen outputproperty="changeset">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <outputfilterchain>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp">
5c1d3fc93d91384bbac29adf01074fa4375317eaUmut Tezduyar Lindskog <param type="regexp" value="^changeset:"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </filterreader>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <tokenfilter>
eb0ea358b688a6f83ff305c6b825c61f12b6dcb8Tom Gundersen <replaceregex pattern="^changeset:[^:]*:" replace=""/>
8cd11a0f0f4ca05199e1166f6a07472b296f7455Tom Gundersen </outputfilterchain>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </redirector>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <target name="-update-build-info" depends="-hg-get-changeset">
3d3d425547a3f38473fcf8737b85dfebb630479dTom Gundersen <mkdir dir="${build.classes.dir}/org/opensolaris/opengrok"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <propertyfile
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen file="${build.classes.dir}/org/opensolaris/opengrok/info.properties">
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen </propertyfile>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <property name="coverage.dir" value="${basedir}/coverage"/>
5c1d3fc93d91384bbac29adf01074fa4375317eaUmut Tezduyar Lindskog <target name="-pre-compile" depends="jflex"/>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen Create an empty manifest file so that nbproject/build-impl.xml
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen notices that a manifest should be added to the jar file
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <!-- no attributes, main-class and class-path will be added later -->
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen <target name="-pre-init" depends="-touch-manifest"/>
ef1ba6065c6ccea94d4ee867f36df7bbc53a5224Tom Gundersen Initialize a property holding a list of jar files on which
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen <pathconvert property="opengrok.lib.files" pathsep=" ">
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen <flattenmapper/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </pathconvert>
14b746f72132324e637c4e39694bd474f85e19f7Tom Gundersen <!-- Update the manifest file with a classpath attribute -->
0617ffabe86a6d366252477eafbe59a888b149d4Tom Gundersen <manifest file="${manifest.file}" mode="update">
c166a070553511e402de5ad216d3fb62b49bdacbTom Gundersen <attribute name="Class-Path" value="${opengrok.lib.files}"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <target name="-pre-jar" depends="-update-manifest-classpath,-update-build-info"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen Copy the jars from lib to dist/lib manually if we don't have
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen the copylibs task from NetBeans
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen unless="manifest.available+main.class+mkdist.available">
a6cc569e33a05b07550c6c7b4d67d83d868f8bc1Tom Gundersen <fileset dir="." includes="${opengrok.lib.files}"/>
5c1d3fc93d91384bbac29adf01074fa4375317eaUmut Tezduyar Lindskog <target name="-post-jar" depends="-copy-lib-without-netbeans">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <war destfile="${dist.war}" webxml="conf/web.xml">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <lib dir="${dist.dir}" includes="opengrok.jar"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <lib dir="${dist.dir}/lib" includes="*.jar" excludes="servlet-api.jar,svn-javahl.jar"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <java classname="org.opensolaris.opengrok.index.CommandLineOptions"
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen output="${dist.dir}/opengrok.1" failonerror="true" fork="true">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <arg line="-o -d build -r . -v ${version} -f pkgdef/prototype"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <exec os="SunOS" executable="/usr/bin/pkgtrans">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <arg line="-s build /dist/OSOLopengrok-${version}.pkg OSOLopengrok"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <tar destfile="${dist.dir}/${distname}-${version}.tar.gz"
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen compression="gzip">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <tarfileset dir="." prefix="${distname}-${version}">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </tarfileset>
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen <tarfileset dir="." prefix="${distname}-${version}" mode="755">
bbf7c04821a71fec67eaf0e7a34d17afc5913c13Tom Gundersen </tarfileset>
3bef724f7e7f7eaca69881548b06e221b77d7031Tom Gundersen <tarfileset dir="doc" prefix="${distname}-${version}">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </tarfileset>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <tarfileset dir="${dist.dir}" prefix="${distname}-${version}">
2cc7e981af27b12a6a3d4f08728281febeb450c9Tom Gundersen </tarfileset>
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen <arg value="${dist.dir}/${distname}-${version}-src.tar.gz"/>
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen <target name="-check_findbugs" description="Check that findbugs jar files are present">
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen <available file="findbugs.jar" type="file" property="findbugs.jar.present">
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen <fail unless="findbugs.jar.present" message="Please install Findbugs findbugs.jar in ~/.ant/lib-directory (or in ant classpath) to run Findbugs, see README"/>
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <available file="findbugs-ant.jar" type="file" property="findbugs-ant.jar.present">
c0dda18697e0994272c0c9616d36f6777b60e2c7Tom Gundersen <fail unless="findbugs-ant.jar.present" message="Please install Findbugs findbugs-ant.jar in ~/.ant/lib-directory (or in ant classpath) to run Findbugs, see README"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <target name="findbugs" depends="dist, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate HTML output">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <findbugs projectname="OpenGrok" home="${findbugs.home}" output="html" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.html" jvmargs="-Xmx512m">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <auxClasspath>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </auxClasspath>
7951dea20911969287878e6897b3eca348721adeSusant Sahani <target name="findbugs-xml" depends="dist, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate XML output">
7951dea20911969287878e6897b3eca348721adeSusant Sahani <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani <findbugs projectname="OpenGrok" home="${findbugs.home}" output="xml" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.xml" jvmargs="-Xmx512m">
7951dea20911969287878e6897b3eca348721adeSusant Sahani <auxClasspath>
7951dea20911969287878e6897b3eca348721adeSusant Sahani </auxClasspath>
7951dea20911969287878e6897b3eca348721adeSusant Sahani <target name="-check_checkstyle" description="Check that checkstyle jar files are present">
7951dea20911969287878e6897b3eca348721adeSusant Sahani <available file="checkstyle-all.jar" type="file" property="checkstyle.jar.present">
7951dea20911969287878e6897b3eca348721adeSusant Sahani <filepath refid="checkstyle.lib.search.path"/>
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <fail unless="checkstyle.jar.present" message="Please install checkstyle-all.jar in lib-directory (or in ant classpath) to run Checkstyle, see README."/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <target name="checkstyle" depends="compile, -check_checkstyle" description="Run checkstyle on OpenGrok source code">
f048a16b464295a4e0a4f4c1210f06343ad31231Tom Gundersen <taskdef resource="checkstyletask.properties" classpath="${checkstyle.home}/checkstyle-all.jar"/>
f048a16b464295a4e0a4f4c1210f06343ad31231Tom Gundersen <checkstyle config="checkstyle/style.xml" failOnViolation="false">
5c1d3fc93d91384bbac29adf01074fa4375317eaUmut Tezduyar Lindskog <formatter type="plain" toFile="checkstyle/checkstyle_errors.txt"/>
5c1d3fc93d91384bbac29adf01074fa4375317eaUmut Tezduyar Lindskog <formatter type="xml" toFile="checkstyle/checkstyle_errors.xml"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </checkstyle>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <target name="-check_pmd" description="Check that pmd jar files are present">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <available file="pmd.jar" type="file" property="pmd.jar.present">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <fail unless="pmd.jar.present" message="Please install pmd.jar in lib-directory (or in ant classpath) to run PMD, see README."/>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <target name="pmd" depends="compile, -check_pmd" description="Run PMD on OpenGrok source code">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <pathelement location="${pmd.home}/lib/pmd.jar"/>
f048a16b464295a4e0a4f4c1210f06343ad31231Tom Gundersen <pathelement location="${pmd.home}/lib/jaxen.jar"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib"/>
aba496a58acf9d9c61314de71353550e579f85eeUmut Tezduyar Lindskog <pmd shortFilenames="true" targetjdk="1.6" failuresPropertyName="pmd.num.warnings">
71a6151083d842b2f5bf04e50239f0bf85d34d2eTom Gundersen <!-- Enable when we have fever reported warnings -->
71a6151083d842b2f5bf04e50239f0bf85d34d2eTom Gundersen <!-- <ruleset>rulesets/optimizations.xml</ruleset> -->
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <ruleset>rulesets/strictexception.xml</ruleset>
eb0ea358b688a6f83ff305c6b825c61f12b6dcb8Tom Gundersen <ruleset>rulesets/typeresolution.xml</ruleset>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <formatter type="html" toFile="pmd/pmd_report.html"/>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <formatter type="xml" toFile="pmd/pmd_report.xml"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <echo message="PMD finished, found ${pmd.num.warnings} warnings, see pmd/pmd_report.html."/>
14b746f72132324e637c4e39694bd474f85e19f7Tom Gundersen <target name="-check_emma" description="Check that emma jar files are present">
11a7f22939d21558df919cab44b8fbe36ab5dae0Tom Gundersen <available file="emma.jar" type="file" property="emma.jar.present">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <fail unless="emma.jar.present" message="Please install emma.jar in lib-directory (or in ant classpath) to run Emma, see README."/>
fbbeb65a93e2f90f6576001b69def877cd98722dTom Gundersen <available file="emma_ant.jar" type="file" property="emma_ant.jar.present">
505f8da7325591defe5f751f328bd26915267602Tom Gundersen <fail unless="emma_ant.jar.present" message="Please install emma_ant.jar in lib-directory (or in ant classpath) to run Emma, see README."/>
bbf7c04821a71fec67eaf0e7a34d17afc5913c13Tom Gundersen <target name="emma-instrument" depends="compile, -check_emma" description="Instruments the source code for Emma code coverage analysis">
14b746f72132324e637c4e39694bd474f85e19f7Tom Gundersen <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
3333d748facc15f49935b6b793490ba0824976e6Zbigniew Jędrzejewski-Szmek <instr instrpath="build/classes"
3333d748facc15f49935b6b793490ba0824976e6Zbigniew Jędrzejewski-Szmek metadatafile="${coverage.dir}/coverage.em"
987efa17dd5c9be156d8f49ddd942df20a72dcb1Tom Gundersen mode="overwrite"
39032b87779323a244dd89f4832949d462b2ac68Zbigniew Jędrzejewski-Szmek <target name="-pre-compile-test">
3333d748facc15f49935b6b793490ba0824976e6Zbigniew Jędrzejewski-Szmek <property name="test-sys-prop.emma.coverage.out.file" value="${coverage.dir}/coverage.ec"/>
3333d748facc15f49935b6b793490ba0824976e6Zbigniew Jędrzejewski-Szmek <property name="test-sys-prop.emma.coverage.out.merge" value="true"/>
3333d748facc15f49935b6b793490ba0824976e6Zbigniew Jędrzejewski-Szmek <!-- Generate ZIP files used for unit testing -->
3333d748facc15f49935b6b793490ba0824976e6Zbigniew Jędrzejewski-Szmek <zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/index/source.zip" basedir="testdata/sources" update="true"/>
987efa17dd5c9be156d8f49ddd942df20a72dcb1Tom Gundersen <zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/history/repositories.zip" basedir="testdata/repositories" update="true"/>
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen <target name="emma-report" description="Analyze" depends="-check_emma">
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
af4e9e2c563047d524b207e0e3d6816385693a16Tom Gundersen <!-- collect all EMMA data dumps (metadata and runtime): -->
3333d748facc15f49935b6b793490ba0824976e6Zbigniew Jędrzejewski-Szmek <infileset dir="${coverage.dir}" includes="*.em, *.ec"/>
628706137efbca8aaf753ccd063e5abf7e31aed5Zbigniew Jędrzejewski-Szmek <xml outfile="${coverage.dir}/coverage.xml"/>
628706137efbca8aaf753ccd063e5abf7e31aed5Zbigniew Jędrzejewski-Szmek <html outfile="${coverage.dir}/index.html"/>