build.xml revision c0550b01024b910b8c1468811c0ea663b10b1372
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-->
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye<project name="OpenGrok" default="default" 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 -->
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpath="lib/JFlex.jar"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <property name="gensrcdir" value="generatedsrc"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <target name="jflex">
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <mkdir dir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/c/CSymbolTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/c/CXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/java/JavaSymbolTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/java/JavaXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispSymbolTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainFullTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainSymbolTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/plain/XMLXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/document/TroffXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/document/TroffFullTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/sh/ShSymbolTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/analysis/sh/ShXref.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/search/context/HistoryLineTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <jflex file="src/org/opensolaris/opengrok/search/context/PlainLineTokenizer.lex" destdir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye </target>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <target name="-pre-compile" depends="jflex"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <target name="-post-clean">
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye <delete dir="${gensrcdir}"/>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye </target>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <target name="-post-jar">
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <war destfile="${dist.war}" webxml="conf/web.xml">
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <fileset dir="web"/>
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <fileset dir="conf" excludes="web.xml"/>
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <lib dir="${dist.dir}" includes="opengrok.jar"/>
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye <lib dir="${dist.dir}/lib" includes="*.jar" excludes="servlet-api.jar"/>
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye </war>
c0550b01024b910b8c1468811c0ea663b10b1372Trond Norbye </target>
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye</project>