File: build.xml

package info (click to toggle)
triplea 1.5.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 153,264 kB
  • sloc: java: 144,364; xml: 37,101; makefile: 28; sh: 22
file content (610 lines) | stat: -rw-r--r-- 19,935 bytes parent folder | download
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
<?xml version="1.0"?>


<project name="TripleA" basedir="." default="compile" xmlns:fb="antlib:edu.umd.cs.findbugs">

	<taskdef uri="antlib:edu.umd.cs.findbugs" resource="edu/umd/cs/findbugs/anttask/tasks.properties" classpath="ant/findbugs-1.3.9/lib/findbugs-ant.jar"/>

	<property file=".ant.properties" />
    <property name="junit-result-dir" location="test-results"/>
    <property name="src" location="src"/>
    <property name="classes" location="classes"/>

    <property name="test-src" location="test"/>
    <property name="test-classes" location="testclasses"/>

	<!-- this path does not have junit on it -->
	<path id="src.classpath">
	<pathelement path="lib\gnumail.jar"/>
        <pathelement path="lib\mailapi.jar"/>
        <pathelement path="lib\smtp.jar"/>
        <pathelement path="lib\activation.jar"/>
		<pathelement path="lib\standalone-compiler.jar" />
		<pathelement path="lib\AppleJavaExtensions.jar" />
		<pathelement path="lib\commons-httpclient-3.0.1.jar" />
		<pathelement path="lib\commons-logging-1.1.jar" />
		<pathelement path="lib\commons-codec-1.3.jar" />
		<pathelement path="lib\substance_5.3.jar" />
		<pathelement path="classes/" />
	</path>

	<path id="test.classpath">
		<path refid="src.classpath"/>
        <pathelement path="${test-classes}"/>
		<pathelement path="lib\junit.jar" />
        <pathelement path="lib\derby_10_1_2.jar"/>
	</path>


	<!-- All -->
	<target name="all" depends="clean,compile,test,zip, zipSource" description="cleans, compiles, tests, zips, and zips source">
	</target>


	<!-- Clean -->
	<target name="clean" description="Remove all release, class and saved game files">
		<delete dir="release" />
		<delete dir="${classes}" />
		<delete dir="bin" />
		<delete dir="${test-classes}" />
		<delete dir="savedGames" />
	</target>

	<!-- Compile -->
	<target name="compile_orig" description="Compile the source files and copy over the resource files">

		<!-- we require jdk 1.5 or greater -->
		<fail message="jdk 1.5 or greater required, you are currently using: ${ant.java.version}">
			<condition>
				<or>
					<equals arg1="1.1" arg2="${ant.java.version}" />
					<equals arg1="1.2" arg2="${ant.java.version}" />
					<equals arg1="1.3" arg2="${ant.java.version}" />
					<equals arg1="1.4" arg2="${ant.java.version}" />
				</or>
			</condition>
		</fail>

		<!-- we only need this for deployment -->
		<delete file="bin/triplea.jar" failonerror="" />

		<mkdir dir="${classes}" />
		<mkdir dir="${test-classes}" />
		<copy todir="classes">
			<fileset dir="data">
				<include name="**/*.dtd" />
				<include name="**/*.gif" />
				<include name="**/*.png" />
				<include name="**/*.txt" />
				<include name="**/*.jpeg" />
				<include name="**/*.xml" />
				<include name="**/*.xslt" />
				<include name="**/*.wav" />
				<include name="**/*.properties" />
				<include name="**/*.html" />
			</fileset>
		</copy>

		<javac srcdir="src/" destdir="${classes}" debug="true" deprecation="true" classpathref="src.classpath" target="1.5" encoding="utf8" />

		<!-- to check the correct java version, we need to compile the startup class so that it will run on older vms -->
		<!-- delete the startup class, and recompile it -->
		<delete>
			<fileset dir="classes" includes="**/GameRunner.class">
			</fileset>
		</delete>

		<javac srcdir="${src}" destdir="${classes}" debug="true" deprecation="true" classpathref="src.classpath" target="1.2" source="1.2" />
	</target>

	<target name="run" depends="compile" description="Run Triplea">
		<java classpathref="src.classpath" spawn="true" classname="games.strategy.engine.framework.GameRunner" fork="true"/>
	</target>


	<!-- compileClean -->
	<target name="compileClean" depends="clean,compile,zip" description="Clean then compile" />

	<target name="macRelease" depends="clean,compile,zip" description="create a mac os x end user application">

		<property name="dmg.file" value="release/triplea_${triplea.version}_mac.dmg"/>
		<property name="app.file" value="release/Triplea.app"/>


		<exec executable="hdiutil">
			<arg line="detach /Volumes/TripleA" />
		</exec>

		<mkdir dir="${app.file}" />
		<mkdir dir="${app.file}/Contents" />
		<mkdir dir="${app.file}/Contents/MacOS" />
		<mkdir dir="${app.file}/Contents/Resources/" />
		<mkdir dir="${app.file}/Contents/Resources/Java" />

		<copy file="/System/Library/Frameworks/JavaVM.framework/Versions/Current/Resources/MacOS/JavaApplicationStub" todir="${app.file}/Contents/MacOS/" />

		<exec executable="chmod">
			<arg line="755 ${app.file}/Contents/MacOS/JavaApplicationStub" />
		</exec>

		<copy file="bin/triplea.jar" todir="${app.file}/Contents/Resources/Java/"/>

		<copy file="Info.plist" todir="${app.file}/Contents/" />

		<echo message="APPL????" file="${app.file}/Contents/PkgInfo" />



		<copy file="icons/icon.icns" todir="${app.file}/Contents/Resources/" />

		<exec executable="cp">
			<arg line="-r icons ${app.file}/Contents/Resources/" />
		</exec>

		<exec executable="cp">
			<arg line="-r images ${app.file}/Contents/Resources/" />
		</exec>

		<exec executable="cp">
			<arg line="-r sounds ${app.file}/Contents/Resources/" />
		</exec>

		<exec executable="cp">
			<arg line="-r license ${app.file}/Contents/Resources/" />
		</exec>

		<exec executable="cp">
			<arg line="-r dice_servers ${app.file}/Contents/Resources/" />
		</exec>

		<exec executable="cp">
			<arg line="-r maps ${app.file}/Contents/Resources/" />
		</exec>

		<exec executable="/Developer/Tools/SetFile">
			<arg line="-a B ${app.file}" />
		</exec>

		<unzip src="icons/Icon.zip" dest="${app.file}/" encoding="MacRoman" />

		<echo message="making dmg"/>
		<exec executable="hdiutil">
			<arg line="create -size 200m -fs HFS+ -volname TripleA ${dmg.file}" />
		</exec>


		<exec executable="hdiutil">
			<arg line="attach ${dmg.file}" />
		</exec>

		<exec executable="cp">
			<arg line="-r ${app.file} /Volumes/TripleA/" />
		</exec>

		<exec executable="cp">
			<arg line="-r doc /Volumes/TripleA/" />
		</exec>

		<exec executable="cp">
			<arg line="readme.html /Volumes/TripleA/" />
		</exec>

		<exec executable="cp">
			<arg line="TripleA_RuleBook.pdf /Volumes/TripleA/" />
		</exec>

		<exec executable="cp">
			<arg line="license/gpl.txt /Volumes/TripleA/COPYING" />
		</exec>

		<exec executable="hdiutil">
			<arg line="detach /Volumes/TripleA" />
		</exec>

		<!-- compress the dmg file -->
		<move file="${dmg.file}" tofile="temp.dmg"> </move>
		<exec executable="hdiutil">
			<arg line="convert temp.dmg -o ${dmg.file} -format UDBZ "/>
 		</exec>
		<delete file="temp.dmg"/>

	</target>

	<target name="macServerApp" depends="clean,compile,zip" description="create a mac os x server application">

		<property name="dmg.file" value="release/triplea_${triplea.version}_server.dmg"/>
		<property name="app.file" value="release/TripleaServer.app"/>


		<exec executable="hdiutil">
			<arg line="detach /Volumes/TripleA" />
		</exec>

		<mkdir dir="${app.file}" />
		<mkdir dir="${app.file}/Contents" />
		<mkdir dir="${app.file}/Contents/MacOS" />
		<mkdir dir="${app.file}/Contents/Resources/" />
		<mkdir dir="${app.file}/Contents/Resources/Java" />

		<copy file="/System/Library/Frameworks/JavaVM.framework/Versions/Current/Resources/MacOS/JavaApplicationStub" todir="${app.file}/Contents/MacOS/" />

		<exec executable="chmod">
			<arg line="755 ${app.file}/Contents/MacOS/JavaApplicationStub" />
		</exec>

		<copy file="bin/triplea.jar" todir="${app.file}/Contents/Resources/Java/"/>
		<copy file="lib/derby_10_1_2.jar" todir="${app.file}/Contents/Resources/Java/"/>


		<copy file="ServerInfo.plist" tofile="${app.file}/Contents/Info.plist" />

		<echo message="APPL????" file="${app.file}/Contents/PkgInfo" />

		<copy file="icons/icon.icns" todir="${app.file}/Contents/Resources/" />


		<exec executable="cp">
			<arg line="-r icons ${app.file}/Contents/Resources/" />
		</exec>

		<exec executable="/Developer/Tools/SetFile">
			<arg line="-a B ${app.file}" />
		</exec>

		<unzip src="icons/Icon.zip" dest="${app.file}/" encoding="MacRoman" />

		<echo message="making dmg"/>
		<exec executable="hdiutil">
			<arg line="create -size 100m -fs HFS+ -volname TripleA ${dmg.file}" />
		</exec>


		<exec executable="hdiutil">
			<arg line="attach ${dmg.file}" />
		</exec>

		<exec executable="cp">
			<arg line="-r ${app.file} /Volumes/TripleA/" />
		</exec>

		<exec executable="cp">
			<arg line="-r doc /Volumes/TripleA/" />
		</exec>

		<exec executable="cp">
			<arg line="readme.html /Volumes/TripleA/" />
		</exec>

		<exec executable="cp">
			<arg line="license/gpl.txt /Volumes/TripleA/COPYING" />
		</exec>

		<exec executable="hdiutil">
			<arg line="detach /Volumes/TripleA" />
		</exec>

		<!-- compress the dmg file -->
		<move file="${dmg.file}" tofile="temp.dmg"> </move>
		<exec executable="hdiutil">
			<arg line="convert temp.dmg -o ${dmg.file} -format UDBZ "/>
 		</exec>
		<delete file="temp.dmg"/>

	</target>


	<!-- zip -->
	<target name="zip" depends="compile" description="create a zip file for all end users">
		<mkdir dir="release" />
	</target>
	<!-- Debian compile -->
	<target name="compile" depends="compile_orig" description="compile classes into .jar">
 		<mkdir dir="release" />

		<mkdir dir="bin"/>
		<delete file="bin/triplea.jar" />

		<!-- we want to merge all the jar files we use
		     into the triplea.jar file, so unzip everything into
		     one directory -->
		<delete dir="deleteme"/>
		<mkdir dir="deleteme"/>
		<unjar dest="deleteme" overwrite="yes">
			<fileset dir="lib" includes="*.jar" excludes="junit.jar,derby*"> </fileset>
		</unjar>
		<delete dir="deleteme/META-INF"/>
		<copy todir="deleteme">
			<fileset dir="classes" includes="**"/>
		</copy>

		<jar destfile="bin/triplea.jar" basedir="deleteme">
			<manifest>
				<attribute name="Main-Class" value="games.strategy.engine.framework.GameRunner" />
			</manifest>
		</jar>
		<delete dir="deleteme"/>
