|
14 | 14 | <property name="build.classes.dir" value="${build.dir}/classes"/> |
15 | 15 | <property name="test.classes.dir" value="${build.dir}/test"/> |
16 | 16 | <property name="dist.dir" value="dist"/> |
17 | | - <property name="lib.dir" value="lib"/> |
18 | | - |
19 | | - <!-- Project classpath --> |
20 | | - <path id="build.classpath"> |
21 | | - <fileset dir="${lib.dir}"> |
22 | | - <include name="*.jar"/> |
23 | | - </fileset> |
24 | | - </path> |
25 | 17 |
|
26 | 18 | <!-- Targets --> |
27 | 19 |
|
28 | | - <target name="init"> |
29 | | - <available file="${lib.dir}" property="lib.present"/> |
30 | | - <mkdir dir="${build.classes.dir}"/> |
31 | | - <mkdir dir="${dist.dir}"/> |
32 | | - </target> |
33 | | - |
34 | | - <target name="resolve" unless="lib.present" |
35 | | - description="Retrieve dependencies with ivy."> |
36 | | - <ivy:retrieve type="jar,bundle"/> |
| 20 | + <target name="resolve" description="Retrieve dependencies with Ivy."> |
| 21 | + <ivy:resolve log="quiet"/> |
| 22 | + <ivy:cachepath conf="build" pathid="build.classpath"/> |
| 23 | + <ivy:cachepath conf="default" pathid="runtime.classpath"/> |
| 24 | + <ivy:cachefileset conf="default" setid="runtime.fileset"/> |
| 25 | + <ivy:cachepath conf="test" pathid="test.classpath"/> |
37 | 26 | </target> |
38 | 27 |
|
39 | | - <target name="compile" depends="init,resolve" |
40 | | - description="Compile all source files."> |
| 28 | + <target name="compile" depends="resolve" description="Compile all sources."> |
| 29 | + <mkdir dir="${build.classes.dir}"/> |
41 | 30 | <javac srcdir="${src.dir}" destdir="${build.classes.dir}" |
42 | | - optimize="on" debug="on" deprecation="on" |
43 | | - includeantruntime="false"> |
| 31 | + optimize="on" debug="on" deprecation="on" includeantruntime="no"> |
44 | 32 | <compilerarg value="-Xlint"/> |
45 | 33 | <classpath refid="build.classpath"/> |
46 | 34 | </javac> |
|
59 | 47 | </jar> |
60 | 48 | <jar destfile="${dist.dir}/${base.name}-all.jar" |
61 | 49 | basedir="${build.classes.dir}"> |
62 | | - <zipgroupfileset dir="${lib.dir}" includes="*.jar"/> |
| 50 | + <zipgroupfileset refid="runtime.fileset"/> |
63 | 51 | <manifest> |
64 | 52 | <attribute name="Main-Class" value="${main.class}"/> |
65 | 53 | </manifest> |
|
117 | 105 | </apply> |
118 | 106 | </target> |
119 | 107 |
|
120 | | - <target name="check"> |
121 | | - <taskdef resource="checkstyletask.properties"/> |
| 108 | + <target name="check" depends="resolve"> |
| 109 | + <taskdef resource="checkstyletask.properties" |
| 110 | + classpathref="build.classpath"/> |
122 | 111 | <checkstyle config="checkstyle.xml"> |
123 | | - <fileset dir="src" includes="**/*.java"/> |
| 112 | + <fileset dir="${src.dir}" includes="**/*.java"/> |
124 | 113 | </checkstyle> |
125 | 114 | </target> |
126 | 115 |
|
|
135 | 124 |
|
136 | 125 | <!-- Unit testing (JUnit) --> |
137 | 126 |
|
138 | | - <target name="test-compile" depends="compile" |
139 | | - description="Compile all of the unit tests."> |
| 127 | + <target name="test-compile" depends="compile"> |
140 | 128 | <mkdir dir="${test.classes.dir}"/> |
141 | 129 | <javac srcdir="${test.dir}" destdir="${test.classes.dir}" |
142 | 130 | optimize="on" debug="on" deprecation="on" |
143 | | - classpath="${build.classes.dir}" includeantruntime="yes"> |
| 131 | + classpath="${build.classes.dir}" includeantruntime="no"> |
144 | 132 | <compilerarg value="-Xlint"/> |
145 | 133 | <classpath refid="build.classpath"/> |
| 134 | + <classpath refid="test.classpath"/> |
146 | 135 | </javac> |
147 | 136 | <copy todir="${test.classes.dir}"> |
148 | 137 | <fileset dir="${test.dir}" excludes="**/*.java"/> |
149 | 138 | </copy> |
150 | 139 | </target> |
151 | 140 |
|
152 | | - <target name="test" depends="test-compile" |
153 | | - description="Run all of the unit tests."> |
154 | | - <junit> |
| 141 | + <target name="test" depends="test-compile" description="Run the unit tests."> |
| 142 | + <junit fork="yes"> |
155 | 143 | <classpath> |
156 | 144 | <pathelement path="${build.classes.dir}"/> |
157 | 145 | <pathelement path="${test.classes.dir}"/> |
158 | | - <path refid="build.classpath"/> |
| 146 | + <path refid="test.classpath"/> |
159 | 147 | </classpath> |
160 | 148 | <batchtest> |
161 | 149 | <formatter type="brief" usefile="false"/> |
|
0 commit comments