|
16 | 16 | </target> |
17 | 17 |
|
18 | 18 | <target name="generator" description="Build code generator tool"> |
19 | | - <java-to-jar srcdir="hamcrest-generator/src/main/java" |
20 | | - modulename="hamcrest-generator-nodeps" |
21 | | - classpath="lib/generator/qdox-1.12.jar"/> |
| 19 | + <path id="cp-hamcrest-generator-main" path="lib/generator/qdox-1.12.jar"/> |
| 20 | + <path id="cp-hamcrest-generator-test" path="lib/integration/junit-dep-4.10.jar"/> |
| 21 | + <compile-module modulename="hamcrest-generator"/> |
22 | 22 |
|
23 | 23 | <!-- Bundle QDox classes in hamcrest-generator.jar using JarJar to place classes under a different package --> |
24 | 24 | <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="lib/generator/jarjar-1.3.jar"/> |
|
30 | 30 | <copy file="build/hamcrest-generator-nodeps-${version}-sources.jar" tofile="build/hamcrest-generator-${version}-sources.jar"/> |
31 | 31 | </target> |
32 | 32 |
|
33 | | - <target name="core" depends="api,generator" description="Build core Hamcrest library"> |
34 | | - <java-to-jar srcdir="hamcrest-core/src/main/java" |
35 | | - modulename="hamcrest-core-nodeps" |
36 | | - classpath="build/hamcrest-api-${version}.jar"/> |
| 33 | + <macrodef name="compile-module"> |
| 34 | + <attribute name="modulename" description="Name of the module to jar"/> |
| 35 | + <attribute name="classpathref" description="Anything additional to add on the classpath" default=""/> |
| 36 | + |
| 37 | + <sequential> |
| 38 | + <mkdir dir="build/temp/@{modulename}-${version}.jar.contents"/> |
| 39 | + <javac srcdir="@{modulename}/src/main/java" |
| 40 | + destdir="build/temp/@{modulename}-${version}.jar.contents" |
| 41 | + debug="${debug}" source="1.5" target="1.5" includeantruntime="false"> |
| 42 | + <classpath refid="cp-@{modulename}-main"/> |
| 43 | + </javac> |
| 44 | + <copy file="LICENSE.txt" todir="build/temp/@{modulename}-${version}.jar.contents/META-INF"/> |
| 45 | + <make-manifest modulename="@{modulename}"/> |
| 46 | + <jar jarfile="build/@{modulename}-${version}.jar" manifest="build/temp/@{modulename}-${version}.jar.manifest/MANIFEST.MF"> |
| 47 | + <fileset dir="build/temp/@{modulename}-${version}.jar.contents"/> |
| 48 | + </jar> |
| 49 | + |
| 50 | + <mkdir dir="build/temp/@{modulename}-${version}-test.jar.contents"/> |
| 51 | + <javac srcdir="@{modulename}/src/test/java" |
| 52 | + destdir="build/temp/@{modulename}-${version}-test.jar.contents" |
| 53 | + debug="${debug}" source="1.5" target="1.5" includeantruntime="false"> |
| 54 | + <classpath refid="cp-@{modulename}-test"/> |
| 55 | + <classpath path="build/@{modulename}-${version}.jar"/> |
| 56 | + </javac> |
| 57 | + </sequential> |
| 58 | + </macrodef> |
| 59 | + |
| 60 | + <target name="core" depends="generator" description="Build core Hamcrest library"> |
| 61 | + <java-to-jar srcdir="hamcrest-core/src/main/java" modulename="hamcrest-core"/> |
37 | 62 |
|
38 | 63 | <!-- Generate one class with all static imports --> |
39 | 64 | <mkdir dir="build/temp/hamcrest-core/generated-code"/> |
|
261 | 286 | </jar> |
262 | 287 | </target> |
263 | 288 |
|
| 289 | + <macrodef name="make-manifest"> |
| 290 | + <attribute name="modulename" description="Name of the module"/> |
| 291 | + <sequential> |
| 292 | + <mkdir dir="build/temp/@{modulename}-${version}.jar.manifest"/> |
| 293 | + <manifest file="build/temp/@{modulename}-${version}.jar.manifest/MANIFEST.MF"> |
| 294 | + <attribute name="Implementation-Title" value="@{modulename}"/> |
| 295 | + <attribute name="Implementation-Vendor" value="hamcrest.org"/> |
| 296 | + <attribute name="Implementation-Version" value="${version}"/> |
| 297 | + <attribute name="Built-By" value="${user.name}"/> |
| 298 | + <attribute name="Built-Date" value="${build.timestamp}"/> |
| 299 | + </manifest> |
| 300 | + </sequential> |
| 301 | + </macrodef> |
| 302 | + |
264 | 303 | <macrodef name="java-to-jar" description="Compile Java source for a module and build a Jar"> |
265 | 304 | <attribute name="srcdir" description="Directory containg Java source"/> |
266 | 305 | <attribute name="modulename" description="Name of the module to jar"/> |
|
0 commit comments