Index: trunk/lucene-search-2/build.xml |
— | — | @@ -4,6 +4,7 @@ |
5 | 5 | <property name="bin" value="bin"/> |
6 | 6 | <property name="src" value="src"/> |
7 | 7 | <property name="jars" value="jars"/> |
| 8 | + <property name="test" value="test"/> |
8 | 9 | <property name="dist" location="dist"/> |
9 | 10 | <property name="pack.name" value="lucene-search-2.1"/> |
10 | 11 | <property name="src.name" value="lucene-search-src-2.1"/> |
— | — | @@ -21,6 +22,7 @@ |
22 | 23 | |
23 | 24 | <path id="classpath"> |
24 | 25 | <fileset dir="${lib}" includes="*.jar"/> |
| 26 | + <file name="${jar.name}"/> |
25 | 27 | </path> |
26 | 28 | |
27 | 29 | <target name="run"> |
— | — | @@ -123,4 +125,32 @@ |
124 | 126 | <delete file="${dist}/${binary.name}.tar"/> |
125 | 127 | </target> |
126 | 128 | |
| 129 | + <target name="test-build" description="Compile the junit tests"> |
| 130 | + <javac srcdir="${test}" destdir="${test}"> |
| 131 | + <classpath> |
| 132 | + <pathelement path="${java.class.path}"/> |
| 133 | + <pathelement location="${collector.dir}"/> |
| 134 | + <pathelement path="${jar.name}"/> |
| 135 | + </classpath> |
| 136 | + </javac> |
| 137 | + </target> |
| 138 | + |
| 139 | + <target name="test" depends="test-build"> |
| 140 | + <property name="collector.dir" value="${test}"/> |
| 141 | + <available file="${collector.dir}/${collector.class}.class" property="hasFailingTests"/> |
| 142 | + |
| 143 | + <junit haltonerror="false" haltonfailure="false"> |
| 144 | + <classpath> |
| 145 | + <pathelement path="${java.class.path}"/> |
| 146 | + <pathelement location="${collector.dir}"/> |
| 147 | + <pathelement path="${jar.name}"/> |
| 148 | + </classpath> |
| 149 | + <sysproperty key="ant.junit.failureCollector" value="${collector.dir}/${collector.class}"/> |
| 150 | + |
| 151 | + <batchtest fork="yes" todir="${collector.dir}" unless="hasFailingTests"> |
| 152 | + <fileset dir="${collector.dir}" includes="**/*.java" excludes="**/${collector.class}.*"/> |
| 153 | + <formatter type="plain" usefile="false"/> |
| 154 | + </batchtest> |
| 155 | + </junit> |
| 156 | + </target> |
127 | 157 | </project> |