build.xml revision ab6406f9557d78081e2476b704d189ee42e7bb04
<?xml version="1.0" encoding="UTF-8"?>
<!--
CDDL HEADER START
The contents of this file are subject to the terms of the
Common Development and Distribution License (the "License").
You may not use this file except in compliance with the License.
See LICENSE.txt included in this distribution for the specific
language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each
file and include the License file at LICENSE.txt.
If applicable, add the following below this CDDL HEADER, with the
fields enclosed by brackets "[]" replaced with your own identifying
information: Portions Copyright [yyyy] [name of copyright owner]
CDDL HEADER END
Copyright 2005 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
ident "%Z%%M% %I% %E% SMI"
-->
<project default="build">
<taskdef classname="JFlex.anttask.JFlexTask" name="jflex"/>
<property name="version" value="0.4"/>
<property name="builddir" value="build"/>
<property name="distdir" value="dist"/>
<property name="outputjar" value="opengrok.jar"/>
<property name="distname" value="opengrok"/>
<property name="classdir" value="${builddir}/classes"/>
<property name="gensrcdir" value="${builddir}/src"/>
<property name="webapp" value="${builddir}/webapp"/>
<path id="compilecp">
<fileset dir="lib/" includes="*.jar"/>
</path>
<path id="runcp">
<pathelement location="${outputjar}"/>
<path refid="compilecp"/>
<pathelement location="."/>
</path>
<path id="junitcp">
<path refid="runcp"/>
<pathelement location="${classdir}"/>
</path>
<target name="jflex">
<mkdir dir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/c/CSymbolTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/c/CXref.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/java/JavaSymbolTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/java/JavaXref.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispSymbolTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispXref.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/plain/PlainXref.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/plain/XMLXref.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/document/TroffXref.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/analysis/sh/ShXref.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}"/>
</target>
<target name="compile" depends="jflex">
<mkdir dir="${classdir}"/>
<javac destdir="${classdir}" deprecation="true" debug="true" optimize="on" >
<src path="src"/>
<src path="${gensrcdir}"/>
<classpath refid="compilecp"/>
<compilerarg value="-Xlint:unchecked"/>
</javac>
</target>
<target name="build" depends="compile">
<jar jarfile="${outputjar}">
<fileset dir="${classdir}" excludes="**/test/"/>
<fileset dir="src" includes="org/opensolaris/opengrok/index/*.png"/>
<fileset dir="src" includes="org/opensolaris/opengrok/search/scope/*.gif"/>
<manifest>
<attribute name="Main-Class" value="org.opensolaris.opengrok.index.Indexer"/>
<attribute name="Class-Path" value="lib/lucene-core-2.1.0.jar
lib/lucene-spellchecker-2.1.0.jar
lib/jakarta-oro-2.0.8.jar
lib/org.apache.commons.jrcs.rcs.jar
lib/org.apache.commons.jrcs.diff.jar
lib/bcel-5.1.jar
lib/servlet-api.jar
lib/ant-tools.jar
lib/swing-layout-0.9.jar
lib/svn-javahl.jar
"/>
</manifest>
</jar>
</target>
<target name="javadoc" depends="jflex">
<javadoc destdir="${builddir}/api"
packagenames="org.opensolaris.opengrok.*">
<sourcepath>
<pathelement path="src"/>
<pathelement path="${gensrcdir}"/>
</sourcepath>
<tag name="todo"/>
<classpath refid="compilecp"/>
</javadoc>
</target>
<target name="webapp" depends="compile,build">
<war destfile="source.war" webxml="conf/default/web.xml">
<fileset dir="web"/>
<fileset dir="conf/default/html"/>
<lib dir="." includes="opengrok.jar"/>
<lib dir="lib" includes="*.jar" excludes="servlet-api.jar"/>
</war>
</target>
<target name="polished" depends="compile,build">
<war destfile="source.war" webxml="conf/polished/web.xml">
<fileset dir="web"/>
<fileset dir="conf/polished/html"/>
<lib dir="." includes="opengrok.jar"/>
<lib dir="lib" includes="*.jar" excludes="servlet-api.jar"/>
</war>
</target>
<target name="offwhite" depends="compile,build">
<war destfile="source.war" webxml="conf/offwhite/web.xml">
<fileset dir="web"/>
<fileset dir="conf/offwhite/html"/>
<lib dir="." includes="opengrok.jar"/>
<lib dir="lib" includes="*.jar" excludes="servlet-api.jar"/>
</war>
</target>
<target name="os-webapp" depends="compile,build">
<war destfile="source.war" webxml="conf/opensolaris/web.xml">
<fileset dir="web"/>
<fileset dir="conf/opensolaris/html"/>
<lib dir="." includes="opengrok.jar"/>
<lib dir="lib" includes="*.jar" excludes="servlet-api.jar"/>
</war>
</target>
<target name="dist" depends="compile,build">
<mkdir dir="${distdir}"/>
<tar destfile="${distdir}/${distname}-${version}.tar">
<tarfileset dir="." username="ant" group="ant" prefix="${distname}-${version}/">
<include name="README.txt" />
<include name="CHANGES.txt" />
<include name="build.xml" />
<include name="paths.tsv" />
<include name="LICENSE.*" />
<include name="lib/*.jar" />
<include name="source.war" />
</tarfileset>
<tarfileset dir="." username="ant" group="ant" prefix="${distname}-${version}/" mode="0755">
<include name="${outputjar}"/>
<include name="run.sh"/>
<include name="run.bat"/>
<include name="run-quiet.sh"/>
<include name="${outputjar}"/>
</tarfileset>
<tarfileset dir="src" prefix="${distname}-${version}/src/"/>
<tarfileset dir="ext" prefix="${distname}-${version}/ext/"/>
<tarfileset dir="web" prefix="${distname}-${version}/web/"/>
<tarfileset dir="conf/default" prefix="${distname}-${version}/conf/default"/>
<tarfileset dir="conf/polished" prefix="${distname}-${version}/conf/polished"/>
<tarfileset dir="conf/offwhite" prefix="${distname}-${version}/conf/offwhite"/>
<tarfileset dir="pkgdef" prefix="${distname}-${version}/pkgdef"/>
</tar>
<gzip zipfile="${distdir}/${distname}-${version}.tar.gz" src="${distdir}/${distname}-${version}.tar"/>
<zip destfile="${distdir}/${distname}-${version}.zip">
<zipfileset dir="." prefix="${distname}-${version}/">
<include name="README.txt" />
<include name="CHANGES.txt" />
<include name="build.xml" />
<include name="paths.tsv" />
<include name="LICENSE.*" />
<include name="lib/*.jar" />
<include name="source.war" />
<include name="${outputjar}"/>
<include name="run.sh"/>
<include name="run.bat"/>
<include name="run-quiet.sh"/>
</zipfileset>
<zipfileset dir="src" prefix="${distname}-${version}/src/"/>
<zipfileset dir="ext" prefix="${distname}-${version}/ext/"/>
<zipfileset dir="web" prefix="${distname}-${version}/web/"/>
<zipfileset dir="conf/default" prefix="${distname}-${version}/conf/default"/>
<zipfileset dir="conf/polished" prefix="${distname}-${version}/conf/polished"/>
<zipfileset dir="conf/offwhite" prefix="${distname}-${version}/conf/offwhite"/>
<zipfileset dir="pkgdef" prefix="${distname}-${version}/pkgdef"/>
</zip>
</target>
<target name="dist-src" depends="compile">
<mkdir dir="${distdir}"/>
<tar destfile="${distdir}/${distname}-${version}-src.tar">
<tarfileset dir="." username="ant" group="ant" prefix="${distname}-${version}/">
<include name="README.txt" />
<include name="CHANGES.txt" />
<include name="build.xml" />
<include name="paths.tsv" />
<include name="LICENSE.*" />
</tarfileset>
<tarfileset dir="." username="ant" group="ant" prefix="${distname}-${version}/" mode="0755">
<include name="${outputjar}"/>
<include name="run.sh"/>
<include name="run.bat"/>
<include name="run-quiet.sh"/>
</tarfileset>
<tarfileset dir="src" prefix="${distname}-${version}/src/"/>
<tarfileset dir="web" prefix="${distname}-${version}/web/"/>
<tarfileset dir="conf/default" prefix="${distname}-${version}/conf/default"/>
<tarfileset dir="conf/polished" prefix="${distname}-${version}/conf/polished"/>
<tarfileset dir="conf/offwhite" prefix="${distname}-${version}/conf/offwhite"/>
<tarfileset dir="pkgdef" prefix="${distname}-${version}/pkgdef"/>
</tar>
<gzip zipfile="${distdir}/${distname}-${version}-src.tar.gz" src="${distdir}/${distname}-${version}-src.tar"/>
<zip destfile="${distdir}/${distname}-${version}-src.zip">
<zipfileset dir="." prefix="${distname}-${version}/">
<include name="README.txt" />
<include name="CHANGES.txt" />
<include name="build.xml" />
<include name="paths.tsv" />
<include name="LICENSE.*" />
<include name="run.sh"/>
<include name="run.bat"/>
<include name="run-quiet.sh"/>
</zipfileset>
<zipfileset dir="src" prefix="${distname}-${version}/src/"/>
<zipfileset dir="web" prefix="${distname}-${version}/web/"/>
<zipfileset dir="conf/default" prefix="${distname}-${version}/conf/default"/>
<zipfileset dir="conf/polished" prefix="${distname}-${version}/conf/polished"/>
<zipfileset dir="conf/offwhite" prefix="${distname}-${version}/conf/offwhite"/>
<zipfileset dir="pkgdef" prefix="${distname}-${version}/pkgdef"/>
</zip>
</target>
<target name="run" depends="build">
<java classname="org.opensolaris.opengrok.index.Indexer" classpath="opengrok.jar">
<classpath refid="compilecp"/>
</java>
</target>
<target name="rejar" depends="build">
<mkdir dir="${builddir}/tmp"/>
<exec os="SunOS" executable="/usr/bin/jar" dir="build/tmp">
<arg line="-xf /opengrok.jar"/>
</exec>
<exec os="SunOS" executable="/usr/bin/jar" dir="build/tmp">
<arg line="-Mcf /opengrok.jar META-INF org"/>
</exec>
<delete dir="${builddir}/tmp"/>
</target>
<target name="package" depends="rejar">
<exec os="SunOS" executable="/usr/bin/pkgmk">
<arg line="-o -d build -r . -v ${version} -f pkgdef/prototype"/>
</exec>
<exec os="SunOS" executable="/usr/bin/pkgtrans">
<arg line="-s build /dist/OSOLopengrok-${version}.pkg OSOLopengrok"/>
</exec>
</target>
<target name="release" depends="webapp,dist,dist-src,package"/>
<target name="clean">
<delete dir="${builddir}"/>
<delete dir="${distdir}"/>
<delete file="source.war"/>
<delete file="opengrok.jar"/>
</target>
</project>