<!--
		<zip zipfile="release/triplea_${triplea.version}_all_platforms.zip" compress="true">
-->
			<!--zipfileset dir="lib/" prefix="triplea_${triplea.version}/lib/">
				<include name="**/*.jar" />
				<include name="**/*.zip" />

				<exclude name="**/junit.jar" />
			</zipfileset -->
<!--
			<zipfileset dir="doc/" prefix="triplea_${triplea.version}/doc/">
				<include name="**/*.*" />
			</zipfileset>

			<zipfileset dir="license/" prefix="triplea_${triplea.version}/license/">
				<include name="gpl.txt" />
			</zipfileset>

			<zipfileset dir="dice_servers/" prefix="triplea_${triplea.version}/dice_servers/">
				<include name="*.properties" />
			</zipfileset>

			<zipfileset dir="icons/" prefix="triplea_${triplea.version}/icons/">
				<include name="**/*.png" />
				<include name="**/*.bmp" />
				<include name="**/*.ico" />
			</zipfileset>

			<zipfileset dir="images/" prefix="triplea_${triplea.version}/images/">
				<include name="**/*.*" />
			</zipfileset>

			<zipfileset dir="sounds/" prefix="triplea_${triplea.version}/sounds/">
				<include name="**/*.*" />
			</zipfileset>

			<zipfileset dir="maps/" prefix="triplea_${triplea.version}/maps/">
				<include name="**/*.*" />
			</zipfileset>

			<zipfileset dir="." prefix="triplea_${triplea.version}/">
				<include name="readme.html" />
				<include name="*.bat" />
				<include name="triplea.exe" />
				<include name="changelog.txt" />
				<include name="TripleA_RuleBook.pdf" />
			</zipfileset>

			<zipfileset dir="." prefix="triplea_${triplea.version}/" filemode="755">
				<include name="*.sh"/>
				<exclude name="fix_mac_icon.sh"/>
				<exclude name="run-server.sh"/>
			</zipfileset>

			<zipfileset dir="bin/" prefix="triplea_${triplea.version}/bin/" filemode="755">
				<include name="**/triplea.jar" />
			</zipfileset>


		</zip>
