-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake-applet.xml
More file actions
235 lines (201 loc) · 6.94 KB
/
Copy pathmake-applet.xml
File metadata and controls
235 lines (201 loc) · 6.94 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
Ant-Task zum Erstellen der Jars für das Applet. Legt ein Verzeichnis build-applet an.
Wenn es schon etwas enthält, wird es gelöscht.
Anleitung zum Applet-Bau und -Deployment: documentation/applet-howto/applet-howto.html
Die Ant-Datei erwartet, im Projekt-Verzeichnis zu sein (eine Stufe oberhalb des Ordners ctSim).
Ausführen in Eclipse: Alt-Shift-X, dann Q. Auch über Run > External Tools zu erreichen.
-->
<project default="make-applet">
<!-- Variablen -->
<property name="build.dir" location="./bin/build-applet" />
<property name="icons.dir" location="./images" />
<property name="jar-base-filename" value="ctsim-applet" />
<property name="makecob.dir" location="./contrib/makecob" />
<!--
Soll das Applet automatisch auf den Bot geladen werden, kommentiert man die folgende Zeile wieder ein:
(<!- und -> weg)
Achtung, Perl muss installiert sein! Unter Windows hilft z.B. http://www.activestate.com/Products/activeperl/
Die IP-Adresse des WiPorts trägt man eine Zeile tiefer ein.
-->
<!--
<property name="upload" value="1" />
-->
<property name="botaddress" value="192.168.1.22" />
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="make-applet">
<!-- Builddir samt Inhalt loeschen falls vorhanden -->
<delete dir="${build.dir}" />
<!-- Builddir und META-INF machen falls nötig -->
<mkdir dir="${build.dir}/META-INF" />
<!-- Wenn man das Ant-File debuggen will
<echoproperties />
-->
<!-- Ding kompilieren samt allen Abhängigkeiten -->
<javac
srcdir="ctSim/applet"
sourcepath="."
destdir="${build.dir}"
classpath="
contrib/java3d/j3dcore.jar\:
contrib/java3d/j3dutils.jar\:
contrib/java3d/vecmath.jar\:
contrib/jSerialComm/jSerialComm-1.3.11.jar\:
contrib/picocontainer-1.2.jar"
includeantruntime="false"
encoding="UTF-8"
/>
<!-- Manifest für die Jars schreiben -->
<manifest file="${build.dir}/META-INF/MANIFEST.MF">
<attribute name="Built-By" value="${user.name}" />
</manifest>
<!--
Mehrere Jars erzeugen
Keins darf >64K sein, weil's sonst der WiPort nicht packt - siehe
http://www.heise.de/ct/projekte/machmit/ctbot/wiki/AppletHowto#Detail:Die64-KB-Grenze
Wir rufen mehrfach die unten definierte "Funktion" namens make-jar auf
-->
<antcall target="make-jar">
<param name="num" value="1" />
<param name="subdirs" value="ctSim/*.class, ctSim/applet/**/*.class, ctSim/controller/**/*.class" />
</antcall>
<antcall target="make-jar">
<param name="num" value="2" />
<param name="subdirs" value="ctSim/model/*.class, ctSim/model/bots/*.class" />
</antcall>
<antcall target="make-jar">
<param name="num" value="3" />
<param name="subdirs" value="ctSim/view/**/*.class" />
</antcall>
<antcall target="make-jar">
<param name="num" value="4" />
<param name="subdirs" value="ctSim/model/bots/ctbot/*.class, ctSim/util/**/*.class" />
</antcall>
<antcall target="make-jar">
<param name="num" value="5" />
<param name="subdirs" value="ctSim/model/bots/components/*.class" />
</antcall>
<jar destfile="${build.dir}/icons.jar"
basedir="${icons.dir}"
includes="${build.dir}/ctSim/META-INF,*.gif"
/>
<!-- Ok Kompilat ist eingepackt, also kann das unkomprimierte jetzt weg -->
<delete dir="${build.dir}/ctSim" />
<delete dir="${build.dir}/META-INF" />
<copy file="applet.html" tofile="${build.dir}/index.html" />
<!-- Bei Bedarf das Applet gleich auf den Bot laden -->
<antcall target="upload-applet" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="make-jar">
<jar
destfile="${build.dir}/${jar-base-filename}-${num}.jar"
basedir="${build.dir}"
includes="${build.dir}/ctSim/META-INF,${subdirs}"
excludes="${exclude}"
/>
</target>
<!-- Erstellt eine cob-Datei für den WiPort -->
<target name="make-cob">
<exec executable="perl" dir="${build.dir}">
<arg value="makecob" />
<arg value="-v" />
<arg value="${file}" />
</exec>
<copy file="${build.dir}/web.cob" tofile="${build.dir}/web${num}.cob" />
<delete file="${build.dir}/web.cob" />
</target>
<!-- Erstellt eine cob-Datei aus jar-Archiv Nr. "num" -->
<target name="make-cob-step">
<antcall target="make-cob">
<param name="file" value="${jar-base-filename}-${i}.jar" />
<param name="num" value="${i}" />
</antcall>
</target>
<!-- Erstellt alle cob-Dateien -->
<target name="make-all-cobs">
<copy file="${makecob.dir}/makecob" tofile="${build.dir}/makecob" />
<antcall target="make-cob">
<param name="file" value="index.html" />
<param name="num" value="10"/>
</antcall>
<antcall target="make-cob">
<param name="file" value="icons.jar" />
<param name="num" value="11"/>
</antcall>
<!-- es gibt keine for-Schleife, also ausrollen -->
<antcall target="make-cob-step">
<param name="i" value="1" />
</antcall>
<antcall target="make-cob-step">
<param name="i" value="2" />
</antcall>
<antcall target="make-cob-step">
<param name="i" value="3" />
</antcall>
<antcall target="make-cob-step">
<param name="i" value="4" />
</antcall>
<antcall target="make-cob-step">
<param name="i" value="5" />
</antcall>
<delete file="${build.dir}/makecob" />
</target>
<!-- Lädt die cob-Dateien per tftp auf den Bot -->
<target name="tftp-upload">
<!-- Linux benutzt das Sh-Script -->
<exec executable="sh" dir="${build.dir}" os="Linux">
<arg value="${makecob.dir}/upload.sh" />
<arg value="${botaddress}" />
<arg value="binary\nput ${src} ${dest}" />
</exec>
<!-- Mac OS X benutzt das Sh-Script -->
<exec executable="sh" dir="${build.dir}" os="Mac OS X">
<arg value="${makecob.dir}/upload.sh" />
<arg value="-e ${botaddress}" />
<arg value="put ${src} ${dest}" />
</exec>
<!-- Windows bekommt die Parameter direkt -->
<exec executable="tftp" dir="${build.dir}" os="Windows XP">
<arg value="-i" />
<arg value="${botaddress}" />
<arg value="PUT" />
<arg value="${src}" />
<arg value="${dest}" />
</exec>
</target>
<!-- Erstellt cob-Dateien aus dem Applet und lädt sie per tftp auf den WiPort -->
<target name="upload-applet" if="upload">
<!-- web{i}.cob bauen -->
<antcall target="make-all-cobs" />
<!-- Dateien auf den WiPport laden -->
<antcall target="tftp-upload">
<param name="src" value="web10.cob" />
<param name="dest" value="WEB1" />
</antcall>
<antcall target="tftp-upload">
<param name="src" value="web11.cob" />
<param name="dest" value="WEB2" />
</antcall>
<antcall target="tftp-upload">
<param name="src" value="web1.cob" />
<param name="dest" value="WEB3" />
</antcall>
<antcall target="tftp-upload">
<param name="src" value="web2.cob" />
<param name="dest" value="WEB4" />
</antcall>
<antcall target="tftp-upload">
<param name="src" value="web3.cob" />
<param name="dest" value="WEB5" />
</antcall>
<antcall target="tftp-upload">
<param name="src" value="web4.cob" />
<param name="dest" value="WEB6" />
</antcall>
<antcall target="tftp-upload">
<param name="src" value="web5.cob" />
<param name="dest" value="WEB7" />
</antcall>
</target>
</project>