-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·785 lines (711 loc) · 27.8 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
<?xml version="1.0" encoding="UTF-8"?>
<!-- Set Ant Project Name -->
<project name="RGADemo" default="main" basedir=".">
<property environment="env."/>
<!-- System environment must contain FLEX_HOME variable that points to Flex SDK -->
<property name="FLEX_HOME" location="${env.FLEX_HOME}"/>
<property name="version" value="0.7.0" />
<!-- If you are using FDT, set this value to true. -->
<!-- To assure that FDT's tasks work, the task has to run in the same JRE (Java Runtime Environment) as Eclipse. see FDT's help. -->
<property name="fdt" value="false" />
<property name="build" value="build" />
<property name="buildInfo" value="build.txt" />
<property name="src" location="src" />
<property name="lib" location="libs" />
<property name="bin" location="bin" />
<property name="ide" location="ide" />
<property name="settings" location=".settings" />
<property file="${build}/flex.properties" />
<property file="${build}/gaia.properties" />
<property name="templates" location="${build}/templates" />
<import file="${build}/lib/textutils.xml" />
<import file="${build}/lib/gaiautils.xml" />
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${build}/lib/ant-contrib-1.0b3.jar" />
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<taskdef name="xmltask" classpath="${build}/lib/xmltask-v1.15.1.jar" classname="com.oopsconsultancy.xmltask.ant.XmlTask" />
<property name="pages.full.package" value="${project.package}.${pages.package}" />
<replace-dot property="project.src" input="${src}/${project.package}" />
<property name="pages.src" value="${project.src}/${pages.package}" />
<target name="main" depends="scaffolding, seo-scaffolding, release">
<echo message="main" />
</target>
<target name="clean">
<delete dir="${src}" />
<delete dir="${ide}" />
<mkdir dir="${src}" />
<mkdir dir="${ide}" />
</target>
<target name="scaffolding" description="scaffolding" depends="create-base, create-main, create-preload, create-pages, create-static-page" />
<target name="seo-scaffolding" description="seo-scaffolding" depends="seo-html" />
<target name="compile-all" description="compile-all" depends="compile-pages, compile-preloader, compile-main" />
<target name="debug-all" description="debug-all" depends="debug-pages, debug-preloader, debug-main" />
<target name="release" description="release" depends="compile-all, create-build-info" />
<!-- Scaffolding -->
<target name="create-base">
<mkdir dir="${pages.src}" />
<mkdir dir="${lib}" />
<mkdir dir="${bin}" />
<mkdir dir="${ide}" />
<mkdir dir="${bin}/js" />
<mkdir dir="${bin}/xml" />
<copy todir="${src}" overwrite="false" encoding="UTF-8">
<fileset dir="${templates}/src/" />
</copy>
<copy todir="${project.src}" overwrite="false" encoding="UTF-8">
<fileset dir="${templates}/project-src" />
<filterchain>
<replacetokens>
<token key="PACKAGENAME" value="${project.package}" />
</replacetokens>
</filterchain>
</copy>
<copy todir="${lib}" overwrite="false" encoding="UTF-8">
<fileset dir="${templates}/lib" />
</copy>
<copy file="${templates}/Scaffold.as" tofile="${pages.src}/Scaffold.as" overwrite="false" encoding="UTF-8">
<filterchain>
<replacetokens>
<token key="PACKAGENAME" value="${pages.full.package}" />
</replacetokens>
</filterchain>
</copy>
<copy file="${templates}/PreloaderScaffold.as" tofile="${pages.src}/PreloaderScaffold.as" overwrite="false" encoding="UTF-8">
<filterchain>
<replacetokens>
<token key="PACKAGENAME" value="${pages.full.package}" />
</replacetokens>
</filterchain>
</copy>
<copy todir="${bin}/js" overwrite="false" encoding="UTF-8">
<fileset dir="${templates}/www/js" />
</copy>
<copy file="${templates}/www/expressInstall.swf" tofile="${bin}/expressInstall.swf" overwrite="false" encoding="UTF-8" />
<copy file="${templates}/www/scaffold.swf" tofile="${bin}/scaffold.swf" overwrite="false" encoding="UTF-8" />
<copy file="${templates}/www/xml/site.xml" tofile="${bin}/xml/site.xml" overwrite="false" encoding="UTF-8">
<filterchain>
<replacetokens>
<token key="title" value="${appname}" />
</replacetokens>
</filterchain>
</copy>
<copy file="${templates}/gitignore" tofile=".gitignore" overwrite="false" encoding="UTF-8" />
</target>
<target name="create-main">
<copy file="${templates}/Main.as" tofile="${src}/Main.as" overwrite="false" encoding="UTF-8">
<filterchain>
<replacetokens>
<token key="width" value="${width}" />
<token key="height" value="${height}" />
<token key="framerate" value="${framerate}" />
<token key="bgcolor" value="${bgcolor}" />
<token key="PACKAGENAME" value="${project.package}" />
</replacetokens>
</filterchain>
</copy>
<create-xfl name="main" document="Main" />
<create-launch name="Main" document="src/Main.as" swf="bin/main.swf" />
</target>
<target name="create-preload">
<copy file="${templates}/Preloader.as" tofile="${pages.src}/Preloader.as" overwrite="false" encoding="UTF-8">
<filterchain>
<replacetokens>
<token key="width" value="${width}" />
<token key="height" value="${height}" />
<token key="framerate" value="${framerate}" />
<token key="bgcolor" value="${bgcolor}" />
<token key="PACKAGENAME" value="${pages.full.package}" />
</replacetokens>
</filterchain>
</copy>
<create-xfl name="preload" document="${pages.full.package}.Preloader" />
<var name="relative.pages.src" unset="true" />
<replace-dot property="relative.pages.src" input="src/${pages.full.package}" />
<create-launch name="Preload" document="${relative.pages.src}/Preloader.as" swf="bin/preload.swf" />
</target>
<target name="create-pages">
<echo message="create-pages" />
<xmltask source="${sitexml}">
<call path="//page">
<param name="package" path="@package" default="" />
<param name="class" path="@id" />
<param name="source" path="@src" />
<actions>
<var name="is_external" unset="true" />
<get-page-type property="is_external" input="@{source}" domain="${base.url}" class="@{class}" package="@{package}" />
<if>
<equals arg1="${is_external}" arg2="true" />
<then>
<var name="fuppercase" unset="true" />
<first-uppercase property="fuppercase" input="@{class}" />
<var name="relative.pages.src" unset="true" />
<replace-dot property="relative.pages.src" input="src/${pages.full.package}" />
<if>
<equals arg1="@{package}" arg2="" />
<then>
<copy file="${templates}/Page.as" tofile="${pages.src}/@{package}/${fuppercase}Page.as" overwrite="false" encoding="UTF-8">
<filterchain>
<replacetokens>
<token key="PACKAGENAME" value="${pages.full.package}" />
<token key="CLASSNAME" value="${fuppercase}Page" />
<token key="IMPORT" value="" />
<token key="width" value="${width}" />
<token key="height" value="${height}" />
<token key="framerate" value="${framerate}" />
<token key="bgcolor" value="${bgcolor}" />
</replacetokens>
</filterchain>
</copy>
<create-xfl name="@{class}" document="${pages.full.package}.${fuppercase}Page" />
<create-launch name="${fuppercase}Page" document="${relative.pages.src}/${fuppercase}Page.as" swf="bin/@{source}" />
</then>
<else>
<copy file="${templates}/Page.as" tofile="${pages.src}/@{package}/${fuppercase}Page.as" overwrite="false" encoding="UTF-8">
<filterchain>
<replacetokens>
<token key="PACKAGENAME" value="${pages.full.package}.@{package}" />
<token key="CLASSNAME" value="${fuppercase}Page" />
<token key="IMPORT" value="import ${pages.full.package}.*;" />
<token key="width" value="${width}" />
<token key="height" value="${height}" />
<token key="framerate" value="${framerate}" />
<token key="bgcolor" value="${bgcolor}" />
</replacetokens>
</filterchain>
</copy>
<create-xfl name="@{class}" document="${pages.full.package}.@{package}.${fuppercase}Page" />
<create-launch name="${fuppercase}Page" document="${relative.pages.src}/${fuppercase}Page.as" swf="bin/@{source}" />
</else>
</if>
</then>
</if>
</actions>
</call>
</xmltask>
</target>
<target name="create-static-page">
<echo message="create-static-page" />
<var name="pagesconst" value="//PageConstants" />
<get-branch input="site" />
<copy file="${templates}/StaticReferencePages.as" tofile="${pages.src}/Pages.as" overwrite="true" encoding="UTF-8">
<filterchain>
<replacetokens>
<token key="PACKAGENAME" value="${pages.full.package}" />
<token key="PAGES" value="${pagesconst}" />
</replacetokens>
</filterchain>
</copy>
</target>
<target name="xml-update-bytes" description="update bytes in site.xml">
<echo message="xml-update-bytes" />
<update-page-site-xml />
<update-asset-site-xml />
</target>
<target name="xml-remove-bytes" description="remove bytes in site.xml">
<echo message="xml-remove-bytes" />
<remove-bytes-site-xml />
</target>
<macrodef name="update-bytes-page">
<attribute name="input" default="home" />
<attribute name="bytes" default="0" />
<attribute name="seoBytes" default="0" />
<sequential>
<echo message="@{input}" />
<if>
<equals arg1="@{seoBytes}" arg2="0" />
<then>
<xmltask source="${bin}/xml/site.xml" dest="${bin}/site3.xml">
<attr path="//page[@id='@{input}']" attr="bytes" value="@{bytes}" />
<attr path="//page[@id='@{input}']" attr="seoBytes" remove="true" />
</xmltask>
</then>
<else>
<xmltask source="${bin}/xml/site.xml" dest="${bin}/site3.xml">
<attr path="//page[@id='@{input}']" attr="bytes" value="@{bytes}" />
<attr path="//page[@id='@{input}']" attr="seoBytes" value="@{seoBytes}" />
</xmltask>
</else>
</if>
<copy file="${bin}/site3.xml" tofile="${bin}/xml/site.xml" overwrite="true" encoding="UTF-8" />
<delete file="${bin}/site3.xml" />
</sequential>
</macrodef>
<macrodef name="update-bytes-asset">
<attribute name="input" default="home" />
<attribute name="bytes" default="0" />
<sequential>
<echo message="@{input}" />
<if>
<equals arg1="@{bytes}" arg2="0" />
<then>
<xmltask source="${bin}/xml/site.xml" dest="${bin}/site3.xml">
<attr path="//asset[@id='@{input}']" attr="bytes" remove="true" />
</xmltask>
</then>
<else>
<xmltask source="${bin}/xml/site.xml" dest="${bin}/site3.xml">
<attr path="//asset[@id='@{input}']" attr="bytes" value="@{bytes}" />
</xmltask>
</else>
</if>
<copy file="${bin}/site3.xml" tofile="${bin}/xml/site.xml" overwrite="true" encoding="UTF-8" />
<delete file="${bin}/site3.xml" />
</sequential>
</macrodef>
<macrodef name="remove-bytes-site-xml">
<sequential>
<xmltask source="${bin}/xml/site.xml" dest="${bin}/site2.xml">
<attr path="//page" attr="bytes" remove="true" />
<attr path="//page" attr="seoBytes" remove="true" />
<attr path="//asset" attr="bytes" remove="true" />
</xmltask>
<copy file="${bin}/site2.xml" tofile="${bin}/xml/site.xml" overwrite="true" encoding="UTF-8" />
<delete file="${bin}/site2.xml" />
</sequential>
</macrodef>
<macrodef name="update-page-site-xml">
<sequential>
<xmltask source="${bin}/xml/site.xml" dest="${bin}/site2.xml">
<call path="//page">
<param name="swffile" path="@src" />
<param name="htmlfile" path="@seo" default="false" />
<param name="ident" path="@id" default="false" />
<actions>
<var name="branch" value="" unset="true" />
<var name="existSwf" value="" unset="true" />
<var name="existHtmlSeo" value="" unset="true" />
<var name="existHtmlId" value="" unset="true" />
<var name="bytes" unset="true" />
<var name="seoBytes" value="0" unset="true" />
<available file="${bin}/@{swffile}" property="existSwf" />
<available file="${bin}/@{htmlfile}" property="existHtmlSeo" />
<available file="${bin}/@{ident}.html" property="existHtmlId" />
<if>
<equals arg1="${existSwf}" arg2="true" />
<then>
<length file="${bin}/@{swffile}" property="bytes" />
<get-branch-page input="site" page="@{ident}" />
<if>
<equals arg1="${existHtmlSeo}" arg2="true" />
<then>
<length file="${bin}/@{htmlfile}" property="seoBytes" />
</then>
<elseif>
<and>
<equals arg1="${existHtmlId}" arg2="true" />
<not>
<equals arg1="@{ident}" arg2="index" />
</not>
</and>
<then>
<length file="${bin}/@{ident}.html" property="seoBytes" />
</then>
</elseif>
<else>
<var name="seoBytes" value="0" />
</else>
</if>
<update-bytes-page input="@{ident}" bytes="${bytes}" seoBytes="${seoBytes}" />
</then>
</if>
</actions>
</call>
</xmltask>
<delete file="${bin}/site2.xml" />
</sequential>
</macrodef>
<macrodef name="update-asset-site-xml">
<sequential>
<xmltask source="${bin}/xml/site.xml" dest="${bin}/site2.xml">
<call path="//asset">
<param name="file" path="@src" />
<param name="ident" path="@id" default="false" />
<actions>
<var name="branch" value="" unset="true" />
<var name="existFile" value="" unset="true" />
<var name="bytes" value="0" unset="true" />
<available file="${bin}/@{file}" property="existFile" />
<if>
<equals arg1="${existFile}" arg2="true" />
<then>
<length file="${bin}/@{file}" property="bytes" />
<update-bytes-asset input="@{ident}" bytes="${bytes}" />
</then>
</if>
</actions>
</call>
</xmltask>
<delete file="${bin}/site2.xml" />
</sequential>
</macrodef>
<macrodef name="get-branch-page">
<attribute name="input" default="" />
<attribute name="parent" default="" />
<attribute name="page" default="index" />
<sequential>
<echo message="get-branch-page: @{input}" />
<xmltask source="${sitexml}">
<call path="@{input}/page">
<param name="class" path="@id" />
<param name="seo" path="@seo" default="false" />
<actions>
<var name="uppercase" unset="true" />
<var name="lowercase" unset="true" />
<var name="ruta" unset="true" />
<uppercase property="uppercase" input="@{class}" />
<lowercase property="lowercase" input="@{class}" />
<drop-first-character property="ruta" input="@{parent}/${lowercase}" />
<if>
<equals arg1="@{class}" arg2="@{page}" />
<then>
<var name="branch" value="${ruta}" />
</then>
<else>
<get-branch-page input="@{input}/page" page="@{page}" parent="@{parent}/${lowercase}" />
</else>
</if>
</actions>
</call>
</xmltask>
</sequential>
</macrodef>
<macrodef name="create-html-page">
<attribute name="name" default="index" />
<attribute name="branch" default="index" />
<attribute name="pagetitle" default="index" />
<sequential>
<copy file="${templates}/www/index.html" tofile="${bin}/@{name}" overwrite="true" encoding="UTF-8">
<filterchain>
<replacetokens>
<token key="title" value="${appname}" />
<token key="player" value="${player}" />
<token key="branch" value="@{branch}" />
<token key="baseurl" value="${base.url}" />
<token key="pagetitle" value="@{pagetitle}" />
</replacetokens>
</filterchain>
</copy>
</sequential>
</macrodef>
<macrodef name="create-xfl">
<attribute name="name" default="" />
<attribute name="document" default="" />
<sequential>
<echo message="create-xfl: @{name}.xfl | @{document}" />
<var name="ver" unset="true" />
<short-version property="ver" input="${player}" />
<copy todir="${ide}/@{name}" overwrite="false" encoding="UTF-8">
<fileset dir="${templates}/ide/template" />
</copy>
<copy file="${templates}/ide/template.xfl" tofile="${ide}/@{name}/@{name}.xfl" overwrite="false" encoding="UTF-8" />
<copy file="${templates}/ide/DOMDocument.xml" tofile="${ide}/@{name}/DOMDocument.xml" overwrite="false" encoding="UTF-8">
<filterchain>
<replacetokens>
<token key="width" value="${width}" />
<token key="height" value="${height}" />
<token key="framerate" value="${framerate}" />
<token key="bgcolor" value="${bgcolor}" />
</replacetokens>
</filterchain>
</copy>
<copy file="${templates}/ide/PublishSettings.xml" tofile="${ide}/@{name}/PublishSettings.xml" overwrite="false" encoding="UTF-8">
<filterchain>
<replacetokens>
<token key="name" value="@{name}" />
<token key="document" value="@{document}" />
<token key="version" value="${ver}" />
<token key="width" value="${width}" />
<token key="height" value="${height}" />
</replacetokens>
</filterchain>
</copy>
</sequential>
</macrodef>
<macrodef name="create-launch">
<attribute name="name" default="" />
<attribute name="document" default="" />
<attribute name="swf" default="" />
<sequential>
<if>
<equals arg1="${fdt}" arg2="true" />
<then>
<echo message="create-launch: @{name}" />
<copy file="${templates}/Page.launch" tofile="${settings}/launch/${appname} - @{name}.launch" overwrite="false" encoding="UTF-8">
<filterchain>
<replacetokens>
<token key="appname" value="${appname}" />
<token key="width" value="${width}" />
<token key="height" value="${height}" />
<token key="document" value="@{document}" />
<token key="swf" value="@{swf}" />
</replacetokens>
</filterchain>
</copy>
</then>
</if>
</sequential>
</macrodef>
<macrodef name="create-sitemap">
<attribute name="sitemap" default="" />
<sequential>
<copy file="${templates}/www/sitemap.xml" tofile="${bin}/sitemap.xml" overwrite="true" encoding="UTF-8">
<filterchain>
<replacetokens>
<token key="sitemap" value="@{sitemap}" />
</replacetokens>
</filterchain>
</copy>
<echo message="@{sitemap}" />
</sequential>
</macrodef>
<macrodef name="add-seo-menu">
<attribute name="seomenu" default="" />
<sequential>
<copy todir="${bin}" overwrite="true" encoding="UTF-8">
<fileset dir="${bin}/noseo">
</fileset>
<filterchain>
<replacetokens>
<token key="seo" value="@{seomenu}" />
</replacetokens>
</filterchain>
</copy>
<echo message="@{seomenu}" />
</sequential>
</macrodef>
<target name="seo-html">
<mkdir dir="${bin}/noseo" />
<var name="menu" value="" unset="true" />
<var name="branch" value="" unset="true" />
<create-html-page name="noseo/index.html" branch="index" pagetitle="${appname}" />
<var name="menu" value="<li><a href='${base.url}'>Index</a></li>${line.separator}" />
<var name="sitemap" value="<url><loc>${base.url}/index.html</loc></url>${line.separator}" />
<xmltask source="${sitexml}">
<call path="//page[@seo]">
<param name="id" path="@id" default="NO ID" />
<param name="seo" path="@seo" default="false" />
<param name="title" path="@title" default="" />
<actions>
<if>
<equals arg1="@{seo}" arg2="true" />
<then>
<echo message="@{id}" />
<get-branch-page input="site" page="@{id}" />
<echo message="${branch}" />
<create-html-page name="noseo/@{id}.html" branch="${branch}" pagetitle="@{title}" />
<var name="menu" value="${menu}<li><a href='${base.url}/@{id}.html'>@{title}</a></li>${line.separator}" />
<var name="sitemap" value="${sitemap}<url><loc>${base.url}/@{id}.html</loc></url>${line.separator}" />
</then>
<else>
<!-- custom seo path -->
<echo message="@{seo}" />
<get-branch-page input="site" page="@{id}" />
<echo message="${branch}" />
<create-html-page name="noseo/@{seo}" branch="${branch}" pagetitle="@{title}" />
<var name="menu" value="${menu}<li><a href='${base.url}/@{seo}'>@{title}</a></li>${line.separator}" />
<var name="sitemap" value="${sitemap}<url><loc>${base.url}/@{seo}</loc></url>${line.separator}" />
</else>
</if>
</actions>
</call>
</xmltask>
<echo message="${menu}" />
<add-seo-menu seomenu="${menu}" />
<create-sitemap sitemap="${sitemap}" />
<delete dir="${bin}/noseo" />
</target>
<!-- Compile -->
<target name="compile-pages" description="compile-pages">
<echo message="compile-pages" />
<xmltask source="${sitexml}">
<call path="//page">
<param name="id" path="@id" default="NO ID" />
<param name="dest" path="@src" default="NO ID" />
<param name="pack" path="@package" default="" />
<actions>
<var name="is_external" unset="true" />
<var name="existPageClass" unset="true" />
<get-page-type property="is_external" input="@{dest}" domain="${base.url}" class="@{id}" package="${package}" />
<if>
<equals arg1="${is_external}" arg2="true" />
<then>
<var name="fuppercase" unset="true" />
<first-uppercase property="fuppercase" input="@{id}" />
<if>
<equals arg1="@{package}" arg2="" />
<then>
<available file="${pages.src}/${fuppercase}Page.as" property="existPageClass" />
<if>
<equals arg1="${existPageClass}" arg2="true" />
<then>
<compile source="${pages.src}/${fuppercase}Page.as" target="${bin}/@{dest}" debug="false" />
</then>
<else>
<echo message="${pages.src}/${fuppercase}Page.as no exist, skipped." />
</else>
</if>
</then>
<else>
<available file="${pages.src}/@{pack}/${fuppercase}Page.as" property="existPageClass" />
<if>
<equals arg1="${existPageClass}" arg2="true" />
<then>
<compile source="${pages.src}/@{pack}/${fuppercase}Page.as" target="${bin}/@{dest}" debug="false" />
</then>
<else>
<echo message="${pages.src}/@{pack}/${fuppercase}Page.as no exist, skipped." />
</else>
</if>
</else>
</if>
</then>
</if>
</actions>
</call>
</xmltask>
</target>
<target name="debug-pages" description="debug-pages">
<echo message="debug-pages" />
<xmltask source="${sitexml}">
<call path="//page">
<param name="id" path="@id" default="NO ID" />
<param name="dest" path="@src" default="NO ID" />
<param name="pack" path="@package" default="" />
<actions>
<var name="is_external" unset="true" />
<var name="existPageClass" unset="true" />
<get-page-type property="is_external" input="@{dest}" domain="${base.url}" class="@{id}" package="${package}" />
<if>
<equals arg1="${is_external}" arg2="true" />
<then>
<var name="fuppercase" unset="true" />
<first-uppercase property="fuppercase" input="@{id}" />
<if>
<equals arg1="@{package}" arg2="" />
<then>
<available file="${pages.src}/${fuppercase}Page.as" property="existPageClass" />
<if>
<equals arg1="${existPageClass}" arg2="true" />
<then>
<compile source="${pages.src}/${fuppercase}Page.as" target="${bin}/@{dest}" debug="true" />
</then>
<else>
<echo message="${pages.src}/${fuppercase}Page.as no exist, skipped." />
</else>
</if>
</then>
<else>
<available file="${pages.src}/@{pack}/${fuppercase}Page.as" property="existPageClass" />
<if>
<equals arg1="${existPageClass}" arg2="true" />
<then>
<compile source="${pages.src}/@{pack}/${fuppercase}Page.as" target="${bin}/@{dest}" debug="true" />
</then>
<else>
<echo message="${pages.src}/@{pack}/${fuppercase}Page.as no exist, skipped." />
</else>
</if>
</else>
</if>
</then>
</if>
</actions>
</call>
</xmltask>
</target>
<target name="compile-preloader" description="compile-preloader">
<echo message="compile-preloader" />
<compile source="${pages.src}/Preloader.as" target="${bin}/preload.swf" debug="false" />
</target>
<target name="debug-preloader" description="debug-preloader">
<echo message="debug-preloader" />
<compile source="${pages.src}/Preloader.as" target="${bin}/preload.swf" debug="true" />
</target>
<target name="compile-main" description="compile-main">
<echo message="compile-main" />
<compile source="${src}/Main.as" target="${bin}/main.swf" debug="false" />
<!--
<exec executable="${flashplayer}">
<arg line="${gaia.bin}/main.swf" />
</exec>
-->
</target>
<target name="debug-main" description="debug-main">
<echo message="debug-main" />
<compile source="${src}/Main.as" target="${bin}/main.swf" debug="true" />
</target>
<macrodef name="compile">
<attribute name="source" />
<attribute name="target" default="bin" />
<attribute name="debug" default="false" />
<sequential>
<if>
<equals arg1="${fdt}" arg2="true" />
<then>
<fdt.loadProjectProperties projectname="${appname}" />
<fdt.launch.application projectname="${FDTProject}" mainclass="@{source}" target="@{target}" debug="@{debug}" />
</then>
<else>
<mxmlc file="@{source}" output="@{target}" debug="@{debug}" target-player="${player}" optimize="true">
<compiler.library-path dir="${lib}">
<include name="**/*.swc" />
<include name="${project.lib.linked0}" />
<include name="${project.lib.linked1}" />
<include name="${project.lib.linked2}" />
<exclude name="${project.lib.exclude0}" />
<exclude name="${project.lib.exclude1}" />
<exclude name="${project.lib.exclude2}" />
</compiler.library-path>
<!--
<compiler.external-library-path dir="${lib}">
<include name="**/*.swc" />
<include name="${project.lib.linked0}" />
<include name="${project.lib.linked1}" />
<include name="${project.lib.linked2}" />
<exclude name="${project.lib.exclude0}" />
<exclude name="${project.lib.exclude1}" />
<exclude name="${project.lib.exclude2}" />
</compiler.external-library-path>
-->
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
<compiler.keep-as3-metadata name="Inject" />
<compiler.keep-as3-metadata name="PostConstruct" />
<source-path path-element="${FLEX_HOME}/frameworks" />
<source-path path-element="${src}" />
</mxmlc>
</else>
</if>
</sequential>
</macrodef>
<macrodef name="get-branch">
<attribute name="input" default="" />
<attribute name="parent" default="" />
<sequential>
<echo message="get-branch: @{input} | @{parent}" />
<xmltask source="${sitexml}">
<call path="@{input}/page">
<param name="class" path="@id" />
<actions>
<var name="uppercase" unset="true" />
<var name="ruta" unset="true" />
<uppercase property="uppercase" input="@{class}" />
<drop-first-character property="ruta" input="@{parent}/@{class}" />
<var name="pagesconst" value="${pagesconst}${line.separator} public static const ${uppercase}:String = '${ruta}';" />
<get-branch input="@{input}/page[@id='@{class}']" parent="@{parent}/@{class}" />
</actions>
</call>
</xmltask>
</sequential>
</macrodef>
<target name="create-build-info">
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm" locale="en,UK" />
</tstamp>
<echo file="${bin}/${buildInfo}">Author: ${user.name}
Date: ${TODAY}
Project: ${appname}
Target player: ${player}
RobotGaiaAnt version: ${version}
Built on: ${os.name} (${os.version})</echo>
</target>
</project>