Skip to content

Commit 3205924

Browse files
committed
build sources
1 parent 453c0c0 commit 3205924

1 file changed

Lines changed: 40 additions & 90 deletions

File tree

‎build.xml‎

Lines changed: 40 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
<target name="library" depends="core" description="Build library of matchers">
5353
<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"/>
5555
<compile-module modulename="hamcrest-library"/>
5656
<test-module modulename="hamcrest-library"/>
5757
<generate-module-factory modulename="hamcrest-library" configurationfile="matchers.xml" targetclass="org.hamcrest.Matchers"/>
@@ -63,7 +63,7 @@
6363
<fileset file="build/hamcrest-library-${version}.jar"/>
6464
<fileset dir="lib/integration" includes="**/*.jar"/>
6565
</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"/>
6767
<compile-module modulename="hamcrest-integration"/>
6868
<test-module modulename="hamcrest-integration"/>
6969
</target>
@@ -82,32 +82,42 @@
8282
<attribute name="modulename" description="Name of the module to jar"/>
8383

8484
<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>
8791
<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"
8993
destdir="build/temp/@{modulename}-${version}.jar.contents"
9094
debug="${debug}" source="1.5" target="1.5" includeantruntime="false">
9195
<classpath refid="cp-@{modulename}-main"/>
9296
</javac>
9397
<copy file="LICENSE.txt" todir="build/temp/@{modulename}-${version}.jar.contents/META-INF"/>
94-
<make-manifest modulename="@{modulename}"/>
9598
<jar jarfile="build/@{modulename}-${version}.jar" manifest="build/temp/@{modulename}-${version}.jar.manifest/MANIFEST.MF">
9699
<fileset dir="build/temp/@{modulename}-${version}.jar.contents"/>
97100
</jar>
98101

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"
104109
debug="${debug}" source="1.5" target="1.5" includeantruntime="false">
105110
<classpath refid="cp-@{modulename}-main"/>
106111
<classpath refid="cp-@{modulename}-test"/>
107112
<classpath path="build/@{modulename}-${version}.jar"/>
108113
</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"/>
111121
</jar>
112122
</sequential>
113123
</macrodef>
@@ -143,13 +153,7 @@
143153
<target name="bigjar" depends="core, library, integration, generator"
144154
description="Build a single Jar (hamcrest-all.jar) that contains core, library, generator and integration.">
145155
<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"/>
153157
<jar jarfile="build/hamcrest-all-${version}.jar" duplicate="preserve" manifest="build/temp/hamcrest-all-${version}.jar.manifest/MANIFEST.MF">
154158
<zipfileset src="build/hamcrest-core-${version}.jar"/>
155159
<zipfileset src="build/hamcrest-library-${version}.jar"/>
@@ -305,58 +309,23 @@
305309
</sequential>
306310
</macrodef>
307311

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.">
310313
<attribute name="modulename" description="Name of the module to jar"/>
311-
<attribute name="classpath" description="Anything additional to add on the classpath" default=""/>
312314
<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>
360329
</sequential>
361330
</macrodef>
362331

@@ -383,24 +352,5 @@
383352
</jar>
384353
</sequential>
385354
</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+
406356
</project>

0 commit comments

Comments
 (0)