Skip to content

Commit a24ab2e

Browse files
committed
build bigjar and javadocs
1 parent c5457d6 commit a24ab2e

1 file changed

Lines changed: 42 additions & 112 deletions

File tree

‎build.xml‎

Lines changed: 42 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<property name="debug" value="true" description="Whether to build with debug information"/>
66
<tstamp><format property="build.timestamp" pattern="yyyy-MM-dd HH:mm:ss" timezone="GMT"/></tstamp>
77

8-
<target name="all" depends="clean, package" description="Performs clean build, runs tests and packages for distribution"/>
8+
<target name="all" depends="clean, bigjar" description="Performs clean build, runs tests and packages for distribution"/>
99

1010
<target name="clean" description="Clean up all built files">
1111
<delete dir="build"/>
@@ -79,105 +79,47 @@
7979
<jar-module modulename="hamcrest-examples"/>
8080
</target>
8181

82-
<target name="bigjar" depends="core, library, integration, generator"
83-
description="Build a single Jar (hamcrest-all.jar) that contains core, library, generator and integration.">
82+
<target name="bigjar" depends="core,library,integration,generator" description="Build composite jars">
8483
<!-- Bundle api into core jar -->
85-
<copy file="build/hamcrest-core-${version}.jar" tofile="build/hamcrest-core-${version}-nodep.jar"/>
86-
<jar jarfile="build/hamcrest-core-${version}.jar" duplicate="preserve">
87-
<zipfileset src="build/hamcrest-api-${version}.jar"/>
88-
<zipfileset src="build/hamcrest-core-${version}-nodep.jar"/>
89-
</jar>
90-
91-
<mkdir dir="build/temp/hamcrest-all-${version}.jar.manifest"/>
92-
<make-manifest modulename="hamcrest-all"/>
93-
<jar jarfile="build/hamcrest-all-${version}.jar" duplicate="preserve" manifest="build/temp/hamcrest-all-${version}.jar.manifest/MANIFEST.MF">
94-
<zipfileset src="build/hamcrest-core-${version}.jar"/>
95-
<zipfileset src="build/hamcrest-library-${version}.jar"/>
96-
<zipfileset src="build/hamcrest-generator-${version}.jar"/>
97-
<zipfileset src="build/hamcrest-integration-${version}.jar"/>
98-
</jar>
99-
<jar jarfile="build/hamcrest-all-${version}-sources.jar" duplicate="preserve" manifest="build/temp/hamcrest-all-${version}.jar.manifest/MANIFEST.MF">
100-
<zipfileset src="build/hamcrest-core-${version}-sources.jar"/>
101-
<zipfileset src="build/hamcrest-library-${version}-sources.jar"/>
102-
<zipfileset src="build/hamcrest-generator-${version}-sources.jar"/>
103-
<zipfileset src="build/hamcrest-integration-${version}-sources.jar"/>
104-
</jar>
105-
</target>
106-
107-
<target name="javadoc" description="build javadoc jars">
108-
<java-to-javadoc-jar modulename="hamcrest-generator-nodeps"/>
109-
<java-to-javadoc-jar modulename="hamcrest-core"/>
110-
<java-to-javadoc-jar modulename="hamcrest-library"/>
111-
<java-to-javadoc-jar modulename="hamcrest-integration"/>
112-
<copy file="build/hamcrest-generator-nodeps-${version}-javadoc.jar" tofile="build/hamcrest-generator-${version}-javadoc.jar"/>
84+
<copy todir="build/temp/hamcrest-core-${version}.jar.contents">
85+
<fileset dir="build/temp/hamcrest-api-${version}.jar.contents"/>
86+
</copy>
87+
<copy todir="build/temp/hamcrest-core-${version}-sources.jar.contents">
88+
<fileset dir="build/temp/hamcrest-api-${version}-sources.jar.contents"/>
89+
</copy>
90+
<jar-module modulename="hamcrest-core"/>
11391

