-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
909 lines (784 loc) · 38.2 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
<?xml version="1.0"?>
<!-- Copyright 2002-2007, 2009, 2010, 2011 Elliotte Rusty Harold
This library is free software; you can redistribute
it and/or modify it under the terms of version 2.1 of
the GNU Lesser General Public License as published by
the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
You can contact Elliotte Rusty Harold by sending e-mail to
elharo@ibiblio.org. Please include the word "XOM" in the
subject line. The XOM home page is http://www.xom.nu/
-->
<project name="XOM" default="help" basedir=".">
<description>
Build XOM
</description>
<!-- set global properties for this build -->
<target name="init">
<tstamp/>
<property name="Name" value="XOM"/>
<property name="name" value="xom"/>
<property name="majorversion" value="1"/>
<property name="minorversion" value="2"/>
<property name="microversion" value="7"/>
<!-- put a1, b2 etc. here in non-releases -->
<property name="versionqualifier" value=""/>
<property name="version" value="${majorversion}.${minorversion}.${microversion}${versionqualifier}"/>
<!-- OSGI wants a period before the a1/b2/d3 qualifier -->
<!-- Can I have an if statement here to check if ${microversion} is an empty string before adding a period?
Problem is release version doesn't get a version qualifier. -->
<property name="bundleversion" value="${majorversion}.${minorversion}.${microversion}.osgi"/>
<property name="jaxenversion" value="1.1.4"/>
<!-- <property name="bundleversion" value="${majorversion}.${minorversion}.${microversion}.${versionqualifier}.osgi"/> -->
<property name="year" value="2011"/>
<echo message="----------- ${Name} ${version} ------------"/>
<property name="debug" value="off"/>
<property name="optimize" value="on"/>
<property name="deprecation" value="off"/>
<property name="src.dir" value="./src"/>
<property name="fat.src" value="./fatsrc"/>
<property name="src15.dir" value="./src15"/>
<property name="lib.dir" value="./lib"/>
<property name="lib2.dir" value="./lib2"/>
<property name="packages" value="nu.xom.*"/>
<property name="build.dir" value="./build"/>
<property name="build15.dir" value="./classes15"/>
<property name="build.src" value="./build/src"/>
<property name="build.dest" value="./build/classes"/>
<property name="build.javadocs" value="./build/apidocs"/>
<property name="testoutput.dir" value="./testresults"/>
<property name="dist.dir" value="./dist"/>
<property name="clover.dir" value="./clover"/>
<property name="testreports.dir" value="./testreports" />
<property name="jaxen.dir" value="${build.dir}/jaxen-classes"/>
<property name="xml-apis.jar" value="${lib.dir}/xml-apis.jar"/>
<property name="parser.jar" value="${lib.dir}/dtd-xercesImpl.jar"/>
<property name="xslt.jar" value="${lib.dir}/xalan.jar"/>
<property name="serializer.jar" value="${lib.dir}/serializer.jar"/>
<property name="tagsoup.jar" value="${lib2.dir}/tagsoup-1.2.jar"/>
<property name="junit.jar" value="${lib.dir}/junit.jar"/>
<property name="xom.jar" value="${build.dir}/${name}-${version}.jar"/>
<property name="xom-core" value="${build.dest}"/>
<property name="saxon6.jar" value="${lib2.dir}/saxon.jar"/>
<property name="saxon7.jar" value="${lib2.dir}/saxon-aelfred.jar"/>
<property name="gnujaxp.jar" value="${lib2.dir}/gnujaxp.jar"/>
<property name="resolver.jar" value="${lib2.dir}/resolver.jar"/>
<property name="dom4j.jar" value="${lib2.dir}/dom4j-1.5.1.jar"/>
<property name="excludes" value=".clover, .DS_Store, **/.DS_Store, **/.AppleFileInfo, **/*.zip, **/.thumbnails/**, clover_html/**, clover/**, xom.gif, data/XInclude-Test-Suite/**, data/xmlconf/**, data/canonical/xmlconf/**, data/oasis*/**, **/testresults/**, **/pantry/**, **/workspace/**, **/junit*properties, **/.nautilus-metafile.xml, website/**, **/.project, **/.classpath, build/**, dist/**, .settings/**, lib2/**, xom.fb, jester*, trademark*"/>
<property name="test.outputFormat" value="xml"/>
<property name="sources.jar" location="${dist.dir}/maven2/xom-${version}-sources.jar" />
<property name="javadoc.jar" location="${dist.dir}/maven2/xom-${version}-javadoc.jar" />
<!-- only needed for servlet samples -->
<property name="servlet.jar" value="${lib2.dir}/servlet.jar"/>
<condition property="servlet.jar.installed">
<and>
<available classname="javax.servlet.ServletException" classpath="${servlet.jar}" />
<available classname="javax.servlet.SingleThreadModel" classpath="${servlet.jar}" />
<available classname="javax.servlet.http.HttpServletRequest" classpath="${servlet.jar}" />
<available classname="javax.servlet.http.HttpServletResponse" classpath="${servlet.jar}"/>
<available classname="javax.servlet.http.HttpServlet" classpath="${servlet.jar}" />
</and>
</condition>
<path id="compile.class.path">
<pathelement location="${xml-apis.jar}"/>
<pathelement location="${parser.jar}"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${jaxen.dir}"/>
<pathelement location="${servlet.jar}"/>
</path>
<path id="run.class.path">
<pathelement location="${xml-apis.jar}"/>
<pathelement location="${parser.jar}"/>
<pathelement location="${xom-core}"/>
<pathelement location="${jaxen.dir}"/>
<pathelement location="${xslt.jar}"/>
<pathelement location="${serializer.jar}"/>
</path>
<path id="test.class.path">
<path refid="run.class.path"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${saxon6.jar}"/>
<pathelement location="${saxon7.jar}"/>
<pathelement location="${gnujaxp.jar}"/>
<pathelement location="${resolver.jar}"/>
<pathelement location="${dom4j.jar}"/>
</path>
<path id="doc.class.path">
<path refid="test.class.path"/>
<pathelement location="${build.dest}"/>
<pathelement location="${tagsoup.jar}"/>
</path>
<!-- set these properties for debugging -->
<property name="compile.classpath" refid="compile.class.path"/>
<property name="test.classpath" refid="test.class.path"/>
<property name="run.classpath" refid="run.class.path"/>
<property name="doc.classpath" refid="doc.class.path"/>
<available property="tagsoup.installed" classname="org.ccil.cowan.tagsoup.Parser">
<classpath>
<pathelement location="${tagsoup.jar}" />
</classpath>
</available>
<available property="clover.installed"
file="clover.jar" filepath="${ant-home}/lib/clover.jar" />
</target>
<target name="help">
<echo>
XOM Build file
-------------------------------------------------------------
available targets are:
help --> print this message
jar --> build the xom.jar file
samples --> build the xom-samples.jar file
compile --> compile the source code
compile15 --> compile the classes that depend on Java 1.5
javadoc --> generate the API documentation
betterdoc --> better formatted API documentation (requires Ant 1.6)
test --> run JUnit test suite
testui --> run Junit test suite in GUI
clean --> clean up the build directory
dist --> the zip and .tar.gz files
uploaddocs --> upload API documentation and home page
uploadbetadocs --> upload unstable API documentation and home page
upload --> upload archive files
postbeta --> tag and upload a beta release
release --> tag and upload a final release
Use the option -Dfat=true to make Text objects bigger but faster.
-------------------------------------------------------------
</echo>
</target>
<target name="prepare" depends="init, prepare-dirs, prepare-fat" />
<target name="prepare-dirs" depends="init">
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/maven1"/>
<mkdir dir="${dist.dir}/maven2"/>
<mkdir dir="${testoutput.dir}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/jaxen"/>
<mkdir dir="${build.dir}/jaxen-classes"/>
<mkdir dir="${build15.dir}"/>
<mkdir dir="${build.src}"/>
<mkdir dir="${build.dest}"/>
<delete file="${build.src}/nu/xom/Text.java" failonerror="false"/>
<copy todir="${build.src}">
<fileset dir="${src.dir}"/>
</copy>
</target>
<!-- use Text.java that stores contents in String -->
<target name="prepare-fat" depends="init" if="fat">
<copy todir="${build.src}" overwrite="true">
<fileset dir="${fat.src}"/>
</copy>
</target>
<target name="compile-core" depends="prepare, compile-jaxen"
description="Compile the source code">
<javac srcdir="${build.src}"
destdir="${build.dest}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="1.5"
source="1.5"
encoding="UTF-8"
fork="true"
includeAntRuntime="false"
excludes="nu/xom/pantry/* nu/xom/tools/* nu/xom/samples/*Servlet.java">
<classpath refid="compile.class.path"/>
</javac>
<copy file="${build.src}/nu/xom/characters.dat" tofile="${build.dest}/nu/xom/characters.dat"/>
<!-- update version number -->
<echo file="${build.dest}/nu/xom/version.txt">${version}</echo>
<copy file="${build.src}/nu/xom/compositions.dat" tofile="${build.dest}/nu/xom/compositions.dat" />
<!-- This file requires Java 1.5 to generate so we compile it with a
different target and copy it over here. -->
<copy file="classes15/nu/xom/JDK15XML1_0Parser.class" tofile="${build.dest}/nu/xom/JDK15XML1_0Parser.class"/>
</target>
<target name="compile" depends="compile-core, compile-servlets"
description="Compile the source code" />
<target name="compile-servlets" depends="compile-core" if="servlet.jar.installed"
description="Compile the source code including the servlet samples">
<javac srcdir="${build.src}"
sourcepath=""
destdir="${build.dest}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="1.2"
source="1.3"
encoding="UTF-8"
includeAntRuntime="false">
<classpath refid="compile.class.path"/>
<include name="nu/xom/samples/*Servlet.java" />
</javac>
</target>
<!-- This task requires Java 1.5 to complete successfully -->
<target name="compile15" depends="prepare" description="Compile the JDK15XML1_0Parser" >
<javac srcdir="${src15.dir}"
destdir="${build15.dir}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="1.2"
source="1.3"
encoding="UTF-8"
failonerror="false"
includeAntRuntime="false">
<classpath refid="compile.class.path"/>
</javac>
</target>
<target name="minimal" depends="compile" description="Create xom-minimal.jar">
<jar jarfile="${build.dir}/${name}-${version}-minimal.jar"
basedir="${build.dest}"
index="no"
compress="yes"
includes="nu/xom/* nu/xom/xslt/* nu/xom/xinclude/* nu/xom/converters/* nu/xom/canonical/* nu/xom/tests/XOMTestCase.class"
excludes="nu/xom/samples/* nu/xom/benchmarks/* nu/xom/pantry/* nu/xom/tools/*">
<manifest>
<attribute name="Sealed" value="true"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Title" value="XOM"/>
<attribute name="Specification-Version" value="${version}"/>
<attribute name="Specification-Vendor" value="Elliotte Rusty Harold"/>
<attribute name="Implementation-Title" value="XOM"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Elliotte Rusty Harold"/>
<attribute name="Main-Class" value="nu.xom.Info"/>
<section name="nu/xom/">
<attribute name="Specification-Title" value="XOM core classes"/>
<attribute name="Implementation-Title" value="nu.xom"/>
</section>
<section name="nu/xom/xslt/">
<attribute name="Specification-Title" value="XOM XSLT interface"/>
<attribute name="Implementation-Title" value="nu.xom.xslt"/>
</section>
<section name="nu/xom/xinclude/">
<attribute name="Specification-Title" value="XOM XInclude engine"/>
<attribute name="Implementation-Title" value="nu.xom.xinclude"/>
</section>
<section name="nu/xom/converters/">
<attribute name="Specification-Title" value="XOM converters to other object models"/>
<attribute name="Implementation-Title" value="nu.xom.converters"/>
</section>
<section name="nu/xom/canonical/">
<attribute name="Specification-Title" value="XOM Canonical XML support"/>
<attribute name="Implementation-Title" value="nu.xom.canonical"/>
</section>
</manifest>
</jar>
</target>
<target name="jar" depends="compile" description="Create xom.jar">
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
classpath="${lib.dir}/jarjar-1.0.jar"/>
<jarjar jarfile="${build.dir}/${name}-${version}.jar"
basedir="${build.dest}"
index="no"
compress="yes"
includes="nu/xom/* nu/xom/xslt/* nu/xom/xinclude/* nu/xom/converters/* nu/xom/canonical/* nu/xom/tests/XOMTestCase.class"
excludes="nu/xom/samples/* nu/xom/benchmarks/* nu/xom/pantry/* nu/xom/tools/*">
<fileset dir="${jaxen.dir}"
excludes="**Demo.class **/package.html org/jaxen/xom/** org/jaxen/XPathTestBase.class org/jaxen/jdom/** org/jaxen/dom4j/** org/jaxen/javabean/** org/jaxen/dom/** org/jaxen/**Test.class org/jaxen/saxpath/base/**Test.class org/jaxen/saxpath/helpers/**Test.class org/jaxen/saxpath/helpers/**Test.class org/jaxen/pattern/** org/jaxen/saxpath/SAXPathParseException.class org/jaxen/pattern/PriorityTest.class">
</fileset>
<rule pattern="org.jaxen.**" result="nu.xom.jaxen.@1"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Title" value="XOM"/>
<attribute name="Specification-Version" value="${version}"/>
<attribute name="Specification-Vendor" value="Elliotte Rusty Harold"/>
<attribute name="Implementation-Title" value="XOM"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Elliotte Rusty Harold"/>
<attribute name="Main-Class" value="nu.xom.Info"/>
<!-- OSGI Information -->
<attribute name="Manifest-Version" value="1.0"/>
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-Name" value="${Name}"/>
<attribute name="Bundle-SymbolicName" value="nu.xom"/>
<attribute name="Bundle-Version" value="${bundleversion}"/>
<attribute name="Bundle-Vendor" value="xom.nu"/>
<attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-1.2"/>
<attribute name="Export-Package" value="nu.xom, nu.xom.canonical, nu.xom.converters, nu.xom.xinclude, nu.xom.xslt"/>
<attribute name="Import-Package" value='javax.xml.transform.sax, javax.xml.transform, org.w3c.dom, org.xml.sax, org.xml.sax.helpers, org.xml.sax.ext,
org.apache.xerces.parsers;resolution:=optional;version="2.8.0", org.apache.xerces.impl;resolution:=optional;version="2.8.0",
org.apache.xerces.jaxp;resolution:=optional;version="2.9.0", junit.framework;resolution:=optional;version="3.8.1",
com.sun.org.apache.xerces.internal.jaxp;resolution:=optional, com.sun.org.apache.xerces.internal.parsers;resolution:=optional'/>
<section name="nu/xom/">
<attribute name="Sealed" value="true"/>
<attribute name="Specification-Title" value="XOM core classes"/>
<attribute name="Implementation-Title" value="nu.xom"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Elliotte Rusty Harold"/>
</section>
<section name="nu/xom/jaxen/">
<attribute name="Specification-Title" value="Jaxen XPath engine"/>
<attribute name="Implementation-Title" value="org.jaxen"/>
<attribute name="Implementation-Version" value="${jaxenversion}"/>
<attribute name="Implementation-Vendor" value="CodeHaus"/>
</section>
<section name="nu/xom/xslt/">
<attribute name="Sealed" value="true"/>
<attribute name="Specification-Title" value="XOM XSLT interface"/>
<attribute name="Implementation-Title" value="nu.xom.xslt"/>
</section>
<section name="nu/xom/xinclude/">
<attribute name="Sealed" value="true"/>
<attribute name="Specification-Title" value="XOM XInclude engine"/>
<attribute name="Implementation-Title" value="nu.xom.xinclude"/>
</section>
<section name="nu/xom/converters/">
<attribute name="Sealed" value="true"/>
<attribute name="Specification-Title" value="XOM converters to other object models"/>
<attribute name="Implementation-Title" value="nu.xom.converters"/>
</section>
<section name="nu/xom/canonical/">
<attribute name="Sealed" value="true"/>
<attribute name="Specification-Title" value="XOM Canonical XML support"/>
<attribute name="Implementation-Title" value="nu.xom.canonical"/>
</section>
</manifest>
</jarjar>
<!-- Put a copy in the dist dir too, because I never remember to upload
the jar from the build directory. -->
<copy file="${build.dir}/${name}-${version}.jar" todir="${dist.dir}"/>
</target>
<target name="samples" depends="compile" description="Create xom-samples.jar">
<jar jarfile="${build.dir}/${name}-samples.jar"
basedir="${build.dest}"
index="yes"
compress="yes"
includes="nu/xom/samples/* nu/xom/benchmarks/*"
excludes="nu/xom/xslt/* nu/xom/xinclude/* nu/xom/tools/* nu/xom/converters/* nu/xom/canonical/* nu/xom/pantry/*">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Title" value="XOM Samples"/>
<attribute name="Specification-Version" value="${version}"/>
<attribute name="Specification-Vendor" value="Elliotte Rusty Harold"/>
<attribute name="Implementation-Title" value="XOM Samples"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Elliotte Rusty Harold"/>
<!-- I can't get this to work yet
<attribute name="Main-Class" value="nu.xom.samples.XMLPrinter"/>
<attribute name="Class-Path" value="${name}-${version}.jar"/> -->
</manifest>
</jar>
</target>
<target name="javadoc" depends="prepare"
description="Generate the API documentation">
<mkdir dir="${build.javadocs}"/>
<javadoc packagenames="nu.xom.xslt, nu.xom.canonical, nu.xom.xinclude, nu.xom, nu.xom.converters"
sourcepath="${build.src}"
destdir="${build.javadocs}"
author="true"
version="true"
overview="overview.html"
use="true"
splitindex="true"
noindex="false"
windowtitle="${Name} ${version} API"
docencoding="UTF-8"
charset="UTF-8"
link="http://www.junit.org/junit/javadoc/3.8.1"
doctitle="${Name} ${version}"
bottom="Copyright 2002-${year} <a href='http://www.elharo.com/'>Elliotte Rusty Harold</a>
<br /> <a href='mailto:elharo%40ibiblio%2Eorg?Subject=XOM'>elharo@ibiblio.org</a>">
<classpath refid="test.class.path"/>
<fileset dir="${build.src}" defaultexcludes="yes">
<include name="nu/xom/tests/XOMTestCase.java" />
</fileset>
</javadoc>
</target>
<!-- I can never remember the exact target name -->
<target name="javadocs" depends="javadoc" />
<target name="apidocs" depends="javadoc"/>
<target name="apidoc" depends="javadoc"/>
<target name="betterdocs" depends="betterdoc"/>
<target name="-checkForTagSoup" unless="tagsoup.installed">
<echo>
Better documentation requires TagSoup to be installed
in the lib2 directory. You can download it from
http://mercury.ccil.org/~cowan/XML/tagsoup/
</echo>
</target>
<target name="-checkForClover" unless="clover.installed">
<echo>
The task you are trying to run requires Clover to be installed
in the $ANT_HOME/lib directory. You can purchase Clover from
http://www.cenqua.com/clover/
</echo>
</target>
<!-- This task requires Ant 1.6 and TagSoup -->
<target name="betterdoc" depends="compile, -checkForTagSoup" if="tagsoup.installed"
description="Generate the API documentation">
<mkdir dir="${build.javadocs}"/>
<javadoc packagenames="nu.xom.xslt, nu.xom.canonical, nu.xom.xinclude, nu.xom, nu.xom.converters"
sourcepath="${build.src}"
destdir="${build.javadocs}"
author="true"
version="true"
overview="overview.html"
use="true"
splitindex="true"
noindex="false"
windowtitle="${Name} ${version} API"
docencoding="UTF-8"
charset="UTF-8"
noqualifier="java.lang:java.io"
link="http://www.junit.org/junit/javadoc/3.8.1"
doctitle="${Name} ${version}"
bottom="Copyright 2002-${year} <a href='http://www.elharo.com/'>Elliotte Rusty Harold</a>
<br/> <a href='mailto:elharo%40ibiblio%2Eorg?Subject=XOM'>elharo@ibiblio.org</a>">
<classpath refid="test.class.path"/>
<fileset dir="${build.src}" defaultexcludes="yes">
<include name="nu/xom/tests/XOMTestCase.java" />
</fileset>
</javadoc>
<javac srcdir="${build.src}"
destdir="${build.dest}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="1.2"
source="1.3"
encoding="UTF-8"
includeAntRuntime="false"
includes="nu/xom/tools/*">
<classpath>
<pathelement path="${compile.class.path}"/>
<pathelement path="${tagsoup.jar}"/>
</classpath>
</javac>
<java classname="nu.xom.tools.XHTMLJavaDoc" fork="yes">
<jvmarg value="-Xbootclasspath/p:lib/dtd-xercesImpl.jar:lib/xml-apis.jar:lib/xalan.jar"/>
<classpath refid="doc.class.path" />
<arg value="build/apidocs"/>
</java>
</target>
<property name="prefix" value="${name}-${version}" />
<target name="dist" depends="zip, tar.gz, maven" />
<!-- invoke as
ant -Dpassword=secret upload -->
<property name="password" value="" />
<!-- This task depends on Jsch library not included in the Ant distribution. -->
<target name="upload" depends="dist">
<scp password="${password}"
todir="elharo:${password}@login.ibiblio.org:/export/sunsite/users/elharo/xml/XOM">
<fileset file="${dist.dir}/${name}-${version}-src.zip" />
<fileset file="${dist.dir}/${name}-${version}.zip" />
<fileset file="${dist.dir}/${name}-${version}.tar.gz" />
<fileset file="${dist.dir}/${name}-${version}-src.tar.gz" />
<fileset file="${dist.dir}/${name}-${version}.jar" />
<fileset file="${dist.dir}/maven2/xom-maven-${version}.jar" />
</scp>
</target>
<!-- invoke as
ant -Dpassword=secret -Dwebpassword=secret postbeta -->
<property name="webpassword" value="" />
<!-- We have an antipattern here. This should be deployed from CVS,
not from the local hard drive. Worth fixing down the line.
The basic idea is that the release and postbeta targets should take
a tag as an argument. Then they should download the tagged files from CVS,
package them, and release those. Possibly the jar and zip targets
should do similarly, or at least the dist target. -->
<!-- should only be run once per release -->
<target name="postbeta" depends="upload, uploadbetadocs">
<cvs command="tag -R XOM_${majorversion}${minorversion}${microversion}${versionqualifier}"
cvsRoot=":pserver:elharo@cvs.dev.java.net:/cvs"/>
</target>
<!-- should only be run once per release -->
<target name="release" depends="upload, uploaddocs">
<cvs command="tag -R XOM_${majorversion}${minorversion}${microversion}"
cvsRoot=":pserver:elharo@cvs.dev.java.net:/cvs"
package="xom"/>
</target>
<target name="uploadbetadocs" depends="betterdocs">
<scp todir="elharo:${webpassword}@humph.pair.com:/usr/home/elharo/public_html/unstable/apidocs">
<fileset dir="build/apidocs" />
</scp>
<scp todir="elharo:${webpassword}@humph.pair.com:/usr/home/elharo/public_html">
<fileset file="website/unstable.html" />
</scp>
</target>
<!-- this target does not yet work, so I have to tag manually. Any ideas? -->
<target name="tag" depends="compile" description="tag target in CVS">
<cvs command="tag -R XOM_${majorversion}${minorversion}${microversion}${versionqualifier}"
cvsRoot=":pserver:elharo@cvs.dev.java.net:/cvs"
package="xom"/>
</target>
<target name="uploaddocs" depends="upload">
<scp todir="elharo:${webpassword}@humph.pair.com:/usr/home/elharo/public_html/apidocs">
<fileset dir="build/apidocs" />
</scp>
<scp todir="elharo:${webpassword}@humph.pair.com:/usr/home/elharo/public_html">
<fileset file="website/index.html" />
<fileset file="website/history.html" />
<fileset file="website/unstable.html" />
</scp>
</target>
<target name="zip" depends="jar, betterdoc, samples"
description="Build zip file for distro">
<zip destfile="${dist.dir}/${name}-${version}-src.zip">
<zipfileset prefix="XOM" dir="." excludes="${excludes}"/>
</zip>
<zip destfile="${dist.dir}/${name}-${version}.zip">
<zipfileset prefix="XOM" dir="." excludes="${excludes}"/>
<zipfileset prefix="XOM/apidocs" dir="./${build.dir}/apidocs"
excludes="**/.thumbnails/**, **/.nautilus-metafile.xml, website/**, **/.project, **/.classpath, **/.DS_Store"/>
<zipfileset fullpath="XOM/${name}-${version}.jar" dir="./${build.dir}" includes="${name}-${version}.jar"/>
<zipfileset fullpath="XOM/${name}-samples.jar" dir="./${build.dir}" includes="${name}-samples.jar"/>
</zip>
</target>
<target name="tar" depends="jar, betterdoc, samples"
description="Build tar file for distro">
<tar destfile="${dist.dir}/${name}-${version}-src.tar">
<tarfileset prefix="XOM" dir="."
excludes="${excludes}"/>
</tar>
<tar destfile="${dist.dir}/${name}-${version}.tar">
<tarfileset prefix="XOM" dir="."
excludes="${excludes}"/>
<tarfileset prefix="XOM/apidocs" dir="./${build.dir}/apidocs"
excludes="**/.thumbnails/**, **/.nautilus-metafile.xml, website/**, **/.project, **/.classpath, **/.DS_Store"/>
<tarfileset fullpath="XOM/${name}-${version}.jar" dir="./${build.dir}" includes="${name}-${version}.jar"/>
<tarfileset fullpath="XOM/${name}-samples.jar" dir="./${build.dir}" includes="${name}-samples.jar"/>
</tar>
</target>
<target name="tar.gz" depends="tar" description="Build tar.gz file for distro">
<gzip src="${dist.dir}/${name}-${version}.tar" zipfile="${dist.dir}/${name}-${version}.tar.gz"/>
<gzip src="${dist.dir}/${name}-${version}-src.tar" zipfile="${dist.dir}/${name}-${version}-src.tar.gz"/>
</target>
<!-- This task requires the ANT optional.jar -->
<target name="test" depends="compile" description="Run JUnit tests using command line user interface">
<junit fork="yes">
<classpath refid="test.class.path" />
<formatter type="${test.outputFormat}" />
<batchtest fork="yes" todir="${testoutput.dir}">
<fileset dir="${build.src}">
<include name="**/*Test.java" />
<exclude name="**/pantry/*" />
<exclude name="**/MegaTest.java" />
<exclude name="**/benchmarks/*.java" />
<exclude name="**/EBCDICTest.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${testoutput.dir}">
<fileset dir="${testoutput.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${testoutput.dir}" />
</junitreport>
</target>
<target name="testjar" depends="jar" description="Run JUnit tests using jar file">
<junit printsummary="on" fork="no">
<classpath>
<pathelement location="${xom.jar}"/>
<pathelement location="${junit.jar}"/>
</classpath>
<classpath refid="run.class.path" />
<formatter type="${test.outputFormat}" />
<batchtest fork="yes" todir="${testoutput.dir}">
<fileset dir="${build.src}">
<include name="**/*Test.java" />
<exclude name="**/pantry/*" />
<exclude name="**/MegaTest.java" />
<exclude name="**/benchmarks/*.java" />
<exclude name="**/EBCDICTest.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="testui" depends="compile" description="Run JUnit tests using GUI interface">
<java classname="junit.swingui.TestRunner" fork="yes" maxmemory="99m">
<sysproperty key="org.xml.sax.driver" value="org.apache.xerces.parsers.SAXParser"/>
<classpath refid="test.class.path" />
<arg value="nu.xom.tests.XOMTests"/>
</java>
</target>
<target name="clean" depends="init" description="Remove build files">
<delete dir="${build.dir}"/>
<delete dir="${testoutput.dir}"/>
<delete dir=".clover"/>
<delete dir="clover"/>
<delete dir="clover_html"/>
<delete>
<fileset dir="." includes="junit*properties"/>
</delete>
</target>
<!-- These tasks require Clover -->
<taskdef resource="clovertasks"/>
<target name="with.clover" depends="init, -checkForClover">
<mkdir dir="${clover.dir}"/>
<clover-setup initString="${clover.dir}/xom_coverage.db">
<files>
<include name="nu/xom/**"/> <!-- work around Ant 1.6.3 bug #34722 -->
<exclude name="nu/xom/UnicodeUtil.java"/>
<exclude name="nu/xom/Latin6Writer.java"/>
<exclude name="nu/xom/Latin8Writer.java"/>
<exclude name="nu/xom/Latin10Writer.java"/>
<exclude name="nu/xom/tests/FastTests.java"/>
<exclude name="nu/xom/tests/XOMTests.java"/>
<exclude name="nu/xom/samples/**"/>
<exclude name="nu/xom/pantry/**"/>
<exclude name="nu/xom/benchmarks/**"/>
<exclude name="nu/xom/tools/**" />
</files>
</clover-setup>
</target>
<property name="ant-home" value="/opt/ant"/>
<target name="clover.html" depends="with.clover">
<clover-report>
<current outfile="clover_html" title="Clover results for ${Name} ${version}">
<format type="html"/>
</current>
</clover-report>
</target>
<!-- This task requires the ANT optional.jar. clover.jar, and junit.jar to be installed in ANT_HOME/lib -->
<target name="clovertest" depends="compile, -checkForClover" description="Run JUnit tests with clover.jar in classpath">
<junit printsummary="on" fork="no">
<classpath refid="test.class.path" />
<classpath>
<pathelement path="${ant-home}/lib/clover.jar"/>
</classpath>
<formatter type="${test.outputFormat}" />
<batchtest fork="yes" todir="${testoutput.dir}">
<fileset dir="${build.src}">
<include name="**/*Test.java" />
<exclude name="**/pantry/*.java" />
<exclude name="**/MegaTest.java" />
<exclude name="**/benchmarks/*.java" />
<exclude name="**/tools/*.java" />
<exclude name="**/EBCDICTest.java" />
<exclude name="nu/xom/tests/FastTests.java"/>
<exclude name="nu/xom/tests/XOMTests.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- This task requires the ANT optional.jar. clover.jar, and junit.jar to be installed in ANT_HOME/lib -->
<target name="fastclover" depends="compile, -checkForClover" description="Run JUnit tests with clover.jar in classpath">
<junit printsummary="on" fork="no">
<classpath refid="test.class.path" />
<classpath>
<pathelement path="${ant-home}/lib/clover.jar"/>
</classpath>
<formatter type="${test.outputFormat}" />
<batchtest fork="yes" todir="${testoutput.dir}">
<fileset dir="${build.src}">
<include name="**/*Test.java" />
<exclude name="**/pantry/*.java" />
<exclude name="**/EncodingTest.java" />
<exclude name="**/XIncludeTest.java" />
<exclude name="**/MegaTest.java" />
<exclude name="**/benchmarks/*.java" />
<exclude name="**/tools/*.java" />
<exclude name="**/EBCDICTest.java" />
<exclude name="nu/xom/tests/FastTests.java"/>
<exclude name="nu/xom/tests/XOMTests.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="maven" depends="maven1, maven2" />
<!-- Generate a Maven 1 JAR for uploading to the maven
bug repository and hence placement onto ibiblio and mirrors.
See http://maven.apache.org/maven-1.x/reference/repository-upload.html -->
<target name="maven1" depends="jar" >
<property name="pom.template" location="project.xml" />
<property name="pom.file" location="${build.dir}/project.xml" />
<property name="package.jar"
location="${build.dir}/${name}-${version}.jar"/>
<property name="license" location="LICENSE.txt" />
<property name="xom-maven-1.jar"
location="${dist.dir}/maven1/xom-maven-${version}.jar" />
<copy file="${pom.template}" tofile="${pom.file}">
<filterset>
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
<jar destFile="${xom-maven-1.jar}">
<fileset file="${pom.file}" />
<fileset file="${license}" />
<fileset file="${package.jar}" />
</jar>
</target>
<target name="sources.jar" depends="init, compile">
<jar jarfile="${sources.jar}" basedir="${build.dir}/src">
<exclude name= "nu/xom/benchmarks/**" />
<exclude name= "nu/xom/tools/**" />
<exclude name= "nu/xom/tests/**" />
<exclude name= "nu/xom/pantry/**" />
<exclude name= "nu/xom/samples/**" />
</jar>
</target>
<target name="javadoc.jar" depends="init, compile">
<jar jarfile="${javadoc.jar}" basedir="${build.dir}/apidocs">
</jar>
</target>
<!-- Generate a Maven 2 JAR for uploading to the maven
bug repository and hence placement onto ibiblio and mirrors.
See http://maven.apache.org/guides/mini/guide-central-repository-upload.html -->
<target name="maven2" depends="jar, sources.jar, javadoc.jar" >
<property name="pom2.template" location="project2.xml" />
<property name="pom2.file" location="${build.dir}/maven2/project.xml" />
<property name="package.jar" location="${build.dir}/${name}-${version}.jar"/>
<property name="license" location="LICENSE.txt" />
<property name="xom-maven-2.jar" location="${dist.dir}/maven2/xom-maven-${version}.jar" />
<copy file="${pom2.template}" tofile="${pom2.file}">
<filterset>
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
<jar destFile="${xom-maven-2.jar}">
<fileset file="${pom2.file}" />
<fileset file="${license}" />
<fileset file="${package.jar}" />
<fileset file="${sources.jar}" />
<fileset file="${javadoc.jar}" />
</jar>
</target>
<target name="compile-jaxen" description="Compile Jaxen" depends="get-jaxen">
<javac srcdir="${build.dir}/jaxen-${jaxenversion}/src/java/main"
destdir="${build.dir}/jaxen-classes"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="1.2"
source="1.3"
encoding="UTF-8"
includeAntRuntime="false"
excludes="org/jaxen/dom/**
org/jaxen/jdom/**
org/jaxen/dom4j/**
org/jaxen/pattern/**
org/jaxen/javabean/**
org/jaxen/xom/**
org/jaxen/function/xslt/**
org/jaxen/function/ext/**
org/jaxen/saxpath/expr/DefaultPredicated.java
org/jaxen/saxpath/helpers/DefaultXPathHandler.java
org/jaxen/util/StackedIterator.java
org/jaxen/util/XPath2XMLVisitor.java
org/jaxen/util/LinkedIterator.java
org/jaxen/util/SelfAxisIterator.java
">
<classpath refid="compile.class.path"/>
</javac>
</target>
<target name="get-jaxen" description="Download Jaxen source code" depends="prepare">
<unzip src="jaxen-${jaxenversion}-src.zip" dest="${build.dir}" />
</target>
<target name="debug" depends="init" description="Print various Ant properties">
<echoproperties/>
<java classname="org.apache.xalan.Version" fork="yes">
<classpath refid="test.class.path" />
</java>
</target>
<target name="website" depends="init" description="Print various Ant properties">
<ant antfile="build.xml" dir="website"/>
</target>
</project>