-
Notifications
You must be signed in to change notification settings - Fork 62
/
core.xml
1125 lines (1017 loc) · 44.8 KB
/
core.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
<project name="core" default="all" xmlns:ivy="antlib:org.apache.ivy.ant">
<!--=======================================================================
== To make eclipse recognise this file as an ant file, go to preferences,
== ant and add core.xml to the "Names" field, and then under Workbench,
== "File Associations" add a type "core.xml" with ant as the editor.
=========================================================================-->
<!--=======================================================================
== These are the standard locations that this build file uses.
== This assumes that the build file is in the root of the project.
=========================================================================-->
<property name="release.version" value="2.0-beta" />
<tstamp><format property="today" pattern="-yyyyMMdd"/></tstamp>
<property name="name.versioned" value="${ant.project.name}-${release.version}"/>
<property name="name.timestamped" value="${name.versioned}${today}"/>
<dirname property="core.basedir" file="${ant.file.core}" />
<property name="jsword.home" location="${core.basedir}" />
<!-- lib.dir is the home to 3-rd party jars both for buildtime and runtime.
== It is also the location to which built jars are put.
-->
<property name="lib.dir" location="${jsword.home}/lib/jars" />
<!-- Tools home is where 3-rd party QA tools are downloaded -->
<property name="tools.home" location="${jsword.home}/tools" />
<!-- Location of supplemental files useful for the build. -->
<property name="etc.dir" value="etc" />
<!-- Shared location of supplemental files useful for the build. -->
<property name="etc.shared.dir" value="${jsword.home}/etc" />
<!-- Properties regarding the location of source files -->
<property name="src.dir" value="src" />
<property name="src.main.java.dir" value="${src.dir}/main/java" />
<property name="src.main.res.dir" value="${src.dir}/main/resources" />
<property name="src.main.web.dir" value="${src.dir}/main/webapp"/>
<property name="src.test.java.dir" value="${src.dir}/test/java" />
<property name="src.test.res.dir" value="${src.dir}/test/resources" />
<available file="${src.main.java.dir}" type="dir" property="src.main.java.present"/>
<available file="${src.main.res.dir}" type="dir" property="src.main.res.present"/>
<available file="${src.main.web.dir}" type="dir" property="src.main.web.present"/>
<available file="${src.test.java.dir}" type="dir" property="src.test.java.present"/>
<available file="${src.test.res.dir}" type="dir" property="src.test.res.present"/>
<!-- Properties releated to the install destination. -->
<property name="dest.dir" value="target" />
<property name="dest.main.classes.dir" value="${dest.dir}/main/classes" />
<property name="dest.test.classes.dir" value="${dest.dir}/test/classes" />
<property name="dest.install.pkg.dir" value="${jsword.home}/${dest.dir}/${ant.project.name}" />
<property name="dest.install.web.dir" value="${jsword.home}/${dest.dir}/${ant.project.name}" />
<property name="report.dir" value="${jsword.home}/${dest.dir}/${ant.project.name}" />
<!-- override -->
<property name="keystore.devfile" location="${jsword.home}/crosswire.keystore" />
<property name="keystore.file" location="${keystore.devfile}" />
<property name="keystore.alias" value="jsword" />
<property name="keystore.pswd" value="p455w0rd" />
<property name="verbose.copy" value="false" />
<!--=======================================================================
== These jars are built by the various JSword projects.
== It excludes jsword-common-aqua which is treated as an external jar.
=========================================================================-->
<patternset id="internal.built.jars">
<include name="**/bibledesktop-${release.version}.jar" />
<include name="**/jsword-${release.version}.jar" />
</patternset>
<!--=======================================================================
== This is a pattern and path to all of the jars
== to be used at run time
=========================================================================-->
<patternset id="patternset.runtime">
<exclude name="**/junit*.jar" />
<exclude name="**/hamcrest*.jar" />
<exclude name="**/mockito*.jar" />
<include name="**/*.jar" />
</patternset>
<path id="classpath.runtime">
<fileset dir="${lib.dir}">
<patternset refid="patternset.runtime"/>
</fileset>
</path>
<!--=======================================================================
== This is a pattern and path to all of the jars
== to be used at build time
=========================================================================-->
<patternset id="patternset.buildtime">
<include name="*.jar" />
</patternset>
<path id="classpath.buildtime">
<fileset dir="${lib.dir}">
<patternset refid="patternset.buildtime"/>
</fileset>
</path>
<!--=======================================================================
== This is a path to all of the jars and test classes
== to be used at test time
=========================================================================-->
<path id="classpath.test">
<pathelement location="${dest.main.classes.dir}" />
<path refid="classpath.buildtime" />
</path>
<!--=======================================================================
== This is a path to all non-test source directories.
== These are the ones without "test" in their names.
=========================================================================-->
<patternset id="java.compile">
<include name="**/*.java" />
</patternset>
<path id="source.path">
<dirset dir="${src.main.java.dir}" includes="*" />
</path>
<!--=======================================================================
== This is a path to all test source directories.
== These are the ones with "test" in their names.
=========================================================================-->
<path id="testsource.path">
<dirset dir="${src.test.java.dir}" includes="*" />
</path>
<!--=======================================================================
== These are the non-java resource files
== that may appear along side of java files.
=========================================================================-->
<patternset id="java.non.compile">
<include name="**/*" />
<exclude name="**/*.html" />
<exclude name="**/*.java" />
<exclude name="**/*.class" />
</patternset>
<!--=======================================================================
== These are local copies of DTDs used by ant xslt/style.
== This is necessary to prevent HTTPD 503 responses
== and it is useful to speed up the build.
=========================================================================-->
<xmlcatalog id="commonDTDs">
<dtd publicId="-//W3C//DTD XHTML 1.0 Strict//EN" location="${jsword.home}/etc/dtdcatalog/xhtml1-strict.dtd" />
<dtd publicId="-//W3C//DTD XHTML 1.0 Transitional//EN" location="${jsword.home}/etc/dtdcatalog/xhtml1-transitional.dtd" />
</xmlcatalog>
<!--=======================================================================
== Mark this build with the current timestamp
=========================================================================-->
<target name="init"
description="Prepare for other tasks">
<echo message="Initializing ${ant.project.name}" />
<tstamp />
</target>
<!--=======================================================================
== Clean the intermediate files and build everything, test it and
== then install it.
=========================================================================-->
<target name="all"
description="Run a full clean/build/test/install cycle"
depends="clean, incremental">
</target>
<!--=======================================================================
== Clean the intermediate files.
== Also invoke a clean on any dependencies, if any.
=========================================================================-->
<target name="clean"
description="Remove the target directory"
depends="init, clean.dependency">
<delete dir="${lib.dir}"/>
<delete dir="${dest.dir}" />
<antcall target="clean.extra"/>
</target>
<target name="clean.extra"
description="Remove project specific files and directories"/>
<!--=======================================================================
== Invoke a clean on any dependencies, if any.
== This target requires the "dependency" property to be set by
== the importing ant build file.
=========================================================================-->
<target name="clean.dependency"
description="Clean the dependencies"
if="dependency">
<echo message="Clean project dependency first: ${dependency}." />
<ant dir="../${dependency}"
target="clean"
inheritAll="false" />
</target>
<!--=======================================================================
== Build everything that has changed, test it and then install the changes.
depends="incremental.dependency, prepare, build, test, tools, install"
=========================================================================-->
<target name="incremental"
depends="incremental.dependency, prepare, build, test, tools, install"
description="Run a build/test/install cycle">
</target>
<!--=======================================================================
== Invoke a build on any dependencies, if any.
== This target requires the "dependency" property to be set by
== the importing ant build file.
=========================================================================-->
<target name="incremental.dependency"
description="Build the dependencies"
if="dependency">
<echo message="Build project dependency first: ${dependency}." />
<ant dir="../${dependency}"
target="incremental"
inheritAll="false" />
</target>
<!--=======================================================================
== Copy all the local and external 3rd party jars to a single locaton.
== Also copy the resources to the appropriate classes dir.
=========================================================================-->
<target name="prepare"
description="Prepare for the build."
depends="resource.main, resource.test">
</target>
<!--=======================================================================
== Build all the non-test java files into class files and
== create a jar file for the project with the name project.jar,
== where project is replaced with the name of the project.
== This jar is built to the lib.dir directory.
== But first invoke a build on any dependencies, if any.
==
== Also build all test java files into class files in their own directory.
=========================================================================-->
<target name="build"
description="Run a full build"
depends="compile">
<jar jarfile="${lib.dir}/${name.versioned}.jar">
<fileset dir="${dest.main.classes.dir}" />
</jar>
</target>
<!--=======================================================================
== Compile all the java files under source.path into class files.
== Make sure that all the resources in those directories make it over too.
=========================================================================-->
<target name="compile"
description="Compile main and test source"
depends="prepare, compile.main, compile.test" />
<!-- Compile the main source -->
<target name="compile.main"
depends="prepare"
if="src.main.java.present">
<mkdir dir="${dest.main.classes.dir}" />
<!-- <echo>"$${ant.refid:classpath.runtime}=${ant.refid:classpath.runtime}"</echo> -->
<javac debug="on"
includes="**/*.java"
excludes="**/package-info.java"
srcdir="${src.main.java.dir}"
destdir="${dest.main.classes.dir}"
encoding="utf-8"
includeantruntime="false"
target="1.8"
source="1.8">
<classpath refid="classpath.buildtime" />
</javac>
</target>
<!-- Copy the main resources -->
<target name="resource.main"
if="src.main.res.present">
<!-- Copy the resources to the classes directory. -->
<mkdir dir="${dest.main.classes.dir}" />
<copy verbose="${verbose.copy}"
todir="${dest.main.classes.dir}"
includeEmptyDirs="false"
flatten="false"
failonerror="false"
preservelastmodified="true">
<fileset dir="${src.main.res.dir}" includes="**" />
</copy>
</target>
<!--=======================================================================
== Compile all the test java files under testsource.path into class files.
== Make sure that all the resources in those directories make it over too.
== At this time a project-test.jar is not being created.
==
== This depends upon build having been completed, but we don't have the
== depends="build" here as an optimization.
=========================================================================-->
<target name="compile.test"
depends="resource.test"
if="src.test.java.present">
<mkdir dir="${dest.test.classes.dir}" />
<javac debug="on"
includes="**/*.java"
srcdir="${src.test.java.dir}"
destdir="${dest.test.classes.dir}"
encoding="utf-8"
includeantruntime="false"
target="1.8"
source="1.8">
<classpath refid="classpath.test" />
</javac>
</target>
<!-- Copy the resources to the classes directory. -->
<target name="resource.test"
if="src.test.res.present">
<mkdir dir="${dest.test.classes.dir}" />
<copy verbose="${verbose.copy}"
todir="${dest.test.classes.dir}"
includeEmptyDirs="false"
flatten="false"
failonerror="false"
preservelastmodified="true">
<fileset dir="${src.test.res.dir}" includes="**" />
</copy>
</target>
<!--=======================================================================
== Install the built artifacts.
== By overriding this target in the importing ant build file,
== it will allow for the definition of any other needed work.
=========================================================================-->
<target name="install"
description="Install all the files"
depends="package">
<!-- Create a flag file used to determine whether this task finished successfully -->
<mkdir dir="${dest.install.pkg.dir}"/>
<antcall target="install.extra"/>
<touch file="${dest.install.pkg.dir}/.flagfile"/>
</target>
<target name="install.extra"
description="Do extra project installation"/>
<target name="package"
description="Create basic project packaging"
depends="package.src, package.doc, package.bin">
<antcall target="package.extra"/>
</target>
<target name="package.extra"
description="Create extra project packaging"/>
<!--=======================================================================-->
<!-- source packages -->
<target name="package.src"
if="src.main.java.present">
<mkdir dir="${dest.install.pkg.dir}"/>
<zip destfile="${dest.install.pkg.dir}/${name.timestamped}-src.zip">
<zipfileset prefix="${name.versioned}" dir="${src.main.java.dir}"/>
<zipfileset prefix="${name.versioned}" dir="${src.main.res.dir}"/>
</zip>
</target>
<!-- doc packages -->
<target name="package.doc"
depends="javadoc"
if="src.main.java.present">
<mkdir dir="${dest.install.pkg.dir}"/>
<zip destfile="${dest.install.pkg.dir}/${name.timestamped}-doc.zip">
<zipfileset prefix="${name.versioned}" dir="${javadoc.report}"/>
</zip>
</target>
<!-- binary packages -->
<target name="package.bin"
depends="build"
if="src.main.java.present">
<mkdir dir="${dest.install.pkg.dir}"/>
<zip destfile="${dest.install.pkg.dir}/${name.timestamped}-bin.zip">
<zipfileset prefix="${name.versioned}" dir="${lib.dir}" includes="${name.versioned}.jar"/>
</zip>
</target>
<property name="javadoc.report" location="${report.dir}/javadoc" />
<target name="javadoc"
description="Create JavaDoc"
if="src.main.java.present">
<!-- This is not incremental. Empty it so it can remove unused docs. -->
<delete dir="${javadoc.report}"/>
<mkdir dir="${javadoc.report}"/>
<javadoc
sourcepath="${src.main.java.dir}"
classpathref="classpath.runtime"
stylesheetfile="${etc.shared.dir}/javadoc/stylesheet.css"
destdir="${javadoc.report}"
overview="../jsword/src/main/java/overview.html"
private="true"
author="true"
use="true"
splitindex="true"
version="true"
source="1.7"
failonerror="false">
<footer>Copyright ¨ 2003-2015</footer>
<link href="http://docs.oracle.com/javase/1.7.0/docs/api/"/>
</javadoc>
</target>
<!--=======================================================================
== Use ivy to manage external jars.
== These are properties related to ivy.
=========================================================================-->
<property name="ivy.version" value="2.4.0" />
<property name="ivy.home" location="${tools.home}/ivy" />
<property name="ivy.url" value="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar" />
<property name="ivy.jar.file" location="${ivy.home}/ivy-${ivy.version}.jar" />
<property name="ivy.quiet" value="default" /> <!-- default or quiet -->
<property name="ivy.sync" value="false" /> <!-- true or false -->
<property name="ivy.project.dir" location="${jsword.home}"/>
<property name="ivy.lib.dir" location="${ivy.project.dir}/lib"/>
<property name="ivy.dep.file" location="${ivy.project.dir}/ivy.xml" />
<property name="ivy.default.ivy.user.dir" location="${ivy.project.dir}/ivy" />
<!-- Ivy.sync controls whether only the current version of jar is allowed.
== This is good when updating the project, but not from day-to-day
== since we build extra stuff into the same location. Having sync="true"
== causes that to be deleted and need to be restored.
-->
<target name="ivy"
description="Retrieve dependencies with ivy"
depends="ivy.task">
<ivy:retrieve sync="${ivy.sync}" pattern="${ivy.lib.dir}/[type]s/[artifact]-[revision].[ext]" log="${ivy.quiet}" />
<ivy:cachepath pathid="default.path" />
</target>
<target name="ivy.clean"
description="Remove the ivy installation">
<delete dir="${ivy.home}" />
</target>
<target name="ivy.clean-cache"
description="Remove dependent jars that ivy manages"
depends="ivy.task">
<ivy:cleancache />
</target>
<!-- Make ivy visible to Ant -->
<target name="ivy.task"
depends="ivy.download">
<path id="ivy.lib.path">
<fileset dir="${ivy.home}" includes="*.jar" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
</target>
<!-- Download ivy -->
<target name="ivy.download"
depends="ivy.check"
unless="ivy.present">
<mkdir dir="${ivy.home}" />
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="${ivy.url}" dest="${ivy.jar.file}" usetimestamp="true" />
</target>
<!-- See if Ivy is installed -->
<target name="ivy.check">
<available file="${ivy.jar.file}" type="file" property="ivy.present" />
</target>
<!--=======================================================================
== External 3-rd Party Tools
=========================================================================-->
<target name="tools"
description="Run QA reports"
depends="checkstyle, findbugs, pmd, cpd, jdepend, java2html"
if="src.main.java.present"/>
<!--=======================================================================
== Use Checkstyle to check the style of JSword files
== These are properties related to checkstyle.
=========================================================================-->
<property name="checkstyle.version" value="8.4"/>
<property name="checkstyle.home" location="${tools.home}/checkstyle-${checkstyle.version}" />
<property name="checkstyle.report" location="${report.dir}/checkstyle" />
<property name="checkstyle.url" value="http://downloads.sourceforge.net/project/checkstyle/checkstyle/${checkstyle.version}/checkstyle-${checkstyle.version}-bin.zip" />
<property name="checkstyle.zip" location="${tools.home}/checkstyle-${checkstyle.version}.zip" />
<property name="checkstyle.jar.file" location="${checkstyle.home}/checkstyle-${checkstyle.version}-all.jar" />
<property name="checkstyle.fail" value="false" />
<property name="checkstyle.config" location="${jsword.home}/JSword.checkstyle.xml" />
<target name="checkstyle"
description="Build Checkstyle report"
depends="checkstyle.task">
<mkdir dir="${checkstyle.report}"/>
<checkstyle
config="${checkstyle.config}"
failOnViolation="${checkstyle.fail}">
<property key="checkstyle.basedir" file="${src.main.java.dir}"/>
<property key="checkstyle.cache.file" file="${checkstyle.report}/checkstyle.cache.dat"/>
<property key="checkstyle.header.file" file="${etc.shared.dir}/checkstyle/license.checkstyle.txt"/>
<fileset dir="${src.main.java.dir}" includes="**/*.java" />
<formatter type="plain"/>
<formatter type="xml" toFile="${checkstyle.report}/checkstyle_errors.xml"/>
</checkstyle>
<xslt in="${checkstyle.report}/checkstyle_errors.xml"
out="${checkstyle.report}/index.html"
style="${etc.shared.dir}/checkstyle/checkstyle-simple.xsl">
<xmlcatalog refid="commonDTDs"/>
</xslt>
</target>
<!-- Make checkstyle visible to Ant -->
<target name="checkstyle.task"
depends="checkstyle.download">
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties" classpath="${checkstyle.jar.file}" />
</target>
<!-- Download checkstyle -->
<target name="checkstyle.download"
depends="checkstyle.check"
unless="checkstyle.present">
<mkdir dir="${tools.home}" />
<get src="${checkstyle.url}" dest="${checkstyle.zip}" usetimestamp="true" />
<unzip src="${checkstyle.zip}" dest="${tools.home}" />
<delete file="${checkstyle.zip}" />
</target>
<!-- See if checkstyle is installed -->
<target name="checkstyle.check">
<available file="${checkstyle.home}" type="dir" property="checkstyle.present" />
</target>
<!--=======================================================================
== Use findbugs to find bugs.
== These are properties related to findbugs.
=========================================================================-->
<property name="findbugs.version" value="3.0.1" />
<property name="findbugs.home" location="${tools.home}/findbugs-${findbugs.version}" />
<property name="findbugs.report" location="${report.dir}/findbugs" />
<property name="findbugs.url" value="http://downloads.sourceforge.net/project/findbugs/findbugs/${findbugs.version}/findbugs-${findbugs.version}.zip" />
<property name="findbugs.zip" location="${tools.home}/findbugs-${findbugs.version}.zip" />
<target name="findbugs"
description="Build Findbugs report"
depends="build, findbugs.task">
<mkdir dir="${findbugs.report}" />
<findbugs
home="${findbugs.home}"
projectName="$ant.project.name"
output="html"
outputFile="${findbugs.report}/index.html"
reportLevel="low"
workHard="true"
jvmargs="-Xmx512m">
<auxClasspath refid="classpath.runtime"/>
<sourcePath path="${src.main.java.dir}"/>
<class location="${dest.main.classes.dir}" />
</findbugs>
</target>
<!-- Make findbugs visible to Ant -->
<target name="findbugs.task"
depends="findbugs.download">
<path id="findbugs.lib.path">
<fileset dir="${findbugs.home}" includes="**/*.jar" />
</path>
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib.path" />
</target>
<!-- Download findbugs -->
<target name="findbugs.download"
depends="findbugs.check"
unless="findbugs.present">
<mkdir dir="${tools.home}" />
<get src="${findbugs.url}" dest="${findbugs.zip}" usetimestamp="true" />
<unzip src="${findbugs.zip}" dest="${tools.home}" />
<delete file="${findbugs.zip}" />
</target>
<!-- See if findbugs is installed -->
<target name="findbugs.check">
<available file="${findbugs.home}" type="dir" property="findbugs.present" />
</target>
<!--=======================================================================
== Use PMD and CPD to find bad code
== These are properties related to PMD.
=========================================================================-->
<property name="pmd.version" value="5.8.1" />
<property name="pmd.home" location="${tools.home}/pmd-bin-${pmd.version}" />
<property name="pmd.report" location="${report.dir}/pmd" />
<property name="cpd.report" location="${report.dir}/cpd" />
<property name="pmd.url" value="http://downloads.sourceforge.net/project/pmd/pmd/${pmd.version}/pmd-bin-${pmd.version}.zip" />
<property name="pmd.zip" location="${tools.home}/pmd-bin-${pmd.version}.zip" />
<target name="pmd"
description="Build PMD report"
depends="pmd.task">
<mkdir dir="${pmd.report}"/>
<pmd rulesetfiles="${jsword.home}/JSword.pmd.ruleset.xml"
shortFilenames="true">
<formatter type="html" toFile="pmd_report.html">
<param name="linkPrefix" value="http://pmd.sourceforge.net/xref/"/>
</formatter>
<fileset dir="${src.main.java.dir}" includes="**/*.java"/>
</pmd>
</target>
<!-- Make PMD visible to Ant -->
<target name="pmd.task"
depends="pmd.download">
<path id="pmd.lib.path">
<pathelement location="${pmd.home}" />
<fileset dir="${pmd.home}" includes="*/*.jar" />
</path>
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib.path" />
</target>
<target name="cpd"
description="Build CPD report"
depends="cpd.task">
<mkdir dir="${cpd.report}" />
<cpd minimumTokenCount="100"
format="html"
outputFile="${cpd.report}/report_cpd.html">
<fileset dir="${src.main.java.dir}" includes="**/*.java"/>
</cpd>
</target>
<!-- Make CPD visible to Ant -->
<target name="cpd.task"
depends="pmd.download">
<path id="pmd.lib.path">
<fileset dir="${pmd.home}" includes="*/*.jar" />
</path>
<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" classpathref="pmd.lib.path" />
</target>
<!-- Download PMD -->
<target name="pmd.download"
depends="pmd.check"
unless="pmd.present">
<mkdir dir="${tools.home}" />
<get src="${pmd.url}" dest="${pmd.zip}" usetimestamp="true" />
<unzip src="${pmd.zip}" dest="${tools.home}" />
<delete file="${pmd.zip}" />
</target>
<!-- See if PMD/CPD is installed -->
<target name="pmd.check">
<available file="${pmd.home}" type="dir" property="pmd.present" />
</target>
<!--=======================================================================
== Use Cobertura to do code coverage analysis.
== Cobertura is a fork of JCoverage.
== These are properties and tasks related to Cobertura.
=========================================================================-->
<property name="cobertura.version" value="2.1.1" />
<property name="cobertura.home" location="${tools.home}/cobertura-${cobertura.version}" />
<property name="cobertura.report" location="${report.dir}/cobertura" />
<property name="cobertura.url" value="http://downloads.sourceforge.net/project/cobertura/cobertura/${cobertura.version}/cobertura-${cobertura.version}-bin.zip" />
<property name="cobertura.zip" location="${tools.home}/cobertura-${cobertura.version}.zip" />
<property name="cobertura.instrument.dir" value="${cobertura.report}/tmp" />
<property name="cobertura.datafile" value="${cobertura.instrument.dir}/cobertura.ser" />
<property name="junit.report" location="${report.dir}/junit" />
<target name="test"
description="Run a full test build"
depends="cobertura.instrument"
if="src.test.java.present">
<delete dir="${junit.report}"/>
<mkdir dir="${junit.report}"/>
<junit printsummary="on"
showoutput="off"
fork="yes"
forkmode="once"
maxmemory="512m"
failureproperty="junit.failure">
<sysproperty
key="net.sourceforge.cobertura.datafile"
file="${cobertura.datafile}" />
<classpath location="${cobertura.instrument.dir}"/>
<classpath>
<path refid="classpath.test"/>
<pathelement location="${dest.test.classes.dir}" />
</classpath>
<classpath refid="cobertura.classpath" />
<formatter type="xml" />
<batchtest fork="yes" todir="${junit.report}">
<fileset dir="${dest.test.classes.dir}">
<include name="**/*Test.class"/>
<exclude name="**/*AllTests*"/>
<exclude name="**/*$$*"/>
</fileset>
</batchtest>
</junit>
<!-- There's an exploitable security bug since Oracle Java 6 u23
== Oracle keeps deleting/hiding bug reports regarding it. Basically,
== any xslt that uses Java's xslt engine and calls a static Java
== function fails. If xerces/xalan are provided then it will work.
== I couldn't figure out how to provide xerces/xalan.
<junitreport todir="${junit.report}">
<fileset dir="${junit.report}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${junit.report}/html"/>
</junitreport>
-->
<cobertura-report
datafile="${cobertura.datafile}"
format="html"
destdir="${cobertura.report}"
srcdir="${src.main.java.dir}" />
<!--
== Check how well coverage is. All parameters shown with default being 50.
== But don't fail for now.
<cobertura-check
datafile="${cobertura.datafile}"
linerate="50"
branchrate="50"
packagelinerate="50"
packagebranchrate="50"
totallinerate="50"
totalbranchrate="50"
haltonfailure="false"
failureproperty="coverage.failure"/>
<fail message="Tests failed: check test reports." if="junit.failure" />
-->
</target>
<!-- Instrument classes for Cobertura -->
<target name="cobertura.instrument"
depends="build, cobertura.task"
if="src.main.java.present">
<delete file="${cobertura.datafile}" />
<cobertura-instrument
datafile="${cobertura.datafile}"
todir="${cobertura.instrument.dir}">
<fileset dir="${dest.main.classes.dir}">
<include name="**/*.class" />
</fileset>
<auxClasspath>
<path refid="classpath.runtime" />
</auxClasspath>
</cobertura-instrument>
</target>
<!-- Make Cobertura visible to Ant-->
<target name="cobertura.task"
depends="cobertura.download">
<path id="cobertura.classpath">
<fileset dir="${cobertura.home}">
<include name="cobertura-${cobertura.version}.jar" />
<include name="lib/**/*.jar" />
</fileset>
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
</target>
<!-- See if Cobertura is installed -->
<target name="cobertura.download"
depends="cobertura.check"
unless="cobertura.present">
<mkdir dir="${tools.home}" />
<get src="${cobertura.url}" dest="${cobertura.zip}" usetimestamp="true" />
<unzip src="${cobertura.zip}" dest="${tools.home}" />
<delete file="${cobertura.zip}" />
</target>
<!-- See if Cobertura is installed -->
<target name="cobertura.check">
<available file="${cobertura.home}" type="dir" property="cobertura.present" />
</target>
<!--=======================================================================
== Use Java2html to create Javadoc style navigation of code.
== These are properties related to java2html.
== Note: this may be redundant with the output of Cobertura.
=========================================================================-->
<property name="java2html.version" value="1.5.1" />
<property name="java2html.home" location="${tools.home}/java2html-${java2html.version}" />
<property name="java2html.report" location="${report.dir}/java2html" />
<property name="java2html.url" value="http://www.java2html.com/Java2HTML.zip"/> <!-- http://ccgi.vaegar.force9.co.uk/Java2HTML.zip"/> -->
<property name="java2html.zip" location="${tools.home}/Java2HTML.zip"/>
<target name="java2html"
description="HTML versions of the java code"
depends="java2html.task">
<mkdir dir="${java2html.report}"/>
<java2html title="JSword Source"
simple="no"
tabsize="4"
marginsize="4"
header="true"
footer="false"
destination="${java2html.report}">
<fileset dir="${src.main.java.dir}" includes="**/*.java" />
<javadoc localRef="${etc.shared.dir}/javadoc" httpRef="http://download.oracle.com/javase/1.7.0/docs/api/"/>
</java2html>
</target>
<!-- Make Java2HTML visible to Ant-->
<target name="java2html.task"
depends="java2html.download">
<path id="java2html.classpath">
<fileset dir="${java2html.home}">
<include name="**/*.jar" />
</fileset>
</path>
<taskdef name="java2html" classpathref="java2html.classpath" classname="com.java2html.Java2HTMLTask"/>
</target>
<!-- Download Java2HTML -->
<target name="java2html.download"
depends="java2html.check"
unless="java2html.present">
<mkdir dir="${java2html.home}" />
<get src="${java2html.url}" dest="${java2html.zip}" usetimestamp="true" />
<unzip src="${java2html.zip}" dest="${java2html.home}" />
<delete file="${java2html.zip}" />
</target>
<!-- See if Java2HTML is installed -->
<target name="java2html.check">
<available file="${java2html.home}/j2h.jar" type="file" property="java2html.present" />
</target>
<!--=======================================================================
== Use JDepend to do dependency analysis.
== These are properties related to JDepend.
=========================================================================-->
<property name="jdepend.version" value="2.9.1" />
<property name="jdepend.home" location="${tools.home}/jdepend-${jdepend.version}" />
<property name="jdepend.report" location="${report.dir}/jdepend" />
<property name="jdepend.url" value="http://www.clarkware.com/software/jdepend-${jdepend.version}.zip"/>
<property name="jdepend.zip" location="${tools.home}/jdepend-${jdepend.version}.zip" />
<target name="jdepend"
description="Build dependency report"
depends="compile, jdepend.download, jdepend.verify"
if="jdepend.available">
<mkdir dir="${jdepend.report}"/>
<jdepend
format="xml"
outputfile="${jdepend.report}/jdepend-report.xml"
fork="yes">
<classespath>
<pathelement location="${dest.main.classes.dir}" />
</classespath>
<classpath>
<path refid="classpath.runtime" />
<fileset dir="${jdepend.home}" includes="**/*.jar"/>
</classpath>
</jdepend>
<xslt in="${jdepend.report}/jdepend-report.xml"
out="${jdepend.report}/jdepend-report.html"
style="${jsword.home}/JSword.jdepend.xsl">
<xmlcatalog refid="commonDTDs"/>
</xslt>
</target>
<!-- JDepend visibility instructions -->
<target name="jdepend.verify"
depends="jdepend.visible"
unless="jdepend.available">
<echo>$${jdepend.available}=${jdepend.available}</echo>
<echo>JDepend cannot run. jdepend-${jdepend.version}.jar is not visible to Ant.</echo>
<echo>To make it visible you need to do one of two things depending</echo>
<echo>on whether you are running ant in Eclipse or not.</echo>
<echo>In Eclipse, add jdepend-*.jar to Preferences -> Ant -> Runtime -> Global Entries</echo>
<echo>Otherwise, run the jdepend.antlibs task to copy jars to ANT_HOME/lib</echo>
</target>
<!-- Check to see if JDepend is visible to Ant. -->
<target name="jdepend.visible">
<available property="jdepend.available"
classname="org.apache.tools.ant.taskdefs.optional.jdepend.JDependTask"/>
</target>
<!-- Download JDepend -->
<target name="jdepend.download"
depends="jdepend.check"
unless="jdepend.present">
<mkdir dir="${tools.home}" />
<get src="${jdepend.url}" dest="${jdepend.zip}" usetimestamp="true" />
<unzip src="${jdepend.zip}" dest="${tools.home}" />
<delete file="${jdepend.zip}" />
</target>
<!-- See if JDepend is installed -->
<target name="jdepend.check">
<available file="${jdepend.home}" type="dir" property="jdepend.present" />
</target>
<!--=======================================================================
== Use Javancss to do analyze Non Commenting Source Statements
== These are properties related to Javancss.
=========================================================================-->
<property name="javancss.version" value="33.54" />
<property name="javancss.home" location="${tools.home}/javancss-${javancss.version}" />
<property name="javancss.report" location="${report.dir}/javancss" />
<property name="javancss.url" value="http://javancss.mojohaus.org/javancss-${javancss.version}.zip"/>
<property name="javancss.zip" location="${tools.home}/javancss-${javancss.version}.zip" />
<target name="javancss"
depends="javancss.task">
<mkdir dir="${javancss.report}"/>
<javancss
srcdir="${src.main.java.dir}"
includes="**/*.java"
generateReport="true"
outputfile="${javancss.report}/javancss_metrics.xml"
format="xml"/>
<xslt in="${javancss.report}/javancss_metrics.xml"
out="${javancss.report}/index.html"
style="${javancss.home}/xslt/javancss2html.xsl">
<xmlcatalog refid="commonDTDs"/>
</xslt>
</target>
<!-- Make JavaNCSS visible to Ant -->
<target name="javancss.task"
depends="javancss.download">
<taskdef name="javancss" classname="javancss.JavancssAntTask">
<classpath>
<fileset dir="${javancss.home}" includes="**/*.jar"/>
</classpath>
</taskdef>
</target>
<!-- Download JavaNCSS -->
<target name="javancss.download"
depends="javancss.check"
unless="javancss.present">
<mkdir dir="${tools.home}" />
<get src="${javancss.url}" dest="${javancss.zip}" usetimestamp="true" />
<unzip src="${javancss.zip}" dest="${tools.home}" />
<delete file="${javancss.zip}" />
</target>
<!-- See if JavaNCSS is installed -->
<target name="javancss.check">
<available file="${javancss.home}" type="dir" property="javancss.present" />
</target>
<!--=======================================================================
== Use NSIS to create Windows installers
== These are properties related to NSIS.
=========================================================================-->
<property name="nsis.version" value="3.02.1" />
<property name="nsis.home" location="${tools.home}/nsis-${nsis.version}" />
<property name="nsis.report" location="${report.dir}/nsis" />
<property name="nsis.url" value="https://cloud.github.com/downloads/dreese/nsis-ant/nsisant-${nsis.version}.jar"/>
<target name="nsis.task"
depends="nsis.download, nsis.verify">
<path id="nsis.classpath">
<fileset dir="${nsis.home}" includes="*.jar" />
</path>
<taskdef name="nsis" classpathref="nsis.classpath" classname="com.danielreese.nsisant.Task"/>
</target>
<!-- NSIS visibility instructions -->
<target name="nsis.verify"
depends="nsis.visible"
unless="nsis.available">
<echo>$${nsis.available}=${nsis.available}</echo>
<echo>NSIS cannot run. nsis-${nsis.version}.jar is not visible to Ant.</echo>
<echo>Also, makensis needs to be on your path</echo>
<echo>To make it visible you need to do one of two things depending</echo>
<echo>on whether you are running ant in Eclipse or not.</echo>
<echo>In Eclipse, add nsis-*.jar to Preferences -> Ant -> Runtime -> Global Entries</echo>
<echo>Otherwise, run the nsis.antlibs task to copy jars to ANT_HOME/lib</echo>
</target>
<!-- Check to see if NSIS is visible to Ant. -->
<target name="nsis.visible">
<available property="nsis.available"
classname="com.danielreese.nsisant.Task"/>
</target>
<!-- Download NSIS -->
<target name="nsis.download"
depends="nsis.check"
unless="nsis.present">
<mkdir dir="${tools.home}" />
<mkdir dir="${nsis.home}" />
<get src="${nsis.url}" dest="${nsis.home}" usetimestamp="true" />
</target>
<!-- See if NSIS is installed -->
<target name="nsis.check">
<available file="${nsis.home}/nsisant-${nsis.version}.jar" type="file" property="nsis.present" />
</target>
<!-- the only purpose of this is to provide a useful diagnostic. -->
<target name="nsis">
<echo>NSIS may fail if nsisant.jar is not visible to Ant and makensis is not in your path.
To make the task visible you need to do one of two things depending