-
Notifications
You must be signed in to change notification settings - Fork 10
/
build-midlet.xml
104 lines (88 loc) · 3.18 KB
/
build-midlet.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
<?xml version="1.0"?>
<project name="sample" default="all" basedir=".">
<!-- find wtk -->
<property environment="env"/>
<property name="env.WTK_HOME" value="c:\WTK-2.2" />
<property name="wtk.home" value="${env.WTK_HOME}" />
<echo level="info">wtk.home: ${wtk.home}</echo>
<!-- set wtk parameters -->
<property name="wtk.cldc.version" value="1.1"/>
<property name="wtk.midp.version" value="2.0"/>
<taskdef resource="antenna.properties"/>
<!-- main script -->
<property name="script.name" value="hello"/>
<property name="script.dir" value="examples/lua"/>
<target name="clean">
<delete failonerror="false" dir="build"/>
</target>
<target name="dirs">
<mkdir dir="build"/>
<mkdir dir="build/tool"/>
<mkdir dir="build/classes"/>
</target>
<target name="tools" depends="dirs">
<ant antfile="build.xml" target="bcel-lib"/>
<javac destdir="build/tool" classpath="lib/bcel-5.2.jar">
<src path="src/core"/>
<src path="src/jse"/>
</javac>
</target>
<!-- compile script into lua bytecode -->
<target name="luac" depends="tools">
<java classname="luac" classpath="build/tool">
<arg line="-o build/classes/${script.name}.lua"/>
<arg line="${script.dir}/${script.name}.lua"/>
</java>
</target>
<!-- compile script into java bytecode -->
<target name="luajc" depends="tools">
<java classname="luajc" classpath="build/tool:lib/bcel-5.2.jar">
<arg line="-verbose"/>
<arg line="-srcdir ${script.dir}"/>
<arg line="-destdir build/classes"/>
<arg line="${script.name}.lua"/>
</java>
</target>
<target name="classes" depends="dirs">
<wtkbuild srcdir="src/core" destdir="build/classes" preverify="false"/>
<wtkbuild srcdir="src/jme" destdir="build/classes" preverify="false"/>
<wtkbuild srcdir="examples/jme" destdir="build/classes" preverify="false"/>
</target>
<target name="jad" depends="classes">
<wtkjad jadfile="build/sample.jad"
manifest="build/MANIFEST.MF"
name="LuaJ Sample Midlet"
vendor="luaj.org"
version="0.1" >
<midlet name="LuaJ Sample Midlet" class="SampleMIDlet"/>
<attribute name="script" value="${script.name}"/>
</wtkjad>
</target>
<target name="jar" depends="luajc,classes,jad">
<wtkpackage jarfile="build/sample.jar"
jadfile="build/sample.jad"
obfuscate="false"
preverify="false"
autoversion="true">
<fileset dir="build/classes"/>
</wtkpackage>
</target>
<target name="obf" depends="jar">
<wtkobfuscate jarfile="build/sample.jar"
jadfile="build/sample.jad">
<preserve class="${script.name}"/>
<argument value="-printmapping build/mapping.txt"/>
<argument value="-repackageclasses"/>
<argument value="-allowaccessmodification"/>
<argument value='""'/>
</wtkobfuscate>
</target>
<target name="package" depends="jad,jar,obf">
<wtkpreverify jarfile="build/sample.jar"
jadfile="build/sample.jad"/>
</target>
<target name="run" depends="package">
<wtkrun jadfile="build/sample.jad" device="DefaultColorPhone"/>
</target>
<target name="all" depends="clean,package,run"/>
</project>