forked from arianne/stendhal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
1188 lines (1029 loc) · 45.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
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version='1.0'?>
<project name="stendhal" default="compile" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
<!--
Sets a property (by name and value), or set of properties (from file or resource) in the project. Properties are case sensitive.
Properties are immutable: whoever sets a property first freezes it for the rest of the build; they are most definitely not variables.
-->
<property file="build.ant-private.properties"/>
<property file="build.ant.properties"/>
<property name="build_tests" value="${buildroot}/build_tests"/>
<property name="build_tests_report" value="${buildroot}/build_test_report"/>
<property name="build_client" value="${buildroot}/build_client"/>
<property name="build_client_data" value="${buildroot}/build_client_data"/>
<property name="build_client_sound_data" value="${buildroot}/build_client_sound_data"/>
<property name="build_client_music_data" value="${buildroot}/build_client_music_data"/>
<property name="build_postman" value="${buildroot}/buildbot/"/>
<property name="build_server" value="${buildroot}/build_server"/>
<property name="build_server_maps" value="${buildroot}/build_server_maps"/>
<property name="build_server_script" value="${buildroot}/build_server_script"/>
<property name="build_server_xmlconf" value="${buildroot}/build_server_xmlconf"/>
<property name="build_stendhaltools" value="${buildroot}/build_stendhaltools"/>
<property name="build_stendhaltextclient" value="${buildroot}/build_stendhaltextclient"/>
<property name="build_client" value="${buildroot}/build_client"/>
<property name="client_data" value="stendhal-data-${version}.jar"/>
<property name="client_jarname" value="stendhal-${version}.jar"/>
<property name="client_sound_data" value="stendhal-sound-data-${version}.jar"/>
<property name="client_music_data" value="stendhal-music-data-${version}.jar"/>
<property name="client_starter_jarname" value="stendhal-starter-${version}.jar"/>
<property name="maps_jarname" value="stendhal-maps-${version}.jar"/>
<property name="server_jarname" value="stendhal-server-${version}.jar"/>
<property name="xmlconf_jarname" value="stendhal-xmlconf-${version}.jar"/>
<property name="config_dir" value="data/conf"/>
<property name="schema_location" value="${config_dir}"/>
<property name="cobertura.dir" value="${libdir}/cobertura" />
<import file="build-private.xml" optional="true" />
<condition property="exclude.signing" value="true">
<not>
<available file="keystore.ks"/>
</not>
</condition>
<condition property="exclude.jardiff" value="true">
<not>
<available file="${build-archive}/stendhal-${version.old}.zip"/>
</not>
</condition>
<tstamp>
<format property="timestamp" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<target name="init">
<mkdir dir="${lib}"/>
<!-- We update the version number -->
<replaceregexp file="${src}/games/stendhal/common/Debug.java"
match="String VERSION ?= ?".*";"
replace="String VERSION = "${version}";"
byline="true"/>
<replaceregexp file="${src}/games/stendhal/server/core/engine/GenerateINI.java"
match="out.println\("server_version=.*"\);"
replace="out.println("server_version=${version}");"
byline="true"/>
<replaceregexp file="runserver.bat"
match="STENDHAL_VERSION=.*"
replace="STENDHAL_VERSION=${version}"
byline="true"/>
<replaceregexp file="runserver.sh"
match="STENDHAL_VERSION ?= ?".*""
replace="STENDHAL_VERSION="${version}""
byline="true"/>
<!-- Update location of resources -->
<replaceregexp file="${src}/games/stendhal/client/update/game-default.properties"
match="GAME_NAME=.*"
replace="GAME_NAME=${game_name}"
byline="true"/>
<replaceregexp file="${src}/games/stendhal/client/update/game-default.properties"
match="DEFAULT_SERVER=.*"
replace="DEFAULT_SERVER=${default_server}"
byline="true"/>
<replaceregexp file="${src}/games/stendhal/client/update/game-default.properties"
match="UPDATE_SERVER_FOLDER=.*"
replace="UPDATE_SERVER_FOLDER=${updates_server}"
byline="true"/>
<replaceregexp file="${src}/games/stendhal/client/update/game-default.properties"
match="UPDATE_SERVER_FOLDER_FALLBACK=.*"
replace="UPDATE_SERVER_FOLDER_FALLBACK=${updates_server_fallback}"
byline="true"/>
<replaceregexp file="${src}/games/stendhal/client/update/game-default.properties"
match="UPDATE_VERSION_CHECK=.*"
replace="UPDATE_VERSION_CHECK=${version_server}"
byline="true"/>
<replaceregexp file="stendhal.jnlp"
match="-0\..*\.jar""
replace="-${version}.jar""
byline="true"/>
<!-- pre release version -->
<replaceregexp file="${src}/games/stendhal/common/Debug.java"
match="String PRE_RELEASE_VERSION ?= .*;"
replace="String PRE_RELEASE_VERSION = null;"
byline="true"/>
<antcall target="internalUpdatePrereleaseVersion" />
</target>
<target name="internalUpdatePrereleaseVersion" if="PRE_RELEASE">
<tstamp prefix="date">
<format property="iso" pattern="yyyy-MM-dd" />
</tstamp>
<replaceregexp file="${src}/games/stendhal/common/Debug.java"
match="String PRE_RELEASE_VERSION ?= .*;"
replace="String PRE_RELEASE_VERSION = "PRE_RELEASE ${date.iso}";"
byline="true"/>
</target>
<target name="clean">
<delete dir="${lib}" />
<delete dir="${build_client}" />
<delete dir="${buildroot}/build_client_data" />
<delete dir="${build}/build_client_music_data"/>
<delete dir="${build}/build_client_sound_data"/>
<delete dir="${build_server}" />
<delete dir="${build_server_maps}" />
<delete dir="${build_server_script}" />
<delete dir="${buildroot}/build_server_quests" />
<delete dir="${buildroot}/build_server_xmlconf" />
<delete dir="${build_tests}" />
<delete dir="${buildroot}/build_stendhaltools" />
<delete dir="${buildroot}/build_stendhaltextclient" />
<delete dir="${buildroot}/buildbot" />
<delete dir="${build_tests_report}" />
<delete dir="${build_cobertura}"/>
<delete dir="${build_cobertura_report}"/>
<delete file="cobertura.ser" />
<delete>
<fileset dir=".">
<include name="TEST-*.xml"/>
</fileset>
</delete>
</target>
<target name = "postman">
<mkdir dir="${buildroot}/buildbot"/>
<javac srcdir="${src}" destdir="${buildroot}/buildbot" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="1.8" target="1.8" deprecation="${javac.deprecation}" includeantruntime="false">
<include name="games/stendhal/bot/postman/*.java"/>
<include name="games/stendhal/bot/package-info.java"/>
<include name="games/stendhal/bot/shouter/*.java"/>
<include name="games/stendhal/bot/core/*.java"/>
<compilerarg value="-encoding"/>
<compilerarg value="utf-8"/>
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<pathelement path="${build_server}"/>
<pathelement path="${marauroa_jar}"/>
<pathelement path="${log4j_jar}"/>
<pathelement path="${junit_jar}"/>
<pathelement path="libs/pircbot.jar"/>
</classpath>
</javac>
<jar jarfile="${buildroot}/buildbot/postman.jar">
<fileset dir="${buildroot}/buildbot">
<include name="games/stendhal/bot/postman/*"/>
<include name="games/stendhal/bot/core/*"/>
<include name="games/stendhal/bot/shouter/*"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="games.stendhal.bot.postman.PostmanMain"/>
</manifest>
</jar>
<!-- ende build bot -->
</target>
<target name="server_build" depends="init, checkxml" description="Build JAR file for Stendhal server">
<mkdir dir="${build_server}"/>
<copy todir="${build_server}/data/conf" file="data/conf/stendhalcreateaccount.properties"/>
<copy todir="${build_server}/games/stendhal/server" file="${src}/games/stendhal/server/stendhal_init.sql"/>
<copy todir="${build_server}/games/stendhal/common">
<fileset dir="${src}/games/stendhal/common">
<include name="**/*.txt"/>
</fileset>
</copy>
<javac srcdir="${src}" destdir="${build_server}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="1.8" target="1.8" deprecation="${javac.deprecation}" includeantruntime="false">
<include name="games/stendhal/common/*.java"/>
<include name="games/stendhal/common/**/*.java"/>
<include name="games/stendhal/server/*.java"/>
<include name="games/stendhal/server/**/*.java"/>
<exclude name="games/stendhal/server/maps/**"/>
<exclude name="games/stendhal/server/script/**"/>
<include name="games/stendhal/tools/tiled/LayerDefinition.java"/>
<include name="games/stendhal/tools/tiled/ServerTMXLoader.java"/>
<include name="games/stendhal/tools/tiled/StendhalMapStructure.java"/>
<include name="games/stendhal/tools/tiled/TileSetDefinition.java"/>
<include name="games/stendhal/tools/test/LineAnalyser.java"/>
<compilerarg value="-encoding"/>
<compilerarg value="utf-8"/>
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<pathelement path="${marauroa_jar}"/>
<pathelement path="${log4j_jar}"/>
<pathelement path="${junit_jar}"/>
<pathelement path="${groovy_jar}"/>
<pathelement path="${simple_jar}"/>
<pathelement path="${guava_jar}"/>
</classpath>
</javac>
<jar jarfile="${lib}/${server_jarname}" basedir="${build_server}">
<manifest>
<attribute name="Main-Class" value="games.stendhal.server.StendhalServer"/>
<attribute name="Class-path" value=". marauroa.jar ${maps_jarname} ${xmlconf_jarname} ${maps_jarname} guava.jar log4j.jar groovy.jar ${mysqldriver_jarname} mysql.jar h2.jar"/>
</manifest>
</jar>
<chmod file="${lib}/${server_jarname}" perm="+x"/>
<mkdir dir="${build_server_maps}"/>
<javac srcdir="${src}" destdir="${build_server_maps}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="1.8" target="1.8" deprecation="${javac.deprecation}" includeantruntime="false">
<include name="games/stendhal/server/maps/*.java"/>
<exclude name="games/stendhal/server/maps/ZoneConfigurator.java"/>
<include name="games/stendhal/server/maps/**/*.java"/>
<compilerarg value="-encoding"/>
<compilerarg value="utf-8"/>
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<pathelement path="${build_server}"/>
<pathelement path="${marauroa_jar}"/>
<pathelement path="${log4j_jar}"/>
<pathelement path="${junit_jar}"/>
<pathelement path="${guava_jar}"/>
</classpath>
</javac>
<copy todir="${build_server_maps}/data/maps">
<fileset dir="${tiled}">
<include name="**/*.tmx"/>
</fileset>
</copy>
<jar jarfile="${lib}/${maps_jarname}" basedir="${build_server_maps}"/>
<mkdir dir="${build_server_xmlconf}"/>
<copy todir="${build_server_xmlconf}/data/conf">
<fileset dir="data/conf">
<include name="creatures.xml"/>
<include name="creatures/*.xml"/>
<include name="items.xml"/>
<include name="items/*.xml"/>
<include name="zones.xml"/>
<include name="zones/*.xml"/>
<include name="riddles-example.xml"/>
<include name="spells.xml" />
<include name="spells/*.xml" />
</fileset>
</copy>
<copy todir="${build_server_xmlconf}/data/languages">
<fileset dir="data/languages" />
</copy>
<jar jarfile="${lib}/${xmlconf_jarname}" basedir="${build_server_xmlconf}"/>
<mkdir dir="${build_server_script}"/>
<javac srcdir="${src}" destdir="${build_server_script}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="1.8" target="1.8" deprecation="${javac.deprecation}" includeantruntime="false">
<include name="games/stendhal/server/script/*.java"/>
<compilerarg value="-encoding"/>
<compilerarg value="utf-8"/>
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<pathelement path="${marauroa_jar}"/>
<pathelement path="${log4j_jar}"/>
<pathelement path="${junit_jar}"/>
<pathelement path="${groovy_jar}"/>
<pathelement path="${simple_jar}"/>
<pathelement path="${guava_jar}"/>
<pathelement path="${lib}/${server_jarname}"/>
<pathelement path="${lib}/${maps_jarname}"/>
</classpath>
</javac>
</target>
<target name="jar" depends="client_build, server_build" description="Builds Client and Server">
<echo>Built client and server for NetBeans.</echo>
</target>
<!-- Runs the client -->
<target name="client_run" depends="client_build" description="Runs the client">
<mkdir dir="run_clnt"/>
<mkdir dir="run_clnt/lib"/>
<copy todir="run_clnt">
<fileset file="build/lib/${client_jarname}"/>
</copy>
<copy todir="run_clnt/lib">
<fileset file="build/lib/${client_data}"/>
<fileset file="build/lib/${client_sound_data}"/>
<fileset file="build/lib/${client_music_data}"/>
<fileset file="build/lib/${client_starter_jarname}"/>
<fileset file="${marauroa_jar}"/>
<fileset file="${log4j_jar}"/>
<fileset file="${jorbis_jar}"/>
</copy>
<chmod file="run_clnt/lib/${client_jarname}" perm="+x"/>
<java classname="games.stendhal.client.stendhal"
fork="true"
failonerror="true"
maxmemory="128m">
<classpath>
<pathelement location="run_clnt/*"/>
<pathelement location="run_clnt/lib/*"/>
</classpath>
</java>
<!-- we've run the program, so delete the jars -->
<delete dir="run_clnt"/>
</target>
<!-- Netbeans won't let you choose ant options, so this does it for us-->
<target name="run" depends="client_run" description="Runs client for netbeans trick"/>
<!-- Runs the server -->
<target name="server_run" depends="server_build, compilejs" description="Runs the server">
<mkdir dir="run_srvr"/>
<copy todir="run_srvr">
<fileset file="build/lib/${server_jarname}"/>
<fileset file="build/lib/${xmlconf_jarname}"/>
<fileset file="build/lib/${maps_jarname}"/>
<fileset file="libs/marauroa.jar"/>
<fileset file="libs/groovy.jar"/>
<fileset file="libs/guava.jar"/>
<fileset file="libs/log4j.jar"/>
<fileset file="libs/${mysqldriver_jarname}"/>
</copy>
<chmod file="run_srvr/${server_jarname}" perm="+x"/>
<exec dir="." executable="java">
<arg line="-Xmx256m -cp run_srvr -jar run_srvr/${server_jarname} -c server.ini -l"/>
</exec>
<!-- we've run the program, so delete the jars -->
<delete dir="run_srvr"/>
</target>
<target name="client_build" depends="init" description="Build JAR file for Stendhal client">
<mkdir dir="${build_client}"/>
<copy todir="${build_client}/games/stendhal/client">
<fileset dir="${src}/games/stendhal/client">
<include name="**/*.txt"/>
</fileset>
</copy>
<copy todir="${build_client}/games/stendhal/common">
<fileset dir="${src}/games/stendhal/common">
<include name="**/*.txt"/>
</fileset>
</copy>
<echo file="${src}/games/stendhal/client/StendhalBuild.java">
package games.stendhal.client;
public class StendhalBuild {
private static final String BUILD_NUMBER = "${timestamp}";
public static String getBuildNumber() {return BUILD_NUMBER;}
}
</echo>
<javac srcdir="${src}" destdir="${build_client}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="1.8" target="1.8" deprecation="${javac.deprecation}" includeantruntime="false">
<include name="games/stendhal/client/*.java"/>
<include name="games/stendhal/client/**/*.java"/>
<exclude name="games/stendhal/client/update/Starter.java"/>
<include name="games/stendhal/common/*.java"/>
<include name="games/stendhal/common/**/*.java"/>
<compilerarg value="-encoding"/>
<compilerarg value="utf-8"/>
<compilerarg value="-Xlint:unchecked"/>
<!-- Only include the libraries which are distributed to detect
unwanted dependencies (i. e. .jar which are not part of the
client-distribution) during compile time -->
<classpath>
<pathelement path="${marauroa_jar}"/>
<pathelement path="${log4j_jar}"/>
<pathelement path="${jorbis_jar}"/>
</classpath>
</javac>
<delete file="${src}/games/stendhal/client/StendhalBuild.java" quiet="true" failonerror="false" />
<!-- compile Starter.java for Java 1.4. So we will be able to
display a dialogbox if running on an old Java Version -->
<javac srcdir="${src}" destdir="${build_client}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="1.4" target="1.4" deprecation="${javac.deprecation}" includeantruntime="false">
<include name="games/stendhal/client/update/Starter.java"/>
<compilerarg value="-encoding"/>
<compilerarg value="utf-8"/>
</javac>
<copy todir="${build_client}/games/stendhal/client/update">
<fileset file="${src}/games/stendhal/client/update/**">
<exclude name="*.java" />
</fileset>
</copy>
<jar jarfile="${lib}/${client_starter_jarname}">
<fileset dir="${build_client}">
<include name="games/stendhal/client/update/*"/>
</fileset>
<manifest>
<attribute name="Application-Name" value="Stendhal" />
<attribute name="Application-Library-Allowable-Codebase" value="https://arianne-project.org http://arianne.sf.net http://arianne.sourceforge.net https://arianne.sf.net https://arianne.sourceforge.net https://stendhalgame.org *" />
<attribute name="Main-Class" value="games.stendhal.client.update.Starter"/>
<attribute name="Class-path" value="."/>
<attribute name="Permissions" value="all-permissions"/>
<attribute name="Codebase" value="*"/>
<attribute name="Trusted-Library" value="true" />
</manifest>
</jar>
<antcall target="signjar" />
<chmod file="${lib}/${client_starter_jarname}" perm="+x"/>
<jar jarfile="${lib}/${client_jarname}">
<fileset dir="${build_client}">
<exclude name="games/stendhal/client/update/**"/>
</fileset>
</jar>
<mkdir dir="${build_client_data}"/>
<copy todir="${build_client_data}/data/sprites">
<fileset dir="${sprites}">
<exclude name="**/*.bz2" />
<exclude name="**/*.gz" />
<exclude name="**/*.psd" />
<exclude name="**/*.xcf" />
<exclude name="**/*.xcf.*" />
</fileset>
</copy>
<copy todir="${build_client_data}/data/tileset">
<fileset dir="${tiled}/tileset">
<exclude name="**/*.bz2" />
<exclude name="**/*.gz" />
<exclude name="**/*.psd" />
<exclude name="**/*.xcf" />
<exclude name="**/*.xcf.*" />
</fileset>
</copy>
<copy todir="${build_client_data}/data/gui">
<fileset dir="${data}">
<exclude name="paneldrock009.jpg"/>
<exclude name="panelmetal003.gif"/>
<exclude name="panelrock016.jpg"/>
<exclude name="panelwood006.jpg"/>
<exclude name="panelwood032.gif"/>
<exclude name="panelwood003.jpg"/>
<exclude name="**/*.bz2" />
<exclude name="**/*.gz" />
<exclude name="**/*.psd" />
<exclude name="**/*.xcf" />
<exclude name="**/*.xcf.*" />
</fileset>
</copy>
<copy todir="${build_client_data}/data/conf" file="data/conf/log4j.properties"/>
<jar jarfile="${lib}/${client_data}" basedir="${build_client_data}"/>
<mkdir dir="${build_client_sound_data}"/>
<copy todir="${build_client_sound_data}/data/sounds">
<fileset dir="data/sounds">
<exclude name="**/*.xz" />
<exclude name="**/*.gz" />
<exclude name="**/*.bz2" />
<!-- <include name="**.*"/> -->
</fileset>
</copy>
<jar jarfile="${lib}/${client_sound_data}" basedir="${build_client_sound_data}"/>
<mkdir dir="${build_client_music_data}"/>
<copy todir="${build_client_music_data}/data/music">
<fileset dir="data/music">
<include name="**.ogg"/>
</fileset>
</copy>
<jar jarfile="${lib}/${client_music_data}" basedir="${build_client_music_data}"/>
</target>
<target name="signjar" unless="exclude.signing">
<signjar
alias="${keystore.alias}"
keystore="keystore.ks"
storepass="${keystore.password}"
tsaurl="http://tsa.starfieldtech.com"
jar="${lib}/${client_starter_jarname}" />
</target>
<target name="docs" description="Build javadocs for fixedStendhal">
<javadoc packagenames="games.stendhal.*"
defaultexcludes="yes"
destdir="${docs}"
author="true"
encoding="UTF-8"
version="true"
use="true"
windowtitle="Stendhal API Documentation Version: ${version}"
sourcepath="${src}">
<classpath>
<pathelement path="${guava_jar}"/>
<pathelement path="${groovy_jar}"/>
<pathelement path="${marauroa_jar}"/>
<pathelement path="${jorbis_jar}"/>
<pathelement path="${junit_jar}"/>
<pathelement path="${log4j_jar}"/>
<pathelement path="${simple_jar}"/>
<pathelement path="${swinglayout_jar}"/>
<pathelement path="${tiled_jar}"/>
<pathelement path="libs/ant.jar"/>
<pathelement path="libs/jcurses.jar"/>
<pathelement path="libs/pircbot.jar"/>
</classpath>
</javadoc>
</target>
<target name="compile" depends="server_build, client_build, server_build" description="Generates JAR files for both client and server"/>
<target name="dist" depends="clean, dist_binary, dist_source, signupdates" description="Creates all the packages needed for a Stendhal release"/>
<target name="dist_binary" depends="clean, dist_server_binary, dist_client_binary, dist_client_starter"/>
<target name="dist_server_binary" depends="server_build, compilejs">
<mkdir dir="${buildroot}/stendhal-server-${version}"/>
<copy todir="${buildroot}/stendhal-server-${version}/data/script">
<fileset dir="${buildroot}/build_server_script">
<include name="games/stendhal/server/script/**.*"/>
</fileset>
</copy>
<copy todir="${buildroot}/stendhal-server-${version}" file="${groovy_jar}"/>
<copy todir="${buildroot}/stendhal-server-${version}" file="${simple_jar}"/>
<copy todir="${buildroot}/stendhal-server-${version}" file="${guava_jar}"/>
<copy todir="${buildroot}/stendhal-server-${version}" file="${log4j_jar}"/>
<copy todir="${buildroot}/stendhal-server-${version}" file="${h2_jar}"/>
<copy todir="${buildroot}/stendhal-server-${version}" file="${lib}/${server_jarname}"/>
<copy todir="${buildroot}/stendhal-server-${version}" file="${lib}/${maps_jarname}"/>
<copy todir="${buildroot}/stendhal-server-${version}" file="${lib}/${xmlconf_jarname}"/>
<copy todir="${buildroot}/stendhal-server-${version}" file="${marauroa_jar}"/>
<copy todir="${buildroot}/stendhal-server-${version}" file="runserver.sh"/>
<copy todir="${buildroot}/stendhal-server-${version}" file="runserver.bat"/>
<copy todir="${buildroot}/stendhal-server-${version}/lib">
<fileset dir="libs">
<include name="*.txt"/>
<include name="*.html"/>
</fileset>
</copy>
<copy todir="${buildroot}/stendhal-server-${version}/doc">
<fileset dir="doc"/>
<fileset dir="." includes="LICENSE.txt"/>
</copy>
<copy todir="${buildroot}/stendhal-server-${version}/data/conf" file="data/conf/admins.txt"/>
<!--
<mkdir dir="${buildroot}/stendhal-server-${version}/js" />
<copy todir="${buildroot}/stendhal-server-${version}/js">
<fileset dir="srcjs" />
</copy>
-->
<copy todir="${buildroot}/stendhal-server-${version}" file="README.md"/>
<mkdir dir="${buildroot}/stendhal-server-${version}/log" />
<touch file="${buildroot}/stendhal-server-${version}/log/empty" />
<zip destfile="${buildroot}/stendhal-server-${version}.zip">
<zipfileset dir="${buildroot}/stendhal-server-${version}" excludes="${server_jarname}"/>
<zipfileset dir="${buildroot}/stendhal-server-${version}" includes="${server_jarname}" filemode="755"/>
</zip>
<delete dir="${buildroot}/stendhal-server-${version}"/>
</target>
<target name="dist_client_binary" depends="client_build">
<mkdir dir="${buildroot}/stendhal-${version}"/>
<mkdir dir="${buildroot}/stendhal-${version}/lib"/>
<mkdir dir="${buildroot}/stendhal-${version}/log"/>
<copy tofile="${buildroot}/stendhal-${version}/stendhal-starter.jar" file="${lib}/${client_starter_jarname}"/>
<copy tofile="${buildroot}/stendhal-${version}/lib/stendhal.jar" file="${lib}/${client_jarname}"/>
<copy tofile="${buildroot}/stendhal-${version}/lib/log4j.jar" file="${log4j_jar}"/>
<copy tofile="${buildroot}/stendhal-${version}/lib/marauroa.jar" file="${marauroa_jar}"/>
<copy tofile="${buildroot}/stendhal-${version}/lib/jorbis.jar" file="${jorbis_jar}"/>
<copy tofile="${buildroot}/stendhal-${version}/lib/stendhal-sound-data.jar" file="${lib}/${client_sound_data}"/>
<copy tofile="${buildroot}/stendhal-${version}/lib/stendhal-music-data.jar" file="${lib}/${client_music_data}"/>
<copy tofile="${buildroot}/stendhal-${version}/lib/stendhal-data.jar" file="${lib}/${client_data}"/>
<copy todir="${buildroot}/stendhal-${version}/lib">
<fileset dir="libs">
<include name="*.txt"/>
<include name="*.html"/>
</fileset>
</copy>
<copy todir="${buildroot}/stendhal-${version}/doc">
<fileset dir="doc"/>
<fileset dir="." includes="LICENSE.txt"/>
</copy>
<touch file="${buildroot}/stendhal-${version}/log/stendhal.txt" />
<copy todir="${buildroot}/stendhal-${version}" file="README.md"/>
<copy todir="${buildroot}/stendhal-${version}" file="icon.ico"/>
<zip destfile="${buildroot}/stendhal-${version}.zip">
<zipfileset dir="${buildroot}/stendhal-${version}" excludes="stendhal-starter.jar"/>
<zipfileset dir="${buildroot}/stendhal-${version}" includes="stendhal-starter.jar" filemode="755"/>
<zipfileset dir="buildtools/launch4j" includes="stendhal-starter.exe" filemode="755"/>
</zip>
<delete dir="${buildroot}/stendhal-${version}"/>
</target>
<target name="dist_client_starter" depends="client_build">
<mkdir dir="${buildroot}/stendhal-${version}"/>
<copy todir="${buildroot}/stendhal-${version}" file="${lib}/${client_starter_jarname}"/>
<copy todir="${buildroot}/stendhal-${version}/lib">
<fileset dir="libs">
<include name="*.txt"/>
<include name="*.html"/>
</fileset>
</copy>
<copy todir="${buildroot}/stendhal-${version}/doc">
<fileset dir="doc"/>
<fileset dir="." includes="LICENSE.txt"/>
</copy>
<copy todir="${buildroot}/stendhal-${version}" file="README.md"/>
<zip destfile="${buildroot}/stendhal-starter-${version}.zip">
<zipfileset dir="${buildroot}/stendhal-${version}" excludes="${client_starter_jarname}"/>
<zipfileset dir="${buildroot}/stendhal-${version}" includes="${client_starter_jarname}" filemode="755"/>
</zip>
<delete dir="${buildroot}/stendhal-${version}"/>
</target>
<target name="dist_source">
<mkdir dir="${buildroot}/stendhal-${version}-src"/>
<copy todir="${buildroot}/stendhal-${version}-src/src">
<fileset dir="src"/>
</copy>
<mkdir dir="${buildroot}/stendhal-${version}-src/libs"/>
<copy todir="${buildroot}/stendhal-${version}-src/libs">
<fileset dir="libs"/>
</copy>
<copy todir="${buildroot}/stendhal-${version}-src/tests">
<fileset dir="tests"/>
</copy>
<copy todir="${buildroot}/stendhal-${version}-src/data">
<fileset dir="data">
</fileset>
</copy>
<copy todir="${buildroot}/stendhal-${version}-src/tiled">
<fileset dir="${tiled}">
<exclude name="world/**" />
</fileset>
</copy>
<copy todir="${buildroot}/stendhal-${version}-src" file="build.xml"/>
<copy todir="${buildroot}/stendhal-${version}-src" file="build.ant.properties"/>
<copy todir="${buildroot}/stendhal-${version}-src" file="README.md"/>
<copy todir="${buildroot}/stendhal-${version}-src" file="LICENSE.txt"/>
<copy todir="${buildroot}/stendhal-${version}-src" file="runserver.bat"/>
<copy todir="${buildroot}/stendhal-${version}-src" file="runserver.sh"/>
<copy todir="${buildroot}/stendhal-${version}-src" file="icon.ico"/>
<copy todir="${buildroot}/stendhal-${version}-src/lib">
<fileset dir="libs">
<include name="*.txt"/>
<include name="*.html"/>
</fileset>
</copy>
<copy todir="${buildroot}/stendhal-${version}-src/doc">
<fileset dir="doc"/>
<fileset dir="." includes="LICENSE.txt"/>
</copy>
<tar destfile="${buildroot}/stendhal-${version}-src.tar.gz" compression="gzip" longfile="gnu">
<tarfileset dir="${buildroot}/stendhal-${version}-src" prefix="stendhal-${version}">
<exclude name="**/CVS/**"/>
</tarfileset>
</tar>
<delete dir="${buildroot}/stendhal-${version}-src"/>
</target>
<target name="compile_stendhaltools" description="compiles the Stendhal build tools">
<mkdir dir="${build_stendhaltools}"/>
<javac srcdir="${src}" destdir="${build_stendhaltools}" source="1.8" target="1.8" debug="${javac.debug}" debuglevel="${javac.debuglevel}" deprecation="${javac.deprecation}" includeantruntime="true">
<include name="games/stendhal/tools/**/*.java"/>
<include name="games/stendhal/tools/*.java"/>
<compilerarg value="-encoding"/>
<compilerarg value="utf-8"/>
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<pathelement path="${guava_jar}"/>
<pathelement path="${marauroa_jar}"/>
<pathelement path="${log4j_jar}"/>
<pathelement path="${groovy_jar}"/>
<pathelement path="${tiled_jar}"/>
<pathelement path="${jorbis_jar}"/>
<pathelement path="${swinglayout_jar}"/>
</classpath>
</javac>
</target>
<target name="compile_stendhaltextclient" description="compiles the Stendhal text client ">
<mkdir dir="${build_stendhaltextclient}"/>
<javac srcdir="${src}" destdir="${build_stendhaltextclient}" source="1.8" target="1.8" debug="${javac.debug}" debuglevel="${javac.debuglevel}" deprecation="${javac.deprecation}" includeantruntime="false">
<include name="games/stendhal/bot/textclient/*.java"/>
<compilerarg value="-encoding"/>
<compilerarg value="utf-8"/>
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<pathelement path="${guava_jar}"/>
<pathelement path="${marauroa_jar}"/>
<pathelement path="${log4j_jar}"/>
<pathelement path="${groovy_jar}"/>
<pathelement path="${tiled_jar}"/>
<pathelement path="${jorbis_jar}"/>
<pathelement path="${swinglayout_jar}"/>
</classpath>
</javac>
</target>
<target name="rendermaps" description="Converts the *.tmx files to PNG images scaled 1:16" depends="compile_stendhaltools">
<taskdef name="maprenderer" classname="games.stendhal.tools.MapRenderer">
<classpath>
<pathelement path="${build_stendhaltools}"/>
<pathelement path="${tiled_jar}"/>
</classpath>
</taskdef>
<mkdir dir="tiled/world"/>
<maprenderer imagePath="${tiled}/world/">
<fileset dir="tiled">
<include name="Level */**/*.tmx"/>
<include name="interiors/**/*.tmx"/>
<exclude name="**/memory/**" />
</fileset>
</maprenderer>
</target>
<target name="renderatlas" description="Generates the files for the Stendhal Atlas" depends="compile_stendhaltools">
<taskdef name="maprenderer" classname="games.stendhal.tools.MapRenderer">
<classpath>
<pathelement path="${build_stendhaltools}"/>
<pathelement path="${tiled_jar}"/>
</classpath>
</taskdef>
<!--
7 1 1
6 2 0.5
5 4 0.25
4 8 0.125
3 16 0.0625
2 32 0.03125
1 64 0.015625
0 128 0.0078125
-->
<mkdir dir="tiled/world" />
<maprenderer imagePath="${tiled}/world/" zoom="0.0625">
<fileset dir="tiled">
<include name="Level 0/**/*.tmx"/>
<exclude name="**/memory/**" />
</fileset>
</maprenderer>
<mkdir dir="tiled/world/large" />
<maprenderer imagePath="${tiled}/world/large" zoom="0.25">
<fileset dir="tiled">
<include name="Level 0/**/*.tmx"/>
<exclude name="**/memory/**" />
</fileset>
</maprenderer>
</target>
<target name="updatemaps" description="Load and save TMX files to fix tilesets changes." depends="compile_stendhaltools">
<taskdef name="mapupdater" classname="games.stendhal.tools.MapUpdater">
<classpath>
<pathelement path="${build_stendhaltools}"/>
<pathelement path="${tiled_jar}"/>
</classpath>
</taskdef>
<mapupdater>
<fileset dir="tiled">
<include name="Level */**/*.tmx"/>
<include name="interiors/**/*.tmx"/>
</fileset>
</mapupdater>
</target>
<target name="jardiff" depends="client_build" unless="exclude.jardiff">
<echo>Creating update from ${version.old} to ${version}</echo>
<delete>
<fileset dir="${build-archive}">
<exclude name="*.zip"/>
</fileset>
</delete>
<unzip src="${build-archive}/stendhal-${version.old}.zip" dest="${build-archive}" />
<java jar="libs/jardiff.jar" fork="true">
<arg value="-nonminimal" />
<arg value="-creatediff" />
<arg value="-output" />
<arg value="${build}/lib/stendhal-diff-${version.old}-${version}.jar" />
<arg value="${build-archive}/lib/stendhal.jar" />
<arg value="${build}/lib/stendhal-${version}.jar" />
</java>
<java jar="libs/jardiff.jar" fork="true">
<arg value="-nonminimal" />
<arg value="-creatediff" />
<arg value="-output" />
<arg value="${build}/lib/stendhal-data-diff-${version.old}-${version}.jar" />
<arg value="${build-archive}/lib/stendhal-data.jar" />
<arg value="${build}/lib/stendhal-data-${version}.jar" />
</java>
<java jar="libs/jardiff.jar" fork="true">
<arg value="-nonminimal" />
<arg value="-creatediff" />
<arg value="-output" />
<arg value="${build}/lib/stendhal-music-data-diff-${version.old}-${version}.jar" />
<arg value="${build-archive}/lib/stendhal-music-data.jar" />
<arg value="${build}/lib/stendhal-music-data-${version}.jar" />
</java>
<java jar="libs/jardiff.jar" fork="true">
<arg value="-nonminimal" />
<arg value="-creatediff" />
<arg value="-output" />
<arg value="${build}/lib/stendhal-sound-data-diff-${version.old}-${version}.jar" />
<arg value="${build-archive}/lib/stendhal-sound-data.jar" />
<arg value="${build}/lib/stendhal-sound-data-${version}.jar" />
</java>
<!-- TODO maraurora.jar-->
</target>
<target name="signupdates" description="signs updates" depends="compile_stendhaltools,jardiff" unless="exclude.signing">
<taskdef name="updatesigner" classname="games.stendhal.tools.updateprop.UpdateSigner">
<classpath>
<pathelement path="."/>
<pathelement path="${build_stendhaltools}"/>
</classpath>
</taskdef>
<updatesigner>
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
</updatesigner>
</target>
<!--************************************************************************-->
<!--************************************************************************-->
<!--**** ****-->
<!--**** T E S T I N G ****-->
<!--**** ****-->
<!--************************************************************************-->
<!--************************************************************************-->
<target name="test" description="Compile and run tests" depends="compile_tests,prepare_serverini_for_tests,run_tests,report_test">
<property environment="env"/>
<exec executable="curl">
<arg value="-q" />
<arg value="-F" />
<arg value="filename=testresults.xml" />
<arg value="-F" />
<arg value="file=@build/build_test_report/testresults-short.xml" />
<arg value="https://stendhalgame.org?id=content/scripts/cireport&cikey=${env.cikey}&buildnumber=${env.TRAVIS_BUILD_NUMBER}&buildid=${env.TRAVIS_BUILD_ID}&commit=${env.TRAVIS_COMMIT}&commits=${env.TRAVIS_COMMIT_RANGE}&slug=${env.TRAVIS_REPO_SLUG}&pullrequest=${env.TRAVIS_PULL_REQUEST}&branch=${env.TRAVIS_BRANCH}"/>
</exec>
<fail message="Test errors detected, check test results." if="test.error" />
<fail message="Test failure detected, check test results." if="test.failure" />
</target>
<target name="compile_tests" description="Compile all tests" depends="server_build, client_build, compile_stendhaltools, compile_stendhaltextclient, postman">
<mkdir dir="${build_tests}"/>
<copy todir="${build_tests}">
<fileset dir="tests">
<exclude name="**/*.java"/>
</fileset>
</copy>
<javac srcdir="tests" destdir="${build_tests}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="1.8" target="1.8" deprecation="${javac.deprecation}" includeantruntime="false">
<include name="**/*.java"/>
<compilerarg value="-encoding"/>
<compilerarg value="utf-8"/>
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<pathelement path="${build_stendhaltools}"/>
<pathelement path="${build_stendhaltextclient}"/>
<pathelement path="${build_client}"/>
<pathelement path="${build_server}"/>
<pathelement path="${build_server_maps}"/>
<pathelement path="${build_server_script}"/>
<pathelement path="${build_postman}"/>
<pathelement path="${marauroa_jar}"/>
<pathelement path="${log4j_jar}"/>
<pathelement path="${hamcrest_jar}"/>
<pathelement path="${junit_jar}"/>
<pathelement path="${groovy_jar}"/>
<pathelement path="${simple_jar}"/>
<pathelement path="${easymock_jar}"/>
<pathelement path="${easymockclassextension_jar}"/>
<pathelement path="${build_server_script}"/>
<pathelement path="${tiled_jar}"/>
</classpath>
</javac>
</target>
<available property="server.ini" file="server.ini"/>
<target name="prepare_serverini_for_tests" unless="server.ini">
<echo file="server.ini">
database_implementation=games.stendhal.server.core.engine.StendhalPlayerDatabase
factory_implementation=games.stendhal.server.core.engine.StendhalRPObjectFactory
database_adapter=marauroa.server.db.adapter.H2DatabaseAdapter
jdbc_url=jdbc:h2:~/stendhal/database/h2db;AUTO_RECONNECT=TRUE;DB_CLOSE_ON_EXIT=FALSE
jdbc_class=org.h2.Driver
tcp_port=32160
world=games.stendhal.server.core.engine.StendhalRPWorld
ruleprocessor=games.stendhal.server.core.engine.StendhalRPRuleProcessor
turn_length=300
server_typeGame=stendhal
server_name=stendhal Marauroa server
server_version=1.17.5
server_contact=https://sourceforge.net/tracker/?atid=514826&group_id=66537&func=browse
n = 966117159215070350422008719727400433209081371975507132437556194069529307432746058120899703845731090424709994853484674454738958575201865208533043689325553646377
e = 15
d = 901709348600732327060541471745573737661809280510473323608385781131560686937229596225645929798090122419343070307904183075525081589946196209839163758401803422679
</echo>
</target>
<target name="run_tests" description="Run tests">
<mkdir dir="${build_tests_report}"/>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="libs/jacoco/jacocoant.jar"/>
</taskdef>
<jacoco:coverage destfile="${build_tests_report}/jacoco.exec" append="false" includes="games.stendhal.*">
<junit fork="yes" forkmode="once" errorproperty="test.error" failureproperty="test.failure">
<classpath>
<pathelement path="${build_tests}"/>
<pathelement path="${build_client}"/>
<pathelement path="${build_server}"/>
<pathelement path="${build_server_maps}"/>
<pathelement path="${build_stendhaltools}"/>