build.xml revision 7ecd52b03dc1f0b03ff8f522b4891c8531896c3d
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.6.1"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <property name="distname" value="opengrok"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <path id="lib.search.path">
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <pathelement path="${user.home}/.ant/lib"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <pathelement path="${java.class.path}"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <pathelement path="lib"/>
780cc7d1b57609ff15fb283201e93cb501ebe9e6Jorgen Austvik </path>
780cc7d1b57609ff15fb283201e93cb501ebe9e6Jorgen Austvik
780cc7d1b57609ff15fb283201e93cb501ebe9e6Jorgen Austvik <path id="findbugs.lib.search.path">
780cc7d1b57609ff15fb283201e93cb501ebe9e6Jorgen Austvik <pathelement path="${user.home}/.ant/lib/findbugs/lib/"/>
780cc7d1b57609ff15fb283201e93cb501ebe9e6Jorgen Austvik <pathelement path="${java.class.path}findbugs/lib/"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <pathelement path="lib/findbugs/lib/"/>
0466de7c67573e1ce5e0733325c1e5383270f5d5Knut Anders Hatlen </path>
0466de7c67573e1ce5e0733325c1e5383270f5d5Knut Anders Hatlen
0466de7c67573e1ce5e0733325c1e5383270f5d5Knut Anders Hatlen <available file="JFlex.jar" type="file" property="JFlex.present">
0466de7c67573e1ce5e0733325c1e5383270f5d5Knut Anders Hatlen <filepath refid="lib.search.path"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco </available>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <fail unless="JFlex.present" message="Please download JFlex (http://jflex.de/) and put JFlex.jar it into /lib directory (or in ant classpath)."/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco
1ed6b730409d4740e941142599767d5eac7e7d92Lubos Kosco <taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpath="lib/JFlex.jar"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <property name="gensrcdir" value="generatedsrc"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <target name="jflex">
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <mkdir dir="${gensrcdir}"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/c/CSymbolTokenizer.lex" destdir="${gensrcdir}"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/c/CXref.lex" destdir="${gensrcdir}"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/java/JavaSymbolTokenizer.lex" destdir="${gensrcdir}"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/java/JavaXref.lex" destdir="${gensrcdir}"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispSymbolTokenizer.lex" destdir="${gensrcdir}"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispXref.lex" destdir="${gensrcdir}"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/tcl/TclSymbolTokenizer.lex" destdir="${gensrcdir}"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/tcl/TclXref.lex" destdir="${gensrcdir}"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainFullTokenizer.lex" destdir="${gensrcdir}"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainSymbolTokenizer.lex" destdir="${gensrcdir}"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/plain/XMLXref.lex" destdir="${gensrcdir}"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/sql/SQLXref.lex" destdir="${gensrcdir}"/>
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/document/TroffXref.lex" destdir="${gensrcdir}"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/document/TroffFullTokenizer.lex" destdir="${gensrcdir}"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <jflex file="src/org/opensolaris/opengrok/analysis/sh/ShSymbolTokenizer.lex" destdir="${gensrcdir}"/>
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <jflex file="src/org/opensolaris/opengrok/analysis/sh/ShXref.lex" destdir="${gensrcdir}"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <jflex file="src/org/opensolaris/opengrok/search/context/HistoryLineTokenizer.lex" destdir="${gensrcdir}"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik <jflex file="src/org/opensolaris/opengrok/search/context/PlainLineTokenizer.lex" destdir="${gensrcdir}"/>
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik </target>
1ed6b730409d4740e941142599767d5eac7e7d92Lubos Kosco
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <property name="hg" value="hg"/>
1ed6b730409d4740e941142599767d5eac7e7d92Lubos Kosco <target name="-hg-get-changeset">
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <exec executable="${hg}"
1ed6b730409d4740e941142599767d5eac7e7d92Lubos Kosco failifexecutionfails="no"
1ed6b730409d4740e941142599767d5eac7e7d92Lubos Kosco outputproperty="changeset">
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <arg value="log"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <arg value="-r"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <arg value="tip"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <redirector>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <outputfilterchain>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp">
3ef4850ec38b34ea6eda02c22a70ac98500584c1Trond Norbye <param type="regexp" value="^changeset:"/>
3ef4850ec38b34ea6eda02c22a70ac98500584c1Trond Norbye </filterreader>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <tokenfilter>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <replaceregex pattern="^changeset:[^:]*:" replace=""/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye </tokenfilter>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye </outputfilterchain>
225d5411e0f1f0e690e3553aad7a97c648d566a1HemangLavana </redirector>
225d5411e0f1f0e690e3553aad7a97c648d566a1HemangLavana </exec>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye </target>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <target name="-update-build-info" depends="-hg-get-changeset">
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <mkdir dir="${build.classes.dir}/org/opensolaris/opengrok"/>
75640e2b0da81c240758d747e76d30acd1ed194dKnut Anders Hatlen <propertyfile
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye file="${build.classes.dir}/org/opensolaris/opengrok/info.properties">
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <entry key="version" value="${version}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <entry key="changeset" value="${changeset}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye </propertyfile>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye </target>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <property name="coverage.dir" value="${basedir}/coverage"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <target name="-pre-compile" depends="jflex"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <target name="-post-clean">
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <delete dir="${gensrcdir}"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <delete file="${manifest.file}"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <delete dir="${coverage.dir}"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </target>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <!--
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye Create an empty manifest file so that nbproject/build-impl.xml
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye notices that a manifest should be added to the jar file
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye -->
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <target name="-touch-manifest">
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <!-- no attributes, main-class and class-path will be added later -->
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <manifest file="manifest.mf" mode="replace"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </target>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <target name="-pre-init" depends="-touch-manifest"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <!--
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye Initialize a property holding a list of jar files on which
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye opengrok.jar depends
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye -->
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <target name="-post-init">
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <pathconvert property="opengrok.lib.files" pathsep=" ">
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <path>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <pathelement path="${javac.classpath}"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </path>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <flattenmapper/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye <map from="" to="lib/"/>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </pathconvert>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye </target>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <!-- Update the manifest file with a classpath attribute -->
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <target name="-update-manifest-classpath">
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <manifest file="${manifest.file}" mode="update">
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <attribute name="Class-Path" value="${opengrok.lib.files}"/>
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik </manifest>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye </target>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen <target name="-pre-jar" depends="-update-manifest-classpath,-update-build-info"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <!--
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen Copy the jars from lib to dist/lib manually if we don't have
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen the copylibs task from NetBeans
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen -->
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">
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco <fileset file="${file.reference.ant.jar}"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen </copy>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <copy todir="${dist.dir}">
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <fileset dir="." includes="${opengrok.lib.files}"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen </copy>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut 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"/>
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen <fileset dir="conf" excludes="web.xml"/>
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen <lib dir="${dist.dir}" includes="opengrok.jar"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <lib dir="${dist.dir}/lib" includes="*.jar" excludes="servlet-api.jar,svn-javahl.jar"/>
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen </war>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <echo message="Generating man page.."/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <java classname="org.opensolaris.opengrok.index.CommandLineOptions"
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen output="${dist.dir}/opengrok.1" failonerror="true" fork="true">
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <classpath>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <pathelement location="dist/opengrok.jar"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <pathelement path="${java.class.path}"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen </classpath>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen </java>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen </target>
7b046969a1b2565787df8ae3a8126359e8cd6fafTrond Norbye
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <target name="package" depends="jar">
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <exec os="SunOS" executable="/usr/bin/pkgmk">
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <arg line="-o -d build -r . -v ${version} -f pkgdef/prototype"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen </exec>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <exec os="SunOS" executable="/usr/bin/pkgtrans">
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <arg line="-s build /dist/OSOLopengrok-${version}.pkg OSOLopengrok"/>
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen </exec>
9661674ed58ba62a40e43d1a4b38d5e77c3c6545Knut Anders Hatlen </target>
9661674ed58ba62a40e43d1a4b38d5e77c3c6545Knut Anders Hatlen
9661674ed58ba62a40e43d1a4b38d5e77c3c6545Knut Anders Hatlen <target name="dist" depends="jar">
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen <tar destfile="${dist.dir}/${distname}-${version}.tar.gz"
2dbc1835e0ae88ad102e2b9a85e5c7b5298b14b6Knut Anders Hatlen compression="gzip">
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen <tarfileset dir="." prefix="${distname}-${version}">
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen <include name="README.txt"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <include name="CHANGES.txt"/>
9cf297d9a579835e9336d587eaee187ca0954767Knut Anders Hatlen <include name="LICENSE.txt"/>
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <include name="paths.tsv"/>
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye </tarfileset>
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <tarfileset dir="." prefix="${distname}-${version}" mode="755">
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <include name="OpenGrok"/>
20a0bde399487a651cdeb66fc8b44b2212036355Trond Norbye <include name="run.sh"/>
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <include name="run-quiet.sh"/>
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye <include name="run.bat"/>
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye </tarfileset>
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye <tarfileset dir="doc" prefix="${distname}-${version}">
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye <include name="EXAMPLE.txt"/>
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye </tarfileset>
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye <tarfileset dir="${dist.dir}" prefix="${distname}-${version}">
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye <include name="opengrok.jar"/>
523201f786f6b12b7cf54091c6e5be167878cbeeTrond Norbye <include name="source.war"/>
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <include name="lib/*"/>
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen </tarfileset>
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen </tar>
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen </target>
c67bbf00f725074786ac47867d2276e7b935b570Trond Norbye
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen <target name="dist-src" depends="init">
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen <mkdir dir="${dist.dir}"/>
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen <exec executable="hg">
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen <arg value="archive"/>
0a0811923cbbd2976425db6f4c78eed811c2825bKnut Anders Hatlen <arg value="-t"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <arg value="tgz"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <arg value="${dist.dir}/${distname}-${version}-src.tar.gz"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen </exec>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen </target>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <target name="-check_findbugs" description="Check that findbugs jar files are present">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <available file="findbugs.jar" type="file" property="findbugs.jar.present">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <filepath refid="findbugs.lib.search.path"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen </available>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <fail unless="findbugs.jar.present" message="Please install Findbugs findbugs.jar in lib-directory (or in ant classpath) to run Findbugs, see README"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen
cdf37a6f2e4e7ca653ef8e791cc8e720fa148a39Peter Bray <available file="findbugs-ant.jar" type="file" property="findbugs-ant.jar.present">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <filepath refid="findbugs.lib.search.path"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen </available>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <fail unless="findbugs-ant.jar.present" message="Please install Findbugs findbugs-ant.jar in lib-directory (or in ant classpath) to run Findbugs, see README"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen </target>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <target name="findbugs" depends="dist, -check_findbugs" description="Runs Findbugs on the OpenGrok source code">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <path id="findbugs.lib" >
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <pathelement location="lib/findbugs/lib/findbugs.jar"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <pathelement location="lib/findbugs/lib/findbugs-ant.jar"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen </path>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
dce551c28e0e9e0a652e512c1094caef574916ceKnut Anders Hatlen <mkdir dir="findbugs"/>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <findbugs projectname="OpenGrok" home="lib/findbugs" output="html" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.html" jvmargs="-Xmx512m">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <auxClasspath>
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <fileset dir="${dist.dir}/lib/">
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen <include name="*.jar"/>
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen </fileset>
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen </auxClasspath>
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen <sourcePath path="src" />
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen <class location="${dist.dir}/opengrok.jar" />
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen </findbugs>
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen </target>
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen <target name="-check_emma" description="Check that emma jar files are present">
edcb01bf549171673fd0bb4239f2edfc7a810397Knut Anders Hatlen <available file="emma.jar" type="file" property="emma.jar.present">
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik <filepath refid="lib.search.path"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik </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."/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <available file="emma_ant.jar" type="file" property="emma_ant.jar.present">
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen 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
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen 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"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <pathelement location="lib/emma_ant.jar"/>
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik </path>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <mkdir dir="${coverage.dir}" />
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <emma enabled="true">
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik <instr instrpath="build/classes"
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik metadatafile="${coverage.dir}/coverage.em"
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik mode="overwrite"
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik filter="+org.opensolaris.*"/>
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik </emma>
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik </target>
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik <target name="-pre-compile-test">
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik <property name="test-sys-prop.emma.coverage.out.file" value="${coverage.dir}/coverage.ec"/>
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik <property name="test-sys-prop.emma.coverage.out.merge" value="true"/>
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik </target>
85e0595857351c6e22f75b8928967d14cb679ac5Jorgen Austvik
2e3c025fdd5908a27cc82eb1d5346368a8be4e0dJorgen Austvik <target name="emma-report" description="Analyze" depends="-check_emma">
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye <emma enabled="true" >
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <report sourcepath="src">
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <!-- collect all EMMA data dumps (metadata and runtime): -->
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye <infileset dir="${coverage.dir}" includes="*.em, *.ec"/>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye <txt outfile="${coverage.dir}/coverage.txt"/>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye <xml outfile="${coverage.dir}/coverage.xml"/>
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik <html outfile="${coverage.dir}/index.html"/>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye </report>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye </emma>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye </target>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye</project>
1f17ba9e3c026d75f488227451416bd72a222afeTrond Norbye