114-
<javadoc packagenames="org.hamcrest.*" defaultexcludes="yes"
115-
destdir="build/temp/hamcrest-all-${version}-javadoc.jar.contents" author="true" version="true" use="true"
116-
windowtitle="Hamcrest" source="1.6" failonerror="yes" overview="overview.html">
117-
<classpath>
118-
<fileset dir="lib/integration">
119-
<include name="*.jar"/>
120-
</fileset>
121-
</classpath>
122-
<packageset dir="build/temp/hamcrest-core-${version}-sources.jar.contents"/>
123-
<packageset dir="build/temp/hamcrest-library-${version}-sources.jar.contents" excludes="org/hamcrest/internal"/>
124-
<packageset dir="build/temp/hamcrest-integration-${version}-sources.jar.contents"/>
125-
126-
<group title="Hamcrest API and Utility Classes" packages="org.hamcrest"/>
127-
<group title="Matcher Library" packages="org.hamcrest.*"/>
128-
<group title="Integration" packages="org.hamcrest.integration, org.hamcrest.integration.*"/>
129-
130-
<link offline="false" href="http://www.junit.org/junit/javadoc/3.8.1/"/>
131-
<link offline="false" href="http://kentbeck.github.com/junit/javadoc/latest/"/>
132-
</javadoc>
133-
<jar jarfile="build/hamcrest-all-${version}-javadoc.jar">
134-
<fileset dir="build/temp/hamcrest-all-${version}-javadoc.jar.contents"/>
135-
</jar>
92+
<!-- Bundle core, library, integration, and generator into all jar-->
93+
<copy todir="build/temp/hamcrest-all-${version}.jar.contents">
94+
<fileset dir="build/temp/hamcrest-core-${version}.jar.contents"/>
95+
<fileset dir="build/temp/hamcrest-library-${version}.jar.contents"/>
96+
<fileset dir="build/temp/hamcrest-integration-${version}.jar.contents"/>
97+
<fileset dir="build/temp/hamcrest-generator-${version}.jar.contents"/>
98+
</copy>
99+
<copy todir="build/temp/hamcrest-all-${version}-sources.jar.contents">
100+
<fileset dir="build/temp/hamcrest-core-${version}-sources.jar.contents"/>
101+
<fileset dir="build/temp/hamcrest-library-${version}-sources.jar.contents"/>
102+
<fileset dir="build/temp/hamcrest-integration-${version}-sources.jar.contents"/>
103+
<fileset dir="build/temp/hamcrest-generator-${version}-sources.jar.contents"/>
104+
</copy>
105+
<path id="cp-hamcrest-all-main">
106+
<path refid="cp-hamcrest-core-main"/>
107+
<path refid="cp-hamcrest-library-main"/>
108+
<path refid="cp-hamcrest-integration-main"/>
109+
<path refid="cp-hamcrest-generator-main"/>
110+
</path>
111+
<jar-module modulename="hamcrest-all"/>
136112
</target>
137113

138-
<target name="package" depends="core, generator, library, integration, bigjar, examples, javadoc" description="Package for distribution">
139-
<copy todir="build">
140-
<fileset dir="pom" includes="*.pom"/>
141-
<filterset><filter token="VERSION" value="${version}"/></filterset>
142-
<mapper type="regexp" from="(.*)\.pom" to="\1-${version}.pom"/>
143-
</copy>
144-
<zip zipfile="build/hamcrest-${version}.zip">
145-
<zipfileset dir="." prefix="hamcrest-${version}">
146-
<include name="hamcrest-*/**"/>
147-
<include name="lib/**"/>
148-
<include name="*.txt"/>
149-
<include name="build.xml"/>
150-
<include name="*matchers.xml"/>
151-
</zipfileset>
152-
<zipfileset dir="build" prefix="hamcrest-${version}">
153-
<include name="hamcrest-parent-${version}*"/>
154-
<include name="hamcrest-core-${version}*"/>
155-
<include name="hamcrest-library-${version}*"/>
156-
<include name="hamcrest-generator-${version}*"/>
157-
<include name="hamcrest-integration-${version}*"/>
158-
<include name="hamcrest-all-${version}*"/>
159-
</zipfileset>
160-
</zip>
161-
<tar tarfile="build/hamcrest-${version}.tgz" compression="gzip" longfile="gnu">
162-
<tarfileset dir="." prefix="hamcrest-${version}">
163-
<include name="hamcrest-*/**"/>
164-
<include name="lib/**"/>
165-
<include name="*.txt"/>
166-
<include name="build.xml"/>
167-
<include name="*matchers.xml"/>
168-
</tarfileset>
169-
<tarfileset dir="build" prefix="hamcrest-${version}">
170-
<include name="hamcrest-parent-${version}*"/>
171-
<include name="hamcrest-core-${version}*"/>
172-
<include name="hamcrest-library-${version}*"/>
173-
<include name="hamcrest-generator-${version}*"/>
174-
<include name="hamcrest-integration-${version}*"/>
175-
<include name="hamcrest-all-${version}*"/>
176-
</tarfileset>
177-
</tar>
114+
<target name="javadoc" depends="bigjar" description="build javadoc jars">
115+
<javadoc-module modulename="hamcrest-generator"/>
116+
<javadoc-module modulename="hamcrest-core"/>
117+
<javadoc-module modulename="hamcrest-library"/>
118+
<javadoc-module modulename="hamcrest-integration"/>
119+
<javadoc-module modulename="hamcrest-all"/>
178120
</target>
179121

