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