-
Notifications
You must be signed in to change notification settings - Fork 20
/
build.xml
1329 lines (1203 loc) · 54.7 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
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!-- build configuration -->
<project name="msoy" default="compile" basedir="." xmlns:artifact="urn:maven-artifact-ant">
<!-- define some basic project parameters -->
<property name="app.name" value="msoy"/>
<!-- things you probably don't want to change -->
<property name="src.dir" value="src/java"/>
<property name="gsrc.dir" value="src/gwt"/>
<property name="asrc.dir" value="src/as"/>
<property name="deploy.dir" value="dist"/>
<property name="classes.dir" value="${deploy.dir}/classes"/>
<property name="tclasses.dir" value="${deploy.dir}/test-classes"/>
<property name="gwtout.dir" value="pages/gwt"/>
<property name="extlibs.dir" value="extlibs/java"/>
<property name="javadoc.title" value="Metasoy API"/>
<!-- define various packaging properties -->
<property name="msoy.user" value="ubuntu"/>
<property name="burl.user" value="ubuntu"/>
<property name="msoy.group" value="ubuntu"/>
<property name="maintainer.name" value="Michael Bayne"/>
<property name="maintainer.email" value="mdb@threerings.net"/>
<!-- defines the build version (normally zero unless we're doing a package build) -->
<property name="version" value="0"/>
<!-- import any local build configuration -->
<property file="build.properties"/>
<!-- define our subprojects and include the standard build system -->
<import file="build/etc/build-support.xml"/>
<fileset dir="." id="check.paths">
<include name="${src.dir}/**/*.java"/>
<exclude name="${src.dir}/**/data/*Marshaller.java"/>
<exclude name="${src.dir}/**/server/*Provider.java"/>
<exclude name="${src.dir}/**/server/*Dispatcher.java"/>
<include name="${gsrc.dir}/client/**/*.java"/>
<exclude name="${gsrc.dir}/**/*Messages.java"/>
<exclude name="${gsrc.dir}/client/images/**/*Images.java"/>
</fileset>
<!-- override the src dirset and package names for the common javadoc target -->
<property name="javadoc.pkg.names" value="client.*,com.threerings.msoy.*"/>
<path id="javadoc.src.path">
<!-- TODO make this only look for bits inside of client/ -->
<dirset dir="${gsrc.dir}">
<exclude name="**/.svn"/>
</dirset>
<dirset dir="${src.dir}">
<exclude name="**/.svn"/>
</dirset>
</path>
<!-- declare the libraries needed only during the build process -->
<filelist dir="." id="build.libs">
<file name="${extlibs.dir}/junit-3.7.jar"/>
<file name="${extlibs.dir}/junit4.jar"/>
<!--<file name="${extlibs.dir}/retroweaver-all-1.2.2.jar"/>
<file name="${extlibs.dir}/retroweaver-rt-1.2.2.jar"/>-->
</filelist>
<!-- declare the libraries needed by the MSOY runtime and for building -->
<filelist dir="." id="runtime.libs">
<!-- The following are used for HTML sanitization -->
<!-- TODO: move into lib?
<file name="${extlibs.dir}/antisamy/antisamy-bin.1.0.jar"/>
<file name="${extlibs.dir}/antisamy/batik-css.jar"/>
<file name="${extlibs.dir}/antisamy/batik-util.jar"/>
<file name="${extlibs.dir}/antisamy/dom4j.jar"/>
<file name="${extlibs.dir}/antisamy/nekohtml.jar"/>
<file name="${extlibs.dir}/antisamy/sac.jar"/>
<file name="${extlibs.dir}/xercesImpl.jar"/>
-->
<file name="lib/s3lib-r347.jar"/>
<file name="lib/json.jar"/>
<file name="lib/jswiff-8.0-beta-2-threerings.jar"/>
<file name="lib/sdoc-0.5.0-beta-ooo.jar"/>
<file name="lib/substance-lite.jar"/>
<!-- The following are used for aperture -->
<file name="lib/aperture/aperture-2006.1-alpha-3.jar"/>
<file name="lib/aperture/aperture-test-2006.1-alpha-3.jar"/>
<file name="lib/aperture/applewrapper-0.1.jar"/>
<file name="lib/aperture/bcmail-jdk14-132.jar"/>
<file name="lib/aperture/bcprov-jdk14-132.jar"/>
<file name="lib/aperture/demork-2.0.jar"/>
<file name="lib/aperture/fontbox-0.1.0-dev.jar"/>
<file name="lib/aperture/htmlparser-1.6.jar"/>
<file name="lib/aperture/ical4j-cvs20061019.jar"/>
<file name="lib/aperture/jacob-1.10-pre4.jar"/>
<file name="lib/aperture/openrdf-model-2.0-alpha-3.jar"/>
<file name="lib/aperture/openrdf-util-2.0-alpha-3.jar"/>
<file name="lib/aperture/openrdf-util-crazy-debug.jar"/>
<file name="lib/aperture/openrdf-util-fixed-locking.jar"/>
<file name="lib/aperture/pdfbox-0.7.3.jar"/>
<file name="lib/aperture/poi-3.0-alpha2-20060616.jar"/>
<file name="lib/aperture/poi-contrib-3.0-alpha2-20060616.jar"/>
<file name="lib/aperture/poi-scratchpad-3.0-alpha2-20060616.jar"/>
<file name="lib/aperture/rio-2.0-alpha-3.jar"/>
<file name="lib/aperture/sesame-2.0-alpha-3.jar"/>
<file name="lib/aperture/winlaf-0.5.1.jar"/>
<!-- The following are used for webmail address book importing -->
<!--
<file name="${extlibs.dir}/abimporter.jar"/>
<file name="${extlibs.dir}/ozcommons.jar"/>
-->
<!-- The following are used by our Flash clients -->
<file name="lib/tweener.swc"/>
<file name="lib/KongregateAPI.swc"/>
</filelist>
<!-- fetches our library dependencies -->
<property name="gwt.version" value="2.6.1"/>
<target name="mavendeps" depends="prepare">
<!-- these libraries we need for building and for the server runtime -->
<artifact:pom id="msoypom" file="pom.xml" />
<artifact:dependencies filesetId="runtime.fileset" pomRefId="msoypom" />
<copy todir="${deploy.dir}/lib">
<fileset refid="runtime.fileset"/>
<mapper type="flatten"/>
</copy>
<!-- these libraries we only need to build -->
<artifact:dependencies filesetId="build.fileset">
<dependency groupId="com.google.gwt" artifactId="gwt-user" version="${gwt.version}"/>
<!--
<dependency groupId="com.google.gwt" artifactId="gwt-incubator" version="2.0.1"/>
-->
<dependency groupId="net.sf.advanced-gwt" artifactId="advanced-gwt" version="2.0.9"/>
<dependency groupId="com.allen-sauer.gwt.dnd" artifactId="gwt-dnd" version="3.1.2"/>
<dependency groupId="com.threerings" artifactId="narya" version="1.8"/>
<dependency groupId="com.threerings" artifactId="narya-gwt" version="1.8"/>
<dependency groupId="com.threerings" artifactId="orth" version="0.9">
<!-- exclude vile snapshot versions that got shipped, blarg -->
<exclusion groupId="com.threerings" artifactId="narya"/>
<exclusion groupId="com.threerings" artifactId="vilya"/>
</dependency>
<dependency groupId="com.threerings" artifactId="orth-gwt" version="0.9"/>
<dependency groupId="com.threerings" artifactId="underwire" version="1.0"/>
<dependency groupId="com.threerings" artifactId="underwire-gwt" version="1.0"/>
<dependency groupId="com.threerings" artifactId="gwt-utils" version="1.7.1"/>
<dependency groupId="com.google.guava" artifactId="guava-gwt" version="18.0"/>
<!-- findbugs needed for a guava-gwt problem: may not be required in the future -->
<dependency groupId="net.sourceforge.findbugs" artifactId="jsr305" version="1.3.2"/>
</artifact:dependencies>
<copy todir="${deploy.dir}/build">
<fileset refid="build.fileset"/>
<mapper type="flatten"/>
</copy>
</target>
<target name="mavendeps-as">
<!-- these libraries we need for building actionscript -->
<artifact:dependencies filesetId="aslib.fileset">
<remoteRepository id="ooo-public" url="https://raw.githubusercontent.com/threerings/maven-repo/master/repository"/>
<dependency groupId="org.osflash" artifactId="signals"
version="0.8.1-ooo" type="swc"/>
<dependency groupId="com.threerings" artifactId="toyboxlib"
version="1.0" type="swc"/>
<dependency groupId="com.threerings" artifactId="whirledthanelib"
version="1.0" type="swc"/>
<dependency groupId="com.threerings" artifactId="thane"
version="1.0" type="swc"/>
<dependency groupId="com.threerings" artifactId="naryalib"
version="1.9" type="swc"/>
<dependency groupId="com.threerings" artifactId="vilyalib"
version="1.1" type="swc"/>
<dependency groupId="nochump" artifactId="zip" version="1.0" type="swc"/>
<dependency groupId="com.threerings" artifactId="orthlib"
version="0.9" type="swc">
<!-- exclude vile snapshot versions that got shipped, blarg -->
<exclusion groupId="com.threerings" artifactId="aspirin"/>
<exclusion groupId="com.threerings" artifactId="naryalib"/>
</dependency>
<dependency groupId="com.threerings" artifactId="whirledlib"
version="1.1-SNAPSHOT" type="swc"/>
<dependency groupId="com.threerings" artifactId="aspirin"
version="1.10" type="swc"/>
</artifact:dependencies>
<copy todir="${deploy.dir}/lib">
<fileset refid="aslib.fileset"/>
<chainedmapper>
<mapper type="flatten"/>
<mapper type="regexp" from="(.+?)(-(SNAPSHOT|ooo))?.swc" to="\1.swc"/>
<mapper type="regexp" from="(.*)-([^-])+.swc" to="\1.swc"/>
</chainedmapper>
</copy>
</target>
<!-- declare our classpath -->
<path id="classpath">
<pathelement location="${classes.dir}"/>
<fileset dir="${deploy.dir}/lib" includes="*.jar"/>
<fileset dir="lib" includes="plugin.jar"/>
</path>
<!-- declare our test classpath -->
<path id="test.classpath">
<path refid="classpath"/>
<pathelement location="${tclasses.dir}"/>
<fileset dir="${deploy.dir}/build" includes="*.jar"/>
</path>
<!-- declare our GWT classpath -->
<path id="gwt.classpath">
<fileset dir="${deploy.dir}/build" includes="*.jar"/>
<pathelement location="${src.dir}"/>
<pathelement location="${gsrc.dir}"/>
</path>
<!-- gets our various properties files and sticks them in dist -->
<target name="config">
<mkdir dir="${deploy.dir}"/>
<!-- determine which deployment we're building -->
<if><not><isset property="deployment"/></not><then>
<property name="deployment" value="test"/>
</then></if>
<!-- grab the deployment et al properties from the configuration location. -->
<dirname property="absolute.deploy.dir" file="${deploy.dir}/somefile.txt"/>
<copy todir="${absolute.deploy.dir}">
<fileset dir="${basedir}/etc/${deployment}">
<include name="msoy-server.properties"/>
<include name="msoy-server.conf"/>
<include name="burl-server.properties"/>
<include name="burl-server.conf"/>
<include name="build_settings.properties"/>
<include name="log4j.properties"/>
<include name="log4j-bureaulauncher.properties"/>
<include name="ehcache.xml"/>
</fileset>
</copy>
<!-- Read in all the deployment & build configuration bits. -->
<property file="${deploy.dir}/msoy-server.properties"/>
<property file="${deploy.dir}/build_settings.properties"/>
</target>
<!-- prepares the application directories -->
<target name="prepare" depends="config">
<mkdir dir="${deploy.dir}/lib"/>
<mkdir dir="${deploy.dir}/build"/>
<mkdir dir="${deploy.dir}/tmp"/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${classes.dir}/rsrc"/>
<copy todir="${classes.dir}/rsrc">
<fileset dir="rsrc">
<include name="**/*"/>
</fileset>
</copy>
<mkdir dir="${tclasses.dir}"/>
<!-- copy all the libs we need for building and for runtime -->
<copyfilelist dest="${deploy.dir}/lib">
<filelist refid="runtime.libs"/>
</copyfilelist>
<!-- TODO
<copyfilelist dest="${deploy.dir}/build">
<filelist refid="build.libs"/>
</copyfilelist>
-->
<!-- create our toybox propertis from msoy-server.properties -->
<exec executable="egrep">
<arg line="^toybox\."/>
<arg line="${deploy.dir}/msoy-server.properties"/>
<redirector output="${classes.dir}/toybox.properties">
<outputfilterchain>
<replacestring from="toybox." to=""/>
</outputfilterchain>
</redirector>
</exec>
<!-- copy a few configuration files into place -->
<copy todir="${deploy.dir}" file="${basedir}/etc/logging.properties"/>
<!-- generate index.html and crossdomain.xml-->
<propertyregex property="server_url_host" input="${server_url}"
regexp="http://([^:]*)(:[0-9]+)?/" replace="\1"/>
<copy file="pages/index.html.in" tofile="pages/index.html" overwrite="true">
<filterset>
<filter token="SERVER_URL" value="${server_url}"/>
<filter token="SERVER_URL_HOST" value="${server_url_host}"/>
<filter token="GA_ACCOUNT" value="${ga_account}"/>
</filterset>
</copy>
<propertyregex property="server_url_host" input="${server_url}"
regexp="http://([^:/]*):?.*" replace="\1"/>
<propertyregex property="media_url_host" input="${media_url}"
regexp="http://([^:/]*):?.*" replace="\1"/>
<copy file="pages/crossdomain.xml.in" tofile="pages/crossdomain.xml" overwrite="true">
<filterset>
<filter token="SERVER_URL_HOST" value="${server_url_host}"/>
<filter token="MEDIA_URL_HOST" value="${media_url_host}"/>
<filter token="HTTP_PORT" value="${http_port}"/>
</filterset>
</copy>
<!-- copy our HTML sanitizer configuration -->
<copy file="${basedir}/etc/antisamy-config.xml" todir="${deploy.dir}"/>
</target>
<!-- defines our various presents ant tasks -->
<target name="toolprep" depends="prepare">
<artifact:dependencies pathId="tools.classpath">
<dependency groupId="com.threerings" artifactId="narya-tools" version="1.9"/>
</artifact:dependencies>
<taskdef resource="com/threerings/presents/tools.properties"
classpathref="tools.classpath"/>
</target>
<target name="flexserver" depends="toolprep">
<java classname="com.martiansoftware.nailgun.NGServer" maxmemory="256m" fork="true">
<classpath>
<pathelement location="${flexsdk.dir}/lib/mxmlc.jar"/>
<pathelement location="${flexsdk.dir}/lib/compc.jar"/>
<pathelement location="${extlibs.dir}/nailgun.jar"/>
</classpath>
<jvmarg value="-Djava.awt.headless=true"/>
</java>
</target>
<!-- creates page.gwt.xml from page.gwt.xml.in, doing user agent fiddling -->
<target name="preppage">
<copy file="${gsrc.dir}/${page}.gwt.xml.in"
tofile="${gsrc.dir}/${page}.gwt.xml" overwrite="true"/>
</target>
<!-- regenerates our i18n messages classes -->
<target name="gmsgs">
<taskdef name="i18nsync" classname="com.threerings.gwt.tools.I18nSyncTask"
classpathref="classpath"/>
<i18nsync srcdir="${gsrc.dir}">
<fileset dir="${gsrc.dir}" includes="client/*/*Messages.properties"/>
</i18nsync>
</target>
<!-- prepares to build our GWT client -->
<target name="jprepare" depends="prepare">
<tstamp>
<format property="build_time" pattern="yyyy-MM-dd HH:mm:ss"/>
</tstamp>
<!-- set default properties -->
<property name="dev_deployment" value="true"/>
<!-- fucking ant -->
<if><isset property="recaptcha_public"/><then>
<property name="recaptcha_token" value="${recaptcha_public}"/>
</then><else>
<property name="recaptcha_token" value=""/>
</else></if>
<!-- then overwrite with values read from msoy-server.properties -->
<copy file="${src.dir}/com/threerings/msoy/data/all/DeploymentConfig.java.tmpl"
tofile="${src.dir}/com/threerings/msoy/data/all/DeploymentConfig.java" overwrite="true">
<filterset>
<filter token="build_time" value="${build_time}"/>
<filter token="build_version" value="${version}"/>
<filter token="server_url" value="${server_url}"/>
<filter token="server_host" value="${server_host}"/>
<filter token="media_url" value="${media_url}"/>
<filter token="static_media_url" value="${static_media_url}"/>
<filter token="dev_deployment" value="${dev_deployment}"/>
<filter token="recaptcha_public" value="${recaptcha_token}"/>
<filter token="billing_url" value="${billing_url}"/>
<filter token="signing_key_id" value="${cloud_signing_key_id}"/>
</filterset>
</copy>
</target>
<!-- compiles our GWT sources with javac; handy for smoke testing -->
<target name="gcompile">
<echo>Compiling GWT classes...</echo>
<mkdir dir="${deploy.dir}/gclasses"/>
<javac srcdir="${gsrc.dir}" destdir="${deploy.dir}/gclasses" includeAntRuntime="false"
debug="on" optimize="off" source="1.6" target="1.6">
<classpath>
<path refid="gwt.classpath"/>
<pathelement path="${classes.dir}"/>
</classpath>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
<compilerarg value="-Xlint:-path"/>
<compilerarg value="-Xlint:-deprecation"/>
</javac>
<delete dir="${deploy.dir}/gclasses"/>
</target>
<!-- builds our numerous GWT web clients -->
<target name="gclients" depends="jprepare,gmsgs"
description="Builds all GWT clients (use -Dpages to choose which).">
<pathconvert property="allpages" pathsep=",">
<path><fileset dir="src/gwt" includes="*.gwt.xml.in"/></path>
<mapper type="regexp" from=".*(/|\\)([a-z]+).gwt.xml.in" to="\2"/>
</pathconvert>
<echo>Converted ${allpages}</echo>
<property name="pages" value="${allpages}"/>
<for list="${pages}" param="page">
<sequential>
<antcall target="gpage" inheritAll="true">
<param name="page" value="@{page}"/>
</antcall>
</sequential></for>
</target>
<!-- builds a single GWT web client module (without dependencies) -->
<target name="gpage">
<property name="pageout.dir" value="${gwtout.dir}/${version}"/>
<mkdir dir="${pageout.dir}"/>
<delete dir="${pageout.dir}/${page}"/>
<mkdir dir="${pageout.dir}/${page}"/>
<!-- prepare our temporary .gwt.xml file -->
<antcall target="preppage"><param name="page" value="${page}"/></antcall>
<!-- invoke the GWT compiler and grindy grindy grindy -->
<artifact:dependencies pathId="gwt-dev.classpath">
<dependency groupId="com.google.gwt" artifactId="gwt-dev" version="${gwt.version}"/>
</artifact:dependencies>
<java fork="true" maxmemory="1024M" failonerror="false" resultproperty="gwt.result"
classname="com.google.gwt.dev.Compiler">
<classpath>
<path refid="gwt-dev.classpath"/>
<path refid="gwt.classpath"/>
</classpath>
<jvmarg value="-Djava.awt.headless=true"/>
<arg value="-style"/><arg value="${gwt_style}"/>
<arg value="-war"/>
<arg value="${pageout.dir}"/>
<arg value="${page}"/>
<!-- gather all the compiler output into a property -->
<redirector outputproperty="redirector.out"/>
</java>
<!-- delete our temporary .gwt.xml file -->
<delete file="${gsrc.dir}/${page}.gwt.xml"/>
<!-- until the GWT compiler does the right thing echo errors/warnings correctly -->
<if><contains string="${redirector.out}" substring="[ERROR]"/><then>
<echo level="error">${redirector.out}</echo>
<!-- be really, really sure that the build fails if we get an error logs -->
<property name="has.errors" value="true"/>
</then><elseif><contains string="${redirector.out}" substring="[WARNING]"/><then>
<echo level="warning">${redirector.out}</echo>
</then></elseif><else>
<echo level="info">${redirector.out}</echo>
</else></if>
<!-- fail the build if the GWT compiler returned 1 or errors were detected -->
<fail message="The GWT build failed. See output for details.">
<condition><or>
<equals arg1="${gwt.result}" arg2="1"/>
<isset property="has.errors"/>
</or></condition>
</fail>
<!-- if we succeeded, gzip our generated HTML output -->
<apply failonerror="true" executable="gzip">
<arg value="-k"/>
<srcfile/>
<fileset dir="${pageout.dir}/${page}" includes="*.cache.html"/>
</apply>
<!-- if we're building the 'frame' page, we need to move it up out of the version dir -->
<if><equals arg1="${page}" arg2="frame"/><then>
<move file="${pageout.dir}/${page}" todir="${gwtout.dir}"/>
</then></if>
<!-- clear out some variables -->
<var name="gwt.result" unset="true"/>
<var name="redirector.out" unset="true"/>
<var name="has.errors" unset="true"/>
</target>
<!-- prepares to build our Flash client -->
<target name="asprepare" depends="prepare">
<echo message="The Flex SDK is in ${flexsdk.dir}."/>
<mkdir dir="pages/clients/${version}"/>
<tstamp>
<format property="build_time" pattern="yyyy-MM-dd HH:mm:ss"/>
</tstamp>
<!-- set default properties -->
<property name="dev_deployment" value="true"/>
<property name="socket_policy_port" value="47623"/>
<property name="log_levels_config" value=""/>
<property name="xdom_url" value="${media_url}crossdomain.xml"/>
<property name="stub_url" value="${media_url}MediaStub.swf"/>
<!-- then overwrite with values read from msoy-server.properties -->
<copy file="${asrc.dir}/com/threerings/msoy/client/DeploymentConfig.as.tmpl"
tofile="${asrc.dir}/com/threerings/msoy/client/DeploymentConfig.as"
overwrite="true">
<filterset>
<filter token="build_time" value="${build_time}"/>
<filter token="build_version" value="${version}"/>
<filter token="server_host" value="${server_host}"/>
<filter token="server_ports" value="${server_ports}"/>
<filter token="socket_policy_port" value="${socket_policy_port}"/>
<filter token="server_url" value="${server_url}"/>
<filter token="media_url" value="${media_url}"/>
<filter token="dev_deployment" value="${dev_deployment}"/>
<filter token="static_media_url" value="${static_media_url}"/>
<filter token="log_levels_config" value="${log_levels_config}"/>
<filter token="billing_url" value="${billing_url}"/>
<filter token="announce_group_id" value="${announce_group_id}"/>
<filter token="signing_key_id" value="${cloud_signing_key_id}"/>
<filter token="xdom_url" value="${xdom_url}"/>
<filter token="stub_url" value="${stub_url}"/>
</filterset>
</copy>
<copy file="lib/framework_3.3.0.4852.swz" todir="pages/clients"/>
<copy file="lib/framework_3.3.0.4852.swf" todir="pages/clients"/>
<copy file="etc/msoy-config.xml.in" tofile="${deploy.dir}/msoy-config.xml">
<filterset>
<filter token="flex_sdk_dir" value="${flexsdk.dir}"/>
<filter token="server_url" value="${server_url}"/>
</filterset>
</copy>
</target>
<!-- just rebuilds the Flash client, assumes nothing has changed -->
<target name="ascompile">
<!-- set default properties (they're set only if unset) -->
<property name="aspath" value="client/world.mxml"/>
<property name="swfname" value="world-client"/>
<property name="dev_deployment" value="true"/>
<property name="flex.extra-arg" value="-externs=DummyValueIgnore"/>
<property name="flex.extra-arg-2" value="-externs=DummyValueIgnore"/>
<property name="copydir" value="pages/clients/${version}"/>
<mxmlc dest="${deploy.dir}/${swfname}.swf"
srcdir="${asrc.dir}" main="com/threerings/msoy/${aspath}"
stacktraces="${dev_deployment}" config="${deploy.dir}/msoy-config.xml">
<arg value="${flex.extra-arg}"/>
<arg value="${flex.extra-arg-2}"/>
<arg value="-compiler.optimize"/>
<arg value="-compiler.library-path+=${deploy.dir}/lib/aspirin.swc"/>
<arg value="-compiler.library-path+=${deploy.dir}/lib/naryalib.swc"/>
<arg value="-compiler.library-path+=${deploy.dir}/lib/nenyalib.swc"/>
<arg value="-compiler.library-path+=${deploy.dir}/lib/vilyalib.swc"/>
<arg value="-compiler.library-path+=${deploy.dir}/lib/zip.swc"/>
<arg value="-compiler.library-path+=${deploy.dir}/lib/whirledlib.swc"/>
<arg value="-compiler.library-path+=${deploy.dir}/lib/orthlib.swc"/>
<arg value="-compiler.library-path+=${deploy.dir}/lib/toyboxlib.swc"/>
<arg value="-compiler.library-path+=${deploy.dir}/lib/as3corelib.swc"/>
<arg value="-compiler.library-path+=${deploy.dir}/lib/flexlib-bin.swc"/>
<arg value="-compiler.library-path+=${deploy.dir}/lib/tweener.swc"/>
<arg value="-compiler.library-path+=${deploy.dir}/lib/KongregateAPI.swc"/>
<arg value="-compiler.library-path+=${deploy.dir}/lib/signals.swc"/>
<arg value="-compiler.source-path+=rsrc/{locale}/i18n"/>
<!-- This sets the SWF size, not the app size, and we set it to
this size for the avatar viewer's native size. -->
<arg value="-default-size"/>
<arg value="600"/>
<arg value="488"/>
</mxmlc>
<if><not><equals arg1="${copydir}" arg2=""/></not>
<then>
<copy file="${deploy.dir}/${swfname}.swf" todir="${copydir}"/>
</then>
</if>
</target>
<target name="generate-link-report">
<xslt in="/tmp/link-report.xml" out="link-report.html" style="etc/link-report.xsl"/>
</target>
<!-- builds our Flash world client -->
<target name="asclient" depends="asprepare"
description="Builds the Flash world client.">
<antcall target="ascompile">
<param name="aspath" value="client/world.mxml"/>
<param name="swfname" value="world-client"/>
</antcall>
</target>
<!-- builds our Flash debug client -->
<target name="asdebug" depends="asprepare">
<antcall target="ascompile"><param name="flex.extra-arg" value="-compiler.debug"/></antcall>
</target>
<!-- build the viewer, for inclusion in the SDK -->
<target name="viewer" description="Build the viewer for the SDK.">
<antcall target="asprepare">
<param name="dev_deployment" value="false"/>
</antcall>
<antcall target="ascompile">
<param name="aspath" value="client/world.mxml"/>
<param name="swfname" value="viewer"/>
<param name="copydir" value="/export/whirled/lib"/>
<param name="dev_deployment" value="false"/>
<param name="flex.extra-arg" value="-static-link-runtime-shared-libraries=true"/>
<param name="flex.extra-arg-2" value="-incremental=false"/>
</antcall>
</target>
<!-- builds our thane game client -->
<target name="thane-client" depends="asprepare" description="Builds the thane game client.">
<copy file="etc/thane-config.xml.in" tofile="${deploy.dir}/thane-config.xml">
<filterset>
<filter token="flex_sdk_dir" value="${flexsdk.dir}"/>
</filterset>
</copy>
<!-- create msoylib.swc to hold the entire set of dependent classes -->
<java jar="${flexsdk.dir}/lib/compc.jar" fork="true" failonerror="true">
<arg value="-load-config"/>
<arg value="dist/thane-config.xml"/>
<arg value="-compiler.external-library-path"/>
<arg value="${deploy.dir}/lib/thane.swc"/>
<arg value="-compiler.library-path"/>
<arg value="${deploy.dir}/lib"/>
<arg value="-output"/>
<arg value="${deploy.dir}/msoylib.swc"/>
<arg value="-compiler.source-path"/>
<arg value="src/thane"/>
<arg value="src/as"/>
<arg value="-include-sources=src/thane/Reference.as"/>
</java>
<!-- link the executable -->
<java jar="${flexsdk.dir}/lib/mxmlc.jar" fork="true" failonerror="true">
<arg value="-load-config"/>
<arg value="dist/thane-config.xml"/>
<arg value="-compiler.external-library-path"/>
<arg value="${deploy.dir}/lib/thane.swc"/>
<arg value="${deploy.dir}/msoylib.swc"/>
<arg value="-compiler.source-path=src/thane"/>
<arg value="-output"/>
<arg value="${deploy.dir}/MsoyThaneClient.swf"/>
<arg value="src/thane/MsoyThaneClient.as"/>
</java>
<echo message="Turning .swfs into .abcs..."/>
<path id="swfx.classpath">
<file name="lib/swfutils-ooo.jar"/>
<file name="lib/asc.jar"/>
<file name="lib/flexTasks.jar"/>
</path>
<java outputproperty="dump" classpathref="swfx.classpath"
classname="flash.swf.tools.SwfxPrinter" fork="true" failonerror="true">
<arg value="-dump"/>
<arg value="${deploy.dir}/msoylib.abc"/>
<arg value="${deploy.dir}/msoylib.swc"/>
</java>
<java outputproperty="dump" classpathref="swfx.classpath"
classname="flash.swf.tools.SwfxPrinter" fork="true" failonerror="true">
<arg value="-dump"/>
<arg value="${deploy.dir}/MsoyThaneClient.abc"/>
<arg value="${deploy.dir}/MsoyThaneClient.swf"/>
</java>
</target>
<!-- builds the mediastub that's used to wrap SWF media -->
<target name="mediastub">
<antcall target="ascompile">
<param name="flex.extra-arg" value="-static-rsls=true"/>
<param name="aspath" value="applets/MediaStub.as"/>
<param name="swfname" value="MediaStub"/>
<param name="copydir" value="pages/media"/> <!-- this gets published specially -->
</antcall>
</target>
<target name="embedstub">
<antcall target="ascompile">
<param name="flex.extra-arg" value="-static-rsls=true"/>
<param name="flex.extra-arg-2" value="-use-network"/>
<param name="aspath" value="applets/EmbedStub.as"/>
<param name="swfname" value="embedstub-base"/>
<param name="copydir" value=""/> <!-- don't copy anywhere -->
</antcall>
</target>
<target name="mochistub">
<antcall target="ascompile">
<param name="flex.extra-arg" value="-static-rsls=true"/>
<param name="flex.extra-arg-2" value="-use-network"/>
<param name="aspath" value="applets/EmbedStubMochiAd.as"/>
<param name="swfname" value="mochistub-base"/>
<param name="copydir" value=""/> <!-- don't copy anywhere -->
</antcall>
</target>
<target name="remixer" depends="asprepare">
<antcall target="ascompile">
<param name="aspath" value="applets/remixer.mxml"/>
<param name="swfname" value="remixer"/>
</antcall>
</target>
<target name="imageeditor" depends="asprepare">
<antcall target="ascompile">
<param name="aspath" value="applets/imageeditor.mxml"/>
<param name="swfname" value="imageeditor"/>
</antcall>
</target>
<target name="camerabutton" depends="asprepare">
<antcall target="ascompile">
<param name="flex.extra-arg" value="-static-rsls=true"/>
<param name="aspath" value="applets/CameraButtonApp.as"/>
<param name="swfname" value="camerabutton"/>
</antcall>
</target>
<!-- builds our media uploader -->
<target name="uploader" depends="asprepare">
<antcall target="ascompile">
<param name="flex.extra-arg" value="-static-rsls=true"/>
<param name="aspath" value="applets/UploaderApp.as"/>
<param name="swfname" value="uploader"/>
</antcall>
</target>
<!-- builds our video player -->
<target name="videoplayer" depends="asprepare">
<antcall target="ascompile">
<param name="flex.extra-arg" value="-static-rsls=true"/>
<param name="aspath" value="applets/VideoPlayerApp.as"/>
<param name="swfname" value="videoplayer"/>
</antcall>
</target>
<!-- builds our audio player -->
<target name="audioplayer" depends="asprepare">
<antcall target="ascompile">
<param name="flex.extra-arg" value="-static-rsls=true"/>
<param name="aspath" value="applets/AudioPlayerApp.as"/>
<param name="swfname" value="audioplayer"/>
</antcall>
</target>
<!-- builds our whirled map -->
<target name="whirledmap" depends="asprepare">
<ant dir="projects/whirledmap" target="dist" inheritAll="false">
<property name="flexsdk.dir" value="${flexsdk.dir}"/>
</ant>
<copy file="${deploy.dir}/whirledmap.swf" todir="pages/clients/${version}"/>
</target>
<!-- generates fields for persistent record classes -->
<target name="genrecord" depends="prepare">
<taskdef name="grecord" classname="com.samskivert.depot.tools.GenRecordTask"
classpathref="classpath"/>
<!-- make sure the record class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on" source="1.6" target="1.6">
<classpath refid="classpath"/>
<include name="**/*Record.java"/>
</javac>
<!-- now update the source files -->
<grecord classpathref="classpath">
<fileset dir="${src.dir}" includes="**/*Record.java"/>
</grecord>
</target>
<!-- generates additional methods for distributed object classes -->
<target name="gendobj" depends="toolprep">
<!-- make sure the dobject class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on" source="1.6" target="1.6">
<classpath refid="classpath"/>
<include name="**/*Object.java"/>
</javac>
<!-- now generate the associated files -->
<gendobj classpathref="classpath">
<fileset dir="${src.dir}" includes="**/*Object.java"/>
</gendobj>
<genascriptstreamable classpathref="classpath" header="lib/SOURCE_HEADER" asroot="${asrc.dir}">
<fileset dir="${src.dir}" includes="**/*Object.java"/>
</genascriptstreamable>
<!-- <asimports srcdir="${asrc.dir}"/> -->
</target>
<target name="genstreamable" depends="toolprep">
<!-- make sure the streamable class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on" source="1.6" target="1.6">
<classpath refid="classpath"/>
<include name="**/data/*.java"/>
</javac>
<genascriptstreamable classpathref="classpath" header="lib/SOURCE_HEADER"
asroot="${asrc.dir}">
<fileset dir="${src.dir}" includes="**/data/*.java" excludes="**/*Object.java"/>
</genascriptstreamable>
<!-- <asimports srcdir="${asrc.dir}"/> -->
</target>
<!-- generates marshaller and dispatcher classes for all invocation service declarations -->
<target name="genservice" depends="toolprep">
<!-- make sure the service class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on" source="1.6" target="1.6">
<classpath refid="classpath"/>
<include name="**/client/*Service.java"/>
<exclude name="**/web/**"/>
</javac>
<!-- now generate the associated files -->
<genservice header="lib/SOURCE_HEADER" asroot="${asrc.dir}" classpathref="classpath">
<fileset dir="${src.dir}">
<include name="**/client/*Service.java"/>
<exclude name="**/admin/**"/>
<exclude name="**/peer/**"/>
<exclude name="**/client/GameServerService.java"/>
<exclude name="**/client/BureauLauncherService.java"/>
</fileset>
<adapter service="WorldGameService"/>
<adapter service="WorldService"/>
</genservice>
<genservice header="lib/SOURCE_HEADER" classpathref="classpath">
<fileset dir="${src.dir}">
<include name="**/admin/client/*Service.java"/>
<include name="**/peer/client/*Service.java"/>
<include name="**/client/GameServerService.java"/>
<include name="**/client/BureauLauncherService.java"/>
</fileset>
</genservice>
<!-- <asimports srcdir="${asrc.dir}"/> -->
</target>
<!-- generates sender and decoder classes for all invocation receiver declarations -->
<target name="genreceiver" depends="toolprep">
<!-- make sure the receiver class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on" source="1.6" target="1.6">
<classpath refid="classpath"/>
<include name="**/*Receiver.java"/>
</javac>
<!-- now generate the associated files -->
<genreceiver header="lib/SOURCE_HEADER" classpathref="classpath">
<fileset dir="${src.dir}">
<include name="**/*Receiver.java"/>
</fileset>
</genreceiver>
<!-- <asimports srcdir="${asrc.dir}"/> -->
</target>
<!-- adds readField and writeField methods to Streamable classes (NOTE: disabled!) -->
<target name="procstream" depends="toolprep">
<!-- now instrument the associated files -->
<instream outdir="${classes.dir}">
<path refid="classpath"/>
<!--<fileset dir="${classes.dir}" includes="**/data/*.class"/>-->
<fileset dir="${classes.dir}" includes="**/data/**/*.class"/>
</instream>
</target>
<!-- generates our FooServiceAsync interfaces for GWT -->
<target name="genasync" description="Regenerates GWT Async interfaces.">
<!-- make sure the record class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on" source="1.6" target="1.6">
<classpath refid="classpath"/>
<include name="**/gwt/*Service.java"/>
</javac>
<!-- now actually generate the async interfaces -->
<taskdef name="genasync" classname="com.samskivert.asyncgen.AsyncGenTask"
classpath="extlibs/java/gwt-asyncgen.jar"/>
<genasync classpathref="classpath">
<fileset dir="${src.dir}" includes="**/gwt/*Service.java"/>
</genasync>
</target>
<!-- run the unit tests -->
<target name="tests" depends="compile" description="Runs unit tests.">
<mkdir dir="${basedir}/${deploy.dir}/tmp"/>
<taskdef name="unit" classpath="${deploy.dir}/build/junit4.jar"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
<unit printsummary="no" haltonfailure="yes" fork="yes" dir="${basedir}">
<classpath refid="test.classpath"/>
<formatter type="brief" usefile="false" unless="use.xml.output"/>
<formatter type="xml" usefile="true" if="use.xml.output"/>
<!-- Vend the test. properties -->
<syspropertyset>
<propertyref prefix="test."/>
</syspropertyset>
<!-- batch run our tests -->
<batchtest todir="${basedir}/${deploy.dir}/tmp" unless="test">
<fileset dir="${src.dir}">
<include name="**/*UnitTest.java"/>
<!-- XXX A nasty way to exclude S3 tests. This is fragile and
not-good, but I don't know of a better way to do it -->
<exclude name="**/ProjectS3StorageUnitTest.java" unless="test.aws.id"/>
</fileset>
</batchtest>
<!-- or run the requested test -->
<test name="${test}" if="test"/>
</unit>
</target>
<!-- build the java class files -->
<target name="compile" depends="jprepare,qcompile" description="Builds java class files."/>
<!-- builds the java class files only, without preparing the build directories etc. -->
<target name="qcompile">
<echo>Compiling main classes...</echo>
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="off" deprecation="on" source="1.6" target="1.6">
<classpath refid="classpath"/>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
<compilerarg value="-Xlint:-path"/>
<exclude name="**/tests/**"/>
</javac>
<echo>Compiling test classes...</echo>
<javac srcdir="${src.dir}" destdir="${tclasses.dir}" includeAntRuntime="false"
debug="on" optimize="off" deprecation="on" source="1.6" target="1.6">
<classpath refid="test.classpath"/>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
<compilerarg value="-Xlint:-path"/>
<include name="**/tests/**"/>
</javac>
</target>
<!-- builds the ActionScript documention -->
<target name="asdoc">
<mkdir dir="${deploy.dir}/asdocs"/>
<java classpath="${flexsdk.dir}/lib/asdoc.jar" classname="flex2.tools.ASDoc" fork="true">
<jvmarg value="-Xmx1024m"/>
<jvmarg value="-Dsun.io.useCanonCashes=false"/>
<jvmarg value="-Xbootclasspath/p:${flexsdk.dir}/asdoc/lib/xalan.jar"/>
<jvmarg value="-Dos.name=Windows"/>
<arg value="+flexlib=${flexsdk.dir}/frameworks"/>
<arg line="-library-path ${flexsdk.dir}/frameworks/libs"/>
<arg line="-library-path ${deploy.dir}/lib"/>
<arg line="-templates-path ${flexsdk.dir}/asdoc/templates"/>
<arg line="-doc-sources ${asrc.dir}"/>
<arg line="-output ${deploy.dir}/asdocs"/>
</java>
</target>
<!-- builds the distribution jar files -->
<target name="dist" depends="prepare,compile,distcode">
<!-- copy the translation strings for the news feed emails -->
<mkdir dir="${classes.dir}/rsrc/i18n/feed"/>
<copy todir="${classes.dir}/rsrc/i18n/feed" flatten="true">
<fileset dir="src/gwt">
<include name="**/PersonMessages.properties"/>
<include name="**/DynamicMessages.properties"/>
</fileset>
</copy>
<!-- and all of our configuration and media in another -->
<jar file="${deploy.dir}/${app.name}-media.jar" basedir="${classes.dir}" includes="rsrc/**"/>
<!-- and our server-only data in yet another -->
<jar file="${deploy.dir}/${app.name}-data.jar" basedir="." includes="data/dictionary/**"/>
</target>
<!-- just builds the msoy-code.jar without changing any config or any futzing -->
<target name="distcode" depends="qcompile">
<!-- stick all our code in one jar file -->
<jar file="${deploy.dir}/${app.name}-code.jar" basedir="${classes.dir}">
<include name="com/**"/>
<include name="*.properties"/>
<include name="rsrc/**/*.properties"/>
<include name="rsrc/**/*.tmpl"/>
</jar>
</target>
<!-- builds top-level flash applications. -->
<target name="flashapps" depends="asprepare,mediastub,embedstub,mochistub,videoplayer,audioplayer,remixer,imageeditor,camerabutton,uploader,asclient"
description="Builds all Flash clients and applets.">
</target>
<target name="copythanebinaries" depends="prepare">
<!-- Run a special target in thane that will copy the right executable file into the -->
<!-- thane/dist directory. -->
<ant dir="projects/thane" target="distbinary"/>
<!-- copy the distbinary result into our dist directory -->
<if><available file="projects/thane/dist/avmthane"/>
<then><property name="avmthane" value="avmthane"/></then>
<else><property name="avmthane" value="avmthane.exe"/></else>
</if>
<copy file="projects/thane/dist/${avmthane}" todir="${deploy.dir}/lib"/>
<!-- executable permission must be set manually :( -->
<chmod perm="oug+x" file="dist/lib/avmthane"/>
</target>
<!-- rebuilds all subprojects and the whole top-level distribution -->
<target name="distbits" depends="dist,flashapps,thane-client"/>
<target name="distall-package"
depends="prepare,mavendeps,mavendeps-as,distbits,tests,gclients"/>
<target name="distall" depends="copythanebinaries,distall-package"
description="Builds entire system (does not package)."/>
<!-- cleans out the compiled code -->
<target name="clean" description="Cleans out compiled code.">
<delete dir="${classes.dir}/com"/>
<delete file="${src.dir}/com/threerings/msoy/data/all/DeploymentConfig.java"/>