build.xml revision 1319
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
1149N/ACopyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
132N/A
132N/A-->
215N/A<project name="OpenGrok" default="jar" basedir=".">
132N/A <description>Builds, tests, and runs the project opengrok.</description>
1215N/A <property name="build.sysclasspath" value="ignore"/>
1215N/A <property file="${user.home}/config/ant/${ant.project.name}.properties" />
1318N/A <property file="${user.home}/config/ant/global.properties" />
1176N/A
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
1318N/A <property name="version" value="0.12-dev"/>
220N/A <property name="distname" value="opengrok"/>
1176N/A <property name="src.dir" location="src"/>
1176N/A <property name="src.generatedsrc.dir" location="generatedsrc"/>
341N/A
341N/A <property name="findbugs.home" value="${user.home}/.ant/lib/findbugs"/>
379N/A <property name="checkstyle.home" value="${user.home}/.ant/lib/checkstyle"/>
411N/A <property name="pmd.home" value="${user.home}/.ant/lib/pmd"/>
487N/A
706N/A <property name="test.repositories" value="testdata/repositories"/>
706N/A <property name="test.sources" value="testdata/sources"/>
706N/A <property name="test.cvs" value="${test.repositories}/cvs"/>
741N/A <property name="test.cvs.repo" value="${test.cvs}/cvsrepo"/>
741N/A <property name="test.cvs.root" value="${test.cvs}/cvsroot"/>
706N/A <property name="test.hg" value="${test.repositories}/mercurial"/>
706N/A <property name="test.svn" value="${test.repositories}/svn"/>
736N/A <property name="test.razor" value="${test.repositories}/razor"/>
487N/A
704N/A <available property="compileSystrayClient" classname="java.awt.TrayIcon"/>
487N/A
704N/A <target name="-exclude-client" unless="compileSystrayClient">
1215N/A <echo>JDK doesn't have java.awt.TrayIcon, excluding building of systray client ... </echo>
1215N/A <property name="excludes" value="org/opensolaris/opengrok/management/client/**"/>
487N/A </target>
487N/A
320N/A
336N/A <path id="lib.search.path">
336N/A <pathelement path="${user.home}/.ant/lib"/>
336N/A <pathelement path="${java.class.path}"/>
1215N/A <pathelement path="lib"/>
1215N/A <pathelement path="/lib"/>
336N/A </path>
336N/A
336N/A <path id="findbugs.lib.search.path">
341N/A <pathelement path="${findbugs.home}/lib/"/>
487N/A <pathelement path="${java.class.path}"/>
336N/A <pathelement path="lib/findbugs/lib/"/>
336N/A </path>
336N/A
379N/A <path id="checkstyle.lib.search.path">
379N/A <pathelement path="${checkstyle.home}/"/>
487N/A <pathelement path="${java.class.path}"/>
379N/A </path>
379N/A
411N/A <path id="pmd.lib.search.path">
411N/A <pathelement path="${pmd.home}/lib/"/>
487N/A <pathelement path="${java.class.path}"/>
411N/A <pathelement path="lib/pmd/lib/"/>
411N/A </path>
411N/A
320N/A <available file="JFlex.jar" type="file" property="JFlex.present">
336N/A <filepath refid="lib.search.path"/>
320N/A </available>
336N/A <fail unless="JFlex.present" message="Please download JFlex (http://jflex.de/) and put JFlex.jar it into /lib directory (or in ant classpath)."/>
1031N/A
1031N/A <taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpathref="lib.search.path"/>
132N/A <target name="jflex">
949N/A <mkdir dir="${src.generatedsrc.dir}"/>
1215N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/c/CSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/c/CXref.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/c/CxxSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/c/CxxXref.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/fortran/FortranSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/fortran/FortranXref.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/java/JavaSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/java/JavaXref.lex" destdir="${src.generatedsrc.dir}"/>
1272N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/javascript/JavaScriptSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
1272N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/javascript/JavaScriptXref.lex" destdir="${src.generatedsrc.dir}"/>
1028N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/python/PythonSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
1028N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/python/PythonXref.lex" destdir="${src.generatedsrc.dir}"/>
1072N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/perl/PerlSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
1072N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/perl/PerlXref.lex" destdir="${src.generatedsrc.dir}"/>
1215N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/php/PhpSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
1215N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/php/PhpXref.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/lisp/LispSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/lisp/LispXref.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/tcl/TclSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/tcl/TclXref.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/PlainFullTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/PlainSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/XMLXref.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/sql/SQLXref.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/document/TroffXref.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/document/TroffFullTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/sh/ShSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/sh/ShXref.lex" destdir="${src.generatedsrc.dir}"/>
1256N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/vb/VBSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
1256N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/vb/VBXref.lex" destdir="${src.generatedsrc.dir}"/>
1275N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/csharp/CSharpSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
1275N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/csharp/CSharpXref.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/search/context/HistoryLineTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
949N/A <jflex file="${src.dir}/org/opensolaris/opengrok/search/context/PlainLineTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
132N/A </target>
132N/A
230N/A <property name="hg" value="hg"/>
989N/A
989N/A <!-- Get the id of the changeset we're building from using a
989N/A Mercurial command.
989N/A -->
989N/A <target name="-get-changeset-from-command"
989N/A depends="-check-is-hg-repo" if="build.from.repo">
230N/A <exec executable="${hg}"
230N/A failifexecutionfails="no"
230N/A outputproperty="changeset">
935N/A <arg value="identify"/>
935N/A <arg value="--id"/>
230N/A </exec>
230N/A </target>
230N/A
989N/A <!-- Check if we build from a checked out copy of the repository,
989N/A so that we have history information from Mercurial available.
989N/A -->
989N/A <target name="-check-is-hg-repo">
1215N/A <available property="build.from.repo" file=".hg" type="dir"/>
989N/A </target>
989N/A
989N/A <!-- Get the id of the changeset we're building from by reading
989N/A .hg_archival.txt file created by hg archive. This will only
989N/A be used when we're not building from a checked out copy of
989N/A the repository, for example the source distribution.
989N/A -->
989N/A <target name="-get-changeset-from-file"
989N/A depends="-check-is-hg-repo" unless="build.from.repo">
1215N/A <tempfile property="hg.archival.temp" deleteonexit="true"/>
1215N/A <copy file=".hg_archival.txt" tofile="${hg.archival.temp}"/>
1215N/A <replaceregexp file="${hg.archival.temp}" flags="s"
989N/A match=".*node: ([0-9a-f]{12}).*"
989N/A replace="\1"/>
1215N/A <loadfile srcFile="${hg.archival.temp}" property="changeset"/>
989N/A </target>
989N/A
989N/A <target name="-update-build-info"
989N/A depends="-get-changeset-from-command,-get-changeset-from-file">
230N/A <mkdir dir="${build.classes.dir}/org/opensolaris/opengrok"/>
230N/A <propertyfile
230N/A file="${build.classes.dir}/org/opensolaris/opengrok/info.properties">
230N/A <entry key="version" value="${version}"/>
230N/A <entry key="changeset" value="${changeset}"/>
230N/A </propertyfile>
230N/A </target>
230N/A
301N/A <property name="coverage.dir" value="${basedir}/coverage"/>
1318N/A <target name="-pre-compile" depends="jrcs,jflex,download-lucene"/>
132N/A <target name="-post-clean">
949N/A <delete dir="${src.generatedsrc.dir}"/>
213N/A <delete file="${manifest.file}"/>
301N/A <delete dir="${coverage.dir}"/>
741N/A <antcall target="-delete-generated-repository-files"/>
132N/A </target>
1318N/A
1318N/A <target name="clean-lib" depends="init">
1318N/A <delete file="${file.reference.lucene-core.jar}"/>
1318N/A <delete file="${file.reference.lucene-spellchecker.jar}"/>
1318N/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 -->
1215N/A <manifest file="manifest.mf" mode="replace"/>
213N/A </target>
213N/A
487N/A <target name="-pre-init" depends="-touch-manifest, -exclude-client"/>
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">
1215N/A <pathconvert property="opengrok.lib.files" pathsep=" ">
1215N/A <path>
1215N/A <pathelement path="${javac.classpath}"/>
1215N/A </path>
1215N/A <flattenmapper/>
1215N/A <map from="" to="lib/"/>
1215N/A </pathconvert>
213N/A </target>
213N/A
213N/A <!-- Update the manifest file with a classpath attribute -->
213N/A <target name="-update-manifest-classpath">
1215N/A <manifest file="${manifest.file}" mode="update">
1215N/A <attribute name="Class-Path"
845N/A value="${opengrok.lib.files} lib/derbyclient.jar lib/derby.jar"/>
1215N/A </manifest>
213N/A </target>
213N/A
230N/A <target name="-pre-jar" depends="-update-manifest-classpath,-update-build-info"/>
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">
1215N/A <copy todir="${dist.dir}/lib">
1215N/A <fileset file="${file.reference.ant.jar}"/>
1215N/A </copy>
1215N/A <copy todir="${dist.dir}">
1215N/A <fileset dir="." includes="${opengrok.lib.files}"/>
1215N/A </copy>
211N/A </target>
1318N/A
1318N/A <path id="plainlib.search.path">
1318N/A <pathelement path="lib"/>
1318N/A <pathelement path="/lib"/>
1318N/A </path>
1318N/A
1318N/A <target name="-check-lucene" description="Check that lucene jar files are present">
1318N/A <available file="${lucene-core.jar}" type="file" property="lucene-core.jar.present">
1318N/A <filepath refid="plainlib.search.path"/>
1318N/A </available>
1318N/A <available file="${lucene-spellchecker.jar}" type="file" property="lucene-spellchecker.jar.present">
1318N/A <filepath refid="plainlib.search.path"/>
1318N/A </available>
1318N/A <condition property="lucene_not_downloaded">
1318N/A <not>
1318N/A <and>
1318N/A <isset property="lucene-core.jar.present"/>
1318N/A <isset property="lucene-core.jar.present"/>
1318N/A </and>
1318N/A </not>
1318N/A </condition>
1318N/A </target>
1318N/A
1318N/A <target name="download-lucene" depends="-check-lucene" if="lucene_not_downloaded">
1318N/A <get src="http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/${lucene.version}/${lucene-core.jar}"
1319N/A dest="lib/${lucene-core.jar}" verbose="true" usetimestamp="true"/>
1318N/A <get src="http://repo1.maven.org/maven2/org/apache/lucene/lucene-spellchecker/${lucene.version}/${lucene-spellchecker.jar}"
1319N/A dest="lib/${lucene-spellchecker.jar}" verbose="true" usetimestamp="true"/>
1318N/A </target>
132N/A
211N/A <target name="-post-jar" depends="-copy-lib-without-netbeans">
1215N/A <war destfile="${dist.war}" webxml="web/WEB-INF/web.xml">
950N/A <fileset dir="web" excludes="META-INF/context.xml"/>
144N/A <lib dir="${dist.dir}" includes="opengrok.jar"/>
453N/A <lib dir="${dist.dir}/lib" includes="*.jar" excludes="servlet-api.jar"/>
144N/A </war>
260N/A <echo message="Generating man page.."/>
260N/A <java classname="org.opensolaris.opengrok.index.CommandLineOptions"
260N/A output="${dist.dir}/opengrok.1" failonerror="true" fork="true">
260N/A <classpath>
260N/A <pathelement location="dist/opengrok.jar"/>
260N/A <pathelement path="${java.class.path}"/>
260N/A </classpath>
260N/A </java>
144N/A </target>
219N/A
219N/A <target name="package" depends="jar">
1215N/A <exec os="SunOS" executable="/usr/bin/pkgmk" failonerror="true">
1215N/A <arg line="-o -d build -r . -v ${version} -f platform/solaris/pkgdef/prototype"/>
1215N/A </exec>
1215N/A <exec os="SunOS" executable="/usr/bin/pkgtrans" failonerror="true">
1215N/A <arg line="-s build /dist/OSOLopengrok-${version}.pkg OSOLopengrok"/>
1215N/A </exec>
219N/A </target>
220N/A
220N/A <target name="dist" depends="jar">
1215N/A <tar destfile="${dist.dir}/${distname}-${version}.tar.gz"
220N/A compression="gzip">
1215N/A <tarfileset dir="." prefix="${distname}-${version}/doc">
1215N/A <include name="README.txt"/>
1215N/A <include name="CHANGES.txt"/>
1215N/A <include name="LICENSE.txt"/>
1215N/A <include name="NOTICE.txt"/>
1215N/A <include name="paths.tsv"/>
1215N/A <include name="logging.properties"/>
1215N/A </tarfileset>
1215N/A <tarfileset dir="." prefix="${distname}-${version}/bin" mode="755">
1215N/A <include name="OpenGrok"/>
1215N/A </tarfileset>
1215N/A <tarfileset dir="doc" prefix="${distname}-${version}/doc">
1215N/A <include name="EXAMPLE.txt"/>
1215N/A </tarfileset>
1215N/A <tarfileset dir="${dist.dir}" prefix="${distname}-${version}/lib">
1215N/A <include name="opengrok.jar"/>
1215N/A <include name="source.war"/>
1215N/A <include name="lib/*"/>
1215N/A <exclude name="lib/servlet-api.jar"/>
1215N/A </tarfileset>
1215N/A <tarfileset dir="${dist.dir}" prefix="${distname}-${version}/man/man1">
1215N/A <include name="opengrok.1"/>
1215N/A </tarfileset>
1215N/A </tar>
220N/A </target>
220N/A
221N/A <target name="dist-src" depends="init">
1215N/A <mkdir dir="${dist.dir}"/>
1215N/A <exec executable="hg">
1215N/A <arg value="archive"/>
1215N/A <arg value="-t"/>
1215N/A <arg value="tgz"/>
981N/A<!-- <arg value="-p"/>
981N/A <arg value="${distname}-${version}-src"/> -->
1215N/A <arg value="${dist.dir}/${distname}-${version}-src.tar.gz"/>
1215N/A </exec>
221N/A </target>
295N/A
336N/A <target name="-check_findbugs" description="Check that findbugs jar files are present">
336N/A <available file="findbugs.jar" type="file" property="findbugs.jar.present">
336N/A <filepath refid="findbugs.lib.search.path"/>
336N/A </available>
341N/A <fail unless="findbugs.jar.present" message="Please install Findbugs findbugs.jar in ~/.ant/lib-directory (or in ant classpath) to run Findbugs, see README"/>
336N/A
336N/A <available file="findbugs-ant.jar" type="file" property="findbugs-ant.jar.present">
336N/A <filepath refid="findbugs.lib.search.path"/>
336N/A </available>
341N/A <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"/>
336N/A </target>
336N/A
879N/A <target name="findbugs" depends="jar, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate HTML output">
336N/A <path id="findbugs.lib" >
341N/A <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
341N/A <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
336N/A </path>
336N/A <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
295N/A <mkdir dir="findbugs"/>
341N/A <findbugs projectname="OpenGrok" home="${findbugs.home}" output="html" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.html" jvmargs="-Xmx512m">
295N/A <auxClasspath>
295N/A <fileset dir="${dist.dir}/lib/">
295N/A <include name="*.jar"/>
295N/A </fileset>
295N/A </auxClasspath>
295N/A <sourcePath path="src" />
295N/A <class location="${dist.dir}/opengrok.jar" />
295N/A </findbugs>
295N/A </target>
301N/A
879N/A <target name="findbugs-xml" depends="jar, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate XML output">
339N/A <path id="findbugs.lib" >
341N/A <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
341N/A <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
339N/A </path>
339N/A <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
339N/A <mkdir dir="findbugs"/>
341N/A <findbugs projectname="OpenGrok" home="${findbugs.home}" output="xml" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.xml" jvmargs="-Xmx512m">
339N/A <auxClasspath>
339N/A <fileset dir="${dist.dir}/lib/">
339N/A <include name="*.jar"/>
339N/A </fileset>
339N/A </auxClasspath>
339N/A <sourcePath path="src" />
339N/A <class location="${dist.dir}/opengrok.jar" />
339N/A </findbugs>
339N/A </target>
379N/A
379N/A <target name="-check_checkstyle" description="Check that checkstyle jar files are present">
379N/A <available file="checkstyle-all.jar" type="file" property="checkstyle.jar.present">
379N/A <filepath refid="checkstyle.lib.search.path"/>
379N/A </available>
379N/A <fail unless="checkstyle.jar.present" message="Please install checkstyle-all.jar in lib-directory (or in ant classpath) to run Checkstyle, see README."/>
411N/A </target>
379N/A
379N/A <target name="checkstyle" depends="compile, -check_checkstyle" description="Run checkstyle on OpenGrok source code">
379N/A <taskdef resource="checkstyletask.properties" classpath="${checkstyle.home}/checkstyle-all.jar"/>
386N/A <checkstyle config="checkstyle/style.xml" failOnViolation="false">
379N/A <fileset dir="src" includes="**/*.java"/>
1024N/A <fileset dir="test" includes="**/*.java"/>
379N/A <formatter type="plain"/>
379N/A <formatter type="plain" toFile="checkstyle/checkstyle_errors.txt"/>
379N/A <formatter type="xml" toFile="checkstyle/checkstyle_errors.xml"/>
379N/A </checkstyle>
411N/A </target>
411N/A
411N/A <target name="-check_pmd" description="Check that pmd jar files are present">
411N/A <available file="pmd.jar" type="file" property="pmd.jar.present">
411N/A <filepath refid="pmd.lib.search.path"/>
411N/A </available>
411N/A <fail unless="pmd.jar.present" message="Please install pmd.jar in lib-directory (or in ant classpath) to run PMD, see README."/>
411N/A </target>
411N/A
411N/A <target name="pmd" depends="compile, -check_pmd" description="Run PMD on OpenGrok source code">
411N/A <path id="pmd.lib" >
411N/A <pathelement location="${pmd.home}/lib/pmd.jar"/>
411N/A <pathelement location="${pmd.home}/lib/jaxen.jar"/>
411N/A </path>
411N/A <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib"/>
411N/A <mkdir dir="pmd"/>
482N/A <pmd targetjdk="1.6" failuresPropertyName="pmd.num.warnings" rulesetfiles="tools/pmd_ruleset.xml">
411N/A <formatter type="html" toFile="pmd/pmd_report.html"/>
411N/A <formatter type="xml" toFile="pmd/pmd_report.xml"/>
411N/A <fileset dir="src" includes="**/*.java"/>
1072N/A<!-- <fileset dir="test" includes="**/*.java"/> -->
1072N/A<!-- <fileset dir="web" includes="**/*.jsp"/>
1072N/A <fileset dir="web" includes="**/*.jspf"/> -->
411N/A </pmd>
463N/A <echo message="PMD finished, found ${pmd.num.warnings} warnings, see pmd/pmd_report.html"/>
411N/A </target>
339N/A
996N/A <target name="cpd-xml" depends="compile, -check_pmd" description="Run CPD on OpenGrok source code, print output in xml">
1215N/A <path id="pmd.lib" >
996N/A <pathelement location="${pmd.home}/lib/pmd.jar"/>
996N/A <pathelement location="${pmd.home}/lib/jaxen.jar"/>
1215N/A </path>
1215N/A <taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" classpathref="pmd.lib"/>
1215N/A <cpd minimumTokenCount="100" format="xml" outputFile="pmd/cpd_report.xml">
1215N/A <fileset dir="src">
1215N/A <include name="**/*.java"/>
1215N/A </fileset>
1215N/A <fileset dir="test">
1215N/A <include name="**/*.java"/>
1215N/A </fileset>
1215N/A </cpd>
996N/A </target>
996N/A
996N/A <target name="cpd" depends="compile, -check_pmd" description="Run CPD on OpenGrok source code">
1215N/A <path id="pmd.lib" >
996N/A <pathelement location="${pmd.home}/lib/pmd.jar"/>
996N/A <pathelement location="${pmd.home}/lib/jaxen.jar"/>
1215N/A </path>
1215N/A <taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" classpathref="pmd.lib"/>
1215N/A <cpd minimumTokenCount="100" outputFile="pmd/cpd_report.txt">
1215N/A <fileset dir="src">
1215N/A <include name="**/*.java"/>
1215N/A </fileset>
1215N/A <fileset dir="test">
1215N/A <include name="**/*.java"/>
1215N/A </fileset>
1215N/A </cpd>
996N/A </target>
996N/A
336N/A <target name="-check_emma" description="Check that emma jar files are present">
381N/A <available file="emma.jar" type="file" property="emma.jar.present">
336N/A <filepath refid="lib.search.path"/>
336N/A </available>
336N/A <fail unless="emma.jar.present" message="Please install emma.jar in lib-directory (or in ant classpath) to run Emma, see README."/>
336N/A
336N/A <available file="emma_ant.jar" type="file" property="emma_ant.jar.present">
336N/A <filepath refid="lib.search.path"/>
336N/A </available>
336N/A <fail unless="emma_ant.jar.present" message="Please install emma_ant.jar in lib-directory (or in ant classpath) to run Emma, see README."/>
336N/A </target>
336N/A
336N/A <target name="emma-instrument" depends="compile, -check_emma" description="Instruments the source code for Emma code coverage analysis">
301N/A <path id="emma.lib" >
301N/A <pathelement location="lib/emma.jar"/>
301N/A <pathelement location="lib/emma_ant.jar"/>
301N/A </path>
301N/A <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
301N/A <mkdir dir="${coverage.dir}" />
301N/A <emma enabled="true">
301N/A <instr instrpath="build/classes"
301N/A metadatafile="${coverage.dir}/coverage.em"
301N/A mode="overwrite"
691N/A filter="+org.opensolaris.*,-org.opensolaris.opengrok.management.client.*"/>
301N/A </emma>
301N/A </target>
301N/A
301N/A <target name="-pre-compile-test">
301N/A <property name="test-sys-prop.emma.coverage.out.file" value="${coverage.dir}/coverage.ec"/>
301N/A <property name="test-sys-prop.emma.coverage.out.merge" value="true"/>
448N/A </target>
446N/A
448N/A <target name="-post-compile-test">
500N/A <antcall target="-create-svn-repository"/>
736N/A <antcall target="-create-razor-repository"/>
706N/A <!-- Change root in CVS test repository -->
706N/A <!-- Strange indentation in line two levels below to get newline correctly -->
807N/A <concat destfile="${test.cvs.repo}/CVS/Root" append="no" force="yes" eol="unix">${basedir}/${test.cvs.root}/
1215N/A </concat>
455N/A <!-- Generate ZIP files used for unit testing mercurial/.hg and mercurial/.hgignore are renamed -->
706N/A <copy todir="${test.hg}/.hg">
706N/A <fileset dir="${test.hg}/hg"/>
455N/A </copy>
706N/A <copy file="${test.hg}/hgignore" tofile="${test.hg}/.hgignore"/>
455N/A
480N/A <zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/index/source.zip"
706N/A basedir="${test.sources}"
480N/A update="false"
480N/A defaultexcludes="no"/>
455N/A <zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/history/repositories.zip"
706N/A basedir="${test.repositories}"
455N/A excludes="mercurial/hg/**, mercurial/hgignore"
480N/A update="false"
480N/A defaultexcludes="no"/>
741N/A
741N/A <antcall target="-delete-generated-repository-files"/>
500N/A </target>
500N/A
500N/A <target name="-create-svn-repository">
1215N/A <delete dir="${test.svn}"/>
1215N/A <delete dir="${build.test.reposroots}/svn"/>
1215N/A <mkdir dir="${build.test.reposroots}"/>
1215N/A <exec executable="svnadmin" failifexecutionfails="true">
1215N/A <arg value="create"/>
1215N/A <arg value="${build.test.reposroots}/svn"/>
1215N/A </exec>
725N/A
725N/A <!-- need absolute path for svn url -->
1215N/A <pathconvert property="test.svn.url">
1215N/A <map from="" to="file://"/>
1215N/A <path location="${build.test.reposroots}/svn"/>
1215N/A </pathconvert>
725N/A
1215N/A <exec executable="svn" failifexecutionfails="false">
1215N/A <arg value="import"/>
1215N/A <arg value="${test.sources}"/>
1215N/A <arg value="${test.svn.url}"/>
1215N/A <arg value="-m"/>
1215N/A <arg value="Initial import"/>
1215N/A </exec>
1215N/A <exec executable="svn" failifexecutionfails="false">
1215N/A <arg value="checkout"/>
1215N/A <arg value="${test.svn.url}"/>
1215N/A <arg value="${test.svn}"/>
1215N/A </exec>
301N/A </target>
301N/A
736N/A <target name="-create-razor-repository">
1215N/A <delete dir="${test.razor}"/>
1215N/A <copy todir="${test.razor}/Razor-Simple">
1215N/A <fileset dir="ext/SampleRazorRepository/UserSandbox"/>
1215N/A </copy>
1215N/A <copy todir="${test.razor}/Razor-Simple/SimpleCProgram/.razor">
1215N/A <fileset dir="ext/SampleRazorRepository/Repository/OpenGrokSample/RAZOR_UNIVERSE/DOMAIN_01/Simple"/>
1215N/A </copy>
736N/A
736N/A <!--
736N/A The support for binaries in Razor repositories is not fully
736N/A functional, so the next copy target is commented out for now.
736N/A -->
736N/A
736N/A <!--copy todir="${test.razor}/Razor-Simple/SimpleCProgram-BinaryRelease/.razor">
736N/A <fileset dir="ext/SampleRazorRepository/Repository/OpenGrokSample/RAZOR_UNIVERSE/DOMAIN_01/Simple"/>
736N/A </copy-->
736N/A
736N/A </target>
736N/A
741N/A <!-- clean up generated test repositories -->
741N/A <target name="-delete-generated-repository-files">
1215N/A <delete dir="${test.hg}/.hg"/>
1215N/A <delete file="${test.hg}/.hgignore"/>
1215N/A <delete dir="${test.svn}"/>
1215N/A <delete dir="${test.razor}"/>
1215N/A <delete file="${test.cvs.repo}/CVS/Root"/>
736N/A </target>
736N/A
336N/A <target name="emma-report" description="Analyze" depends="-check_emma">
301N/A <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
301N/A <emma enabled="true" >
501N/A <report sourcepath="${src.dir},${src.generatedsrc.dir}">
301N/A <!-- collect all EMMA data dumps (metadata and runtime): -->
301N/A <infileset dir="${coverage.dir}" includes="*.em, *.ec"/>
301N/A <txt outfile="${coverage.dir}/coverage.txt"/>
301N/A <xml outfile="${coverage.dir}/coverage.xml"/>
301N/A <html outfile="${coverage.dir}/index.html"/>
301N/A </report>
301N/A </emma>
301N/A </target>
301N/A
449N/A <target name="code-coverage" depends="clean, emma-instrument, test, emma-report" description="Make test code coverage reports based on the OpenGrok unit tests"/>
624N/A
624N/A <target name="jdepend" depends="compile" description="Run JDepend dependency checking">
624N/A <mkdir dir="jdepend"/>
624N/A <java classname="jdepend.xmlui.JDepend" failonerror="true" fork="true">
624N/A <arg value="-file"/>
624N/A <arg value="jdepend/report.xml"/>
624N/A <arg value="${build.classes.dir}"/>
624N/A <classpath>
624N/A <pathelement location="${user.home}/.ant/lib/jdepend/lib/jdepend.jar"/>
624N/A <pathelement path="${java.class.path}"/>
624N/A </classpath>
624N/A </java>
624N/A <java classname="jdepend.textui.JDepend" failonerror="true" fork="true">
624N/A <arg value="-file"/>
624N/A <arg value="jdepend/report.txt"/>
624N/A <arg value="${build.classes.dir}"/>
624N/A <classpath>
624N/A <pathelement location="${user.home}/.ant/lib/jdepend/lib/jdepend.jar"/>
624N/A <pathelement path="${java.class.path}"/>
624N/A </classpath>
624N/A </java>
624N/A </target>
624N/A
801N/A <!-- Generate HTML test report -->
801N/A <target depends="init" name="test-report">
801N/A <junitreport todir="${build.test.results.dir}">
801N/A <fileset dir="${build.test.results.dir}">
801N/A <include name="TEST-*.xml"/>
801N/A </fileset>
801N/A <report todir="${build.test.results.dir}"/>
801N/A </junitreport>
801N/A </target>
801N/A
1095N/A <!-- Build our patched JRCS library. -->
1095N/A <target name="jrcs" depends="-pre-pre-compile">
1215N/A <mkdir dir="${build.dir}/jrcs"/>
1215N/A <javac srcdir="jrcs/src" destdir="${build.dir}/jrcs"
1099N/A nowarn="on" source="1.4"/>
1215N/A <jar destfile="${file.reference.jrcs.jar}">
1215N/A <fileset dir="${build.dir}/jrcs" includes="**/*.class"/>
1215N/A </jar>
1095N/A </target>
1095N/A
1176N/A
1176N/A <!-- compile jsp - just to test -->
1215N/A <property name="debug" value="on" />
1215N/A <property name="jsdebug" value="off" />
1215N/A <property name="compress" value=".gz" />
1215N/A <property name="debuglevel" value="source,lines,vars" />
1215N/A <property name="optimize" value="on" />
1215N/A <property name="deprecation" value="on" />
1215N/A <property name="listfiles" value="true" />
1176N/A
1215N/A <property name="codebase" value="org/opensolaris/opengrok"/>
1215N/A <property name="codebase.dot" value="org.opensolaris.opengrok"/>
1215N/A <property name="web.src.dir" location="web" />
1176N/A
1215N/A <patternset id="libs">
1215N/A <include name="*.jar" />
1215N/A </patternset>
1215N/A <path id="classpath.base">
1215N/A <fileset dir="lib">
1215N/A <patternset refid="libs" />
1215N/A </fileset>
1215N/A </path>
1217N/A <property name="AS_HOME" value="glassfish"/>
1215N/A <path id="classpath.j2ee">
1215N/A <fileset dir="${AS_HOME}/modules">
1215N/A <include name="javaee.jar" />
1176N/A <!-- for the **/auth/* stuff, only -->
1215N/A <include name="appserv-rt.jar" />
1215N/A <include name="appserv-deployment-client.jar" />
1215N/A </fileset>
1215N/A </path>
1215N/A <path id="classpath.jspc">
1215N/A <fileset dir="${AS_HOME}/modules">
1215N/A <include name="javax.servlet.jar"/>
1215N/A <include name="javax.servlet.jsp.jar"/>
1215N/A <include name="jsp-impl.jar"/>
1215N/A <include name="el-impl.jar"/>
1215N/A <include name="javax.servlet.jsp.jstl.jar"/>
1215N/A <include name="jstl-impl.jar"/>
1215N/A <include name="jsf-api.jar"/>
1215N/A <include name="jsf-impl.jar"/>
1215N/A <include name="tools.jar"/>
1215N/A </fileset>
1215N/A </path>
1176N/A
1215N/A <path id="classpath.web">
1215N/A <path refid="classpath.j2ee"/>
1215N/A <path refid="classpath.base"/>
1215N/A </path>
1176N/A
1215N/A <path id="classpath.jsp">
1215N/A <path refid="classpath.jspc"/>
1215N/A <path refid="classpath.web"/>
1215N/A </path>
1176N/A
1215N/A <target name="-jsp.check" depends="init">
1215N/A <mkdir dir="${build.dir}/src/jsp/${codebase}/jsp" />
1215N/A <uptodate property="jsp.not.changed">
1215N/A <srcfiles dir="${web.src.dir}" includes="**/*.jsp,**/*.jspf"/>
1215N/A <mapper type="glob" from="*.jsp"
1176N/A to="${build.dir}/src/jsp/${codebase}/jsp/*_jsp.java"/>
1215N/A </uptodate>
1215N/A </target>
1176N/A
1215N/A <target name="-jsp.generate" depends="-jsp.check" unless="jsp.not.changed">
1215N/A <taskdef name="jasper" classname="org.apache.jasper.JspC"
1176N/A classpathref="classpath.jsp" />
1215N/A <mkdir dir="${build.dir}/src/web"/>
1215N/A <copy todir="${build.dir}/src/web">
1215N/A <fileset dir="${web.src.dir}">
1215N/A <include name="**/*.jsp"/>
1215N/A <include name="**/*.jspf"/>
1215N/A <include name="**/index_body.html"/>
1215N/A </fileset>
1215N/A </copy>
1215N/A <jasper validateXml="false"
1176N/A outputdir="${build.dir}/src/jsp"
1176N/A javaencoding="UTF-8"
1176N/A uriroot="${build.dir}/src/web"
1176N/A package="${codebase.dot}.jsp"
1176N/A compilersourcevm="1.6"
1176N/A compilertargetvm="1.6"
1176N/A smapsuppressed="false"
1176N/A webxmlfragment="${build.dir}/src/servlets_web.xml"
1176N/A />
1215N/A <loadfile property="wdd" srcfile="${build.dir}/src/servlets_web.xml"/>
1215N/A <copy file="${web.src.dir}/WEB-INF/web.xml" todir="${build.dir}"
1176N/A overwrite="true">
1215N/A <filterset>
1215N/A <filter token="generated servlet mappings"
1176N/A value=" generated start -->${wdd}&lt;!-- generated end " />
1215N/A </filterset>
1215N/A </copy>
1215N/A </target>
1176N/A
1215N/A <target name="compile.jsp" depends="compile,-jsp.generate"
1176N/A description="--> compile java source code and jsp pages"
1176N/A >
1215N/A <javac srcdir="${build.dir}/src/jsp" destdir="${build.dir}/classes"
1176N/A includes="**/*.java"
1176N/A optimize="${optimize}" debug="${debug}" debuglevel="${debuglevel}"
1176N/A deprecation="${deprecation}" classpathref="classpath.jsp"
1176N/A encoding="UTF-8" listfiles="${listfiles}"
1176N/A includeantruntime="false">
1215N/A <compilerarg value="-Xlint:unchecked" compiler="javac1.6"/>
1215N/A </javac>
1215N/A </target>
1176N/A
1216N/A <target name="all" depends="clean,jar,compile.jsp,test,javadoc,pmd,findbugs-xml,checkstyle" />
132N/A</project>