Home | History | Annotate | Download | only in trunk
      1 <?xml version="1.0" encoding="UTF-8"?>
      2 <!-- 
      3 
      4 CDDL HEADER START
      5 
      6 The contents of this file are subject to the terms of the
      7 Common Development and Distribution License (the "License").  
      8 You may not use this file except in compliance with the License.
      9 
     10 See LICENSE.txt included in this distribution for the specific
     11 language governing permissions and limitations under the License.
     12 
     13 When distributing Covered Code, include this CDDL HEADER in each
     14 file and include the License file at LICENSE.txt.
     15 If applicable, add the following below this CDDL HEADER, with the
     16 fields enclosed by brackets "[]" replaced with your own identifying
     17 information: Portions Copyright [yyyy] [name of copyright owner]
     18 
     19 CDDL HEADER END
     20 
     21 Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
     22 Use is subject to license terms.
     23 
     24 -->
     25 <project name="OpenGrok" default="jar" basedir=".">
     26     <description>Builds, tests, and runs the project opengrok.</description>
     27     <import file="nbproject/build-impl.xml"/>
     28 
     29     <import file="nbproject/profiler-build-impl.xml"/>    <!--
     30 
     31     There exist several targets which are by default empty and which can be 
     32     used for execution of your tasks. These targets are usually executed 
     33     before and after some main targets. They are: 
     34 
     35       -pre-init:                 called before initialization of project properties
     36       -post-init:                called after initialization of project properties
     37       -pre-compile:              called before javac compilation
     38       -post-compile:             called after javac compilation
     39       -pre-compile-single:       called before javac compilation of single file
     40       -post-compile-single:      called after javac compilation of single file
     41       -pre-compile-test:         called before javac compilation of JUnit tests
     42       -post-compile-test:        called after javac compilation of JUnit tests
     43       -pre-compile-test-single:  called before javac compilation of single JUnit test
     44       -post-compile-test-single: called after javac compilation of single JUunit test
     45       -pre-jar:                  called before JAR building
     46       -post-jar:                 called after JAR building
     47       -post-clean:               called after cleaning build products
     48 
     49     (Targets beginning with '-' are not intended to be called on their own.)
     50 
     51     Example of inserting an obfuscator after compilation could look like this:
     52 
     53         <target name="-post-compile">
     54             <obfuscate>
     55                 <fileset dir="${build.classes.dir}"/>
     56             </obfuscate>
     57         </target>
     58 
     59     For list of available properties check the imported 
     60     nbproject/build-impl.xml file. 
     61 
     62 
     63     Another way to customize the build is by overriding existing main targets.
     64     The targets of interest are: 
     65 
     66       -init-macrodef-javac:     defines macro for javac compilation
     67       -init-macrodef-junit:     defines macro for junit execution
     68       -init-macrodef-debug:     defines macro for class debugging
     69       -init-macrodef-java:      defines macro for class execution
     70       -do-jar-with-manifest:    JAR building (if you are using a manifest)
     71       -do-jar-without-manifest: JAR building (if you are not using a manifest)
     72       run:                      execution of project 
     73       -javadoc-build:           Javadoc generation
     74       test-report:              JUnit report generation
     75 
     76     An example of overriding the target for project execution could look like this:
     77 
     78         <target name="run" depends="opengrok-impl.jar">
     79             <exec dir="bin" executable="launcher.exe">
     80                 <arg file="${dist.jar}"/>
     81             </exec>
     82         </target>
     83 
     84     Notice that the overridden target depends on the jar target and not only on 
     85     the compile target as the regular run target does. Again, for a list of available 
     86     properties which you can use, check the target you are overriding in the
     87     nbproject/build-impl.xml file. 
     88 
     89     -->
     90 
     91     <property name="version" value="0.8"/>
     92     <property name="distname" value="opengrok"/>
     93     
     94     <property name="findbugs.home" value="${user.home}/.ant/lib/findbugs"/>
     95     <property name="checkstyle.home" value="${user.home}/.ant/lib/checkstyle"/>
     96     <property name="pmd.home" value="${user.home}/.ant/lib/pmd"/>
     97 
     98     <property name="test.repositories" value="testdata/repositories"/>
     99     <property name="test.sources" value="testdata/sources"/>
    100     <property name="test.cvs" value="${test.repositories}/cvs"/>
    101     <property name="test.cvs.repo" value="${test.cvs}/cvsrepo"/>
    102     <property name="test.cvs.root" value="${test.cvs}/cvsroot"/>
    103     <property name="test.hg" value="${test.repositories}/mercurial"/>
    104     <property name="test.svn" value="${test.repositories}/svn"/>
    105     <property name="test.razor" value="${test.repositories}/razor"/>
    106 
    107     <available property="compileSystrayClient" classname="java.awt.TrayIcon"/>
    108 
    109     <target name="-exclude-client" unless="compileSystrayClient">	    
    110 	<echo>JDK doesn't have java.awt.TrayIcon, excluding building of systray client ... </echo>
    111 	<property name="excludes" value="org/opensolaris/opengrok/management/client/**"/> 
    112     </target>
    113     
    114                  
    115     <path id="lib.search.path">
    116         <pathelement path="${user.home}/.ant/lib"/>
    117         <pathelement path="${java.class.path}"/>
    118         <pathelement path="lib"/>
    119     </path>
    120 
    121     <path id="findbugs.lib.search.path">
    122         <pathelement path="${findbugs.home}/lib/"/>
    123         <pathelement path="${java.class.path}"/>
    124         <pathelement path="lib/findbugs/lib/"/>
    125     </path>
    126 
    127     <path id="checkstyle.lib.search.path">
    128         <pathelement path="${checkstyle.home}/"/>
    129         <pathelement path="${java.class.path}"/>
    130     </path>
    131 
    132     <path id="pmd.lib.search.path">
    133         <pathelement path="${pmd.home}/lib/"/>
    134         <pathelement path="${java.class.path}"/>
    135         <pathelement path="lib/pmd/lib/"/>
    136     </path>
    137 
    138     <available file="JFlex.jar" type="file" property="JFlex.present">
    139         <filepath refid="lib.search.path"/>
    140     </available>
    141     <fail unless="JFlex.present" message="Please download JFlex (http://jflex.de/) and put JFlex.jar it into ./lib directory (or in ant classpath)."/>
    142     
    143     <taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpath="lib/JFlex.jar"/>    
    144     <property name="gensrcdir" value="generatedsrc"/>
    145     <target name="jflex">
    146         <mkdir dir="${gensrcdir}"/>
    147         <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
    148         <jflex file="src/org/opensolaris/opengrok/analysis/c/CSymbolTokenizer.lex" destdir="${gensrcdir}"/>
    149         <jflex file="src/org/opensolaris/opengrok/analysis/c/CXref.lex" destdir="${gensrcdir}"/>
    150         <jflex file="src/org/opensolaris/opengrok/analysis/c/CxxSymbolTokenizer.lex" destdir="${gensrcdir}"/>
    151         <jflex file="src/org/opensolaris/opengrok/analysis/c/CxxXref.lex" destdir="${gensrcdir}"/>
    152         <jflex file="src/org/opensolaris/opengrok/analysis/fortran/FortranSymbolTokenizer.lex" destdir="${gensrcdir}"/>
    153         <jflex file="src/org/opensolaris/opengrok/analysis/fortran/FortranXref.lex" destdir="${gensrcdir}"/>
    154         <jflex file="src/org/opensolaris/opengrok/analysis/java/JavaSymbolTokenizer.lex" destdir="${gensrcdir}"/>
    155         <jflex file="src/org/opensolaris/opengrok/analysis/java/JavaXref.lex" destdir="${gensrcdir}"/>
    156         <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispSymbolTokenizer.lex" destdir="${gensrcdir}"/>
    157         <jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispXref.lex" destdir="${gensrcdir}"/>
    158         <jflex file="src/org/opensolaris/opengrok/analysis/tcl/TclSymbolTokenizer.lex" destdir="${gensrcdir}"/>
    159         <jflex file="src/org/opensolaris/opengrok/analysis/tcl/TclXref.lex" destdir="${gensrcdir}"/>
    160         <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainFullTokenizer.lex" destdir="${gensrcdir}"/>
    161         <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainSymbolTokenizer.lex" destdir="${gensrcdir}"/>
    162         <jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainXref.lex" destdir="${gensrcdir}"/>
    163         <jflex file="src/org/opensolaris/opengrok/analysis/plain/XMLXref.lex" destdir="${gensrcdir}"/>
    164         <jflex file="src/org/opensolaris/opengrok/analysis/sql/SQLXref.lex" destdir="${gensrcdir}"/>
    165         <jflex file="src/org/opensolaris/opengrok/analysis/document/TroffXref.lex" destdir="${gensrcdir}"/>
    166         <jflex file="src/org/opensolaris/opengrok/analysis/document/TroffFullTokenizer.lex" destdir="${gensrcdir}"/>
    167         <jflex file="src/org/opensolaris/opengrok/analysis/sh/ShSymbolTokenizer.lex" destdir="${gensrcdir}"/>
    168         <jflex file="src/org/opensolaris/opengrok/analysis/sh/ShXref.lex" destdir="${gensrcdir}"/>
    169         <jflex file="src/org/opensolaris/opengrok/search/context/HistoryLineTokenizer.lex" destdir="${gensrcdir}"/>
    170         <jflex file="src/org/opensolaris/opengrok/search/context/PlainLineTokenizer.lex" destdir="${gensrcdir}"/>
    171     </target>
    172     
    173     <property name="hg" value="hg"/>
    174     <target name="-hg-get-changeset">
    175         <exec executable="${hg}"
    176               failifexecutionfails="no"
    177               outputproperty="changeset">
    178             <arg value="log"/>
    179             <arg value="-r"/>
    180             <arg value="tip"/>
    181             <redirector>
    182                 <outputfilterchain>
    183                     <filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp">
    184                         <param type="regexp" value="^changeset:"/>
    185                     </filterreader>
    186                     <tokenfilter>
    187                         <replaceregex pattern="^changeset:[^:]*:" replace=""/>
    188                     </tokenfilter>
    189                 </outputfilterchain>
    190             </redirector>
    191         </exec>
    192     </target>
    193 
    194     <target name="-update-build-info" depends="-hg-get-changeset">
    195         <mkdir dir="${build.classes.dir}/org/opensolaris/opengrok"/>
    196         <propertyfile
    197             file="${build.classes.dir}/org/opensolaris/opengrok/info.properties">
    198             <entry  key="version" value="${version}"/>
    199             <entry  key="changeset" value="${changeset}"/>
    200         </propertyfile>        
    201     </target>
    202         
    203     <property name="coverage.dir" value="${basedir}/coverage"/>
    204     <target name="-pre-compile" depends="jflex"/>
    205     <target name="-post-clean">
    206         <delete dir="${gensrcdir}"/>
    207         <delete file="${manifest.file}"/>
    208         <delete dir="${coverage.dir}"/>
    209         <antcall target="-delete-generated-repository-files"/>
    210     </target>
    211 
    212     <!--
    213         Create an empty manifest file so that nbproject/build-impl.xml
    214         notices that a manifest should be added to the jar file
    215       -->
    216     <target name="-touch-manifest">
    217       <!-- no attributes, main-class and class-path will be added later -->
    218       <manifest file="manifest.mf" mode="replace"/>
    219     </target>
    220 
    221     <target name="-pre-init" depends="-touch-manifest, -exclude-client"/>
    222 
    223     <!--
    224         Initialize a property holding a list of jar files on which
    225         opengrok.jar depends
    226       -->
    227     <target name="-post-init">
    228       <pathconvert property="opengrok.lib.files" pathsep=" ">
    229         <path>
    230           <pathelement path="${javac.classpath}"/>
    231         </path>
    232         <flattenmapper/>
    233         <map from="" to="lib/"/>
    234       </pathconvert>
    235     </target>
    236 
    237     <!-- Update the manifest file with a classpath attribute -->
    238     <target name="-update-manifest-classpath">
    239       <manifest file="${manifest.file}" mode="update">
    240         <attribute name="Class-Path"
    241                    value="${opengrok.lib.files} lib/derbyclient.jar lib/derby.jar"/>
    242       </manifest>
    243     </target>
    244 
    245     <target name="-pre-jar" depends="-update-manifest-classpath,-update-build-info"/>
    246 
    247     <!--
    248         Copy the jars from lib to dist/lib manually if we don't have
    249         the copylibs task from NetBeans
    250       -->
    251     <target name="-copy-lib-without-netbeans"
    252             unless="manifest.available+main.class+mkdist.available">
    253       <copy todir="${dist.dir}/lib">
    254         <fileset file="${file.reference.ant.jar}"/>
    255       </copy>
    256       <copy todir="${dist.dir}">
    257         <fileset dir="." includes="${opengrok.lib.files}"/>
    258       </copy>
    259     </target>
    260 
    261     <target name="-post-jar" depends="-copy-lib-without-netbeans">
    262         <war destfile="${dist.war}" webxml="conf/web.xml">
    263             <fileset dir="web"/>
    264             <fileset dir="conf" excludes="web.xml"/>
    265             <lib dir="${dist.dir}" includes="opengrok.jar"/>
    266             <lib dir="${dist.dir}/lib" includes="*.jar" excludes="servlet-api.jar"/>
    267         </war>
    268         <echo message="Generating man page.."/>
    269         <java classname="org.opensolaris.opengrok.index.CommandLineOptions" 
    270               output="${dist.dir}/opengrok.1" failonerror="true" fork="true">
    271             <classpath>
    272                 <pathelement location="dist/opengrok.jar"/>
    273                 <pathelement path="${java.class.path}"/>
    274             </classpath>
    275         </java>
    276     </target>
    277 
    278     <target name="package" depends="jar">
    279       <exec os="SunOS" executable="/usr/bin/pkgmk" failonerror="true">
    280         <arg line="-o -d build -r . -v ${version} -f platform/solaris/pkgdef/prototype"/>
    281       </exec>
    282       <exec os="SunOS" executable="/usr/bin/pkgtrans" failonerror="true">
    283 	<arg line="-s build ../dist/OSOLopengrok-${version}.pkg OSOLopengrok"/>
    284       </exec>
    285     </target>
    286 
    287     <target name="dist" depends="jar">
    288       <tar destfile="${dist.dir}/${distname}-${version}.tar.gz"
    289            compression="gzip">
    290         <tarfileset dir="." prefix="${distname}-${version}">
    291           <include name="README.txt"/>
    292           <include name="CHANGES.txt"/>
    293           <include name="LICENSE.txt"/>
    294           <include name="paths.tsv"/>
    295         </tarfileset>
    296         <tarfileset dir="." prefix="${distname}-${version}" mode="755">
    297           <include name="OpenGrok"/>
    298           <include name="run.sh"/>
    299           <include name="run-quiet.sh"/>
    300           <include name="run.bat"/>
    301         </tarfileset>
    302         <tarfileset dir="doc" prefix="${distname}-${version}">
    303           <include name="EXAMPLE.txt"/>
    304         </tarfileset>
    305         <tarfileset dir="${dist.dir}" prefix="${distname}-${version}">
    306           <include name="opengrok.jar"/>
    307           <include name="source.war"/>
    308           <include name="lib/*"/>
    309           <exclude name="lib/servlet-api.jar"/>
    310         </tarfileset>
    311       </tar>
    312     </target>
    313 
    314     <target name="dist-src" depends="init">
    315       <mkdir dir="${dist.dir}"/>
    316       <exec executable="hg">
    317         <arg value="archive"/>
    318         <arg value="-t"/>
    319         <arg value="tgz"/>
    320         <arg value="${dist.dir}/${distname}-${version}-src.tar.gz"/>
    321       </exec>
    322     </target>
    323     
    324     <target name="-check_findbugs" description="Check that findbugs jar files are present">
    325         <available file="findbugs.jar" type="file" property="findbugs.jar.present">
    326             <filepath refid="findbugs.lib.search.path"/>
    327         </available>
    328         <fail unless="findbugs.jar.present" message="Please install Findbugs findbugs.jar in ~/.ant/lib-directory (or in ant classpath) to run Findbugs, see README"/>
    329 
    330         <available file="findbugs-ant.jar" type="file" property="findbugs-ant.jar.present">
    331             <filepath refid="findbugs.lib.search.path"/>
    332         </available>
    333         <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"/>
    334     </target>
    335     
    336     <target name="findbugs" depends="jar, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate HTML output">
    337         <path id="findbugs.lib" >
    338             <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
    339             <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
    340         </path>
    341         <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
    342         <mkdir dir="findbugs"/>
    343         <findbugs projectname="OpenGrok" home="${findbugs.home}" output="html" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.html" jvmargs="-Xmx512m">
    344             <auxClasspath>
    345                 <fileset dir="${dist.dir}/lib/">
    346                     <include name="*.jar"/>
    347                 </fileset>
    348             </auxClasspath>
    349             <sourcePath path="src" />
    350             <class location="${dist.dir}/opengrok.jar" />
    351         </findbugs>
    352     </target>
    353     
    354     <target name="findbugs-xml" depends="jar, -check_findbugs" description="Runs Findbugs on the OpenGrok source code and generate XML output">
    355         <path id="findbugs.lib" >
    356             <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
    357             <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
    358         </path>
    359         <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/>
    360         <mkdir dir="findbugs"/>
    361         <findbugs projectname="OpenGrok" home="${findbugs.home}" output="xml" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.xml" jvmargs="-Xmx512m">
    362             <auxClasspath>
    363                 <fileset dir="${dist.dir}/lib/">
    364                     <include name="*.jar"/>
    365                 </fileset>
    366             </auxClasspath>
    367             <sourcePath path="src" />
    368             <class location="${dist.dir}/opengrok.jar" />
    369         </findbugs>
    370     </target>
    371     
    372     <target name="-check_checkstyle" description="Check that checkstyle jar files are present">
    373         <available file="checkstyle-all.jar" type="file" property="checkstyle.jar.present">
    374             <filepath refid="checkstyle.lib.search.path"/>
    375         </available>
    376         <fail unless="checkstyle.jar.present" message="Please install checkstyle-all.jar in lib-directory  (or in ant classpath) to run Checkstyle, see README."/>
    377     </target>
    378     
    379     <target name="checkstyle" depends="compile, -check_checkstyle" description="Run checkstyle on OpenGrok source code">
    380         <taskdef resource="checkstyletask.properties" classpath="${checkstyle.home}/checkstyle-all.jar"/>
    381         <checkstyle config="checkstyle/style.xml" failOnViolation="false">
    382             <fileset dir="src" includes="**/*.java"/>
    383             <formatter type="plain"/>
    384             <formatter type="plain"  toFile="checkstyle/checkstyle_errors.txt"/>
    385             <formatter type="xml" toFile="checkstyle/checkstyle_errors.xml"/>
    386         </checkstyle>
    387     </target>
    388 
    389     <target name="-check_pmd" description="Check that pmd jar files are present">
    390         <available file="pmd.jar" type="file" property="pmd.jar.present">
    391             <filepath refid="pmd.lib.search.path"/>
    392         </available>
    393         <fail unless="pmd.jar.present" message="Please install pmd.jar in lib-directory  (or in ant classpath) to run PMD, see README."/>
    394     </target>
    395     
    396     <target name="pmd" depends="compile, -check_pmd" description="Run PMD on OpenGrok source code">
    397         <path id="pmd.lib" >
    398             <pathelement location="${pmd.home}/lib/pmd.jar"/>
    399             <pathelement location="${pmd.home}/lib/jaxen.jar"/>
    400         </path>
    401         <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib"/>
    402         <mkdir dir="pmd"/>
    403         <pmd targetjdk="1.6" failuresPropertyName="pmd.num.warnings" rulesetfiles="tools/pmd_ruleset.xml">
    404             <formatter type="html" toFile="pmd/pmd_report.html"/>
    405             <formatter type="xml" toFile="pmd/pmd_report.xml"/>
    406             <fileset dir="src" includes="**/*.java"/>
    407         </pmd>
    408         <echo message="PMD finished, found ${pmd.num.warnings} warnings, see pmd/pmd_report.html"/>
    409     </target>
    410 
    411     <target name="-check_emma" description="Check that emma jar files are present">
    412         <available file="emma.jar" type="file" property="emma.jar.present">
    413             <filepath refid="lib.search.path"/>
    414         </available>
    415         <fail unless="emma.jar.present" message="Please install emma.jar in lib-directory  (or in ant classpath) to run Emma, see README."/>
    416 
    417         <available file="emma_ant.jar" type="file" property="emma_ant.jar.present">
    418             <filepath refid="lib.search.path"/>
    419         </available>
    420         <fail unless="emma_ant.jar.present" message="Please install emma_ant.jar in lib-directory  (or in ant classpath) to run Emma, see README."/>
    421     </target>
    422     
    423     <target name="emma-instrument" depends="compile, -check_emma" description="Instruments the source code for Emma code coverage analysis">
    424         <path id="emma.lib" >
    425             <pathelement location="lib/emma.jar"/>
    426             <pathelement location="lib/emma_ant.jar"/>
    427         </path>
    428         <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
    429         <mkdir dir="${coverage.dir}" />
    430         <emma enabled="true">
    431             <instr instrpath="build/classes"
    432                        metadatafile="${coverage.dir}/coverage.em"
    433                        mode="overwrite"
    434                        filter="+org.opensolaris.*,-org.opensolaris.opengrok.management.client.*"/>
    435         </emma>
    436     </target>
    437     
    438     <target name="-pre-compile-test">
    439         <property name="test-sys-prop.emma.coverage.out.file" value="${coverage.dir}/coverage.ec"/>
    440         <property name="test-sys-prop.emma.coverage.out.merge" value="true"/>
    441     </target>
    442 
    443     <target name="-post-compile-test">
    444         <antcall target="-create-svn-repository"/>
    445         <antcall target="-create-razor-repository"/>
    446         <!-- Change root in CVS test repository -->
    447         <!-- Strange indentation in line two levels below to get newline correctly -->
    448         <concat destfile="${test.cvs.repo}/CVS/Root" append="no" force="yes" eol="unix">${basedir}/${test.cvs.root}/
    449 </concat>
    450         <!-- Generate ZIP files used for unit testing mercurial/.hg and mercurial/.hgignore are renamed -->
    451         <copy todir="${test.hg}/.hg">
    452             <fileset dir="${test.hg}/hg"/>
    453         </copy>
    454         <copy file="${test.hg}/hgignore" tofile="${test.hg}/.hgignore"/>
    455         
    456         <zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/index/source.zip"
    457               basedir="${test.sources}"
    458               update="false"
    459               defaultexcludes="no"/>
    460         <zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/history/repositories.zip" 
    461                 basedir="${test.repositories}"
    462                 excludes="mercurial/hg/**, mercurial/hgignore"
    463                 update="false"
    464                 defaultexcludes="no"/>
    465 
    466         <antcall target="-delete-generated-repository-files"/>
    467     </target>
    468 
    469     <target name="-create-svn-repository">
    470       <delete dir="${test.svn}"/>
    471       <delete dir="${build.test.reposroots}/svn"/>
    472       <mkdir dir="${build.test.reposroots}"/>
    473       <exec executable="svnadmin" failifexecutionfails="false">
    474         <arg value="create"/>
    475         <arg value="${build.test.reposroots}/svn"/>
    476       </exec>
    477       
    478       <!-- need absolute path for svn url -->
    479       <pathconvert property="test.svn.url">
    480         <map from="" to="file://"/>
    481         <path location="${build.test.reposroots}/svn"/>
    482       </pathconvert>
    483 
    484       <exec executable="svn" failifexecutionfails="false">
    485         <arg value="import"/>
    486         <arg value="${test.sources}"/>
    487         <arg value="${test.svn.url}"/>
    488         <arg value="-m"/>
    489         <arg value="Initial import"/>
    490       </exec>
    491       <exec executable="svn" failifexecutionfails="false">
    492         <arg value="checkout"/>
    493         <arg value="${test.svn.url}"/>
    494         <arg value="${test.svn}"/>
    495       </exec>
    496     </target>
    497     
    498     <target name="-create-razor-repository">
    499       <delete dir="${test.razor}"/>
    500       <copy todir="${test.razor}/Razor-Simple">
    501         <fileset dir="ext/SampleRazorRepository/UserSandbox"/>
    502       </copy>
    503       <copy todir="${test.razor}/Razor-Simple/SimpleCProgram/.razor">
    504         <fileset dir="ext/SampleRazorRepository/Repository/OpenGrokSample/RAZOR_UNIVERSE/DOMAIN_01/Simple"/>
    505       </copy>
    506 
    507       <!--
    508           The support for binaries in Razor repositories is not fully
    509           functional, so the next copy target is commented out for now.
    510         -->
    511 
    512       <!--copy todir="${test.razor}/Razor-Simple/SimpleCProgram-BinaryRelease/.razor">
    513         <fileset dir="ext/SampleRazorRepository/Repository/OpenGrokSample/RAZOR_UNIVERSE/DOMAIN_01/Simple"/>
    514       </copy-->
    515 
    516     </target>
    517 
    518     <!-- clean up generated test repositories -->
    519     <target name="-delete-generated-repository-files">
    520       <delete dir="${test.hg}/.hg"/>
    521       <delete file="${test.hg}/.hgignore"/>
    522       <delete dir="${test.svn}"/>
    523       <delete dir="${test.razor}"/>
    524       <delete file="${test.cvs.repo}/CVS/Root"/>
    525     </target>
    526 
    527     <target name="emma-report" description="Analyze" depends="-check_emma">
    528         <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
    529         <emma enabled="true" >
    530             <report sourcepath="${src.dir},${src.generatedsrc.dir}">
    531                 <!-- collect all EMMA data dumps (metadata and runtime): -->
    532                 <infileset dir="${coverage.dir}" includes="*.em, *.ec"/>
    533                 <txt outfile="${coverage.dir}/coverage.txt"/>
    534                 <xml outfile="${coverage.dir}/coverage.xml"/>
    535                 <html  outfile="${coverage.dir}/index.html"/>
    536             </report>
    537         </emma>
    538     </target>
    539     
    540     <target name="code-coverage" depends="clean, emma-instrument, test, emma-report" description="Make test code coverage reports based on the OpenGrok unit tests"/>
    541 
    542     <target name="jdepend" depends="compile" description="Run JDepend dependency checking">
    543         <mkdir dir="jdepend"/>
    544         <java classname="jdepend.xmlui.JDepend" failonerror="true" fork="true">
    545             <arg value="-file"/>
    546             <arg value="jdepend/report.xml"/>
    547             <arg value="${build.classes.dir}"/>
    548             <classpath>
    549                 <pathelement location="${user.home}/.ant/lib/jdepend/lib/jdepend.jar"/>
    550                 <pathelement path="${java.class.path}"/>
    551             </classpath>            
    552         </java>
    553         <java classname="jdepend.textui.JDepend" failonerror="true" fork="true">
    554             <arg value="-file"/>
    555             <arg value="jdepend/report.txt"/>
    556             <arg value="${build.classes.dir}"/>
    557             <classpath>
    558                 <pathelement location="${user.home}/.ant/lib/jdepend/lib/jdepend.jar"/>
    559                 <pathelement path="${java.class.path}"/>
    560             </classpath>            
    561         </java>
    562     </target>
    563 
    564     <!-- Generate HTML test report -->
    565     <target depends="init" name="test-report">
    566         <junitreport todir="${build.test.results.dir}">
    567             <fileset dir="${build.test.results.dir}">
    568                 <include name="TEST-*.xml"/>
    569             </fileset>
    570             <report todir="${build.test.results.dir}"/>
    571         </junitreport>
    572     </target>
    573 
    574 </project>
    575