-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
886 lines (764 loc) · 42.2 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
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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
<?xml version="1.0" encoding="UTF-8"?>
<project name="JTGL" basedir="." default="all">
<!--
/////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////// USER CONFIG PROPERTIES:////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<target name="config">
<!-- ///// Paths config: ////// -->
<property name="classes" value="classes.tmp"/>
<property name="sources" value="src"/>
<property name="libs" value="lib"/>
<property name="jars" value="dist"/>
<property name="javadocs" value="doc/javadocs"/>
<!-- ///// API config: /////// -->
<property name="ui_api" value="no"/>
<property name="gaming_api" value="no"/>
<property name="extension_api" value="no"/>
</target>
<target name="config-advanced">
<!-- Standard javac compiling options: -->
<property name="compiler.source" value="1.3"/>
<property name="compiler.target" value="1.1"/>
<property name="compiler.optimize" value="true"/>
<property name="compiler.deprecation" value="false"/>
<property name="compiler.debug" value="false"/>
<property name="compiler.verbose" value="false"/>
<!-- Wireless Toolkit compiling with antenna: -->
<property name="wtk.compiler.source" value="1.3"/>
<property name="wtk.compiler.target" value="1.1"/>
<property name="wtk.compiler.optimize" value="true"/>
<property name="wtk.compiler.preverify" value="true"/>
<property name="wtk.compiler.deprecation" value="false"/>
<property name="wtk.compiler.debug" value="false"/>
<property name="wtk.compiler.verbose" value="false"/>
<!-- Wireless Toolkit antenna config: -->
<property name="wtkjad.update" value="yes"/>
<property name="wtk.obfuscate" value="no"/>
<!--/////////////////////////////////////////////////////-->
<!-- Do not change this properties: -->
<property name="project.name" value="${ant.project.name}"/>
<property name="project.url" value="http://www.jtgl.org"/>
<property name="project.title" value="${project.name} (${project.url})"/>
<property name="project.version" value="0.77"/>
<property name="project.author" value="Manuel Polo (manuel_polo@yahoo.es)"/>
<property name="jtgl.targets" value="awt,midp,midp-nokia,midp-siemens,midp2,superwaba" />
</target>
<!--
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<target name="_config-packages">
<patternset id="package.jtgl.base" description="JTGL Base API">
<include name="org/jtgl/core/*.java"/>
<include name="org/jtgl/image/*.java"/>
<include name="org/jtgl/input/*.java"/>
</patternset>
<patternset id="package.jtgl.gaming" description="Gaming API">
<include name="org/jtgl/gaming/*.java" if="include.gaming_api"/>
<exclude name="org/jtgl/gaming/OpTiledSurface.java"/>
<exclude name="org/jtgl/gaming/Bresenham.java"/>
</patternset>
<patternset id="package.jtgl.extension" description="Extension API">
<include name="org/jtgl/ext/**/*.java" if="include.extension_api"/>
</patternset>
<patternset id="package.jtgl.ui" description="UI API">
<include name="org/jtgl/ui/**/*.java" if="include.ui_api"/>
</patternset>
<patternset id="package.jtgl.micro" description="Micro API">
<include name="org/jtgl/micro/*.java"/>
<exclude name="org/jtgl/micro/GameMapplet.java" unless="include.gaming_api"/>
<exclude name="org/jtgl/micro/MicroExtensionManager.java" unless="include.extension_api"/>
</patternset>
<patternset id="package.jtgl" description="JTGL Base Packages">
<patternset refid="package.jtgl.base"/>
<patternset refid="package.jtgl.gaming"/>
<patternset refid="package.jtgl.extension"/>
<patternset refid="package.jtgl.ui"/>
<patternset refid="package.jtgl.micro"/>
</patternset>
<!-- ////////////////////////// -->
<patternset id="package.build" description="Bin package">
<include name="**"/>
<exclude name="**/*.class"/>
</patternset>
<patternset id="package.app.build" description="Client application bin package">
<patternset refid="package.build"/>
<exclude name="targets/**"/>
</patternset>
<patternset id="package.javadocs" description="JavaDocs source package">
<patternset refid="package.jtgl"/>
</patternset>
</target>
<target name="_root-path-config" unless="root.path">
<property name="root.path" value="${basedir}"/>
</target>
<target name="_build-root-paths" depends="_root-path-config" unless="app.src" description="Build paths for base library">
<!-- home.dir is the root of all -->
<property name="home.dir" location="${root.path}"/>
<property name="classes.dir" location="${home.dir}/${classes}"/>
<property name="src.dir" location="${home.dir}/${sources}"/>
<property name="lib.dir" location="${home.dir}/${libs}"/>
<property name="jar.dir" location="${home.dir}/${jars}"/>
<property name="jar" value="${home.dir}/${jars}/${project.name}_v${project.version}" />
<property name="javadoc.dir" location="${home.dir}/${javadocs}"/>
<antcall target="_debug_paths"/>
</target>
<target name="_build-app-root-paths" depends="_root-path-config" if="app.src" description="Build paths for client applications">
<!-- home.dir is the root of all -->
<property name="home.dir" location="${root.path}"/>
<property name="classes.dir" location="${app.src}/${classes}"/>
<property name="src.dir" location="${home.dir}/${sources}"/>
<property name="lib.dir" location="${home.dir}/${libs}"/>
<property name="jar.dir" location="${app.src}/${jars}"/>
<property name="jar" value="${app.src}/${jars}/${project.name}"/>
<property name="javadoc.dir" location="${app.src}/${javadocs}"/>
<antcall target="_debug_paths"/>
</target>
<target name="_debug_paths" if="debug.paths">
<!-- to debug paths: -->
<echo message="classes.dir =${classes.dir}"/>
<echo message="src.dir =${src.dir}"/>
<echo message="lib.dir =${lib.dir}"/>
<echo message="jar.dir =${jar.dir}"/>
<echo message="jar prefix: ${jar}"/>
<echo message="javadoc.dir =${javadoc.dir}"/>
</target>
<target name="_build-paths" depends="_root-path-config,_build-root-paths,_build-app-root-paths">
</target>
<target name="_config-props" depends="config,config-advanced,_build-paths" description="Configure API inclusion variables">
<condition property="include.gaming_api">
<istrue value="${gaming_api}"/>
</condition>
<condition property="include.extension_api">
<istrue value="${extension_api}"/>
</condition>
<condition property="include.ui_api">
<istrue value="${ui_api}"/>
</condition>
</target>
<target name="init" depends="_config-props,_config-packages">
<tstamp/>
<property file="${home.dir}/build.properties"/>
</target>
<target name="base" depends="init" >
<mkdir dir="${classes.dir}/base"/>
<antcall target="_javac">
<param name="destdir" value="${classes.dir}/base"/>
<param name="patternref" value="package.jtgl"/>
</antcall>
</target>
<target name="init-midp" depends="init" >
<condition property="antenna.available">
<available file="${antenna.lib}"/>
</condition>
<fail unless="antenna.available" message="Antenna library not found at ${antenna.lib} please edit build.properties file and change the antenna.lib property."/>
<taskdef resource="antenna.properties" classpath="${antenna.lib}"/>
</target>
<target name="base-midp" depends="init-midp" >
<mkdir dir="${classes.dir}/base"/>
<wtkbuild
source="${wtk.compiler.source}"
target="${wtk.compiler.target}"
debug="${wtk.compiler.debug}"
optimize="${wtk.compiler.optimize}"
verbose="${wtk.compiler.verbose}"
deprecation="${wtk.compiler.deprecation}"
destdir="${classes.dir}/base" srcdir="${src.dir}">
<patternset refid="package.jtgl"/>
</wtkbuild>
</target>
<!--
/////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////// BUILDS ////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<!-- ///////////////////// PLATFORMS: ////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////// J2SE: ///////////////////// -->
<target name="awt" depends="base" >
<antcall target="_build-package">
<param name="package" value="awt"/>
</antcall>
<antcall target="_javac">
<param name="destdir" value="${classes.dir}/awt"/>
<param name="includes" value="org/jtgl/impl/common/Default*"/>
</antcall>
</target>
<target name="swing" depends="base" >
<antcall target="_build-package">
<param name="package" value="swing"/>
</antcall>
<antcall target="_javac">
<param name="destdir" value="${classes.dir}/swing"/>
<param name="includes" value="org/jtgl/impl/common/Default*"/>
</antcall>
</target>
<target name="swingwt" depends="base" >
<antcall target="_create-package">
<param name="package" value="swingwt"/>
</antcall>
<antcall target="_javac">
<param name="destdir" value="${classes.dir}/swingwt"/>
<param name="includes" value="org/jtgl/micro/impl/swingwt/*"/>
</antcall>
</target>
<!-- ///////////////////// MIDP: ///////////////////// -->
<target name="midp" depends="base-midp" >
<antcall target="_build-package-midp">
<param name="package" value="midp"/>
</antcall>
</target>
<target name="midp-siemens" depends="base-midp" >
<condition property="siemens_api.available">
<available file="${siemens.lib}"/>
</condition>
<fail unless="siemens_api.available" message="Siemens library API not found!"/>
<echo message="Siemens lib:${siemens.lib}"/>
<property name="target.classpath" value="${siemens.lib}"/> <!-- Export needed classpath to other tasks (app builds) -->
<antcall target="_build-package-midp">
<param name="package" value="midp-siemens"/>
<param name="package.name" value="siemens"/>
<param name="package.classpath" value="${siemens.lib}"/>
<param name="package.base" value="midp/"/>
</antcall>
</target>
<target name="midp-nokia" depends="base-midp" >
<condition property="nokia.available">
<available file="${nokia.lib}"/>
</condition>
<fail unless="nokia.available" message="Nokia library API not found!"/>
<echo message="Nokia lib:${nokia.lib}"/>
<property name="target.classpath" value="${nokia.lib}"/> <!-- Export needed classpath to other tasks (app builds) -->
<antcall target="_build-package-midp">
<param name="package" value="midp-nokia"/>
<param name="package.name" value="nokia"/>
<param name="package.classpath" value="${nokia.lib}"/>
<param name="package.base" value="midp/"/>
</antcall>
</target>
<!-- ///////////////////// MIDP2: ///////////////////// -->
<target name="midp2" depends="base-midp" >
<antcall target="_build-package-midp">
<param name="package" value="midp2"/>
</antcall>
</target>
<!-- ///////////////////// DoJa: ///////////////////// -->
<!-- ///////////////////// ExEn: ///////////////////// -->
<target name="exen" depends="base" >
<echo message="ExEn Build Unavailable in this release (${project.version})"/>
<!--
<mkdir dir="${classes.dir}/exen"/>
<antcall target="_javac">
<param name="destdir" value="${classes.dir}/exen"/>
<param name="includes" value="org/jtgl/impl/exen/*,org/jtgl/micro/impl/exen/*"/>
</antcall>
-->
</target>
<!-- ///////////////////// SuperWaba: ///////////////////// -->
<target name="_init-superwaba" depends="base" >
<condition property="superwaba.found">
<available file="${superwaba.home}/lib/Waba_only.jar"/>
</condition>
<fail unless="superwaba.found" message="SuperWaba not found at ${superwaba.home}"/>
<property name="waba.lib" value="${superwaba.home}/lib/Waba_only.jar"/>
<echo message="SuperWaba HOME:${superwaba.home}"/>
<echo message="Waba lib:${waba.lib}"/>
<property name="target.classpath" value="${waba.lib}"/> <!-- Export needed classpath to other tasks (app builds) -->
</target>
<target name="superwaba" depends="_init-superwaba">
<antcall target="_build-package">
<param name="package" value="superwaba"/>
<param name="package.classpath" value="${waba.lib}"/>
</antcall>
</target>
<!--
/////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////// ARCHIVING/PACKAGING:///////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<target name="jar-base" depends="init,base" >
<mkdir dir="${jar.dir}"/>
<jar basedir="${classes.dir}/base" compress="true" jarfile="${jar}.jar">
<manifest>
<attribute name="Specification-Title" value="${project.title}"/>
<attribute name="Specification-Vendor" value="${project.author}"/>
<attribute name="Specification-Version" value="${project.version}"/>
<attribute name="Implementation-Title" value="${project.name}"/>
<attribute name="Implementation-Vendor" value="${project.author}"/>
<attribute name="Implementation-Version" value="${project.version} ${DSTAMP} ${TSTAMP}"/>
</manifest>
</jar>
</target>
<!-- ///////////////////// PLATFORMS: ////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////// J2SE: ///////////////////// -->
<target name="jar-awt" depends="awt" >
<antcall target="_jar-package">
<param name="package" value="awt"/>
</antcall>
</target>
<target name="jar-swing" depends="swing" >
<antcall target="_jar-package">
<param name="package" value="swing"/>
</antcall>
</target>
<target name="jar-swingwt" depends="swingwt" >
<antcall target="_jar-package">
<param name="package" value="swingwt"/>
</antcall>
</target>
<!-- ///////////////////// MIDP: ///////////////////// -->
<target name="jar-midp" depends="midp" >
<antcall target="_jar-package-midp">
<param name="package" value="midp"/>
</antcall>
</target>
<target name="jar-midp-siemens" depends="midp-siemens" >
<antcall target="_jar-package-midp">
<param name="package" value="midp-siemens"/>
</antcall>
</target>
<target name="jar-midp-nokia" depends="midp-nokia" >
<antcall target="_jar-package-midp">
<param name="package" value="midp-nokia"/>
</antcall>
</target>
<!-- ///////////////////// MIDP2: //////////////////// -->
<target name="jar-midp2" depends="midp2" >
<antcall target="_jar-package-midp">
<param name="package" value="midp2"/>
</antcall>
</target>
<!-- ///////////////////// Extra Platforms: ///////////////////// -->
<!-- ///////////////////// DoJa: ///////////////////// -->
<!-- ///////////////////// ExEn: ///////////////////// -->
<!-- ///////////////////// SuperWaba: ///////////////////// -->
<target name="jar-superwaba" depends="superwaba" >
<antcall target="_jar-package">
<param name="package" value="superwaba"/>
</antcall>
</target>
<!--
////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////// APP Building /////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<target name="_app-config-defaults">
<condition property="app.name" value="${ant.project.name}">
<not><isset property="app.name" /></not>
</condition>
<condition property="app.title" value="${app.name}">
<not><isset property="app.title"/></not>
</condition>
<condition property="app.vendor" value="${project.author}">
<not><isset property="app.vendor"/></not>
</condition>
<condition property="app.version" value="1.0">
<not><isset property="app.version"/></not>
</condition>
<condition property="app.resource.dir" value="res">
<and>
<available file="${app.src}/res"/>
<not><isset property="app.resource.dir"/></not>
</and>
</condition>
</target>
<target name="_app-check-target_src">
<fail unless="app.target" message="app.target not set!"/>
<fail unless="app.src" message="app.src not set!"/>
</target>
<target name="_app-config-mapplet" depends="_app-check-target_src">
<echo message="Copying Mapplet runner from ${app.src}/targets/${app.target}/*MappletRunner.java to ${app.src} ..."/>
<copy todir="${app.src}" verbose="true">
<fileset dir="${app.src}/targets/${app.target}" includes="*mappletrunner.java" casesensitive="false"/>
</copy>
</target>
<target name="_app-config-classpath" >
<condition property="app.classpath" value="${classes.dir}/${app.target};${target.classpath}">
<isset property="target.classpath"/>
</condition>
<condition property="app.classpath" value="${classes.dir}/${app.target}">
<not><isset property="app.classpath"/></not>
</condition>
<echo message="app.classpath=${app.classpath}"/>
</target>
<target name="_app-build-base" depends="_app-check-target_src,_app-config-classpath">
<echo message="Building app ${app.name} at ${app.src} with target ${app.target}"/>
<antcall target="_javac">
<param name="classpath" value="${app.classpath}"/>
<param name="srcdir" value="${app.src}"/>
<param name="destdir" value="${classes.dir}/${app.target}"/>
<param name="patternref" value="package.app.build"/>
</antcall>
</target>
<target name="_app-build-base-midp" depends="_app-check-target_src,_app-config-classpath">
<echo message="Building app ${project.name} at ${app.src} with target ${app.target}"/>
<wtkbuild
source="${wtk.compiler.source}"
target="${wtk.compiler.target}"
debug="${wtk.compiler.debug}"
optimize="${wtk.compiler.optimize}"
verbose="${wtk.compiler.verbose}"
deprecation="${wtk.compiler.deprecation}"
classpath="${app.classpath}"
destdir="${classes.dir}/${app.target}" srcdir="${app.src}" listfiles="true">
<patternset refid="package.app.build"/>
</wtkbuild>
</target>
<target name="_build-base-app" depends="init">
<fail unless="app.target" message="app.target not set!"/>
<antcall target="${app.target}"/>
<antcall target="_app-config-mapplet"/>
<antcall target="_app-build-base"/>
</target>
<target name="_build-base-app-external" depends="_app-config-mapplet,_app-build-base" />
<target name="_build-base-app-superwaba" depends="superwaba,_build-base-app-external">
</target>
<target name="_build-base-app-superwaba-ppc" depends="_build-base-app-superwaba" description="Builds a PocketPC SuperWaba application" >
</target>
<target name="_build-base-app-midp" depends="init-midp" >
<fail unless="app.target" message="app.target not set!"/>
<antcall target="${app.target}"/>
<antcall target="_app-config-mapplet"/>
<antcall target="_app-build-base-midp"/>
</target>
<target name="_build-base-app-midp-external" depends="_app-config-mapplet,_app-build-base-midp" />
<target name="_build-base-app-midp-nokia" depends="midp-nokia,_build-base-app-midp-external" />
<target name="_build-base-app-midp-siemens" depends="midp-siemens,_build-base-app-midp-external" />
<target name="_app-check-target">
<fail unless="app.target" message="app.target not set (Posible values are ${jtgl.targets})"/>
</target>
<target name="_app-init" depends="init,_app-check-target,_app-config-defaults">
<!--TODO: add a pre init task to load an app.properties and/or app.${app.target}.properties file if present at ${app.src} -->
<condition property="build.subfix" value="-midp">
<or>
<equals arg1="midp" arg2="${app.target}" trim="true"/>
<equals arg1="midp2" arg2="${app.target}" trim="true"/>
</or>
</condition>
<condition property="build.subfix" value="">
<or>
<equals arg1="awt" arg2="${app.target}" trim="true"/>
<equals arg1="swing" arg2="${app.target}" trim="true"/>
</or>
</condition>
<!-- Prepare a special target build (To configure external libs): -->
<property name="build.subfix" value="-${app.target}" />
<property name="package" value="${app.target}"/>
</target>
<target name="_app-build" depends="_app-init" description="Builds a client application.">
<echo message="Building app ${app.name}"/>
<antcall target="_build-base-app${build.subfix}"/>
</target>
<target name="_app-build-resources" if="app.resource.dir" depends="_app-init" description="Builds a client application with its resources.">
<condition property="app.resource.filter" value="**">
<not><isset property="app.resource.filter" /></not>
</condition>
<echo message="Adding (${app.resource.filter}) resources from app ${app.name}"/>
<copy todir="${classes.dir}/${app.target}/${app.resource.dir}" verbose="true">
<fileset dir="${app.src}/${app.resource.dir}">
<include name="${app.resource.filter}"/>
</fileset>
</copy>
</target>
<target name="_app-all-checkjar" if="app.jar.unavailable" description="Builds all unless jar target is present">
<echo message="Building all because jar target is not present"/>
<antcall target="app-jar"/>
<antcall target="_app-clean-classes"/>
</target>
<target name="_app-run" depends="_app-init,_app-clean-classes,_config-jar" description="Runs the application target">
<property name="app.jar" value="${jar.name}.jar"/>
<condition property="app.jar.unavailable">
<not>
<available file="${app.jar}"/>
</not>
</condition>
<antcall target="_app-all-checkjar"/>
<antcall target="_app-run-default${build.subfix}"/>
</target>
<target name="_app-run-default" description="Runs the application with default jvm">
<echo message="Running with default jvm at ${jar.dir} ${app.jar}"/>
<java dir="${jar.dir}" jar="${app.jar}" fork="true"/>
</target>
<target name="_app-run-default-midp" depends="init-midp" description="Runs the application with default midp emulator">
<echo message="Running with default midp emulator at ${jar.dir} ${app.jar}"/>
<wtkrun jadfile="${jar.name}.jad" wait="true"/>
</target>
<target name="_app-run-default-superwaba" depends="_init-superwaba" description="Runs the application with SuperWaba emulator applet">
<echo message="Running with SuperWaba emulator applet"/>
<!-- SW needs the whole application out of a jar in its app-run target: -->
<unjar src="${jar.name}.jar" dest="${classes.dir}" />
<ant dir="${superwaba.home}" antfile="${superwaba.home}/build.xml" target="app-run">
<property name="app.build" value="${classes.dir}"/>
<property name="build.libs" value="${waba.lib}"/>
<property name="main.class" value="${app.mainclass}"/>
</ant>
</target>
<target name="app-jar" depends="_app-build,_app-build-resources" description="Builds and jars a client application.">
<antcall target="jar-${app.target}" />
<antcall target="_app-pack-subtarget"/>
<antcall target="_app-clean-classes"/>
</target>
<!-- Special App Packaging: -->
<target name="_app-pack-subtarget" if="app.subtarget">
<antcall target="_app-pack-${app.target}-${app.subtarget}"/>
</target>
<target name="_app-pack-superwaba-palmos" depends="_config-jar" description="Builds a PalmOS SuperWaba application">
<echo message="Packing PalmOS app from jar ${jar.name}.jar Version: ${app.version}"/>
<echo message="@ ${jar.dir}"/>
<!-- call app-warp to build SuperWaba Utils -->
<ant dir="${superwaba.home}" antfile="${superwaba.home}/build.xml" target="compile-utils">
<property name="warp.name" value="${app.name}"/>
<property name="warp.options" value=""/>
<property name="warp.files" value="${jar.name}.jar"/>
<property name="build.temp" value="${jar.dir}"/>
</ant>
<!-- call Warp to build a PalmOS application pdb -->
<java classname="Warp" fork="yes" dir="${jar.dir}">
<classpath>
<pathelement path="${superwaba.home}/build/utils"/>
</classpath>
<arg value="c"/>
<arg line="${app.name}"/>
<arg line="${jar.name}.jar"/>
</java>
<!-- call Exegen to build a PalmOS application prc executable -->
<java classname="Exegen" fork="yes" dir="${jar.dir}">
<classpath>
<pathelement path="${superwaba.home}/lib/SuperWaba.jar"/>
<pathelement path="${superwaba.home}/utils"/>
</classpath>
<arg line="/V '${app.version}'"/>
<arg line="/T '${app.title}'"/>
<arg line="${app.name}"/>
<arg line="${app.mainclass}"/>
</java>
</target>
<target name="_app-clean-classes" description="Clean up client application (classes only).">
<antcall target="clean-classes"/>
<delete quiet="true">
<fileset dir="${app.src}" includes="*mappletrunner.java" casesensitive="false"/>
</delete>
</target>
<target name="_app-clean-all" depends="_app-clean-classes" description="Clean up client application (classes and jars).">
<antcall target="clean"/>
</target>
<!--
/////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////// Utility method targets: ///////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<target name="_javac" depends="_javac_includes,_javac_pattern" />
<target name="_javac_init" depends="init">
<condition property="classpath" value="">
<or>
<isset property="classpath"/>
<not>
<equals arg1="${classpath}" arg2="" trim="true"/>
</not>
</or>
</condition>
<condition property="srcdir" value="${src.dir}">
<or>
<isset property="srcdir"/>
<not>
<equals arg1="${srcdir}" arg2="" trim="true"/>
</not>
</or>
</condition>
</target>
<target name="_javac_includes" if="includes" depends="_javac_init">
<javac
source="${compiler.source}"
target="${compiler.target}"
debug="${compiler.debug}"
optimize="${compiler.optimize}"
verbose="${compiler.verbose}"
deprecation="${compiler.deprecation}"
classpath="${classpath}"
destdir="${destdir}" srcdir="${srcdir}"
includes="${includes}">
</javac>
</target>
<target name="_javac_pattern" if="patternref" depends="_javac_init">
<javac
source="${compiler.source}"
target="${compiler.target}"
debug="${compiler.debug}"
optimize="${compiler.optimize}"
verbose="${compiler.verbose}"
deprecation="${compiler.deprecation}"
classpath="${classpath}"
destdir="${destdir}" srcdir="${srcdir}">
<patternset refid="${patternref}"/>
</javac>
</target>
<target name="_config-jar">
<mkdir dir="${jar.dir}"/>
<fail unless="package" message="package not set"/>
<property name="jar.name" value="${jar}_${package}"/>
</target>
<target name="_jar-package-with-main" if="app.mainclass" description="Jars a package with a main class (executable jar)">
<jar basedir="${classes.dir}/${package}" compress="true" jarfile="${jar.name}.jar" >
<manifest>
<attribute name="Specification-Title" value="${project.title}"/>
<attribute name="Specification-Vendor" value="${project.author}"/>
<attribute name="Specification-Version" value="${project.version}"/>
<attribute name="Implementation-Title" value="${project.name}"/>
<attribute name="Implementation-Vendor" value="${project.author}"/>
<attribute name="Implementation-Version" value="${project.version} ${DSTAMP} ${TSTAMP}"/>
<attribute name="Main-class" value="${app.mainclass}"/>
</manifest>
</jar>
</target>
<target name="_jar-package-without-main" unless="app.mainclass" description="Jars a package without a main class (executable jar)">
<jar basedir="${classes.dir}/${package}" compress="true" jarfile="${jar.name}.jar">
<manifest>
<attribute name="Specification-Title" value="${project.title}"/>
<attribute name="Specification-Vendor" value="${project.author}"/>
<attribute name="Specification-Version" value="${project.version}"/>
<attribute name="Implementation-Title" value="${project.name}"/>
<attribute name="Implementation-Vendor" value="${project.author}"/>
<attribute name="Implementation-Version" value="${project.version} ${DSTAMP} ${TSTAMP}"/>
</manifest>
</jar>
</target>
<target name="_jar-package" depends="init,_config-jar,_jar-package-with-main,_jar-package-without-main" description="Jars a package" />
<target name="_jar-package-midp-with-jad" if="app.mainclass" depends="_config-jar,_app-config-defaults" description="Create JAD/JAR ">
<wtkjad
jadfile="${jar.name}.jad"
jarfile="${jar.name}.jar"
update="${wtkjad.update}"
name="${app.name}"
version="${app.version}"
vendor="${app.vendor}">
<midlet name="${app.name}" class="${app.mainclass}" icon="${app.icon}" if="app.icon"/>
<midlet name="${app.name}" class="${app.mainclass}" unless="app.icon"/>
</wtkjad>
<wtkpackage
basedir="${classes.dir}/${package}"
compress="true"
obfuscate="${wtk.obfuscate}"
jarfile="${jar.name}.jar"
jadfile="${jar.name}.jad"
preverify="${wtk.compiler.preverify}">
</wtkpackage>
</target>
<target name="_jar-package-midp-without-jad" unless="app.mainclass" depends="_config-jar,_jar-package-without-main">
</target>
<target name="_jar-package-midp" depends="init-midp,_jar-package-midp-with-jad,_jar-package-midp-without-jad" description="Jars a midp (wtk) package">
</target>
<target name="_create-package" depends="init" description="Creates a new package merged with the base JTGL package">
<fail unless="package" message="package not set"/>
<mkdir dir="${classes.dir}/${package}"/>
<echo message="Copy base package from ${classes.dir}/base to ${classes.dir}/${package}"/>
<copy todir="${classes.dir}/${package}">
<fileset dir="${classes.dir}/base" excludes="**/*.java"/>
</copy>
</target>
<target name="_build-package" depends="init" description="Builds a new generic package merged with the base JTGL package">
<fail unless="package" message="package not set"/>
<antcall target="_create-package">
<param name="package" value="${package}"/>
</antcall>
<condition property="package.classpath" value="">
<or>
<isset property="package.classpath"/>
<not>
<equals arg1="${package.classpath}" arg2="" trim="true"/>
</not>
</or>
</condition>
<antcall target="_javac">
<param name="destdir" value="${classes.dir}/${package}"/>
<param name="classpath" value="${package.classpath}"/>
<param name="includes" value="org/jtgl/impl/${package}/*,org/jtgl/micro/impl/${package}/*"/>
</antcall>
<!-- Copy property files that may be needed: -->
<copy todir="${classes.dir}/${package}/org/jtgl/micro/impl/${package}">
<fileset dir="${src.dir}/org/jtgl/micro/impl/${package}" includes="*.properties"/>
</copy>
</target>
<target name="_build-package-midp" depends="init" description="Builds with antenna a new generic package merged with the base JTGL package">
<fail unless="package" message="package not set"/>
<antcall target="_create-package">
<param name="package" value="${package}"/>
</antcall>
<condition property="package.name" value="${package}">
<not><isset property="package.name"/></not>
</condition>
<condition property="package.classpath" value="">
<or>
<isset property="package.classpath"/>
<not>
<equals arg1="${package.classpath}" arg2="" trim="true"/>
</not>
</or>
</condition>
<condition property="package.base" value="">
<or>
<isset property="package.base"/>
<not>
<equals arg1="${package.base}" arg2="" trim="true"/>
</not>
</or>
</condition>
<wtkbuild
source="${wtk.compiler.source}"
target="${compiler.target}"
debug="${wtk.compiler.debug}"
optimize="${wtk.compiler.optimize}"
verbose="${wtk.compiler.verbose}"
deprecation="${wtk.compiler.deprecation}"
classpath="${package.classpath}"
destdir="${classes.dir}/${package}" srcdir="${src.dir}">
<include name="org/jtgl/impl/${package.base}${package.name}/*"/>
<include name="org/jtgl/micro/impl/${package.base}${package.name}/*"/>
</wtkbuild>
</target>
<target name="_init-javadocs">
<!-- Enable all extended api's for full javadocs: -->
<property name="gaming_api" value="yes"/>
<property name="extension_api" value="yes"/>
</target>
<!-- //////////////////////////////////////////////////////////////////////////////////////////////////// -->
<!--
/////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////// Various generic targets: //////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<target name="all-j2se" depends="clean,jar-base,jar-awt,jar-swing" description="Build J2SE group." />
<target name="all-midp1" depends="clean,jar-base,jar-midp,jar-midp-siemens,jar-midp-nokia" description="Build J2ME/Midp1 group." />
<target name="all-midp2" depends="clean,jar-base,jar-midp2" description="Build J2ME/Midp2 group." />
<target name="all-j2me" depends="all-midp1,all-midp2" description="Build J2ME/Midp1&2 group." />
<target name="all-extra" depends="clean,jar-superwaba" description="Build Extra group." />
<target name="all" depends="clean,all-j2se,all-j2me,all-extra" description="Build all available groups.">
<antcall target="clean-classes"/>
</target>
<!-- //////////////////////////////////////////////////////////////////////////////////////////////////// -->
<target name="javadoc" depends="_init-javadocs,init" description="Build Javadocs." >
<delete dir="${javadoc.dir}" quiet="true" includeemptydirs="true"/>
<mkdir dir="${javadoc.dir}" />
<javadoc
destdir="${javadoc.dir}"
author="true"
version="true"
use="true"
windowtitle="${project.name} v${project.version} JavaDoc API"
>
<fileset dir="${src.dir}">
<patternset refid="package.javadocs"/>
</fileset>
</javadoc>
<copy file="${home.dir}/res/overview-summary.html" tofile="${javadoc.dir}/overview-summary.html" overwrite="true"/>
</target>
<target name="clean-classes" depends="init" description="Clean all classes built">
<echo message="Cleaning up classes.."/>
<delete dir="${classes.dir}" quiet="true" includeemptydirs="true"/>
</target>
<target name="clean" depends="clean-classes" description="Clean all builds">
<delete dir="${javadoc.dir}" quiet="true" includeemptydirs="true"/>
<delete dir="${jar.dir}" quiet="true" includeemptydirs="true"/>
</target>
</project>