build.xml revision 219
132N/A<?xml version="1.0" encoding="UTF-8"?>
132N/A<!--
132N/A
132N/ACDDL HEADER START
132N/A
132N/AThe contents of this file are subject to the terms of the
132N/ACommon Development and Distribution License (the "License").
132N/AYou may not use this file except in compliance with the License.
132N/A
132N/ASee LICENSE.txt included in this distribution for the specific
132N/Alanguage governing permissions and limitations under the License.
132N/A
132N/AWhen distributing Covered Code, include this CDDL HEADER in each
132N/Afile and include the License file at LICENSE.txt.
132N/AIf applicable, add the following below this CDDL HEADER, with the
132N/Afields enclosed by brackets "[]" replaced with your own identifying
132N/Ainformation: Portions Copyright [yyyy] [name of copyright owner]
132N/A
132N/ACDDL HEADER END
132N/A
132N/ACopyright 2007 Sun Microsystems, Inc. All rights reserved.
132N/AUse is subject to license terms.
132N/A
132N/A-->
215N/A<project name="OpenGrok" default="jar" basedir=".">
132N/A <description>Builds, tests, and runs the project opengrok.</description>
132N/A <import file="nbproject/build-impl.xml"/>
132N/A
132N/A <import file="nbproject/profiler-build-impl.xml"/> <!--
132N/A
132N/A There exist several targets which are by default empty and which can be
132N/A used for execution of your tasks. These targets are usually executed
132N/A before and after some main targets. They are:
132N/A
132N/A -pre-init: called before initialization of project properties
132N/A -post-init: called after initialization of project properties
132N/A -pre-compile: called before javac compilation
132N/A -post-compile: called after javac compilation
132N/A -pre-compile-single: called before javac compilation of single file
132N/A -post-compile-single: called after javac compilation of single file
132N/A -pre-compile-test: called before javac compilation of JUnit tests
132N/A -post-compile-test: called after javac compilation of JUnit tests
132N/A -pre-compile-test-single: called before javac compilation of single JUnit test
132N/A -post-compile-test-single: called after javac compilation of single JUunit test
132N/A -pre-jar: called before JAR building
132N/A -post-jar: called after JAR building
132N/A -post-clean: called after cleaning build products
132N/A
132N/A (Targets beginning with '-' are not intended to be called on their own.)
132N/A
132N/A Example of inserting an obfuscator after compilation could look like this:
132N/A
132N/A <target name="-post-compile">
132N/A <obfuscate>
132N/A <fileset dir="${build.classes.dir}"/>
132N/A </obfuscate>
132N/A </target>
132N/A
132N/A For list of available properties check the imported
132N/A nbproject/build-impl.xml file.
132N/A
132N/A
132N/A Another way to customize the build is by overriding existing main targets.
132N/A The targets of interest are:
132N/A
132N/A -init-macrodef-javac: defines macro for javac compilation
132N/A -init-macrodef-junit: defines macro for junit execution
132N/A -init-macrodef-debug: defines macro for class debugging
132N/A -init-macrodef-java: defines macro for class execution
132N/A -do-jar-with-manifest: JAR building (if you are using a manifest)
132N/A -do-jar-without-manifest: JAR building (if you are not using a manifest)
132N/A run: execution of project
132N/A -javadoc-build: Javadoc generation
132N/A test-report: JUnit report generation
132N/A
132N/A An example of overriding the target for project execution could look like this:
132N/A
132N/A <target name="run" depends="opengrok-impl.jar">
132N/A <exec dir="bin" executable="launcher.exe">
132N/A <arg file="${dist.jar}"/>
132N/A </exec>
132N/A </target>
132N/A
132N/A Notice that the overridden target depends on the jar target and not only on
132N/A the compile target as the regular run target does. Again, for a list of available
132N/A properties which you can use, check the target you are overriding in the
132N/A nbproject/build-impl.xml file.
132N/A
132N/A -->
219N/A
219N/A <property name="version" value="0.6"/>
219N/A
132N/A <taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpath="lib/JFlex.jar"/>
132N/A <property name="gensrcdir" value="generatedsrc"/>
132N/A <target name="jflex">
132N/A <mkdir dir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/c/CSymbolTokenizer.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/c/CXref.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/java/JavaSymbolTokenizer.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/java/JavaXref.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispSymbolTokenizer.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispXref.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainFullTokenizer.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainSymbolTokenizer.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/plain/XMLXref.lex" destdir="${gensrcdir}"/>
190N/A <jflex file="src/org/opensolaris/opengrok/analysis/sql/SQLXref.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/document/TroffXref.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/document/TroffFullTokenizer.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/sh/ShSymbolTokenizer.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/analysis/sh/ShXref.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/search/context/HistoryLineTokenizer.lex" destdir="${gensrcdir}"/>
132N/A <jflex file="src/org/opensolaris/opengrok/search/context/PlainLineTokenizer.lex" destdir="${gensrcdir}"/>
132N/A </target>
132N/A
132N/A <target name="-pre-compile" depends="jflex"/>
132N/A <target name="-post-clean">
132N/A <delete dir="${gensrcdir}"/>
213N/A <delete file="${manifest.file}"/>
132N/A </target>
132N/A
211N/A <!--
213N/A Create an empty manifest file so that nbproject/build-impl.xml
213N/A notices that a manifest should be added to the jar file
213N/A -->
213N/A <target name="-touch-manifest">
213N/A <!-- no attributes, main-class and class-path will be added later -->
213N/A <manifest file="manifest.mf" mode="replace"/>
213N/A </target>
213N/A
213N/A <target name="-pre-init" depends="-touch-manifest"/>
213N/A
213N/A <!--
213N/A Initialize a property holding a list of jar files on which
213N/A opengrok.jar depends
213N/A -->
213N/A <target name="-post-init">
213N/A <pathconvert property="opengrok.lib.files" pathsep=" ">
213N/A <path>
213N/A <pathelement path="${javac.classpath}"/>
213N/A </path>
213N/A <flattenmapper/>
213N/A <map from="" to="lib/"/>
213N/A </pathconvert>
213N/A </target>
213N/A
213N/A <!-- Update the manifest file with a classpath attribute -->
213N/A <target name="-update-manifest-classpath">
213N/A <manifest file="${manifest.file}" mode="update">
213N/A <attribute name="Class-Path" value="${opengrok.lib.files}"/>
213N/A </manifest>
213N/A </target>
213N/A
213N/A <target name="-pre-jar" depends="-update-manifest-classpath"/>
213N/A
213N/A <!--
211N/A Copy the jars from lib to dist/lib manually if we don't have
211N/A the copylibs task from NetBeans
211N/A -->
211N/A <target name="-copy-lib-without-netbeans"
211N/A unless="manifest.available+main.class+mkdist.available">
213N/A <copy todir="${dist.dir}">
213N/A <fileset dir="." includes="${opengrok.lib.files}"/>
211N/A </copy>
211N/A </target>
132N/A
211N/A <target name="-post-jar" depends="-copy-lib-without-netbeans">
144N/A <war destfile="${dist.war}" webxml="conf/web.xml">
144N/A <fileset dir="web"/>
144N/A <fileset dir="conf" excludes="web.xml"/>
144N/A <lib dir="${dist.dir}" includes="opengrok.jar"/>
177N/A <lib dir="${dist.dir}/lib" includes="*.jar" excludes="servlet-api.jar,svn-javahl.jar"/>
144N/A </war>
144N/A </target>
219N/A
219N/A <target name="package" depends="jar">
219N/A <exec os="SunOS" executable="/usr/bin/pkgmk">
219N/A <arg line="-o -d build -r . -v ${version} -f pkgdef/prototype"/>
219N/A </exec>
219N/A <exec os="SunOS" executable="/usr/bin/pkgtrans">
219N/A <arg line="-s build /dist/OSOLopengrok-${version}.pkg OSOLopengrok"/>
219N/A </exec>
219N/A </target>
132N/A</project>