build.xml revision 4b08e2231abb7a3b44ab9255eca7963e6309aba4
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeCDDL HEADER START
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeThe contents of this file are subject to the terms of the
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeCommon Development and Distribution License (the "License").
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeYou may not use this file except in compliance with the License.
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeSee LICENSE.txt included in this distribution for the specific
64b763950bf11e9357facbd2b5666631a895c085Trond Norbyelanguage governing permissions and limitations under the License.
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeWhen distributing Covered Code, include this CDDL HEADER in each
64b763950bf11e9357facbd2b5666631a895c085Trond Norbyefile and include the License file at LICENSE.txt.
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeIf applicable, add the following below this CDDL HEADER, with the
64b763950bf11e9357facbd2b5666631a895c085Trond Norbyefields enclosed by brackets "[]" replaced with your own identifying
64b763950bf11e9357facbd2b5666631a895c085Trond Norbyeinformation: Portions Copyright [yyyy] [name of copyright owner]
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeCDDL HEADER END
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeCopyright 2007 Sun Microsystems, Inc. All rights reserved.
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeUse is subject to license terms.
cf1f7b5e81583dfca30972cfef322266a6928e7fKnut Anders Hatlen<project name="OpenGrok" default="jar" basedir=".">
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <description>Builds, tests, and runs the project opengrok.</description>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <import file="nbproject/profiler-build-impl.xml"/> <!--
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye There exist several targets which are by default empty and which can be
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye used for execution of your tasks. These targets are usually executed
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye before and after some main targets. They are:
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -pre-init: called before initialization of project properties
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -post-init: called after initialization of project properties
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -pre-compile: called before javac compilation
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -post-compile: called after javac compilation
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -pre-compile-single: called before javac compilation of single file
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -post-compile-single: called after javac compilation of single file
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -pre-compile-test: called before javac compilation of JUnit tests
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -post-compile-test: called after javac compilation of JUnit tests
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -pre-compile-test-single: called before javac compilation of single JUnit test
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -post-compile-test-single: called after javac compilation of single JUunit test
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -pre-jar: called before JAR building
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -post-jar: called after JAR building
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -post-clean: called after cleaning build products
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye (Targets beginning with '-' are not intended to be called on their own.)
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye Example of inserting an obfuscator after compilation could look like this:
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <target name="-post-compile">
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <fileset dir="${build.classes.dir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye </obfuscate>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye For list of available properties check the imported
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye Another way to customize the build is by overriding existing main targets.
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye The targets of interest are:
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -init-macrodef-javac: defines macro for javac compilation
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -init-macrodef-junit: defines macro for junit execution
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -init-macrodef-debug: defines macro for class debugging
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -init-macrodef-java: defines macro for class execution
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -do-jar-with-manifest: JAR building (if you are using a manifest)
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -do-jar-without-manifest: JAR building (if you are not using a manifest)
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye run: execution of project
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -javadoc-build: Javadoc generation
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye test-report: JUnit report generation
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye An example of overriding the target for project execution could look like this:
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <target name="run" depends="opengrok-impl.jar">
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <exec dir="bin" executable="launcher.exe">
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <arg file="${dist.jar}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye Notice that the overridden target depends on the jar target and not only on
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye the compile target as the regular run target does. Again, for a list of available
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye properties which you can use, check the target you are overriding in the
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <property name="distname" value="opengrok"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <property name="findbugs.home" value="${user.home}/.ant/lib/findbugs"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <property name="checkstyle.home" value="${user.home}/.ant/lib/checkstyle"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <property name="pmd.home" value="${user.home}/.ant/lib/pmd"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <pathelement path="${java.class.path}/findbugs/lib/"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <pathelement path="${java.class.path}/checkstyle/"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <pathelement path="${java.class.path}/pmd/lib/"/>
1ed6b730409d4740e941142599767d5eac7e7d92Lubos Kosco <available file="JFlex.jar" type="file" property="JFlex.present">
1ed6b730409d4740e941142599767d5eac7e7d92Lubos Kosco </available>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <fail unless="JFlex.present" message="Please download JFlex (http://jflex.de/) and put JFlex.jar it into /lib directory (or in ant classpath)."/>
1ed6b730409d4740e941142599767d5eac7e7d92Lubos Kosco <taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpath="lib/JFlex.jar"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <property name="gensrcdir" value="generatedsrc"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/c/CSymbolTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/c/CXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/java/JavaSymbolTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/java/JavaXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispSymbolTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispXref.lex" destdir="${gensrcdir}"/>
225d5411e0f1f0e690e3553aad7a97c648d566a1HemangLavana <jflex file="src/org/opensolaris/opengrok/analysis/tcl/TclSymbolTokenizer.lex" destdir="${gensrcdir}"/>
225d5411e0f1f0e690e3553aad7a97c648d566a1HemangLavana <jflex file="src/org/opensolaris/opengrok/analysis/tcl/TclXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainFullTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainSymbolTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/plain/XMLXref.lex" destdir="${gensrcdir}"/>
75640e2b0da81c240758d747e76d30acd1ed194dKnut Anders Hatlen <jflex file="src/org/opensolaris/opengrok/analysis/sql/SQLXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/document/TroffXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/document/TroffFullTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/sh/ShSymbolTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/sh/ShXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/search/context/HistoryLineTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/search/context/PlainLineTokenizer.lex" destdir="${gensrcdir}"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye failifexecutionfails="no"
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye outputproperty="changeset">
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <redirector>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <outputfilterchain>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp">
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </filterreader>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <tokenfilter>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <replaceregex pattern="^changeset:[^:]*:" replace=""/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </tokenfilter>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </outputfilterchain>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </redirector>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <target name="-update-build-info" depends="-hg-get-changeset">
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <mkdir dir="${build.classes.dir}/org/opensolaris/opengrok"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <propertyfile
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye file="${build.classes.dir}/org/opensolaris/opengrok/info.properties">
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </propertyfile>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <property name="coverage.dir" value="${basedir}/coverage"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen Create an empty manifest file so that nbproject/build-impl.xml
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen notices that a manifest should be added to the jar file
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <!-- no attributes, main-class and class-path will be added later -->
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <manifest file="manifest.mf" mode="replace"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <target name="-pre-init" depends="-touch-manifest"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen Initialize a property holding a list of jar files on which
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <pathconvert property="opengrok.lib.files" pathsep=" ">
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen <flattenmapper/>
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen </pathconvert>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <!-- Update the manifest file with a classpath attribute -->
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <target name="-update-manifest-classpath">
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <manifest file="${manifest.file}" mode="update">
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <attribute name="Class-Path" value="${opengrok.lib.files}"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <target name="-pre-jar" depends="-update-manifest-classpath,-update-build-info"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen Copy the jars from lib to dist/lib manually if we don't have
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen the copylibs task from NetBeans
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <target name="-copy-lib-without-netbeans"
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen unless="manifest.available+main.class+mkdist.available">
9661674ed58ba62a40e43d1a4b38d5e77c3c6545Knut Anders Hatlen <fileset file="${file.reference.ant.jar}"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <fileset dir="." includes="${opengrok.lib.files}"/>
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen <target name="-post-jar" depends="-copy-lib-without-netbeans">
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <war destfile="${dist.war}" webxml="conf/web.xml">
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <lib dir="${dist.dir}" includes="opengrok.jar"/>
9794eb72d2b2da2812cdba67562851047cce4600Trond Norbye <lib dir="${dist.dir}/lib" includes="*.jar" excludes="servlet-api.jar,svn-javahl.jar"/>
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye <java classname="org.opensolaris.opengrok.index.CommandLineOptions"
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye output="${dist.dir}/opengrok.1" failonerror="true" fork="true">
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye </classpath>
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen <exec os="SunOS" executable="/usr/bin/pkgmk">
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen <arg line="-o -d build -r . -v ${version} -f pkgdef/prototype"/>
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen <exec os="SunOS" executable="/usr/bin/pkgtrans">
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen <arg line="-s build /dist/OSOLopengrok-${version}.pkg OSOLopengrok"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <tar destfile="${dist.dir}/${distname}-${version}.tar.gz"
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen compression="gzip">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <tarfileset dir="." prefix="${distname}-${version}">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <tarfileset dir="." prefix="${distname}-${version}" mode="755">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <tarfileset dir="doc" prefix="${distname}-${version}">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <tarfileset dir="${dist.dir}" prefix="${distname}-${version}">
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen <arg value="${dist.dir}/${distname}-${version}-src.tar.gz"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <target name="-check_findbugs" description="Check that findbugs jar files are present">
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <available file="findbugs.jar" type="file" property="findbugs.jar.present">
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <fail unless="findbugs.jar.present" message="Please install Findbugs findbugs.jar in ~/.ant/lib-directory (or in ant classpath) to run Findbugs, see README"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <available file="findbugs-ant.jar" type="file" property="findbugs-ant.jar.present">
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <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"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <target name="findbugs" depends="dist, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate HTML output">
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <findbugs projectname="OpenGrok" home="${findbugs.home}" output="html" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.html" jvmargs="-Xmx512m">
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik <auxClasspath>
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik </auxClasspath>
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik <class location="${dist.dir}/opengrok.jar" />
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <target name="findbugs-xml" depends="dist, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate XML output">
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <findbugs projectname="OpenGrok" home="${findbugs.home}" output="xml" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.xml" jvmargs="-Xmx512m">
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye <auxClasspath>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye </auxClasspath>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <target name="-check_checkstyle" description="Check that checkstyle jar files are present">
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <available file="checkstyle-all.jar" type="file" property="checkstyle.jar.present">
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <filepath refid="checkstyle.lib.search.path"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <fail unless="checkstyle.jar.present" message="Please install checkstyle-all.jar in lib-directory (or in ant classpath) to run Checkstyle, see README."/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <target name="checkstyle" depends="compile, -check_checkstyle" description="Run checkstyle on OpenGrok source code">
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <taskdef resource="checkstyletask.properties" classpath="${checkstyle.home}/checkstyle-all.jar"/>
45cf976b01987ad147e9edb54ffab0938dd6c016Trond Norbye <checkstyle config="checkstyle/style.xml" failOnViolation="false">
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <formatter type="plain" toFile="checkstyle/checkstyle_errors.txt"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <formatter type="xml" toFile="checkstyle/checkstyle_errors.xml"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik </checkstyle>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <target name="-check_pmd" description="Check that pmd jar files are present">
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <available file="pmd.jar" type="file" property="pmd.jar.present">
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <fail unless="pmd.jar.present" message="Please install pmd.jar in lib-directory (or in ant classpath) to run PMD, see README."/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <target name="pmd" depends="compile, -check_pmd" description="Run PMD on OpenGrok source code">
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <pathelement location="${pmd.home}/lib/pmd.jar"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <pathelement location="${pmd.home}/lib/jaxen.jar"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <pmd shortFilenames="true" targetjdk="1.6" failuresPropertyName="pmd.num.warnings">
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <!-- Enable when we have fever reported warnings -->
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <!-- <ruleset>rulesets/optimizations.xml</ruleset> -->
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <ruleset>rulesets/strictexception.xml</ruleset>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <ruleset>rulesets/typeresolution.xml</ruleset>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <formatter type="html" toFile="pmd/pmd_report.html"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <formatter type="xml" toFile="pmd/pmd_report.xml"/>
b1e0699bbd6ba0934c13d14e2e656b26a4e0fa62Jorgen Austvik <echo message="PMD finished, found ${pmd.num.warnings} warnings, see pmd/pmd_report.html."/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <target name="-check_emma" description="Check that emma jar files are present">
f09d46eefeb5e4db6dc11e02e417b448fa9362a9Jorgen Austvik <available file="emma.jar" type="file" property="emma.jar.present">
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <fail unless="emma.jar.present" message="Please install emma.jar in lib-directory (or in ant classpath) to run Emma, see README."/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <available file="emma_ant.jar" type="file" property="emma_ant.jar.present">
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <fail unless="emma_ant.jar.present" message="Please install emma_ant.jar in lib-directory (or in ant classpath) to run Emma, see README."/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <target name="emma-instrument" depends="compile, -check_emma" description="Instruments the source code for Emma code coverage analysis">
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik metadatafile="${coverage.dir}/coverage.em"
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik mode="overwrite"
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <property name="test-sys-prop.emma.coverage.out.file" value="${coverage.dir}/coverage.ec"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <property name="test-sys-prop.emma.coverage.out.merge" value="true"/>
49180e08afc7cf03413ab108bc71c14e9de1a880Jorgen Austvik <!-- Generate ZIP files used for unit testing -->
9a1e70e767e0c59951953549dbb20c4d47901840Jorgen Austvik <zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/index/source.zip" basedir="testdata/sources" update="true"/>
9a1e70e767e0c59951953549dbb20c4d47901840Jorgen Austvik <zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/history/repositories.zip" basedir="testdata/repositories" update="true"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <target name="emma-report" description="Analyze" depends="-check_emma">
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <!-- collect all EMMA data dumps (metadata and runtime): -->
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <infileset dir="${coverage.dir}" includes="*.em, *.ec"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <txt outfile="${coverage.dir}/coverage.txt"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <xml outfile="${coverage.dir}/coverage.xml"/>
4b08e2231abb7a3b44ab9255eca7963e6309aba4Jorgen Austvik <target name="code-coverage" depends="clean, emma-instrument, test, emma-report" description="Make test code coverage reports based on the OpenGrok unit tests"/>