build.xml revision 781
1d980e5489836e977ba59b419e27b0ec875c4bd3takashiCDDL HEADER START
1d980e5489836e977ba59b419e27b0ec875c4bd3takashiThe contents of this file are subject to the terms of the
1d980e5489836e977ba59b419e27b0ec875c4bd3takashiCommon Development and Distribution License (the "License").
1d980e5489836e977ba59b419e27b0ec875c4bd3takashiYou may not use this file except in compliance with the License.
1d980e5489836e977ba59b419e27b0ec875c4bd3takashiSee LICENSE.txt included in this distribution for the specific
1d980e5489836e977ba59b419e27b0ec875c4bd3takashilanguage governing permissions and limitations under the License.
1d980e5489836e977ba59b419e27b0ec875c4bd3takashiWhen distributing Covered Code, include this CDDL HEADER in each
1d980e5489836e977ba59b419e27b0ec875c4bd3takashifile and include the License file at LICENSE.txt.
1d980e5489836e977ba59b419e27b0ec875c4bd3takashiIf applicable, add the following below this CDDL HEADER, with the
1d980e5489836e977ba59b419e27b0ec875c4bd3takashifields enclosed by brackets "[]" replaced with your own identifying
1d980e5489836e977ba59b419e27b0ec875c4bd3takashiinformation: Portions Copyright [yyyy] [name of copyright owner]
1d980e5489836e977ba59b419e27b0ec875c4bd3takashiCDDL HEADER END
1d980e5489836e977ba59b419e27b0ec875c4bd3takashiCopyright 2007 Sun Microsystems, Inc. All rights reserved.
1d980e5489836e977ba59b419e27b0ec875c4bd3takashiUse is subject to license terms.
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <description>Builds, tests, and runs the project opengrok.</description>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <import file="nbproject/profiler-build-impl.xml"/> <!--
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi There exist several targets which are by default empty and which can be
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi used for execution of your tasks. These targets are usually executed
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi before and after some main targets. They are:
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -pre-init: called before initialization of project properties
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -post-init: called after initialization of project properties
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -pre-compile: called before javac compilation
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -post-compile: called after javac compilation
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -pre-compile-single: called before javac compilation of single file
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -post-compile-single: called after javac compilation of single file
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -pre-compile-test: called before javac compilation of JUnit tests
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -post-compile-test: called after javac compilation of JUnit tests
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -pre-compile-test-single: called before javac compilation of single JUnit test
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -post-compile-test-single: called after javac compilation of single JUunit test
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -pre-jar: called before JAR building
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -post-jar: called after JAR building
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -post-clean: called after cleaning build products
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi (Targets beginning with '-' are not intended to be called on their own.)
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi Example of inserting an obfuscator after compilation could look like this:
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <target name="-post-compile">
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <obfuscate>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <fileset dir="${build.classes.dir}"/>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi </obfuscate>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi For list of available properties check the imported
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi Another way to customize the build is by overriding existing main targets.
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi The targets of interest are:
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -init-macrodef-javac: defines macro for javac compilation
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -init-macrodef-junit: defines macro for junit execution
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -init-macrodef-debug: defines macro for class debugging
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -init-macrodef-java: defines macro for class execution
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -do-jar-with-manifest: JAR building (if you are using a manifest)
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -do-jar-without-manifest: JAR building (if you are not using a manifest)
b9f522ae1c0ed2bf3fc4444245bf28b2e2449a65nd run: execution of project
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi -javadoc-build: Javadoc generation
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi test-report: JUnit report generation
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi An example of overriding the target for project execution could look like this:
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <target name="run" depends="opengrok-impl.jar">
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <exec dir="bin" executable="launcher.exe">
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <arg file="${dist.jar}"/>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi Notice that the overridden target depends on the jar target and not only on
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi the compile target as the regular run target does. Again, for a list of available
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi properties which you can use, check the target you are overriding in the
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <property name="findbugs.home" value="${user.home}/.ant/lib/findbugs"/>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <property name="checkstyle.home" value="${user.home}/.ant/lib/checkstyle"/>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <property name="pmd.home" value="${user.home}/.ant/lib/pmd"/>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <property name="test.repositories" value="testdata/repositories"/>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <property name="test.sources" value="testdata/sources"/>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <property name="test.cvs" value="${test.repositories}/cvs"/>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <property name="test.cvs.repo" value="${test.cvs}/cvsrepo"/>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <property name="test.cvs.root" value="${test.cvs}/cvsroot"/>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <property name="test.hg" value="${test.repositories}/mercurial"/>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <property name="test.svn" value="${test.repositories}/svn"/>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <property name="test.razor" value="${test.repositories}/razor"/>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <available property="compileSystrayClient" classname="java.awt.TrayIcon"/>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <target name="-exclude-client" unless="compileSystrayClient">
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <echo>JDK doesn't have java.awt.TrayIcon, excluding building of systray client ... </echo>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <property name="excludes" value="org/opensolaris/opengrok/management/client/**"/>
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung <available file="JFlex.jar" type="file" property="JFlex.present">
9c1260efa52c82c2a58e5b5f20cd6902563d95f5rbowen </available>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi <fail unless="JFlex.present" message="Please download JFlex (http://jflex.de/) and put JFlex.jar it into /lib directory (or in ant classpath)."/>
<jflex file="src/org/opensolaris/opengrok/analysis/c/CxxSymbolTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/java/JavaSymbolTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispSymbolTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/tcl/TclSymbolTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainFullTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainSymbolTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/document/TroffFullTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/sh/ShSymbolTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/search/context/HistoryLineTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/search/context/PlainLineTokenizer.lex" destdir="${gensrcdir}"/>
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/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="dist, -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="dist, -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">${user.dir}/${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"/>