-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.xml
439 lines (439 loc) · 15.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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
<?xml version="1.0"?>
<project default="build"
name="opensettlers">
<!-- Give user a chance to override without editing this file
(and without typing -D each time compiling) -->
<property file="build.properties" />
<property file="${user.home}/build.properties" />
<property environment="env" />
<property name="debug"
value="true" />
<property name="optimize"
value="true" />
<property name="deprecation"
value="false" />
<property name="name"
value="opensettlers" />
<property name="Name"
value="OpenSettlers" />
<!-- version under development, e.g. 1.1, 1.2-RC2, 2.0-SNAPSHOT -->
<property name="version"
value="1.1.09" />
<property name="versionnum"
value="1109" />
<property name="copyright"
value="2001-2004 Robb Thomas, portions 2007-2010 Jeremy D Monin, portions 2010 Nate Parsons" />
<property name="url"
value="http://github.com/nsp/OpenSettlers" />
<!-- **** See build.properties for client/server startup arguments **** -->
<property name="experiment.class"
value="experiment.Experiment" />
<property name="client.class"
value="soc.client.PlayerClient" />
<property name="server.class"
value="soc.server.SOCServer" />
<property name="main.class"
value="${client.class}" />
<!-- directory names -->
<!-- These must remain simple values, (relative to basedir) -->
<property name="src"
value="src" />
<property name="lib"
value="lib" />
<!-- 3rd party libs -->
<property name="docs.src"
value="xdocs" />
<property name="bin.src"
value="src/bin" />
<property name="java.src"
value="src/java" />
<property name="test.src"
value="src/test" />
<property name="web.src"
value="src/web" />
<property location="target"
name="target" />
<property location="${target}/classes"
name="classes" />
<property location="${target}/bin"
name="bin.target" />
<property location="${target}/lib"
name="lib.target" />
<property location="${target}/test-classes"
name="test.classes" />
<property location="${target}/test-reports"
name="test.reports" />
<property location="${target}/generated-xdocs"
name="docs.generated" />
<property location="${target}/docs"
name="docs.target" />
<property location="${docs.target}/api"
name="api.target" />
<property location="dist"
name="dist" />
<!-- version file basename relative to ${classes} and ${java.src} -->
<property name="version.info"
value="resources/version.info" />
<!-- packaging -->
<property name="client.jar"
value="${Name}.jar" />
<property name="server.jar"
value="${Name}Server.jar" />
<property name="test.jar"
value="${Name}Test.jar" />
<property name="dist.name"
value="${name}-${version}" />
<property name="dist.src.name"
value="${dist.name}-src" />
<property name="installer.jar"
value="${dist}/${dist.name}-installer.jar" />
<property name="dist.tgz"
value="${dist}/${dist.name}.tar.gz" />
<property name="dist.zip"
value="${dist}/${dist.name}.zip" />
<property name="dist.src.tgz"
value="${dist}/${dist.src.name}.tar.gz" />
<property name="dist.src.zip"
value="${dist}/${dist.src.name}.zip" />
<!-- files for the distributions -->
<fileset dir="."
id="readme.files">
<include name="COPYING.txt" />
<include name="README.txt" />
<include name="VERSIONS.txt" />
</fileset>
<!-- jar file packages -->
<patternset id="server.files">
<include name="soc/robot/" />
<include name="soc/server/" />
</patternset>
<patternset id="client.files">
<include name="uct/" />
<include name="resources/" />
<!-- for version file -->
<include name="soc/" />
<!-- everything... -->
<exclude name="soc/robot/" />
<exclude name="soc/client/" />
<!-- ...except these -->
<exclude name="soc/server/" />
</patternset>
<patternset id="client.files">
<include name="resources/" />
<!-- client may run local server -->
<include name="soc/" />
<!-- thus, everything -->
</patternset>
<!-- external libraries -->
<fileset dir="${lib}"
id="ext.libs"
includes="*.jar" />
<!-- class paths -->
<path id="classpath">
<pathelement location="${classes}" />
<fileset dir="${lib.target}"
includes="*.jar" />
</path>
<!-- Not used: For later.... -->
<path id="ext.cp">
<fileset refid="${ext.libs}" />
</path>
<!-- Not used: For later.... -->
<path id="installer.cp">
<path refid="classpath" />
<pathelement location="${izpack.home}/lib/compiler.jar" />
</path>
<!-- ************************************** -->
<!-- Initialization -->
<!-- ************************************** -->
<target name="init">
<tstamp />
</target>
<target depends="init"
name="init-libs">
<mkdir dir="${lib.target}" />
<!-- Later: when we use external libraries -->
<copy toDir="${lib.target}">
<fileset refid="ext.libs" />
</copy>
</target>
<target description="Copy resources to classes directory"
name="resources">
<copy toDir="${classes}">
<fileset dir="${java.src}"
includes="soc/**/*.gif" />
</copy>
</target>
<!-- ************************************** -->
<!-- Third party dependancy checks -->
<!-- ************************************** -->
<!-- Not used: For later.... -->
<target depends="init"
name="check-junit">
<available classname="junit.framework.TestCase"
classpathref="ext.cp"
property="junit.present" />
</target>
<!-- Not used: For later installer.... see http://izpack.org/ -->
<target depends="init"
name="check-izpack">
<available classname="com.izforge.izpack.ant.IzPackTask"
classpathref="installer.cp"
property="izpack.present" />
<fail unless="izpack.present">The IzPack program is not available. Download it from http://izpack.org/. Install it, and set the 'izpack.home' property in build.properties.</fail>
</target>
<!-- ************************************** -->
<!-- Compilation targets -->
<!-- ************************************** -->
<!-- Compile the java code from ${java.src} into ${classes} so
that tests can be done on compiled classes without creating
distribution tarballs -->
<target depends="init-libs,resources"
description="Compile class files into 'classes'."
name="compile">
<!-- version updates when info build.xml changes -->
<dependset>
<srcfilelist dir="${basedir}"
files="build.xml" />
<targetfilelist dir="${classes}"
files="${version.info}" />
</dependset>
<copy file="${java.src}/${version.info}.in"
tofile="${classes}/${version.info}">
<filterset>
<filter token="VERSION"
value="${version}" />
<filter token="VERSIONNUM"
value="${versionnum}" />
<filter token="COPYRIGHT"
value="${copyright}" />
</filterset>
</copy>
<javac classpathref="classpath"
debug="${debug}"
deprecation="${deprecation}"
destdir="${classes}"
optimize="${optimize}"
srcdir="${java.src}" />
</target>
<!-- Create two jars: client and server (which depends on client) -->
<target depends="compile"
description="Create project jar files."
name="build">
<jar basedir="${classes}"
destfile="${target}/${client.jar}">
<patternset refid="client.files" />
<manifest>
<attribute name="Main-Class"
value="${client.class}" />
</manifest>
</jar>
<jar basedir="${classes}"
destfile="${target}/${server.jar}">
<patternset refid="server.files" />
<manifest>
<attribute name="Main-Class"
value="${server.class}" />
<attribute name="Class-Path"
value="${client.jar}" />
</manifest>
</jar>
</target>
<!-- ************************************** -->
<!-- Testing targets -->
<!-- ************************************** -->
<target depends="compile-tests"
name="test">
<mkdir dir="${test.reports}" />
<junit dir="./"
failureproperty="test.failure"
fork="true"
haltonerror="no"
printSummary="yes">
<sysproperty key="basedir"
value="." />
<formatter type="xml" />
<formatter type="plain"
usefile="true" />
<classpath>
<fileset refid="ext.libs" />
<pathelement path="${test.classes}" />
<pathelement path="${classes}" />
</classpath>
<batchtest fork="yes"
todir="${test.reports}">
<fileset dir="${test.classes}">
<include name="**/Test*.class" />
<exclude name="**/TestAll.class" />
</fileset>
</batchtest>
</junit>
<junitreport>
<fileset dir="${test.reports}"
includes="TEST-*.xml" />
<report format="noframes" />
</junitreport>
<fail if="test.failure"
message="There were test failures." />
</target>
<target depends="compile"
name="compile-tests">
<mkdir dir="${test.classes}" />
<javac classpathref="classpath"
debug="${debug}"
deprecation="${deprecation}"
destdir="${test.classes}"
optimize="${optimize}"
srcdir="${test.src}" />
</target>
<!-- ************************************** -->
<!-- Distribution targets -->
<!-- ************************************** -->
<!-- Prevent build warning if IzPack not available -->
<macrodef description="create a taskdef, without warning when classname isn't available"
name="taskdef-unchecked">
<attribute name="taskname" />
<attribute name="classname" />
<attribute name="cp-ref" />
<sequential>
<taskdef classname="@{classname}"
classpathref="{@cp-ref}"
name="@{taskname}" />
</sequential>
</macrodef>
<!-- Create installer (requires IzPack) -->
<target depends="check-izpack,build,docs"
description="Create installer (Need IzPack: http://izpack.org/)"
if="izpack.present"
name="installer">
<fail>An installation file has not yet been created.</fail>
<mkdir dir="${dist}" />
<taskdef-unchecked classname="com.izforge.izpack.ant.IzPackTask"
classpathref="installer.cp"
taskname="izpack" />
<izpack basedir="."
input="${src}/installer/install.xml"
installerType="standard"
izPackDir="${izpack.home}"
output="${installer.jar}" />
</target>
<!-- Create distribution tarballs -->
<target depends="build,docs"
description="Build distribution tarballs and zips."
name="dist">
<property name="dist.tmp"
value="${dist}/${dist.name}" />
<delete dir="${dist.tmp}"
quiet="true" />
<copy preservelastmodified="true"
todir="${dist.tmp}">
<fileset refid="readme.files" />
<!-- program and libs -->
<fileset dir="${target}">
<include name="${client.jar}" />
<include name="${server.jar}" />
<include name="docs/" />
<include name="lib/" />
</fileset>
</copy>
<copy todir="${dist.tmp}/web">
<fileset dir="${web.src}" />
</copy>
<tar basedir="${dist}"
compression="gzip"
destfile="${dist.tgz}"
includes="${dist.name}/" />
<zip basedir="${dist}"
destfile="${dist.zip}"
includes="${dist.name}/" />
<!-- clean up -->
<delete dir="${dist.tmp}"
quiet="true" />
</target>
<!-- Create a source tarball suitable for building the project -->
<target depends="init"
description="Create a tarball of the source tree"
name="src">
<echo>This copies everything in your "src" directory, so be sure to run on a clean repository only!</echo>
<property name="dist.src.tmp"
value="${dist}/${dist.src.name}" />
<delete dir="${dist.src.tmp}"
quiet="true" />
<copy preservelastmodified="true"
todir="${dist.src.tmp}">
<fileset refid="readme.files" />
<fileset dir=".">
<include name="README.developer" />
<include name="build.xml" />
<include name="build.properties" />
<include name="${src}/" />
<include name="${lib}/*.jar" />
</fileset>
</copy>
<tar basedir="${dist}"
compression="gzip"
destfile="${dist.src.tgz}"
includes="${dist.src.name}/" />
<!-- clean up -->
<delete dir="${dist.src.tmp}"
quiet="true" />
</target>
<!-- clean the distribution directory -->
<target depends="init"
name="dist-clean">
<delete includeEmptyDirs="true"
quiet="true">
<fileset defaultExcludes="no"
dir="${dist}/" />
</delete>
</target>
<!-- ************************************** -->
<!-- Documentation targets -->
<!-- ************************************** -->
<!-- all documentation -->
<target depends="docs.users,javadoc"
name="docs" />
<target name="docs.users">
<!-- No munging, simply copy -->
<copy todir="${docs.target}">
<fileset dir="${src}/docs" />
</copy>
</target>
<!-- generate javadoc -->
<target depends="init-libs"
description="Creates javadoc in 'docs/api'"
name="javadoc">
<mkdir dir="${api.target}" />
<javadoc access="package"
additionalparam="-breakiterator"
author="true"
classpathref="classpath"
destdir="${api.target}"
doctitle="${Name}, v ${version}, API Specification"
overview="${java.src}/main-overview.html"
source="1.6"
sourcepath="${java.src}"
version="true"
windowtitle="${Name} v${version} API">
<packageset dir="${java.src}" />
<header>
<![CDATA[<b><a target="_blank" href="${url}">${Name} v${version} API</a></b><br><font size="-2">Built ${date}</font>]]>
</header>
</javadoc>
</target>
<!-- ************************************** -->
<!-- Other targets -->
<!-- ************************************** -->
<!-- Delete all artifacts of the project, i.e. ${target} & ${dist} -->
<target depends="init"
description="Cleans the project of all generated files"
name="clean">
<delete includeEmptyDirs="true"
quiet="true">
<fileset defaultExcludes="no"
dir="${target}/" />
<fileset defaultExcludes="no"
dir="${dist}/" />
</delete>
</target>
</project>