-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.xml
207 lines (190 loc) · 7.49 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
<project default="all">
<property file="version.properties"/>
<property environment="env"/>
<property name="jar.name.jme" value="luaj-jme-${version}.jar"/>
<property name="jar.name.jse" value="luaj-jse-${version}.jar"/>
<property name="jar.name.sources" value="luaj-sources-${version}.jar"/>
<import file="wtk.xml"/>
<target name="clean">
<delete dir="build"/>
<delete>
<fileset dir="." includes="luaj-*.jar"/>
</delete>
</target>
<available file="lib/bcel-5.2.jar" property="bcel.lib.exists"/>
<available file="lib/luaj-j2se-1.0.4.jar" property="luaj1.lib.exists"/>
<available file="lib/javacc.jar" property="javacc.lib.exists"/>
<target name="bcel-lib" unless="bcel.lib.exists">
<mkdir dir="lib"/>
<get src="http://archive.apache.org/dist/jakarta/bcel/binaries/bcel-5.2.tar.gz"
dest="lib/bcel-5.2.tar.gz"/>
<gunzip src="lib/bcel-5.2.tar.gz" dest="lib/bcel-5.2.tar"/>
<untar src="lib/bcel-5.2.tar" dest="lib" overwrite="true">
<patternset>
<include name="**/*.jar"/>
</patternset>
<mapper type="flatten"/>
</untar>
</target>
<target name="luaj1-lib" unless="luaj1.lib.exists">
<get src="http://downloads.sourceforge.net/project/luaj/luaj-1.0/1.0.4/luaj-1.0.4.zip"
dest="lib/luaj-1.0.4.zip"/>
<unzip src="lib/luaj-1.0.4.zip" dest="lib" overwrite="true">
<patternset>
<include name="**/*.jar"/>
</patternset>
<mapper type="flatten"/>
</unzip>
</target>
<target name="javacc-lib" unless="javacc.lib.exists">
<get src="https://javacc.dev.java.net/files/documents/17/138912/javacc-5.0.zip"
dest="lib/javacc-5.0.zip"/>
<unzip src="lib/javacc-5.0.zip" dest="lib" overwrite="true">
<patternset>
<include name="**/javacc.jar"/>
</patternset>
<mapper type="flatten"/>
</unzip>
</target>
<target name="parser" depends="javacc-lib">
<java classname="javacc" classpath="lib/javacc.jar">
<arg line="grammar/LuaParser.jj"/>
</java>
</target>
<target name="compile" depends="wtk-or-fail,bcel-lib">
<delete dir="build/jme/src"/>
<delete dir="build/jse/src"/>
<mkdir dir="build/jme/src"/>
<mkdir dir="build/jse/src"/>
<mkdir dir="build/jme/classes"/>
<mkdir dir="build/jse/classes"/>
<copy todir="build/jme/src">
<fileset dir="src/core"/>
<fileset dir="src/jme"/>
<filterchain>
<tokenfilter><replacestring from='"Luaj 0.0"' to='"luaj-jme ${version}"'/></tokenfilter>
</filterchain>
</copy>
<copy todir="build/jse/src">
<fileset dir="src/core"/>
<filterchain>
<tokenfilter><replacestring from='"Luaj 0.0"' to='"luaj-jse ${version}"'/></tokenfilter>
</filterchain>
</copy>
<copy todir="build/jse/src">
<fileset dir="src/jse"/>
<filterchain>
<tokenfilter><replacestring from='<String>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<Stat>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<Exp>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<Name>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<Block>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<TableField>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<VarExp>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<Exp.VarExp>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<Object,String>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<Double,String>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<Integer,Integer>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<Exp,Integer>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<String,byte[]>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<String,Variable>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<LuaValue,String>' to=''/></tokenfilter>
<tokenfilter><replacestring from='<LuaString,String>' to=''/></tokenfilter>
</filterchain>
</copy>
<javac destdir="build/jme/classes" encoding="utf-8" source="1.3" target="1.2" bootclasspathref="wtk-libs"
srcdir="build/jme/src"/>
<javac destdir="build/jse/classes" encoding="utf-8" source="1.3" target="1.3"
classpath="lib/bcel-5.2.jar"
srcdir="build/jse/src"
excludes="**/script/*,**/Lua2Java*,lua*"/>
<javac destdir="build/jse/classes" encoding="utf-8" source="1.5" target="1.5"
classpath="build/jse/classes"
srcdir="build/jse/src"
includes="**/script/*,**/Lua2Java*"/>
<javac destdir="build/jse/classes" encoding="utf-8" source="1.3" target="1.3"
classpath="build/jse/classes"
srcdir="build/jse/src"
includes="lua*"/>
</target>
<target name="jar-jme" depends="compile">
<jar destfile="${jar.name.jme}" basedir="build/jme/classes"/>
</target>
<target name="jar-jse" depends="compile">
<jar destfile="${jar.name.jse}">
<fileset dir="build/jse/classes"/>
<fileset dir="src/jse/">
<include name="META-INF/services/**"/>
</fileset>
</jar>
</target>
<target name="jar-jse-sources" depends="compile">
<jar destfile="${jar.name.sources}">
<fileset dir="build/jme/src"/>
<fileset dir="build/jse/src"/>
</jar>
</target>
<target name="doc">
<delete dir="docs/api"/>
<mkdir dir="docs/api"/>
<javadoc defaultexcludes="yes"
destdir="docs/api"
author="true"
version="true"
use="true"
windowtitle="Luaj API">
<fileset dir="src/core" defaultexcludes="yes" includes="org/luaj/vm2/*.java,org/luaj/vm2/compiler/LuaC.java,org/luaj/vm2/lib/*.java"/>
<fileset dir="src/jse" defaultexcludes="yes" includes="org/luaj/vm2/lib/jse/*.java,org/luaj/vm2/luajc/LuaJC.java"/>
<fileset dir="src/jme" defaultexcludes="yes" includes="org/luaj/vm2/lib/jme/*.java"/>
<doctitle><![CDATA[<h1>Luaj API</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © 2007-2008 Luaj.org. All Rights Reserved.</i>]]></bottom>
<tag name="todo" scope="all" description="To do:"/>
<group title="Core VM" packages="org.luaj.vm.*"/>
<link offline="true" href="http://sourceforge.net/projects/luaj/" packagelistLoc="C:\tmp"/>
<link href="http://sourceforge.net/projects/luaj/"/>
</javadoc>
</target>
<target name="dist" depends="all,doc">
<delete dir="build/luaj-${version}"/>
<mkdir dir="build/luaj-${version}/src"/>
<mkdir dir="build/luaj-${version}/lib"/>
<copy todir="build/luaj-${version}/src">
<fileset dir="src">
<exclude name="src/test/**"/>
<exclude name="**/antlr/**"/>
<exclude name="**/lst/**"/>
<exclude name="**/JavaCodeGenerator.java"/>
<exclude name="**/LuaJCompiler.java"/>
</fileset>
</copy>
<copy todir="build/luaj-${version}/test">
<fileset dir="test"/>
</copy>
<copy todir="build/luaj-${version}/examples">
<fileset dir="examples"/>
</copy>
<copy todir="build/luaj-${version}/lib">
<fileset dir=".">
<include name="*-${version}.jar"/>
</fileset>
</copy>
<copy todir="build/luaj-${version}">
<fileset dir=".">
<include name="build.xml"/>
<include name="build-coverage.xml"/>
<include name="version.properties"/>
<include name="wtk.xml"/>
<include name="README.html"/>
<include name="names.csv"/>
<include name=".classpath"/>
<include name=".project"/>
</fileset>
</copy>
<copy todir="build/luaj-${version}/docs">
<fileset dir="docs"/>
</copy>
<zip destfile="luaj-${version}.zip"
basedir="build" includes="luaj-${version}/**"/>
</target>
<target name="all" depends="clean,jar-jme,jar-jse,jar-jse-sources"/>
</project>