build.xml revision 9a1e70e767e0c59951953549dbb20c4d47901840
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen<?xml version="1.0" encoding="UTF-8"?>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen<!--
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenCDDL HEADER START
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
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 Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenSee LICENSE.txt included in this distribution for the specific
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersenlanguage governing permissions and limitations under the License.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
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 Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenCDDL HEADER END
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenCopyright 2007 Sun Microsystems, Inc. All rights reserved.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom GundersenUse is subject to license terms.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen-->
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen<project name="OpenGrok" default="jar" basedir=".">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <description>Builds, tests, and runs the project opengrok.</description>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <import file="nbproject/build-impl.xml"/>
1346b1f0388f4100bb3c2a2bb23bc881769c020cTom Gundersen
f5be560181d092c5f52a2b819aedcd48220f36abTom Gundersen <import file="nbproject/profiler-build-impl.xml"/> <!--
5c1d3fc93d91384bbac29adf01074fa4375317eaUmut Tezduyar Lindskog
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
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
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen (Targets beginning with '-' are not intended to be called on their own.)
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen Example of inserting an obfuscator after compilation could look like this:
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <target name="-post-compile">
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen <obfuscate>
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <fileset dir="${build.classes.dir}"/>
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen </obfuscate>
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen </target>
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen For list of available properties check the imported
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen nbproject/build-impl.xml file.
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen Another way to customize the build is by overriding existing main targets.
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen The targets of interest are:
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen
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
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen An example of overriding the target for project execution could look like this:
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen
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 </exec>
2cc7e981af27b12a6a3d4f08728281febeb450c9Tom Gundersen </target>
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen
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
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen nbproject/build-impl.xml file.
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen -->
14b746f72132324e637c4e39694bd474f85e19f7Tom Gundersen
14b746f72132324e637c4e39694bd474f85e19f7Tom Gundersen <property name="version" value="0.6.1"/>
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <property name="distname" value="opengrok"/>
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen
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"/>
edbb03e95a3c31bf719d5c6c46eec14d0bcb9c8fTom Gundersen
c0dda18697e0994272c0c9616d36f6777b60e2c7Tom Gundersen <path id="lib.search.path">
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <pathelement path="${user.home}/.ant/lib"/>
af4e9e2c563047d524b207e0e3d6816385693a16Tom Gundersen <pathelement path="${java.class.path}"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani <pathelement path="lib"/>
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen </path>
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen
672682a6b9d6fb6a3722c3fea1a93b4831747b54Tom Gundersen <path id="findbugs.lib.search.path">
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen <pathelement path="${findbugs.home}/lib/"/>
54abf461d6b10dc270c4bb2aeac65f240ff1c5cdTom Gundersen <pathelement path="${java.class.path}/findbugs/lib/"/>
50add2909c2e4b13a04d285b058b1c2270137656Tom Gundersen <pathelement path="lib/findbugs/lib/"/>
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen </path>
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen
7951dea20911969287878e6897b3eca348721adeSusant Sahani <path id="checkstyle.lib.search.path">
7951dea20911969287878e6897b3eca348721adeSusant Sahani <pathelement path="${checkstyle.home}/"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani <pathelement path="${java.class.path}/checkstyle/"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani <pathelement path="lib/checkstyle/lib/"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani </path>
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <path id="pmd.lib.search.path">
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <pathelement path="${pmd.home}/lib/"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <pathelement path="${java.class.path}/pmd/lib/"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <pathelement path="lib/pmd/lib/"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </path>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <available file="JFlex.jar" type="file" property="JFlex.present">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <filepath refid="lib.search.path"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </available>
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
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpath="lib/JFlex.jar"/>
2cc412b59353576cece2d5b30c6a39c70552f0a0Tom Gundersen <property name="gensrcdir" value="generatedsrc"/>
2cc412b59353576cece2d5b30c6a39c70552f0a0Tom Gundersen <target name="jflex">
2cc412b59353576cece2d5b30c6a39c70552f0a0Tom Gundersen <mkdir dir="${gensrcdir}"/>
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}"/>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen </target>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen
06f021a8048583d66202e3ac5cd0a12386d33ac2Tom Gundersen <property name="hg" value="hg"/>
06f021a8048583d66202e3ac5cd0a12386d33ac2Tom Gundersen <target name="-hg-get-changeset">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <exec executable="${hg}"
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen failifexecutionfails="no"
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen outputproperty="changeset">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <arg value="log"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <arg value="-r"/>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <arg value="tip"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <redirector>
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=""/>
aba496a58acf9d9c61314de71353550e579f85eeUmut Tezduyar Lindskog </tokenfilter>
8cd11a0f0f4ca05199e1166f6a07472b296f7455Tom Gundersen </outputfilterchain>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </redirector>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </exec>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </target>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
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">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <entry key="version" value="${version}"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <entry key="changeset" value="${changeset}"/>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen </propertyfile>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </target>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <property name="coverage.dir" value="${basedir}/coverage"/>
5c1d3fc93d91384bbac29adf01074fa4375317eaUmut Tezduyar Lindskog <target name="-pre-compile" depends="jflex"/>
5c1d3fc93d91384bbac29adf01074fa4375317eaUmut Tezduyar Lindskog <target name="-post-clean">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <delete dir="${gensrcdir}"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <delete file="${manifest.file}"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <delete dir="${coverage.dir}"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </target>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <!--
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 -->
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <target name="-touch-manifest">
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <!-- no attributes, main-class and class-path will be added later -->
3d3d425547a3f38473fcf8737b85dfebb630479dTom Gundersen <manifest file="manifest.mf" mode="replace"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </target>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen <target name="-pre-init" depends="-touch-manifest"/>
505f8da7325591defe5f751f328bd26915267602Tom Gundersen
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen <!--
ef1ba6065c6ccea94d4ee867f36df7bbc53a5224Tom Gundersen Initialize a property holding a list of jar files on which
ef1ba6065c6ccea94d4ee867f36df7bbc53a5224Tom Gundersen opengrok.jar depends
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen -->
57bd6899b35b84d1f23809133ae45d29a87b2eaaTom Gundersen <target name="-post-init">
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen <pathconvert property="opengrok.lib.files" pathsep=" ">
370e9930c3260cc58984ec70e44b1e2ab7676496Tom Gundersen <path>
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen <pathelement path="${javac.classpath}"/>
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen </path>
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen <flattenmapper/>
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen <map from="" to="lib/"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </pathconvert>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </target>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
14b746f72132324e637c4e39694bd474f85e19f7Tom Gundersen <!-- Update the manifest file with a classpath attribute -->
14b746f72132324e637c4e39694bd474f85e19f7Tom Gundersen <target name="-update-manifest-classpath">
0617ffabe86a6d366252477eafbe59a888b149d4Tom Gundersen <manifest file="${manifest.file}" mode="update">
c166a070553511e402de5ad216d3fb62b49bdacbTom Gundersen <attribute name="Class-Path" value="${opengrok.lib.files}"/>
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen </manifest>
8cd11a0f0f4ca05199e1166f6a07472b296f7455Tom Gundersen </target>
b5db00e52ee2e20578839e4e4488f7b9af9abc38Umut Tezduyar Lindskog
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <target name="-pre-jar" depends="-update-manifest-classpath,-update-build-info"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
1e9be60bbabe179f5233217384f1daec757c17c7Tom Gundersen <!--
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 -->
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen <target name="-copy-lib-without-netbeans"
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen unless="manifest.available+main.class+mkdist.available">
f5be560181d092c5f52a2b819aedcd48220f36abTom Gundersen <copy todir="${dist.dir}/lib">
f5be560181d092c5f52a2b819aedcd48220f36abTom Gundersen <fileset file="${file.reference.ant.jar}"/>
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen </copy>
f5be560181d092c5f52a2b819aedcd48220f36abTom Gundersen <copy todir="${dist.dir}">
a6cc569e33a05b07550c6c7b4d67d83d868f8bc1Tom Gundersen <fileset dir="." includes="${opengrok.lib.files}"/>
a6cc569e33a05b07550c6c7b4d67d83d868f8bc1Tom Gundersen </copy>
68a8723c8592c06b2c978f391cb47db266d9d6deTom Gundersen </target>
a6cc569e33a05b07550c6c7b4d67d83d868f8bc1Tom Gundersen
5c1d3fc93d91384bbac29adf01074fa4375317eaUmut Tezduyar Lindskog <target name="-post-jar" depends="-copy-lib-without-netbeans">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <war destfile="${dist.war}" webxml="conf/web.xml">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <fileset dir="web"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <fileset dir="conf" excludes="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"/>
1346b1f0388f4100bb3c2a2bb23bc881769c020cTom Gundersen </war>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <echo message="Generating man page.."/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <java classname="org.opensolaris.opengrok.index.CommandLineOptions"
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen output="${dist.dir}/opengrok.1" failonerror="true" fork="true">
0c2f9b84698b25e6065b9febd21486669a13870fTom Gundersen <classpath>
0c2f9b84698b25e6065b9febd21486669a13870fTom Gundersen <pathelement location="dist/opengrok.jar"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <pathelement path="${java.class.path}"/>
bbf7c04821a71fec67eaf0e7a34d17afc5913c13Tom Gundersen </classpath>
bbf7c04821a71fec67eaf0e7a34d17afc5913c13Tom Gundersen </java>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </target>
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <target name="package" depends="jar">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <exec os="SunOS" executable="/usr/bin/pkgmk">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <arg line="-o -d build -r . -v ${version} -f pkgdef/prototype"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani </exec>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <exec os="SunOS" executable="/usr/bin/pkgtrans">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <arg line="-s build /dist/OSOLopengrok-${version}.pkg OSOLopengrok"/>
2ad8416dd057e7e3185169609ca3006e7649f576Zbigniew Jędrzejewski-Szmek </exec>
2ad8416dd057e7e3185169609ca3006e7649f576Zbigniew Jędrzejewski-Szmek </target>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <target name="dist" depends="jar">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <tar destfile="${dist.dir}/${distname}-${version}.tar.gz"
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen compression="gzip">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <tarfileset dir="." prefix="${distname}-${version}">
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <include name="README.txt"/>
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <include name="CHANGES.txt"/>
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <include name="LICENSE.txt"/>
505f8da7325591defe5f751f328bd26915267602Tom Gundersen <include name="paths.tsv"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </tarfileset>
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen <tarfileset dir="." prefix="${distname}-${version}" mode="755">
505f8da7325591defe5f751f328bd26915267602Tom Gundersen <include name="OpenGrok"/>
1346b1f0388f4100bb3c2a2bb23bc881769c020cTom Gundersen <include name="run.sh"/>
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen <include name="run-quiet.sh"/>
3bef724f7e7f7eaca69881548b06e221b77d7031Tom Gundersen <include name="run.bat"/>
bbf7c04821a71fec67eaf0e7a34d17afc5913c13Tom Gundersen </tarfileset>
3bef724f7e7f7eaca69881548b06e221b77d7031Tom Gundersen <tarfileset dir="doc" prefix="${distname}-${version}">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <include name="EXAMPLE.txt"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </tarfileset>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <tarfileset dir="${dist.dir}" prefix="${distname}-${version}">
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen <include name="opengrok.jar"/>
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen <include name="source.war"/>
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen <include name="lib/*"/>
2cc7e981af27b12a6a3d4f08728281febeb450c9Tom Gundersen </tarfileset>
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen </tar>
14b746f72132324e637c4e39694bd474f85e19f7Tom Gundersen </target>
14b746f72132324e637c4e39694bd474f85e19f7Tom Gundersen
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <target name="dist-src" depends="init">
14b746f72132324e637c4e39694bd474f85e19f7Tom Gundersen <mkdir dir="${dist.dir}"/>
14b746f72132324e637c4e39694bd474f85e19f7Tom Gundersen <exec executable="hg">
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <arg value="archive"/>
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen <arg value="-t"/>
d39edfc72f9296078a18014627bf0a2543b60627Tom Gundersen <arg value="tgz"/>
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen <arg value="${dist.dir}/${distname}-${version}-src.tar.gz"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani </exec>
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen </target>
1a436809498faf6486815baa0338fb6b8e5def07Tom Gundersen
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 <filepath refid="findbugs.lib.search.path"/>
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen </available>
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"/>
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen <available file="findbugs-ant.jar" type="file" property="findbugs-ant.jar.present">
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen <filepath refid="findbugs.lib.search.path"/>
fe6b2d55bcb379d01664ed28cea40634cb6b52e3Tom Gundersen </available>
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"/>
c0dda18697e0994272c0c9616d36f6777b60e2c7Tom Gundersen </target>
c0dda18697e0994272c0c9616d36f6777b60e2c7Tom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <target name="findbugs" depends="dist, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate HTML output">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <path id="findbugs.lib" >
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </path>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <mkdir dir="findbugs"/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <findbugs projectname="OpenGrok" home="${findbugs.home}" output="html" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.html" jvmargs="-Xmx512m">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <auxClasspath>
505f8da7325591defe5f751f328bd26915267602Tom Gundersen <fileset dir="${dist.dir}/lib/">
505f8da7325591defe5f751f328bd26915267602Tom Gundersen <include name="*.jar"/>
505f8da7325591defe5f751f328bd26915267602Tom Gundersen </fileset>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </auxClasspath>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <sourcePath path="src" />
69a93e7db47addc4495a6ec9dc0fc74092a6ebeeTom Gundersen <class location="${dist.dir}/opengrok.jar" />
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen </findbugs>
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen </target>
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen
7951dea20911969287878e6897b3eca348721adeSusant Sahani <target name="findbugs-xml" depends="dist, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate XML output">
7951dea20911969287878e6897b3eca348721adeSusant Sahani <path id="findbugs.lib" >
7951dea20911969287878e6897b3eca348721adeSusant Sahani <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani </path>
7951dea20911969287878e6897b3eca348721adeSusant Sahani <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani <mkdir dir="findbugs"/>
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 <fileset dir="${dist.dir}/lib/">
7951dea20911969287878e6897b3eca348721adeSusant Sahani <include name="*.jar"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani </fileset>
7951dea20911969287878e6897b3eca348721adeSusant Sahani </auxClasspath>
7951dea20911969287878e6897b3eca348721adeSusant Sahani <sourcePath path="src" />
7951dea20911969287878e6897b3eca348721adeSusant Sahani <class location="${dist.dir}/opengrok.jar" />
7951dea20911969287878e6897b3eca348721adeSusant Sahani </findbugs>
7951dea20911969287878e6897b3eca348721adeSusant Sahani </target>
7951dea20911969287878e6897b3eca348721adeSusant Sahani
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"/>
7951dea20911969287878e6897b3eca348721adeSusant Sahani </available>
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."/>
c0dda18697e0994272c0c9616d36f6777b60e2c7Tom Gundersen </target>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
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">
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <fileset dir="src" includes="**/*.java"/>
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen <formatter type="plain"/>
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>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
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">
71a6151083d842b2f5bf04e50239f0bf85d34d2eTom Gundersen <filepath refid="pmd.lib.search.path"/>
71a6151083d842b2f5bf04e50239f0bf85d34d2eTom Gundersen </available>
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>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <target name="pmd" depends="compile, -check_pmd" description="Run PMD on OpenGrok source code">
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <path id="pmd.lib" >
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <pathelement location="${pmd.home}/lib/pmd.jar"/>
f048a16b464295a4e0a4f4c1210f06343ad31231Tom Gundersen <pathelement location="${pmd.home}/lib/jaxen.jar"/>
f048a16b464295a4e0a4f4c1210f06343ad31231Tom Gundersen </path>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib"/>
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen <mkdir dir="pmd"/>
aba496a58acf9d9c61314de71353550e579f85eeUmut Tezduyar Lindskog <pmd shortFilenames="true" targetjdk="1.6" failuresPropertyName="pmd.num.warnings">
407fe036a24834203aca6c1eec7d74d9ad3e9ee0Tom Gundersen <ruleset>rulesets/basic.xml</ruleset>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <ruleset>rulesets/braces.xml</ruleset>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <ruleset>rulesets/clone.xml</ruleset>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <ruleset>rulesets/design.xml</ruleset>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <ruleset>rulesets/favorites.xml</ruleset>
3bef724f7e7f7eaca69881548b06e221b77d7031Tom Gundersen <ruleset>rulesets/finalizers.xml</ruleset>
3bef724f7e7f7eaca69881548b06e221b77d7031Tom Gundersen <ruleset>rulesets/imports.xml</ruleset>
3bef724f7e7f7eaca69881548b06e221b77d7031Tom Gundersen <ruleset>rulesets/junit.xml</ruleset>
3bef724f7e7f7eaca69881548b06e221b77d7031Tom Gundersen <ruleset>rulesets/logging-java.xml</ruleset>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <ruleset>rulesets/migrating.xml</ruleset>
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/strings.xml</ruleset>
eb0ea358b688a6f83ff305c6b825c61f12b6dcb8Tom Gundersen <ruleset>rulesets/sunsecure.xml</ruleset>
eb0ea358b688a6f83ff305c6b825c61f12b6dcb8Tom Gundersen <ruleset>rulesets/typeresolution.xml</ruleset>
eb0ea358b688a6f83ff305c6b825c61f12b6dcb8Tom Gundersen <ruleset>rulesets/unusedcode.xml</ruleset>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <formatter type="html" toFile="pmd/pmd_report.html"/>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <formatter type="xml" toFile="pmd/pmd_report.xml"/>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen <fileset dir="src" includes="**/*.java"/>
6ae115c1fe95611b39d2f20cfcea3d385429f59eTom Gundersen </pmd>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <echo message="PMD finished, found ${pmd.num.warnings} warnings, see pmd/pmd_report.html."/>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen </target>
14b746f72132324e637c4e39694bd474f85e19f7Tom Gundersen
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">
505f8da7325591defe5f751f328bd26915267602Tom Gundersen <filepath refid="lib.search.path"/>
370e9930c3260cc58984ec70e44b1e2ab7676496Tom Gundersen </available>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen <fail unless="emma.jar.present" message="Please install emma.jar in lib-directory (or in ant classpath) to run Emma, see README."/>
22936833e177d9e477e059ec2b4f4fa9213b4e19Tom Gundersen
fbbeb65a93e2f90f6576001b69def877cd98722dTom Gundersen <available file="emma_ant.jar" type="file" property="emma_ant.jar.present">
dd3efc0993b6e95ff04775e9125e2fc9d30fe261Tom Gundersen <filepath refid="lib.search.path"/>
505f8da7325591defe5f751f328bd26915267602Tom Gundersen </available>
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."/>
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen </target>
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen
bbf7c04821a71fec67eaf0e7a34d17afc5913c13Tom Gundersen <target name="emma-instrument" depends="compile, -check_emma" description="Instruments the source code for Emma code coverage analysis">
bbf7c04821a71fec67eaf0e7a34d17afc5913c13Tom Gundersen <path id="emma.lib" >
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen <pathelement location="lib/emma.jar"/>
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen <pathelement location="lib/emma_ant.jar"/>
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen </path>
14b746f72132324e637c4e39694bd474f85e19f7Tom Gundersen <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
14b746f72132324e637c4e39694bd474f85e19f7Tom Gundersen <mkdir dir="${coverage.dir}" />
3333d748facc15f49935b6b793490ba0824976e6Zbigniew Jędrzejewski-Szmek <emma enabled="true">
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 filter="+org.opensolaris.*"/>
39032b87779323a244dd89f4832949d462b2ac68Zbigniew Jędrzejewski-Szmek </emma>
39032b87779323a244dd89f4832949d462b2ac68Zbigniew Jędrzejewski-Szmek </target>
39032b87779323a244dd89f4832949d462b2ac68Zbigniew Jędrzejewski-Szmek
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
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>
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen <target name="emma-report" description="Analyze" depends="-check_emma">
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
52433f6b65eccd1c54606dde999610640f3458acTom Gundersen <emma enabled="true" >
3333d748facc15f49935b6b793490ba0824976e6Zbigniew Jędrzejewski-Szmek <report sourcepath="src">
af4e9e2c563047d524b207e0e3d6816385693a16Tom Gundersen <!-- collect all EMMA data dumps (metadata and runtime): -->
3333d748facc15f49935b6b793490ba0824976e6Zbigniew Jędrzejewski-Szmek <infileset dir="${coverage.dir}" includes="*.em, *.ec"/>
af4e9e2c563047d524b207e0e3d6816385693a16Tom Gundersen <txt outfile="${coverage.dir}/coverage.txt"/>
628706137efbca8aaf753ccd063e5abf7e31aed5Zbigniew Jędrzejewski-Szmek <xml outfile="${coverage.dir}/coverage.xml"/>
628706137efbca8aaf753ccd063e5abf7e31aed5Zbigniew Jędrzejewski-Szmek <html outfile="${coverage.dir}/index.html"/>
628706137efbca8aaf753ccd063e5abf7e31aed5Zbigniew Jędrzejewski-Szmek </report>
628706137efbca8aaf753ccd063e5abf7e31aed5Zbigniew Jędrzejewski-Szmek </emma>
628706137efbca8aaf753ccd063e5abf7e31aed5Zbigniew Jędrzejewski-Szmek </target>
</project>