File: build.xml

package info (click to toggle)
remuco 0.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,276 kB
  • ctags: 2,452
  • sloc: java: 7,161; python: 6,140; xml: 5,704; sh: 165; makefile: 74
file content (405 lines) | stat: -rw-r--r-- 13,914 bytes parent folder | download
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
<?xml version="1.0"?>
<!-- ====================================================================== 

     Remuco Client
     A J2ME client for the Remuco system.
     
     http://remuco.googlecode.com
     
     This build script requires Ant >= 1.7 !
                   
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     Building the client:
     ^^^^^^^^^^^^^^^^^^^^
     
     Create a file 'build.properties' (either manually using
     'build.properties.example' or automatically using 'setup.sh').

     Run one of the public targets starting with 'dist' ('opti' means
     optimized, 'noop' means non-optimized).
     
     This will create a jar and jad file in the directory 'dist'.
     
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     Running the client in the emulator:
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     
     Create a file 'build.properties' (either manually using
     'build.properties.example' or automatically using 'setup.sh').

     Run target 'run.microemu' to run the client in the MicroEmu emulator.

     When using the WTK emulator, create a file 'wtk-emulator.properties' (use
     'wtk-emulator.properties.example' as a template) and edit it if necessary.
     
     Run target 'run.wtk' to run the client in the WTK emulator.
     
     ====================================================================== -->