180-
<target name="bundle" description="Create a release bundle for deployment to maven central" depends="clean, package">
122+
<target name="bundle" description="Create a release bundle for deployment to maven central" depends="clean, javadoc">
181123
<exec executable="gpg" dir="build"><arg value="-ab"/><arg value="hamcrest-parent-${version}.pom"/></exec>
182124
<exec executable="gpg" dir="build"><arg value="-ab"/><arg value="hamcrest-core-${version}.pom"/></exec>
183125
<exec executable="gpg" dir="build"><arg value="-ab"/><arg value="hamcrest-core-${version}.jar"/></exec>
@@ -338,27 +280,15 @@
338280
</sequential>
339281
</macrodef>
340282

341-
<macrodef name="java-to-javadoc-jar" description="Generate javadoc for a module and build a Jar">
283+
<macrodef name="javadoc-module" description="Generate javadoc for a module and build a Jar">
342284
<attribute name="modulename" description="Name of the module to document"/>
343285
<sequential>
344-
<unzip src="build/@{modulename}-${version}-sources.jar" dest="build/temp/@{modulename}-${version}-sources.jar.contents"/>
345-
<javadoc packagenames="org.hamcrest.*" sourcepath="build/temp/@{modulename}-${version}-sources.jar.contents" defaultexcludes="yes"
346-
destdir="build/temp/@{modulename}-${version}-javadoc.jar.contents" author="true" version="true" use="true"
347-
windowtitle="Hamcrest" source="1.6" failonerror="yes">
348-
<classpath>
349-
<fileset dir="lib/integration">
350-
<include name="*.jar"/>
351-
</fileset>
352-
<fileset file="lib/generator/qdox-1.12.jar"/>
353-
<fileset file="build/hamcrest-core-${version}.jar"/>
354-
<fileset file="build/hamcrest-library-${version}.jar"/>
355-
<fileset file="build/hamcrest-generator-${version}.jar"/>
356-
<fileset file="build/hamcrest-integration-${version}.jar"/>
357-
</classpath>
286+
<javadoc packagenames="org.hamcrest.*" sourcepath="build/temp/@{modulename}-${version}-sources.jar.contents"
287+
destdir="build/temp/@{modulename}-${version}-javadoc.jar.contents" author="true" version="true"
288+
use="true" windowtitle="Hamcrest" source="1.5" failonerror="yes" defaultexcludes="yes">
289+
<classpath refid="cp-@{modulename}-main"/>
358290
</javadoc>
359-
<jar jarfile="build/@{modulename}-${version}-javadoc.jar">
360-
<fileset dir="build/temp/@{modulename}-${version}-javadoc.jar.contents"/>
361-
</jar>
291+
<jar-module-component modulename="@{modulename}" suffix="-javadoc"/>
362292
</sequential>
363293
</macrodef>
364294

0 commit comments

Comments
 (0)