|
1 | 1 | <project name="hamcrest" default="all"> |
2 | 2 |
|
3 | | - <property name="version" value="SNAPSHOT"/> |
| 3 | + <property name="version" |
| 4 | + value="SNAPSHOT" |
| 5 | + description="Version number to use in build files"/> |
4 | 6 |
|
5 | | - <target name="all" depends="clean, build,test,package" |
6 | | - description="Performs clean build, test and package for distribution"/> |
| 7 | + <property name="haltonfailure" |
| 8 | + value="true" |
| 9 | + description="Whether to halt the build if the tests fail"/> |
7 | 10 |
|
8 | | - <target name="clean" description="Clean up all built files"> |
| 11 | + <target name="all" |
| 12 | + depends="clean, package" |
| 13 | + description="Performs clean build, runs tests and packages for distribution"/> |
| 14 | + |
| 15 | + <target name="clean" |
| 16 | + description="Clean up all built files"> |
9 | 17 | <delete dir="build"/> |
10 | 18 | </target> |
11 | 19 |
|
12 | | - <target name="build" description="Build project"> |
13 | | - <mkdir dir="build"/> |
14 | | - <java-to-jar srcdir="src/api" destjar="build/hamcrest-api-${version}.jar"/> |
15 | | - <java-to-jar srcdir="src/generator" destjar="build/hamcrest-generator-${version}.jar" |
| 20 | + <target name="api" |
| 21 | + description="Build API"> |
| 22 | + <java-to-jar srcdir="src/api" |
| 23 | + destjar="build/hamcrest-api-${version}.jar"/> |
| 24 | + </target> |
| 25 | + |
| 26 | + <target name="generator" |
| 27 | + depends="api" |
| 28 | + description="Build code generator tool"> |
| 29 | + <java-to-jar srcdir="src/generator" |
| 30 | + destjar="build/hamcrest-generator-${version}.jar" |
16 | 31 | classpath="build/hamcrest-api-${version}.jar"/> |
17 | | - <java-to-jar srcdir="src/library" destjar="build/hamcrest-library-${version}.jar" |
| 32 | + </target> |
| 33 | + |
| 34 | + <target name="library" |
| 35 | + depends="api" |
| 36 | + description="Build library of matchers"> |
| 37 | + <java-to-jar srcdir="src/library" |
| 38 | + destjar="build/hamcrest-library-${version}.jar" |
18 | 39 | classpath="build/hamcrest-api-${version}.jar"/> |
19 | | - <java-to-jar srcdir="src/integration" destjar="build/hamcrest-integration-${version}.jar" |
20 | | - classpath="build/hamcrest-api-${version}.jar;build/hamcrest-library-${version}.jar"/> |
21 | | - <java-to-jar srcdir="src/unit-test" destjar="build/hamcrest-unit-test-${version}.jar" |
22 | | - classpath="build/hamcrest-api-${version}.jar;build/hamcrest-library-${version}.jar;build/hamcrest-integration-${version}.jar;build/hamcrest-generator-${version}.jar"/> |
23 | | - <java-to-jar srcdir="src/examples" destjar="build/hamcrest-examples-${version}.jar" |
24 | | - classpath="build/hamcrest-api-${version}.jar;build/hamcrest-library-${version}.jar;build/hamcrest-integration-${version}.jar"/> |
25 | 40 | </target> |
26 | 41 |
|
27 | | - <target name="test" description="Test project"> |
28 | | - <!-- TODO --> |
| 42 | + <target name="integration" |
| 43 | + depends="api, library" |
| 44 | + description="Build integration with external tools"> |
| 45 | + <java-to-jar srcdir="src/integration" |
| 46 | + destjar="build/hamcrest-integration-${version}.jar" |
| 47 | + classpath=" |
| 48 | + build/hamcrest-api-${version}.jar; |
| 49 | + build/hamcrest-library-${version}.jar"/> |
| 50 | + </target> |
| 51 | + |
| 52 | + <target name="unit-test" |
| 53 | + depends="api, library, integration, generator" |
| 54 | + description="Build and run unit tests."> |
| 55 | + <java-to-jar srcdir="src/unit-test" |
| 56 | + destjar="build/hamcrest-unit-test-${version}.jar" |
| 57 | + classpath=" |
| 58 | + build/hamcrest-api-${version}.jar; |
| 59 | + build/hamcrest-library-${version}.jar; |
| 60 | + build/hamcrest-integration-${version}.jar; |
| 61 | + build/hamcrest-generator-${version}.jar"/> |
| 62 | + <junit printsummary="no" fork="no" haltonfailure="${haltonfailure}"> |
| 63 | + <formatter type="brief" usefile="no"/> |
| 64 | + <classpath> |
| 65 | + <fileset dir="lib/integration"> |
| 66 | + <include name="*.jar"/> |
| 67 | + </fileset> |
| 68 | + <pathelement path="build/hamcrest-api-${version}.jar"/> |
| 69 | + <pathelement path="build/hamcrest-library-${version}.jar"/> |
| 70 | + <pathelement path="build/hamcrest-integration-${version}.jar"/> |
| 71 | + <pathelement path="build/hamcrest-generator-${version}.jar"/> |
| 72 | + <pathelement path="build/hamcrest-unit-test-${version}.jar"/> |
| 73 | + </classpath> |
| 74 | + <batchtest> |
| 75 | + <fileset dir="src/unit-test"> |
| 76 | + <exclude name="**/Abstract*"/> |
| 77 | + </fileset> |
| 78 | + </batchtest> |
| 79 | + </junit> |
| 80 | + </target> |
| 81 | + |
| 82 | + <target name="examples" |
| 83 | + depends="api, library, integration" |
| 84 | + description="Build and run unit tests."> |
| 85 | + <java-to-jar srcdir="src/examples" |
| 86 | + destjar="build/hamcrest-examples-${version}.jar" |
| 87 | + classpath=" |
| 88 | + build/hamcrest-api-${version}.jar; |
| 89 | + build/hamcrest-library-${version}.jar; |
| 90 | + build/hamcrest-integration-${version}.jar"/> |
29 | 91 | </target> |
30 | 92 |
|
31 | | - <target name="package" depends="build" description="Package for distribution"> |
| 93 | + <target name="package" |
| 94 | + depends="api,generator,library,integration,unit-test,examples" |
| 95 | + description="Package for distribution"> |
32 | 96 | <zip zipfile="build/hamcrest-${version}.zip"> |
33 | 97 | <zipfileset dir="." prefix="hamcrest-${version}"> |
34 | 98 | <include name="src/**"/> |
|
44 | 108 | </zip> |
45 | 109 | </target> |
46 | 110 |
|
47 | | - <macrodef name="java-to-jar" description="Compile Java source and build a Jar"> |
| 111 | + <macrodef name="java-to-jar" |
| 112 | + description="Compile Java source and build a Jar"> |
48 | 113 | <attribute name="srcdir" description="Directory containg Java source"/> |
49 | 114 | <attribute name="destjar" description="Path to Jar"/> |
50 | 115 | <attribute name="classpath" description="Anything additional to add on the classpath" default=""/> |
51 | 116 | <sequential> |
52 | | - <echo message="* Java source (@{srcdir}) -> Jar (@{destjar})"/> |
53 | 117 | <mkdir dir="build/temp/@{destjar}.contents"/> |
54 | 118 | <javac srcdir="@{srcdir}" destdir="build/temp/@{destjar}.contents"> |
55 | 119 | <classpath> |
|
62 | 126 | <jar jarfile="@{destjar}"> |
63 | 127 | <fileset dir="build/temp/@{destjar}.contents"/> |
64 | 128 | <fileset dir="@{srcdir}"/> |
65 | | - <!-- Also put Java source in Jar for user's convenience. --> |
| 129 | + <!-- Put Java source in Jars for user's convenience. --> |
66 | 130 | </jar> |
67 | 131 | </sequential> |
68 | 132 | </macrodef> |
|
0 commit comments