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
|
<!-- ===========================================================================
* =========================== *
| POI Build System |
* =========================== *
by
Nicola Ken Barozzi <barozzi@nicolaken.com>
Marc Johnson <mjohnson at apache dot org>
extends
* =========================== *
| Apache Cocoon Build System |
* =========================== *
by
Stefano Mazzocchi <stefano@apache.org>
Carsten Ziegeler <cziegeler@apache.org>
Installing the build tools
==========================
The POI build system is based on Apache Ant, which is a Java building tool
originally developed for the Tomcat project but now used in many other
Apache projects and extended by many developers.
Ant is a little but very handy tool that uses a build file written in XML
(this file) as building instructions. For more information refer to
"http://jakarta.apache.org/ant/".
To make things easier for you, the POI distribution contains a precompiled
version of Ant and the build scripts take care of running it.
The only thing that you have to make sure, is the "JAVA_HOME" environment
property should be set to match the JVM you want to use.
That's all you have to do to be ready to go.
Building instructions
=====================
Ok, let's build the baby. First, make sure your current working directory is
where this very file is located. Then type
./build.sh (unix)
.\build.bat (win32)
if everything is right and all the required packages are visible, this action
will generate a jar file in the "./build/poi" directory.
Note, that if you do further development, compilation time is reduced since
Ant is able of detecting which files have changed and to recompile them at need.
Also, you'll note that reusing a single JVM instance for each task, increases
tremendously the performance of the whole build system, compared to other
tools (i.e. make or shell scripts) where a new JVM is started for each task.
Building on another directory
=============================
Sometimes you might want to build on an external directory to keep the
distribution clean: no worries, this is just an environment property away.
Suppose you want to use the "../build" directory instead, you simply tipe
[unix] ./build.sh -Dbuild.root=../build
[win32] .\build.bat -Dbuild.root=..\build
By using the -Dxxx=yyy argument, you are setting environments in the JVM: Ant
is designed to give higher priority to system environments to allow you to
modify _any_ <property> that you can find in the building instructions below,
so it's just a matter of understanding what property you want to change
and you don't have to touch this file (which you shouldn't need to do).
Build targets
=============
The build system is not only responsible of compiling the project into a jar
file, but is also responsible for creating the HTML documentation, javadocs,
distributions and web site. In fact, the file you have here is _exactly_ what
is used by project maintainers to take care of everything in the project,
no less and no more.
To know more about the available targets take a look at this file, which is
pretty self-explanatory or type
[unix] ./build.sh -projecthelp
[win32] .\build.bat -projecthelp
and concentrate on the target descriptions that start with a star '*': these
are the one you should call, the others are internal targets that are called
by the main ones.
Build Dependencies
==================
Some components are optional and require special jar files to be compiled
and added to the web application. Some if these jars are already included
in the distribution while others not.
For each optional package which is not available, a warning is
printed. If you don't like these warnings, specify the property "omit.opt.warnings"
(build -Domit.opt.warnings).
Distribution Version
====================
When preparing a distribution for release, specify the version ID on
the command line: -Dversion="dev-1.2.1", for example.
Specifying a subset of unit tests to be executed
================================================
Specify the package on the command line:
-Dtest.specific="org.apache.poi.util" will select only the util
tests to be run. If you've run any other unit tests in a prior
session, you'll need to specify the 'clean' target to remove
extraneous test classes from execution:
./build.sh clean test -Dtest.specific="org/apache/poi/util"
or
.\build.bat clean test -Dtest.specific="org/apache/poi/util"
Happy hacking from the POI Dev Team :)
============================================================================ -->
<project default="interactive" basedir="." name="POI">
<!--
Give user a chance to override without editing this file
(and without typing -D each time he compiles it)
-->
<property file=".ant.properties"/>
<property file="${user.home}/.ant.properties"/>
<!--
these are here only for those who use jikes compiler. For other
developers this part makes no difference.
-->
<property name="build.compiler.emacs" value="on"/>
<!-- property name="build.compiler.warnings" value="true"/ -->
<property name="build.compiler.pedantic" value="false"/>
<property name="build.compiler.depend" value="true"/>
<property name="build.compiler.fulldepend" value="true"/>
<!-- =================================================================== -->
<!-- Indentify Classpath -->
<!-- =================================================================== -->
<path id="classpath">
<fileset dir="./lib/core">
<include name="*.jar"/>
</fileset>
<fileset dir="./lib/optional">
<include name="*.jar"/>
</fileset>
</path>
<path id="scratchpad.classpath">
<fileset dir="./lib/core">
<include name="*.jar"/>
</fileset>
<fileset dir="./lib/optional">
<include name="*.jar"/>
</fileset>
<fileset dir="./src/scratchpad/lib">
<include name="*.jar"/>
</fileset>
<!-- FIXME : how to build a path that references a property set in 'init' target ? -->
<pathelement path="./build/cocoon/classes"/>
</path>
<!-- =================================================================== -->
<!-- Initialization target -->
<!-- =================================================================== -->
<target name="init">
<tstamp/>
<property name="fullname" value="POI"/>
<property name="Name" value="Poi"/>
<property name="name" value="poi"/>
<property name="version" value="1.1-dev"/>
<property name="short.version" value="1.1"/>
<property name="year" value="2001-2002"/>
<echo message="--------------------------------------------------------------"/>
<echo message=" ${fullname} [${year}] "/>
<echo message="--------------------------------------------------------------"/>
<echo message="Building with ${ant.version}"/>
<echo message="using build file ${ant.file}"/>
<echo message="--------------------------------------------------------------"/>
<property name="debug" value="on"/>
<property name="optimize" value="off"/>
<property name="deprecation" value="off"/>
<property name="nowarn" value="on"/>
<property name="build.compiler" value="classic"/>
<property name="target.vm" value="1.2"/>
<property name="src.dir" value="./src"/>
<property name="java.dir" value="${src.dir}/java"/>
<property name="test.dir" value="${src.dir}/testcases"/>
<property name="test.specific" value=""/>
<property name="lib.dir" value="./lib"/>
<property name="bin.dir" value="./bin"/>
<property name="tools.dir" value="./tools"/>
<property name="docs.dir" value="${src.dir}/documentation/xdocs"/>
<property name="images.dir" value="${src.dir}/documentation/images"/>
<property name="resource.dir" value="${src.dir}/resources"/>
<property name="packages" value="org.apache.poi.*"/>
<property name="context.dir" value="${src.dir}/documentation"/>
<property name="scratchpad.dir" value="${src.dir}/scratchpad"/>
<property name="scratchpad.src" value="${scratchpad.dir}/src"/>
<property name="scratchpad.lib" value="${scratchpad.dir}/lib"/>
<property name="scratchpad.name" value="poi-scratchpad"/>
<property name="build.root" value="./build"/>
<property name="build.dir" value="${build.root}/${name}"/>
<property name="build.src" value="${build.dir}/src"/>
<property name="build.test" value="${build.dir}/testcases"/>
<property name="build.dest" value="${build.dir}/classes"/>
<property name="build.docs" value="${build.dir}/docs"/>
<property name="build.xdocs" value="${build.dir}/xdocs"/>
<property name="build.docs.printer" value="${build.dir}/printer-docs"/>
<property name="build.javadocs" value="${build.dir}/javadocs"/>
<property name="build.context" value="${build.dir}/documentation"/>
<property name="build.scratchpad" value="${build.dir}/scratchpad"/>
<property name="build.scratchpad.src" value="${build.scratchpad}/src"/>
<property name="build.scratchpad.dest" value="${build.scratchpad}/classes"/>
<property name="build.patchqueue" value="${build.dir}/patchqueue"/>
<property name="dist.root" value="./dist"/>
<property name="dist.name" value="${name}-${version}"/>
<property name="dist.dir" value="${dist.root}/${dist.name}"/>
<property name="dist.src.dir" value="${dist.root}/source/${dist.name}"/>
<property name="dist.bin.dir" value="${dist.root}/bin/${dist.name}"/>
<property name="dist.target" value="${dist.root}"/>
<property name="site" value="../xml-site/targets/${name}"/>
<property name="build.announce" value="${build.dir}/Announcement.xml"/>
<property name="announce2txt" value="./documentation/stylesheets/announcement2txt.xsl"/>
<!--
The location of tools.jar, relative to the JAVA_HOME home.
-->
<property name="tools.jar" value="${java.home}/../lib/tools.jar"/>
<available file="${tools.jar}" property="tools.jar.present"/>
<filter token="Name" value="${fullname}"/>
<filter token="name" value="${fullname}"/>
<filter token="year" value="${year}"/>
<filter token="version" value="${version}"/>
<filter token="date" value="${TODAY}"/>
<filter token="log" value="true"/>
<filter token="verbose" value="true"/>
<filter token="install.war" value="${install.war}"/>
<!-- Add filters for loading database information from database.properties file -->
<property file="database.properties"/>
<filter token="database-driver" value="${database-driver}"/>
<filter token="database-url" value="${database-url}"/>
<filter token="database-user" value="${database-user}"/>
<filter token="database-password" value="${database-password}"/>
<!-- compile the ant tasks -->
<mkdir dir="${tools.dir}/anttasks"/>
<javac srcdir="${tools.dir}/src" destdir="${tools.dir}/anttasks"/>
</target>
<!-- =================================================================== -->
<!-- Interactive build -->
<!-- =================================================================== -->
<target name="interactive" description="Interactive Build" depends="init">
<echo message="--------------------------------------------------------------"/>
<echo message="| | _ \/ _ \_ _| |"/>
<echo message="| | _/ (_) | | |"/>
<echo message="| |_| \___/___| |"/>
<echo message="--------------------------------------------------------------"/>
<echo message=" ${fullname} [${year}] "/>
<echo message="--------------------------------------------------------------"/>
<echo message="Building with ${ant.version}"/>
<echo message="using build file ${ant.file}"/>
<echo message="--------------------------------------------------------------"/>
<echo message=" These are the most common build targets."/>
<echo message=" You can also invoke them directly; see build.xml for more info. "/>
<echo message=" Builds will be in /build directory, distributions in /dist."/>
<echo message=" "/>
<echo message=" compile ------ compiles the source code "/>
<echo message=" docs --------- generates the html docs"/>
<echo message=" cleandocs ---- cleans the build docs directory"/>
<echo message=" javadocs ----- generates the API documentation"/>
<echo message=" test --------- performs the jUnit tests"/>
<echo message=" clean -------- cleans the build directory"/>
<echo message=" dist --------- creates src and bin distributions"/>
<echo message=" "/>
<taskdef name="user-input" classname="UserInput"
classpath="./tools/anttasks"/>
<property name="input.selection" value="compile"/>
<user-input name="input.selection">Please select a target </user-input>
<antcall target="${input.selection}"/>
</target>
<!-- =================================================================== -->
<!-- Print out warnings for optional components -->
<!-- =================================================================== -->
<target name="optional-warnings"
description="Outputs warnings if some optional jars are missing from the environment">
</target>
<!-- =================================================================== -->
<!-- Prepares the build directory -->
<!-- =================================================================== -->
<target name="prepare" depends="init">
<mkdir dir="${build.dir}"/>
</target>
<!-- =================================================================== -->
<!-- Prepares the source code -->
<!-- =================================================================== -->
<target name="prepare-src" depends="prepare,generate-java-code">
<mkdir dir="${build.src}"/>
<mkdir dir="${build.dest}"/>
<copy todir="${build.src}" filtering="on">
<fileset dir="${java.dir}"/>
</copy>
<mkdir dir="${build.scratchpad.src}"/>
<mkdir dir="${build.scratchpad.dest}"/>
<copy todir="${build.scratchpad.src}" filtering="on">
<fileset dir="${scratchpad.src}"/>
</copy>
</target>
<!-- =================================================================== -->
<!-- Set a variable if the generated java code is already up-to-date. -->
<!-- =================================================================== -->
<target name="generate-java-code-check" depends="init"><!--
<uptodate property="generate-java-code.notrequired"
targetfile="${build.src}/org/apache/cocoon/components/browser/BrowserImpl.java" >
<srcfiles dir="${java.dir}/org/apache/cocoon/components/browser"
includes="BrowserImpl.xml,BrowserImpl.xsl"/>
</uptodate>-->
</target>
<!-- =================================================================== -->
<!-- Generate the Java code from XML using XSLT -->
<!-- =================================================================== -->
<target name="generate-java-code" depends="generate-java-code-check"
unless="generate-java-code.notrequired"><!--
<style basedir="${java.dir}/org/apache/cocoon/components/browser"
destdir="${build.src}/org/apache/cocoon/components/browser"
includes="BrowserImpl.xml"
extension=".java"
style="${java.dir}/org/apache/cocoon/components/browser/BrowserImpl.xsl"/>-->
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory -->
<!-- =================================================================== -->
<target name="compile" depends="prepare-src"
description="Compiles the source code">
<copy todir="${build.dest}">
<fileset dir="${build.src}">
<include name="**/Manifest.mf"/>
<include name="**/*.xsl"/>
<include name="**/*.roles"/>
<include name="**/*.xconf"/>
<include name="META-INF/**"/>
</fileset>
</copy>
<echo message="Compiling with Java ${ant.java.version}, debug ${debug}, optimize ${optimize}, deprecation ${deprecation}"/>
<javac srcdir="${build.src}"
destdir="${build.dest}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="${target.vm}"
nowarn="${nowarn}">
<classpath refid="classpath"/>
</javac>
<copy todir="${build.scratchpad.dest}">
<fileset dir="${build.scratchpad.src}">
<include name="**/Manifest.mf"/>
<include name="**/*.xsl"/>
<include name="**/*.roles"/>
<include name="**/*.xconf"/>
<include name="META-INF/**"/>
</fileset>
</copy>
<javac srcdir="${build.scratchpad.src}"
destdir="${build.scratchpad.dest}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="${target.vm}">
<classpath refid="scratchpad.classpath"/>
</javac>
</target>
<target name="generate-records" depends="prepare"
description="Generates the record source code">
<java classname="org.apache.poi.hssf.util.RecordGenerator" fork="yes">
<arg value="src/records/definitions"/>
<arg value="src/records/styles"/>
<arg value="src/java"/>
<arg value="src/testcases"/>
<classpath>
<path refid="classpath"/>
<pathelement location="${build.dest}"/>
</classpath>
</java>
</target>
<!-- =================================================================== -->
<!-- Creates the jar file -->
<!-- =================================================================== -->
<target name="all" depends="package" description="Default target"/>
<target name="package" depends="compile" description="Generates the jar package">
<jar jarfile="${build.dir}/${name}.jar" manifest="${build.src}/Manifest.mf">
<fileset dir="${build.dest}">
<include name="**"/>
<include name="META-INF/**"/>
</fileset>
</jar>
<jar jarfile="${build.dir}/${scratchpad.name}.jar">
<fileset dir="${build.scratchpad.dest}">
<include name="**"/>
</fileset>
</jar>
</target>
<!-- =================================================================== -->
<!-- Gets pending patches from bugzilla and cleans html -->
<!-- =================================================================== -->
<target name="prepare-patchqueue" depends="init" description="Patch queue 2 mail">
<mkdir dir="${build.patchqueue}"/>
<get src="http://nagoya.apache.org/bugzilla/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&bugidtype=include&bug_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&product=Cocoon+2&short_desc=%5BPATCH%5D&short_desc_type=anywordssubstr&long_desc=&long_desc_type=allwordssubstr&bug_file_loc=&bug_file_loc_type=allwordssubstr&keywords=&keywords_type=anywords&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&namedcmd=cocoon+patch+queue&newqueryname=&order=Reuse+same+sort+as+last+time"
dest="${build.patchqueue}/bugzillapatchqueue.html"
verbose="true"
usetimestamp="true"
ignoreerrors="true"/>
<taskdef name="jtidy" classname="JTidyTask"
classpath="${tools.dir}/anttasks"/>
<jtidy src="${build.patchqueue}/bugzillapatchqueue.html"
dest="${build.patchqueue}/bugzillapatchqueue.xhtml"
log="${build.patchqueue}/bugzillapatchqueue.log"
summary="true"
warn="true"/>
</target>
<!-- =================================================================== -->
<!-- Transforms bugzilla patches html into xml -->
<!-- =================================================================== -->
<target name="patchqueue-xml" depends="prepare-patchqueue">
<copy file="${tools.dir}/src/bugzilla2patchqueue.xsl" tofile="${build.patchqueue}/bugzilla2patchqueue.xsl"/>
<style basedir="${build.patchqueue}"
destdir="${build.patchqueue}"
includes="bugzillapatchqueue.xhtml"
extension=".xml"
style="bugzilla2patchqueue.xsl"/>
</target>
<!-- =================================================================== -->
<!-- Makes patches.xml for xdocs using bugzilla patches xml -->
<!-- =================================================================== -->
<target name="patchqueue-xdocs" depends="patchqueue-xml">
<copy file="${tools.dir}/src/patchqueue2xdocs.xsl" tofile="${build.patchqueue}/patchqueue2xdocs.xsl"/>
<style basedir="${build.patchqueue}"
destdir="${build.patchqueue}"
includes="bugzillapatchqueue.xml"
extension=".xdoc"
style="patchqueue2xdocs.xsl"/>
<copy file="${build.patchqueue}/bugzillapatchqueue.xdoc" tofile="${docs.dir}/patches.xml"/>
</target>
<!-- =================================================================== -->
<!-- Sends a notification of the current patch queue to the mailing list -->
<!-- =================================================================== -->
<target name="patchqueue" depends="patchqueue-xdocs">
<copy file="${tools.dir}/src/patchqueue2text4dev.xsl" tofile="${build.patchqueue}/patchqueue2text4dev.xsl"/>
<style basedir="${build.patchqueue}"
destdir="${build.patchqueue}"
includes="bugzillapatchqueue.xml"
extension=".txt"
style="patchqueue2text4dev.xsl"/>
</target>
<!-- =================================================================== -->
<!-- Sends a notification of the current patch queue to the mailing list -->
<!-- =================================================================== -->
<target name="patchqueue-notify" depends="patchqueue">
<mail from="patch-queue@nicolaken.com"
tolist="cocoon-dev@xml.apache.org"
mailhost="192.4.0.155"
subject="DO NOT REPLY [PATCH QUEUE] Summary ${TODAY}"
files="${build.patchqueue}/bugzillapatchqueue.txt"/>
</target>
<!-- =================================================================== -->
<!-- Prepares the docs -->
<!-- =================================================================== -->
<target name="prepare-docs" depends="init">
<mkdir dir="${build.context}"/>
<mkdir dir="${build.context}/images"/>
<mkdir dir="${build.docs}"/>
<mkdir dir="${build.dir}/work"/>
<!-- make filtered copy of XML docs -->
<copy todir="${build.context}" filtering="on">
<fileset dir="${context.dir}">
<exclude name="images/**"/>
</fileset>
</copy>
<!-- Add changes and todo -->
<!--
<copy file="changes.xml" tofile="${build.context}/xdocs/changes.xml" filtering="on"/>
<copy file="todo.xml" tofile="${build.context}/xdocs/todo.xml" filtering="on"/>
<replace file="${build.context}/xdocs/changes.xml" token="src/documentation/xdocs/dtd/" value="dtd/"/>
<replace file="${build.context}/xdocs/todo.xml" token="src/documentation/xdocs/dtd/" value="dtd/"/>
-->
<!-- Copy images -->
<copy todir="${build.context}/images" filtering="off">
<fileset dir="${context.dir}/images"/>
</copy>
<!-- Copy entity catalog and entities -->
<copy todir="${build.context}/resources/entities" filtering="on">
<fileset dir="${resource.dir}/entities"/>
</copy>
<mkdir dir="${build.context}/WEB-INF/classes"/>
<move todir="${build.context}/WEB-INF/classes">
<fileset dir="${build.context}/resources/entities">
<include name="CatalogManager.properties"/>
</fileset>
</move>
</target>
<!-- =================================================================== -->
<!-- Set a variable if the generated docs are already up-to-date. -->
<!-- =================================================================== -->
<target name="docs_check" depends="init">
<uptodate property="docs.notrequired" targetfile="${build.docs}/index.html" >
<srcfiles dir="." includes="changes.xml,todo.xml"/>
<srcfiles dir="${context.dir}/xdocs" includes="**/*.xml"/>
</uptodate>
</target>
<!-- =================================================================== -->
<!-- If generated docs is already up-to-date, print a message saying so. -->
<!-- =================================================================== -->
<target name="docs_done" if="docs.notrequired">
<echo message="-------------------------------------------------------------"/>
<echo message="Not rebuilding docs, as they are up-to-date:"/>
<echo message=" ${build.docs}/index.html is more recent than"/>
<echo message=" todo.xml, changes.xml, ${context.dir}/xdocs/*.xml"/>
<echo message="-------------------------------------------------------------"/>
</target>
<!-- =================================================================== -->
<!-- The documentation system (nearly beta...) -->
<!-- =================================================================== -->
<target name="docs"
depends="package, prepare-docs, docs_check, docs_done"
unless="docs.notrequired"
description="* Generates the documentation">
<java classname="org.apache.cocoon.Main" fork="true" dir="${build.context}" failonerror="true">
<arg value="-c."/>
<arg value="-d../docs"/>
<arg value="-w../work"/>
<arg value="-l../work/cocoon.log"/>
<arg value="-uINFO"/>
<arg value="index.html"/>
<classpath>
<path refid="classpath"/>
<fileset dir="${build.dir}">
<include name="*.jar"/>
</fileset>
<pathelement location="${tools.jar}"/>
<pathelement location="${build.context}/WEB-INF/classes"/>
</classpath>
</java>
</target>
<!-- =================================================================== -->
<!-- Copies the tools.jar to javac.jar in web-inf/lib -->
<!-- =================================================================== -->
<target name="prepare-tools-lib" depends="package" if="tools.jar.present">
<!-- NOTE: java.home is normally set by the JVM to the /jre directory -->
<copy file="${tools.jar}" tofile="${build.war}/WEB-INF/lib/javac.jar"/>
</target>
<!-- =================================================================== -->
<!-- Set a variable if the generated printer docs are already up-to-date. -->
<!-- =================================================================== -->
<target name="printer-docs_check" depends="init">
<uptodate property="printer-docs.notrequired" targetfile="${build.docs.printer}/index.html" >
<srcfiles dir="." includes="changes.xml,todo.xml"/>
<srcfiles dir="${docs.dir}" includes="**/*.xml"/>
</uptodate>
</target>
<!-- =================================================================== -->
<!-- If generated printer docs is already up-to-date, print a message saying so. -->
<!-- =================================================================== -->
<target name="printer-docs_done" if="printer-docs.notrequired">
<echo message="-------------------------------------------------------------"/>
<echo message="Not rebuilding printer docs, as they are up-to-date:"/>
<echo message=" ${build.docs.printer}/index.html is more recent than"/>
<echo message=" todo.xml, changes.xml, ${docs.dir}/*.xml"/>
<echo message="-------------------------------------------------------------"/>
</target>
<!-- =================================================================== -->
<!-- Create the announcements -->
<!-- =================================================================== -->
<target name="announcement" depends="prepare" description="* Creates the announcement for new releases">
<copy file="announcement.xml" tofile="${build.announce}" filtering="on"/>
<style basedir="${build.dir}" destdir="./" style="${announce2txt}"
includes="Announcement.xml" extension=".txt"/>
</target>
<!-- =================================================================== -->
<!-- Prepares the printer-docs -->
<!-- =================================================================== -->
<target name="prepare-printer-docs" depends="prepare-docs">
<mkdir dir="${build.dir}/printer_documentation"/>
<!-- copy prepared docs -->
<copy todir="${build.dir}/printer_documentation" filtering="off">
<fileset dir="${build.context}">
</fileset>
</copy>
<!-- copy printer skin -->
<copy todir="${build.dir}/printer_documentation/stylesheets" filtering="off" overwrite="yes">
<fileset dir="${build.context}/stylesheets/printer_skin">
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- Generate printer-friendly HTML docs -->
<!-- =================================================================== -->
<target name="printer-docs" depends="package, prepare-printer-docs, printer-docs_check, printer-docs_done"
unless="printer-docs.notrequired"
description="* Generates printer-friendly documentation">
<mkdir dir="${build.docs.printer}"/>
<java classname="org.apache.cocoon.Main" fork="true" dir="${build.dir}/printer_documentation" failonerror="true">
<arg value="-c."/>
<arg value="-d../printer-docs"/>
<arg value="-w../work-printer"/>
<arg value="-l../work-printer/cocoon.log"/>
<arg value="-uINFO"/>
<arg value="index.html"/>
<classpath>
<path refid="classpath"/>
<fileset dir="${build.dir}">
<include name="*.jar"/>
</fileset>
<pathelement location="${tools.jar}"/>
<pathelement location="${build.context}/WEB-INF/classes"/>
</classpath>
</java>
</target>
<!-- =================================================================== -->
<!-- Creates the web site -->
<!-- =================================================================== -->
<target name="site" depends="docs, javadocs"
description="Generates the web site (for site maintainers only)">
<mkdir dir="${site}"/>
<copy todir="${site}" filtering="off">
<fileset dir="${build.docs}">
</fileset>
</copy>
<copy todir="${site}/apidocs" filtering="off">
<fileset dir="${build.javadocs}"/>
</copy>
</target>
<!-- =================================================================== -->
<!-- Set a variable if javadoc is already up-to-date. -->
<!-- =================================================================== -->
<target name="javadocs_check">
<uptodate property="javadocs.notrequired" targetfile="${build.javadocs}/packages.html" >
<srcfiles dir= "${build.src}" includes="**/*.java"/>
</uptodate>
</target>
<!-- =================================================================== -->
<!-- If javadoc is already up-to-date, print a message saying so. -->
<!-- =================================================================== -->
<target name="javadocs_done" if="javadocs.notrequired">
<echo message="-------------------------------------------------------------"/>
<echo message="Not rebuilding Javadocs, as they are up-to-date:"/>
<echo message=" ${build.javadocs}/packages.html is more recent than"/>
<echo message=" ${build.src}/**/*.java"/>
<echo message="-------------------------------------------------------------"/>
</target>
<!-- =================================================================== -->
<!-- Creates the API documentation -->
<!-- =================================================================== -->
<target name="javadocs" depends="prepare-src, javadocs_check, javadocs_done"
unless="javadocs.notrequired"
description="* Generates the API documentation">
<mkdir dir="${build.javadocs}"/>
<javadoc packagenames="${packages}"
sourcepath="${build.src}"
destdir="${build.javadocs}"
author="true"
version="true"
use="false"
noindex="true"
windowtitle="${Name} API"
doctitle="${Name}"
bottom="Copyright © ${year} POI project. All Rights Reserved."
stylesheetfile="${resource.dir}/javadoc.css">
<classpath refid="classpath"/>
</javadoc>
</target>
<!-- =================================================================== -->
<!-- Creates the source distribution -->
<!-- =================================================================== -->
<target name="dist-src" depends="docs, javadocs"
description="Prepares the source distribution">
<!-- Simply copy all and add the html docs -->
<mkdir dir="${dist.root}"/>
<mkdir dir="${dist.src.dir}"/>
<mkdir dir="${dist.src.dir}/lib"/>
<mkdir dir="${dist.src.dir}/src"/>
<mkdir dir="${dist.src.dir}/src/java"/>
<mkdir dir="${dist.src.dir}/src/documentation"/>
<mkdir dir="${dist.src.dir}/src/resources"/>
<mkdir dir="${dist.src.dir}/src/scratchpad"/>
<mkdir dir="${dist.src.dir}/src/testcases"/>
<mkdir dir="${dist.src.dir}/docs"/>
<mkdir dir="${dist.src.dir}/docs/apidocs"/>
<mkdir dir="${dist.src.dir}/tools"/>
<!--
<copy todir="${dist.src.dir}/bin">
<fileset dir="${bin.dir}"/>
</copy> -->
<copy todir="${dist.src.dir}/tools">
<fileset dir="${tools.dir}"/>
</copy>
<copy todir="${dist.src.dir}/src/documentation">
<fileset dir="${build.context}"/>
</copy>
<copy todir="${dist.src.dir}/lib">
<fileset dir="${lib.dir}"/>
</copy>
<copy todir="${dist.src.dir}/src/resources" filtering="on">
<fileset dir="${resource.dir}">
<exclude name="**/*.gif"/>
<exclude name="**/*.jpg"/>
<exclude name="**/*.png"/>
</fileset>
</copy>
<copy todir="${dist.src.dir}/src/resources" filtering="off">
<fileset dir="${resource.dir}">
<include name="**/*.gif"/>
<include name="**/*.jpg"/>
<include name="**/*.png"/>
</fileset>
</copy>
<copy todir="${dist.src.dir}/src/java" filtering="on">
<fileset dir="${java.dir}"/>
</copy>
<copy todir="${dist.src.dir}/src/scratchpad" filtering="off">
<fileset dir="${scratchpad.dir}"/>
</copy>
<copy todir="${dist.src.dir}/src/testcases" filtering="off">
<fileset dir="${test.dir}"/>
</copy>
<copy todir="${dist.src.dir}/docs">
<fileset dir="${build.docs}"/>
</copy>
<copy todir="${dist.src.dir}/docs/apidocs">
<fileset dir="${build.javadocs}"/>
</copy>
<copy todir="${dist.src.dir}">
<fileset dir="${docs.dir}">
<include name="changes.xml, todo.xml"/>
</fileset>
</copy>
<copy todir="${dist.src.dir}" filtering="on">
<fileset dir=".">
<include name="README.txt"/>
<include name="legal/*"/>
<include name="*.bat"/>
<include name="*.sh"/>
<include name="*.xml"/>
</fileset>
</copy>
<chmod perm="+x" file="${dist.src.dir}/build.sh"/>
<chmod perm="+x" file="${dist.src.dir}/tools/bin/antRun"/>
<fixcrlf srcdir="${dist.src.dir}" includes="**.sh" eol="lf"/>
<fixcrlf srcdir="${dist.src.dir}" includes="antRun" eol="lf"/>
<fixcrlf srcdir="${dist.src.dir}" includes="**.bat" eol="crlf"/>
</target>
<!-- =================================================================== -->
<!-- Packages the source distribution as .zip -->
<!-- =================================================================== -->
<target name="dist-src-zip" depends="dist-src"
description="Generates the source distribution as a .zip file">
<zip zipfile="${dist.target}/${dist.name}-src.zip"
basedir="${dist.root}/source"/>
</target>
<!-- =================================================================== -->
<!-- Packages the source distribution with .tar.gzip -->
<!-- =================================================================== -->
<target name="dist-src-tgz" depends="dist-src"
description="Generates the source distribution as a .tar.gz file">
<tar tarfile="${dist.target}/${dist.name}-src.tar"
basedir="${dist.root}/source"
longfile="gnu"/>
<gzip zipfile="${dist.target}/${dist.name}-src.tar.gz"
src="${dist.target}/${dist.name}-src.tar"/>
</target>
<!-- =================================================================== -->
<!-- Creates the binary distribution -->
<!-- =================================================================== -->
<target name="dist-bin" depends="package, docs, javadocs"
description="Prepares the binary distribution">
<!-- Copy the html docs -->
<mkdir dir="${dist.root}"/>
<mkdir dir="${dist.bin.dir}"/>
<mkdir dir="${dist.bin.dir}/lib"/>
<mkdir dir="${dist.bin.dir}/docs"/>
<mkdir dir="${dist.bin.dir}/docs/apidocs"/>
<copy file="${build.dir}/${name}.jar" tofile="${dist.bin.dir}/lib/${name}-${version}.jar"/>
<copy todir="${dist.bin.dir}/docs">
<fileset dir="${build.docs}"/>
</copy>
<copy todir="${dist.bin.dir}/docs/apidocs">
<fileset dir="${build.javadocs}"/>
</copy>
<copy todir="${dist.bin.dir}">
<fileset dir="${docs.dir}">
<include name="changes.xml, todo.xml"/>
</fileset>
</copy>
<copy todir="${dist.bin.dir}" filtering="on">
<fileset dir=".">
<include name="README.txt"/>
<include name="legal/*"/>
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- Packages the binary distribution as .zip -->
<!-- =================================================================== -->
<target name="dist-bin-zip" depends="dist-bin"
description="Generates the binary distribution as a .zip file">
<zip zipfile="${dist.target}/${dist.name}-bin.zip"
basedir="${dist.root}/bin"/>
</target>
<!-- =================================================================== -->
<!-- Packages the binary distribution with .tar.gzip -->
<!-- =================================================================== -->
<target name="dist-bin-tgz" depends="dist-bin"
description="Generates the binary distribution as a .tar.gz file">
<tar tarfile="${dist.target}/${dist.name}-bin.tar"
basedir="${dist.root}/bin"
longfile="gnu"/>
<gzip zipfile="${dist.target}/${dist.name}-bin.tar.gz"
src="${dist.target}/${dist.name}-bin.tar"/>
</target>
<!-- =================================================================== -->
<!-- Build all distributions -->
<!-- =================================================================== -->
<target name="dist-info" depends="init">
<echo>**********************************************</echo>
<echo>*</echo>
<echo>* Build all distributions:</echo>
<echo>* - source distribution for windows/unix.</echo>
<echo>* - binary distribution for windows/unix.</echo>
<echo>*</echo>
<echo>* This may take a while...</echo>
<echo>*</echo>
<echo>***********************************************</echo>
<echo/>
</target>
<!-- =================================================================== -->
<!-- Build all distributions -->
<!-- =================================================================== -->
<target name="dist"
depends="dist-info, dist-bin-tgz, dist-bin-zip, dist-src-tgz, dist-src-zip"
description="* Generates all distributions (source/binary)">
</target>
<!-- =================================================================== -->
<!-- Clean targets -->
<!-- =================================================================== -->
<target name="clean" depends="init" description="* Cleans the build directories">
<delete dir="${build.dir}"/>
</target>
<target name="cleandocs" depends="init" description="* Cleans the build docs directories">
<delete dir="${build.docs}"/>
</target>
<target name="distclean" depends="clean" description="* Cleans everything to the original state">
<delete dir="${build.root}"/>
<delete file="${dist.target}/${Name}-${version}.tar.gz"/>
<delete file="${dist.target}/${Name}-${version}.tar"/>
<delete file="${dist.target}/${Name}-${version}.zip"/>
<delete file="${dist.target}/${Name}-${version}-src.tar.gz"/>
<delete file="${dist.target}/${Name}-${version}-src.tar"/>
<delete file="${dist.target}/${Name}-${version}-src.zip"/>
<delete file="${dist.target}/${Name}-${version}-bin.tar.gz"/>
<delete file="${dist.target}/${Name}-${version}-bin.tar"/>
<delete file="${dist.target}/${Name}-${version}-bin.zip"/>
<delete dir="${dist.root}"/>
</target>
<!-- =================================================================== -->
<!-- Test targets -->
<!-- =================================================================== -->
<target name="test" depends="compile" description="Perform jUnit tests">
<mkdir dir="${build.test}"/>
<!-- Copy test files to build test dir -->
<copy todir="${build.test}" filtering="on">
<fileset dir="${test.dir}/${test.specific}"/>
</copy>
<!-- Compile tests -->
<javac srcdir="${build.test}"
destdir="${build.test}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="${target.vm}">
<classpath refid="classpath"/>
<classpath>
<pathelement path="${build.dest}" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="yes" fork="yes">
<sysproperty key="UTIL.testdata.path"
value="${test.dir}/org/apache/poi/util/data"/>
<sysproperty key="HSSF.testdata.path"
value="${test.dir}/org/apache/poi/hssf/data"/>
<classpath>
<pathelement location="${build.test}" />
<pathelement location="${build.dest}" />
<pathelement path="${java.class.path}" />
</classpath>
<classpath refid="classpath"/>
<formatter type="plain" usefile="no" />
<batchtest>
<fileset dir="${build.test}">
<include name="**/test/*TestCase.class"/>
<include name="**/*Test.class" />
<include name="**/Test*.class" />
<exclude name="**/AllTest.class" />
<exclude name="**/*$$*Test.class" />
</fileset>
</batchtest>
</junit>
</target>
<!-- =================================================================== -->
<!-- Fix line endings in src -->
<!-- =================================================================== -->
<target name="fixsrclf" depends="init" description="Fix lf in src directory (internal use only!)">
<fixcrlf srcdir="${java.dir}" includes="**/*.java" eol="lf"/>
</target>
</project>
<!-- End of file -->
|