summaryrefslogtreecommitdiffstats
path: root/build.xml
blob: b97df76939faba03323a410a99526bdff5cd2d10 (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
<?xml version="1.0"?>
<!-- 
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE project PUBLIC "-//Ant//Project 1.5//EN" "ant.dtd">

<!--
    POI Build System.  Written by:

        Glen Stampoultzis   glens at apache.org

    Modified by:

        Rainer Klute        klute@rainer-klute.de

    This build was tested with ant 1.6.2 although it will probably work with
    other versions.  The following jar files should be available on the 
    classpath when running ant:

    LIBRARY         LOCATION
    =======         ========
    junit(3.8+)     http://www.ibiblio.org/maven/junit/jars/
    xerces          http://www.ibiblio.org/maven/xerces/jars/
    jdepend         http://www.ibiblio.org/maven/jdepend/jars/
    xalan           http://www.ibiblio.org/maven/xalan/jars/

    The ant jar "optional.jar" should also be available otherwise the
    build will fail.

    To build the documentation you will need to install forrest and set
    the FORREST_HOME environment variable.  Forrest 0.5.1 required.

    Some people may find the tests hang when run through Ant. If this
    happens to you, try giving Ant some more memory when you run it, eg:
          ANT_OPTS="-Xmx1024m -XX:MaxPermSize=256m" ant test


    TO BE COMPLETED:

    Convert book.xml files to a sitemap.

 -->
<project name="POI Build" default="help" basedir=".">

  <description>
    The POI project Ant build.
  </description>

  <property environment="env"/>

  <property name="repository" value="http://www.ibiblio.org/maven"/>
  <property name="forrest.home" value="${env.FORREST_HOME}"/>

  <!-- Main: -->
  <property name="main.resource1.dir" value="src/resources/main"/>
  <property name="main.src" location="src/java"/>
  <property name="main.src.test" location="src/testcases"/>
  <property name="main.documentation" value="src/documentation"/>
  <property name="main.output.dir" location="build/classes"/>
  <property name="main.output.test.dir" location="build/test-classes"/>
  <property name="main.lib" location="lib"/>
  <property name="ooxml.lib" location="ooxml-lib"/>
  <property name="main.reports.test" location="build/test-results"/>
  <property name="main.jar1.dir" location="${main.lib}/commons-logging-1.1.jar"/>
  <property name="main.jar1.url" value="${repository}/commons-logging/jars/commons-logging-1.1.jar"/>
  <property name="main.jar2.dir" location="${main.lib}/log4j-1.2.13.jar"/>
  <property name="main.jar2.url" value="${repository}/log4j/jars/log4j-1.2.13.jar"/>
  <property name="main.testokfile" location="build/main-testokfile.txt"/>

  <property name="junit.jar1.dir" location="${main.lib}/junit-3.8.1.jar"/>
  <property name="junit.jar1.url" value="${repository}/junit/jars/junit-3.8.1.jar"/>

  <!-- Scratchpad: -->
  <property name="scratchpad.src" location="src/scratchpad/src"/>
  <property name="scratchpad.src.test" location="src/scratchpad/testcases"/>
  <property name="scratchpad.lib" location="src/scratchpad/lib"/>
  <property name="scratchpad.reports.test" location="build/scratchpad-test-results"/>
  <property name="scratchpad.output.dir" location="build/scratchpad-classes"/>
  <property name="scratchpad.output.test.dir" location="build/scratchpad-test-classes"/>
  <property name="scratchpad.testokfile" location="build/scratchpad-testokfile.txt"/>

  <!-- Contributed software: -->
  <property name="contrib.src" location="src/contrib/src"/>
  <property name="contrib.src.test" location="src/contrib/testcases"/>
  <property name="contrib.lib" location="src/contrib/lib"/>
  <property name="contrib.reports.test" location="build/contrib-test-results"/>
  <property name="contrib.output.dir" location="build/contrib-classes"/>
  <property name="contrib.output.test.dir" location="build/contrib-test-classes"/>
  <property name="contrib.jar1.dir" location="${contrib.lib}/commons-beanutils-1.7.0.jar"/>
  <property name="contrib.jar1.url" value="${repository}/commons-beanutils/jars/commons-beanutils-1.7.0.jar"/>
  <property name="contrib.jar2.dir" location="${contrib.lib}/commons-collections-3.2.jar"/>
  <property name="contrib.jar2.url" value="${repository}/commons-collections/jars/commons-collections-3.2.jar"/>
  <property name="contrib.jar3.dir" location="${contrib.lib}/commons-lang-2.1.jar"/>
  <property name="contrib.jar3.url" value="${repository}/commons-lang/jars/commons-lang-2.1.jar"/>
  <property name="contrib.testokfile" location="build/contrib-testokfile.txt"/>

  <!-- Examples: -->
  <property name="examples.src" location="src/examples/src"/>
  <property name="examples.src.test" location="src/examples/testcases"/>
  <property name="examples.lib" location="src/examples/lib"/>
  <property name="examples.reports.test" location="build/examples-test-results"/>
  <property name="examples.output.dir" location="build/examples-classes"/>
  <property name="examples.output.test.dir" location="build/examples-test-classes"/>
  <property name="examples.jar1.dir" location="${examples.lib}/commons-beanutils-1.7.0.jar"/>
  <property name="examples.jar1.url" value="${repository}/commons-beanutils/jars/commons-beanutils-1.7.0.jar"/>
  <property name="examples.jar2.dir" location="${examples.lib}/commons-collections-3.2.jar"/>
  <property name="examples.jar2.url" value="${repository}/commons-collections/jars/commons-collections-3.2.jar"/>
  <property name="examples.jar3.dir" location="${examples.lib}/commons-lang-2.1.jar"/>
  <property name="examples.jar3.url" value="${repository}/commons-lang/jars/commons-lang-2.1.jar"/>
  <property name="examples.testokfile" location="build/examples-testokfile.txt"/>

  <!-- Experimental OOXML support: -->
  <property name="ooxml.src" location="src/scratchpad/ooxml-src"/>
  <property name="ooxml.src.test" location="src/scratchpad/ooxml-testcases"/>
  <property name="ooxml.reports.test" location="build/ooxml-test-results"/>
  <property name="ooxml.output.dir" location="build/ooxml-classes"/>
  <property name="ooxml.output.test.dir" location="build/ooxml-test-classes"/>
  <property name="ooxml.testokfile" location="build/ooxml-testokfile.txt"/>

  <property name="ooxml.jar1.dir" location="${ooxml.lib}/dom4j-1.6.1.jar"/>
  <property name="ooxml.jar1.url" value="${repository}/dom4j/jars/dom4j-1.6.1.jar"/>
  <property name="ooxml.jar2.dir" location="${ooxml.lib}/jaxen-1.1.jar"/>
  <property name="ooxml.jar2.url" value="${repository}/jaxen/jars/jaxen-1.1.jar"/>
  <property name="ooxml.jar3.dir" location="${ooxml.lib}/xmlbeans-2.3.0.jar"/>
  <property name="ooxml.jar3.url" value="${repository}/org.apache.xmlbeans/jars/xmlbeans-2.3.0.jar"/>
  <property name="ooxml.jar4.dir" location="${ooxml.lib}/jsr173_1.0_api.jar"/>
  <property name="ooxml.jar4.url" value="${repository}/xmlbeans/jars/jsr173_1.0_api.jar"/>
  <!-- No official release of openxml4j yet -->
  <property name="ooxml.jar5.dir" location="${ooxml.lib}/openxml4j-bin-alpha-080124.jar"/>
  <property name="ooxml.jar5.url" value="http://people.apache.org/~nick/openxml4j-bin-prealpha-071224.jar"/>

  <!-- See http://www.ecma-international.org/publications/standards/Ecma-376.htm -->
  <!-- "Copy these file(s), free of charge" -->
  <property name="ooxml.xsds.ozip" location="${ooxml.lib}/OfficeOpenXML-Part4.zip"/>
  <property name="ooxml.xsds.izip" location="${ooxml.lib}/OfficeOpenXML-XMLSchema.zip"/>
  <property name="ooxml.xsds.url" value="http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%20Part%204%20(DOCX).zip" />
  <property name="ooxml.xsds.jar" location="${ooxml.lib}/ooxml-schemas.jar"/>

  <property name="build.site" location="build/tmp/site/build/site"/>
  <property name="build.site.src" location="build/tmp/site"/>
  <property name="junit.report.dir" location="${build.site}/junit"/>
  <property name="jdepend.report.dir" location="${build.site}/jdepend"/>
  <property name="jdepend.report.out.dir" location="${build.site.src}/src/documentation/content/jdepend"/>
  <property name="apidocs.report.dir" location="${build.site}/apidocs"/>
  <property name="changelog.file" location="${build.site}/changelog.html"/>
  <property name="dist.dir" location="build/dist"/>
  <property name="mavendist.dir" location="build/maven-dist"/>
  <property name="mavendist.poi.dir" location="build/maven-dist/poi"/>
  <property name="mavendist.oap.dir" location="build/maven-dist/org.apache.poi"/>
  <property name="jar.name" value="poi"/>
  <property name="version.id" value="3.1-beta1"/>
  <property name="halt.on.test.failure" value="true"/>
  <property name="jdk.version.source" value="1.3"
    description="JDK version of source code"/>
  <property name="jdk.version.class" value="1.3"
    description="JDK version of generated class files"/>  
 

    <path id="main.classpath">
        <pathelement location="${main.jar1.dir}"/>
        <pathelement location="${main.jar2.dir}"/>
        <pathelement location="${main.resource1.dir}"/>
    </path>

    <path id="scratchpad.classpath">
        <path refid="main.classpath"/>
        <pathelement location="${main.output.dir}"/>
    </path>

    <path id="contrib.classpath">
        <path refid="main.classpath"/>
        <pathelement location="${contrib.jar1.dir}"/>
        <pathelement location="${contrib.jar2.dir}"/>
        <pathelement location="${contrib.jar3.dir}"/>
        <pathelement location="${main.output.dir}"/>
        <pathelement location="${main.output.test.dir}"/>
        <pathelement location="${scratchpad.output.dir}"/>
        <pathelement location="${scratchpad.output.test.dir}"/>
        <pathelement location="${contrib.output.dir}"/>
        <pathelement location="${contrib.output.test.dir}"/>
    </path>

    <path id="ooxml.classpath">
        <path refid="main.classpath"/>
        <path refid="scratchpad.classpath"/>
        <fileset dir="${ooxml.lib}">
			<include name="*.jar" />
		</fileset>
    </path>


  <path id="examples.classpath">
    <path refid="main.classpath"/>
    <pathelement location="${main.output.dir}"/>
  </path>



  <!-- Prints POI's Ant usage help -->
  <target name="help" description="Prints POI's Ant usage help">
    <echo>
      - Execute "ant -projecthelp" to view a listing of the main build
        targets.
      - Execute "ant help-properties" to view a listing of some properties
        controlling the build process.
    </echo>
  </target>



  <target name="help-properties"
    description="Prints a listing of build controlling properties">
    <echo>
      The following properties control the build process:

      -Ddisconnected="true": Do not execute any targets that require an online
          connection to the Internet.
      -Dtestcase=org.apache.poi.xxx.xxx : for the single-test target, specify
	      the test to run

      WARNING: This list is not exhaustive.
    </echo>
  </target>



    <target name="with.clover" if="clover.present">
        <taskdef resource="clovertasks"/>
        <clover-setup initString="mycoverage.db"/>
    </target>

    <target name="clover.html" depends="with.clover" if="clover.present">
        <echo>Generating clover report</echo>
       <clover-report>
          <current outfile="build/tmp/site/build/site/clover_html">
             <format type="html"/>
          </current>
       </clover-report>
    </target>

    <target name="init" depends="check-jars,fetch-jars">

        <tstamp>
          <format property="tstamp.year" pattern="yyyy"/>
        </tstamp>

        <available resource="clovertasks" property="clover.present"/>
        <antcall target="with.clover"/>
        
        <mkdir dir="build"/>
        <mkdir dir="build/non-ant-classes"/>
        <mkdir dir="${main.output.dir}"/>
        <mkdir dir="${scratchpad.output.dir}"/>
        <mkdir dir="${contrib.output.dir}"/>
        <mkdir dir="${examples.output.dir}"/>
        <mkdir dir="${ooxml.output.dir}"/>
        <mkdir dir="${main.output.test.dir}"/>
        <mkdir dir="${contrib.output.test.dir}"/>
        <mkdir dir="${scratchpad.output.test.dir}"/>
        <mkdir dir="${ooxml.output.test.dir}"/>
        <mkdir dir="${main.reports.test}"/>
        <mkdir dir="${scratchpad.reports.test}"/>
        <mkdir dir="${contrib.reports.test}"/>
        <mkdir dir="${ooxml.reports.test}"/>
        <mkdir dir="${junit.report.dir}"/>
        <mkdir dir="${jdepend.report.dir}"/>
        <mkdir dir="${jdepend.report.out.dir}"/>
        <mkdir dir="${apidocs.report.dir}"/>
        <mkdir dir="${dist.dir}"/>
        <mkdir dir="${build.site.src}/${main.documentation}"/>

        <mkdir dir="${mavendist.dir}"/>
        <mkdir dir="${mavendist.poi.dir}"/>
        <mkdir dir="${mavendist.poi.dir}/poms"/>
        <mkdir dir="${mavendist.oap.dir}"/>
        <mkdir dir="${mavendist.oap.dir}/jars"/>
        <mkdir dir="${mavendist.oap.dir}/poms"/>

        <copy todir="${build.site.src}/${main.documentation}">
            <fileset dir="${main.documentation}"/>
        </copy>
        <copy file="forrest.properties" tofile="${build.site.src}/forrest.properties"/>
    </target>

    <target name="clean">
        <delete dir="build"/>
    </target>

    <target name="check-jars">
        <condition property="jars.present">
            <or>
                <and>
                    <available file="${main.jar1.dir}"/>
                    <available file="${main.jar2.dir}"/>
                    <available file="${contrib.jar1.dir}"/>
                    <available file="${contrib.jar2.dir}"/>
                    <available file="${contrib.jar3.dir}"/>
                    <available file="${junit.jar1.dir}"/>
                    <available file="${ooxml.jar1.dir}"/>
                    <available file="${ooxml.jar2.dir}"/>
                    <available file="${ooxml.jar3.dir}"/>
                    <available file="${ooxml.jar4.dir}"/>
                    <available file="${ooxml.jar5.dir}"/>
                </and>
                <isset property="disconnected"/>
            </or>
        </condition>
    </target>

    <target name="fetch-jars" unless="jars.present"
     description="Fetches needed JAR files from the Internet">
        <get src="${main.jar1.url}" dest="${main.jar1.dir}"/>
        <get src="${main.jar2.url}" dest="${main.jar2.dir}"/>
        <get src="${contrib.jar1.url}" dest="${contrib.jar1.dir}"/>
        <get src="${contrib.jar2.url}" dest="${contrib.jar2.dir}"/>
        <get src="${contrib.jar3.url}" dest="${contrib.jar3.dir}"/>
        <get src="${junit.jar1.url}" dest="${junit.jar1.dir}"/>

        <get src="${ooxml.jar1.url}" dest="${ooxml.jar1.dir}"/>
        <get src="${ooxml.jar2.url}" dest="${ooxml.jar2.dir}"/>
        <get src="${ooxml.jar3.url}" dest="${ooxml.jar3.dir}"/>
        <get src="${ooxml.jar4.url}" dest="${ooxml.jar4.dir}"/>
        <get src="${ooxml.jar5.url}" dest="${ooxml.jar5.dir}"/>
    </target>

	<target name="check-ooxml-xsds">
        <condition property="ooxml-xsds.present">
            <or>
                <and>
                    <available file="${ooxml.xsds.izip}"/>
                </and>
                <isset property="disconnected"/>
            </or>
        </condition>
	</target>
    <target name="fetch-ooxml-xsds" unless="ooxml-xsds.present"
     description="Fetches needed OOXML xsd files from the Internet">
        <get src="${ooxml.xsds.url}" dest="${ooxml.xsds.ozip}"/>
		<unzip src="${ooxml.xsds.ozip}" dest="${ooxml.lib}">
			<patternset>
				<include name="OfficeOpenXML-XMLSchema.zip" />
			</patternset>
		</unzip>
	</target>
	<target name="check-compiled-ooxml-xsds">
        <condition property="ooxml-compiled-xsds.present">
            <or>
                <and>
                    <available file="${ooxml.xsds.jar}"/>
                </and>
                <isset property="disconnected"/>
            </or>
        </condition>
	</target>
	<target name="compile-ooxml-xsds" unless="ooxml-compiled-xsds.present"
	 depends="check-jars,fetch-jars,check-ooxml-xsds,fetch-ooxml-xsds,check-compiled-ooxml-xsds"
	 description="Unpacks the OOXML xsd files, and compiles them into XmlBeans">
		<taskdef name="xmlbean"
			classname="org.apache.xmlbeans.impl.tool.XMLBean"
			classpath="${ooxml.jar3.dir}:${ooxml.jar4.dir}" />

		<unzip src="${ooxml.xsds.izip}" dest="build/ooxml-xsds/" />
		<!--
			schema="build/ooxml-xsds/"
			schema="build/ooxml-xsds/sml-workbook.xsd"
		-->
		<xmlbean
			schema="build/ooxml-xsds/"
			destfile="${ooxml.xsds.jar}"
			javasource="1.4"
			failonerror="false"
			fork="true"
			memoryMaximumSize="512m"
		>
			<classpath refid="ooxml.classpath"/>
		</xmlbean>
	</target>

  <target name="compile" depends="init, compile-main, compile-scratchpad,
    compile-contrib, compile-examples"
    description="Compiles the POI main classes, scratchpad, contrib, and examples"/>

  <target name="compile-main" depends="fail-unless-xslt-is-available">
    <copy todir="${main.output.dir}">
      <fileset dir="${main.resource1.dir}"/>
    </copy>
    <javac target="${jdk.version.class}" source="${jdk.version.source}"
      failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
      srcdir="${main.src}">
      <classpath refid="main.classpath"/>
    </javac>
    <javac target="${jdk.version.class}" source="${jdk.version.source}"
      failonerror="true" destdir="${main.output.test.dir}" debug="on"
      fork="yes" srcdir="${main.src.test}">
      <classpath>
        <path refid="main.classpath"/>
        <pathelement location="${main.output.dir}"/>
        <pathelement location="${junit.jar1.dir}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-scratchpad" depends="init,compile-main">
    <javac target="${jdk.version.class}" source="${jdk.version.source}"
      failonerror="true" destdir="${scratchpad.output.dir}" debug="on"
      fork="yes" srcdir="${scratchpad.src}">
      <classpath refid="scratchpad.classpath"/>
    </javac>
    <javac target="${jdk.version.class}" source="${jdk.version.source}"
      failonerror="true" destdir="${scratchpad.output.test.dir}" debug="on"
      fork="yes" srcdir="${scratchpad.src.test}">
      <classpath>
        <path refid="scratchpad.classpath"/>
        <pathelement location="${scratchpad.output.dir}"/>
        <pathelement location="${junit.jar1.dir}"/>
      </classpath>
    </javac>

	<!-- Copy HSLF Resources over -->
	<property name="hslf.data" value="org/apache/poi/hslf/data" />
	<mkdir dir="${scratchpad.output.dir}/${hslf.data}" />
	<copy todir="${scratchpad.output.dir}/${hslf.data}">
		<fileset dir="${scratchpad.src}/${hslf.data}">
			<include name="*.ppt" />
		</fileset>
	</copy>

	<!-- Copy HDGF Resources over -->
	<property name="hdgf.chunks" value="org/apache/poi/hdgf/chunks" />
	<copy todir="${scratchpad.output.dir}/${hdgf.chunks}">
		<fileset dir="${scratchpad.src}/${hdgf.chunks}">
			<include name="*.tbl" />
		</fileset>
	</copy>
  </target>

  <target name="compile-contrib" depends="init">
    <javac target="${jdk.version.class}" source="${jdk.version.source}"
      failonerror="true" destdir="${contrib.output.dir}" debug="on" fork="yes"
      srcdir="${contrib.src}">
      <classpath refid="contrib.classpath"/>
    </javac>
    <javac target="${jdk.version.class}" source="${jdk.version.source}"
      failonerror="true" destdir="${contrib.output.test.dir}" debug="on"
      fork="yes" srcdir="${contrib.src.test}">
      <classpath>
        <path refid="contrib.classpath"/>
        <pathelement location="${contrib.output.dir}"/>
        <pathelement location="${junit.jar1.dir}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-examples" depends="init">
    <javac target="${jdk.version.class}" source="${jdk.version.source}"
      destdir="${examples.output.dir}" debug="on" srcdir="${examples.src}">
      <classpath refid="examples.classpath"/>
    </javac>
  </target>

  <target name="compile-ooxml" depends="init, check-ooxml-xsds, fetch-ooxml-xsds, compile-ooxml-xsds, compile-main">
	<!-- openxml4j requires java 1.5, so so must we, for now -->
    <javac target="1.5" source="1.5"
      destdir="${ooxml.output.dir}" debug="on" srcdir="${ooxml.src}">
      <classpath refid="ooxml.classpath"/>
    </javac>

    <javac target="1.5" source="1.5"
      failonerror="true" destdir="${ooxml.output.test.dir}" debug="on"
      fork="yes" srcdir="${ooxml.src.test}">
      <classpath>
        <path refid="ooxml.classpath"/>
        <pathelement location="${ooxml.output.dir}"/>
        <pathelement location="${junit.jar1.dir}"/>
      </classpath>
    </javac>
  </target>

  <target name="test" depends="test-main,test-scratchpad,test-contrib"
    description="Tests main, contrib and scratchpad"/>

    <target name="-test-main-check">
        <uptodate property="main.test.notRequired" targetfile="${main.testokfile}">
            <srcfiles dir="${main.src}"/>
            <srcfiles dir="${main.src.test}"/>
        </uptodate>
    </target>

    <path id="test.classpath">
        <path refid="main.classpath"/>
        <pathelement location="${main.output.dir}"/>
        <pathelement location="${main.output.test.dir}"/>
        <pathelement location="${junit.jar1.dir}"/>
    </path>

  <target name="test-main" unless="main.test.notRequired"
    depends="compile-main, -test-main-check, fail-unless-junit-is-available">
    <junit fork="no" printsummary="yes" haltonfailure="${halt.on.test.failure}"
      failureproperty="main.test.failed" showoutput="true">
      <classpath refid="test.classpath"/>
      <sysproperty key="HSSF.testdata.path"
        file="${main.src.test}/org/apache/poi/hssf/data"/> 
      <sysproperty key="HSLF.testdata.path"
        file="${main.src.test}/org/apache/poi/hslf/data"/> 
      <sysproperty key="HWPF.testdata.path"
        file="${main.src.test}/org/apache/poi/hwpf/data"/> 
      <sysproperty key="HPSF.testdata.path"
        file="${main.src.test}/org/apache/poi/hpsf/data"/> 
      <sysproperty key="POIFS.testdata.path"
        file="${main.src.test}/org/apache/poi/poifs/data"/> 
      <sysproperty key="java.awt.headless" value="true"/>
      <formatter type="plain"/>
      <formatter type="xml"/>
      <batchtest todir="${main.reports.test}">
        <fileset dir="${main.src.test}">
          <include name="**/Test*.java"/>
          <exclude name="**/All*Tests.java"/>
          <exclude name="**/TestUnfixedBugs.java"/>
          <exclude name="**/TestcaseRecordInputStream.java"/>
        </fileset>
      </batchtest>
    </junit>
    <delete file="${main.testokfile}"/>
    <antcall target="-test-main-write-testfile"/>
  </target>

  <target name="test-fail" depends="compile-main,
    fail-unless-junit-is-available"
    description="run tests that are known to fail">
    <junit printsummary="yes" showoutput="true" filtertrace="no"
      haltonfailure="false">
      <classpath refid="test.classpath"/>
      <classpath>
        <path refid="scratchpad.classpath"/>
        <pathelement location="${main.output.dir}"/>
        <pathelement location="${scratchpad.output.dir}"/>
        <pathelement location="${scratchpad.output.test.dir}"/>
        <pathelement location="${junit.jar1.dir}"/>
      </classpath>
      <sysproperty key="HSSF.testdata.path"
        file="${main.src.test}/org/apache/poi/hssf/data"/>
      <sysproperty key="HPSF.testdata.path"
        file="${main.src.test}/org/apache/poi/hpsf/data"/>
      <sysproperty key="HWPF.testdata.path"
        file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
      <sysproperty key="POIFS.testdata.path"
        file="${main.src.test}/org/apache/poi/poifs/data"/> 
      <sysproperty key="java.awt.headless" value="true"/>
      <formatter type="plain" usefile="no"/>
      <batchtest todir="${main.reports.test}">
        <fileset dir="${main.src.test}">
          <include name="**/TestEmptyDocument.java"/>
          <include name="**/TestUnfixedBugs.java"/>
        </fileset>
      </batchtest>
    </junit>
  </target>        



    <target name="single-test" depends="-test-property-check,compile-main" description="Runs a single test case specified with -Dtestcase=classname">
        <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
            <classpath refid="test.classpath"/>
                 <classpath>
                                <path refid="test.classpath"/>
                                <pathelement location="${main.output.dir}"/>
                                <pathelement location="${scratchpad.output.dir}"/>
                                <pathelement location="${scratchpad.output.test.dir}"/>
                                <pathelement location="${junit.jar1.dir}"/>
                            </classpath>
            <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
            <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
            <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
            <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
            <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
            <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
            <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/> 
                <sysproperty key="java.awt.headless" value="true"/>
            <formatter type="plain" usefile="no"/>
            <formatter type="xml"/>
            <test name="${testcase}"/>
        </junit>
    </target>

    <target name="debug-test" depends="-test-property-check,compile-main" description="Runs a single test case specified with -Dtestcase=classname with remote debug options turned on." >
	    <echo>Waiting for debugger on port 5001</echo>    
        <junit printsummary="no" showoutput="true" filtertrace="no" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed">
            <jvmarg value="-Xdebug"/>
            <jvmarg value="-Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=y"/>
            <sysproperty key="java.compiler" value="NONE"/>
            <classpath refid="test.classpath"/>
            <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
            <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
            <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/> 
            <sysproperty key="java.awt.headless" value="true"/>
            <formatter type="plain" usefile="no"/>
            <test name="${testcase}"/>
        </junit>
    </target>

    <target name="-test-property-check" unless="testcase">
        <echo message="Please use -Dtestcase=org.your.testcase to run a single test"/>
        <fail/>
    </target>

    <target name="-test-main-write-testfile" unless="main.test.failed">
        <echo file="${main.testokfile}" append="false" message="testok"/>
    </target>

    <target name="-test-scratchpad-check">
        <uptodate property="scratchpad.test.notRequired" targetfile="${scratchpad.testokfile}">
            <srcfiles dir="${scratchpad.src}"/>
            <srcfiles dir="${scratchpad.src.test}"/>
        </uptodate>
    </target>

    <target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check" unless="scratchpad.test.notRequired">
        <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="scratchpad.test.failed">
            <classpath>
                <path refid="scratchpad.classpath"/>
                <pathelement location="${main.output.dir}"/>
                <pathelement location="${scratchpad.output.dir}"/>
                <pathelement location="${scratchpad.output.test.dir}"/>
                <pathelement location="${junit.jar1.dir}"/>
            </classpath>
            <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
            <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
            <sysproperty key="HDF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdf/data"/>
            <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
            <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
            <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
            <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
            <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/> 
            <sysproperty key="java.awt.headless" value="true"/>
            <formatter type="plain"/>
            <formatter type="xml"/>
            <batchtest todir="${scratchpad.reports.test}">
                <fileset dir="${scratchpad.src.test}">
                    <include name="**/Test*.java"/>
                    <exclude name="**/AllTests.java"/>
                </fileset>
            </batchtest>
        </junit>
        <delete file="${scratchpad.testokfile}"/>
        <antcall target="-test-scratchpad-write-testfile"/>
    </target>

    <target name="-test-scratchpad-write-testfile" unless="scratchpad.test.failed">
        <echo file="${scratchpad.testokfile}" append="false" message="testok"/>
    </target>

	<target name="single-scratchpad-test" depends="compile-scratchpad,-test-property-check" description="Runs a single test case specified with -Dtestcase=classname">
	        <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
	            <classpath refid="test.classpath"/>
	                 <classpath>
	                                <path refid="scratchpad.classpath"/>
	                                <pathelement location="${main.output.dir}"/>
	                                <pathelement location="${scratchpad.output.dir}"/>
	                                <pathelement location="${scratchpad.output.test.dir}"/>
	                                <pathelement location="${junit.jar1.dir}"/>
	                            </classpath>
                <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
	            <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
	            <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
                <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
                <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
                <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
                <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/> 
	            <sysproperty key="java.awt.headless" value="true"/>
	                <sysproperty key="java.awt.headless" value="true"/>
	            <formatter type="plain" usefile="no"/>
	            <formatter type="xml"/>
	            <test name="${testcase}"/>
	        </junit>
	    </target>
	
    <target name="-test-contrib-check">
        <uptodate property="contrib.test.notRequired" targetfile="${contrib.testokfile}">
            <srcfiles dir="${contrib.src}"/>
            <srcfiles dir="${contrib.src.test}"/>
        </uptodate>
    </target>

    <target name="test-contrib" depends="compile-main,compile-contrib,-test-contrib-check" unless="contrib.test.notRequired">
        <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="contrib.test.failed">
            <classpath>
                <path refid="contrib.classpath"/>
                <pathelement location="${main.output.dir}"/>
                <pathelement location="${contrib.output.dir}"/>
                <pathelement location="${contrib.output.test.dir}"/>
                <pathelement location="${junit.jar1.dir}"/>
            </classpath>
            <sysproperty key="HSSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hssf/data"/>
            <sysproperty key="HPSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hpsf/data"/>
            <sysproperty key="java.awt.headless" value="true"/>
            <formatter type="plain"/>
            <formatter type="xml"/>
            <batchtest todir="${contrib.reports.test}">
                <fileset dir="${contrib.src.test}">
                    <include name="**/Test*.java"/>
                    <exclude name="**/AllTests.java"/>
                </fileset>
            </batchtest>
        </junit>
        <delete file="${contrib.testokfile}"/>
        <antcall target="-test-contrib-write-testfile"/>
    </target>

    <target name="-test-contrib-write-testfile" unless="contrib.test.failed">
        <echo file="${contrib.testokfile}" append="false" message="testok"/>
    </target>

    <target name="-test-ooxml-check">
        <uptodate property="ooxml.test.notRequired" targetfile="${ooxml.testokfile}">
            <srcfiles dir="${ooxml.src}"/>
            <srcfiles dir="${ooxml.src.test}"/>
        </uptodate>
    </target>

    <target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check" unless="ooxml.test.notRequired">
        <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="ooxml.test.failed">
            <classpath>
                <path refid="ooxml.classpath"/>
                <pathelement location="${main.output.dir}"/>
                <pathelement location="${ooxml.output.dir}"/>
                <pathelement location="${ooxml.output.test.dir}"/>
                <pathelement location="${junit.jar1.dir}"/>
            </classpath>
            <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
            <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
            <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
            <sysproperty key="java.awt.headless" value="true"/>
            <formatter type="plain"/>
            <formatter type="xml"/>
            <batchtest todir="${ooxml.reports.test}">
                <fileset dir="${ooxml.src.test}">
                    <include name="**/Test*.java"/>
                    <exclude name="**/AllTests.java"/>
                </fileset>
            </batchtest>
        </junit>
        <delete file="${ooxml.testokfile}"/>
        <antcall target="-test-ooxml-write-testfile"/>
    </target>

    <target name="-test-ooxml-write-testfile" unless="ooxml.test.failed">
        <echo file="${ooxml.testokfile}" append="false" message="testok"/>
    </target>

    <target name="-check-docs">
        <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html">
            <srcfiles dir="${build.site.src}"/>
        </uptodate>
    </target>

    <target name="-check-forrest-installed" unless="env.FORREST_HOME">
        <echo>Please install Apache Forrest (see
&lt;http://xml.apache.org/forrest/index.html&gt;) and set the
FORREST_HOME environment variable!</echo>
        <fail message="Apache Forrest is not installed."/>
    </target>

    <!--    <target name="check-docs">-->
    <!--        <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html" >-->
    <!--            <srcfiles dir= "${build.site.src}"/>-->
    <!--        </uptodate>-->
    <!--    </target>-->

    <target name="docs" depends="init, -check-forrest-installed, -check-docs"
      unless="main.docs.notRequired" description="Builds the POI website">

        <mkdir dir="${build.site.src}/src/documentation/content/apidocs"/>
        <copy todir="${build.site.src}/src/documentation/content/apidocs">
            <fileset dir="${apidocs.report.dir}"/>
        </copy>
        <copy
          tofile="${build.site.src}/src/documentation/content/jdepend.ehtml"
          file="${jdepend.report.dir}/index.html" failonerror="false"/>
        <mkdir dir="${build.site.src}/src/documentation/content/junit"/>
        <copy todir="${build.site.src}/src/documentation/content/junit">
            <fileset dir="${junit.report.dir}"/>
        </copy>

        <move
          file="${build.site.src}/src/documentation/content/xdocs/status.xml"
          tofile="${build.site.src}/status.xml"/>

        <ant antfile="${forrest.home}/forrest.antproxy.xml" target="site">
            <property name="project.home" location="${build.site.src}"/>
        </ant>

        <echo>Broken links:</echo>
        <echo file="${build.site}/../tmp/brokenlinks.txt"/>

        <touch>
            <fileset dir="${build.site}"/>
        </touch>
    </target>

    <!-- Checks whether reports are required to be run.  If nothing has changed then they dont. -->
    <target name="-check-reports">
        <condition property="reports.notRequired">
            <and>
                <equals arg1="${main.test.notRequired}" arg2="true"/>
                <equals arg1="${scratchpad.test.notRequired}" arg2="true"/>
                <equals arg1="${contrib.test.notRequired}" arg2="true"/>
            </and>
        </condition>
    </target>



  <!-- Generates a log of the latest changes in the CVS repository. -->
  <target name="cvschangelog" unless="disconnected"
    depends="fail-unless-xslt-is-available"
    description="Generates a CVS change log report">
    <antcall target="cvs-rsh-warning"/>
    <cvschangelog destfile="${changelog.file}" daysinpast="30"/>

    <style in="${changelog.file}"
      out="${build.site.src}/src/documentation/content/changelog.html"
      style="changelog.xsl">
      <param name="title"  expression="POI Change Log"/>
      <param name="module" expression="jakarta-poi"/>
      <param name="cvsweb" expression="http://cvs.apache.org/viewcvs/"/>
    </style>
  </target>

  <target name="cvs-rsh-warning" unless="env.CVS_RSH">
    <echo>
      WARNING: The environment variable CVS_RSH is not set. If you cannot
      access the CVS repository this could be one of the reasons for the
      failure.
    </echo>
  </target>



  <!-- Creates reports and API documentation -->
  <target name="reports" unless="reports.notRequired" depends="-check-reports,
    fail-unless-xslt-is-available, fail-unless-junit-is-available,
    fail-unless-jdepend-is-available, test-ignore-failures, junitreport,
    jdepend, cvschangelog, javadocs, clover.html"
    description="Creates various reports and the API documentation">
  </target>



  <!-- Runs all JUnit tests without aborting if one of the tests fails. -->
  <target name="test-ignore-failures" depends="init">
    <antcall target="test">
      <param name="halt.on.test.failure" value="false"/>
    </antcall>
  </target>



  <!-- Produces a report of the JUnit test results -->
  <target name="junitreport"
    depends="fail-unless-xslt-is-available, test-ignore-failures"
    description="Produces a report of the JUnit test results">
    <junitreport todir="${junit.report.dir}">
      <fileset dir="${main.reports.test}">
        <include name="TEST-*.xml"/>
      </fileset>
      <fileset dir="${scratchpad.reports.test}">
        <include name="TEST-*.xml"/>
      </fileset>
      <fileset dir="${contrib.reports.test}">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" todir="${junit.report.dir}"/>
    </junitreport>
  </target>



  <!-- Generates the API documentation. -->
  <target name="javadocs" depends="init, warn-unless-junit-is-available,
    warn-unless-xslt-is-available"
    description="Generates the API documentation">
    <javadoc verbose="false" author="true" destdir="${apidocs.report.dir}"
      windowtitle="POI API Documentation" use="true" version="true">

      <packageset dir="${main.src}" defaultexcludes="yes">
        <include name="org/apache/poi/**"/>
      </packageset>
      <packageset dir="${scratchpad.src}" defaultexcludes="yes">
        <include name="org/apache/poi/**"/>
        <exclude name="org/apache/poi/hdf/**"/>
      </packageset>
      <packageset dir="${contrib.src}" defaultexcludes="yes">
        <include name="org/apache/poi/**"/>
      </packageset>
      <packageset dir="${examples.src}" defaultexcludes="yes">
        <include name="org/apache/poi/**"/>
      </packageset>

      <classpath id="javadoc.classpath">
        <path refid="main.classpath"/>
        <path refid="scratchpad.classpath"/>
        <path refid="contrib.classpath"/>
        <path refid="examples.classpath"/>
        <path path="${env.CLASSPATH}"/>
      </classpath>

      <doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle>
      <bottom>
        <![CDATA[<i>Copyright ${tstamp.year} The Apache Software Foundation or
        its licensors, as applicable.</i>]]>
      </bottom>
      <group>
        <title>DDF - Dreadful Drawing Format</title>
        <package name="org.apache.poi.ddf*"/>
      </group>
      <group>
        <title>HPSF - Horrible Property Set Format</title>
        <package name="org.apache.poi.hpsf*"/>
      </group>
      <group>
        <title>HSSF - Horrible Spreadsheet Format</title>
        <package name="org.apache.poi.hssf*"/>
      </group>
      <group>
        <title>HWPF - Horrible Word Processor Format</title>
        <package name="org.apache.poi.hwpf*"/>
      </group>
      <group>
        <title>POIFS - POI File System</title>
        <package name="org.apache.poi.poifs*"/>
      </group>
      <group>
        <title>Utilities</title>
        <package name="org.apache.poi.util*"/>
      </group>
      <group>
        <title>Examples</title>
        <package name="org.apache.poi.hpsf.examples*"/>
        <package name="org.apache.poi.hssf.usermodel.examples*"/>
      </group>
    </javadoc>

    <antcall target="clover.html"/>
  </target>



  <!-- ================================== -->
  <!--       Generate records                -->
  <!-- ================================== -->

  <target name="generate-records" depends="init"
    description="Generates HSSF records"> 
    <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
      <arg file="src/records/definitions"/>
      <arg file="src/records/styles"/>
      <arg file="src/java"/>
      <arg file="src/testcases"/>
      <classpath>
        <path refid="scratchpad.classpath"/>
        <pathelement location="${main.output.dir}"/>
        <pathelement location="${scratchpad.output.dir}"/>
      </classpath>
    </java>  
  </target>

  <!-- ================================== -->
  <!--       Generate types               -->
  <!-- ================================== -->

  <target name="generate-types" depends="init"
    description="Generates word types">
    <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
      <arg file="src/types/definitions"/>
      <arg file="src/types/styles"/>
      <arg file="src/scratchpad/src"/>
      <arg file="src/scratchpad/testcases"/>
      <classpath>
        <path refid="scratchpad.classpath">
        </path>
        <pathelement location="${main.output.dir}"/>
        <pathelement location="${scratchpad.output.dir}"/>
      </classpath>
    </java>
  </target>



    <!-- Generates documentation and reports -->
    <target name="site" depends="reports, docs"
      description="Generates POI's website's contents"/>


    <target name="maven-dist" depends="jar" description="Builds the POM files for a maven distribution, and copies these and the jars to the appropriate locations">
		<!-- Copy the jar files into the maven jar directory -->
		<!-- Same jars as for the main release, only lacking the datestamp -->
		<copy
			file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"
			tofile="${mavendist.oap.dir}/jars/${jar.name}-${version.id}.jar" />
		<copy
			file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"
			tofile="${mavendist.oap.dir}/jars/${jar.name}-contrib-${version.id}.jar" />
		<copy
			file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"
			tofile="${mavendist.oap.dir}/jars/${jar.name}-scratchpad-${version.id}.jar" />

		<!-- TODO: Decide about source jars, and copy them if we have some -->

		<!-- Build the org.apache.poi poms -->
		<!-- Copy from the base file, substituting in the version and -->
		<!--  artificat, plus doing the core poi dependency as needed -->

		<!-- Build the main pom -->
		<copy 
			file="poi.pom" 
			tofile="${mavendist.oap.dir}/poms/${jar.name}-${version.id}.pom" 
		>
			<filterchain>
				<replacetokens>
					<token key="VERSION" value="${version.id}" />
					<token key="ARTIFICAT" value="poi" />
				</replacetokens>
				<tokenfilter>
					<filetokenizer/>
					<replaceregex pattern="START_NON_MAIN.*END_NON_MAIN_DEPENDENCY" replace="No POI dependency on the main jar" flags="s" />
				</tokenfilter>
			</filterchain>
		</copy>
		<!-- And the contrib pom -->
		<copy 
			file="poi.pom" 
			tofile="${mavendist.oap.dir}/poms/${jar.name}-contrib-${version.id}.pom" 
		>
			<filterchain>
				<replacetokens>
					<token key="VERSION" value="${version.id}" />
					<token key="ARTIFICAT" value="poi-contrib" />
				</replacetokens>
				<tokenfilter>
					<replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
					<replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
				</tokenfilter>
			</filterchain>
		</copy>
		<!-- And the scratchpad pom -->
		<copy 
			file="poi.pom" 
			tofile="${mavendist.oap.dir}/poms/${jar.name}-scratchpad-${version.id}.pom" 
		>
			<filterchain>
				<replacetokens>
					<token key="VERSION" value="${version.id}" />
					<token key="ARTIFICAT" value="poi-scratchpad" />
				</replacetokens>
				<tokenfilter>
					<replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
					<replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
				</tokenfilter>
			</filterchain>
		</copy>

		<!-- Build the poi => org.apache.poi redirect poms -->
		<!-- Copy from the base file, substituting in the version+artifact -->
		<copy 
			file="poi-redirect.pom" 
			tofile="${mavendist.poi.dir}/poms/${jar.name}-${version.id}.pom" 
		>
			<filterchain><replacetokens>
				<token key="VERSION" value="${version.id}" />
				<token key="ARTIFICAT" value="poi" />
			</replacetokens></filterchain>
		</copy>
		<copy 
			file="poi-redirect.pom" 
			tofile="${mavendist.poi.dir}/poms/${jar.name}-contrib-${version.id}.pom" 
		>
			<filterchain><replacetokens>
				<token key="VERSION" value="${version.id}" />
				<token key="ARTIFICAT" value="poi-contrib" />
			</replacetokens></filterchain>
		</copy>
		<copy 
			file="poi-redirect.pom" 
			tofile="${mavendist.poi.dir}/poms/${jar.name}-scratchpad-${version.id}.pom" 
		>
			<filterchain><replacetokens>
				<token key="VERSION" value="${version.id}" />
				<token key="ARTIFICAT" value="poi-scratchpad" />
			</replacetokens></filterchain>
		</copy>

		<!-- And that's it for maven -->
	</target>

    <target name="jar" depends="compile" description="Creates jar files for distribution">
        <jar destfile="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar">
			<fileset dir="${main.output.dir}" />
			<fileset dir="legal/" />
            <manifest>
                <attribute name="Built-By" value="${user.name}"/>
                <attribute name="Specification-Title" value="Apache POI"/>
                <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
                <attribute name="Specification-Vendor" value="Apache"/>
                <attribute name="Implementation-Title" value="Apache POI"/>
                <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
                <attribute name="Implementation-Vendor" value="Apache"/>
            </manifest>        
        </jar>
        <jar destfile="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar">
			<fileset dir="${contrib.output.dir}" />
			<fileset dir="legal/" />
            <manifest>
                <attribute name="Built-By" value="${user.name}"/>
                <attribute name="Specification-Title" value="Apache POI"/>
                <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
                <attribute name="Specification-Vendor" value="Apache"/>
                <attribute name="Implementation-Title" value="Apache POI"/>
                <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
                <attribute name="Implementation-Vendor" value="Apache"/>
            </manifest>        
        </jar>
        <jar destfile="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar">
			<fileset dir="${scratchpad.output.dir}" />
			<fileset dir="legal/" />
            <manifest>
                <attribute name="Built-By" value="${user.name}"/>
                <attribute name="Specification-Title" value="Apache POI"/>
                <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
                <attribute name="Specification-Vendor" value="Apache"/>
                <attribute name="Implementation-Title" value="Apache POI"/>
                <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
                <attribute name="Implementation-Vendor" value="Apache"/>
            </manifest>        
        </jar>
    </target>
    <target name="jar-ooxml" depends="compile-ooxml" description="Creates the ooxml jar files for distribution">
        <jar destfile="${dist.dir}/${jar.name}-ooxml-${version.id}-${DSTAMP}.jar">
			<fileset dir="${ooxml.output.dir}" />
			<fileset dir="legal/" />
            <manifest>
                <attribute name="Built-By" value="${user.name}"/>
                <attribute name="Specification-Title" value="Apache POI"/>
                <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
                <attribute name="Specification-Vendor" value="Apache"/>
                <attribute name="Implementation-Title" value="Apache POI"/>
                <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
                <attribute name="Implementation-Vendor" value="Apache"/>
            </manifest>        
        </jar>
    </target>

  <target name="dist" depends="clean, fail-unless-tools-are-available, compile, site, jar"
    description="Creates the entire distribution into build/dist, from scratch">

	<property name="zipdir" value="${jar.name}-${version.id}" />

    <zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
      <zipfileset dir="legal/" prefix="${zipdir}" />
      <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
      <zipfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
      <zipfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
      <zipfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
    </zip>

    <zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
      <zipfileset dir="legal/" prefix="${zipdir}" />
      <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
      <zipfileset dir="." prefix="${zipdir}">
        <exclude name="build/**"/>
        <exclude name="scripts/**"/>
        <exclude name="*.ipr"/>
        <exclude name="*.iml"/>
        <exclude name="*.iws"/>
        <exclude name="*.swp"/>
      </zipfileset>
    </zip>

    <tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz"
      compression="gzip">
      <tarfileset dir="legal/" prefix="${zipdir}" />
      <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
      <tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
      <tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
      <tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
    </tar>

    <tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz"
      compression="gzip">
      <tarfileset dir="legal/" prefix="${zipdir}" />
      <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
      <tarfileset dir="." prefix="${zipdir}">
        <exclude name="build/**"/>
        <exclude name="scripts/**"/>
        <exclude name="*.ipr"/>
        <exclude name="*.iml"/>
        <exclude name="*.iws"/>
        <exclude name="*.swp"/>
      </tarfileset>
    </tar>

    <echo>Distribution located in build/dist</echo>
  </target>

  <target name="clean-compile" depends="clean, compile"/>

  <target name="clean-dist" depends="clean, dist"
    description="Cleans the build directory then creates a distribution"/>

  <target name="gump" depends="test, jar"/>



  <!-- Generates the Ant document type definition (DTD) -->
  <target name="dtd"
    description="Generates the Ant document type definition (DTD)">
    <antstructure output="ant.dtd"/>
  </target>




  <!-- Abort the build if JUnit is missing. -->
  <target name="fail-unless-junit-is-available" depends="init">
    <condition property="isAvailable.junit">
      <available classname="junit.framework.TestCase"/>
    </condition>
    <antcall target="fail-junit"/>
  </target>

  <target name="fail-junit" unless="isAvailable.junit">
    <echo>
      JUnit is not available. You must download JUnit from
      &lt;http://www.junit.org/&gt; and include the JAR file in your
      classpath.
    </echo> 
    <fail message="JUnit is not available."/>
  </target>

  <!-- Warn if JUnit is missing. -->
  <target name="warn-unless-junit-is-available" depends="init">
    <condition property="isAvailable.junit">
      <available classname="junit.framework.TestCase"/>
    </condition>
    <antcall target="warn-junit"/>
  </target>

  <target name="warn-junit" unless="isAvailable.junit">
    <echo>
      WARNING: Since JUnit is not available you might encounter failures
      subsequently. In order to avoid this you should download JUnit from
      &lt;http://www.junit.org/&gt; and include the JAR file in your
      classpath.
    </echo> 
  </target>



  <!-- Abort the build if JDepend is missing. -->
  <target name="fail-unless-jdepend-is-available" depends="init">
    <condition property="isAvailable.jdepend">
      <available classname="jdepend.framework.JDepend"/>
    </condition>
    <antcall target="fail-jdepend"/>
  </target>

  <target name="fail-jdepend" unless="isAvailable.jdepend">
    <echo>
      JDepend is not available. You must download JDepend from
      &lt;http://www.clarkware.com/software/JDepend.html&gt; and include the
      JAR file in your classpath.
    </echo> 
    <fail message="JDepend is not available."/>
  </target>



  <!-- Abort the build if an XSLT processor is missing. -->
  <target name="fail-unless-xslt-is-available" depends="init">
    <condition property="isAvailable.xslt">
      <available classname="javax.xml.transform.TransformerFactory"/>
    </condition>
    <antcall target="fail-xslt"/>
  </target>

  <target name="fail-xslt" unless="isAvailable.xslt">
    <echo>
      An XSLT processor is missing. You must download e.g. Xalan from
      &lt;http://xml.apache.org/xalan-j/&gt; and include the JAR file in your
      classpath.
    </echo> 
    <fail message="An XSLT processor is not available."/>
  </target>

  <!-- Warn if an XSLT processor is missing. -->
  <target name="warn-unless-xslt-is-available" depends="init">
    <condition property="isAvailable.xslt">
      <available classname="javax.xml.transform.TransformerFactory"/>
    </condition>
    <antcall target="warn-xslt"/>
  </target>

  <target name="warn-xslt" unless="isAvailable.xslt">
    <echo>
      WARNING: Since an XSLT processor is not available you might encounter
      failures subsequently. In order to avoid this you should download
      e.g. Xalan from &lt;http://xml.apache.org/xalan-j/&gt; and include the
      JAR file in your classpath.
    </echo> 
  </target>



  <!-- Aborts the build if any of the required tools are missing. -->
  <target name="fail-unless-tools-are-available"
    depends="fail-unless-junit-is-available, fail-unless-junit-is-available,
    fail-unless-jdepend-is-available"/>



  <!-- Runs jdepend to produce a report about package dependencies -->
  <target name="jdepend" depends="fail-unless-jdepend-is-available"
    description="Runs jdepend to produce a report about package dependencies">
    <jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
      <classespath>
        <pathelement location="${main.output.dir}"/>
        <pathelement location="${contrib.output.dir}"/>
        <pathelement location="${scratchpad.output.dir}"/>
      </classespath>
      <classpath>
        <path refid="main.classpath"/>
        <path refid="contrib.classpath"/>
        <path refid="scratchpad.classpath"/>
      </classpath>
    </jdepend>

    <style basedir="${jdepend.report.dir}"
      in="${jdepend.report.dir}/jdepend.xml"
      out="${jdepend.report.out.dir}/index.html"
      style="jdepend.xsl"/>
  </target>

</project>

<!-- Keep this comment at the end of the file
Local variables:
mode: xml
sgml-omittag:nil
sgml-shorttag:nil
sgml-namecase-general:nil
sgml-general-insert-case:lower
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-parent-document:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->