1 |
<?xml version="1.0"?> |
2 |
<!-- |
3 |
$Id: build.xml,v 1.30 2007/05/28 16:10:00 karsten Exp $ |
4 |
|
5 |
This is a build file for use with the Jakarta Ant build tool, see |
6 |
http://jakarta.apache.org/ant/index.html |
7 |
|
8 |
To build, go to the directory where this file is located and run |
9 |
ant <target> |
10 |
with one of the following targets: |
11 |
|
12 |
clean removes temporary files and directories |
13 |
compile compiles the framework, extras, tutorial and tests |
14 |
javadoc creates the API documentation |
15 |
test compiles and runs the unit tests |
16 |
jar creates a library jar |
17 |
create-dist-dir creates a distribution tree: docs, sources, jar |
18 |
create-dist-zip creates a zipped distribution |
19 |
create-maven-bundle creates a Maven bundle |
20 |
create-all creates the distribution zip and Maven bundle |
21 |
|
22 |
To compile, you MUST set the property "build.boot.classpath", |
23 |
for example in your user build.properties file a line like: |
24 |
build.boot.classpath=C:/Java/Jdk1.5.0_11/jre/lib/rt.jar |
25 |
|
26 |
To run the unit tests you MUST set the junit.jar property, |
27 |
for example in your user build.properties file. |
28 |
|
29 |
--> |
30 |
|
31 |
<project default="create-all" basedir="." name="JGoodies Looks" > |
32 |
|
33 |
<!-- ***************************************************************** --> |
34 |
<!-- Give users a chance to override build properties. --> |
35 |
<!-- ***************************************************************** --> |
36 |
<property file="${user.home}/looks.build.properties" /> |
37 |
<property file="${user.home}/build.properties" /> |
38 |
<property file="${basedir}/build.properties" /> |
39 |
<property file="${basedir}/default.properties" /> |
40 |
|
41 |
|
42 |
<!-- ***************************************************************** --> |
43 |
<!-- P A T H S --> |
44 |
<!-- ***************************************************************** --> |
45 |
<path id="classpath.tests"> |
46 |
<pathelement location="${build.core.dir}" /> |
47 |
<pathelement location="${build.test.dir}" /> |
48 |
<pathelement location="${junit.jar}" /> |
49 |
</path> |
50 |
|
51 |
<path id="classpath.demo"> |
52 |
<pathelement location="${build.core.dir}" /> |
53 |
<pathelement location="${lib.forms.jar}" /> |
54 |
</path> |
55 |
|
56 |
|
57 |
|
58 |
<!-- ***************************************************************** --> |
59 |
<!-- C L E A N --> |
60 |
<!-- ***************************************************************** --> |
61 |
<target name="clean" |
62 |
description="Removes all temporary files and directories." > |
63 |
|
64 |
<delete dir="${build.dir}" /> |
65 |
<delete dir="${dist.dir}" /> |
66 |
</target> |
67 |
|
68 |
|
69 |
<!-- ***************************************************************** --> |
70 |
<!-- P R E P A R A T I O N --> |
71 |
<!-- ***************************************************************** --> |
72 |
<target name="prepare" |
73 |
description="Prepares the build and distribution targets." > |
74 |
|
75 |
<tstamp> |
76 |
<format property="DATE" pattern="yyyy-MM-dd hh:mm:ss" /> |
77 |
</tstamp> |
78 |
|
79 |
<mkdir dir="${build.core.dir}" /> |
80 |
<mkdir dir="${build.demo.dir}" /> |
81 |
|
82 |
<available |
83 |
property="junit.task.present" |
84 |
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" |
85 |
/> |
86 |
<available |
87 |
property="junit.jar.present" |
88 |
file="${junit.jar}" |
89 |
/> |
90 |
</target> |
91 |
|
92 |
|
93 |
<!-- ***************************************************************** --> |
94 |
<!-- C O M P I L A T I O N --> |
95 |
<!-- ***************************************************************** --> |
96 |
<target name="compile" |
97 |
depends="compile-core, compile-demo, compile-tests" |
98 |
description="Compiles the l&fs, demo, and tests." /> |
99 |
|
100 |
<!-- ***************************************************************** --> |
101 |
<target name="compile-core" depends="prepare" |
102 |
description="Compiles all library sources." > |
103 |
<javac |
104 |
srcdir ="${src.core.dir}" |
105 |
destdir ="${build.core.dir}" |
106 |
encoding ="${build.encoding}" |
107 |
executable ="${build.compile.executable}" |
108 |
fork ="${build.compile.fork}" |
109 |
debug ="${build.compile.debug}" |
110 |
depend ="${build.compile.depend}" |
111 |
deprecation ="${build.compile.deprecation}" |
112 |
nowarn ="${build.compile.nowarn}" |
113 |
optimize ="${build.compile.optimize}" |
114 |
source ="${build.compile.source}" |
115 |
target ="${build.compile.target}" |
116 |
verbose ="${build.compile.verbose}" |
117 |
bootclasspath="${build.boot.classpath}" /> |
118 |
|
119 |
<copy toDir="${build.core.dir}" > |
120 |
<fileset dir="${src.core.dir}" |
121 |
includes="com/jgoodies/looks/common/shadow.png, |
122 |
com/jgoodies/looks/plastic/icons/**/*, |
123 |
com/jgoodies/looks/windows/icons/**/*" /> |
124 |
</copy> |
125 |
</target> |
126 |
|
127 |
<!-- ***************************************************************** --> |
128 |
<target name="compile-demo" depends="compile-core" |
129 |
description="Compiles the demo sources." > |
130 |
<javac |
131 |
srcdir ="${src.demo.dir}" |
132 |
destdir ="${build.demo.dir}" |
133 |
encoding ="${build.encoding}" |
134 |
executable ="${build.compile.executable}" |
135 |
fork ="${build.compile.fork}" |
136 |
debug ="${build.compile.debug}" |
137 |
depend ="${build.compile.depend}" |
138 |
deprecation ="${build.compile.deprecation}" |
139 |
nowarn ="${build.compile.nowarn}" |
140 |
optimize ="${build.compile.optimize}" |
141 |
source ="${build.compile.source}" |
142 |
target ="${build.compile.target}" |
143 |
verbose ="${build.compile.verbose}" |
144 |
bootclasspath="${build.boot.classpath}" |
145 |
classpathref ="classpath.demo" /> |
146 |
</target> |
147 |
|
148 |
<!-- ***************************************************************** --> |
149 |
<target name="compile-tests" depends="compile-core" if="junit.jar.present" |
150 |
description="Compiles the unit tests." > |
151 |
<mkdir dir="${build.test.dir}"/> |
152 |
<javac |
153 |
srcdir ="${src.test.dir}" |
154 |
destdir ="${build.test.dir}" |
155 |
encoding ="${build.encoding}" |
156 |
executable ="${build.compile.executable}" |
157 |
fork ="${build.compile.fork}" |
158 |
debug ="${build.compile.debug}" |
159 |
depend ="${build.compile.depend}" |
160 |
deprecation ="${build.compile.deprecation}" |
161 |
nowarn ="${build.compile.nowarn}" |
162 |
optimize ="${build.compile.optimize}" |
163 |
source ="${build.compile.source}" |
164 |
target ="${build.compile.target}" |
165 |
verbose ="${build.compile.verbose}" |
166 |
bootclasspath="${build.boot.classpath}" |
167 |
classpathref ="classpath.tests" /> |
168 |
</target> |
169 |
|
170 |
|
171 |
|
172 |
<!-- ***************************************************************** --> |
173 |
<!-- J A V A D O C --> |
174 |
<!-- ***************************************************************** --> |
175 |
<target name="javadoc" depends="prepare" |
176 |
description="Creates the API documentation using JavaDoc." > |
177 |
<mkdir dir="${build.javadocs.dir}" /> |
178 |
<javadoc |
179 |
sourcepath="${src.core.dir}" |
180 |
packagenames="${javadoc.packages}" |
181 |
destdir="${build.javadocs.dir}" |
182 |
encoding="${build.encoding}" |
183 |
access="protected" |
184 |
author="true" |
185 |
version="true" |
186 |
use="true" |
187 |
link="${javadoc.link}" |
188 |
overview="${javadoc.overview}" |
189 |
windowtitle="${Name} ${spec.version} API" |
190 |
doctitle="${Name} ${spec.version} API" |
191 |
bottom="${copyright.message}" > |
192 |
</javadoc> |
193 |
</target> |
194 |
|
195 |
|
196 |
<!-- ***************************************************************** --> |
197 |
<!-- U N I T T E S T S --> |
198 |
<!-- ***************************************************************** --> |
199 |
<target name="test" depends="compile-tests" if="junit.task.present" |
200 |
description="Compiles and runs the unit tests." > |
201 |
<mkdir dir="${build.reports.dir}"/> |
202 |
<junit printsummary="yes" haltonfailure="no" > |
203 |
<classpath refid="classpath.tests"/> |
204 |
<formatter type="plain" /> |
205 |
<batchtest fork="yes" todir="${build.reports.dir}"> |
206 |
<fileset dir="${src.test.dir}" includes="**/*Test.java" /> |
207 |
</batchtest> |
208 |
</junit> |
209 |
</target> |
210 |
|
211 |
|
212 |
<!-- ***************************************************************** --> |
213 |
<!-- J A R --> |
214 |
<!-- ***************************************************************** --> |
215 |
<target name="jar" |
216 |
depends="jar-all, jar-plastic, jar-windows, jar-demo, jar-tiny, jar-fonttest" |
217 |
description="Creates library and example jars." > |
218 |
</target> |
219 |
|
220 |
<!-- ***************************************************************** --> |
221 |
<target name="manifest" depends="prepare" |
222 |
description="Creates the manifest file." > |
223 |
<manifest file="${build.manifest}"> |
224 |
<attribute name ="Built-By" |
225 |
value="${user.name}"/> |
226 |
<attribute name ="Specification-Title" |
227 |
value="${spec.title}" /> |
228 |
<attribute name ="Specification-Vendor" |
229 |
value="${spec.vendor}" /> |
230 |
<attribute name ="Specification-Version" |
231 |
value="${spec.version}" /> |
232 |
<attribute name ="Implementation-Title" |
233 |
value="${impl.title}" /> |
234 |
<attribute name ="Implementation-Vendor" |
235 |
value="${impl.vendor}" /> |
236 |
<attribute name ="Implementation-Version" |
237 |
value="${impl.version} ${DATE}" /> |
238 |
</manifest> |
239 |
</target> |
240 |
|
241 |
<!-- ***************************************************************** --> |
242 |
<target name="jar-all" depends="compile, manifest" |
243 |
description="Creates the library jar with all JGoodies l&fs." > |
244 |
|
245 |
<jar |
246 |
destfile="${build.all.jar}" |
247 |
manifest="${build.manifest}" > |
248 |
<fileset dir="${build.core.dir}" /> |
249 |
<zipfileset dir="${descriptors.dir}" |
250 |
includes="all.txt" |
251 |
fullpath="META-INF/services/javax.swing.LookAndFeel" /> |
252 |
</jar> |
253 |
</target> |
254 |
|
255 |
<!-- ***************************************************************** --> |
256 |
<target name="jar-plastic" depends="compile, manifest" |
257 |
description="Creates the library jar for the Plastic l&fs." > |
258 |
|
259 |
<jar |
260 |
destfile="${build.plastic.jar}" |
261 |
manifest="${build.manifest}" > |
262 |
<fileset dir="${build.core.dir}" |
263 |
excludes="com/jgoodies/looks/windows/**/*" /> |
264 |
<zipfileset dir="${descriptors.dir}" |
265 |
includes="plastic.txt" |
266 |
fullpath="META-INF/services/javax.swing.LookAndFeel" /> |
267 |
</jar> |
268 |
</target> |
269 |
|
270 |
<!-- ***************************************************************** --> |
271 |
<target name="jar-windows" depends="compile, manifest" |
272 |
description="Creates the library jar for the windows l&f." > |
273 |
<jar |
274 |
destfile="${build.windows.jar}" |
275 |
manifest="${build.manifest}" > |
276 |
<fileset dir="${build.core.dir}" |
277 |
excludes="com/jgoodies/looks/plastic/**/*" /> |
278 |
<zipfileset dir="${descriptors.dir}" |
279 |
includes="windows.txt" |
280 |
fullpath="META-INF/services/javax.swing.LookAndFeel" /> |
281 |
</jar> |
282 |
</target> |
283 |
|
284 |
<!-- ***************************************************************** --> |
285 |
<target name="jar-demo" depends="jar-plastic" |
286 |
description="Creates the demo jar." > |
287 |
<jar |
288 |
destfile="${build.demo.jar}" > |
289 |
<fileset dir="${build.demo.dir}" |
290 |
excludes="Tiny.*, FontTest.*" /> |
291 |
<fileset dir="${src.demo.dir}" |
292 |
includes="com/jgoodies/looks/demo/resources/**/*" /> |
293 |
<manifest> |
294 |
<attribute name ="Built-By" |
295 |
value="${user.name}"/> |
296 |
<attribute name ="Main-Class" |
297 |
value="com.jgoodies.looks.demo.DemoFrame"/> |
298 |
<attribute name ="Class-Path" |
299 |
value="../lib/${lib.forms.name} ../${dist.all.name}"/> |
300 |
</manifest> |
301 |
</jar> |
302 |
</target> |
303 |
|
304 |
<!-- ***************************************************************** --> |
305 |
<target name="jar-tiny" depends="jar-plastic" |
306 |
description="Creates the tiny jar." > |
307 |
<jar |
308 |
destfile="${build.tiny.jar}" > |
309 |
<fileset dir="${build.demo.dir}" |
310 |
includes="Tiny.*" /> |
311 |
<manifest> |
312 |
<attribute name ="Built-By" |
313 |
value="${user.name}"/> |
314 |
<attribute name ="Main-Class" |
315 |
value="Tiny"/> |
316 |
<attribute name ="Class-Path" |
317 |
value="../${dist.all.name}"/> |
318 |
</manifest> |
319 |
</jar> |
320 |
</target> |
321 |
|
322 |
|
323 |
<!-- ***************************************************************** --> |
324 |
<target name="jar-fonttest" depends="jar-plastic" |
325 |
description="Creates the fonttest jar." > |
326 |
<jar |
327 |
destfile="${build.fonttest.jar}" > |
328 |
<fileset dir="${build.demo.dir}" |
329 |
includes="FontTest.*" /> |
330 |
<manifest> |
331 |
<attribute name ="Built-By" |
332 |
value="${user.name}"/> |
333 |
<attribute name ="Main-Class" |
334 |
value="FontTest"/> |
335 |
<attribute name ="Class-Path" |
336 |
value="../${dist.all.name}"/> |
337 |
</manifest> |
338 |
</jar> |
339 |
</target> |
340 |
|
341 |
|
342 |
<!-- ***************************************************************** --> |
343 |
<!-- C R E A T E --> |
344 |
<!-- ***************************************************************** --> |
345 |
<target name="create-all" depends="create-dist-zip, create-maven-bundle" |
346 |
description="Creates the distribution zip and Maven bundle." > |
347 |
</target> |
348 |
|
349 |
|
350 |
<target name="create-dist-dir" depends="clean, compile, javadoc, test, jar" |
351 |
description="Creates the distribution directory tree." > |
352 |
|
353 |
<mkdir dir="${dist.dir}" /> |
354 |
|
355 |
<!-- Compile the documentation. --> |
356 |
<copy todir="${dist.docs.dir}" > |
357 |
<fileset dir="${docs.dir}" /> |
358 |
</copy> |
359 |
<move todir="${dist.docs.dir}" file="${build.javadocs.dir}" /> |
360 |
|
361 |
<!-- Copy the examples. --> |
362 |
<copy todir="${dist.demo.dir}" file="${build.demo.jar}" /> |
363 |
<copy todir="${dist.demo.dir}" file="${build.tiny.jar}" /> |
364 |
|
365 |
<!-- Copy the font test. --> |
366 |
<copy todir="${dist.demo.dir}" file="${build.fonttest.jar}" /> |
367 |
|
368 |
<!-- Copy the libraries. --> |
369 |
<copy todir="${dist.lib.dir}" > |
370 |
<fileset dir="${lib.dir}" |
371 |
includes="forms-*.jar" /> |
372 |
</copy> |
373 |
|
374 |
<!-- Copy the source directories. --> |
375 |
<copy todir="${dist.src.dir}" > |
376 |
<fileset dir="${src.dir}" /> |
377 |
</copy> |
378 |
|
379 |
<!-- Copy the distribution files. --> |
380 |
<copy todir="${dist.dir}" > |
381 |
<fileset dir="${top.dir}" |
382 |
includes="*.txt, *.html, *.xml, *.properties" |
383 |
excludes="todo.txt" /> |
384 |
</copy> |
385 |
|
386 |
<!-- Copy the jar files. --> |
387 |
<copy tofile="${dist.all.jar}" file="${build.all.jar}" /> |
388 |
<!-- |
389 |
<copy tofile="${dist.plastic.jar}" file="${build.plastic.jar}" /> |
390 |
<copy tofile="${dist.windows.jar}" file="${build.windows.jar}" /> |
391 |
// --> |
392 |
|
393 |
</target> |
394 |
|
395 |
<!-- ***************************************************************** --> |
396 |
<target name="create-dist-zip" depends="create-dist-dir" |
397 |
description="Packages the distribution as a zip file." > |
398 |
|
399 |
<zip |
400 |
destfile="${dist.zip}" |
401 |
basedir="${dist.root.dir}" |
402 |
includes="${dist.subdir}/**/*" /> |
403 |
</target> |
404 |
|
405 |
<!-- ***************************************************************** --> |
406 |
<target name="create-maven-bundle" depends="create-dist-dir" |
407 |
description="Creates a Maven bundle for the Ibiblio upload." > |
408 |
|
409 |
<!-- Copy the Maven pom template. --> |
410 |
<copy tofile="${dist.maven.pom}" file="${build.maven.pom.template}" /> |
411 |
<!-- Replace the version in the pom.xml. --> |
412 |
<replace file="${dist.maven.pom}" |
413 |
token="@impl.version" |
414 |
value="${impl.version}" /> |
415 |
|
416 |
<copy tofile="${dist.maven.bin.jar}" file="${build.all.jar}" /> |
417 |
<jar |
418 |
destfile="${dist.maven.src.jar}" |
419 |
basedir="${dist.src.dir}" /> |
420 |
<jar |
421 |
destfile="${dist.maven.bundle}" |
422 |
basedir="${build.maven.dir}" /> |
423 |
</target> |
424 |
|
425 |
|
426 |
</project> |