-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
321 lines (286 loc) · 11.9 KB
/
build.xml
File metadata and controls
321 lines (286 loc) · 11.9 KB
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
<project name="Game" default="test" basedir=".">
<description>Diamond Crush build file</description>
<!-- base paths -->
<property name="root" location="."/>
<property name="src" location="${root}/src"/>
<property name="testSrc" location="${root}/tests/src"/>
<property name="bin" location="${root}/bin"/>
<property name="testBin" location="${bin}/tests"/>
<property name="lib" location="${root}/lib"/>
<property name="jar" location="${lib}/jar"/>
<property name="checks" location="${root}/checks"/>
<property name="dist" location="${root}/dist"/>
<property name="data" location="${root}/data"/>
<property name="docs" location="${root}/docs"/>
<property name="reports" location="${root}/reports"/>
<!-- paths for code coverage and distribution -->
<property name="instrumented" location="${bin}/instrumented"/>
<property name="final" location="${dist}/DiamondCrush/DiamondCrush"/>
<property name="final-root" location="${dist}/DiamondCrush"/>
<property name="osx-root" location="${dist}/osx" />
<property name="osx" location="${dist}/osx/Diamond Crush.app" />
<!-- jar and native libraries -->
<property name="lwgl.jar" location="${jar}/lwjgl.jar"/>
<property name="lwgl.devil.jar" location="${jar}/lwjgl_devil.jar"/>
<property name="lwgl.util.jar" location="${jar}/lwjgl_util.jar"/>
<property name="trb.jar" location="${jar}/trb.jar"/>
<property name="jorbis.jar" location="${jar}/jorbis-0.0.15.jar"/>
<property name="jogg.jar" location="${jar}/jogg-0.0.7.jar"/>
<property name="lib/win32" location="${lib}/win32"/>
<property name="lib/linux" location="${lib}/linux"/>
<property name="lib/linux64" location="${lib}/linux64"/>
<property name="lib/macos" location="${lib}/macos"/>
<property name="library.path"
location="${lib/linux}${path.separator}${lib/macos}${path.separator}${lib/win32}"/>
<!-- classpaths -->
<path id="classpath.lwjgl">
<pathelement location="${lwgl.jar}"/>
<pathelement location="${lwgl.devil.jar}"/>
<pathelement location="${lwgl.util.jar}"/>
<pathelement location="${trb.jar}"/>
</path>
<path id="classpath.dev">
<path refid="classpath.lwjgl"/>
<pathelement location="${bin}/debug"/>
<pathelement location="${lib}/junit.jar"/>
<pathelement location="${lib}/jdepend-2.9.jar"/>
<pathelement location="${lib}/cobertura/cobertura.jar"/>
</path>
<path id="classpath.release">
<path refid="classpath.lwjgl"/>
<pathelement location="${bin}/release"/>
</path>
<fileset id="test.fileset" dir="${testBin}/debug">
<include name="**/Test*.class"/>
<exclude name="**/*Test*$$*"/>
</fileset>
<!-- jars for ant tasks -->
<taskdef resource="com/roxes/tools/ant/taskdefs.properties"
classpath="${lib}/roxes-ant-tasks-1.2-2004-01-30.jar"/>
<taskdef resource="checkstyletask.properties"
classpath="${lib}/checkstyle/checkstyle-all-4.1.jar"/>
<taskdef resource="tasks.properties"
classpath="lib/cobertura/cobertura.jar"/>
<!-- clean project -->
<target name="clean" description="Clean the directory trees">
<delete dir="${bin}/debug"/>
<delete dir="${bin}/release"/>
<delete dir="${testBin}/debug"/>
<delete dir="${testBin}/release"/>
<delete dir="${reports}"/>
<delete dir="${instrumented}"/>
<delete file="${root}/bug-report.txt"/>
<delete file ="${root}/cobertura.ser"/>
<delete>
<fileset dir="${root}">
<include name="hs_err_*"/>
</fileset>
</delete>
<delete>
<fileset dir="${dist}">
<include name="DiamondCrush-*"/>
</fileset>
</delete>
</target>
<!-- checkstyle task -->
<target name="checkstyle" depends="clean">
<mkdir dir="${reports}"/>
<checkstyle config="${checks}/metrics.xml"
failureProperty="checkstyle.failure" failOnViolation="true">
<formatter type="xml" tofile="${reports}/checkstyle_report.xml"/>
<formatter type="plain"/>
<fileset dir="${src}">
<include name="**/*.java"/>
<exclude name="**/ignore/*"/>
</fileset>
<fileset dir="${testSrc}">
<include name="**/*.java"/>
<exclude name="**/ignore/*"/>
</fileset>
</checkstyle>
</target>
<!-- compilation target -->
<target name="compile-debug" depends="checkstyle"
description="Compile the java code from ${src} into ${bin}">
<mkdir dir="${bin}/debug"/>
<mkdir dir="${testBin}/debug"/>
<javac
destdir="${bin}/debug"
debug="on"
excludes="it/diamonds/tests/ignore/**">
<src path="${src}"/>
<src path="${testSrc}"/>
<classpath refid="classpath.dev"/>
</javac>
<javac
srcdir="${testSrc}"
destdir="${testBin}/debug"
debug="on"
excludes="it/diamonds/tests/ignore/**">
<classpath refid="classpath.dev"/>
</javac>
</target>
<target name="compile-release" depends="checkstyle"
description="Compile the java code from ${src} into ${bin}">
<mkdir dir="${bin}/release"/>
<javac
optimize="yes"
destdir="${bin}/release"
debug="off">
<src path="${src}"/>
<classpath refid="classpath.release"/>
</javac>
<delete dir="${bin}/release/it/diamonds/tests"/>
</target>
<!-- unit testing task -->
<target name="test" depends="compile-debug">
<junit haltonfailure="yes" printsummary="off" fork="yes" forkmode="once" dir="${root}">
<classpath refid="classpath.dev"/>
<formatter type="xml"/>
<formatter usefile="false" type="brief"/>
<jvmarg value="-Djava.library.path=${library.path}"/>
<batchtest fork="yes" todir="${reports}">
<fileset refid="test.fileset"/>
</batchtest>
</junit>
</target>
<!-- test coverage instrumentation task -->
<target name="instrument" depends="compile-debug">
<cobertura-instrument todir="${instrumented}">
<fileset dir="${bin}/debug">
<include name="it/diamonds/**/*.class"/>
<exclude name="it/diamonds/tests/**/*.class"/>
</fileset>
</cobertura-instrument>
</target>
<target name="cover-test" depends="instrument">
<mkdir dir="${reports}/instrumented"/>
<junit haltonfailure="yes" printsummary="off" fork="yes" forkmode="once" dir="${root}">
<jvmarg value="-Djava.library.path=${library.path}"/>
<formatter type="xml"/>
<formatter usefile="false" type="brief"/>
<classpath location="${instrumented}"/>
<classpath refid="classpath.dev"/>
<batchtest fork="yes" todir="${reports}/instrumented">
<fileset refid="test.fileset"/>
</batchtest>
</junit>
</target>
<target name="cover-report" depends="cover-test">
<cobertura-report format="html" destdir="${reports}/coverage" srcdir="${src}"/>
</target>
<!-- test and source distribution task -->
<target name="test-dist-source" depends="clean, test" description="Create the distribution directory">
<tstamp/>
<mkdir dir="${dist}"/>
<zip destfile="${dist}/DiamondCrush-source-${DSTAMP}.zip">
<fileset dir="${src}"/>
<fileset dir="${testSrc}"/>
</zip>
</target>
<!-- JDepend task -->
<target name="jdepend">
<jdepend format="xml" outputfile="${reports}/jdepend/jdepend-report.xml">
<exclude name="java.*"/>
<exclude name="javax.*"/>
<classpath refid="classpath.dev"/>
<classpath location="${src}" />
</jdepend>
<style basedir="${reports}" destdir="jdepend"
includes="jdepend-report.xml"
style="${ant.home}/etc/jdepend.xsl" />
</target>
<!-- distribution task -->
<target name="dist" depends="test-dist-source, cover-report, compile-release" description="Create the distribution directory">
<tstamp/>
<mkdir dir="${dist}/common"/>
<jar destfile="${dist}/DiamondCrush.jar" basedir="${bin}/release">
<manifest>
<attribute name="Main-Class" value="it.diamonds.Game"/>
<attribute name="Class-Path" value="lib/jar/lwjgl.jar lib/jar/lwjgl_devil.jar lib/jar/lwjgl_util.jar lib/jar/trb.jar lib/jar/jorbis-0.0.15.jar lib/jar/jogg-0.0.7.jar"/>
</manifest>
</jar>
<!-- common files -->
<copy todir="${dist}/common/data">
<fileset dir="${data}">
<exclude name="diamond.png"/>
<exclude name="TestGameConfig"/>
<exclude name="textureTest.png"/>
</fileset>
</copy>
<copy file="${docs}/Readme.txt" todir="${dist}/common"/>
<copy file="${docs}/License.txt" todir="${dist}/common"/>
<copy todir="${dist}/common/lib/jar">
<fileset dir="${jar}"/>
</copy>
<!-- Windows -->
<jstub archive="${dist}/DiamondCrush.jar" mode="win32-console" output="${dist}/DiamondCrush.exe">
<execute>java -Djava.library.path=lib/win32 -Dorg.lwjgl.opengl.Display.allowSoftwareOpenGL=true -jar DiamondCrush.exe</execute>
</jstub>
<mkdir dir="${final}"/>
<copy todir="${final}/lib/win32">
<fileset dir="${lib/win32}"/>
</copy>
<copy todir="${final}/">
<fileset dir="${dist}/common"/>
</copy>
<copy file="${dist}/DiamondCrush.exe" todir="${final}"/>
<zip destfile="${dist}/DiamondCrush-Win32-${DSTAMP}.zip">
<fileset dir="${final-root}"/>
</zip>
<delete dir="${final-root}"/>
<!-- Linux -->
<mkdir dir="${final}"/>
<copy file="${root}/DiamondCrush" todir="${final}"/>
<copy file="${docs}/openalrc.example" todir="${dist}/common/docs"/>
<copy file="${docs}/asoundrc.example" todir="${dist}/common/docs"/>
<copy todir="${final}/lib/linux">
<fileset dir="${lib/linux}"/>
</copy>
<copy todir="${final}/">
<fileset dir="${dist}/common"/>
</copy>
<copy file="${dist}/DiamondCrush.jar" todir="${final}"/>
<zip destfile="${dist}/DiamondCrush-Linux-${DSTAMP}.zip">
<fileset dir="${final-root}"/>
</zip>
<delete dir="${final-root}"/>
<!-- Linux 64 -->
<mkdir dir="${final}"/>
<copy file="${root}/DiamondCrush" tofile="${final}/DiamondCrush64"/>
<copy file="${docs}/openalrc.example" todir="${dist}/common/docs"/>
<copy file="${docs}/asoundrc.example" todir="${dist}/common/docs"/>
<copy todir="${final}/lib/linux64">
<fileset dir="${lib/linux64}"/>
</copy>
<copy todir="${final}/">
<fileset dir="${dist}/common"/>
</copy>
<copy file="${dist}/DiamondCrush.jar" todir="${final}"/>
<zip destfile="${dist}/DiamondCrush-Linux64-${DSTAMP}.zip">
<fileset dir="${final-root}"/>
</zip>
<delete dir="${final-root}"/>
<!-- Mac OS X -->
<copy todir="${osx}">
<fileset dir="${dist}/osx-base/"/>
</copy>
<copy file="${dist}/DiamondCrush.jar" todir="${osx}/Contents/Resources/Java/"/>
<copy todir="${osx}/Contents/Resources/Java/">
<fileset dir="${dist}/common"/>
</copy>
<copy todir="${osx}/Contents/Resources/Java/lib/macos">
<fileset dir="${lib/macos}"/>
</copy>
<zip destfile="${dist}/DiamondCrush-MacOSX-${DSTAMP}.zip">
<fileset dir="${osx-root}"/>
</zip>
<delete dir="${final-root}"/>
<delete dir="${dist}/common"/>
<delete dir="${dist}/osx"/>
<delete dir="${dist}/DiamondCrush"/>
<delete file="${dist}/DiamondCrush.exe"/>
<delete file="${dist}/DiamondCrush.sh"/>
<delete file="${dist}/DiamondCrush.jar"/>
</target>
</project>