build.xml revision 981
a23fd118e437af0a7877dd313db8fdaa3537c675ylCDDL HEADER START
a23fd118e437af0a7877dd313db8fdaa3537c675ylThe contents of this file are subject to the terms of the
a23fd118e437af0a7877dd313db8fdaa3537c675ylCommon Development and Distribution License (the "License").
a23fd118e437af0a7877dd313db8fdaa3537c675ylYou may not use this file except in compliance with the License.
a23fd118e437af0a7877dd313db8fdaa3537c675ylSee LICENSE.txt included in this distribution for the specific
a23fd118e437af0a7877dd313db8fdaa3537c675yllanguage governing permissions and limitations under the License.
a23fd118e437af0a7877dd313db8fdaa3537c675ylWhen distributing Covered Code, include this CDDL HEADER in each
a23fd118e437af0a7877dd313db8fdaa3537c675ylfile and include the License file at LICENSE.txt.
a23fd118e437af0a7877dd313db8fdaa3537c675ylIf applicable, add the following below this CDDL HEADER, with the
a23fd118e437af0a7877dd313db8fdaa3537c675ylfields enclosed by brackets "[]" replaced with your own identifying
a23fd118e437af0a7877dd313db8fdaa3537c675ylinformation: Portions Copyright [yyyy] [name of copyright owner]
a23fd118e437af0a7877dd313db8fdaa3537c675ylCDDL HEADER END
8347601bcb0a439f6e50fc36b4039a73d08700e1ylCopyright 2007 Sun Microsystems, Inc. All rights reserved.
a23fd118e437af0a7877dd313db8fdaa3537c675ylUse is subject to license terms.
a23fd118e437af0a7877dd313db8fdaa3537c675yl <description>Builds, tests, and runs the project opengrok.</description>
a23fd118e437af0a7877dd313db8fdaa3537c675yl There exist several targets which are by default empty and which can be
8347601bcb0a439f6e50fc36b4039a73d08700e1yl used for execution of your tasks. These targets are usually executed
8347601bcb0a439f6e50fc36b4039a73d08700e1yl before and after some main targets. They are:
a23fd118e437af0a7877dd313db8fdaa3537c675yl -pre-init: called before initialization of project properties
a23fd118e437af0a7877dd313db8fdaa3537c675yl -post-init: called after initialization of project properties
a23fd118e437af0a7877dd313db8fdaa3537c675yl -pre-compile: called before javac compilation
a23fd118e437af0a7877dd313db8fdaa3537c675yl -post-compile: called after javac compilation
a23fd118e437af0a7877dd313db8fdaa3537c675yl -pre-compile-single: called before javac compilation of single file
a23fd118e437af0a7877dd313db8fdaa3537c675yl -post-compile-single: called after javac compilation of single file
a23fd118e437af0a7877dd313db8fdaa3537c675yl -pre-compile-test: called before javac compilation of JUnit tests
a23fd118e437af0a7877dd313db8fdaa3537c675yl -post-compile-test: called after javac compilation of JUnit tests
a23fd118e437af0a7877dd313db8fdaa3537c675yl -pre-compile-test-single: called before javac compilation of single JUnit test
a23fd118e437af0a7877dd313db8fdaa3537c675yl -post-compile-test-single: called after javac compilation of single JUunit test
a23fd118e437af0a7877dd313db8fdaa3537c675yl -pre-jar: called before JAR building
a23fd118e437af0a7877dd313db8fdaa3537c675yl -post-jar: called after JAR building
a23fd118e437af0a7877dd313db8fdaa3537c675yl -post-clean: called after cleaning build products
a23fd118e437af0a7877dd313db8fdaa3537c675yl (Targets beginning with '-' are not intended to be called on their own.)
a23fd118e437af0a7877dd313db8fdaa3537c675yl Example of inserting an obfuscator after compilation could look like this:
a23fd118e437af0a7877dd313db8fdaa3537c675yl <target name="-post-compile">
a23fd118e437af0a7877dd313db8fdaa3537c675yl <obfuscate>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <fileset dir="${build.classes.dir}"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl </obfuscate>
a23fd118e437af0a7877dd313db8fdaa3537c675yl For list of available properties check the imported
a23fd118e437af0a7877dd313db8fdaa3537c675yl Another way to customize the build is by overriding existing main targets.
a23fd118e437af0a7877dd313db8fdaa3537c675yl The targets of interest are:
a23fd118e437af0a7877dd313db8fdaa3537c675yl -init-macrodef-javac: defines macro for javac compilation
a23fd118e437af0a7877dd313db8fdaa3537c675yl -init-macrodef-junit: defines macro for junit execution
a23fd118e437af0a7877dd313db8fdaa3537c675yl -init-macrodef-debug: defines macro for class debugging
a23fd118e437af0a7877dd313db8fdaa3537c675yl -init-macrodef-java: defines macro for class execution
a23fd118e437af0a7877dd313db8fdaa3537c675yl -do-jar-with-manifest: JAR building (if you are using a manifest)
a23fd118e437af0a7877dd313db8fdaa3537c675yl -do-jar-without-manifest: JAR building (if you are not using a manifest)
a23fd118e437af0a7877dd313db8fdaa3537c675yl run: execution of project
a23fd118e437af0a7877dd313db8fdaa3537c675yl -javadoc-build: Javadoc generation
a23fd118e437af0a7877dd313db8fdaa3537c675yl test-report: JUnit report generation
a23fd118e437af0a7877dd313db8fdaa3537c675yl An example of overriding the target for project execution could look like this:
a23fd118e437af0a7877dd313db8fdaa3537c675yl <target name="run" depends="opengrok-impl.jar">
a23fd118e437af0a7877dd313db8fdaa3537c675yl <exec dir="bin" executable="launcher.exe">
a23fd118e437af0a7877dd313db8fdaa3537c675yl <arg file="${dist.jar}"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl Notice that the overridden target depends on the jar target and not only on
a23fd118e437af0a7877dd313db8fdaa3537c675yl the compile target as the regular run target does. Again, for a list of available
a23fd118e437af0a7877dd313db8fdaa3537c675yl properties which you can use, check the target you are overriding in the
a23fd118e437af0a7877dd313db8fdaa3537c675yl <property name="findbugs.home" value="${user.home}/.ant/lib/findbugs"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <property name="checkstyle.home" value="${user.home}/.ant/lib/checkstyle"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <property name="pmd.home" value="${user.home}/.ant/lib/pmd"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <property name="test.repositories" value="testdata/repositories"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <property name="test.cvs" value="${test.repositories}/cvs"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <property name="test.cvs.repo" value="${test.cvs}/cvsrepo"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <property name="test.cvs.root" value="${test.cvs}/cvsroot"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <property name="test.hg" value="${test.repositories}/mercurial"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <property name="test.svn" value="${test.repositories}/svn"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <property name="test.razor" value="${test.repositories}/razor"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <available property="compileSystrayClient" classname="java.awt.TrayIcon"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <target name="-exclude-client" unless="compileSystrayClient">
a23fd118e437af0a7877dd313db8fdaa3537c675yl <echo>JDK doesn't have java.awt.TrayIcon, excluding building of systray client ... </echo>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <property name="excludes" value="org/opensolaris/opengrok/management/client/**"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <available file="JFlex.jar" type="file" property="JFlex.present">
a23fd118e437af0a7877dd313db8fdaa3537c675yl </available>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <fail unless="JFlex.present" message="Please download JFlex (http://jflex.de/) and put JFlex.jar it into /lib directory (or in ant classpath)."/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpath="lib/JFlex.jar;/lib/JFlex.jar"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${src.generatedsrc.dir}"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/c/CSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/c/CXref.lex" destdir="${src.generatedsrc.dir}"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/c/CxxSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/c/CxxXref.lex" destdir="${src.generatedsrc.dir}"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/fortran/FortranSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/fortran/FortranXref.lex" destdir="${src.generatedsrc.dir}"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/java/JavaSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/java/JavaXref.lex" destdir="${src.generatedsrc.dir}"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/lisp/LispSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/lisp/LispXref.lex" destdir="${src.generatedsrc.dir}"/>
8347601bcb0a439f6e50fc36b4039a73d08700e1yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/tcl/TclSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
8347601bcb0a439f6e50fc36b4039a73d08700e1yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/tcl/TclXref.lex" destdir="${src.generatedsrc.dir}"/>
8347601bcb0a439f6e50fc36b4039a73d08700e1yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/PlainFullTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
a23fd118e437af0a7877dd313db8fdaa3537c675yl <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/PlainSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
<jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${src.generatedsrc.dir}"/>
<jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/XMLXref.lex" destdir="${src.generatedsrc.dir}"/>
<jflex file="${src.dir}/org/opensolaris/opengrok/analysis/sql/SQLXref.lex" destdir="${src.generatedsrc.dir}"/>
<jflex file="${src.dir}/org/opensolaris/opengrok/analysis/document/TroffXref.lex" destdir="${src.generatedsrc.dir}"/>
<jflex file="${src.dir}/org/opensolaris/opengrok/analysis/document/TroffFullTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
<jflex file="${src.dir}/org/opensolaris/opengrok/analysis/sh/ShSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
<jflex file="${src.dir}/org/opensolaris/opengrok/analysis/sh/ShXref.lex" destdir="${src.generatedsrc.dir}"/>
<jflex file="${src.dir}/org/opensolaris/opengrok/search/context/HistoryLineTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
<jflex file="${src.dir}/org/opensolaris/opengrok/search/context/PlainLineTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
file="${build.classes.dir}/org/opensolaris/opengrok/info.properties">
Create an empty manifest file so that nbproject/build-impl.xml
opengrok.jar depends
value="${opengrok.lib.files} lib/derbyclient.jar lib/derby.jar"/>
unless="manifest.available+main.class+mkdist.available">
<fail unless="findbugs.jar.present" message="Please install Findbugs findbugs.jar in ~/.ant/lib-directory (or in ant classpath) to run Findbugs, see README"/>
<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"/>
<target name="findbugs" depends="jar, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate HTML output">
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
<findbugs projectname="OpenGrok" home="${findbugs.home}" output="html" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.html" jvmargs="-Xmx512m">
<target name="findbugs-xml" depends="jar, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate XML output">
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
<findbugs projectname="OpenGrok" home="${findbugs.home}" output="xml" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.xml" jvmargs="-Xmx512m">
<fail unless="checkstyle.jar.present" message="Please install checkstyle-all.jar in lib-directory (or in ant classpath) to run Checkstyle, see README."/>
<target name="checkstyle" depends="compile, -check_checkstyle" description="Run checkstyle on OpenGrok source code">
<fail unless="pmd.jar.present" message="Please install pmd.jar in lib-directory (or in ant classpath) to run PMD, see README."/>
<fail unless="emma.jar.present" message="Please install emma.jar in lib-directory (or in ant classpath) to run Emma, see README."/>
<fail unless="emma_ant.jar.present" message="Please install emma_ant.jar in lib-directory (or in ant classpath) to run Emma, see README."/>
<target name="emma-instrument" depends="compile, -check_emma" description="Instruments the source code for Emma code coverage analysis">
metadatafile="${coverage.dir}/coverage.em"
filter="+org.opensolaris.*,-org.opensolaris.opengrok.management.client.*"/>
<concat destfile="${test.cvs.repo}/CVS/Root" append="no" force="yes" eol="unix">${basedir}/${test.cvs.root}/
basedir="${test.sources}"
basedir="${test.repositories}"
<fileset dir="ext/SampleRazorRepository/Repository/OpenGrokSample/RAZOR_UNIVERSE/DOMAIN_01/Simple"/>
<!--copy todir="${test.razor}/Razor-Simple/SimpleCProgram-BinaryRelease/.razor">
<fileset dir="ext/SampleRazorRepository/Repository/OpenGrokSample/RAZOR_UNIVERSE/DOMAIN_01/Simple"/>