build.xml revision bcae302a5f4b516d2f3c05f657df054e1a0efde7
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye<?xml version="1.0" encoding="UTF-8"?>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye<!--
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeCDDL HEADER START
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
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 Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeSee LICENSE.txt included in this distribution for the specific
64b763950bf11e9357facbd2b5666631a895c085Trond Norbyelanguage governing permissions and limitations under the License.
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
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 Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeCDDL HEADER END
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeCopyright 2007 Sun Microsystems, Inc. All rights reserved.
64b763950bf11e9357facbd2b5666631a895c085Trond NorbyeUse is subject to license terms.
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye-->
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/build-impl.xml"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <import file="nbproject/profiler-build-impl.xml"/> <!--
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
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
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
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye (Targets beginning with '-' are not intended to be called on their own.)
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye Example of inserting an obfuscator after compilation could look like this:
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <target name="-post-compile">
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <obfuscate>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <fileset dir="${build.classes.dir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye </obfuscate>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye </target>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye For list of available properties check the imported
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye nbproject/build-impl.xml file.
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye Another way to customize the build is by overriding existing main targets.
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye The targets of interest are:
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
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
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye An example of overriding the target for project execution could look like this:
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
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 </exec>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye </target>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
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
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye nbproject/build-impl.xml file.
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -->
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen
26eda24db2dc16f2cc45055efb39762fafd606deKnut Anders Hatlen <property name="version" value="0.7"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <property name="distname" value="opengrok"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik
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"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <property name="test.repositories" value="testdata/repositories"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <property name="test.sources" value="testdata/sources"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <property name="test.cvs" value="${test.repositories}/cvs"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <property name="test.hg" value="${test.repositories}/mercurial"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <property name="test.svn" value="${test.repositories}/svn"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <available property="compileSystrayClient" classname="java.awt.TrayIcon"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <target name="-exclude-client" unless="compileSystrayClient">
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <echo>JDK doesn't have java.awt.TrayIcon, excluding building of systray client ... </echo>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <property name="excludes" value="org/opensolaris/opengrok/management/client/**"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco </target>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <path id="lib.search.path">
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <pathelement path="${user.home}/.ant/lib"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <pathelement path="${java.class.path}"/>
1ed6b730409d4740e941142599767d5eac7e7d92Lubos Kosco <pathelement path="lib"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik </path>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <path id="findbugs.lib.search.path">
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <pathelement path="${findbugs.home}/lib/"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <pathelement path="${java.class.path}"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <pathelement path="lib/findbugs/lib/"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik </path>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <path id="checkstyle.lib.search.path">
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <pathelement path="${checkstyle.home}/"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <pathelement path="${java.class.path}"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <pathelement path="lib/checkstyle/lib/"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik </path>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <path id="pmd.lib.search.path">
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <pathelement path="${pmd.home}/lib/"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <pathelement path="${java.class.path}"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <pathelement path="lib/pmd/lib/"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik </path>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <available file="JFlex.jar" type="file" property="JFlex.present">
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <filepath refid="lib.search.path"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik </available>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen 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
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpath="lib/JFlex.jar"/>
1ed6b730409d4740e941142599767d5eac7e7d92Lubos Kosco <property name="gensrcdir" value="generatedsrc"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <target name="jflex">
1ed6b730409d4740e941142599767d5eac7e7d92Lubos Kosco <mkdir dir="${gensrcdir}"/>
1ed6b730409d4740e941142599767d5eac7e7d92Lubos Kosco <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/c/CxxSymbolTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/c/CxxXref.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}"/>
3ef4850ec38b34ea6eda02c22a70ac98500584c1Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispSymbolTokenizer.lex" destdir="${gensrcdir}"/>
3ef4850ec38b34ea6eda02c22a70ac98500584c1Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/tcl/TclSymbolTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <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}"/>
225d5411e0f1f0e690e3553aad7a97c648d566a1HemangLavana <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
225d5411e0f1f0e690e3553aad7a97c648d566a1HemangLavana <jflex file="src/org/opensolaris/opengrok/analysis/plain/XMLXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <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}"/>
75640e2b0da81c240758d747e76d30acd1ed194dKnut Anders Hatlen <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}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye </target>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <property name="hg" value="hg"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <target name="-hg-get-changeset">
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <exec executable="${hg}"
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye failifexecutionfails="no"
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye outputproperty="changeset">
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <arg value="log"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <arg value="-r"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <arg value="tip"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <redirector>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <outputfilterchain>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp">
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <param type="regexp" value="^changeset:"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </filterreader>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <tokenfilter>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <replaceregex pattern="^changeset:[^:]*:" replace=""/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </tokenfilter>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </outputfilterchain>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </redirector>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </exec>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </target>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye
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 <entry key="version" value="${version}"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <entry key="changeset" value="${changeset}"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </propertyfile>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </target>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <property name="coverage.dir" value="${basedir}/coverage"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <target name="-pre-compile" depends="jflex"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <target name="-post-clean">
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <delete dir="${gensrcdir}"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <delete file="${manifest.file}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <delete dir="${coverage.dir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye </target>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <!--
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik Create an empty manifest file so that nbproject/build-impl.xml
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye notices that a manifest should be added to the jar file
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye -->
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen <target name="-touch-manifest">
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <!-- no attributes, main-class and class-path will be added later -->
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <manifest file="manifest.mf" mode="replace"/>
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen </target>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <target name="-pre-init" depends="-touch-manifest, -exclude-client"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <!--
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen Initialize a property holding a list of jar files on which
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco opengrok.jar depends
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen -->
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <target name="-post-init">
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <pathconvert property="opengrok.lib.files" pathsep=" ">
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <path>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <pathelement path="${javac.classpath}"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen </path>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <flattenmapper/>
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen <map from="" to="lib/"/>
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen </pathconvert>
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen </target>
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <!-- Update the manifest file with a classpath attribute -->
9cf297d9a579835e9336d587eaee187ca0954767Knut 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}"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen </manifest>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen </target>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <target name="-pre-jar" depends="-update-manifest-classpath,-update-build-info"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <!--
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen Copy the jars from lib to dist/lib manually if we don't have
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye the copylibs task from NetBeans
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen -->
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <target name="-copy-lib-without-netbeans"
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen unless="manifest.available+main.class+mkdist.available">
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <copy todir="${dist.dir}/lib">
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <fileset file="${file.reference.ant.jar}"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen </copy>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <copy todir="${dist.dir}">
9661674ed58ba62a40e43d1a4b38d5e77c3c6545Knut Anders Hatlen <fileset dir="." includes="${opengrok.lib.files}"/>
9661674ed58ba62a40e43d1a4b38d5e77c3c6545Knut Anders Hatlen </copy>
9661674ed58ba62a40e43d1a4b38d5e77c3c6545Knut Anders Hatlen </target>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <target name="-post-jar" depends="-copy-lib-without-netbeans">
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen <war destfile="${dist.war}" webxml="conf/web.xml">
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen <fileset dir="web"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <fileset dir="conf" excludes="web.xml"/>
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen <lib dir="${dist.dir}" includes="opengrok.jar"/>
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <lib dir="${dist.dir}/lib" includes="*.jar" excludes="servlet-api.jar"/>
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye </war>
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <echo message="Generating man page.."/>
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <java classname="org.opensolaris.opengrok.index.CommandLineOptions"
20a0bde399487a651cdeb66fc8b44b2212036355Trond Norbye output="${dist.dir}/opengrok.1" failonerror="true" fork="true">
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <classpath>
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye <pathelement location="dist/opengrok.jar"/>
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye <pathelement path="${java.class.path}"/>
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye </classpath>
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye </java>
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye </target>
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye <target name="package" depends="jar">
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye <exec os="SunOS" executable="/usr/bin/pkgmk">
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <arg line="-o -d build -r . -v ${version} -f platform/solaris/pkgdef/prototype"/>
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen </exec>
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen <exec os="SunOS" executable="/usr/bin/pkgtrans">
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen <arg line="-s build /dist/OSOLopengrok-${version}.pkg OSOLopengrok"/>
c67bbf00f725074786ac47867d2276e7b935b570Trond Norbye </exec>
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen </target>
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen <target name="dist" depends="jar">
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen <tar destfile="${dist.dir}/${distname}-${version}.tar.gz"
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen compression="gzip">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <tarfileset dir="." prefix="${distname}-${version}">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <include name="README.txt"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <include name="CHANGES.txt"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <include name="LICENSE.txt"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <include name="paths.tsv"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen </tarfileset>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <tarfileset dir="." prefix="${distname}-${version}" mode="755">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <include name="OpenGrok"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <include name="run.sh"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <include name="run-quiet.sh"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <include name="run.bat"/>
cdf37a6f2e4e7ca653ef8e791cc8e720fa148a39Peter Bray </tarfileset>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <tarfileset dir="doc" prefix="${distname}-${version}">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <include name="EXAMPLE.txt"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen </tarfileset>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <tarfileset dir="${dist.dir}" prefix="${distname}-${version}">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <include name="opengrok.jar"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <include name="source.war"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <include name="lib/*"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <exclude name="lib/servlet-api.jar"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen </tarfileset>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen </tar>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen </target>
dce551c28e0e9e0a652e512c1094caef574916ceKnut Anders Hatlen
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <target name="dist-src" depends="init">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <mkdir dir="${dist.dir}"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <exec executable="hg">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <arg value="archive"/>
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen <arg value="-t"/>
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen <arg value="tgz"/>
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen <arg value="${dist.dir}/${distname}-${version}-src.tar.gz"/>
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen </exec>
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen </target>
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen <target name="-check_findbugs" description="Check that findbugs jar files are present">
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen <available file="findbugs.jar" type="file" property="findbugs.jar.present">
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen <filepath refid="findbugs.lib.search.path"/>
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik </available>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen 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
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <available file="findbugs-ant.jar" type="file" property="findbugs-ant.jar.present">
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <filepath refid="findbugs.lib.search.path"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik </available>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen 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"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik </target>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <target name="findbugs" depends="dist, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate HTML output">
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <path id="findbugs.lib" >
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik </path>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <mkdir dir="findbugs"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <findbugs projectname="OpenGrok" home="${findbugs.home}" output="html" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.html" jvmargs="-Xmx512m">
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <auxClasspath>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <fileset dir="${dist.dir}/lib/">
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik <include name="*.jar"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik </fileset>
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik </auxClasspath>
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik <sourcePath path="src" />
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik <class location="${dist.dir}/opengrok.jar" />
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik </findbugs>
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik </target>
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik <target name="findbugs-xml" depends="dist, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate XML output">
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik <path id="findbugs.lib" >
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik </path>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <mkdir dir="findbugs"/>
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 <fileset dir="${dist.dir}/lib/">
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye <include name="*.jar"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik </fileset>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye </auxClasspath>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye <sourcePath path="src" />
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye <class location="${dist.dir}/opengrok.jar" />
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye </findbugs>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye </target>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye <target name="-check_checkstyle" description="Check that checkstyle jar files are present">
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye <available file="checkstyle-all.jar" type="file" property="checkstyle.jar.present">
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye <filepath refid="checkstyle.lib.search.path"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik </available>
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>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik
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"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <checkstyle config="checkstyle/style.xml" failOnViolation="false">
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <fileset dir="src" includes="**/*.java"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <formatter type="plain"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <formatter type="plain" toFile="checkstyle/checkstyle_errors.txt"/>
45cf976b01987ad147e9edb54ffab0938dd6c016Trond Norbye <formatter type="xml" toFile="checkstyle/checkstyle_errors.xml"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik </checkstyle>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik </target>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <target name="-check_pmd" description="Check that pmd jar files are present">
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <available file="pmd.jar" type="file" property="pmd.jar.present">
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <filepath refid="pmd.lib.search.path"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik </available>
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>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <target name="pmd" depends="compile, -check_pmd" description="Run PMD on OpenGrok source code">
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <path id="pmd.lib" >
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <pathelement location="${pmd.home}/lib/pmd.jar"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <pathelement location="${pmd.home}/lib/jaxen.jar"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik </path>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <mkdir dir="pmd"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <pmd targetjdk="1.6" failuresPropertyName="pmd.num.warnings" rulesetfiles="tools/pmd_ruleset.xml">
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <formatter type="html" toFile="pmd/pmd_report.html"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <formatter type="xml" toFile="pmd/pmd_report.xml"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <fileset dir="src" includes="**/*.java"/>
1e13442ac5687540ace78411d98155fca4b3791eKnut Anders Hatlen </pmd>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <echo message="PMD finished, found ${pmd.num.warnings} warnings, see pmd/pmd_report.html"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik </target>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <target name="-check_emma" description="Check that emma jar files are present">
2ef63dc9adc693ddad2206d323b0a85a1afe70ecJorgen Austvik <available file="emma.jar" type="file" property="emma.jar.present">
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <filepath refid="lib.search.path"/>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye </available>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <fail unless="emma.jar.present" message="Please install emma.jar in lib-directory (or in ant classpath) to run Emma, see README."/>
f09d46eefeb5e4db6dc11e02e417b448fa9362a9Jorgen Austvik
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <available file="emma_ant.jar" type="file" property="emma_ant.jar.present">
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <filepath refid="lib.search.path"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik </available>
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>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <target name="emma-instrument" depends="compile, -check_emma" description="Instruments the source code for Emma code coverage analysis">
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <path id="emma.lib" >
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <pathelement location="lib/emma.jar"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <pathelement location="lib/emma_ant.jar"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik </path>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <mkdir dir="${coverage.dir}" />
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <emma enabled="true">
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <instr instrpath="build/classes"
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik metadatafile="${coverage.dir}/coverage.em"
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik mode="overwrite"
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik filter="+org.opensolaris.*,-org.opensolaris.opengrok.management.client.*"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik </emma>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik </target>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik
63e0f31920b0818d6f471a066c12da991fb35346Trond Norbye <target name="-pre-compile-test">
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"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik </target>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <target name="-post-compile-test">
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <antcall target="-create-svn-repository"/>
ede8ae04a015c7d2ae4916e5bb36813b81cb7c30Jorgen Austvik <!-- Change root in CVS test repository -->
49180e08afc7cf03413ab108bc71c14e9de1a880Jorgen Austvik <property name="test.cvs.repo" value="${test.cvs}/cvsrepo"/>
ede8ae04a015c7d2ae4916e5bb36813b81cb7c30Jorgen Austvik <property name="test.cvs.root" value="${test.cvs}/cvsroot"/>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <!-- Strange indentation in line two levels below to get newline correctly -->
629f5f1dc42d96d37676b093b89f011f143dad0aJorgen Austvik <concat destfile="${test.cvs.repo}/CVS/Root" append="no" force="yes" eol="unix">${user.dir}/${test.cvs.root}/
629f5f1dc42d96d37676b093b89f011f143dad0aJorgen Austvik</concat>
629f5f1dc42d96d37676b093b89f011f143dad0aJorgen Austvik <!-- Generate ZIP files used for unit testing mercurial/.hg and mercurial/.hgignore are renamed -->
629f5f1dc42d96d37676b093b89f011f143dad0aJorgen Austvik <copy todir="${test.hg}/.hg">
629f5f1dc42d96d37676b093b89f011f143dad0aJorgen Austvik <fileset dir="${test.hg}/hg"/>
629f5f1dc42d96d37676b093b89f011f143dad0aJorgen Austvik </copy>
d5734522e5d6f8e329d005a0f93f8c2f30df9516Trond Norbye <copy file="${test.hg}/hgignore" tofile="${test.hg}/.hgignore"/>
d5734522e5d6f8e329d005a0f93f8c2f30df9516Trond Norbye
d5734522e5d6f8e329d005a0f93f8c2f30df9516Trond Norbye <zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/index/source.zip"
d5734522e5d6f8e329d005a0f93f8c2f30df9516Trond Norbye basedir="${test.sources}"
629f5f1dc42d96d37676b093b89f011f143dad0aJorgen Austvik update="false"
629f5f1dc42d96d37676b093b89f011f143dad0aJorgen Austvik defaultexcludes="no"/>
629f5f1dc42d96d37676b093b89f011f143dad0aJorgen Austvik <zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/history/repositories.zip"
d5734522e5d6f8e329d005a0f93f8c2f30df9516Trond Norbye basedir="${test.repositories}"
d5734522e5d6f8e329d005a0f93f8c2f30df9516Trond Norbye excludes="mercurial/hg/**, mercurial/hgignore"
629f5f1dc42d96d37676b093b89f011f143dad0aJorgen Austvik update="false"
629f5f1dc42d96d37676b093b89f011f143dad0aJorgen Austvik defaultexcludes="no"/>
629f5f1dc42d96d37676b093b89f011f143dad0aJorgen Austvik
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <delete dir="${test.hg}/.hg"/>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <delete file="${test.hg}/.hgignore"/>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <delete dir="${test.svn}"/>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen </target>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <target name="-create-svn-repository">
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <delete dir="${test.svn}"/>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <delete dir="${build.test.reposroots}/svn"/>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <mkdir dir="${build.test.reposroots}"/>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <exec executable="svnadmin" failifexecutionfails="false">
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <arg value="create"/>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <arg value="${build.test.reposroots}/svn"/>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen </exec>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <!-- need absolute path for svn url -->
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <pathconvert property="test.svn.url">
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <map from="" to="file://"/>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <path location="${build.test.reposroots}/svn"/>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen </pathconvert>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <exec executable="svn" failifexecutionfails="false">
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <arg value="import"/>
afb218f076cae538126a5f931299a82a114a075aKnut Anders Hatlen <arg value="${test.sources}"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <arg value="${test.svn.url}"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <arg value="-m"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <arg value="Initial import"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik </exec>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <exec executable="svn" failifexecutionfails="false">
4c0668d038ecec0f5f4f4cc3d7a177d8e118c955Knut Anders Hatlen <arg value="checkout"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <arg value="${test.svn.url}"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <arg value="${test.svn}"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik </exec>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik </target>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <target name="emma-report" description="Analyze" depends="-check_emma">
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <emma enabled="true" >
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <report sourcepath="${src.dir},${src.generatedsrc.dir}">
4b08e2231abb7a3b44ab9255eca7963e6309aba4Jorgen Austvik <!-- collect all EMMA data dumps (metadata and runtime): -->
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <infileset dir="${coverage.dir}" includes="*.em, *.ec"/>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <txt outfile="${coverage.dir}/coverage.txt"/>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <xml outfile="${coverage.dir}/coverage.xml"/>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <html outfile="${coverage.dir}/index.html"/>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik </report>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik </emma>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik </target>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <target name="code-coverage" depends="clean, emma-instrument, test, emma-report" description="Make test code coverage reports based on the OpenGrok unit tests"/>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <target name="jdepend" depends="compile" description="Run JDepend dependency checking">
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <mkdir dir="jdepend"/>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <java classname="jdepend.xmlui.JDepend" failonerror="true" fork="true">
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <arg value="-file"/>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <arg value="jdepend/report.xml"/>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <arg value="${build.classes.dir}"/>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <classpath>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <pathelement location="${user.home}/.ant/lib/jdepend/lib/jdepend.jar"/>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <pathelement path="${java.class.path}"/>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik </classpath>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik </java>
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <java classname="jdepend.textui.JDepend" failonerror="true" fork="true">
92ed85d851c9108d821e93d3aacc9faf3588e17eJorgen Austvik <arg value="-file"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <arg value="jdepend/report.txt"/>
<arg value="${build.classes.dir}"/>
<classpath>
<pathelement location="${user.home}/.ant/lib/jdepend/lib/jdepend.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
</project>