-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
517 lines (410 loc) · 14.6 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
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
<project name="Jin" default="build">
<path id="compile.class.path">
<fileset dir="resources/libs">
<include name="*.jar"/>
</fileset>
<fileset dir="resources/libs/icc">
<include name="*.jar"/>
</fileset>
<fileset dir="resources/libs/fics">
<include name="*.jar"/>
</fileset>
</path>
<!-- Initializes stuff -->
<target name="init">
<tstamp>
<format property="date" pattern="dd.MM.yyyy" />
</tstamp>
<property name="build.dir" value="build" />
<property name="build.compiler" value="modern" />
<property name="build.target" value="${java.specification.version}" />
<property name="build.compress" value="no" />
<property name="build.manifest" value="manifest.txt" />
<property name="source.dir" value="src" />
<property name="classes.dir" value="classes" />
<property name="res.dir" value="resources" />
<property name="libs.dir" value="${build.dir}/libs" />
<property name="servers.dir" value="${build.dir}/servers" />
<property name="plugins.dir" value="${build.dir}/plugins" />
<property name="actions.dir" value="${build.dir}/actions" />
<property name="resources.dir" value="${build.dir}/resources" />
<property name="lnfs.dir" value="${build.dir}/lnfs" />
<property file="${source.dir}/free/jin/resources/app.props" prefix="jin" />
<property name="release.name" value="Jin" />
<property name="release.version" value="${date}" />
</target>
<!-- Removes things done by build -->
<target name="clean" depends="init">
<delete dir="${classes.dir}" />
<delete dir="${build.dir}" />
</target>
<!-- This is just to compile everything, without jarring
or placing things at appropriate locations -->
<target name="compile" depends="init">
<mkdir dir="${classes.dir}" />
<echo message="Compiler: ${build.compiler}" />
<javac srcdir="${source.dir}"
destdir="${classes.dir}"
includes="**"
classpathref="compile.class.path">
<compilerarg compiler="modern" line="-target ${build.target}" />
<compilerarg compiler="modern" line="-source 1.2" />
</javac>
</target>
<!-- Compiles a single piece set -->
<target name="compilePieceSet">
<mkdir dir="${classes.dir}/pieces/${piece-set-id}" />
<javac srcdir="${res.dir}/pieces/${piece-set-id}"
destdir="${classes.dir}/pieces/${piece-set-id}"
includes="**"
classpath="${classes.dir}">
<compilerarg compiler="modern" line="-target ${build.target}" />
<compilerarg compiler="modern" line="-source 1.2" />
</javac>
</target>
<!-- After compiling, this jars everything properly
and puts it where it belongs. -->
<target name="build" depends="init, compile">
<mkdir dir="${build.dir}" />
<mkdir dir="${libs.dir}" />
<mkdir dir="${servers.dir}" />
<mkdir dir="${plugins.dir}" />
<mkdir dir="${plugins.dir}/icc" />
<mkdir dir="${plugins.dir}/fics" />
<mkdir dir="${actions.dir}" />
<mkdir dir="${actions.dir}/icc" />
<mkdir dir="${actions.dir}/fics" />
<mkdir dir="${lnfs.dir}" />
<!-- Copy libs -->
<copy todir="${libs.dir}">
<fileset dir="resources/libs" />
</copy>
<!-- Copy Look and Feels -->
<copy todir="${lnfs.dir}">
<fileset dir="resources/lnfs" />
</copy>
<!-- Check whether Unix (but not Mac OS X) -->
<condition property="unix">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<!-- Check whether Windows -->
<condition property="windows">
<os family="windows" />
</condition>
<!-- Check whether Mac OS X -->
<condition property="macosx">
<and>
<os family="unix"/>
<os family="mac"/>
</and>
</condition>
<condition property="buildingForUnix">
<or>
<and>
<not>
<isset property="release.platform" />
</not>
<isset property="unix" />
</and>
<and>
<isset property="release.platform" />
<equals arg1="unix" arg2="${release.platform}" />
</and>
</or>
</condition>
<condition property="buildingForWindows">
<or>
<and>
<not>
<isset property="release.platform" />
</not>
<isset property="windows" />
</and>
<and>
<isset property="release.platform" />
<equals arg1="windows" arg2="${release.platform}" />
</and>
</or>
</condition>
<condition property="buildingForMacOSX">
<or>
<and>
<not>
<isset property="release.platform" />
</not>
<isset property="macosx" />
</and>
<and>
<isset property="release.platform" />
<equals arg1="macosx" arg2="${release.platform}" />
</and>
</or>
</condition>
<condition property="buildingApplet">
<or>
<isset property="applet" />
<and>
<isset property="release.platform" />
<equals arg1="applet" arg2="${release.platform}" />
</and>
</or>
</condition>
<!-- Copy Java resources -->
<copy todir="${classes.dir}">
<fileset dir="${source.dir}" excludes="**/*.java **/*.html **/localization*.properties" />
</copy>
<!-- Convert and copy localization files -->
<native2ascii src="${source.dir}"
includes="**/localization*.properties"
dest="${classes.dir}"
encoding="utf8"
/>
<!-- Call the tasks that do platform specific stuff -->
<antcall target="doUnixStuff" />
<antcall target="doWindowsStuff" />
<antcall target="doMacOSXStuff" />
<antcall target="doAppletStuff" />
<!-- Set application name and version -->
<propertyfile file="${classes.dir}/free/jin/resources/app.props">
<entry key="app.name" value="${release.name}" />
<entry key="app.version" value="${release.version}" />
</propertyfile>
<!-- Utility library: free.util.* and free.workarounds.* -->
<jar jarfile="${build.dir}/util.jar"
basedir="${classes.dir}"
includes="free/util/** free/workarounds/**"
compress="${build.compress}"
/>
<!-- Chess library: free.chess.* -->
<jar jarfile="${build.dir}/chess.jar"
basedir="${classes.dir}"
includes="free/chess/**"
compress="${build.compress}"
/>
<!-- Fix CRLF in manifest.txt (for windows) -->
<fixcrlf srcdir="${user.dir}" includes="${manifest}" />
<!-- Jin classes -->
<jar jarfile="${build.dir}/jin.jar"
basedir="${classes.dir}"
includes="free/jin/* free/jin/ui/** free/jin/event/** free/jin/legal/** free/jin/plugin/** free/jin/action/* free/jin/resources/**"
compress="${build.compress}"
manifest="${build.manifest}"
/>
<!-- Internet Chess Club support -->
<jar jarfile="${servers.dir}/chessclub.jar" compress="${build.compress}">
<fileset dir="${classes.dir}"
includes="free/jin/chessclub/** free/chessclub/**"
excludes="free/jin/chessclub/definition" />
<fileset dir="${classes.dir}/free/jin/chessclub"
includes="definition" />
</jar>
<!-- Free Internet Chess Server support -->
<jar jarfile="${servers.dir}/freechess.jar" compress="${build.compress}">
<fileset dir="${classes.dir}"
includes="free/jin/freechess/** free/freechess/**"
excludes="free/jin/freechess/definition" />
<fileset dir="${classes.dir}/free/jin/freechess"
includes="definition" />
</jar>
<!-- Console plugin library -->
<jar jarfile="${libs.dir}/console.jar" compress="${build.compress}">
<fileset dir="${classes.dir}"
includes="free/jin/console/**"
excludes="free/jin/console/icc/** free/jin/console/fics/**" />
</jar>
<!-- Console plugin for ICC -->
<antcall target="buildPlugin">
<param name="server.id" value="icc" />
<param name="plugin.id" value="console" />
</antcall>
<!-- Console plugin for FICS -->
<antcall target="buildPlugin">
<param name="server.id" value="fics" />
<param name="plugin.id" value="console" />
</antcall>
<!-- Sound plugin library -->
<jar jarfile="${libs.dir}/sound.jar" compress="${build.compress}">
<fileset dir="${classes.dir}"
includes="free/jin/sound/**"
excludes="free/jin/sound/icc/** free/jin/sound/fics/**" />
</jar>
<!-- Sound plugin for ICC -->
<antcall target="buildPlugin">
<param name="server.id" value="icc" />
<param name="plugin.id" value="sound" />
</antcall>
<!-- Sound plugin for FICS -->
<antcall target="buildPlugin">
<param name="server.id" value="fics" />
<param name="plugin.id" value="sound" />
</antcall>
<!-- Seek Graph plugin library -->
<jar jarfile="${libs.dir}/seek.jar" compress="${build.compress}">
<fileset dir="${classes.dir}"
includes="free/jin/seek/**"
excludes="free/jin/seek/icc/** free/jin/seek/fics/**" />
</jar>
<!-- Seek Graph plugin for ICC -->
<antcall target="buildPlugin">
<param name="server.id" value="icc" />
<param name="plugin.id" value="seek" />
</antcall>
<!-- Seek Graph plugin for FICS -->
<antcall target="buildPlugin">
<param name="server.id" value="fics" />
<param name="plugin.id" value="seek" />
</antcall>
<!-- Board plugin library -->
<jar jarfile="${libs.dir}/board.jar" compress="${build.compress}">
<fileset dir="${classes.dir}"
includes="free/jin/board/**"
excludes="free/jin/board/icc/** free/jin/board/fics/**" />
</jar>
<!-- Board plugin for ICC -->
<antcall target="buildPlugin">
<param name="server.id" value="icc" />
<param name="plugin.id" value="board" />
</antcall>
<!-- Board plugin for FICS -->
<antcall target="buildPlugin">
<param name="server.id" value="fics" />
<param name="plugin.id" value="board" />
</antcall>
<!-- Game Logger plugin -->
<antcall target="buildPlugin">
<param name="plugin.id" value="gamelogger" />
</antcall>
<!-- Scripter plugin library -->
<jar jarfile="${libs.dir}/scripter.jar" compress="${build.compress}">
<fileset dir="${classes.dir}"
includes="free/jin/scripter/**"
excludes="free/jin/scripter/icc/** free/jin/scripter/fics/**" />
</jar>
<!-- Scripter plugin for ICC -->
<antcall target="buildPlugin">
<param name="server.id" value="icc" />
<param name="plugin.id" value="scripter" />
</antcall>
<!-- Scripter plugin for FICS -->
<antcall target="buildPlugin">
<param name="server.id" value="fics" />
<param name="plugin.id" value="scripter" />
</antcall>
<!-- Actions plugin -->
<antcall target="buildPlugin">
<param name="plugin.id" value="actions" />
</antcall>
<!-- Get Server Help action -->
<antcall target="buildAction">
<param name="action.id" value="getserverhelp" />
</antcall>
<!-- Ask a Question action -->
<antcall target="buildAction">
<param name="action.id" value="askquestion" />
</antcall>
<!-- Seek action -->
<antcall target="buildAction">
<param name="action.id" value="seek" />
</antcall>
<!-- Resources -->
<mkdir dir="${resources.dir}" />
<!-- Copy over piece sets and board patterns -->
<copy todir="${resources.dir}">
<fileset dir="${res.dir}" includes="pieces/**/*.jar pieces/**/*.zip" />
<fileset dir="${res.dir}" includes="boards/**/.jar boards/**/*.zip" />
</copy>
</target>
<!-- Creates a single plugin
Parameters: server.id (optional, for server specific plugins}, plugin.id
-->
<target name="buildPlugin">
<property name="server.id" value="" />
<jar jarfile="${plugins.dir}/${server.id}/${plugin.id}.jar" compress="${build.compress}">
<fileset dir="${classes.dir}"
includes="free/jin/${plugin.id}/${server.id}/**"
excludes="free/jin/${plugin.id}/${server.id}/definition" />
<fileset dir="${classes.dir}/free/jin/${plugin.id}/${server.id}"
includes="definition" />
</jar>
</target>
<!-- Creates a single action.
Parameters: server.id (optional, for server specific actions), action.id
-->
<target name="buildAction">
<property name="server.id" value="" />
<jar jarfile="${actions.dir}/${server.id}/${action.id}.jar" compress="${build.compress}">
<fileset dir="${classes.dir}"
includes="free/jin/action/${action.id}/* free/jin/action/${action.id}/${server.id}/**"
excludes="free/jin/action/${action.id}/${server.id}/definition" />
<fileset dir="${classes.dir}/free/jin/action/${action.id}/${server.id}"
includes="definition" />
</jar>
</target>
<!-- If the property buildingForUnix is set, does things required for Unix -->
<target name="doUnixStuff" if="buildingForUnix">
<copy todir="${build.dir}">
<fileset dir="resources/os-specific/unix" includes="jin" />
</copy>
<chmod file="${build.dir}/jin" perm="a+x" />
<!-- Check whether x86 -->
<condition property="x86">
<or>
<equals arg1="x86" arg2="${os.arch}" />
<equals arg1="i386" arg2="${os.arch}" />
<equals arg1="i486" arg2="${os.arch}" />
<equals arg1="i586" arg2="${os.arch}" />
<equals arg1="i686" arg2="${os.arch}" />
</or>
</condition>
<antcall target="doUnixOnx86Stuff" />
</target>
<!-- If the property x86 is set, does things required for unix on x86 -->
<target name="doUnixOnx86Stuff" if="x86">
<!--
<copy todir="${build.dir}">
<fileset dir="resources/os-specific/unix/x86" />
</copy>
<chmod file="${build.dir}/sox" perm="a+x" />
<chmod file="${build.dir}/play" perm="a+x" />
-->
</target>
<!-- If the property buildingForWindows is set, does things required for Windows -->
<target name="doWindowsStuff" if="buildingForWindows">
<copy todir="${build.dir}">
<fileset dir="resources/os-specific/windows" />
</copy>
</target>
<!-- If the property buildingForMacOSX is set, does things required for Mac OS X -->
<target name="doMacOSXStuff" if="buildingForMacOSX">
<javac srcdir="resources/os-specific/macosx"
destdir="${classes.dir}"
includes="free/jin/MacOSXSpecific.java">
<compilerarg compiler="modern" line="-target ${build.target}" />
<compilerarg compiler="modern" line="-source 1.2" />
<classpath>
<pathelement location="resources/os-specific/macosx/ui.jar"/>
<pathelement path="${classes.dir}"/>
</classpath>
</javac>
</target>
<!-- If the property buildingApplet is set, does things required for Applets -->
<target name="doAppletStuff" if="buildingApplet">
<javac srcdir="resources/os-specific/applet"
destdir="${build.dir}"
includes="DetectJava.java">
<compilerarg compiler="modern" line="-target ${build.target}" />
<compilerarg compiler="modern" line="-source 1.2" />
</javac>
<copy todir="${build.dir}">
<fileset file="resources/os-specific/applet/**" excludes="**.java"/>
</copy>
<propertyfile file="${classes.dir}/free/jin/resources/app.props">
<entry key="lf.extra.count" value="0" />
</propertyfile>
</target>
</project>