-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.xml
308 lines (259 loc) · 12.4 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
<?xml version="1.0"?>
<!--
$Id: build.xml,v 1.22 2010/01/11 22:47:40 karsten Exp $
This is a build file for use with the Jakarta Ant build tool, see
http://jakarta.apache.org/ant/index.html
To build, go to the directory where this file is located and run
ant <target>
with one of the following targets:
clean removes temporary files and directories
compile compiles the main and test sources
javadoc creates the API documentation
test compiles and runs the unit tests
jar creates a library jar
create-dist-dir creates a distribution tree: docs, sources, jar
create-dist-zip creates a zipped distribution
create-maven-bundle creates a Maven bundle
create-all creates the distribution zip and Maven bundle
To compile, you MUST set the property "build.boot.classpath",
for example in your user build.properties file a line like:
build.boot.classpath=C:/Java/Jdk1.5.0_11/jre/lib/rt.jar
To run the unit tests you MUST set the junit.jar property,
for example in your user build.properties file.
-->
<project default="deploy" basedir="." name="JGoodies Forms" >
<!-- ***************************************************************** -->
<!-- Give users a chance to override build properties. -->
<!-- ***************************************************************** -->
<property file="${user.home}/forms.build.properties" />
<property file="${user.home}/build.properties" />
<property file="${basedir}/build.properties" />
<property file="${basedir}/default.properties" />
<!-- ***************************************************************** -->
<!-- P A T H S -->
<!-- ***************************************************************** -->
<path id="classpath.main">
<pathelement location="${build.main.dir}" />
<pathelement location="${lib.common.jar}" />
</path>
<path id="classpath.tests">
<pathelement location="${build.main.dir}" />
<pathelement location="${build.test.dir}" />
<pathelement location="${lib.common.jar}" />
<pathelement location="${junit4.jar}" />
<pathelement location="${hamcrest.jar}" />
</path>
<path id="classpath.javadoc">
<pathelement location="${lib.common.jar}" />
</path>
<!-- ***************************************************************** -->
<!-- C L E A N -->
<!-- ***************************************************************** -->
<target name="clean"
description="Removes all temporary files and directories." >
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<!-- ***************************************************************** -->
<!-- P R E P A R A T I O N -->
<!-- ***************************************************************** -->
<target name="prepare"
description="Prepares the build and distribution targets." >
<tstamp>
<format property="DATE" pattern="yyyy-MM-dd hh:mm:ss" />
</tstamp>
<mkdir dir="${build.main.dir}" />
<available
property="junit.task.present"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
/>
<available
property="junit.jar.present"
file="${junit4.jar}"
/>
</target>
<!-- ***************************************************************** -->
<!-- C O M P I L A T I O N -->
<!-- ***************************************************************** -->
<target name="compile"
depends="compile-main, compile-tests"
description="Compiles the framework, extras and tests." />
<!-- ***************************************************************** -->
<target name="compile-main" depends="prepare"
description="Compiles the main sources." >
<javac
srcdir ="${src.main.dir}"
excludes = "com/jgoodies/forms/extras/**"
destdir ="${build.main.dir}"
encoding ="${build.encoding}"
executable ="${build.compile.executable}"
fork ="${build.compile.fork}"
debug ="${build.compile.debug}"
depend ="${build.compile.depend}"
deprecation ="${build.compile.deprecation}"
nowarn ="${build.compile.nowarn}"
optimize ="${build.compile.optimize}"
source ="${build.compile.source}"
target ="${build.compile.target}"
verbose ="${build.compile.verbose}"
bootclasspath="${build.boot.classpath}"
classpathref ="classpath.main"
includeAntRuntime="false" />
</target>
<!-- ***************************************************************** -->
<target name="compile-tests" depends="compile-main" if="junit.jar.present"
description="Compiles the unit tests." >
<mkdir dir="${build.test.dir}"/>
<javac
srcdir ="${src.test.dir}"
destdir ="${build.test.dir}"
encoding ="${build.encoding}"
executable ="${build.compile.executable}"
fork ="${build.compile.fork}"
debug ="${build.compile.debug}"
depend ="${build.compile.depend}"
deprecation ="${build.compile.deprecation}"
nowarn ="${build.compile.nowarn}"
optimize ="${build.compile.optimize}"
source ="${build.compile.source}"
target ="${build.compile.target}"
verbose ="${build.compile.verbose}"
bootclasspath="${build.boot.classpath}"
classpathref ="classpath.tests"
includeAntRuntime="false" />
</target>
<!-- ***************************************************************** -->
<!-- J A V A D O C -->
<!-- ***************************************************************** -->
<target name="javadoc" depends="prepare"
description="Creates the API documentation using JavaDoc." >
<mkdir dir="${build.javadocs.dir}" />
<javadoc
sourcepath="${src.main.dir}"
packagenames="${javadoc.packages}"
destdir="${build.javadocs.dir}"
encoding="${build.encoding}"
access="protected"
author="true"
version="true"
use="true"
link="${javadoc.link}"
overview="${javadoc.overview}"
windowtitle="${Name} ${spec.version} API"
doctitle="${Name} ${spec.version} API"
bottom="${copyright.message}"
classpathref ="classpath.javadoc" >
</javadoc>
</target>
<!-- ***************************************************************** -->
<!-- U N I T T E S T S -->
<!-- ***************************************************************** -->
<target name="test" depends="compile-tests" if="junit.task.present"
description="Compiles and runs the unit tests." >
<mkdir dir="${build.reports.dir}"/>
<junit printsummary="yes" haltonfailure="no" >
<classpath refid="classpath.tests"/>
<formatter type="plain" />
<batchtest fork="yes" todir="${build.reports.dir}">
<fileset dir="${src.test.dir}" includes="**/*Test.java" />
</batchtest>
</junit>
</target>
<!-- ***************************************************************** -->
<!-- J A R -->
<!-- ***************************************************************** -->
<target name="jar" depends="compile-main"
description="Creates the library jar." >
<jar
destfile="${build.main.jar}" >
<fileset dir="${build.main.dir}" />
<manifest>
<attribute name ="Built-By"
value="${user.name}"/>
<attribute name ="Specification-Title"
value="${spec.title}" />
<attribute name ="Specification-Vendor"
value="${spec.vendor}" />
<attribute name ="Specification-Version"
value="${spec.version}" />
<attribute name ="Implementation-Title"
value="${impl.title}" />
<attribute name ="Implementation-Vendor"
value="${impl.vendor}" />
<attribute name ="Implementation-Version"
value="${impl.version} ${DATE}" />
</manifest>
</jar>
</target>
<!-- ***************************************************************** -->
<!-- C R E A T E -->
<!-- ***************************************************************** -->
<target name="create-all" depends="create-dist-zip, create-maven-bundle"
description="Creates the distribution zip and Maven bundle." >
</target>
<target name="create-dist-dir" depends="clean, compile, javadoc, test, jar"
description="Creates the distribution directory tree." >
<mkdir dir="${dist.dir}" />
<!-- Compile the documentation. -->
<copy todir="${dist.docs.dir}" >
<fileset dir="${docs.dir}"
excludes="**/*.psd, **/*.sxw" />
</copy>
<move todir="${dist.docs.dir}" file="${build.javadocs.dir}" />
<!-- Compress the JavaDocs. -->
<jar
destfile="${dist.javadoc.jar}"
basedir="${dist.javadoc.dir}"
/>
<!-- Compress the main and test sources. -->
<jar
destfile="${dist.sources.jar}"
basedir="${src.main.dir}"
/>
<jar
destfile="${dist.tests.jar}"
basedir="${src.test.dir}"
/>
<!-- Copy the library jar file. -->
<copy tofile="${dist.main.jar}" file="${build.main.jar}" />
<!-- Copy the distribution files. -->
<copy todir="${dist.dir}" >
<fileset dir="${top.dir}"
includes="pom.xml, *.txt, *.html"
excludes="todo.txt" />
<filterset>
<filter token="impl.version" value="${impl.version}" />
<filter token="version.name" value="${version.name}" />
<filter token="copyright.message" value="${copyright.message}" />
<filter token="copyright.short" value="${copyright.short}" />
<filter token="common.version" value="${common.version}" />
</filterset>
</copy>
</target>
<!-- ***************************************************************** -->
<target name="create-dist-zip" depends="create-dist-dir"
description="Packages the distribution as a zip file." >
<zip
destfile="${dist.zip}"
basedir="${dist.root.dir}"
includes="${dist.subdir}/**/*" />
</target>
<!-- ***************************************************************** -->
<target name="create-maven-bundle" depends="create-dist-dir"
description="Creates a Maven bundle for the Ibiblio upload." >
<jar
destfile="${dist.maven.bundle}"
basedir="${dist.dir}"
excludes="docs, docs/**/*"
/>
</target>
<!-- ***************************************************************** -->
<target name="publish-locally" depends="create-dist-dir"
description="Copies the binary library to the local library repository." >
<copy todir="${lib.dir}" file="${dist.main.jar}" />
</target>
<!-- ***************************************************************** -->
<target name="deploy" depends="create-all, publish-locally"
description="Creates all distribution files and publishes locally." >
</target>
</project>