build.xml revision 1359
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 (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
132N/APortions Copyright 2011, 2012 Jens Elkner.
132N/A-->
132N/A<project name="OpenGrok" default="jar" basedir=".">
215N/A <description>Builds, tests, and runs the project opengrok.</description>
132N/A <property name="build.sysclasspath" value="ignore"/>
132N/A <property file="${user.home}/config/ant/${ant.project.name}.properties" />
132N/A <property file="${user.home}/config/ant/global.properties" />
132N/A
132N/A
132N/A <!-- YUI [download] related properties -->
132N/A <property name="YUI.Version" value="3.5.0pr2"
132N/A description="YUI version to use"/> <!-- GA scheduled for mid-march -->
132N/A <path id="YUI.min.src" description="Minimized YUI component files">
132N/A <pathelement path="yui-base/yui-base-min.js"/>
132N/A <pathelement path="oop/oop-min.js"/>
132N/A <pathelement path="event-custom-base/event-custom-base-min.js"/>
132N/A <pathelement path="features/features-min.js"/>
132N/A <pathelement path="dom-core/dom-core-min.js"/>
132N/A <pathelement path="dom-base/dom-base-min.js"/>
132N/A <pathelement path="selector-native/selector-native-min.js"/>
132N/A <pathelement path="selector/selector-min.js"/>
132N/A <pathelement path="node-core/node-core-min.js"/>
132N/A <pathelement path="node-base/node-base-min.js"/>
132N/A <pathelement path="event-base/event-base-min.js"/>
132N/A <pathelement path="event-custom-complex/event-custom-complex-min.js"/>
132N/A <pathelement path="event-synthetic/event-synthetic-min.js"/>
132N/A <pathelement path="event-key/event-key-min.js"/>
132N/A <pathelement path="dom-style/dom-style-min.js"/>
132N/A <pathelement path="dom-screen/dom-screen-min.js"/>
132N/A <pathelement path="node-screen/node-screen-min.js"/>
132N/A <pathelement path="node-style/node-style-min.js"/>
132N/A <pathelement path="attribute-core/attribute-core-min.js"/>
132N/A <pathelement path="attribute-events/attribute-events-min.js"/>
132N/A <pathelement path="attribute-extras/attribute-extras-min.js"/>
132N/A <pathelement path="attribute-base/attribute-base-min.js"/>
132N/A <pathelement path="attribute-complex/attribute-complex-min.js"/>
132N/A <pathelement path="base-core/base-core-min.js"/>
132N/A <pathelement path="base-base/base-base-min.js"/>
132N/A <pathelement path="pluginhost-base/pluginhost-base-min.js"/>
132N/A <pathelement path="pluginhost-config/pluginhost-config-min.js"/>
132N/A <pathelement path="base-pluginhost/base-pluginhost-min.js"/>
132N/A <pathelement path="classnamemanager/classnamemanager-min.js"/>
132N/A <pathelement path="event-focus/event-focus-min.js"/>
132N/A <pathelement path="widget-base/widget-base-min.js"/>
132N/A <pathelement path="widget-htmlparser/widget-htmlparser-min.js"/>
132N/A <pathelement path="widget-skin/widget-skin-min.js"/>
132N/A <pathelement path="event-delegate/event-delegate-min.js"/>
132N/A <pathelement path="node-event-delegate/node-event-delegate-min.js"/>
132N/A <pathelement path="widget-uievents/widget-uievents-min.js"/>
132N/A <pathelement path="base-build/base-build-min.js"/>
132N/A <pathelement path="widget-position/widget-position-min.js"/>
132N/A <pathelement path="widget-stack/widget-stack-min.js"/>
132N/A
132N/A <!-- components not below $YUI.version/build must be absolute, e.g. -->
132N/A <!-- pathelement path="/gallery-2011.09.28-20-06/build/gallery-yui-tooltip/gallery-yui-tooltip-min.js"/ -->
132N/A </path>
132N/A <path id="YUI.debug.src"
132N/A description="YUI component files suitable for debugging">
132N/A <path refid="YUI.min.src"/>
132N/A <pathelement path="yui-log/yui-log-min.js"/>
132N/A <pathelement path="dump/dump-min.js"/>
132N/A </path>
132N/A <property name="YUI.min" value="web/static/yui-min.js"
132N/A description="composite file to construct from YUI.min.src"/>
132N/A <property name="YUI.debug" value="web/static/yui-debug.js"
132N/A description="composite file to create from YUI.debug.src"/>
132N/A
132N/A
219N/A <import file="nbproject/build-impl.xml"/>
620N/A
220N/A <import file="nbproject/profiler-build-impl.xml"/> <!--
341N/A
341N/A There exist several targets which are by default empty and which can be
379N/A used for execution of your tasks. These targets are usually executed
411N/A before and after some main targets. They are:
487N/A
706N/A -pre-init: called before initialization of project properties
706N/A -post-init: called after initialization of project properties
706N/A -pre-compile: called before javac compilation
741N/A -post-compile: called after javac compilation
741N/A -pre-compile-single: called before javac compilation of single file
706N/A -post-compile-single: called after javac compilation of single file
706N/A -pre-compile-test: called before javac compilation of JUnit tests
736N/A -post-compile-test: called after javac compilation of JUnit tests
487N/A -pre-compile-test-single: called before javac compilation of single JUnit test
704N/A -post-compile-test-single: called after javac compilation of single JUunit test
487N/A -pre-jar: called before JAR building
704N/A -post-jar: called after JAR building
704N/A -post-clean: called after cleaning build products
487N/A
487N/A (Targets beginning with '-' are not intended to be called on their own.)
487N/A
320N/A Example of inserting an obfuscator after compilation could look like this:
336N/A
336N/A <target name="-post-compile">
336N/A <obfuscate>
336N/A <fileset dir="${build.classes.dir}"/>
336N/A </obfuscate>
336N/A </target>
336N/A
341N/A For list of available properties check the imported
487N/A nbproject/build-impl.xml file.
336N/A
336N/A
336N/A Another way to customize the build is by overriding existing main targets.
379N/A The targets of interest are:
379N/A
487N/A -init-macrodef-javac: defines macro for javac compilation
379N/A -init-macrodef-junit: defines macro for junit execution
379N/A -init-macrodef-debug: defines macro for class debugging
379N/A -init-macrodef-java: defines macro for class execution
411N/A -do-jar-with-manifest: JAR building (if you are using a manifest)
411N/A -do-jar-without-manifest: JAR building (if you are not using a manifest)
487N/A run: execution of project
411N/A -javadoc-build: Javadoc generation
411N/A test-report: JUnit report generation
411N/A
320N/A An example of overriding the target for project execution could look like this:
336N/A
320N/A <target name="run" depends="opengrok-impl.jar">
336N/A <exec dir="bin" executable="launcher.exe">
320N/A <arg file="${dist.jar}"/>
320N/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.
671N/A
671N/A -->
132N/A
132N/A <property name="version" value="0.12-dev"/>
132N/A <property name="distname" value="opengrok"/>
132N/A <property name="src.dir" location="src"/>
244N/A <property name="src.generatedsrc.dir" location="generatedsrc"/>
244N/A
132N/A <property name="findbugs.home" value="${user.home}/.ant/lib/findbugs"/>
132N/A <property name="checkstyle.home" value="${user.home}/.ant/lib/checkstyle"/>
132N/A <property name="pmd.home" value="${user.home}/.ant/lib/pmd"/>
132N/A
190N/A <property name="test.repositories" value="testdata/repositories"/>
132N/A <property name="test.sources" value="testdata/sources"/>
132N/A <property name="test.cvs" value="${test.repositories}/cvs"/>
132N/A <property name="test.cvs.repo" value="${test.cvs}/cvsrepo"/>
132N/A <property name="test.cvs.root" value="${test.cvs}/cvsroot"/>
132N/A <property name="test.hg" value="${test.repositories}/mercurial"/>
132N/A <property name="test.svn" value="${test.repositories}/svn"/>
132N/A <property name="test.razor" value="${test.repositories}/razor"/>
132N/A
230N/A <available property="compileSystrayClient" classname="java.awt.TrayIcon"/>
230N/A
230N/A <target name="-exclude-client" unless="compileSystrayClient">
230N/A <echo>JDK doesn't have java.awt.TrayIcon, excluding building of systray client ... </echo>
230N/A <property name="excludes" value="org/opensolaris/opengrok/management/client/**"/>
230N/A </target>
230N/A
230N/A
230N/A <path id="lib.search.path">
230N/A <pathelement path="${user.home}/.ant/lib"/>
230N/A <pathelement path="${java.class.path}"/>
230N/A <pathelement path="lib"/>
230N/A <pathelement path="/lib"/>
230N/A </path>
230N/A
230N/A <path id="findbugs.lib.search.path">
230N/A <pathelement path="${findbugs.home}/lib/"/>
230N/A <pathelement path="${java.class.path}"/>
230N/A <pathelement path="lib/findbugs/lib/"/>
230N/A </path>
230N/A
230N/A <path id="checkstyle.lib.search.path">
230N/A <pathelement path="${checkstyle.home}/"/>
230N/A <pathelement path="${java.class.path}"/>
230N/A </path>
230N/A
230N/A <path id="pmd.lib.search.path">
230N/A <pathelement path="${pmd.home}/lib/"/>
230N/A <pathelement path="${java.class.path}"/>
230N/A <pathelement path="lib/pmd/lib/"/>
301N/A </path>
132N/A
132N/A <available file="JFlex.jar" type="file" property="JFlex.present">
132N/A <filepath refid="lib.search.path"/>
213N/A </available>
301N/A <fail unless="JFlex.present" message="Please download JFlex (http://jflex.de/) and put JFlex.jar it into /lib directory (or in ant classpath)."/>
741N/A
132N/A <taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpathref="lib.search.path"/>
132N/A <target name="jflex">
211N/A <mkdir dir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/c/CSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/c/CXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/c/CxxSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/c/CxxXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/fortran/FortranSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/fortran/FortranXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/java/JavaSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
487N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/java/JavaXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/javascript/JavaScriptSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/javascript/JavaScriptXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/python/PythonSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/python/PythonXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/perl/PerlSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/perl/PerlXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/php/PhpSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/php/PhpXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/lisp/LispSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/lisp/LispXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/tcl/TclSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/tcl/TclXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/PlainFullTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/PlainSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/plain/XMLXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/sql/SQLXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/document/TroffXref.lex" destdir="${src.generatedsrc.dir}"/>
781N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/document/TroffFullTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
781N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/sh/ShSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/sh/ShXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/vb/VBSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/vb/VBXref.lex" destdir="${src.generatedsrc.dir}"/>
230N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/csharp/CSharpSymbolTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/analysis/csharp/CSharpXref.lex" destdir="${src.generatedsrc.dir}"/>
213N/A <jflex file="${src.dir}/org/opensolaris/opengrok/search/context/HistoryLineTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
211N/A <jflex file="${src.dir}/org/opensolaris/opengrok/search/context/PlainLineTokenizer.lex" destdir="${src.generatedsrc.dir}"/>
211N/A </target>
211N/A
211N/A <property name="hg" value="hg"/>
211N/A
246N/A <!-- Get the id of the changeset we're building from using a
246N/A Mercurial command.
246N/A -->
213N/A <target name="-get-changeset-from-command"
213N/A depends="-check-is-hg-repo" if="build.from.repo">
211N/A <exec executable="${hg}"
211N/A failifexecutionfails="no"
132N/A outputproperty="changeset">
211N/A <arg value="identify"/>
144N/A <arg value="--id"/>
144N/A </exec>
144N/A </target>
144N/A
453N/A <!-- Check if we build from a checked out copy of the repository,
144N/A so that we have history information from Mercurial available.
260N/A -->
260N/A <target name="-check-is-hg-repo">
260N/A <available property="build.from.repo" file=".hg" type="dir"/>
260N/A </target>
260N/A
260N/A <!-- Get the id of the changeset we're building from by reading
260N/A .hg_archival.txt file created by hg archive. This will only
260N/A be used when we're not building from a checked out copy of
144N/A the repository, for example the source distribution.
219N/A -->
219N/A <target name="-get-changeset-from-file"
219N/A depends="-check-is-hg-repo" unless="build.from.repo">
679N/A <tempfile property="hg.archival.temp" deleteonexit="true"/>
219N/A <copy file=".hg_archival.txt" tofile="${hg.archival.temp}"/>
219N/A <replaceregexp file="${hg.archival.temp}" flags="s"
219N/A match=".*node: ([0-9a-f]{12}).*"
219N/A replace="\1"/>
219N/A <loadfile srcFile="${hg.archival.temp}" property="changeset"/>
220N/A </target>
220N/A
220N/A <target name="-update-build-info"
220N/A depends="-get-changeset-from-command,-get-changeset-from-file">
220N/A <mkdir dir="${build.classes.dir}/org/opensolaris/opengrok"/>
220N/A <propertyfile
220N/A file="${build.classes.dir}/org/opensolaris/opengrok/info.properties">
220N/A <entry key="version" value="${version}"/>
220N/A <entry key="changeset" value="${changeset}"/>
220N/A <entry key="lmdate" value="now" pattern="dd MMM yyyy HH:mm:ss Z"
220N/A type="date" />
299N/A </propertyfile>
220N/A </target>
220N/A
220N/A <property name="coverage.dir" value="${basedir}/coverage"/>
220N/A <target name="-pre-compile" depends="jrcs,jflex,get.lucene"/>
220N/A <target name="eclipse" depends="-pre-compile"
220N/A description="satisfy eclipse dependencies"/>
220N/A <target name="-post-clean">
220N/A <delete dir="${src.generatedsrc.dir}"/>
220N/A <delete file="${manifest.file}"/>
220N/A <delete dir="${coverage.dir}"/>
220N/A <antcall target="-delete-generated-repository-files"/>
623N/A </target>
220N/A
220N/A <!--
220N/A Create an empty manifest file so that nbproject/build-impl.xml
220N/A notices that a manifest should be added to the jar file
221N/A -->
221N/A <target name="-touch-manifest">
221N/A <!-- no attributes, main-class and class-path will be added later -->
221N/A <manifest file="manifest.mf" mode="replace"/>
221N/A </target>
221N/A
221N/A <target name="-pre-init" depends="-touch-manifest, -exclude-client"/>
221N/A
221N/A <!--
295N/A Initialize a property holding a list of jar files on which
336N/A opengrok.jar depends
336N/A -->
336N/A <target name="-post-init">
336N/A <pathconvert property="opengrok.lib.files" pathsep=" ">
341N/A <path>
336N/A <pathelement path="${javac.classpath}"/>
336N/A </path>
336N/A <flattenmapper/>
336N/A <map from="" to="lib/"/>
341N/A </pathconvert>
336N/A <mkdir dir="${build.test.classes.dir}"/>
336N/A <mkdir dir="${build.dir}/src/jsp"/>
341N/A </target>
336N/A
341N/A <!-- Update the manifest file with a classpath attribute -->
341N/A <target name="-update-manifest-classpath">
336N/A <manifest file="${manifest.file}" mode="update">
336N/A <attribute name="Class-Path"
295N/A value="${opengrok.lib.files} lib/derbyclient.jar lib/derby.jar"/>
341N/A </manifest>
295N/A </target>
295N/A
295N/A <target name="-pre-jar" depends="-update-manifest-classpath,-update-build-info"/>
295N/A
295N/A <!--
295N/A Copy the jars from lib to dist/lib manually if we don't have
295N/A the copylibs task from NetBeans
295N/A -->
295N/A <target name="-copy-lib-without-netbeans"
301N/A unless="manifest.available+main.class+mkdist.available">
341N/A <copy todir="${dist.dir}/lib">
339N/A <fileset file="${file.reference.ant.jar}"/>
341N/A </copy>
341N/A <copy todir="${dist.dir}">
339N/A <fileset dir="." includes="${opengrok.lib.files}"/>
339N/A </copy>
339N/A </target>
341N/A
339N/A <path id="plainlib.search.path">
339N/A <pathelement path="lib"/>
339N/A <pathelement path="/lib"/>
339N/A </path>
339N/A
339N/A <!-- since defs come from netbeans files, one needs -init-project -->
339N/A <target name="-check-lucene" depends="-init-project">
339N/A <available file="${file.reference.lucene-core.jar}" type="file"
339N/A property="lucene-core.jar.present"/>
379N/A <available file="${file.reference.lucene-spellchecker.jar}" type="file"
379N/A property="lucene-spellchecker.jar.present"/>
379N/A <condition property="lucene.present">
379N/A <and>
379N/A <istrue value="lucene-core.jar.present"/>
379N/A <istrue value="lucene-spellchecker.jar.present"/>
411N/A </and>
379N/A </condition>
379N/A </target>
379N/A <target name="get.lucene" depends="-check-lucene" unless="lucene.present"
386N/A description="Download lucene jar files if not present">
379N/A <property name="m2repo.lucene"
379N/A value="http://repo1.maven.org/maven2/org/apache/lucene"/>
379N/A <get src="${m2repo.lucene}/lucene-core/${lucene.version}/${lucene-core.jar}"
379N/A dest="${file.reference.lucene-core.jar}" verbose="true" usetimestamp="true"/>
379N/A <get src="${m2repo.lucene}/lucene-spellchecker/${lucene.version}/${lucene-spellchecker.jar}"
411N/A dest="${file.reference.lucene-spellchecker.jar}" verbose="true" usetimestamp="true"/>
411N/A </target>
411N/A <target name="clean.lucene" depends="-init-project"
411N/A description="Remove downloaded Lucene components">
411N/A <delete file="${file.reference.lucene-core.jar}"/>
411N/A <delete file="${file.reference.lucene-spellchecker.jar}"/>
411N/A </target>
411N/A
411N/A <target name="-check-yui">
411N/A <available file="${YUI.min}" property="YUI.min.present" type="file"/>
411N/A <available file="${YUI.debug}" property="YUI.debug.present" type="file"/>
411N/A <condition property="YUI.present">
411N/A <and>
411N/A <istrue value="${YUI.min.present}"/>
411N/A <istrue value="${YUI.debug.present}"/>
411N/A </and>
482N/A </condition>
411N/A </target>
411N/A <target name="get.yui" depends="-check-yui" unless="YUI.present"
411N/A description="Download YUI files if not available.">
411N/A <pathconvert property="YUI.min.path" refid="YUI.min.src" pathsep="&amp;">
463N/A <map from="${basedir}/" to="${YUI.Version}/build/"/>
411N/A <map from="/" to=""/>
339N/A </pathconvert>
336N/A <pathconvert property="YUI.debug.path" refid="YUI.debug.src" pathsep="&amp;">
381N/A <map from="${basedir}/" to="${YUI.Version}/build/"/>
336N/A <map from="/" to=""/>
336N/A <mapper>
336N/A <globmapper from="*-min.js" to="*-debug.js"/>
336N/A </mapper>
336N/A </pathconvert>
336N/A <get src="http://yui.yahooapis.com/combo?${YUI.min.path}"
336N/A dest="${YUI.min}" verbose="true" usetimestamp="true"/>
336N/A <get src="http://yui.yahooapis.com/combo?${YUI.debug.path}"
336N/A dest="${YUI.debug}" verbose="true" usetimestamp="true"/>
336N/A </target>
336N/A <target name="clean.yui" description="Remove downloaded YUI components">
301N/A <delete failonerror="false" verbose="true">
301N/A <fileset dir="${basedir}" includes="${YUI.min},${YUI.debug}"/>
301N/A </delete>
301N/A </target>
301N/A
301N/A <target name="-make.web.xml" if="debug.web">
301N/A <property name="web.xml" value="${build.dir}/web.xml"/>
301N/A <copy file="web/WEB-INF/web.xml" tofile="${web.xml}">
301N/A <filterset>
301N/A <filter token="JsDebug" value="true"/>
691N/A </filterset>
301N/A </copy>
301N/A </target>
301N/A <target name="-check.web.xml" depends="-make.web.xml">
301N/A <property name="web.xml" value="web/WEB-INF/web.xml"/>
301N/A </target>
301N/A
448N/A <target name="-post-jar" depends="-copy-lib-without-netbeans,get.yui,-check.web.xml">
446N/A <war destfile="${dist.war}" webxml="${web.xml}">
448N/A <fileset dir="web" excludes="META-INF/context.xml"/>
500N/A <lib dir="${dist.dir}" includes="opengrok.jar"/>
736N/A <lib dir="${dist.dir}/lib" includes="*.jar" excludes="servlet-api.jar"/>
706N/A </war>
706N/A <echo message="Generating man page.."/>
706N/A <java classname="org.opensolaris.opengrok.index.CommandLineOptions"
706N/A output="${dist.dir}/opengrok.1" failonerror="true" fork="true">
455N/A <classpath>
706N/A <pathelement location="dist/opengrok.jar"/>
706N/A <pathelement path="${java.class.path}"/>
455N/A </classpath>
706N/A </java>
455N/A </target>
480N/A
706N/A <target name="package" depends="jar">
480N/A <exec os="SunOS" executable="/usr/bin/pkgmk" failonerror="true">
480N/A <arg line="-o -d build -r . -v ${version} -f platform/solaris/pkgdef/prototype"/>
455N/A </exec>
706N/A <exec os="SunOS" executable="/usr/bin/pkgtrans" failonerror="true">
455N/A <arg line="-s build /dist/OSOLopengrok-${version}.pkg OSOLopengrok"/>
480N/A </exec>
480N/A </target>
741N/A
741N/A <target name="dist" depends="jar">
500N/A <tar destfile="${dist.dir}/${distname}-${version}.tar.gz"
500N/A compression="gzip">
500N/A <tarfileset dir="." prefix="${distname}-${version}/doc">
706N/A <include name="README.txt"/>
500N/A <include name="CHANGES.txt"/>
500N/A <include name="LICENSE.txt"/>
706N/A <include name="NOTICE.txt"/>
500N/A <include name="paths.tsv"/>
500N/A <include name="logging.properties"/>
500N/A </tarfileset>
725N/A <tarfileset dir="." prefix="${distname}-${version}/bin" mode="755">
725N/A <include name="OpenGrok"/>
725N/A </tarfileset>
725N/A <tarfileset dir="doc" prefix="${distname}-${version}/doc">
725N/A <include name="EXAMPLE.txt"/>
725N/A </tarfileset>
725N/A <tarfileset dir="${dist.dir}" prefix="${distname}-${version}/lib">
706N/A <include name="opengrok.jar"/>
500N/A <include name="source.war"/>
706N/A <include name="lib/*"/>
725N/A <exclude name="lib/servlet-api.jar"/>
500N/A </tarfileset>
500N/A <tarfileset dir="${dist.dir}" prefix="${distname}-${version}/man/man1">
500N/A <include name="opengrok.1"/>
706N/A </tarfileset>
500N/A </tar>
725N/A </target>
706N/A
500N/A <target name="dist-src" depends="init">
301N/A <mkdir dir="${dist.dir}"/>
301N/A <exec executable="hg">
736N/A <arg value="archive"/>
736N/A <arg value="-t"/>
736N/A <arg value="tgz"/>
736N/A<!-- <arg value="-p"/>
736N/A <arg value="${distname}-${version}-src"/> -->
736N/A <arg value="${dist.dir}/${distname}-${version}-src.tar.gz"/>
736N/A </exec>
736N/A </target>
736N/A
736N/A <!-- Check that findbugs jar files are present -->
736N/A <target name="-check_findbugs">
736N/A <available file="findbugs.jar" type="file" property="findbugs.jar.present">
736N/A <filepath refid="findbugs.lib.search.path"/>
736N/A </available>
736N/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"/>
736N/A
736N/A <available file="findbugs-ant.jar" type="file" property="findbugs-ant.jar.present">
736N/A <filepath refid="findbugs.lib.search.path"/>
736N/A </available>
736N/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"/>
741N/A </target>
741N/A
737N/A <target name="findbugs" depends="jar, -check_findbugs"
737N/A description="Findbugs on OpenGrok source and generate HTML output">
737N/A <path id="findbugs.lib" >
736N/A <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
739N/A <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
736N/A </path>
736N/A <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
336N/A <mkdir dir="findbugs"/>
301N/A <findbugs projectname="OpenGrok" home="${findbugs.home}" output="html" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.html" jvmargs="-Xmx512m">
301N/A <auxClasspath>
501N/A <fileset dir="${dist.dir}/lib/">
301N/A <include name="*.jar"/>
301N/A </fileset>
301N/A </auxClasspath>
301N/A <sourcePath path="src" />
301N/A <class location="${dist.dir}/opengrok.jar" />
301N/A </findbugs>
301N/A </target>
301N/A
301N/A <target name="findbugs-xml" depends="jar, -check_findbugs"
449N/A description="Findbugs on OpenGrok source and generate XML output">
624N/A <path id="findbugs.lib" >
624N/A <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
624N/A <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
624N/A </path>
624N/A <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
624N/A <mkdir dir="findbugs"/>
624N/A <findbugs projectname="OpenGrok" home="${findbugs.home}" output="xml" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.xml" jvmargs="-Xmx512m">
624N/A <auxClasspath>
624N/A <fileset dir="${dist.dir}/lib/">
624N/A <include name="*.jar"/>
624N/A </fileset>
624N/A </auxClasspath>
624N/A <sourcePath path="src" />
624N/A <class location="${dist.dir}/opengrok.jar" />
624N/A </findbugs>
624N/A </target>
624N/A
624N/A <!-- Check that checkstyle jar files are present -->
624N/A <target name="-check_checkstyle">
624N/A <available file="checkstyle-all.jar" type="file" property="checkstyle.jar.present">
624N/A <filepath refid="checkstyle.lib.search.path"/>
624N/A </available>
624N/A <fail unless="checkstyle.jar.present" message="Please install checkstyle-all.jar in lib-directory (or in ant classpath) to run Checkstyle, see README."/>
801N/A </target>
801N/A
801N/A <target name="checkstyle" depends="compile, -check_checkstyle" description="Run checkstyle on OpenGrok source code">
801N/A <taskdef resource="checkstyletask.properties" classpath="${checkstyle.home}/checkstyle-all.jar"/>
801N/A <checkstyle config="checkstyle/style.xml" failOnViolation="false">
801N/A <fileset dir="src" includes="**/*.java"/>
801N/A <fileset dir="test" includes="**/*.java"/>
801N/A <formatter type="plain"/>
801N/A <formatter type="plain" toFile="checkstyle/checkstyle_errors.txt"/>
801N/A <formatter type="xml" toFile="checkstyle/checkstyle_errors.xml"/>
132N/A </checkstyle>
</target>
<!-- Check that pmd jar files are present -->
<target name="-check_pmd">
<available file="pmd.jar" type="file" property="pmd.jar.present">
<filepath refid="pmd.lib.search.path"/>
</available>
<fail unless="pmd.jar.present" message="Please install pmd.jar in lib-directory (or in ant classpath) to run PMD, see README."/>
</target>
<target name="pmd" depends="compile, -check_pmd" description="Run PMD on OpenGrok source code">
<path id="pmd.lib" >
<pathelement location="${pmd.home}/lib/pmd.jar"/>
<pathelement location="${pmd.home}/lib/jaxen.jar"/>
</path>
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib"/>
<mkdir dir="pmd"/>
<pmd targetjdk="1.6" failuresPropertyName="pmd.num.warnings" rulesetfiles="tools/pmd_ruleset.xml">
<formatter type="html" toFile="pmd/pmd_report.html"/>
<formatter type="xml" toFile="pmd/pmd_report.xml"/>
<fileset dir="src" includes="**/*.java"/>
<!-- <fileset dir="test" includes="**/*.java"/> -->
<!-- <fileset dir="web" includes="**/*.jsp"/>
<fileset dir="web" includes="**/*.jspf"/> -->
</pmd>
<echo message="PMD finished, found ${pmd.num.warnings} warnings, see pmd/pmd_report.html"/>
</target>
<target name="cpd-xml" depends="compile, -check_pmd" description="Run CPD on OpenGrok source code, print output in xml">
<path id="pmd.lib" >
<pathelement location="${pmd.home}/lib/pmd.jar"/>
<pathelement location="${pmd.home}/lib/jaxen.jar"/>
</path>
<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" classpathref="pmd.lib"/>
<cpd minimumTokenCount="100" format="xml" outputFile="pmd/cpd_report.xml">
<fileset dir="src">
<include name="**/*.java"/>
</fileset>
<fileset dir="test">
<include name="**/*.java"/>
</fileset>
</cpd>
</target>
<target name="cpd" depends="compile, -check_pmd" description="Run CPD on OpenGrok source code">
<path id="pmd.lib" >
<pathelement location="${pmd.home}/lib/pmd.jar"/>
<pathelement location="${pmd.home}/lib/jaxen.jar"/>
</path>
<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" classpathref="pmd.lib"/>
<cpd minimumTokenCount="100" outputFile="pmd/cpd_report.txt">
<fileset dir="src">
<include name="**/*.java"/>
</fileset>
<fileset dir="test">
<include name="**/*.java"/>
</fileset>
</cpd>
</target>
<!-- Check that emma jar files are present -->
<target name="-check_emma">
<available file="emma.jar" type="file" property="emma.jar.present">
<filepath refid="lib.search.path"/>
</available>
<fail unless="emma.jar.present" message="Please install emma.jar in lib-directory (or in ant classpath) to run Emma, see README."/>
<available file="emma_ant.jar" type="file" property="emma_ant.jar.present">
<filepath refid="lib.search.path"/>
</available>
<fail unless="emma_ant.jar.present" message="Please install emma_ant.jar in lib-directory (or in ant classpath) to run Emma, see README."/>
</target>
<target name="emma-instrument" depends="compile, -check_emma"
description="Prepare Emma code coverage analysis">
<path id="emma.lib" >
<pathelement location="lib/emma.jar"/>
<pathelement location="lib/emma_ant.jar"/>
</path>
<taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
<mkdir dir="${coverage.dir}" />
<emma enabled="true">
<instr instrpath="build/classes"
metadatafile="${coverage.dir}/coverage.em"
mode="overwrite"
filter="+org.opensolaris.*,-org.opensolaris.opengrok.management.client.*"/>
</emma>
</target>
<target name="-pre-compile-test">
<property name="test-sys-prop.emma.coverage.out.file" value="${coverage.dir}/coverage.ec"/>
<property name="test-sys-prop.emma.coverage.out.merge" value="true"/>
</target>
<target name="-post-compile-test">
<antcall target="-create-svn-repository"/>
<antcall target="-create-razor-repository"/>
<!-- Change root in CVS test repository -->
<!-- Strange indentation in line two levels below to get newline correctly -->
<concat destfile="${test.cvs.repo}/CVS/Root" append="no" force="yes" eol="unix">${basedir}/${test.cvs.root}/
</concat>
<!-- Generate ZIP files used for unit testing mercurial/.hg and mercurial/.hgignore are renamed -->
<copy todir="${test.hg}/.hg">
<fileset dir="${test.hg}/hg"/>
</copy>
<copy file="${test.hg}/hgignore" tofile="${test.hg}/.hgignore"/>
<zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/index/source.zip"
basedir="${test.sources}"
update="false"
defaultexcludes="no"/>
<zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/history/repositories.zip"
basedir="${test.repositories}"
excludes="mercurial/hg/**, mercurial/hgignore"
update="false"
defaultexcludes="no"/>
<antcall target="-delete-generated-repository-files"/>
</target>
<target name="-create-svn-repository">
<delete dir="${test.svn}"/>
<delete dir="${build.test.reposroots}/svn"/>
<mkdir dir="${build.test.reposroots}"/>
<exec executable="svnadmin" failifexecutionfails="true">
<arg value="create"/>
<arg value="${build.test.reposroots}/svn"/>
</exec>
<!-- need absolute path for svn url -->
<pathconvert property="test.svn.url">
<map from="" to="file://"/>
<path location="${build.test.reposroots}/svn"/>
</pathconvert>
<exec executable="svn" failifexecutionfails="false">
<arg value="import"/>
<arg value="${test.sources}"/>
<arg value="${test.svn.url}"/>
<arg value="-m"/>
<arg value="Initial import"/>
</exec>
<exec executable="svn" failifexecutionfails="false">
<arg value="checkout"/>
<arg value="${test.svn.url}"/>
<arg value="${test.svn}"/>
</exec>
</target>
<target name="-create-razor-repository">
<delete dir="${test.razor}"/>
<copy todir="${test.razor}/Razor-Simple">
<fileset dir="ext/SampleRazorRepository/UserSandbox"/>
</copy>
<copy todir="${test.razor}/Razor-Simple/SimpleCProgram/.razor">
<fileset dir="ext/SampleRazorRepository/Repository/OpenGrokSample/RAZOR_UNIVERSE/DOMAIN_01/Simple"/>
</copy>
<!--
The support for binaries in Razor repositories is not fully
functional, so the next copy target is commented out for now.
-->
<!--copy todir="${test.razor}/Razor-Simple/SimpleCProgram-BinaryRelease/.razor">
<fileset dir="ext/SampleRazorRepository/Repository/OpenGrokSample/RAZOR_UNIVERSE/DOMAIN_01/Simple"/>
</copy-->
</target>
<!-- clean up generated test repositories -->
<target name="-delete-generated-repository-files">
<delete dir="${test.hg}/.hg"/>
<delete file="${test.hg}/.hgignore"/>
<delete dir="${test.svn}"/>
<delete dir="${test.razor}"/>
<delete file="${test.cvs.repo}/CVS/Root"/>
</target>
<target name="emma-report" description="Analyze" depends="-check_emma">
<taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
<emma enabled="true" >
<report sourcepath="${src.dir},${src.generatedsrc.dir}">
<!-- collect all EMMA data dumps (metadata and runtime): -->
<infileset dir="${coverage.dir}" includes="*.em, *.ec"/>
<txt outfile="${coverage.dir}/coverage.txt"/>
<xml outfile="${coverage.dir}/coverage.xml"/>
<html outfile="${coverage.dir}/index.html"/>
</report>
</emma>
</target>
<target name="code-coverage" depends="clean, emma-instrument, test, emma-report"
description="Check/Report OpenGrok's test coverage"/>
<target name="jdepend" depends="compile" description="Run JDepend dependency checking">
<mkdir dir="jdepend"/>
<java classname="jdepend.xmlui.JDepend" failonerror="true" fork="true">
<arg value="-file"/>
<arg value="jdepend/report.xml"/>
<arg value="${build.classes.dir}"/>
<classpath>
<pathelement location="${user.home}/.ant/lib/jdepend/lib/jdepend.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
<java classname="jdepend.textui.JDepend" failonerror="true" fork="true">
<arg value="-file"/>
<arg value="jdepend/report.txt"/>
<arg value="${build.classes.dir}"/>
<classpath>
<pathelement location="${user.home}/.ant/lib/jdepend/lib/jdepend.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
<!-- Generate HTML test report -->
<target depends="init" name="test-report">
<junitreport todir="${build.test.results.dir}">
<fileset dir="${build.test.results.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report todir="${build.test.results.dir}"/>
</junitreport>
</target>
<!-- Build our patched JRCS library. -->
<target name="jrcs" depends="-pre-pre-compile">
<mkdir dir="${build.dir}/jrcs"/>
<javac srcdir="jrcs/src" destdir="${build.dir}/jrcs"
nowarn="on" source="1.4"/>
<jar destfile="${file.reference.jrcs.jar}">
<fileset dir="${build.dir}/jrcs" includes="**/*.class"/>
</jar>
</target>
<!-- compile jsp - just to test -->
<property name="debug" value="on" />
<property name="jsdebug" value="off" />
<property name="compress" value=".gz" />
<property name="debuglevel" value="source,lines,vars" />
<property name="optimize" value="on" />
<property name="deprecation" value="on" />
<property name="listfiles" value="true" />
<property name="codebase" value="org/opensolaris/opengrok"/>
<property name="codebase.dot" value="org.opensolaris.opengrok"/>
<property name="web.src.dir" location="web" />
<patternset id="libs">
<include name="*.jar" />
</patternset>
<path id="classpath.base">
<fileset dir="lib">
<patternset refid="libs" />
</fileset>
</path>
<!-- glassfish 3.1.2 install directory -->
<property name="AS_HOME" value="glassfish"/>
<path id="classpath.jspc">
<fileset dir="${AS_HOME}/modules">
<include name="javax.servlet-api.jar"/>
<include name="javax.servlet.jsp-api.jar"/>
<include name="javax.servlet.jsp.jar"/>
<include name="javax.el-api.jar"/>
</fileset>
</path>
<path id="classpath.web">
<path refid="classpath.base"/>
</path>
<path id="classpath.jsp">
<path refid="classpath.jspc"/>
<path refid="classpath.web"/>
</path>
<target name="-jsp.check" depends="init">
<mkdir dir="${build.dir}/src/jsp/${codebase}/jsp" />
<uptodate property="jsp.not.changed">
<srcfiles dir="${web.src.dir}" includes="**/*.jsp,**/*.jspf"/>
<mapper type="glob" from="*.jsp"
to="${build.dir}/src/jsp/${codebase}/jsp/*_jsp.java"/>
</uptodate>
</target>
<target name="-jsp.generate" depends="-jsp.check" unless="jsp.not.changed">
<taskdef name="jasper" classname="org.apache.jasper.JspC"
classpathref="classpath.jsp" />
<mkdir dir="${build.dir}/src/web"/>
<copy todir="${build.dir}/src/web">
<fileset dir="${web.src.dir}">
<include name="**/*.jsp"/>
<include name="**/*.jspf"/>
<include name="**/index_body.html"/>
</fileset>
</copy>
<jasper validateXml="false"
outputdir="${build.dir}/src/jsp"
javaencoding="UTF-8"
uriroot="${build.dir}/src/web"
package="${codebase.dot}.jsp"
compilersourcevm="1.6"
compilertargetvm="1.6"
smapsuppressed="false"
webxmlfragment="${build.dir}/src/servlets_web.xml"
/>
<loadfile property="wdd" srcfile="${build.dir}/src/servlets_web.xml"/>
<copy file="${web.src.dir}/WEB-INF/web.xml" todir="${build.dir}"
overwrite="true">
<filterset>
<filter token="generated servlet mappings"
value=" generated start -->${wdd}&lt;!-- generated end " />
</filterset>
</copy>
</target>
<target name="compile.jsp" depends="compile,-jsp.generate"
description="Generate java source from jsp pages and compile"
>
<javac srcdir="${build.dir}/src/jsp" destdir="${build.dir}/classes"
includes="**/*.java"
optimize="${optimize}" debug="${debug}" debuglevel="${debuglevel}"
deprecation="${deprecation}" classpathref="classpath.jsp"
encoding="UTF-8" listfiles="${listfiles}"
includeantruntime="false">
<compilerarg value="-Xlint:unchecked" compiler="javac1.6"/>
</javac>
</target>
<target name="all" depends="clean,jar,compile.jsp,test,javadoc,pmd,findbugs-xml,checkstyle" />
</project>