-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathbuild.xml
executable file
·656 lines (525 loc) · 23 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
<?xml version="1.0"?>
<project default="oneswarm-all" name="OneSwarm" basedir=".">
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<property name="root.dir" value="${basedir}" />
<property name="core-libs.dir" value="build/core-libs" />
<property name="core-dist.dir" value="core-dist" />
<property name="core-bin.dir" value="core-bin" />
<!-- Conditions which we need for platform specific build options. -->
<condition property="isMac">
<os family="mac" />
</condition>
<condition property="isWindows">
<os family="windows" />
</condition>
<condition property="isUnix">
<os family="unix" />
</condition>
<condition property="isUnixButNotMacOSX">
<and>
<isfalse value="${isMac}" />
<istrue value="${isUnix}" />
</and>
</condition>
<condition property="is64Bit">
<equals arg1="${sun.arch.data.model}" arg2="64" />
</condition>
<!--
Mac SWT apps require startOnFirstThread, but this argument usually throws an
error on other platforms.
-->
<if>
<istrue value="${isMac}" />
<then>
<property name="optStartOnFirstThread" value="-XstartOnFirstThread" />
</then>
<else>
<!-- Because empty properties cause errors, use something innocuous. -->
<property name="optStartOnFirstThread" value="-Xms64M" />
</else>
</if>
<!--
Windows requires the aereg.dll for native platform features.
-->
<if>
<istrue value="${isWindows}" />
<then>
<property name="optWindowsLibraryPath" value="-Djava.library.path=build/core-libs/dll" />
</then>
<else>
<property name="optWindowsLibraryPath" value="-Xms64M" />
</else>
</if>
<!--
Choose the appropriate SWT jar for the given platform. This is used by the
run target.
-->
<if>
<istrue value="${isMac}" />
<then>
<echo>Using OSX SWT</echo>
<property name="platform.swt.jar" value="build/swt/swt-osx-cocoa-x86_64.jar" />
</then>
<elseif>
<istrue value="${isUnixButNotMacOSX}" />
<then>
<if>
<istrue value="${is64Bit}" />
<then>
<echo>Using Linux SWT-64 bit</echo>
<property name="platform.swt.jar" value="build/swt/swt-gtk-linux-x86_64.jar" />
</then>
<else>
<echo>Using Linux SWT-32 bit</echo>
<property name="platform.swt.jar" value="build/swt/swt-gtk-linux-x86.jar" />
</else>
</if>
</then>
</elseif>
<elseif>
<istrue value="${isWindows}" />
<then>
<echo>Using Windows SWT</echo>
<property name="platform.swt.jar" value="build/swt/swt-win32-x86.jar" />
</then>
</elseif>
<else>
<echo>Unrecognized platform. (Likely no SWT available.)</echo>
</else>
</if>
<property name="generic.excludes" value="**/*.jar **/*.txt **/*.jardesc **/.classpath **/.project **/aereg.lib **/aereg.dll" />
<property name="core-dist.jar.excludes" value="${generic.excludes} **/*.java " />
<!-- ====================================== Custom Ant tasks =============== -->
<target name="custom-tasks">
<mkdir dir="${root.dir}/ant-custom-bin" />
<javac srcdir="ant-custom" destdir="${root.dir}/ant-custom-bin" includeantruntime="true" />
</target>
<!-- =================================== AZ MODS / CORE ==================== -->
<target name="core-init" depends="custom-tasks">
<echo message="Building OneSwarmCore.jar..." />
<tstamp />
<mkdir dir="${root.dir}/${core-dist.dir}" />
<mkdir dir="${root.dir}/${core-bin.dir}" />
<!-- Register our custom tasks -->
<taskdef name="GWTRecompileCheck" classname="edu.washington.cs.oneswarm.ant.GWTRecompileCheck" classpath="${root.dir}/ant-custom-bin" />
<taskdef name="DiscoverTestClasses" classname="edu.washington.cs.oneswarm.ant.DiscoverTestClasses" classpath="${root.dir}/ant-custom-bin" />
<!-- Sets gwt.recompile, used by the gwt-webui target. -->
<GWTRecompileCheck directory="oneswarm_gwt_ui/src/edu/washington/cs/oneswarm/ui/gwt/client" basedir="${basedir}/" lastBuild="${build.timestamp}" />
</target>
<target name="compile-core" depends="core-init">
<path id="libs.classpath">
<fileset dir="${root.dir}/${core-libs.dir}" includes="**/*.jar" />
<fileset dir="${root.dir}/build/swt/" includes="**/*.jar" />
<fileset dir="${root.dir}/build/gwt-libs/gwt/" includes="**/*.jar" />
</path>
<javac srcdir="az_src/src:az_src/jsocks:oneswarm_az_mods/mods_autoupdate:oneswarm_az_mods/mods_az_bugfixes:oneswarm_az_mods/mods_constants:oneswarm_az_mods/mods_f2f:oneswarm_az_mods/mods_gwt_ui:oneswarm_az_mods/mods_onehop:oneswarm_az_mods/mods_plugins:oneswarm_az_mods/mods_swt:" destdir="${root.dir}/${core-bin.dir}" nowarn="yes" source="1.5" target="1.5" includeAntRuntime="no" debug="true" debuglevel="lines,vars,source">
<classpath>
<path refid="libs.classpath" />
</classpath>
</javac>
</target>
<target name="core-jar" depends="compile-core">
<!-- Copy the relevant png/jpg/properties files to the output directory. -->
<patternset id="non.source.types">
<include name="**/*.png" />
<include name="**/*.jpg" />
<include name="**/*.gif" />
<include name="**/*.properties" />
</patternset>
<copy todir="${core-bin.dir}">
<fileset dir="az_src/src">
<patternset refid="non.source.types" />
</fileset>
<fileset dir="oneswarm_az_mods/mods_autoupdate">
<patternset refid="non.source.types" />
</fileset>
<fileset dir="oneswarm_az_mods/mods_az_bugfixes">
<patternset refid="non.source.types" />
</fileset>
<fileset dir="oneswarm_az_mods/mods_constants">
<patternset refid="non.source.types" />
</fileset>
<fileset dir="oneswarm_az_mods/mods_f2f">
<patternset refid="non.source.types" />
</fileset>
<fileset dir="oneswarm_az_mods/mods_gwt_ui">
<patternset refid="non.source.types" />
</fileset>
<fileset dir="oneswarm_az_mods/mods_onehop">
<patternset refid="non.source.types" />
</fileset>
<fileset dir="oneswarm_az_mods/mods_plugins">
<patternset refid="non.source.types" />
</fileset>
<fileset dir="oneswarm_az_mods/mods_swt">
<patternset refid="non.source.types" />
</fileset>
</copy>
<jar destfile="${root.dir}/${core-dist.dir}/OneSwarmCore.jar" basedir="${core-bin.dir}" excludes="${core-dist.jar.excludes}">
<fileset dir="${core-bin.dir}">
<include name="**/*.class" />
<include name="**/*.png" />
<include name="**/*.jpg" />
<include name="**/*.gif" />
<include name="**/*.properties" />
</fileset>
<fileset file="oneswarm_az_mods/OneSwarmAzMods.properties" />
</jar>
<copy file="build/core-libs/derby.jar" todir="core-dist" />
<copy file="build/core-libs/guava.jar" todir="core-dist" />
</target>
<!-- =============================== F2F ==================== -->
<property name="f2f-libs.dir" value="build/f2f-libs" />
<property name="publickey.jar" value="${f2f-libs.dir}/publickey-client.jar" />
<property name="smack.jar" value="${f2f-libs.dir}/smack.jar" />
<property name="ecs.jar" value="${f2f-libs.dir}/ecs-1.4.2.jar" />
<property name="apache-io.jar" value="build/gwt-libs/commons-http/commons-io-1.3.2.jar" />
<property name="f2f-bin.dir" value="${root.dir}/f2f-bin" />
<property name="f2f-src.dir" value="${root.dir}/oneswarm_f2f/src" />
<property name="gwt.dir" value="${root.dir}/oneswarm_gwt_ui/lib/gwt" />
<path id="libs.classpath">
<fileset dir="${root.dir}/${core-libs.dir}" includes="**/*.jar" />
</path>
<path id="f2f.class.path">
<pathelement path="${publickey.jar}" />
<pathelement path="${smack.jar}" />
<pathelement path="${ecs.jar}" />
<pathelement path="${apache-io.jar}" />
<path refid="libs.classpath" />
<!-- For DateTimeFormat, TODO: remove dependency or merge. -->
<pathelement path="build/gwt-libs/gwt/gwt-servlet.jar" />
<!-- Built by the core-jar target -->
<pathelement path="core-dist/OneSwarmCore.jar" />
</path>
<!-- =============================== GWT ==================== -->
<property name="root.dir" value="." />
<property name="gwt_output.dir" value="${root.dir}/gwt-dist/war/oneswarmgwt" />
<property name="jetty.dir" value="build/gwt-libs/jetty" />
<property name="jaudio.jar" value="build/gwt-libs/jaudiotagger.jar" />
<path id="project.class.path.servlet">
<!-- GWT core -->
<pathelement path="build/gwt-libs/gwt/gwt-user.jar" />
<pathelement path="build/gwt-libs/gwt/gwt-dev.jar" />
<pathelement path="build/gwt-libs/gwt/gwt-servlet.jar" />
<!-- GWT add-ons -->
<pathelement path="build/gwt-libs/gwt-dnd/gwt-dnd-2.6.5.jar" />
<pathelement path="build/gwt-libs/gwt-fx/gwt-fx 2.0.0 RC2.jar" />
<pathelement path="build/gwt-libs/gwt-dnd/gwt-dnd-2.6.5.jar" />
<pathelement path="build/gwt-libs/commons-http/httpcore-4.0.1.jar" />
<pathelement path="build/gwt-libs/commons-http/httpmime-4.0.jar" />
<pathelement path="build/gwt-libs/commons-http/httpclient-4.0.jar" />
<pathelement path="build/gwt-libs/commons-http/apache-mime4j-0.6.jar" />
<pathelement path="build/gwt-libs/commons-http/jcip-annotations.jar" />
<pathelement path="build/gwt-libs/commons-http/commons-logging-1.1.1.jar" />
<pathelement path="build/gwt-libs/commons-http/commons-codec-1.4.jar" />
<pathelement path="${jaudio.jar}" />
<pathelement path="${jetty.dir}/jetty.jar" />
<pathelement path="${jetty.dir}/jetty-util.jar" />
<pathelement path="${jetty.dir}/jetty-servlet-api.jar" />
<pathelement path="${jetty.dir}/jetty-management.jar" />
<pathelement path="${f2f-plugin.jar}" />
<pathelement path="${root.dir}/${core-dist.dir}/OneSwarmCore.jar" />
<!-- For SWT libraries. -->
<path refid="libs.classpath" />
</path>
<!--
Check the last modified time of the GWT source code. (Used to skip lengthy GWT compiler invocation
if possible.)
-->
<property file="oneswarm_gwt_ui/build.properties" />
<condition property="gwt.code.modified">
<isset property="build.timestamp" />
</condition>
<target name="gwt-war-init" description="Creates the war/ directory structure in the gwt output directory.">
<copy todir="${root.dir}/gwt-bin/war">
<fileset dir="oneswarm_gwt_ui/war">
<exclude name="oneswarmgwt/**" />
<exclude name="WEB-INF/classes/**" />
</fileset>
</copy>
<mkdir dir="${root.dir}/gwt-bin/war/WEB-INF/classes" />
</target>
<path id="gwt.classpath">
<!-- Other 1S components -->
<pathelement path="core-dist/OneSwarmCore.jar" />
<pathelement path="gwt-bin/war/WEB-INF/classes" />
<!-- GWT core -->
<pathelement path="build/gwt-libs/gwt/gwt-user.jar" />
<pathelement path="build/gwt-libs/gwt/gwt-dev.jar" />
<pathelement path="build/gwt-libs/gwt/gwt-servlet.jar" />
<pathelement path="build/gwt-libs/gwt/validation-api-1.0.0.GA.jar" />
<pathelement path="build/gwt-libs/gwt/validation-api-1.0.0.GA-sources.jar" />
<!-- GWT add-ons -->
<pathelement path="build/gwt-libs/gwt-dnd/gwt-dnd-2.6.5.jar" />
<!-- src -->
<pathelement path="oneswarm_gwt_ui/gwt_incubator_minimal" />
<pathelement path="oneswarm_gwt_ui/src" />
<pathelement path="oneswarm_az_mods/mods_gwt_ui" />
</path>
<target name="f2f-gwt-servlet" depends="gwt-war-init,core-jar,i18n-OsMessages">
<!-- compile the f2f/gwt code -->
<javac destdir="${root.dir}/gwt-bin/war/WEB-INF/classes" nowarn="yes" source="1.5" target="1.5" includeAntRuntime="no" debug="true" debuglevel="lines,vars,source" fork="yes" memoryMaximumSize="256m">
<src path="${root.dir}/oneswarm_gwt_ui/gwt_incubator_minimal" />
<src path="${root.dir}/oneswarm_gwt_ui/src" />
<src path="${f2f-src.dir}" />
<classpath refid="project.class.path.servlet" />
<classpath refid="f2f.class.path" />
</javac>
<echo>Compiling UI code</echo>
</target>
<target name="gwt-webui" description="Java -> Javascript using the GWT compiler." if="gwt.recompile" depends="f2f-gwt-servlet,i18n-OsMessages,gwt-war-init">
<!--
Invoke the GWT compiler. The build can be customized during development to
significantly reduce build times. See:
src/edu/washington/cs/oneswarm/ui/gwt/OneSwarmGWT.gwt.xml
for details.
-->
<java failonerror="true" dir="oneswarm_gwt_ui" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<path refid="gwt.classpath" />
</classpath>
<jvmarg value="${optStartOnFirstThread}" />
<jvmarg value="-Xmx512M" />
<arg value="-localWorkers" />
<arg value="4" />
<arg value="-war" />
<arg value="../gwt-bin/war" />
<arg value="edu.washington.cs.oneswarm.ui.gwt.OneSwarmGWT" />
</java>
<!--
Record the last time this was built - this is used in the gwt.code.modified condition to detect
whether a recompile is necessary. (Note: the pattern much match that used by the
GWTRecompileCheck custom task.)
-->
<propertyfile file="oneswarm_gwt_ui/build.properties">
<entry key="build.timestamp" type="date" value="now" pattern="MM/dd/yyyy HH:mm" />
</propertyfile>
</target>
<property name="gwt-deploy.dir" value="${root.dir}/gwt-dist" />
<target name="i18n-OsMessages" description="(Re)generates the OSMessages interface based on the OSMessages.properties file." if="gwt.recompile">
<echo>Generating language files...</echo>
<javac destdir="${root.dir}/gwt-bin/war/WEB-INF/classes" nowarn="yes" source="1.5" target="1.5" includeAntRuntime="no" debug="true" debuglevel="lines,vars,source" fork="yes" memoryMaximumSize="256m">
<src path="${root.dir}/oneswarm_gwt_ui/gwt_override" />
<classpath refid="project.class.path.servlet" />
</javac>
<echo>basedir=${basedir}</echo>
<java classname="com.google.gwt.i18n.tools.I18NSync" failonerror="true" fork="true">
<arg value="edu.washington.cs.oneswarm.ui.gwt.client.i18n.OSMessages" />
<arg value="-out" />
<arg value="oneswarm_gwt_ui/src" />
<arg value="-createMessages" />
<classpath>
<pathelement location="gwt-bin/war/WEB-INF/classes" />
<pathelement location="oneswarm_gwt_ui/src/" />
<pathelement location="build/gwt-libs/gwt/gwt-dev.jar" />
<pathelement location="build/gwt-libs/gwt/gwt-user.jar" />
</classpath>
</java>
</target>
<target name="gwt-dist" description="Creates the GWT dist package." depends="gwt-webui">
<mkdir dir="${root.dir}/gwt-dist" />
<jar destfile="gwt-dist/oneswarm_gwt_ui.jar">
<!-- Az plugin properties file -->
<fileset file="oneswarm_gwt_ui/plugin.properties" />
<!-- RPC serializable file -->
<fileset dir="${root.dir}/gwt-bin/war/oneswarmgwt/">
<include name="**/*.rpc" />
</fileset>
<!-- Servlet binaries -->
<fileset dir="gwt-bin/war/WEB-INF/classes">
<include name="**/*.class" />
</fileset>
<!-- Language files -->
<fileset dir="${root.dir}/oneswarm_gwt_ui/src">
<include name="edu/washington/cs/oneswarm/ui/gwt/client/i18n/*.properties" />
</fileset>
<!-- www/www directory; i.e. the generated java script -->
<fileset dir="gwt-bin/war/" includes="war">
<include name="oneswarmgwt/**" />
</fileset>
</jar>
<!-- Libraries -->
<copy file="${jetty.dir}/jetty.jar" todir="${gwt-deploy.dir}" />
<copy file="${jetty.dir}/jetty-util.jar" todir="${gwt-deploy.dir}" />
<copy file="${jetty.dir}/jetty-servlet-api.jar" todir="${gwt-deploy.dir}" />
<copy file="${jetty.dir}/jetty-management.jar" todir="${gwt-deploy.dir}" />
<copy file="build/gwt-libs/gwt/gwt-servlet.jar" todir="${gwt-deploy.dir}" />
<copy file="${jaudio.jar}" todir="${gwt-deploy.dir}" />
<copy file="${root.dir}/build/gwt-libs/commons-http/httpcore-4.0.1.jar" todir="${gwt-deploy.dir}" />
<copy file="${root.dir}/build/gwt-libs/commons-http/httpmime-4.0.jar" todir="${gwt-deploy.dir}" />
<copy file="${root.dir}/build/gwt-libs/commons-http/httpclient-4.0.jar" todir="${gwt-deploy.dir}" />
<copy file="${root.dir}/build/gwt-libs/commons-http/apache-mime4j-0.6.jar" todir="${gwt-deploy.dir}" />
<copy file="${root.dir}/build/gwt-libs/commons-http/jcip-annotations.jar" todir="${gwt-deploy.dir}" />
<copy file="${root.dir}/build/gwt-libs/commons-http/commons-logging-1.1.1.jar" todir="${gwt-deploy.dir}" />
<copy file="${root.dir}/build/gwt-libs/commons-http/commons-codec-1.4.jar" todir="${gwt-deploy.dir}" />
<!-- f2f dependencies -->
<copy todir="${gwt-deploy.dir}" file="${smack.jar}" />
<copy todir="${gwt-deploy.dir}" file="${publickey.jar}" />
<copy todir="${gwt-deploy.dir}" file="${ecs.jar}" />
<copy todir="${gwt-deploy.dir}" file="${apache-io.jar}" />
</target>
<!-- =============================== Merge ==================== -->
<target name="oneswarm-all" description="Builds and packages all required components." depends="gwt-dist,core-jar">
<delete dir="merge-scratch/" failonerror="false" />
<mkdir dir="merge-scratch" />
<unjar dest="merge-scratch/">
<fileset dir="core-dist/" includes="*.jar" />
<fileset dir="gwt-dist/" includes="*.jar" />
</unjar>
<buildnumber file="build.txt" />
<copy todir="merge-scratch/" file="build.txt" />
<!-- Remove any junk META-INF or properties that may have leaked in during the merge. -->
<delete dir="merge-scratch/META-INF" />
<delete file="merge-scratch/plugin.properties" />
<jar destfile="OneSwarm.jar" basedir="merge-scratch">
<manifest>
<attribute name="Main-Class" value="org.gudy.azureus2.ui.swt.Main" />
</manifest>
</jar>
</target>
<target name="inc" description="Builds and packages GWT and F2F components, assuming a previously merged core." depends="gwt-dist">
<unjar dest="merge-scratch/">
<fileset dir="gwt-dist/" includes="oneswarm_gwt_ui.jar" />
</unjar>
<!-- Remove any junk META-INF or properties that may have leaked in during the merge. -->
<delete dir="merge-scratch/META-INF" />
<delete file="merge-scratch/plugin.properties" />
<buildnumber file="build.txt" />
<copy todir="merge-scratch/" file="build.txt" />
<jar destfile="OneSwarm.jar" basedir="merge-scratch">
<manifest>
<attribute name="Main-Class" value="org.gudy.azureus2.ui.swt.Main" />
</manifest>
</jar>
</target>
<!-- This target will update only the GWT servlet code. -->
<target name="servlet-inc" depends="f2f-gwt-servlet,gwt-dist,inc" />
<!-- =============================== Clean ==================== -->
<target name="clean">
<!-- Ant tasks -->
<delete dir="${root.dir}/ant-custom-bin" />
<!-- Core -->
<delete quiet="true">
<fileset dir="${root.dir}/azureus/com" includes="**/*.class" />
<fileset dir="${root.dir}/azureus/org" includes="**/*.class" />
<fileset dir="${root.dir}/azureus/bin" includes="**/*.class" />
</delete>
<delete dir="${root.dir}/${core-dist.dir}" />
<delete dir="${root.dir}/${core-bin.dir}" />
<!-- F2F -->
<delete dir="${f2f-bin.dir}" />
<!-- GWT -->
<delete dir="gwt-dist" />
<delete dir="gwt-bin" />
<delete file="oneswarm_gwt_ui/build.properties" />
<!-- Merged jars -->
<delete dir="merge-scratch" />
<delete file="OneSwarm.jar" />
<!-- Test -->
<delete dir="test-bin" />
<delete dir="test-report" />
<delete file="OneSwarm-tests.jar" />
</target>
<!-- =============================== Test ==================== -->
<target name="compile-tests" depends="gwt-dist,core-jar">
<mkdir dir="test-bin" />
<javac srcdir="javatests" destdir="test-bin" nowarn="yes" source="1.5" target="1.5" includeAntRuntime="no" debug="true" debuglevel="lines,vars,source" fork="yes" memoryMaximumSize="256m">
<classpath>
<pathelement location="gwt-bin/war/WEB-INF/classes" />
<path refid="project.class.path.servlet" />
<pathelement location="build/test-libs/selenium-server.jar" />
<pathelement location="build/test-libs/selenium-java-client-driver.jar" />
</classpath>
</javac>
<jar destfile="OneSwarm-tests.jar" basedir="test-bin" />
</target>
<path id="junittests.class.path">
<pathelement location="test-bin" />
<pathelement location="build/core-libs/junit.jar" />
<pathelement location="gwt-bin/war/WEB-INF/classes" />
<pathelement location="${platform.swt.jar}" />
<path refid="project.class.path.servlet" />
<path refid="f2f.class.path" />
<!-- For org/testng/Assert. -->
<pathelement location="build/test-libs/selenium-server.jar" />
<pathelement location="build/test-libs/selenium-java-client-driver.jar" />
</path>
<target name="junit" depends="compile-tests">
<mkdir dir="test-report" />
<junit printsummary="yes" fork="yes" showoutput="true">
<jvmarg value="-Doneswarm.test.local.classpath=test-bin:gwt-bin/war/WEB-INF/classes:core-dist/OneSwarmCore.jar" />
<formatter type="xml" />
<classpath refid="junittests.class.path" />
<batchtest todir="test-report">
<fileset dir="${root.dir}/javatests/">
<include name="**/*Test*.java" />
<exclude name="**/util/*.java" />
<!-- TODO(willscott): Understand failure! -->
<exclude name="**/integration/MultipathResillianceTest.java" />
<!-- Unimplemented tests. TODO(piatek): Implement these! -->
<exclude name="**/integration/DirectTransferTest.java" />
<exclude name="**/integration/IndirectTransferTest.java" />
<exclude name="**/integration/PermissionsTest.java" />
<exclude name="**/integration/WatchDirectoryTest.java" />
<exclude name="**/integration/DefaultSettingsTest.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="default-install-test" depends="compile-tests">
<mkdir dir="test-report" />
<junit printsummary="yes" fork="yes">
<jvmarg value="-Doneswarm.test.local.classpath=test-bin:gwt-bin/war/WEB-INF/classes:core-dist/OneSwarmCore.jar" />
<formatter type="xml" />
<classpath refid="junittests.class.path" />
<batchtest todir="test-report">
<fileset dir="${root.dir}/javatests/">
<include name="**/integration/DefaultSettingsTest.java" />
</fileset>
</batchtest>
</junit>
</target>
<!--
Detect the set of tests in javatests/ and execute each one.
The need for this hack as opposed to ordinary JUnit execution is because
we can't use the JUnit ant task directly. Due to OSX SWT issues, we need
to run each test as an individual java execution.
-->
<target name="test" depends="compile-tests">
<!-- Sets oneswarm.test.cases -->
<DiscoverTestClasses />
<foreach target="run-single-test" list="${oneswarm.test.cases}" param="testClass" />
</target>
<target name="run-single-test">
<echo message="Running ${testClass}" />
<java classname="${testClass}" failonerror="true" fork="true">
<jvmarg value="${optStartOnFirstThread}" />
<jvmarg value="${optWindowsLibraryPath}" />
<jvmarg value="-Xmx256M" />
<jvmarg value="-Doneswarm.test.local.classpath=gwt-bin/war/WEB-INF/classes:core-dist/OneSwarmCore.jar" />
<classpath>
<pathelement location="test-bin" />
<pathelement location="gwt-bin/war/WEB-INF/classes" />
<path refid="project.class.path.servlet" />
<path refid="f2f.class.path" />
<pathelement location="build/core-libs/junit.jar" />
<pathelement location="${platform.swt.jar}" />
<pathelement location="build/test-libs/selenium-server.jar" />
<pathelement location="build/test-libs/selenium-java-client-driver.jar" />
</classpath>
</java>
</target>
<!-- A target which runs OneSwarm. (This assumes that the appropriate targets have been built.) -->
<target name="run">
<echo>Starting OneSwarm...</echo>
<java classname="com.aelitis.azureus.ui.Main" failonerror="true" fork="true">
<jvmarg value="${optStartOnFirstThread}" />
<jvmarg value="${optWindowsLibraryPath}" />
<jvmarg value="-Xmx256M" />
<classpath>
<pathelement location="OneSwarm.jar" />
<pathelement location="${platform.swt.jar}" />
</classpath>
</java>
</target>
</project>