build.xml revision cfb127cc9c800f5e29f3103b9d2b2415e22e3bab
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart PoetteringCDDL HEADER START
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart PoetteringThe contents of this file are subject to the terms of the
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart PoetteringCommon Development and Distribution License (the "License").
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart PoetteringYou may not use this file except in compliance with the License.
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart PoetteringSee LICENSE.txt included in this distribution for the specific
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poetteringlanguage governing permissions and limitations under the License.
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart PoetteringWhen distributing Covered Code, include this CDDL HEADER in each
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poetteringfile and include the License file at LICENSE.txt.
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart PoetteringIf applicable, add the following below this CDDL HEADER, with the
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poetteringfields enclosed by brackets "[]" replaced with your own identifying
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poetteringinformation: Portions Copyright [yyyy] [name of copyright owner]
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart PoetteringCDDL HEADER END
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart PoetteringCopyright 2007 Sun Microsystems, Inc. All rights reserved.
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart PoetteringUse is subject to license terms.
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering<project name="OpenGrok" default="jar" basedir=".">
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <description>Builds, tests, and runs the project opengrok.</description>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <import file="nbproject/build-impl.xml"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <import file="nbproject/profiler-build-impl.xml"/> <!--
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering There exist several targets which are by default empty and which can be
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering used for execution of your tasks. These targets are usually executed
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering before and after some main targets. They are:
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -pre-init: called before initialization of project properties
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -post-init: called after initialization of project properties
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -pre-compile: called before javac compilation
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -post-compile: called after javac compilation
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -pre-compile-single: called before javac compilation of single file
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -post-compile-single: called after javac compilation of single file
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -pre-compile-test: called before javac compilation of JUnit tests
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -post-compile-test: called after javac compilation of JUnit tests
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -pre-compile-test-single: called before javac compilation of single JUnit test
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -post-compile-test-single: called after javac compilation of single JUunit test
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -pre-jar: called before JAR building
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -post-jar: called after JAR building
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -post-clean: called after cleaning build products
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering (Targets beginning with '-' are not intended to be called on their own.)
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering Example of inserting an obfuscator after compilation could look like this:
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <target name="-post-compile">
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <fileset dir="${build.classes.dir}"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering For list of available properties check the imported
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering Another way to customize the build is by overriding existing main targets.
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering The targets of interest are:
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -init-macrodef-javac: defines macro for javac compilation
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -init-macrodef-junit: defines macro for junit execution
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -init-macrodef-debug: defines macro for class debugging
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -init-macrodef-java: defines macro for class execution
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -do-jar-with-manifest: JAR building (if you are using a manifest)
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -do-jar-without-manifest: JAR building (if you are not using a manifest)
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering run: execution of project
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering -javadoc-build: Javadoc generation
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering test-report: JUnit report generation
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering An example of overriding the target for project execution could look like this:
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <target name="run" depends="opengrok-impl.jar">
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <exec dir="bin" executable="launcher.exe">
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <arg file="${dist.jar}"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering Notice that the overridden target depends on the jar target and not only on
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering the compile target as the regular run target does. Again, for a list of available
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering properties which you can use, check the target you are overriding in the
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <property name="distname" value="opengrok"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <property name="findbugs.home" value="${user.home}/.ant/lib/findbugs"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <property name="checkstyle.home" value="${user.home}/.ant/lib/checkstyle"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <property name="pmd.home" value="${user.home}/.ant/lib/pmd"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <property name="test.repositories" value="testdata/repositories"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <property name="test.sources" value="testdata/sources"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <property name="test.cvs" value="${test.repositories}/cvs"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <property name="test.hg" value="${test.repositories}/mercurial"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <property name="test.svn" value="${test.repositories}/svn"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <property name="test.razor" value="${test.repositories}/razor"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <available property="compileSystrayClient" classname="java.awt.TrayIcon"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <target name="-exclude-client" unless="compileSystrayClient">
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <echo>JDK doesn't have java.awt.TrayIcon, excluding building of systray client ... </echo>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <property name="excludes" value="org/opensolaris/opengrok/management/client/**"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <pathelement path="${user.home}/.ant/lib"/>
23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0Lennart Poettering <pathelement path="${findbugs.home}/lib/"/>
<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
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"/>