-->
	</target>

	<!-- zip -->
	<target name="zipServer" depends="zip" description="create zip for lobby server">
		<zip zipfile="release/triplea_${triplea.version}_server.zip" compress="true">

			<zipfileset dir="license/" prefix="triplea_${triplea.version}/license/">
				<include name="gpl.txt" />
			</zipfileset>

			<zipfileset dir="lib/" prefix="triplea_${triplea.version}/lib/">
				<include name="**/derby*.jar" />
			</zipfileset>

			<zipfileset dir="bin/" prefix="triplea_${triplea.version}/bin/">
				<include name="**/*.jar" />
			</zipfileset>

			<zipfileset dir="." prefix="triplea_${triplea.version}" filemode="755">
				<include name="run-server.sh"/>
			</zipfileset>
		</zip>

	</target>

	<!-- must be done after a ant zip has been executed (we dont depend since ant zip
         takes a while.  NSIS must be installed, and makensis must be on the path
	 -->
	<target name="zipInstallerWithJava" description="creates windows installer with java">
		<delete dir="release/installer" />
		<mkdir dir="release/installer" />

		<unzip src="release/triplea_${triplea.version}_all_platforms.zip" dest="release/installer" />
		<unzip src="installer/jre1.6.0_25.zip" dest="release/installer" />
		<move toDir="release/installer/triplea_${triplea.version}/jre">
			<fileset dir="release/installer/jre1.6.0_25" />
		</move>

		<copy file="installer/installer.nsi" toFile="release/installer/installer.nsi" />
		<copy file="triplea_embeded_jre.exe" toFile="release/installer/triplea_${triplea.version}/triplea.exe" overwrite="true" />
		<!-- the bat file doesnt work, since it does not point to the jre -->
		<delete file="release/installer/triplea_${triplea.version}/triplea_windows.bat" />


		<exec executable="makensis" dir="release/installer">
			<arg line="/Dversion=${triplea.version} installer.nsi " />
		</exec>

		<move file="release/installer/triplea_installer.exe" toFile="release/triplea_${triplea.version}_windows_installer_with_java.exe" />
	</target>


	<target name="release" depends="clean,compile,zip,zipInstaller,zipInstallerWithJava,zipSource" description="do a full windows/generic release, this must be done on a windows machine" />


	<!-- must be done after a ant zip has been executed (we dont depend since ant zip
         takes a while.  NSIS must be installed, and makensis must be on the path
	 -->
	<target name="zipInstaller" description="creates windows installer">
		<delete dir="release/installer" />
		<mkdir dir="release/installer" />

		<unzip src="release/triplea_${triplea.version}_all_platforms.zip" dest="release/installer" />

		<copy file="installer/installer.nsi" toFile="release/installer/installer.nsi" />

		<exec executable="makensis" dir="release/installer">
			<arg line="/Dversion=${triplea.version} installer.nsi " />
		</exec>

		<move file="release/installer/triplea_installer.exe" toFile="release/triplea_${triplea.version}_windows_installer.exe" />


	</target>

	<!-- zipSource -->
	<target name="zipSource" description="create a zip file for developers">
		<mkdir dir="release" />

		<zip zipfile="release/triplea_${triplea.version}_source_code_only.zip" compress="true">

			<zipfileset dir="src/" prefix="triplea_${triplea.version}/src/">
				<include name="**/*.java" />
			</zipfileset>

			<zipfileset dir="test/" prefix="triplea_${triplea.version}/test/">
				<include name="**/*.java" />
			</zipfileset>

			<zipfileset dir="junit/" prefix="triplea_${triplea.version}/junit/">
				<include name="excluded.properties" />
			</zipfileset>

			<zipfileset dir="lib/" prefix="triplea_${triplea.version}/lib/">
				<include name="**/*.jar" />
				<include name="**/*.zip" />
			</zipfileset>

			<zipfileset dir="data/" prefix="triplea_${triplea.version}/data/">
				<include name="**/*.dtd" />
				<include name="**/*.gif" />
				<include name="**/*.png" />
				<include name="**/*.jpg" />
				<include name="**/*.jpeg" />
				<include name="**/*.txt" />
				<include name="**/*.xml" />
				<include name="**/*.wav" />
				<include name="**/*.properties" />
				<include name="**/*.html" />
			</zipfileset>

			<zipfileset dir="bin/" prefix="triplea_${triplea.version}/bin/">
				<include name="**/*.bat" />
				<include name="**/*.sh" />
			</zipfileset>

			<zipfileset dir="." prefix="triplea_${triplea.version}/">
				<include name="build.xml" />
				<include name=".ant.properties" />
				<include name="readme.html" />
				<include name="TripleA_RuleBook.pdf" />
				<include name="TripleA_RuleBook.docx" />
				<include name="*.bat" />
				<include name="*.sh" />
				<include name="changelog.txt" />
				<include name="launch4j.config.xml" />
				<include name="launch4j_embedded_jre.config.xml" />
				<include name="Info.plist" />
				<include name="ServerInfo.plist" />
			</zipfileset>

			<zipfileset dir="icons/" prefix="triplea_${triplea.version}/icons/">
				<include name="**/*.png" />
				<include name="**/*.bmp" />
				<include name="**/*.ico" />
				<include name="**/*.icns" />
				<include name="**/*.zip" />
			</zipfileset>

			<zipfileset dir="doc/" prefix="triplea_${triplea.version}/doc/">
				<include name="**/*.*" />
			</zipfileset>

			<zipfileset dir="license/" prefix="triplea_${triplea.version}/license/">
				<include name="gpl.txt" />
			</zipfileset>

			<zipfileset dir="dice_servers/" prefix="triplea_${triplea.version}/dice_servers/">
				<include name="*.properties" />
			</zipfileset>

			<zipfileset dir="images/" prefix="triplea_${triplea.version}/images/">
				<include name="**/*.*" />
			</zipfileset>

			<zipfileset dir="sounds/" prefix="triplea_${triplea.version}/sounds/">
				<include name="**/*.*" />
			</zipfileset>

			<zipfileset dir="maps/" prefix="triplea_${triplea.version}/maps/">
				<include name="**/*.*" />
			</zipfileset>

		</zip>
	</target>


	<!-- javadoc -->
	<target name="javadoc" description="Generate JavaDoc documentation">
		<delete dir="apidoc" />

		<mkdir dir="apidoc" />

		<javadoc destdir="apidoc" Verbose="off">
			<package name="games.strategy.*" />
			<sourcepath>
				<pathelement location="src/" />
			</sourcepath>
		</javadoc>
	</target>

	<!-- test -->
	<target name="test" description="run junit tests">

        <delete dir="${junit-result-dir}" failonerror="false"/>
        <mkdir dir="${junit-result-dir}"/>

        <javac srcdir="${test-src}" destdir="${test-classes}/" debug="true" deprecation="true" target="1.5">
            <classpath refid="test.classpath"/>
        </javac>

        <!-- copy the game.xml file form the test into the test output directory -->
	    <copy todir="${test-classes}">
		<fileset dir="${test-src}" includes="**/*.xml"/>
	    </copy>

		<junit fork="yes" haltonerror="off">
			<classpath refid="test.classpath"/>
			<formatter type="plain" />
            <formatter type="xml" />
			 <batchtest todir="${junit-result-dir}">
             <fileset dir="${test-classes}">
                <filename name="**/*Test.class"/>
            </fileset>
            </batchtest>
		</junit>
	</target>

	<!-- analyze code for bugs. run compile first -->
    <target name="findbugs" description="run findbugs">

        <jar destfile="classes.jar" basedir="classes">
		</jar>

        <pathconvert refid="src.classpath" property="findbugs-path"/>
        <fb:findbugs home="ant/findbugs-1.3.9" excludeFilter="ant/FindbugsExcludeFilter.txt" output="xml" outputFile="fb.xml" timeout="3600000" jvmargs="-Xmx256m">
            <sourcePath path="src"/>
            <auxclasspath path="${findbugs-path}"/>
            <class location="classes.jar"/>
        </fb:findbugs>
    </target>


</project>