-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
327 lines (294 loc) · 11.7 KB
/
Copy pathbuild.xml
File metadata and controls
327 lines (294 loc) · 11.7 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
322
323
324
325
326
327
<?xml version="1.0" encoding="UTF-8"?>
<project name="AdaLogo" default="build" basedir=".">
<!-- basic path properties -->
<property name="src.dir" value="src"/>
<property name="bin.dir" value="bin"/>
<!-- path to packages -->
<property name="adalogo.dir" value="adalogo"/>
<property name="gui.dir" value="adalogo/gui"/>
<property name="lang.dir" value="adalogo/lang"/>
<property name="examples.dir" value="examples"/>
<property name="images.dir" value="images"/>
<property name="jjt.file" value="Lang.jjt"/>
<property name="jj.file" value="Lang.jj"/>
<property name="main.class" value="adalogo.AdaLogo"/>
<!-- release properties -->
<property name="release.dir" value="release"/>
<property name="html.file" value="adalogo.html"/>
<property name="stylesheet.file" value="style.css"/>
<property name="jar.file" value="adalogo.jar"/>
<property name="jar.sign.alias" value="sopra2005"/>
<property name="jar.sign.storepass" value="sopra2005"/>
<property name="jar.sign.file" value="adalogo.key"/>
<property name="webstart.file" value="adalogo.jnlp"/>
<property name="source.file" value="adalogosource.zip"/>
<property name="web.dir" value="${user.home}/WWW/adalogo_dev"/>
<!-- path to doc -->
<property name="doc.dir" value="doc"/>
<!-- build jjtree, javacc and javac -->
<target name="build" depends="init">
<antcall target="call-jjtree"/>
<antcall target="call-javacc"/>
<antcall target="call-javac"/>
</target>
<!-- jjtree, needs jjt file argument -->
<target name="call-jjtree" if="jjt.file" depends="init">
<jjtree
target="${src.dir}/${lang.dir}/${jjt.file}"
outputdirectory="${src.dir}/${lang.dir}"
javacchome="${javacchome}"
/>
</target>
<!-- javacc, needs jj file argument -->
<target name="call-javacc" if="jj.file" depends="init">
<javacc
target="${src.dir}/${lang.dir}/${jj.file}"
outputdirectory="${src.dir}/${lang.dir}"
javacchome="${javacchome}"
/>
</target>
<!-- javac, needs srcdir and destdir, otherwise uses default -->
<target name="call-javac" depends="init">
<condition property="javac.srcdir" value="${src.dir}">
<not>
<isset property="javac.srcdir"/>
</not>
</condition>
<condition property="javac.destdir" value="${bin.dir}">
<not>
<isset property="javac.destdir"/>
</not>
</condition>
<javac
srcdir="${javac.srcdir}"
destdir="${javac.destdir}"
debug="false"
debuglevel="lines,vars,source"
/>
<!-- copy extra "packages" -->
<copy todir="${javac.destdir}/${examples.dir}">
<fileset dir="${javac.srcdir}/${examples.dir}"/>
</copy>
<copy todir="${javac.destdir}/${images.dir}">
<fileset dir="${javac.srcdir}/${images.dir}"/>
</copy>
</target>
<!-- build, then run as applet via html file -->
<target name="run-applet" depends="init,build">
<copy file="${src.dir}/testapplet.html" todir="${bin.dir}"/>
<exec executable="appletviewer">
<arg value="${bin.dir}/testapplet.html"/>
</exec>
</target>
<!-- build, then run as application -->
<target name="run-application" depends="init,build">
<java
classname="${main.class}"
classpath="${bin.dir}"
fork="true"
dir="${bin.dir}"
/>
<!--
<java
classname="${main.class}"
fork="true"
dir="${bin.dir}"
/>
-->
</target>
<!-- release all this stuff as jar with html file -->
<target name="release" depends="init,clean-release,call-jjtree,call-javacc">
<mkdir dir="${release.dir}"/>
<!-- prepare timestamp properties -->
<tstamp>
<format
property="BUILDTIME"
pattern="yyyy-MM-dd HH:mm"
locale="de"
/>
</tstamp>
<!-- copy source to release dir -->
<copy todir="${release.dir}/${src.dir}">
<fileset dir="${src.dir}"/>
<!-- insert build time while copying -->
<filterset>
<filter token="BUILDTIME" value="${BUILDTIME}"/>
</filterset>
</copy>
<!-- compile stuff in release dir -->
<antcall target="call-javac">
<param name="javac.srcdir" value="${release.dir}/${src.dir}"/>
<param name="javac.destdir" value="${release.dir}"/>
</antcall>
<!-- create jar (including source files) -->
<jar destfile="${release.dir}/${jar.file}">
<fileset dir="${release.dir}">
<include name="${adalogo.dir}/**"/>
<include name="${examples.dir}/**"/>
<include name="${images.dir}/**"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
<signjar
jar="${release.dir}/${jar.file}"
alias="${jar.sign.alias}"
storepass="${jar.sign.storepass}"
keystore="${release.dir}/${jar.sign.file}"
/>
<!-- create source zip -->
<zip
destfile="${release.dir}/${source.file}"
basedir="${release.dir}/${src.dir}"
/>
<!-- copy jar and html file to ~/WWW/adalogo -->
<copy todir="${web.dir}" overwrite="true">
<fileset file="${release.dir}/${html.file}"/>
<fileset file="${release.dir}/${stylesheet.file}"/>
<!-- insert build time while copying -->
<filterset>
<filter token="BUILDTIME" value="${BUILDTIME}"/>
</filterset>
</copy>
<copy todir="${web.dir}" overwrite="true">
<fileset file="${release.dir}/${webstart.file}"/>
<fileset file="${release.dir}/${jar.file}"/>
<fileset file="${release.dir}/${source.file}"/>
</copy>
<copy todir="${web.dir}" overwrite="true">
<fileset dir=".">
<include name="**/${doc.dir}/**"/>
</fileset>
</copy>
<!-- chmod so world can view -->
<chmod perm="755">
<dirset dir="${web.dir}"/>
</chmod>
<chmod perm="644">
<fileset dir="${web.dir}"/>
</chmod>
<echo message="files copied to ${web.dir}"/>
</target>
<!-- create documentation using javadoc and jjdoc -->
<target name="doc" depends="init,clean-doc,call-jjtree,call-javacc">
<antcall target="doc-javadoc"/>
<antcall target="doc-jjdoc"/>
</target>
<!-- create javadoc -->
<target name="doc-javadoc" depends="init,call-jjtree,call-javacc">
<mkdir dir="${doc.dir}"/>
<javadoc
sourcepath="${src.dir}"
destdir="${doc.dir}"
packagenames="${adalogo.dir}.*"
use="true"
/>
<echo message="javadoc created in ${doc.dir}"/>
</target>
<!-- create jjdoc -->
<target name="doc-jjdoc" depends="init,call-jjtree,call-javacc">
<mkdir dir="${doc.dir}"/>
<jjdoc
target="${src.dir}/${lang.dir}/${jj.file}"
outputfile="${doc.dir}/${jj.file}.html"
javacchome="${javacchome}"
/>
<echo message="jjdoc created in ${doc.dir}"/>
</target>
<!-- clean all -->
<target name="clean">
<antcall target="clean-build"/>
<antcall target="clean-javacc"/>
<antcall target="clean-release"/>
<antcall target="clean-doc"/>
</target>
<!-- delete bin dir -->
<target name="clean-build">
<delete includeemptydirs="true">
<fileset dir="${bin.dir}" includes="**/*"/>
</delete>
</target>
<!-- delete jjtree/javacc stuff -->
<target name="clean-javacc">
<!-- only listed files will be deleted -->
<delete includeemptydirs="true">
<fileset dir="${src.dir}/${lang.dir}">
<!-- delete all AST*.java files -->
<include name="AST*.java"/>
<!-- delete other default jjtree/javacc files -->
<include name="JJTLangState.java"/>
<include name="Lang.java"/>
<include name="LangConstants.java"/>
<include name="LangTokenManager.java"/>
<include name="LangTreeConstants.java"/>
<include name="LangVisitor.java"/>
<include name="Node.java"/>
<include name="ParseException.java"/>
<include name="SimpleCharStream.java"/>
<include name="Token.java"/>
<include name="TokenMgrError.java"/>
<include name="Lang.jj"/>
<!-- comment out files which should not be deleted
<include name="SimpleNode.java"/>
-->
</fileset>
</delete>
</target>
<!-- delete release stuff -->
<target name="clean-release">
<delete file="${release.dir}/${jar.file}"/>
<delete file="${release.dir}/${source.file}"/>
<delete dir="${release.dir}/${src.dir}"/>
<delete dir="${release.dir}/${adalogo.dir}"/>
<delete dir="${release.dir}/${examples.dir}"/>
<delete dir="${release.dir}/${images.dir}"/>
</target>
<!-- delete doc -->
<target name="clean-doc">
<delete dir="${doc.dir}"/>
</target>
<target name="init" unless="javacchome">
<!-- check for javacc in base dir -->
<condition property="javacchome" value="javacc-3.2">
<available file="javacc-3.2/bin/lib/javacc.jar"/>
</condition>
<!-- check for javacc in /temp -->
<condition property="javacchome" value="/temp/javacc-3.2">
<available file="/temp/javacc-3.2/bin/lib/javacc.jar"/>
</condition>
<condition property="javacchome" value="/temp/${user.name}/javacc-3.2">
<available file="/temp/${user.name}/javacc-3.2/bin/lib/javacc.jar"/>
</condition>
<!-- check for javacc in /tmp -->
<condition property="javacchome" value="/tmp/javacc-3.2">
<available file="/tmp/javacc-3.2/bin/lib/javacc.jar"/>
</condition>
<condition property="javacchome" value="/tmp/${user.name}/javacc-3.2">
<available file="/tmp/${user.name}/javacc-3.2/bin/lib/javacc.jar"/>
</condition>
<!-- check for javacc in /tmptmp -->
<condition property="javacchome" value="/tmptmp/javacc-3.2">
<available file="/tmptmp/javacc-3.2/bin/lib/javacc.jar"/>
</condition>
<condition property="javacchome" value="/tmptmp/${user.name}/javacc-3.2">
<available file="/tmptmp/${user.name}/javacc-3.2/bin/lib/javacc.jar"/>
</condition>
<!-- check for javacc in user home -->
<condition property="javacchome" value="${user.home}/javacc-3.2">
<available file="${user.home}/javacc-3.2/bin/lib/javacc.jar"/>
</condition>
<condition property="javacchome" value="${user.home}/tmp/javacc-3.2">
<available file="${user.home}/tmp/javacc-3.2/bin/lib/javacc.jar"/>
</condition>
<condition property="javacchome" value="${user.home}/temp/javacc-3.2">
<available file="${user.home}/temp/javacc-3.2/bin/lib/javacc.jar"/>
</condition>
<!-- default in ubuntu -->
<condition property="javacchome" value="/usr/share/java">
<available file="/usr/share/java/javacc.jar"/>
</condition>
<!-- fail if not found -->
<fail message="javacc not found" unless="javacchome"/>
</target>
</project>