<project name="Remuco Client" default="clean">

	<description>A J2ME client for the Remuco system.</description>

	<!-- =================== Configuration =============================== -->

	<property file="build.properties" />

	<property name="midp.ver" value="MIDP-2.0" />
	<property name="cldc.ver" value="CLDC-1.1" />

	<property name="midlet.icon" value="logo.png" />
	<property name="midlet.vendor" value="remuco.googlecode.com" />
	<property name="midlet.version" value="0.9.2" />
	<property name="midlet.data-size" value="2048" />

	<property name="midlet.name" value="Remuco" />
	<property name="midlet.name.lc" value="remuco" />
	<property name="midlet.jar" value="${midlet.name.lc}.jar" />
	<property name="midlet.jad" value="${midlet.name.lc}.jad" />

	<!-- - - - - - - - -Target dependent configuration - - - - - - - - - - -->

	<target name="configure.emulation">
		<fail if="configured" />
		<property name="configured" value="isset" />
		<property name="compile.debug" value="${run.debug}" />
		<property name="preverifier" value="${run.preverifier}" />
		<property name="proguard.optimize" value="${run.proguard.optimize}" />
		<property name="emulation" value="isset" />
		<antcall target="echo.configuration" />
	</target>

	<target name="configure.dist">
		<fail if="configured" />
		<property name="configured" value="isset" />
		<property name="compile.debug" value="${dist.debug}" />
		<property name="preverifier" value="${dist.preverifier}" />
		<property name="proguard.optimize" value="${dist.proguard.optimize}" />
		<antcall target="echo.configuration" />
	</target>

	<target name="echo.configuration">
		<fail unless="configured" />
		<echo message="compile with debug symbols : ${compile.debug}" />
		<echo message="preverifier                : ${preverifier}" />
		<echo message="proguard optimizes         : ${proguard.optimize}" />
		<condition property="bluetooth" value="yes" else="no">
			<isset property="jsr82.jar"/>
		</condition>
		<echo message="bluetooth                  : ${bluetooth}" />
	</target>

	<!-- =================== Libraries and Classpath ====================== -->

	<path id="cp.compile">
		<fileset file="${midp.jar}" />
		<fileset file="${cldc.jar}" />
		<fileset file="${jsr82.jar}" />
	</path>

	<property name="cp.compile.cmdline" refid="cp.compile" />

	<path id="cp.preverify">
		<fileset file="${midp.jar}" />
		<fileset file="${cldc.jar}" />
		<fileset file="${jsr82.jar}" />
	</path>

	<property name="cp.preverify.cmdline" refid="cp.preverify" />

	<!-- =================== Themes ======================================= -->

	<pathconvert property="include.themes" pathsep=",">
		<dirset dir="res/themes" includes="${theme.list}" />
		<mapper type="regexp" from="^(.*)$$" to="\1/**/*" />
		<map from="${basedir}/res/" to="" />
	</pathconvert>

	<pathconvert property="include.icons" pathsep=",">
		<dirset dir="res/icons" includes="${theme.lics},uni" />
		<mapper type="regexp" from="^(.*)$$" to="\1/**/*" />
		<map from="${basedir}/res/" to="" />
	</pathconvert>

	<property name="res.include" value="${include.themes},${include.icons}" />

	<!-- =================== Build ======================================== -->

	<target name="preprocess">
		<fail unless="configured" />
		<condition property="emulation-flag" value="true" else="false">
			<isset property="emulation" />
		</condition>
		<mkdir dir="build/sources" />
		<copy todir="build/sources">
			<fileset dir="src" includes="remuco/**/*.java" />
			<filterset>
				<filter token="VERSION" value="${midlet.version}" />
				<filter token="THEMES" value="${theme.list}" />
				<filter token="LICS" value="${theme.lics}" />
				<filter token="EMULATION" value="${emulation-flag}" />
			</filterset>
		</copy>
	</target>

	<target name="compile" depends="preprocess">
		<mkdir dir="build/classes" />
		<javac destdir="build/classes"
		       target="1.1"
		       source="1.3"
		       bootclasspath="${midp.jar}"
		       debug="${compile.debug}"
		       verbose="no">
			<!-- source paths -->
			<src path="build/sources" />
			<!-- exclude classes based on conditions -->
			<not>
				<selector unless="jsr82.jar">
					<containsregexp expression="^import javax.bluetooth" />
				</selector>
			</not>
			<!-- default classes to include -->
			<include name="remuco/**/*.java" />
			<!-- classpath -->
			<classpath refid="cp.compile" />
		</javac>
	</target>

	<!-- - - - - - - - - - - Preverification  - - - - - - - - - - - - - - - -->

	<target name="preverify.proguard">
		<taskdef resource="proguard/ant/task.properties"
		         classpath="${proguard.jar}" />
		<proguard allowaccessmodification="${proguard.optimize}"
		          overloadaggressively="${proguard.optimize}"
		          repackageclasses=""
		          shrink="${proguard.optimize}"
		          obfuscate="${proguard.optimize}"
		          usemixedcaseclassnames="no"
		          optimize="${proguard.optimize}"
		          microedition="yes">
			<injar path="build/classes" />
			<outjar path="build/preverified" />
			<libraryjar refid="cp.preverify" />
			<keep access="public" extends="javax.microedition.midlet.MIDlet" />
			<keep access="public" name="remuco.comm.BluetoothServiceFinder" />
			<keep access="public" name="remuco.comm.BluetoothScanner" />
		</proguard>
	</target>

	<target name="preverify.wtk">
		<echo message="pcp: ${cp.preverify.cmdline}" />
		<exec executable="${wtk.home}/bin/preverify" failonerror="true">
			<arg line="-classpath ${cp.preverify.cmdline}" />
			<arg line="-d build/preverified" />
			<arg line="build/classes" />
		</exec>
	</target>

	<target name="preverify" depends="compile">
		<mkdir dir="build/preverified" />
		<antcall target="preverify.${preverifier}" />
	</target>

	<!-- - - - - - - - - - - Create Jar - - - - - - - - - - - - - - - - - - -->

	<target name="jar" depends="preverify,manifest">
		<mkdir dir="build/jar" />
		<copy tofile="build/logo.png"
		      file="design/logos/logo_${logo.size}.png" />
		<jar jarfile="build/jar/${midlet.jar}" manifest="build/MF">
			<fileset dir="build/preverified" />
			<fileset dir="res" includes="${res.include}" />
			<fileset dir="build">
				<include name="logo.png" />
			</fileset>
		</jar>
	</target>

	<target name="jad" depends="jar">
		<move file="build/MF" tofile="build/jar/${midlet.jad}" />
		<length file="build/jar/${midlet.jar}" property="midlet.jar.size" />
		<manifest file="build/jar/${midlet.jad}" mode="update">
			<attribute name="MIDlet-Jar-URL" value="${midlet.jar}" />
			<attribute name="MIDlet-Jar-Size" value="${midlet.jar.size}" />
		</manifest>
	</target>

	<target name="manifest">
		<manifest file="build/MF">
			<attribute name="MicroEdition-Configuration" value="${cldc.ver}" />
			<attribute name="MicroEdition-Profile" value="${midp.ver}" />
			<attribute name="MIDlet-1"
			           value="${midlet.name},${midlet.icon},remuco.Entry" />
			<attribute name="MIDlet-Name" value="${midlet.name}" />
			<attribute name="MIDlet-Vendor" value="${midlet.vendor}" />
			<attribute name="MIDlet-Version" value="${midlet.version}" />
			<attribute name="MIDlet-Data-Size" value="${midlet.data-size}" />
			<!--
			These options cause trouble on certain devices and do not provide
			a great benefit at all, thus they are commented.
			<attribute name="MIDlet-Permissions"
			           value="javax.microedition.io.Connector.socket" />
			<attribute name="MIDlet-Permissions"
			           value="javax.microedition.io.Connector.bluetooth.client" />
			-->
			<attribute name="Nokia-MIDlet-On-Screen-Keypad" value="no" />
		</manifest>
	</target>

	<!-- =================== Dist ========================================= -->

	<target name="dist"
	        depends="clean,configure.dist,jad"
	        description="--> create distributable jar and jad file">
		<mkdir dir="app" />
		<copy todir="app">
			<fileset dir="build/jar">
				<include name="${midlet.jar}" />
				<include name="${midlet.jad}" />
			</fileset>
		</copy>
	</target>

	<!-- =================== Snapshot ===================================== -->

	<target name="snapshot"
	        depends="clean,revision,configure.dist,jad"
	        description="--> create snapshot tarball">
		<tstamp />
		<echo file="build/tmp1"
		      message="Client snapshot (${TODAY}, Revision ${revision.no})." />
		<echo file="build/tmp1"
		      append="true"
		      message="${line.separator}${line.separator}" />
		<echoproperties destfile="build/tmp2" />
		<concat destfile="build/README">
			<fileset dir="build" includes="tmp*" id="snaptmp" />
		</concat>
		<delete>
			<fileset refid="snaptmp" />
		</delete>
		<mkdir dir="dist" />
		<tar destfile="dist/remuco-client-${revision.no}.tar.gz"
		     compression="gzip">
			<fileset dir="build/jar">
				<include name="${midlet.jar}" />
				<include name="${midlet.jad}" />
			</fileset>
			<fileset dir="build" includes="README" />
		</tar>
	</target>

	<target name="revision">
		<!-- if this does not work, revision is set to 'unknown' -->
		<exec executable="sh"
		      outputproperty="svn.rev"
		      errorproperty="svn.error"
		      osfamily="unix"
		      failifexecutionfails="false"
		      failonerror="false">
			<arg value="-c" />
			<arg value="svn info -R | grep '^Revision' | sed -e 's/^Revision: //' | sort -n | tail -n 1" />
		</exec>
		<condition property="revision.no" value="${svn.rev}" else="unknown">
			<and>
				<equals arg1="${svn.error}" arg2="" />
				<isset property="svn.rev" />
				<matches string="${svn.rev}" pattern="^[1-9][0-9]*$" />
			</and>
		</condition>
	</target>

	<!-- =================== Run ========================================== -->

	<target name="run.prepare" depends="clean,configure.emulation,jad" />

	<target name="run.wtk" depends="run.prepare">
		<exec executable="${wtk.home}/bin/emulator" dir="build/jar">
			<arg value="-Xprefs:${basedir}/wtk-emulator.properties" />
			<arg value="-Xdomain:${run.emulator.wtk.domain}" />
			<arg value="-Xdevice:${wtk.device}" />
			<arg value="-Xdescriptor:${midlet.jad}" />
		</exec>
	</target>

	<target name="run.wtk.default"
	        description="--> run client in WTK emulator (default skin)">
		<antcall target="run.wtk">
			<param name="wtk.device" value="DefaultColorPhone" />
		</antcall>
	</target>

	<target name="run.wtk.media"
	        description="--> run client in WTK emulator (media skin)">
		<antcall target="run.wtk">
			<param name="wtk.device" value="MediaControlSkin" />
		</antcall>
	</target>

	<target name="run.wtk.gray"
	        description="--> run client in WTK emulator (gray size)">
		<antcall target="run.wtk">
			<param name="wtk.device" value="DefaultGrayPhone" />
		</antcall>
	</target>

	<target name="run.wtk.qwerty"
	        description="--> run client in WTK emulator (qwerty skin)">
		<antcall target="run.wtk">
			<param name="wtk.device" value="QwertyDevice" />
		</antcall>
	</target>

	<target name="run.microemu" depends="run.prepare">
		<java fork="yes" classname="org.microemu.app.Main">
			<arg value="build/jar/${midlet.jad}" />
			<arg value="--device" />
			<arg value="org/microemu/device/${microemu.device}/device.xml" />
			<classpath>
				<pathelement location="${microemu.home}/devices/microemu-device-${microemu.device}.jar" />
				<pathelement location="${microemu.home}/microemulator.jar" />
				<pathelement location="${microemu.bluecove.jar}" />
				<pathelement location="${microemu.bluecove-gpl.jar}" />
			</classpath>
		</java>
	</target>

	<target name="run.microemu.default"
	        description="--> run client in MicroEmu emulator (default size)">
		<antcall target="run.microemu">
			<param name="microemu.device" value="default" />
		</antcall>
	</target>

	<target name="run.microemu.large"
	        description="--> run client in MicroEmu emulator (large size)">
		<antcall target="run.microemu">
			<param name="microemu.device" value="large" />
		</antcall>
	</target>

	<target name="run.microemu.minimum"
	        description="--> run client in MicroEmu emulator (minimum size)">
		<antcall target="run.microemu">
			<param name="microemu.device" value="minimum" />
		</antcall>
	</target>

	<target name="run"
	        description="--> run client in configured default emulator">
		<antcall target="run.${run.emulator}" />
	</target>

	<!-- =================== Clean ======================================== -->

	<target name="clean" description="--> clean project">
		<delete dir="build" />
		<delete dir="design/themes/build" />
		<delete dir="app" />
	</target>

</project>