1<!-- $Id: build.xml,v 12.4 2008/02/08 22:10:16 mark Exp $ --> 2<project name="clover" default="build" basedir="."> 3 4 <property name="db" location="../../.."/> 5 <property name="src" location="${db}/java/src"/> 6 <property name="test.src" location="${db}/test/scr024/src"/> 7 <property name="examples.src" location="${db}/examples_java/src"/> 8 <property name="testserialdir" value="testserial"/> 9 <property name="clover.initstring" location="reports/clover.db"/> 10 <property name="clover.excludes" value="**/test/** collections/** db/** com/sleepycat/db/**"/> 11 <!-- 12 <property name="build.compiler" 13 value="org.apache.tools.ant.taskdefs.CloverCompilerAdapter"/> 14 --> 15 16 <target name="all" depends="clean,test,report"/> 17 18 <target name="clean"> 19 <delete dir="classes"/> 20 <delete dir="tmp"/> 21 <delete dir="reports"/> 22 </target> 23 24 <target name="init"> 25 <mkdir dir="classes"/> 26 <mkdir dir="tmp"/> 27 <mkdir dir="reports"/> 28 </target> 29 30 <path id="clover.classpath"> 31 <pathelement location="clover.jar"/> 32 <pathelement location="velocity.jar"/> 33 </path> 34 35 <path id="classpath"> 36 <pathelement location="classes"/> 37 <path refid="clover.classpath"/> 38 </path> 39 40 <target name="build" depends="init"> 41 <javac destdir="classes" debug="on" source="1.5" target="1.5"> 42 <src path="${src}"/> 43 <src path="${test.src}"/> 44 <src path="${examples.src}"/> 45 <exclude name="com/sleepycat/**/release/**"/> 46 <exclude name="com/sleepycat/xa/**"/> 47 </javac> 48 <!-- Compile original version of TestSerial.java.original. --> 49 <property name="testserialpath" 50 value="com/sleepycat/collections/test/serial/TestSerial"/> 51 <copy file="${test.src}/${testserialpath}.java.original" 52 tofile="${testserialdir}/${testserialpath}.java"/> 53 <javac destdir="${testserialdir}" debug="on" source="1.5" target="1.5" 54 includeAntRuntime="true" srcdir="${testserialdir}"> 55 <include name="${testserialpath}.java"/> 56 </javac> 57 <!-- Compile original version of EvolveClasses. --> 58 <copy file= 59 "${test.src}/com/sleepycat/persist/test/EvolveClasses.java.original" 60 tofile= 61 "testevolvedir/com/sleepycat/persist/test/EvolveClasses.java"/> 62 <copy file= 63 "${test.src}/com/sleepycat/persist/test/EvolveCase.java" 64 tofile= 65 "testevolvedir/com/sleepycat/persist/test/EvolveCase.java"/> 66 <copy file= 67 "${test.src}/com/sleepycat/persist/test/PersistTestUtils.java" 68 tofile= 69 "testevolvedir/com/sleepycat/persist/test/PersistTestUtils.java"/> 70 <javac debug="on" source="1.5" target="1.5" classpath="classes"> 71 <src path="testevolvedir"/> 72 </javac> 73 </target> 74 75 <target name="test" depends="build"> 76 77 <!-- Determine which tests to run. --> 78 <condition property="dotestserial"> 79 <or> 80 <not><isset property="testcase"/></not> 81 <equals arg1="${testcase}" arg2= 82 "com.sleepycat.collections.test.serial.StoredClassCatalogTest"/> 83 </or> 84 </condition> 85 <condition property="dotestevolve"> 86 <or> 87 <not><isset property="testcase"/></not> 88 <equals arg1="${testcase}" 89 arg2="com.sleepycat.persist.test.EvolveTest"/> 90 </or> 91 </condition> 92 93 <!-- Performs initialization needed before StoredClassCatalogTest. --> 94 <junit fork="yes" dir="." printsummary="on" haltonfailure="on" 95 showoutput="on"> 96 <jvmarg value="-ea"/> 97 <classpath path="${testserialdir}"/> <!-- Must be first --> 98 <classpath refid="classpath"/> 99 <sysproperty key="testdestdir" value="/tmp"/> 100 <sysproperty key="longtest" value="${longtest}"/> 101 <formatter type="plain" usefile="false"/> 102 <formatter type="xml"/> 103 <test name= 104 "com.sleepycat.collections.test.serial.StoredClassCatalogTestInit" 105 todir="reports" if="dotestserial"/> 106 </junit> 107 108 <!-- Performs initialization needed before persist EvolveTest. --> 109 <junit fork="yes" dir="." printsummary="on" haltonfailure="on" 110 showoutput="on"> 111 <jvmarg value="-ea"/> 112 <classpath path="testevolvedir"/> 113 <classpath refid="classpath"/> 114 <sysproperty key="testdestdir" value="/tmp"/> 115 <sysproperty key="longtest" value="${longtest}"/> 116 <formatter type="plain" usefile="false"/> 117 <formatter type="xml"/> 118 <test name="com.sleepycat.persist.test.EvolveTestInit" 119 todir="reports" if="dotestevolve"/> 120 </junit> 121 122 <!-- Performs testcase if set, or batch tests. --> 123 <junit fork="yes" dir="." printsummary="on" haltonfailure="on" 124 showoutput="on"> 125 <jvmarg value="-ea"/> 126 <classpath refid="classpath"/> 127 <sysproperty key="testdestdir" value="/tmp"/> 128 <sysproperty key="longtest" value="${longtest}"/> 129 <formatter type="plain" usefile="false"/> 130 <formatter type="xml"/> 131 <test name="${testcase}" todir="reports" if="testcase"/> 132 <batchtest todir="reports" unless="testcase"> 133 <fileset dir="classes" includes="**/*Test.class"/> 134 </batchtest> 135 </junit> 136 </target> 137 138 <target name="testevolve" depends="build"> 139 </target> 140 141 <target name="examples" depends="build"> 142 <echo message="=== HelloDatabaseWorld ==="/> 143 <java dir="." fork="yes" classpathref="classpath" 144 classname="collections.hello.HelloDatabaseWorld"/> 145 <echo message=""/> 146 <antcall target="one_shipment_example"> 147 <param name="param_name" value="basic"/> 148 </antcall> 149 <antcall target="one_shipment_example"> 150 <param name="param_name" value="index"/> 151 </antcall> 152 <antcall target="one_shipment_example"> 153 <param name="param_name" value="entity"/> 154 </antcall> 155 <antcall target="one_shipment_example"> 156 <param name="param_name" value="tuple"/> 157 </antcall> 158 <antcall target="one_shipment_example"> 159 <param name="param_name" value="sentity"/> 160 </antcall> 161 <antcall target="one_shipment_example"> 162 <param name="param_name" value="marshal"/> 163 </antcall> 164 <antcall target="one_shipment_example"> 165 <param name="param_name" value="factory"/> 166 </antcall> 167 <antcall target="one_persist_example"> 168 <param name="param_name" value="CustomKeyOrderExample"/> 169 </antcall> 170 <antcall target="one_persist_example"> 171 <param name="param_name" value="EventExample"/> 172 </antcall> 173 <antcall target="one_persist_example"> 174 <param name="param_name" value="EventExampleDPL"/> 175 </antcall> 176 <antcall target="one_persist_example"> 177 <param name="param_name" value="PersonExample"/> 178 </antcall> 179 <antcall target="DplDump"> 180 <param name="home" value="tmp"/> 181 <param name="store" value="PersonStore"/> 182 </antcall> 183 </target> 184 185 <target name="one_shipment_example"> 186 <echo message="=== ${param_name} ==="/> 187 <delete dir="tmp"/> 188 <mkdir dir="tmp"/> 189 <java dir="." fork="yes" classpathref="classpath" 190 classname="collections.ship.${param_name}.Sample"/> 191 </target> 192 193 <target name="one_persist_example"> 194 <echo message="=== ${param_name} ==="/> 195 <delete dir="tmp"/> 196 <mkdir dir="tmp"/> 197 <java fork="yes" dir="." classname="persist.${param_name}"> 198 <jvmarg value="-ea"/> 199 <arg line="-h tmp"/> 200 <classpath refid="classpath"/> 201 </java> 202 </target> 203 204 <target name="DplDump"> 205 <echo message="=== DplDump ${home} ${store} ==="/> 206 <java fork="yes" dir="." classname="persist.DplDump"> 207 <jvmarg value="-ea"/> 208 <arg line="-h ${home} -s ${store}"/> 209 <classpath refid="classpath"/> 210 </java> 211 </target> 212 213 <!-- Using fork="yes" does not work for AccessExample, apparently because 214 it is interactive and the input stream of the forked process isn't 215 functional; therefore this sample writes to the base directory. 216 --> 217 <target name="access_example" depends="build"> 218 <echo message="=== AccessExample ==="/> 219 <java classpathref="classpath" 220 classname="collections.access.AccessExample"> 221 </java> 222 </target> 223 224 <target name="report"> 225 <java classname="com.cortexeb.tools.clover.reporters.html.HtmlReporter" 226 fork="true"> 227 <arg line="--outputdir reports --showSrc --initstring ${clover.initstring} --title 'Berkeley DB Java BDB API'"/> 228 <classpath refid="clover.classpath"/> 229 </java> 230 </target> 231 232</project> 233 234