|
51 | 51 |
|
52 | 52 | <target name="library" depends="core" description="Build library of matchers"> |
53 | 53 | <path id="cp-hamcrest-library-main" path="build/hamcrest-core-${version}.jar"/> |
54 | | - <path id="cp-hamcrest-library-test" path="lib/integration/junit-dep-4.10.jar;build/hamcrest-core-${version}-test.jar"/> |
| 54 | + <path id="cp-hamcrest-library-test" path="lib/integration/junit-dep-4.10.jar;build/hamcrest-core-${version}-tests.jar"/> |
55 | 55 | <compile-module modulename="hamcrest-library"/> |
56 | 56 | <test-module modulename="hamcrest-library"/> |
57 | 57 | <generate-module-factory modulename="hamcrest-library" configurationfile="matchers.xml" targetclass="org.hamcrest.Matchers"/> |
|
63 | 63 | <fileset file="build/hamcrest-library-${version}.jar"/> |
64 | 64 | <fileset dir="lib/integration" includes="**/*.jar"/> |
65 | 65 | </path> |
66 | | - <path id="cp-hamcrest-integration-test" path="lib/integration/junit-dep-4.10.jar;build/hamcrest-core-${version}-test.jar"/> |
| 66 | + <path id="cp-hamcrest-integration-test" path="lib/integration/junit-dep-4.10.jar;build/hamcrest-core-${version}-tests.jar"/> |
67 | 67 | <compile-module modulename="hamcrest-integration"/> |
68 | 68 | <test-module modulename="hamcrest-integration"/> |
69 | 69 | </target> |
|
82 | 82 | <attribute name="modulename" description="Name of the module to jar"/> |
83 | 83 |
|
84 | 84 | <sequential> |
85 | | - <mkdir dir="build/temp/@{modulename}-${version}.jar.source"/> |
86 | | - <copy todir="build/temp/@{modulename}-${version}.jar.source"><fileset dir="@{modulename}/src/main/java"/></copy> |
| 85 | + <make-manifest modulename="@{modulename}"/> |
| 86 | + |
| 87 | + <mkdir dir="build/temp/@{modulename}-${version}-sources.jar.contents"/> |
| 88 | + <copy todir="build/temp/@{modulename}-${version}-sources.jar.contents"> |
| 89 | + <fileset dir="@{modulename}/src/main/java"/> |
| 90 | + </copy> |
87 | 91 | <mkdir dir="build/temp/@{modulename}-${version}.jar.contents"/> |
88 | | - <javac srcdir="build/temp/@{modulename}-${version}.jar.source" |
| 92 | + <javac srcdir="build/temp/@{modulename}-${version}-sources.jar.contents" |
89 | 93 | destdir="build/temp/@{modulename}-${version}.jar.contents" |
90 | 94 | debug="${debug}" source="1.5" target="1.5" includeantruntime="false"> |
91 | 95 | <classpath refid="cp-@{modulename}-main"/> |
92 | 96 | </javac> |
93 | 97 | <copy file="LICENSE.txt" todir="build/temp/@{modulename}-${version}.jar.contents/META-INF"/> |
94 | | - <make-manifest modulename="@{modulename}"/> |
95 | 98 | <jar jarfile="build/@{modulename}-${version}.jar" manifest="build/temp/@{modulename}-${version}.jar.manifest/MANIFEST.MF"> |
96 | 99 | <fileset dir="build/temp/@{modulename}-${version}.jar.contents"/> |
97 | 100 | </jar> |
98 | 101 |
|
99 | | - <mkdir dir="build/temp/@{modulename}-${version}-test.jar.source"/> |
100 | | - <copy todir="build/temp/@{modulename}-${version}-test.jar.source" failonerror="false"><fileset dir="@{modulename}/src/test/java"/></copy> |
101 | | - <mkdir dir="build/temp/@{modulename}-${version}-test.jar.contents"/> |
102 | | - <javac srcdir="build/temp/@{modulename}-${version}-test.jar.source" |
103 | | - destdir="build/temp/@{modulename}-${version}-test.jar.contents" |
| 102 | + <mkdir dir="build/temp/@{modulename}-${version}-tests-sources.jar.contents"/> |
| 103 | + <copy todir="build/temp/@{modulename}-${version}-tests-sources.jar.contents" failonerror="false"> |
| 104 | + <fileset dir="@{modulename}/src/test/java"/> |
| 105 | + </copy> |
| 106 | + <mkdir dir="build/temp/@{modulename}-${version}-tests.jar.contents"/> |
| 107 | + <javac srcdir="build/temp/@{modulename}-${version}-tests-sources.jar.contents" |
| 108 | + destdir="build/temp/@{modulename}-${version}-tests.jar.contents" |
104 | 109 | debug="${debug}" source="1.5" target="1.5" includeantruntime="false"> |
105 | 110 | <classpath refid="cp-@{modulename}-main"/> |
106 | 111 | <classpath refid="cp-@{modulename}-test"/> |
107 | 112 | <classpath path="build/@{modulename}-${version}.jar"/> |
108 | 113 | </javac> |
109 | | - <jar jarfile="build/@{modulename}-${version}-test.jar" manifest="build/temp/@{modulename}-${version}.jar.manifest/MANIFEST.MF"> |
110 | | - <fileset dir="build/temp/@{modulename}-${version}-test.jar.contents"/> |
| 114 | + <jar jarfile="build/@{modulename}-${version}-tests.jar" manifest="build/temp/@{modulename}-${version}.jar.manifest/MANIFEST.MF"> |
| 115 | + <fileset dir="build/temp/@{modulename}-${version}-tests.jar.contents"/> |
| 116 | + </jar> |
| 117 | + |
| 118 | + <copy file="LICENSE.txt" todir="build/temp/@{modulename}-${version}-sources.jar.contents/META-INF"/> |
| 119 | + <jar jarfile="build/@{modulename}-${version}-sources.jar" manifest="build/temp/@{modulename}-${version}.jar.manifest/MANIFEST.MF"> |
| 120 | + <fileset dir="build/temp/@{modulename}-${version}-sources.jar.contents"/> |
111 | 121 | </jar> |
112 | 122 | </sequential> |
113 | 123 | </macrodef> |
|
143 | 153 | <target name="bigjar" depends="core, library, integration, generator" |
144 | 154 | description="Build a single Jar (hamcrest-all.jar) that contains core, library, generator and integration."> |
145 | 155 | <mkdir dir="build/temp/hamcrest-all-${version}.jar.manifest"/> |
146 | | - <manifest file="build/temp/hamcrest-all-${version}.jar.manifest/MANIFEST.MF"> |
147 | | - <attribute name="Implementation-Title" value="hamcrest-all"/> |
148 | | - <attribute name="Implementation-Vendor" value="hamcrest.org"/> |
149 | | - <attribute name="Implementation-Version" value="${version}"/> |
150 | | - <attribute name="Built-By" value="${user.name}"/> |
151 | | - <attribute name="Built-Date" value="${build.timestamp}"/> |
152 | | - </manifest> |
| 156 | + <make-manifest modulename="hamcrest-all"/> |
153 | 157 | <jar jarfile="build/hamcrest-all-${version}.jar" duplicate="preserve" manifest="build/temp/hamcrest-all-${version}.jar.manifest/MANIFEST.MF"> |
154 | 158 | <zipfileset src="build/hamcrest-core-${version}.jar"/> |
155 | 159 | <zipfileset src="build/hamcrest-library-${version}.jar"/> |
|
305 | 309 | </sequential> |
306 | 310 | </macrodef> |
307 | 311 |
|
308 | | - <macrodef name="java-to-jar" description="Compile Java source for a module and build a Jar"> |
309 | | - <attribute name="srcdir" description="Directory containg Java source"/> |
| 312 | + <macrodef name="test-module" description="run unit tests."> |
310 | 313 | <attribute name="modulename" description="Name of the module to jar"/> |
311 | | - <attribute name="classpath" description="Anything additional to add on the classpath" default=""/> |
312 | 314 | <sequential> |
313 | | - <mkdir dir="build/temp/@{modulename}-${version}.jar.manifest"/> |
314 | | - <manifest file="build/temp/@{modulename}-${version}.jar.manifest/MANIFEST.MF"> |
315 | | - <attribute name="Implementation-Title" value="@{modulename}"/> |
316 | | - <attribute name="Implementation-Vendor" value="hamcrest.org"/> |
317 | | - <attribute name="Implementation-Version" value="${version}"/> |
318 | | - <attribute name="Built-By" value="${user.name}"/> |
319 | | - <attribute name="Built-Date" value="${build.timestamp}"/> |
320 | | - </manifest> |
321 | | - |
322 | | - <!-- Build jar --> |
323 | | - <mkdir dir="build/temp/@{modulename}-${version}.jar.contents"/> |
324 | | - <javac srcdir="@{srcdir}" destdir="build/temp/@{modulename}-${version}.jar.contents" debug="${debug}" source="1.5" target="1.5" includeantruntime="false"> |
325 | | - <classpath> |
326 | | - <fileset dir="lib/integration"> |
327 | | - <include name="*.jar"/> |
328 | | - </fileset> |
329 | | - <pathelement path="@{classpath}"/> |
330 | | - </classpath> |
331 | | - </javac> |
332 | | - <copy file="LICENSE.txt" todir="build/temp/@{modulename}-${version}.jar.contents/META-INF"/> |
333 | | - <jar jarfile="build/@{modulename}-${version}.jar" manifest="build/temp/@{modulename}-${version}.jar.manifest/MANIFEST.MF"> |
334 | | - <fileset dir="build/temp/@{modulename}-${version}.jar.contents"/> |
335 | | - </jar> |
336 | | - |
337 | | - <!-- Build test jar --> |
338 | | - <mkdir dir="build/temp/@{modulename}-${version}.testjar.contents"/> |
339 | | - <javac srcdir="@{srcdir}" destdir="build/temp/@{modulename}-${version}.testjar.contents" debug="${debug}" source="1.5" target="1.5" includeantruntime="false"> |
340 | | - <classpath> |
341 | | - <fileset dir="lib/integration"> |
342 | | - <include name="*.jar"/> |
343 | | - </fileset> |
344 | | - <pathelement path="build/@{modulename}-${version}.jar"/> |
345 | | - <pathelement path="@{classpath}"/> |
346 | | - </classpath> |
347 | | - </javac> |
348 | | - <jar jarfile="build/@{modulename}-${version}-tests.jar" manifest="build/temp/@{modulename}-${version}.jar.manifest/MANIFEST.MF"> |
349 | | - <fileset dir="build/temp/@{modulename}-${version}.testjar.contents"/> |
350 | | - </jar> |
351 | | - |
352 | | - <!-- Build sources jar --> |
353 | | - <copy todir="build/temp/@{modulename}-${version}-sources.jar.contents"> |
354 | | - <fileset dir="@{srcdir}"/> |
355 | | - </copy> |
356 | | - <copy file="LICENSE.txt" todir="build/temp/@{modulename}-${version}-sources.jar.contents/META-INF"/> |
357 | | - <jar jarfile="build/@{modulename}-${version}-sources.jar" manifest="build/temp/@{modulename}-${version}.jar.manifest/MANIFEST.MF"> |
358 | | - <fileset dir="build/temp/@{modulename}-${version}-sources.jar.contents"/> |
359 | | - </jar> |
| 315 | + <mkdir dir="build/temp/@{modulename}/test-wrk"/> |
| 316 | + <junit printsummary="no" forkmode="once" tempdir="build/temp/@{modulename}/test-wrk" haltonfailure="${haltonfailure}"> |
| 317 | + <formatter type="brief" usefile="no"/> |
| 318 | + <classpath refid="cp-@{modulename}-main"/> |
| 319 | + <classpath refid="cp-@{modulename}-test"/> |
| 320 | + <classpath path="build/@{modulename}-${version}.jar"/> |
| 321 | + <classpath path="build/@{modulename}-${version}-tests.jar"/> |
| 322 | + <batchtest fork="yes" todir="${build.dir}/testreport"> |
| 323 | + <zipfileset src="build/@{modulename}-${version}-tests.jar"> |
| 324 | + <include name="org/hamcrest/**/*Test.class"/> |
| 325 | + <exclude name="**/Abstract*.class"/> |
| 326 | + </zipfileset> |
| 327 | + </batchtest> |
| 328 | + </junit> |
360 | 329 | </sequential> |
361 | 330 | </macrodef> |
362 | 331 |
|
|
383 | 352 | </jar> |
384 | 353 | </sequential> |
385 | 354 | </macrodef> |
386 | | - |
387 | | - <macrodef name="test-module" description="run unit tests."> |
388 | | - <attribute name="modulename" description="Name of the module to jar"/> |
389 | | - <sequential> |
390 | | - <mkdir dir="build/temp/@{modulename}/test-wrk"/> |
391 | | - <junit printsummary="no" forkmode="once" tempdir="build/temp/@{modulename}/test-wrk" haltonfailure="${haltonfailure}"> |
392 | | - <formatter type="brief" usefile="no"/> |
393 | | - <classpath refid="cp-@{modulename}-main"/> |
394 | | - <classpath refid="cp-@{modulename}-test"/> |
395 | | - <classpath path="build/@{modulename}-${version}.jar"/> |
396 | | - <classpath path="build/@{modulename}-${version}-test.jar"/> |
397 | | - <batchtest fork="yes" todir="${build.dir}/testreport"> |
398 | | - <zipfileset src="build/@{modulename}-${version}-test.jar"> |
399 | | - <include name="org/hamcrest/**/*Test.class"/> |
400 | | - <exclude name="**/Abstract*.class"/> |
401 | | - </zipfileset> |
402 | | - </batchtest> |
403 | | - </junit> |
404 | | - </sequential> |
405 | | - </macrodef> |
| 355 | + |
406 | 356 | </project> |
0 commit comments