build.xml revision 737
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin<?xml version="1.0" encoding="UTF-8"?>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin<!--
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey ShabalinCDDL HEADER START
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey ShabalinThe contents of this file are subject to the terms of the
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey ShabalinCommon Development and Distribution License (the "License").
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey ShabalinYou may not use this file except in compliance with the License.
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey ShabalinSee LICENSE.txt included in this distribution for the specific
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalinlanguage governing permissions and limitations under the License.
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey ShabalinWhen distributing Covered Code, include this CDDL HEADER in each
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalinfile and include the License file at LICENSE.txt.
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey ShabalinIf applicable, add the following below this CDDL HEADER, with the
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalinfields enclosed by brackets "[]" replaced with your own identifying
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalininformation: Portions Copyright [yyyy] [name of copyright owner]
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey ShabalinCDDL HEADER END
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey ShabalinCopyright 2007 Sun Microsystems, Inc. All rights reserved.
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey ShabalinUse is subject to license terms.
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin-->
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin<project name="OpenGrok" default="jar" basedir=".">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <description>Builds, tests, and runs the project opengrok.</description>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <import file="nbproject/build-impl.xml"/>
ed4616b1cfbc84dd01caa8546d813e8c5d482921Christian Bühler
e29bf450cafa2ce2564aeb0b64d2014c17228407Dwight Engen <import file="nbproject/profiler-build-impl.xml"/> <!--
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin There exist several targets which are by default empty and which can be
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin used for execution of your tasks. These targets are usually executed
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin before and after some main targets. They are:
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin -pre-init: called before initialization of project properties
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin -post-init: called after initialization of project properties
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin -pre-compile: called before javac compilation
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin -post-compile: called after javac compilation
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin -pre-compile-single: called before javac compilation of single file
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin -post-compile-single: called after javac compilation of single file
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin -pre-compile-test: called before javac compilation of JUnit tests
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin -post-compile-test: called after javac compilation of JUnit tests
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin -pre-compile-test-single: called before javac compilation of single JUnit test
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin -post-compile-test-single: called after javac compilation of single JUunit test
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin -pre-jar: called before JAR building
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin -post-jar: called after JAR building
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin -post-clean: called after cleaning build products
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin (Targets beginning with '-' are not intended to be called on their own.)
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin Example of inserting an obfuscator after compilation could look like this:
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="-post-compile">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <obfuscate>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <fileset dir="${build.classes.dir}"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </obfuscate>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </target>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin For list of available properties check the imported
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin nbproject/build-impl.xml file.
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin Another way to customize the build is by overriding existing main targets.
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin The targets of interest are:
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin -init-macrodef-javac: defines macro for javac compilation
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin -init-macrodef-junit: defines macro for junit execution
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin -init-macrodef-debug: defines macro for class debugging
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin -init-macrodef-java: defines macro for class execution
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin -do-jar-with-manifest: JAR building (if you are using a manifest)
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin -do-jar-without-manifest: JAR building (if you are not using a manifest)
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin run: execution of project
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin -javadoc-build: Javadoc generation
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin test-report: JUnit report generation
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin An example of overriding the target for project execution could look like this:
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <target name="run" depends="opengrok-impl.jar">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <exec dir="bin" executable="launcher.exe">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <arg file="${dist.jar}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </exec>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin Notice that the overridden target depends on the jar target and not only on
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin the compile target as the regular run target does. Again, for a list of available
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin properties which you can use, check the target you are overriding in the
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin nbproject/build-impl.xml file.
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin -->
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <property name="version" value="0.7"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <property name="distname" value="opengrok"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <property name="findbugs.home" value="${user.home}/.ant/lib/findbugs"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <property name="checkstyle.home" value="${user.home}/.ant/lib/checkstyle"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <property name="pmd.home" value="${user.home}/.ant/lib/pmd"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <property name="test.repositories" value="testdata/repositories"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <property name="test.sources" value="testdata/sources"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <property name="test.cvs" value="${test.repositories}/cvs"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <property name="test.hg" value="${test.repositories}/mercurial"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <property name="test.svn" value="${test.repositories}/svn"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <property name="test.razor" value="${test.repositories}/razor"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <available property="compileSystrayClient" classname="java.awt.TrayIcon"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="-exclude-client" unless="compileSystrayClient">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <echo>JDK doesn't have java.awt.TrayIcon, excluding building of systray client ... </echo>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <property name="excludes" value="org/opensolaris/opengrok/management/client/**"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </target>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <path id="lib.search.path">
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <pathelement path="${user.home}/.ant/lib"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <pathelement path="${java.class.path}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <pathelement path="lib"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </path>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <path id="findbugs.lib.search.path">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <pathelement path="${findbugs.home}/lib/"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <pathelement path="${java.class.path}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <pathelement path="lib/findbugs/lib/"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </path>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <path id="checkstyle.lib.search.path">
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <pathelement path="${checkstyle.home}/"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <pathelement path="${java.class.path}"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <pathelement path="lib/checkstyle/lib/"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </path>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <path id="pmd.lib.search.path">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <pathelement path="${pmd.home}/lib/"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <pathelement path="${java.class.path}"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <pathelement path="lib/pmd/lib/"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </path>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <available file="JFlex.jar" type="file" property="JFlex.present">
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <filepath refid="lib.search.path"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </available>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <fail unless="JFlex.present" message="Please download JFlex (http://jflex.de/) and put JFlex.jar it into /lib directory (or in ant classpath)."/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpath="lib/JFlex.jar"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <property name="gensrcdir" value="generatedsrc"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="jflex">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <mkdir dir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/c/CSymbolTokenizer.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/c/CXref.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/c/CxxSymbolTokenizer.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/c/CxxXref.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/java/JavaSymbolTokenizer.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/java/JavaXref.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispSymbolTokenizer.lex" destdir="${gensrcdir}"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispXref.lex" destdir="${gensrcdir}"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <jflex file="src/org/opensolaris/opengrok/analysis/tcl/TclSymbolTokenizer.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/tcl/TclXref.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainFullTokenizer.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainSymbolTokenizer.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/plain/XMLXref.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/sql/SQLXref.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/document/TroffXref.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/document/TroffFullTokenizer.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/sh/ShSymbolTokenizer.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/analysis/sh/ShXref.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/search/context/HistoryLineTokenizer.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <jflex file="src/org/opensolaris/opengrok/search/context/PlainLineTokenizer.lex" destdir="${gensrcdir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <property name="hg" value="hg"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="-hg-get-changeset">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <exec executable="${hg}"
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin failifexecutionfails="no"
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin outputproperty="changeset">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <arg value="log"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <arg value="-r"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <arg value="tip"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <redirector>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <outputfilterchain>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <param type="regexp" value="^changeset:"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </filterreader>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <tokenfilter>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <replaceregex pattern="^changeset:[^:]*:" replace=""/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </tokenfilter>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </outputfilterchain>
44d397891e691ab994a69766cc72e57265b62da1Serge Hallyn </redirector>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </exec>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="-update-build-info" depends="-hg-get-changeset">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <mkdir dir="${build.classes.dir}/org/opensolaris/opengrok"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <propertyfile
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin file="${build.classes.dir}/org/opensolaris/opengrok/info.properties">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <entry key="version" value="${version}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <entry key="changeset" value="${changeset}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </propertyfile>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
e29bf450cafa2ce2564aeb0b64d2014c17228407Dwight Engen
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <property name="coverage.dir" value="${basedir}/coverage"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <target name="-pre-compile" depends="jflex"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <target name="-post-clean">
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <delete dir="${gensrcdir}"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <delete file="${manifest.file}"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <delete dir="${coverage.dir}"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber </target>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <!--
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber Create an empty manifest file so that nbproject/build-impl.xml
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber notices that a manifest should be added to the jar file
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber -->
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <target name="-touch-manifest">
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <!-- no attributes, main-class and class-path will be added later -->
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <manifest file="manifest.mf" mode="replace"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <target name="-pre-init" depends="-touch-manifest, -exclude-client"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <!--
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin Initialize a property holding a list of jar files on which
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber opengrok.jar depends
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber -->
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <target name="-post-init">
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <pathconvert property="opengrok.lib.files" pathsep=" ">
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <path>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <pathelement path="${javac.classpath}"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber </path>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <flattenmapper/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <map from="" to="lib/"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber </pathconvert>
fe253caa8b98854445aaf6ee253545ee1f13beb1Stéphane Graber </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <!-- Update the manifest file with a classpath attribute -->
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="-update-manifest-classpath">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <manifest file="${manifest.file}" mode="update">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <attribute name="Class-Path" value="${opengrok.lib.files}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </manifest>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
1881820ae4ff9004beef1bf7f04553580840441dSerge Hallyn <target name="-pre-jar" depends="-update-manifest-classpath,-update-build-info"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <!--
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin Copy the jars from lib to dist/lib manually if we don't have
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin the copylibs task from NetBeans
eba7df9ee0a1963984ef212e7ddfc0e0835af288Stéphane Graber -->
eee3ba81c88e64b8a732694fc4843a39d5bde491Serge Hallyn <target name="-copy-lib-without-netbeans"
f02ce27d4b1a9d01b88d0ffaf626e5bafa671bf0Stéphane Graber unless="manifest.available+main.class+mkdist.available">
f02ce27d4b1a9d01b88d0ffaf626e5bafa671bf0Stéphane Graber <copy todir="${dist.dir}/lib">
f02ce27d4b1a9d01b88d0ffaf626e5bafa671bf0Stéphane Graber <fileset file="${file.reference.ant.jar}"/>
f02ce27d4b1a9d01b88d0ffaf626e5bafa671bf0Stéphane Graber </copy>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <copy todir="${dist.dir}">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <fileset dir="." includes="${opengrok.lib.files}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </copy>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="-post-jar" depends="-copy-lib-without-netbeans">
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <war destfile="${dist.war}" webxml="conf/web.xml">
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <fileset dir="web"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <fileset dir="conf" excludes="web.xml"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <lib dir="${dist.dir}" includes="opengrok.jar"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <lib dir="${dist.dir}/lib" includes="*.jar" excludes="servlet-api.jar"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </war>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <echo message="Generating man page.."/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <java classname="org.opensolaris.opengrok.index.CommandLineOptions"
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin output="${dist.dir}/opengrok.1" failonerror="true" fork="true">
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <classpath>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <pathelement location="dist/opengrok.jar"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <pathelement path="${java.class.path}"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </classpath>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </java>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </target>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <target name="package" depends="jar">
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <exec os="SunOS" executable="/usr/bin/pkgmk">
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <arg line="-o -d build -r . -v ${version} -f platform/solaris/pkgdef/prototype"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </exec>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <exec os="SunOS" executable="/usr/bin/pkgtrans">
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <arg line="-s build /dist/OSOLopengrok-${version}.pkg OSOLopengrok"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </exec>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="dist" depends="jar">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <tar destfile="${dist.dir}/${distname}-${version}.tar.gz"
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin compression="gzip">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <tarfileset dir="." prefix="${distname}-${version}">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <include name="README.txt"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <include name="CHANGES.txt"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <include name="LICENSE.txt"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <include name="paths.tsv"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </tarfileset>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <tarfileset dir="." prefix="${distname}-${version}" mode="755">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <include name="OpenGrok"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <include name="run.sh"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <include name="run-quiet.sh"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <include name="run.bat"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </tarfileset>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <tarfileset dir="doc" prefix="${distname}-${version}">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <include name="EXAMPLE.txt"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </tarfileset>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <tarfileset dir="${dist.dir}" prefix="${distname}-${version}">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <include name="opengrok.jar"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <include name="source.war"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <include name="lib/*"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <exclude name="lib/servlet-api.jar"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber </tarfileset>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </tar>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="dist-src" depends="init">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <mkdir dir="${dist.dir}"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <exec executable="hg">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <arg value="archive"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <arg value="-t"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <arg value="tgz"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <arg value="${dist.dir}/${distname}-${version}-src.tar.gz"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </exec>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="-check_findbugs" description="Check that findbugs jar files are present">
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <available file="findbugs.jar" type="file" property="findbugs.jar.present">
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <filepath refid="findbugs.lib.search.path"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber </available>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <fail unless="findbugs.jar.present" message="Please install Findbugs findbugs.jar in ~/.ant/lib-directory (or in ant classpath) to run Findbugs, see README"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <available file="findbugs-ant.jar" type="file" property="findbugs-ant.jar.present">
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <filepath refid="findbugs.lib.search.path"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber </available>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <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"/>
fe253caa8b98854445aaf6ee253545ee1f13beb1Stéphane Graber </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="findbugs" depends="dist, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate HTML output">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <path id="findbugs.lib" >
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </path>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <mkdir dir="findbugs"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <findbugs projectname="OpenGrok" home="${findbugs.home}" output="html" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.html" jvmargs="-Xmx512m">
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <auxClasspath>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <fileset dir="${dist.dir}/lib/">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <include name="*.jar"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </fileset>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </auxClasspath>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <sourcePath path="src" />
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <class location="${dist.dir}/opengrok.jar" />
e29bf450cafa2ce2564aeb0b64d2014c17228407Dwight Engen </findbugs>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <target name="findbugs-xml" depends="dist, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate XML output">
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <path id="findbugs.lib" >
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </path>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <mkdir dir="findbugs"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <findbugs projectname="OpenGrok" home="${findbugs.home}" output="xml" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.xml" jvmargs="-Xmx512m">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <auxClasspath>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <fileset dir="${dist.dir}/lib/">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <include name="*.jar"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </fileset>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </auxClasspath>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <sourcePath path="src" />
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <class location="${dist.dir}/opengrok.jar" />
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </findbugs>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="-check_checkstyle" description="Check that checkstyle jar files are present">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <available file="checkstyle-all.jar" type="file" property="checkstyle.jar.present">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <filepath refid="checkstyle.lib.search.path"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </available>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <fail unless="checkstyle.jar.present" message="Please install checkstyle-all.jar in lib-directory (or in ant classpath) to run Checkstyle, see README."/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber </target>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <target name="checkstyle" depends="compile, -check_checkstyle" description="Run checkstyle on OpenGrok source code">
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <taskdef resource="checkstyletask.properties" classpath="${checkstyle.home}/checkstyle-all.jar"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <checkstyle config="checkstyle/style.xml" failOnViolation="false">
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <fileset dir="src" includes="**/*.java"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <formatter type="plain"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <formatter type="plain" toFile="checkstyle/checkstyle_errors.txt"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber <formatter type="xml" toFile="checkstyle/checkstyle_errors.xml"/>
14d9c0f09d1a55d124ef210a4b4e205c9fe7596cStéphane Graber </checkstyle>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="-check_pmd" description="Check that pmd jar files are present">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <available file="pmd.jar" type="file" property="pmd.jar.present">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <filepath refid="pmd.lib.search.path"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </available>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <fail unless="pmd.jar.present" message="Please install pmd.jar in lib-directory (or in ant classpath) to run PMD, see README."/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="pmd" depends="compile, -check_pmd" description="Run PMD on OpenGrok source code">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <path id="pmd.lib" >
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <pathelement location="${pmd.home}/lib/pmd.jar"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <pathelement location="${pmd.home}/lib/jaxen.jar"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </path>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <mkdir dir="pmd"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <pmd targetjdk="1.6" failuresPropertyName="pmd.num.warnings" rulesetfiles="tools/pmd_ruleset.xml">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <formatter type="html" toFile="pmd/pmd_report.html"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <formatter type="xml" toFile="pmd/pmd_report.xml"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <fileset dir="src" includes="**/*.java"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </pmd>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <echo message="PMD finished, found ${pmd.num.warnings} warnings, see pmd/pmd_report.html"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="-check_emma" description="Check that emma jar files are present">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <available file="emma.jar" type="file" property="emma.jar.present">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <filepath refid="lib.search.path"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </available>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <fail unless="emma.jar.present" message="Please install emma.jar in lib-directory (or in ant classpath) to run Emma, see README."/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <available file="emma_ant.jar" type="file" property="emma_ant.jar.present">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <filepath refid="lib.search.path"/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </available>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <fail unless="emma_ant.jar.present" message="Please install emma_ant.jar in lib-directory (or in ant classpath) to run Emma, see README."/>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin </target>
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <target name="emma-instrument" depends="compile, -check_emma" description="Instruments the source code for Emma code coverage analysis">
b031f0d2ca1b40eab86286b82d3c5e8b379122e6Alexey Shabalin <path id="emma.lib" >
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <pathelement location="lib/emma.jar"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <pathelement location="lib/emma_ant.jar"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </path>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <mkdir dir="${coverage.dir}" />
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <emma enabled="true">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <instr instrpath="build/classes"
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin metadatafile="${coverage.dir}/coverage.em"
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin mode="overwrite"
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin filter="+org.opensolaris.*,-org.opensolaris.opengrok.management.client.*"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </emma>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </target>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <target name="-pre-compile-test">
1881820ae4ff9004beef1bf7f04553580840441dSerge Hallyn <property name="test-sys-prop.emma.coverage.out.file" value="${coverage.dir}/coverage.ec"/>
1881820ae4ff9004beef1bf7f04553580840441dSerge Hallyn <property name="test-sys-prop.emma.coverage.out.merge" value="true"/>
1881820ae4ff9004beef1bf7f04553580840441dSerge Hallyn </target>
1881820ae4ff9004beef1bf7f04553580840441dSerge Hallyn
1881820ae4ff9004beef1bf7f04553580840441dSerge Hallyn <target name="-post-compile-test">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <antcall target="-create-svn-repository"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <antcall target="-create-razor-repository"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <!-- Change root in CVS test repository -->
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <property name="test.cvs.repo" value="${test.cvs}/cvsrepo"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <property name="test.cvs.root" value="${test.cvs}/cvsroot"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <!-- Strange indentation in line two levels below to get newline correctly -->
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <concat destfile="${test.cvs.repo}/CVS/Root" append="no" force="yes" eol="unix">${user.dir}/${test.cvs.root}/
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin</concat>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <!-- Generate ZIP files used for unit testing mercurial/.hg and mercurial/.hgignore are renamed -->
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <copy todir="${test.hg}/.hg">
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <fileset dir="${test.hg}/hg"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin </copy>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <copy file="${test.hg}/hgignore" tofile="${test.hg}/.hgignore"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/index/source.zip"
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin basedir="${test.sources}"
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin update="false"
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin defaultexcludes="no"/>
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin <zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/history/repositories.zip"
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin basedir="${test.repositories}"
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin excludes="mercurial/hg/**, mercurial/hgignore"
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin update="false"
262f4e48a51a55ad9cee06abbcfe4a6ad6166f49Alexey Shabalin defaultexcludes="no"/>
eba7df9ee0a1963984ef212e7ddfc0e0835af288Stéphane Graber </target>
<target name="-create-svn-repository">
<delete dir="${test.svn}"/>
<delete dir="${build.test.reposroots}/svn"/>
<mkdir dir="${build.test.reposroots}"/>
<exec executable="svnadmin" failifexecutionfails="false">
<arg value="create"/>
<arg value="${build.test.reposroots}/svn"/>
</exec>
<!-- need absolute path for svn url -->
<pathconvert property="test.svn.url">
<map from="" to="file://"/>
<path location="${build.test.reposroots}/svn"/>
</pathconvert>
<exec executable="svn" failifexecutionfails="false">
<arg value="import"/>
<arg value="${test.sources}"/>
<arg value="${test.svn.url}"/>
<arg value="-m"/>
<arg value="Initial import"/>
</exec>
<exec executable="svn" failifexecutionfails="false">
<arg value="checkout"/>
<arg value="${test.svn.url}"/>
<arg value="${test.svn}"/>
</exec>
</target>
<target name="-create-razor-repository">
<delete dir="${test.razor}"/>
<copy todir="${test.razor}/Razor-Simple">
<fileset dir="ext/SampleRazorRepository/UserSandbox"/>
</copy>
<copy todir="${test.razor}/Razor-Simple/SimpleCProgram/.razor">
<fileset dir="ext/SampleRazorRepository/Repository/OpenGrokSample/RAZOR_UNIVERSE/DOMAIN_01/Simple"/>
</copy>
<!--
The support for binaries in Razor repositories is not fully
functional, so the next copy target is commented out for now.
-->
<!--copy todir="${test.razor}/Razor-Simple/SimpleCProgram-BinaryRelease/.razor">
<fileset dir="ext/SampleRazorRepository/Repository/OpenGrokSample/RAZOR_UNIVERSE/DOMAIN_01/Simple"/>
</copy-->
</target>
<!-- clean up after tests -->
<target name="-post-test-run">
<delete dir="${test.hg}/.hg"/>
<delete file="${test.hg}/.hgignore"/>
<delete dir="${test.svn}"/>
<delete dir="${test.razor}"/>
</target>
<target name="emma-report" description="Analyze" depends="-check_emma">
<taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
<emma enabled="true" >
<report sourcepath="${src.dir},${src.generatedsrc.dir}">
<!-- collect all EMMA data dumps (metadata and runtime): -->
<infileset dir="${coverage.dir}" includes="*.em, *.ec"/>
<txt outfile="${coverage.dir}/coverage.txt"/>
<xml outfile="${coverage.dir}/coverage.xml"/>
<html outfile="${coverage.dir}/index.html"/>
</report>
</emma>
</target>
<target name="code-coverage" depends="clean, emma-instrument, test, emma-report" description="Make test code coverage reports based on the OpenGrok unit tests"/>
<target name="jdepend" depends="compile" description="Run JDepend dependency checking">
<mkdir dir="jdepend"/>
<java classname="jdepend.xmlui.JDepend" failonerror="true" fork="true">
<arg value="-file"/>
<arg value="jdepend/report.xml"/>
<arg value="${build.classes.dir}"/>
<classpath>
<pathelement location="${user.home}/.ant/lib/jdepend/lib/jdepend.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
<java classname="jdepend.textui.JDepend" failonerror="true" fork="true">
<arg value="-file"/>
<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>