-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
484 lines (429 loc) · 14.9 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
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Header$ -->
<!--
This build.xml file is documented in manual/build/ .
-->
<project name="Jill" default="compile" basedir=".">
<!--
The buildprop.local is intended to be written by users
(maintainers and builders) if needed. It is not supplied as part of
the managed sources, and Ant will not complain if it is not present.
It is intended to be used so that properties that define the
location of .jar files, etc, can be overriden.
-->
<property file="buildprop.local" />
<!--
Properties that you might want to change. These properties can be
overridden by defining them in a file called buildprop.local (see
above)
j2meunit - location of j2meunit.jar file.
mpp - location of mpowerplayer sdk directory (for OS X)
rim - location of RIM BlackBerry JDE
sun-wtk - location of Sun Java Wireless Toolkit
checkstyle - location of checkstyle-all-4.1.jar
-->
<!--
The default definitions for these properties are given below. If
you change these defaults, please also update the documentation in
manual/build/
-->
<property name="j2meunit"
value="lib/j2meunit.jar" />
<property name="mpp"
value="/usr/local/mpp-sdk" />
<property name="rim"
value="C:/Program Files/Research In Motion/BlackBerry JDE 4.1.0" />
<property name="sun-wtk"
value="/home/markt/software/javas/j2me-2.2" />
<property name="checkstyle"
value="lib/checkstyle-all-4.1.jar" />
<!-- define exactly one property of the form platform.* -->
<condition property="platform.macosx">
<and>
<os family="mac" />
<os family="unix" />
</and>
</condition>
<condition property="platform.win">
<os family="windows" />
</condition>
<condition property="platform.linux">
<and>
<os family="unix" />
<not><os family="mac" /></not>
</and>
</condition>
<!-- now pick a JME SDK to use -->
<condition property="which.jme" value="mpp">
<isset property="platform.macosx" />
</condition>
<condition property="which.jme" value="rim">
<isset property="platform.win" />
</condition>
<condition property="which.jme" value="sun-wtk">
<isset property="platform.linux" />
</condition>
<!-- Standard java classes, only needed by mpp -->
<!--
Note that recent versions of Mac OS X 10.4 come with Java 1.5 as
default. The classes.jar file for Java 1.5 cannot be preverified by
the mpp preverify tool. Therefore we explicitly name the Java 1.4
classes.jar file.
-->
<!-- :todo: is there a better way of doing this? -->
<condition property="java.classes.jar"
value="/System/Library/Frameworks/JavaVM.framework/Versions/1.4/Classes/classes.jar">
<isset property="platform.macosx" />
</condition>
<!-- JME jar files when using MPP -->
<property name="mpp.jar"
value="${mpp}/cldc.jar:${mpp}/midp.jar:${java.classes.jar}" />
<!-- JME jar files when using RIM -->
<property name="rim.jar" value="${rim}/lib/net_rim_api.jar" />
<!-- JME jar files when using Sun WTK -->
<property name="sun-wtk.jar" value="${sun-wtk}/lib/cldcapi11.jar:${sun-wtk}/lib/midpapi20.jar" />
<!-- All required JME jar files in classpath syntax -->
<condition property="jme.jar" value="${mpp.jar}">
<equals arg1="${which.jme}" arg2="mpp" />
</condition>
<condition property="jme.jar" value="${rim.jar}">
<equals arg1="${which.jme}" arg2="rim" />
</condition>
<condition property="jme.jar" value="${sun-wtk.jar}">
<equals arg1="${which.jme}" arg2="sun-wtk" />
</condition>
<!-- Location of preverify tool -->
<!-- if using MPP (on OS X) then assume an absolute location ... -->
<condition property="preverify" value="${mpp}/osx/preverify/preverify">
<equals arg1="${which.jme}" arg2="mpp" />
</condition>
<!-- ... otherwise assume we can find it on the path -->
<property name="preverify" value="preverify" />
<target name="sysinfo">
<echo message="os.name: ${os.name}" />
<echo message="os.arch: ${os.arch}" />
<echo message="os.version: ${os.version}" />
<echo message="ant.version: ${ant.version}" />
<echo message="ant.java.version: ${ant.java.version}" />
<echo message="java.version: ${java.version}" />
</target>
<target name="prop">
<echoproperties />
</target>
<target name="checkstyle-task">
<!-- loads the definition for the checkstyle task. It's a target so
that the style target can depend upon it. When the style target is
not required, the checkstyle task won't be loaded, and Ant won't
complain about not being able to find the file.
-->
<taskdef resource="checkstyletask.properties"
classpath="${checkstyle}" />
</target>
<target name="style" depends="checkstyle-task">
<checkstyle config="code/codingstyle.xml">
<fileset dir="code" includes="**/*.java" />
<formatter type="plain" />
<formatter type="plain" toFile="style.txt" />
</checkstyle>
</target>
<target name="bin-dir">
<mkdir dir="bin" />
</target>
<target name="load"
depends="cod"
description="Loads cod file onto USB-attached BlackBerry device" >
<exec executable="javaloader" >
<arg value="-u" />
<arg value="load" />
<arg value="bin/jilit.cod" />
</exec>
<exec executable="javaloader" >
<arg value="-u" />
<arg value="load" />
<arg value="bin/jilishell.cod" />
</exec>
</target>
<target name="cod"
depends="bin-dir,jar"
description="Builds BlackBerry code files in bin/" >
<exec executable="rapc" dir="bin" >
<arg value="import=${rim}/lib/net_rim_api.jar" />
<arg value="-midlet" />
<arg value="codename=jilit" />
<arg value="jilit.jar" />
</exec>
<exec executable="rapc" dir="bin" >
<arg value="import=${rim}/lib/net_rim_api.jar" />
<arg value="-midlet" />
<arg value="codename=speed" />
<arg value="speed.jar" />
</exec>
<exec executable="rapc" dir="bin" >
<arg value="import=${rim}/lib/net_rim_api.jar" />
<arg value="-midlet" />
<arg value="codename=jilishell" />
<arg value="jilishell.jar" />
</exec>
</target>
<target name="jar"
depends="bin-dir,preverify"
description="Builds some popular jar files in bin/" >
<!--
Gather files for jilit. Take everything we can get.
-->
<copy todir="prejar/jilit" >
<fileset dir="preverified" />
<fileset dir="test-preverified" />
</copy>
<jar
destfile="bin/jilit.jar"
basedir="prejar/jilit"
manifest="test/metest-manifest"
/>
<!--
Gather files for SpeedMIDlet. Take everything. (lazy but ok)
-->
<copy todir="prejar/speed" >
<fileset dir="preverified" />
<fileset dir="test-preverified" />
</copy>
<jar
destfile="bin/speed.jar"
basedir="prejar/speed"
manifest="test/speed-manifest"
/>
<!--
Gather files for JiliShell, copying just what we need and no more.
So that its file size can be used as a measure of how big a jar
with Jill in is.
-->
<copy todir="prejar/jilishell" >
<fileset dir="preverified" />
<fileset dir="test-preverified"
includes="**/JiliShell*.class" />
</copy>
<jar
destfile="bin/jilishell.jar"
basedir="prejar/jilishell"
manifest="test/jilishell-manifest"
/>
</target>
<!--
Runs preverifier on compiled/ and test-compiled/ directories.
The results go into separate directories.
-->
<target name="preverify" depends="include-extra,compile,compile-test" >
<!-- preverify compiled/ into preverified/ -->
<exec executable="${preverify}" >
<arg value="-classpath" />
<arg value="${jme.jar}" />
<arg value="-d" />
<arg value="preverified" />
<arg value="compiled" />
</exec>
<!-- preverify test-compiled/ into test-preverified/ -->
<exec executable="${preverify}" >
<arg value="-classpath" />
<arg value="${jme.jar}${path.separator}preverified" />
<arg value="-d" />
<arg value="test-preverified" />
<arg value="test-compiled" />
</exec>
<!-- copy non-class files (resources) as well. -->
<copy todir="preverified" >
<fileset dir="compiled">
<exclude name="**/*.class" />
</fileset>
</copy>
<copy todir="test-preverified" >
<fileset dir="test-compiled">
<exclude name="**/*.class" />
</fileset>
</copy>
</target>
<!-- places additional materials alongside compiled class files -->
<target name="include-extra" depends="compiled-dir,test-compiled-dir" >
<exec executable="jar" dir="test-compiled" >
<arg value="xf" />
<arg value="../${j2meunit}" />
</exec>
<copy todir="test-compiled">
<fileset dir="test">
<!-- Auxiliary lua (source and binary) files for the tests -->
<include name="**/*.lua" />
<include name="**/*.luc" />
<!-- Entire libs sub-directory is used by PackageLibTest -->
<include name="**/libs/**" />
</fileset>
</copy>
</target>
<target name="compiled-dir">
<mkdir dir="compiled" />
</target>
<target name="compile"
depends="compiled-dir"
description="Compiles java code from code/ to compiled/" >
<javac destdir="compiled" srcdir="code"
debug="true"
bootclasspath="${jme.jar}"
classpath="${j2meunit}"
source="1.2"
target="1.1"
/>
</target>
<target name="compiled-gnone-dir">
<mkdir dir="compiled-gnone" />
</target>
<!--
Compiles Java sources into compiled-gnone using the -g:none option.
The resulting class files have no debug information, so are smaller.
-->
<target name="compile-gnone"
depends="compiled-gnone-dir" >
<javac destdir="compiled-gnone" srcdir="code"
debug="off"
bootclasspath="${jme.jar}"
classpath="${j2meunit}"
source="1.2"
target="1.1"
/>
</target>
<target name="test-compiled-dir">
<mkdir dir="test-compiled" />
<mkdir dir="test-compiled-se" />
</target>
<target name="compile-test"
depends="test-compiled-dir,compile" >
<javac destdir="test-compiled" srcdir="test"
debug="true"
classpath="${jme.jar}:${j2meunit}:compiled"
source="1.2"
target="1.1"
/>
<!-- move JSE-only files elsewhere so that they don't break in the
preverify stage
-->
<move todir="test-compiled-se">
<fileset dir="test-compiled">
<include name="**/Luac.*" />
<include name="**/Luai.*" />
<include name="**/*SE.*" />
</fileset>
</move>
</target>
<target name="clean"
description="Cleans intermediate build products (not bin/)" >
<delete dir="compiled" quiet="true" />
<delete dir="test-compiled" quiet="true" />
<delete dir="test-compiled-se" quiet="true" />
<delete dir="preverified" quiet="true" />
<delete dir="test-preverified" quiet="true" />
<delete dir="prejar" quiet="true" />
</target>
<target name="doc"
description="Creates documentation in javadoc/" >
<javadoc destdir="javadoc"
classpath="${j2meunit};${jme.jar}"
access="public" >
<fileset dir="code" />
</javadoc>
<javadoc destdir="javadoc-private"
classpath="${j2meunit};${jme.jar}"
access="private" >
<fileset dir="code" />
</javadoc>
</target>
<target name="test" depends="compile,compile-test,include-extra"
description="Runs j2meunit tests using j2meunit.textui.TestRunner" >
<java fork="yes"
classname="j2meunit.textui.TestRunner"
classpath="compiled:test-compiled:${j2meunit}">
<arg value="mnj.lua.METest" />
</java>
</target>
<target name="a-test" depends="compile,compile-test,include-extra"
description="Runs acceptance tests using j2meunit.textui.TestRunner" >
<java fork="yes"
classname="j2meunit.textui.TestRunner"
classpath="compiled:test-compiled:${j2meunit}">
<arg value="mnj.lua.AcceptTest" />
</java>
</target>
<target name="life-test" depends="compile,compile-test,include-extra"
description="Runs the life.lua tests using j2meunit.textui.TestRunner" >
<java fork="yes"
classname="j2meunit.textui.TestRunner"
classpath="compiled:test-compiled:${j2meunit}">
<arg value="mnj.lua.LifeTest" />
</java>
</target>
<!--
Runs some of the advanced acceptance tests file by file so that
errors in one file do not preclude execution of the next.
-->
<target name="old-advanced-test" depends="compile,compile-test,include-extra"
>
<java fork="yes"
classname="j2meunit.textui.TestRunner"
classpath="compiled:test-compiled:${j2meunit}">
<!--
big.lua requires this much memory because it creates a string of
size 32MiB and then tries to concatenate it.
-->
<jvmarg value="-Xmx256M" />
<arg value="mnj.lua.AdvancedTest" />
</java>
</target>
<target name="advanced-test"
depends="compile,compile-test,include-extra"
description="Runs the advanced acceptance tests" >
<java fork="yes"
classname="mnj.lua.Luai"
classpath="compiled:test-compiled:test-compiled-se" >
<jvmarg value="-Xmx256M" />
<arg value="test/mnj/lua/all.lua" />
</java>
</target>
<target name="speed" depends="compile,compile-test,include-extra"
description="Runs a bogus speed test using JSE" >
<java fork="yes"
classname="mnj.lua.Speed"
classpath="compiled:test-compiled:test-compiled-se">
<!--
Sun JDK JVM option to disable HotSpot. Attempting to give a
more realistic performance ratio.
-->
<jvmarg value="-Xint" />
</java>
</target>
<target name="multitask" depends="compile,compile-test,include-extra"
description="Runs the MultiTask example using JSE" >
<java fork="yes"
classname="mnj.lua.MultiTask"
classpath="compiled:test-compiled" />
</target>
<target name="hook-test" depends="compile,compile-test,include-extra"
description="Runs the HookTest example using JSE" >
<java fork="yes"
classname="mnj.lua.HookTest"
classpath="compiled:test-compiled" />
</target>
<!-- Test to measure speed of some primitive table operations -->
<target name="table-test" depends="compile,compile-test,include-extra">
<java fork="yes"
classname="mnj.lua.Luai"
classpath="compiled:test-compiled:test-compiled-se">
<arg value="test/mnj/lua/getn.lua" />
</java>
<java fork="yes"
classname="mnj.lua.Luai"
classpath="compiled:test-compiled:test-compiled-se">
<arg value="test/mnj/lua/getnmore.lua" />
</java>
<java fork="yes"
classname="mnj.lua.Luai"
classpath="compiled:test-compiled:test-compiled-se">
<arg value="test/mnj/lua/putnum.lua" />
</java>
</target>
</project>