forked from fenyo1/FreeCol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
927 lines (845 loc) · 42.5 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
<?xml version="1.0"?>
<!-- This file includes targets for building FreeCol,
the metaserver, distribution packages, running tests
and creating documentation. -->
<project name="FreeCol" default="package">
<description>
This file includes targets for building FreeCol,
the metaserver, distribution packages, running tests
and creating documentation.
</description>
<property name="java.target.version" value="1.8"/>
<property name="freecol.name" value="freecol"/>
<property environment="env"/>
<property name="freecol.data.dir" value="${basedir}/data"/>
<property name="freecol.rules.dir" value="${basedir}/data/rules"/>
<property name="freecol.src.dir" value="${basedir}/src"/>
<property name="freecol.build.dir" value="${basedir}/build"/>
<property name="freecol.packaging.dir" value="${basedir}/packaging"/>
<property name="freecol.release.dir" value="${basedir}/dist"/>
<property name="freecol.doc.dir" value="${basedir}/doc"/>
<property name="freecol.javadoc.dir" value="${freecol.doc.dir}/javadoc"/>
<property name="freecol.jar.file" value="${basedir}/FreeCol.jar"/>
<property name="freecol.metaserver.jar.file"
value="${basedir}/FreeCol-metaserver.jar"/>
<property name="freecol.overview.file"
value="${freecol.src.dir}/overview.html"/>
<property name="test" value="AllTests"/>
<property name="miglayout-swing.jar"
value="jars/miglayout-swing-4.2.jar"/>
<property name="miglayout-core.jar"
value="jars/miglayout-core-4.2.jar"/>
<property name="cli.jar" value="jars/commons-cli-1.3.1.jar"/>
<property name="cortado.jar" value="jars/cortado-0.6.0.jar"/>
<path id="libraries.classpath">
<!-- MigLayout manager -->
<pathelement location="${basedir}/${miglayout-swing.jar}"/>
<pathelement location="${basedir}/${miglayout-core.jar}"/>
<!-- Command line processor -->
<pathelement location="${basedir}/${cli.jar}"/>
<!-- Cortado Video Applet -->
<pathelement location="${basedir}/${cortado.jar}"/>
<!-- JOgg/JOrbis libraries -->
<pathelement location="${basedir}/jars/jogg-0.0.17.jar"/>
<pathelement location="${basedir}/jars/jorbis-0.0.17.jar"/>
</path>
<path id="junit.classpath">
<pathelement location="${basedir}/test/lib/junit.jar" />
</path>
<path id="freecol.build.classpath">
<path refid="libraries.classpath" />
</path>
<path id="test.build.classpath">
<path refid="junit.classpath"/>
<path refid="libraries.classpath" />
</path>
<path id="test.run.classpath">
<pathelement location="${freecol.build.dir}" />
<path refid="junit.classpath"/>
<path refid="libraries.classpath" />
</path>
<condition property="isOsUnixLike">
<os family="unix" />
</condition>
<condition property="isOsWindows">
<os family="windows" />
</condition>
<condition property="isOsMac">
<os family="mac" />
</condition>
<condition property="isNotMacOrWindows">
<not>
<or>
<isset property="isOsWindows" />
<isset property="isOsMac" />
</or>
</not>
</condition>
<target name="define-jsmoothgen">
<taskdef name="jsmoothgen"
classname="net.charabia.jsmoothgen.ant.JSmoothGen"
classpath="${freecol.build.dir}/jars/jsmoothgen-ant.jar"/>
</target>
<target name="init" unless="TSTAMP">
<tstamp/>
</target>
<!-- Compiles the java source files. -->
<target name="compile" depends="init">
<mkdir dir="${freecol.build.dir}"/>
<javac srcdir="${freecol.src.dir}"
destdir="${freecol.build.dir}"
classpathref="freecol.build.classpath"
debug="on"
optimize="on"
deprecation="off"
source="${java.target.version}"
target="${java.target.version}"
includeantruntime="false">
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-g"/>
</javac>
</target>
<!-- Compile the JUnit tests -->
<target name="compile-test" depends="init">
<mkdir dir="${freecol.build.dir}"/>
<javac srcdir="test/src"
destdir="${freecol.build.dir}"
classpathref="test.build.classpath"
debug="on"
optimize="on"
deprecation="off"
source="${java.target.version}"
target="${java.target.version}"
includeantruntime="false">
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-g"/>
</javac>
</target>
<target name="build" depends="init,compile"
description="Compiles the source files.">
<copy todir="${freecol.build.dir}">
<fileset dir="${freecol.src.dir}" includes="**/*.xml" />
</copy>
</target>
<condition property="have-revision">
<isset property="FreeCol.Revision" />
</condition>
<target name="git-raw-revision" unless="have-revision"
description="Set gitRawRevision property using git">
<exec executable="git" failifexecutionfails="false"
outputproperty="gitRawRevision" logError="true">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
</target>
<target name="git-revision" unless="have-revision"
depends="git-raw-revision" if="gitRawRevision"
description="Set FreeCol.Revision from gitRawRevision using git">
<exec executable="git" failifexecutionfails="false"
outputproperty="FreeCol.Revision" logError="true">
<arg value="describe"/>
<arg value="--always"/>
</exec>
<echo message="${FreeCol.Revision}" />
</target>
<target name="manifest" depends="git-revision"
description="Creates the Manifest file.">
<manifestclasspath property="jar.classpath"
jarfile="Freecol.jar">
<classpath refid="libraries.classpath" />
</manifestclasspath>
<manifest file="${basedir}/src/MANIFEST.MF">
<attribute name="Created-By" value="FreeCol Team"/>
<attribute name="Main-Class" value="net.sf.freecol.FreeCol"/>
<attribute name="Class-Path" value="${jar.classpath}"/>
<attribute name="Product-Name" value="FreeCol"/>
<attribute name="Package-Title" value="FreeCol"/>
<attribute name="Package-Version" value="${FreeCol.Revision}"/>
<attribute name="Package-Vendor" value="FreeCol Team"/>
</manifest>
</target>
<!-- Compiles the source files and creates a JAR-file. -->
<target name="package" depends="init,build,manifest" description="Compiles the source files and creates a JAR-file.">
<jar jarfile="${freecol.jar.file}"
basedir="${freecol.build.dir}"
manifest="${basedir}/src/MANIFEST.MF"
includes="net/**, splash.jpg"
excludes="**/metaserver/MetaServer.java"/>
</target>
<!-- Compiles the metaserver and creates a JAR-file. -->
<target name="metaserver" depends="init,build,manifest" description="Compiles the metaserver and creates a JAR-file.">
<jar jarfile="${freecol.metaserver.jar.file}"
basedir="${freecol.build.dir}"
manifest="${basedir}/src/MANIFEST.MF"
includes="net/**, org/**"/>
</target>
<target name="mydist" depends="mydistWindows,mydistMac,mydistJava"
description="Creates a distribution package for the current system." />
<target name="mydistWindows" if="isOsWindows">
<antcall target="winInstallerBundle"/>
</target>
<target name="mydistMac" if="isOsMac">
<antcall target="tarMacJavaBundle"/>
</target>
<target name="mydistJava" if="isNotMacOrWindows">
<antcall target="javaInstallerBundle"/>
</target>
<!--
Creates archives and installers for distribution and places these in the
"dist" directory.
Various platforms can be omitted for prerelease testing by
setting properties on the command line:
skip.dist.mac="true" suppresses mac packaging
skip.dist.installer="true" suppresses creation of installers
skip.dist.java="true" suppresses zip and tar creation of the jarfiles
skip.dist.source="true" suppresses packaging the source files
For a formal release, none of these properties should be set.
-->
<target name="dist"
description="Creates archives and installers for distribution."
depends="init,initDist,zipJavaBundle,zipSourceBundle,javaInstallerBundle,winInstallerBundle,tarMacJavaBundle">
<echo message="" />
<echo message="-------------------------------------------------"/>
<echo message="Distribution files created:"/>
<echo message="${freecol.release.dir}"/>
<echo message="-------------------------------------------------"/>
</target>
<target name="initDist" depends="init,setReleaseVersion">
<mkdir dir="${freecol.release.dir}"/>
</target>
<target name="setReleaseVersion" depends="askReleaseVersion">
<property name="freecol.release.name"
value="${freecol.name}-${freecol.version}"/>
<echo message="Creating Distribution of ${freecol.release.name}"/>
<replaceregexp file="${freecol.src.dir}/net/sf/freecol/FreeCol.java"
match="FREECOL_VERSION\s*=\s*"(.*?)"\;"
replace="FREECOL_VERSION = "${freecol.version}"\;"/>
<replaceregexp file="${freecol.doc.dir}/version.sty"
match="fcversion\}\{(.*?)\}"
replace="fcversion\}\{${freecol.version}\}"/>
<echo message="Game version updated in FreeCol.java" />
</target>
<target name="askReleaseVersion" unless="freecol.version">
<input message="Please specify the release version (default: git-${DSTAMP}): "
addproperty="freecol.version" defaultvalue="git-${DSTAMP}" />
</target>
<target name="prepareManual" depends="initDist,print-manuals">
<mkdir dir="${freecol.release.dir}/manual/${freecol.name}"/>
<copy todir="${freecol.release.dir}/manual/${freecol.name}">
<fileset dir="${freecol.doc.dir}" includes="FreeCol.pdf"/>
<fileset dir="${freecol.doc.dir}" includes="developer.pdf"/>
</copy>
</target>
<target name="prepareBaseFiles" depends="initDist,desktop-entry">
<antcall target="clean"/>
<antcall target="package"/>
<mkdir dir="${freecol.release.dir}/base/${freecol.name}"/>
<copy todir="${freecol.release.dir}/base/${freecol.name}">
<fileset dir="${basedir}" includes="FreeCol.jar"/>
<fileset dir="${basedir}" includes="splash.jpg"/>
<fileset dir="${freecol.packaging.dir}/common" includes="COPYING"/>
<fileset dir="${freecol.packaging.dir}/common" includes="README"/>
<fileset dir="${freecol.packaging.dir}/common"
includes="freecol.cmd"/>
<fileset dir="${freecol.packaging.dir}/common"
includes="freecol.xpm"/>
<fileset dir="${basedir}" includes="data/**"/>
<fileset dir="${basedir}" includes="jars/**"/>
</copy>
<copy file="${freecol.packaging.dir}/common/freecol.sh"
tofile="${freecol.release.dir}/base/${freecol.name}/freecol"/>
</target>
<target name="prepareSourceFiles" depends="initDist">
<antcall target="clean"/>
<mkdir dir="${freecol.release.dir}/source/${freecol.name}"/>
<copy todir="${freecol.release.dir}/source/${freecol.name}">
<fileset dir="${basedir}"
excludes="splash.jpg,dist/**,data/**,jars/**,www.freecol.org/**,nbproject/**,srcdata/**,unused/**"/>
</copy>
</target>
<target name="prepareWinFiles" depends="initDist,define-jsmoothgen">
<jsmoothgen project="${freecol.build.dir}/startup.jsmooth"
skeletonroot="${freecol.build.dir}/skeletons"/>
<move todir="${freecol.release.dir}/win/${freecol.name}">
<fileset dir="${freecol.build.dir}" includes="freecol.exe"/>
</move>
<mkdir dir="${freecol.release.dir}/win/${freecol.name}/Uninstaller"/>
<jsmoothgen project="${freecol.build.dir}/uninstaller.jsmooth"
skeletonroot="${freecol.build.dir}/skeletons"/>
<move todir="${freecol.release.dir}/win/${freecol.name}/Uninstaller">
<fileset dir="${freecol.build.dir}" includes="uninstaller.exe"/>
</move>
</target>
<target name="zipJavaBundle" unless="skip.dist.java"
depends="initDist,prepareManual,prepareBaseFiles">
<zip destfile="${freecol.release.dir}/${freecol.release.name}.zip">
<fileset dir="${freecol.release.dir}/base"
includes="${freecol.name}/**"/>
<fileset dir="${freecol.release.dir}/manual"
includes="${freecol.name}/**"/>
</zip>
</target>
<target name="zipSourceBundle" unless="skip.dist.source"
depends="initDist,prepareBaseFiles,prepareSourceFiles">
<zip destfile="${freecol.release.dir}/${freecol.release.name}-src.zip">
<fileset dir="${freecol.release.dir}/base"
includes="${freecol.name}/**"
excludes="${freecol.name}/FreeCol.jar,${freecol.name}/freecol.*,${freecol.name}/freecol"/>
<fileset dir="${freecol.release.dir}/source"
includes="${freecol.name}/**"/>
</zip>
</target>
<target name="executeIzpack">
<izpack output="${freecol.release.dir}/${freecol.release.name}-installer.jar"
installerType="standard"
basedir="${freecol.release.dir}/"
izpackdir="${freecol.build.dir}">
<config><![CDATA[
<installation version="1.0">
<info>
<appname>FreeCol</appname>
<appversion>@{freecol.version}</appversion>
<appsubpath>freecol</appsubpath>
<url>http://www.freecol.org</url>
<authors>
<author name="The FreeCol Team" email="[email protected]" />
</authors>
<javaversion>1.8</javaversion>
</info>
<guiprefs width="640" height="480" resizable="no">
<laf name="looks">
<os family="unix" />
</laf>
<modifier key="langDisplayType" value="native"/>
</guiprefs>
<locale>
<langpack iso3="cat"/>
<langpack iso3="chn"/>
<langpack iso3="cze"/>
<langpack iso3="dan"/>
<langpack iso3="deu"/>
<langpack iso3="eng"/>
<!-- <langpack iso3="eus"/> -->
<langpack iso3="fin"/>
<langpack iso3="fra"/>
<!-- <langpack iso3="glg"/> -->
<langpack iso3="hun"/>
<langpack iso3="ita"/>
<langpack iso3="jpn"/>
<!-- <langpack iso3="mys"/> -->
<langpack iso3="ned"/>
<langpack iso3="nor"/>
<langpack iso3="pol"/>
<langpack iso3="por"/>
<!-- <langpack iso3="prt"/> -->
<!-- <langpack iso3="rom"/> -->
<langpack iso3="rus"/>
<!-- <langpack iso3="scg"/> -->
<langpack iso3="spa"/>
<!-- <langpack iso3="svk"/> -->
<langpack iso3="swe"/>
<langpack iso3="ukr"/>
</locale>
<resources>
<res id="LicencePanel.licence" src="base/@{freecol.name}/COPYING"/>
<res id="shortcutSpec.xml" src="@{freecol.build.dir}/winShortcutSpec.xml"/>
<res id="Unix_shortcutSpec.xml" src="@{freecol.build.dir}/unixShortcutSpec.xml"/>
<res id="installer.langsel.img" src="@{freecol.build.dir}/install.png"/>
<res id="packsLang.xml_cat" src="@{freecol.build.dir}/installer/lang.xml_cat"/>
<res id="packsLang.xml_chn" src="@{freecol.build.dir}/installer/lang.xml_chn"/>
<res id="packsLang.xml_cze" src="@{freecol.build.dir}/installer/lang.xml_cze"/>
<res id="packsLang.xml_dan" src="@{freecol.build.dir}/installer/lang.xml_dan"/>
<res id="packsLang.xml_deu" src="@{freecol.build.dir}/installer/lang.xml_deu"/>
<res id="packsLang.xml_eng" src="@{freecol.build.dir}/installer/lang.xml_eng"/>
<res id="packsLang.xml_eus" src="@{freecol.build.dir}/installer/lang.xml_eus"/>
<res id="packsLang.xml_fin" src="@{freecol.build.dir}/installer/lang.xml_fin"/>
<res id="packsLang.xml_fra" src="@{freecol.build.dir}/installer/lang.xml_fra"/>
<res id="packsLang.xml_glg" src="@{freecol.build.dir}/installer/lang.xml_glg"/>
<res id="packsLang.xml_hun" src="@{freecol.build.dir}/installer/lang.xml_hun"/>
<res id="packsLang.xml_ita" src="@{freecol.build.dir}/installer/lang.xml_ita"/>
<res id="packsLang.xml_jpn" src="@{freecol.build.dir}/installer/lang.xml_jpn"/>
<!-- <res id="packsLang.xml_mys" src="@{freecol.build.dir}/installer/lang.xml_mys"/> -->
<res id="packsLang.xml_ned" src="@{freecol.build.dir}/installer/lang.xml_ned"/>
<res id="packsLang.xml_nor" src="@{freecol.build.dir}/installer/lang.xml_nor"/>
<res id="packsLang.xml_pol" src="@{freecol.build.dir}/installer/lang.xml_pol"/>
<res id="packsLang.xml_por" src="@{freecol.build.dir}/installer/lang.xml_por"/>
<res id="packsLang.xml_prt" src="@{freecol.build.dir}/installer/lang.xml_prt"/>
<!-- <res id="packsLang.xml_rom" src="@{freecol.build.dir}/installer/lang.xml_rom"/> -->
<res id="packsLang.xml_rus" src="@{freecol.build.dir}/installer/lang.xml_rus"/>
<!-- <res id="packsLang.xml_scg" src="@{freecol.build.dir}/installer/lang.xml_scg"/> -->
<res id="packsLang.xml_spa" src="@{freecol.build.dir}/installer/lang.xml_spa"/>
<!-- <res id="packsLang.xml_svk" src="@{freecol.build.dir}/installer/lang.xml_svk"/> -->
<res id="packsLang.xml_swe" src="@{freecol.build.dir}/installer/lang.xml_swe"/>
<res id="packsLang.xml_ukr" src="@{freecol.build.dir}/installer/lang.xml_ukr"/>
</resources>
<native type="izpack" name="ShellLink.dll"/>
<native type="izpack" name="ShellLink_x64.dll"/>
<panels>
<panel classname="HelloPanel"/>
<panel classname="LicencePanel"/>
<panel classname="TargetPanel"/>
<panel classname="PacksPanel"/>
<panel classname="InstallPanel"/>
<panel classname="ShortcutPanel"/>
<panel classname="SimpleFinishPanel"/>
</panels>
<packs>
<pack id="FreeCol" name="FreeCol" required="yes">
<description>The FreeCol application and data files. This pack includes all files required to play the game.</description>
<fileset dir="base/@{freecol.name}" targetdir="$INSTALL_PATH"/>
<fileset dir="@{freecol.packaging.dir}/common/" includes="Uninstaller/**" targetdir="$INSTALL_PATH"/>
<fileset dir="win/@{freecol.name}" targetdir="$INSTALL_PATH" os="windows"/>
<executable targetfile="$INSTALL_PATH/freecol" stage="never" keep="true" />
<executable targetfile="$INSTALL_PATH/Uninstaller/uninstaller" stage="never" keep="true" />
</pack>
<pack id="GameManual" name="Game Manual" required="no" preselected="yes">
<description>This pack includes the game manual.</description>
<fileset dir="manual/@{freecol.name}" targetdir="$INSTALL_PATH"/>
</pack>
</packs>
</installation>
]]>
</config>
</izpack>
</target>
<target name="javaInstallerBundle" unless="skip.dist.installer"
description="Builds a platform independent installer"
depends="initDist,prepareWinFiles,prepareManual,prepareBaseFiles,prepareSourceFiles,installer-translations">
<taskdef name="izpack"
classname="com.izforge.izpack.ant.IzPackTask"
classpath="${freecol.build.dir}/jars/standalone-compiler.jar"/>
<antcall target="executeIzpack" />
</target>
<target name="winInstallerBundle" unless="skip.dist.installer"
description="Builds a windows installer"
depends="initDist,javaInstallerBundle,define-jsmoothgen">
<copy todir="${freecol.release.dir}">
<fileset dir="${freecol.build.dir}" includes="installer.jsmooth"/>
</copy>
<replace file="${freecol.release.dir}/installer.jsmooth"
token="%ant:freecol.release.name%"
value="${freecol.release.name}"/>
<replace file="${freecol.release.dir}/installer.jsmooth"
token="%ant:freecol.installerjar%"
value="${freecol.release.dir}/${freecol.release.name}-installer.jar"/>
<jsmoothgen project="${freecol.release.dir}/installer.jsmooth"
skeletonroot="${freecol.build.dir}/skeletons"/>
</target>
<!-- Builds a doubleclickable application bundle running on Mac OS X -->
<target name="macJavaBundle" unless="skip.dist.mac"
depends="prepareManual,prepareBaseFiles">
<!-- JarBundler is a feature-rich Ant task which will create a Mac OS X
application bundle from a list of Jar files and a main class name.
(GPL-Software) -> http://informagen.com/JarBundler/ -->
<taskdef name="jarbundler"
classname="net.sourceforge.jarbundler.JarBundler"
classpath="${freecol.build.dir}/jars/jarbundler.jar"/>
<jarbundler dir="${freecol.release.dir}"
name="FreeCol"
mainclass="net.sf.freecol.FreeCol"
version="${freecol.version}"
vmoptions="-Xmx256M -Dapple.awt.fakefullscreen=true"
jvmversion="1.8+"
arguments="--windowed --freecol-data FreeCol.app/Contents/Resources/"
stubfile="${freecol.build.dir}/skeletons/FreeCol"
icon="${freecol.packaging.dir}/icons/FreeCol.icns">
<jarfileset dir="${freecol.release.dir}/base/freecol/">
<include name="**/*" />
<exclude name="data/**" />
</jarfileset>
<resourcefileset dir="${freecol.release.dir}/base/freecol/data" />
</jarbundler>
</target>
<target name="tarMacJavaBundle" unless="skip.dist.mac"
depends="tarMacJavaBundleOnUnixLike,tarMacJavaBundleOnWindows"
description="Creates a Mac OS X application bundle inside a tar file.">
</target>
<target name="tarMacJavaBundleOnUnixLike" unless="skip.dist.mac"
if="isOsUnixLike" depends="macJavaBundle">
<delete file="${freecol.release.dir}/FreeCol.app/Contents/MacOS/FreeCol"/>
<symlink link="${freecol.release.dir}/FreeCol.app/Contents/MacOS/FreeCol"
resource="/System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub"/>
<exec executable="tar">
<arg value="cfvj"/>
<arg value="${freecol.release.dir}/${freecol.release.name}-mac.tar.bz2"/>
<arg value="-C"/>
<arg value="${freecol.release.dir}"/>
<arg value="FreeCol.app/"/>
</exec>
</target>
<target name="tarMacJavaBundleOnWindows" depends="macJavaBundle"
unless="skip.dist.mac" if="isOsWindows">
<echo message="Warning: You are building a Mac Os X Java Application Bundle containing a Copy Java Application Stub. Creating a bundle with the current copy of Java Launching Stub could lead to a future situation where the JavaApplicationStub file could become incompatible with a future OS X update. To avoid this, use a unix like system ... "/>
<tar destfile="${freecol.release.dir}/${freecol.release.name}-mac.tar.bz2"
compression="bzip2">
<tarfileset dir="${freecol.release.dir}" mode="755"
includes="FreeCol.app/Contents/MacOS/FreeCol"
excludes="**/freecol*"
followsymlinks="false"/>
<tarfileset followsymlinks="false" dir="${freecol.release.dir}">
<include name="FreeCol.app/**"/>
<exclude name="**/freecol*"/>
<exclude name="FreeCol.app/Contents/MacOS/FreeCol"/>
</tarfileset>
</tar>
</target>
<!-- Cleans the directories by removing auto-generated files. -->
<target name="clean" depends="init"
description="Cleans the directories by removing auto-generated files.">
<delete quiet="true" includeEmptyDirs="true">
<fileset dir="${freecol.build.dir}" includes="net/**" />
<fileset dir="${freecol.build.dir}" includes="timestamp.inf" />
<fileset dir="${freecol.build.dir}" includes="report/**" />
<fileset dir="${freecol.build.dir}" includes="TEST-net.sf.freecol.*" />
<fileset dir="${freecol.build.dir}" includes="dependencies.txt" />
<fileset dir="${freecol.doc.dir}"
excludes="*.tex *.sty images/* specification.*" />
</delete>
<delete quiet="true" file="${freecol.jar.file}"/>
<delete quiet="true" file="${freecol.metaserver.jar.file}"/>
<delete quiet="true" file="TESTS-TestSuites.xml"/>
<delete quiet="true" dir="${freecol.javadoc.dir}"/>
<delete quiet="true" file="Freecol.log"/>
<delete quiet="true" file="${basedir}/test/data/specification.xml"/>
</target>
<target name="distclean" depends="init,clean"
description="Cleans the directories and removes the distribution directory.">
<delete quiet="true" includeEmptyDirs="true" followsymlinks="false"
removeNotFollowedSymlinks="true">
<fileset dir="${freecol.release.dir}" />
</delete>
</target>
<target name="fix" depends="init">
<fixcrlf srcdir="${freecol.src.dir}"
includes="**/*.java"
eol="asis"
tab="remove"
javafiles="yes"
tablength="4"
eof="asis"/>
</target>
<!-- Generate JavaDoc documentation. -->
<target name="javadoc" depends="init"
description="Generate JavaDoc documentation.">
<mkdir dir="${freecol.javadoc.dir}"/>
<javadoc sourcepath="${freecol.src.dir}"
overview="${freecol.overview.file}"
destdir="${freecol.javadoc.dir}"
packagenames="net.sf.freecol.*"
private="true"
classpathref="freecol.build.classpath"
Author="true"
Windowtitle="FreeCol Code Documentation"/>
<echo message="" />
<echo message="-------------------------------------------------"/>
<echo message="JavaDoc-generated documentation created:"/>
<echo message="${freecol.javadoc.dir}"/>
<echo message="-------------------------------------------------"/>
</target>
<!-- example:
ant -lib test/lib/junit.jar -Dtest=common.model.BuildingTest test
-->
<target name="test" depends="build-unit-tests"
description="Runs a particular unit test">
<!-- if the next fails then here is the long answer:
http://ant.apache.org/faq.html#delegating-classloader
the short answer depends.
if you have Ant 1.7, the junit.jar can exist on the classpath.
upgrading to 1.7 may be the best solution. Later ant
should be fine.
if you have Ant 1.6:
ant -lib test/lib/junit.jar testall
if you have a version of Ant prior to 1.6 on Windows:
set CLASSPATH=%CLASSPATH%;test\lib\junit.jar
ant testall
if you have a version of Ant prior to 1.6 on UNIX:
export CLASSPATH=${CLASSPATH}:test/lib/junit.jar; ant testall
-->
<junit printsummary="yes">
<classpath refid="test.run.classpath"/>
<formatter type="brief" usefile="false" />
<formatter type="plain" />
<test todir="${freecol.build.dir}" name="net.sf.freecol.${test}" />
<sysproperty key="java.awt.headless" value="true" />
</junit>
<echo message="For more detailed information about this test run see:"/>
<echo message="${freecol.build.dir}/TEST-net.sf.freecol.${test}.txt"/>
</target>
<target name="testall" depends="build-unit-tests" unless="skip.dist.test"
description="Runs all unit tests">
<delete dir="${freecol.build.dir}/report" />
<mkdir dir="${freecol.build.dir}/report"/>
<mkdir dir="${freecol.build.dir}/report/xml"/>
<!-- if the next fails then here is the long answer:
http://ant.apache.org/faq.html#delegating-classloader
the short answer depends.
if you have Ant 1.7, the junit.jar can exist on the classpath.
upgrading to 1.7 may be the best solution.
if you have Ant 1.6:
ant -lib test/lib/junit.jar testall
if you have a version of Ant prior to 1.6 on Windows:
set CLASSPATH=%CLASSPATH%;test\lib\junit.jar
ant testall
if you have a version of Ant prior to 1.6 on UNIX:
export CLASSPATH=${CLASSPATH}:test/lib/junit.jar; ant testall
-->
<junit printsummary="on" errorProperty="error.junit"
failureProperty="error.junit" fork="yes" maxmemory="96M">
<classpath refid="test.run.classpath"/>
<formatter type="xml" />
<test todir="${freecol.build.dir}/report/xml"
name="net.sf.freecol.AllTests" fork="yes"/>
<!--
<batchtest fork="false" todir="${freecol.build.dir}/report/xml">
<fileset dir="test/src" includes="**/*Test.java" />
</batchtest>
-->
<sysproperty key="java.awt.headless" value="true" />
</junit>
<junitreport>
<fileset dir="${freecol.build.dir}/report/xml">
<include name="TEST-*.xml"/>
</fileset>
<report todir="${freecol.build.dir}/report" />
</junitreport>
<echo message="For detailed results of the test run see: ${freecol.build.dir}/report/index.html"/>
<fail if="error.junit" message="Automated Unit Tests failed."/>
</target>
<target name="build-unit-tests" depends="build">
<depend srcDir="test/src" destDir="${freecol.build.dir}"
cache="${freecol.build.dir}" />
<javac srcdir="test/src"
destdir="${freecol.build.dir}"
classpathref="test.build.classpath"
debug="on"
optimize="on"
deprecation="off"
source="${java.target.version}"
target="${java.target.version}"
includeantruntime="false">
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-Xlint:deprecation"/>
</javac>
</target>
<target name="validate" description="Validates the specification.">
<echo message="Validating freecol/specification.xml."/>
<schemavalidate noNamespaceFile="schema/specification-schema.xsd"
file="${freecol.rules.dir}/freecol/specification.xml">
</schemavalidate>
<echo message="Validating classic/specification.xml."/>
<schemavalidate noNamespaceFile="schema/specification-schema.xsd"
file="${freecol.rules.dir}/classic/specification.xml">
</schemavalidate>
<echo message="Validating testing/specification.xml."/>
<schemavalidate noNamespaceFile="schema/specification-schema.xsd"
file="${freecol.rules.dir}/testing/specification.xml">
</schemavalidate>
</target>
<target name="print-manual" unless="print.manual.is.up.to.date"
description="Creates the printable user guide.">
<delete file="doc/FreeCol.ind" />
<exec executable="pdflatex" dir="doc" >
<arg file="doc/FreeCol.tex"/>
</exec>
<exec executable="makeindex" dir="doc" >
<arg file="doc/FreeCol.idx"/>
</exec>
<exec executable="pdflatex" dir="doc" >
<arg file="doc/FreeCol.tex"/>
</exec>
<property name="print.manual.is.up.to.date" value="true" />
</target>
<target name="print-devmanual" unless="print.devmanual.is.up.to.date"
description="Creates the printable user guide.">
<delete file="doc/developer.ind" />
<exec executable="pdflatex" dir="doc" >
<arg file="doc/developer.tex"/>
</exec>
<exec executable="makeindex" dir="doc" >
<arg file="doc/developer.idx"/>
</exec>
<exec executable="pdflatex" dir="doc" >
<arg file="doc/developer.tex"/>
</exec>
<property name="print.devmanual.is.up.to.date" value="true" />
</target>
<target name="print-manuals" depends="print-manual,print-devmanual"
description="Creates the printable user and developer guides.">
</target>
<target name="online-manual" unless="online.manual.is.up.to.date"
description="Creates the online user guide.">
<delete file="doc/FreeCol.ind" />
<exec executable="htlatex" dir="doc" >
<arg file="doc/FreeCol.tex"/>
</exec>
<exec executable="tex" dir="doc">
<arg line="\def\filename{{FreeCol}{idx}{4dx}{ind}} \input idxmake.4ht" />
</exec>
<exec executable="makeindex" dir="doc" >
<arg file="doc/FreeCol.4dx"/>
</exec>
<exec executable="htlatex" dir="doc" >
<arg file="doc/FreeCol.tex"/>
</exec>
<property name="online.manual.is.up.to.date" value="true" />
</target>
<target name="online-devmanual" unless="online.devmanual.is.up.to.date"
description="Creates the online user guide.">
<delete file="doc/developer.ind" />
<exec executable="htlatex" dir="doc" >
<arg file="doc/developer.tex"/>
</exec>
<exec executable="tex" dir="doc">
<arg line="\def\filename{{developer}{idx}{4dx}{ind}} \input idxmake.4ht" />
</exec>
<exec executable="makeindex" dir="doc" >
<arg file="doc/developer.4dx"/>
</exec>
<exec executable="htlatex" dir="doc" >
<arg file="doc/developer.tex"/>
</exec>
<property name="online.devmanual.is.up.to.date" value="true" />
</target>
<target name="online-manuals" depends="online-manual,online-devmanual"
description="Creates the online user and developer guides.">
</target>
<target name="manual" depends="print-manual,online-manual"
description="Creates the printable and online user guides.">
</target>
<target name="devmanual" depends="print-devmanual,online-devmanual"
description="Creates the printable and online developer guides.">
</target>
<target name="manuals" depends="manual,devmanual"
description="Creates the printable and online user and developer guides.">
</target>
<target name="fixTabsWindows">
<fixcrlf srcdir="${freecol.src.dir}" tab="remove" tablength="4"
includes="**/*.java" eol="crlf"/>
</target>
<target name="fixTabsUnix">
<fixcrlf srcdir="${freecol.src.dir}" tab="remove" tablength="4"
includes="**/*.java" eol="lf"/>
</target>
<!-- Prints a report on certain translations, which you can specify
by setting the localeKey property ("-DlocaleKey=fi", for example),
or all translations. Use "-emacs" in order to suppress extensive
logging. -->
<target name="translation-report" depends="build"
description="Creates report on translations.">
<condition property="localeKey" else="">
<isset property="localeKey" />
</condition>
<java classname="net.sf.freecol.tools.TranslationReport" classpath="build/" >
<arg value="data/strings" />
<arg value="${localeKey}" />
</java>
</target>
<!-- Merges new translations from trunk. You can specify a
particular language by setting the localeKey property
("-DlocaleKey=fi", for example), or all translations. -->
<!-- Now that translations are hosted at translatewiki, we no longer need this.
<target name="merge-translations" depends="build"
description="Merges translations from trunk.">
<condition property="localeKey" else="">
<isset property="localeKey" />
</condition>
<java classname="net.sf.freecol.tools.MergeTranslations" classpath="build/" >
<arg value="../../trunk/data/strings" />
<arg value="data/strings" />
<arg value="${localeKey}" />
</java>
</target>
-->
<!-- Validates a savegame files specified as property file
("-Dsavegame=whatever.fsg", for example). If file is a directory,
all savegame files in that directory will be validated. -->
<target name="validate-savegame" depends="build"
description="Validates a savegame, or directory of savegames.">
<condition property="savegame" else="">
<isset property="savegame" />
</condition>
<java classname="net.sf.freecol.tools.SaveGameValidator">
<classpath refid="test.run.classpath"/>
<arg value="${savegame}" />
</java>
</target>
<!-- Creates installer strings. -->
<target name="installer-translations" depends="build"
description="Creates properties files for installer translations.">
<java classname="net.sf.freecol.tools.InstallerTranslations"
classpath="build/" />
</target>
<!-- Creates HTML documentation from specification. -->
<target name="generate-documentation" depends="build"
description="Creates HTML documentation from specification.">
<java classname="net.sf.freecol.tools.GenerateDocumentation"
classpath="build/" fork="true"/>
</target>
<!-- Creates 'freecol.desktop' file. -->
<target name="desktop-entry" depends="build"
description="Creates 'freecol.desktop' file.">
<mkdir dir="${freecol.release.dir}/base/freecol"/>
<java classname="net.sf.freecol.tools.DesktopEntry"
classpath="build/">
<arg value="${freecol.release.dir}/base/freecol/freecol.desktop" />
</java>
</target>
<target name="pmd">
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"
classpath="./pmd-4.1/lib/pmd-4.1.jar"/>
<pmd shortFilenames="true">
<ruleset>basic</ruleset>
<ruleset>imports</ruleset>
<!-- <ruleset>optimizations</ruleset> -->
<ruleset>unusedcode</ruleset>
<formatter type="html" toFile="pmd_report.html"
linkPrefix="http://pmd.sourceforge.net/xref/"/>
<fileset dir="src">
<include name="**/*.java"/>
</fileset>
</pmd>
</target>
<target name="prepare-commit"
description="Rebuild from scratch and run all tests."
depends="clean,package,validate,testall"/>
<!-- This is a shortcut for NetBeans, and possibly other IDEs. -->
<target name="run" depends="package" description="Runs the game">
<java jar="FreeCol.jar" fork="true">
<jvmarg value="-Xmx512M" />
</java>
</target>
<target name="cobertura" depends="build">
<property name="cobertura.dir" value="cobertura" />
<path id="cobertura.classpath">
<fileset dir="${cobertura.dir}">
<include name="cobertura.jar" />
<include name="lib/**/*.jar" />
</fileset>
</path>
<taskdef classpathref="cobertura.classpath"
resource="tasks.properties" />
<cobertura-instrument todir="build/instrumented-classes">
<fileset dir="build/net">
<include name="**/*.class"/>
</fileset>
</cobertura-instrument>
<delete dir="${freecol.build.dir}/report" />
<mkdir dir="${freecol.build.dir}/report"/>
<mkdir dir="${freecol.build.dir}/report/xml"/>
<junit printsummary="on" errorproperty="error.junit"
fork="yes" maxmemory="64M">
<classpath location="build/instrumented-classes"/>
<classpath location="build/net"/>
<classpath refid="cobertura.classpath"/>
<classpath refid="test.run.classpath"/>
<formatter type="xml" />
<test todir="${freecol.build.dir}/report/xml"
name="net.sf.freecol.AllTests" fork="yes"/>
<sysproperty key="java.awt.headless" value="true" />
</junit>
<cobertura-report srcdir="${freecol.src.dir}"
destdir="cobertura/report"/>
</target>
</project>