Improve how POIFS works with directory entries, and update HWPFDocument to support...
[poi.git] / build.xml
blob4201e8155eb8a362a42ea9586458f71fac023187
1 <?xml version="1.0"?>
2 <!-- 
3 Licensed to the Apache Software Foundation (ASF) under one
4 or more contributor license agreements.  See the NOTICE file
5 distributed with this work for additional information
6 regarding copyright ownership.  The ASF licenses this file
7 to you under the Apache License, Version 2.0 (the
8 "License"); you may not use this file except in compliance
9 with the License.  You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
13 Unless required by applicable law or agreed to in writing,
14 software distributed under the License is distributed on an
15 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 KIND, either express or implied.  See the License for the
17 specific language governing permissions and limitations
18 under the License.
19 -->
20 <!DOCTYPE project PUBLIC "-//Ant//Project 1.5//EN" "ant.dtd">
22 <!--
23     POI Build System.  Written by:
25         Glen Stampoultzis   glens at apache.org
27     Modified by:
29         Rainer Klute        klute@rainer-klute.de
31     This build was tested with ant 1.6.2 although it will probably work with
32     other versions.  The following jar files should be available on the 
33     classpath when running ant:
35     LIBRARY         LOCATION
36     =======         ========
37     junit(3.8+)     http://www.ibiblio.org/maven/junit/jars/
38     xerces          http://www.ibiblio.org/maven/xerces/jars/
39     jdepend         http://www.ibiblio.org/maven/jdepend/jars/
40     xalan           http://www.ibiblio.org/maven/xalan/jars/
42     The ant jar "optional.jar" should also be available otherwise the
43     build will fail.
45     To build the documentation you will need to install forrest and set
46     the FORREST_HOME environment variable.  Forrest 0.5.1 required.
48     Some people may find the tests hang when run through Ant. If this
49     happens to you, try giving Ant some more memory when you run it, eg:
50           ANT_OPTS="-Xmx1024m -XX:MaxPermSize=256m" ant test
53     TO BE COMPLETED:
55     Convert book.xml files to a sitemap.
57  -->
58 <project name="POI Build" default="help" basedir=".">
60   <description>
61     The POI project Ant build.
62   </description>
64   <property environment="env"/>
66   <property name="repository" value="http://www.ibiblio.org/maven"/>
67   <property name="forrest.home" value="${env.FORREST_HOME}"/>
69   <!-- Main: -->
70   <property name="main.resource1.dir" value="src/resources/main"/>
71   <property name="main.src" location="src/java"/>
72   <property name="main.src.test" location="src/testcases"/>
73   <property name="main.documentation" value="src/documentation"/>
74   <property name="main.output.dir" location="build/classes"/>
75   <property name="main.output.test.dir" location="build/test-classes"/>
76   <property name="main.lib" location="lib"/>
77   <property name="ooxml.lib" location="ooxml-lib"/>
78   <property name="main.reports.test" location="build/test-results"/>
79   <property name="main.jar1.dir" location="${main.lib}/commons-logging-1.1.jar"/>
80   <property name="main.jar1.url" value="${repository}/commons-logging/jars/commons-logging-1.1.jar"/>
81   <property name="main.jar2.dir" location="${main.lib}/log4j-1.2.13.jar"/>
82   <property name="main.jar2.url" value="${repository}/log4j/jars/log4j-1.2.13.jar"/>
83   <property name="main.testokfile" location="build/main-testokfile.txt"/>
85   <property name="junit.jar1.dir" location="${main.lib}/junit-3.8.1.jar"/>
86   <property name="junit.jar1.url" value="${repository}/junit/jars/junit-3.8.1.jar"/>
88   <!-- Scratchpad: -->
89   <property name="scratchpad.src" location="src/scratchpad/src"/>
90   <property name="scratchpad.src.test" location="src/scratchpad/testcases"/>
91   <property name="scratchpad.lib" location="src/scratchpad/lib"/>
92   <property name="scratchpad.reports.test" location="build/scratchpad-test-results"/>
93   <property name="scratchpad.output.dir" location="build/scratchpad-classes"/>
94   <property name="scratchpad.output.test.dir" location="build/scratchpad-test-classes"/>
95   <property name="scratchpad.testokfile" location="build/scratchpad-testokfile.txt"/>
97   <!-- Contributed software: -->
98   <property name="contrib.src" location="src/contrib/src"/>
99   <property name="contrib.src.test" location="src/contrib/testcases"/>
100   <property name="contrib.lib" location="src/contrib/lib"/>
101   <property name="contrib.reports.test" location="build/contrib-test-results"/>
102   <property name="contrib.output.dir" location="build/contrib-classes"/>
103   <property name="contrib.output.test.dir" location="build/contrib-test-classes"/>
104   <property name="contrib.jar1.dir" location="${contrib.lib}/commons-beanutils-1.7.0.jar"/>
105   <property name="contrib.jar1.url" value="${repository}/commons-beanutils/jars/commons-beanutils-1.7.0.jar"/>
106   <property name="contrib.jar2.dir" location="${contrib.lib}/commons-collections-3.2.jar"/>
107   <property name="contrib.jar2.url" value="${repository}/commons-collections/jars/commons-collections-3.2.jar"/>
108   <property name="contrib.jar3.dir" location="${contrib.lib}/commons-lang-2.1.jar"/>
109   <property name="contrib.jar3.url" value="${repository}/commons-lang/jars/commons-lang-2.1.jar"/>
110   <property name="contrib.testokfile" location="build/contrib-testokfile.txt"/>
112   <!-- Examples: -->
113   <property name="examples.src" location="src/examples/src"/>
114   <property name="examples.src.test" location="src/examples/testcases"/>
115   <property name="examples.lib" location="src/examples/lib"/>
116   <property name="examples.reports.test" location="build/examples-test-results"/>
117   <property name="examples.output.dir" location="build/examples-classes"/>
118   <property name="examples.output.test.dir" location="build/examples-test-classes"/>
119   <property name="examples.jar1.dir" location="${examples.lib}/commons-beanutils-1.7.0.jar"/>
120   <property name="examples.jar1.url" value="${repository}/commons-beanutils/jars/commons-beanutils-1.7.0.jar"/>
121   <property name="examples.jar2.dir" location="${examples.lib}/commons-collections-3.2.jar"/>
122   <property name="examples.jar2.url" value="${repository}/commons-collections/jars/commons-collections-3.2.jar"/>
123   <property name="examples.jar3.dir" location="${examples.lib}/commons-lang-2.1.jar"/>
124   <property name="examples.jar3.url" value="${repository}/commons-lang/jars/commons-lang-2.1.jar"/>
125   <property name="examples.testokfile" location="build/examples-testokfile.txt"/>
127   <!-- Experimental OOXML support: -->
128   <property name="ooxml.src" location="src/scratchpad/ooxml-src"/>
129   <property name="ooxml.src.test" location="src/scratchpad/ooxml-testcases"/>
130   <property name="ooxml.reports.test" location="build/ooxml-test-results"/>
131   <property name="ooxml.output.dir" location="build/ooxml-classes"/>
132   <property name="ooxml.output.test.dir" location="build/ooxml-test-classes"/>
133   <property name="ooxml.testokfile" location="build/ooxml-testokfile.txt"/>
135   <property name="ooxml.jar1.dir" location="${ooxml.lib}/dom4j-1.6.1.jar"/>
136   <property name="ooxml.jar1.url" value="${repository}/dom4j/jars/dom4j-1.6.1.jar"/>
137   <property name="ooxml.jar2.dir" location="${ooxml.lib}/jaxen-1.1.jar"/>
138   <property name="ooxml.jar2.url" value="${repository}/jaxen/jars/jaxen-1.1.jar"/>
139   <property name="ooxml.jar3.dir" location="${ooxml.lib}/xmlbeans-2.3.0.jar"/>
140   <property name="ooxml.jar3.url" value="${repository}/org.apache.xmlbeans/jars/xmlbeans-2.3.0.jar"/>
141   <property name="ooxml.jar4.dir" location="${ooxml.lib}/jsr173_1.0_api.jar"/>
142   <property name="ooxml.jar4.url" value="${repository}/xmlbeans/jars/jsr173_1.0_api.jar"/>
143   <!-- No official release of openxml4j yet -->
144   <property name="ooxml.jar5.dir" location="${ooxml.lib}/openxml4j-bin-alpha-080124.jar"/>
145   <property name="ooxml.jar5.url" value="http://people.apache.org/~nick/openxml4j-bin-prealpha-071224.jar"/>
147   <!-- See http://www.ecma-international.org/publications/standards/Ecma-376.htm -->
148   <!-- "Copy these file(s), free of charge" -->
149   <property name="ooxml.xsds.ozip" location="${ooxml.lib}/OfficeOpenXML-Part4.zip"/>
150   <property name="ooxml.xsds.izip" location="${ooxml.lib}/OfficeOpenXML-XMLSchema.zip"/>
151   <property name="ooxml.xsds.url" value="http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%20Part%204%20(DOCX).zip" />
152   <property name="ooxml.xsds.jar" location="${ooxml.lib}/ooxml-schemas.jar"/>
154   <property name="build.site" location="build/tmp/site/build/site"/>
155   <property name="build.site.src" location="build/tmp/site"/>
156   <property name="junit.report.dir" location="${build.site}/junit"/>
157   <property name="jdepend.report.dir" location="${build.site}/jdepend"/>
158   <property name="jdepend.report.out.dir" location="${build.site.src}/src/documentation/content/jdepend"/>
159   <property name="apidocs.report.dir" location="${build.site}/apidocs"/>
160   <property name="changelog.file" location="${build.site}/changelog.html"/>
161   <property name="dist.dir" location="build/dist"/>
162   <property name="mavendist.dir" location="build/maven-dist"/>
163   <property name="mavendist.poi.dir" location="build/maven-dist/poi"/>
164   <property name="mavendist.oap.dir" location="build/maven-dist/org.apache.poi"/>
165   <property name="jar.name" value="poi"/>
166   <property name="version.id" value="3.0.3-alpha1"/>
167   <property name="halt.on.test.failure" value="true"/>
168   <property name="jdk.version.source" value="1.3"
169     description="JDK version of source code"/>
170   <property name="jdk.version.class" value="1.3"
171     description="JDK version of generated class files"/>  
174     <path id="main.classpath">
175         <pathelement location="${main.jar1.dir}"/>
176         <pathelement location="${main.jar2.dir}"/>
177         <pathelement location="${main.resource1.dir}"/>
178     </path>
180     <path id="scratchpad.classpath">
181         <path refid="main.classpath"/>
182         <pathelement location="${main.output.dir}"/>
183     </path>
185     <path id="contrib.classpath">
186         <path refid="main.classpath"/>
187         <pathelement location="${contrib.jar1.dir}"/>
188         <pathelement location="${contrib.jar2.dir}"/>
189         <pathelement location="${contrib.jar3.dir}"/>
190         <pathelement location="${main.output.dir}"/>
191         <pathelement location="${main.output.test.dir}"/>
192         <pathelement location="${scratchpad.output.dir}"/>
193         <pathelement location="${scratchpad.output.test.dir}"/>
194         <pathelement location="${contrib.output.dir}"/>
195         <pathelement location="${contrib.output.test.dir}"/>
196     </path>
198     <path id="ooxml.classpath">
199         <path refid="main.classpath"/>
200         <path refid="scratchpad.classpath"/>
201         <fileset dir="${ooxml.lib}">
202                         <include name="*.jar" />
203                 </fileset>
204     </path>
207   <path id="examples.classpath">
208     <path refid="main.classpath"/>
209     <pathelement location="${main.output.dir}"/>
210   </path>
214   <!-- Prints POI's Ant usage help -->
215   <target name="help" description="Prints POI's Ant usage help">
216     <echo>
217       - Execute "ant -projecthelp" to view a listing of the main build
218         targets.
219       - Execute "ant help-properties" to view a listing of some properties
220         controlling the build process.
221     </echo>
222   </target>
226   <target name="help-properties"
227     description="Prints a listing of build controlling properties">
228     <echo>
229       The following properties control the build process:
231       -Ddisconnected="true": Do not execute any targets that require an online
232           connection to the Internet.
233       -Dtestcase=org.apache.poi.xxx.xxx : for the single-test target, specify
234               the test to run
236       WARNING: This list is not exhaustive.
237     </echo>
238   </target>
242     <target name="with.clover" if="clover.present">
243         <taskdef resource="clovertasks"/>
244         <clover-setup initString="mycoverage.db"/>
245     </target>
247     <target name="clover.html" depends="with.clover" if="clover.present">
248         <echo>Generating clover report</echo>
249        <clover-report>
250           <current outfile="build/tmp/site/build/site/clover_html">
251              <format type="html"/>
252           </current>
253        </clover-report>
254     </target>
256     <target name="init" depends="check-jars,fetch-jars">
258         <tstamp>
259           <format property="tstamp.year" pattern="yyyy"/>
260         </tstamp>
262         <available resource="clovertasks" property="clover.present"/>
263         <antcall target="with.clover"/>
264         
265         <mkdir dir="build"/>
266         <mkdir dir="build/non-ant-classes"/>
267         <mkdir dir="${main.output.dir}"/>
268         <mkdir dir="${scratchpad.output.dir}"/>
269         <mkdir dir="${contrib.output.dir}"/>
270         <mkdir dir="${examples.output.dir}"/>
271         <mkdir dir="${ooxml.output.dir}"/>
272         <mkdir dir="${main.output.test.dir}"/>
273         <mkdir dir="${contrib.output.test.dir}"/>
274         <mkdir dir="${scratchpad.output.test.dir}"/>
275         <mkdir dir="${ooxml.output.test.dir}"/>
276         <mkdir dir="${main.reports.test}"/>
277         <mkdir dir="${scratchpad.reports.test}"/>
278         <mkdir dir="${contrib.reports.test}"/>
279         <mkdir dir="${ooxml.reports.test}"/>
280         <mkdir dir="${junit.report.dir}"/>
281         <mkdir dir="${jdepend.report.dir}"/>
282         <mkdir dir="${jdepend.report.out.dir}"/>
283         <mkdir dir="${apidocs.report.dir}"/>
284         <mkdir dir="${dist.dir}"/>
285         <mkdir dir="${build.site.src}/${main.documentation}"/>
287         <mkdir dir="${mavendist.dir}"/>
288         <mkdir dir="${mavendist.poi.dir}"/>
289         <mkdir dir="${mavendist.poi.dir}/poms"/>
290         <mkdir dir="${mavendist.oap.dir}"/>
291         <mkdir dir="${mavendist.oap.dir}/jars"/>
292         <mkdir dir="${mavendist.oap.dir}/poms"/>
294         <copy todir="${build.site.src}/${main.documentation}">
295             <fileset dir="${main.documentation}"/>
296         </copy>
297         <copy file="forrest.properties" tofile="${build.site.src}/forrest.properties"/>
298     </target>
300     <target name="clean">
301         <delete dir="build"/>
302     </target>
304     <target name="check-jars">
305         <condition property="jars.present">
306             <or>
307                 <and>
308                     <available file="${main.jar1.dir}"/>
309                     <available file="${main.jar2.dir}"/>
310                     <available file="${contrib.jar1.dir}"/>
311                     <available file="${contrib.jar2.dir}"/>
312                     <available file="${contrib.jar3.dir}"/>
313                     <available file="${junit.jar1.dir}"/>
314                     <available file="${ooxml.jar1.dir}"/>
315                     <available file="${ooxml.jar2.dir}"/>
316                     <available file="${ooxml.jar3.dir}"/>
317                     <available file="${ooxml.jar4.dir}"/>
318                     <available file="${ooxml.jar5.dir}"/>
319                 </and>
320                 <isset property="disconnected"/>
321             </or>
322         </condition>
323     </target>
325     <target name="fetch-jars" unless="jars.present"
326      description="Fetches needed JAR files from the Internet">
327         <get src="${main.jar1.url}" dest="${main.jar1.dir}"/>
328         <get src="${main.jar2.url}" dest="${main.jar2.dir}"/>
329         <get src="${contrib.jar1.url}" dest="${contrib.jar1.dir}"/>
330         <get src="${contrib.jar2.url}" dest="${contrib.jar2.dir}"/>
331         <get src="${contrib.jar3.url}" dest="${contrib.jar3.dir}"/>
332         <get src="${junit.jar1.url}" dest="${junit.jar1.dir}"/>
334         <get src="${ooxml.jar1.url}" dest="${ooxml.jar1.dir}"/>
335         <get src="${ooxml.jar2.url}" dest="${ooxml.jar2.dir}"/>
336         <get src="${ooxml.jar3.url}" dest="${ooxml.jar3.dir}"/>
337         <get src="${ooxml.jar4.url}" dest="${ooxml.jar4.dir}"/>
338         <get src="${ooxml.jar5.url}" dest="${ooxml.jar5.dir}"/>
339     </target>
341         <target name="check-ooxml-xsds">
342         <condition property="ooxml-xsds.present">
343             <or>
344                 <and>
345                     <available file="${ooxml.xsds.izip}"/>
346                 </and>
347                 <isset property="disconnected"/>
348             </or>
349         </condition>
350         </target>
351     <target name="fetch-ooxml-xsds" unless="ooxml-xsds.present"
352      description="Fetches needed OOXML xsd files from the Internet">
353         <get src="${ooxml.xsds.url}" dest="${ooxml.xsds.ozip}"/>
354                 <unzip src="${ooxml.xsds.ozip}" dest="${ooxml.lib}">
355                         <patternset>
356                                 <include name="OfficeOpenXML-XMLSchema.zip" />
357                         </patternset>
358                 </unzip>
359         </target>
360         <target name="check-compiled-ooxml-xsds">
361         <condition property="ooxml-compiled-xsds.present">
362             <or>
363                 <and>
364                     <available file="${ooxml.xsds.jar}"/>
365                 </and>
366                 <isset property="disconnected"/>
367             </or>
368         </condition>
369         </target>
370         <target name="compile-ooxml-xsds" unless="ooxml-compiled-xsds.present"
371          depends="check-jars,fetch-jars,check-ooxml-xsds,fetch-ooxml-xsds,check-compiled-ooxml-xsds"
372          description="Unpacks the OOXML xsd files, and compiles them into XmlBeans">
373                 <taskdef name="xmlbean"
374                         classname="org.apache.xmlbeans.impl.tool.XMLBean"
375                         classpath="${ooxml.jar3.dir}:${ooxml.jar4.dir}" />
377                 <unzip src="${ooxml.xsds.izip}" dest="build/ooxml-xsds/" />
378                 <!--
379                         schema="build/ooxml-xsds/"
380                         schema="build/ooxml-xsds/sml-workbook.xsd"
381                 -->
382                 <xmlbean
383                         schema="build/ooxml-xsds/"
384                         destfile="${ooxml.xsds.jar}"
385                         javasource="1.4"
386                         failonerror="false"
387                         fork="true"
388                         memoryMaximumSize="512m"
389                 >
390                         <classpath refid="ooxml.classpath"/>
391                 </xmlbean>
392         </target>
394   <target name="compile" depends="init, compile-main, compile-scratchpad,
395     compile-contrib, compile-examples"
396     description="Compiles the POI main classes, scratchpad, contrib, and examples"/>
398   <target name="compile-main" depends="fail-unless-xslt-is-available">
399     <copy todir="${main.output.dir}">
400       <fileset dir="${main.resource1.dir}"/>
401     </copy>
402     <javac target="${jdk.version.class}" source="${jdk.version.source}"
403       failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
404       srcdir="${main.src}">
405       <classpath refid="main.classpath"/>
406     </javac>
407     <javac target="${jdk.version.class}" source="${jdk.version.source}"
408       failonerror="true" destdir="${main.output.test.dir}" debug="on"
409       fork="yes" srcdir="${main.src.test}">
410       <classpath>
411         <path refid="main.classpath"/>
412         <pathelement location="${main.output.dir}"/>
413         <pathelement location="${junit.jar1.dir}"/>
414       </classpath>
415     </javac>
416   </target>
418   <target name="compile-scratchpad" depends="init,compile-main">
419     <javac target="${jdk.version.class}" source="${jdk.version.source}"
420       failonerror="true" destdir="${scratchpad.output.dir}" debug="on"
421       fork="yes" srcdir="${scratchpad.src}">
422       <classpath refid="scratchpad.classpath"/>
423     </javac>
424     <javac target="${jdk.version.class}" source="${jdk.version.source}"
425       failonerror="true" destdir="${scratchpad.output.test.dir}" debug="on"
426       fork="yes" srcdir="${scratchpad.src.test}">
427       <classpath>
428         <path refid="scratchpad.classpath"/>
429         <pathelement location="${scratchpad.output.dir}"/>
430         <pathelement location="${junit.jar1.dir}"/>
431       </classpath>
432     </javac>
434         <!-- Copy HSLF Resources over -->
435         <property name="hslf.data" value="org/apache/poi/hslf/data" />
436         <mkdir dir="${scratchpad.output.dir}/${hslf.data}" />
437         <copy todir="${scratchpad.output.dir}/${hslf.data}">
438                 <fileset dir="${scratchpad.src}/${hslf.data}">
439                         <include name="*.ppt" />
440                 </fileset>
441         </copy>
443         <!-- Copy HDGF Resources over -->
444         <property name="hdgf.chunks" value="org/apache/poi/hdgf/chunks" />
445         <copy todir="${scratchpad.output.dir}/${hdgf.chunks}">
446                 <fileset dir="${scratchpad.src}/${hdgf.chunks}">
447                         <include name="*.tbl" />
448                 </fileset>
449         </copy>
450   </target>
452   <target name="compile-contrib" depends="init">
453     <javac target="${jdk.version.class}" source="${jdk.version.source}"
454       failonerror="true" destdir="${contrib.output.dir}" debug="on" fork="yes"
455       srcdir="${contrib.src}">
456       <classpath refid="contrib.classpath"/>
457     </javac>
458     <javac target="${jdk.version.class}" source="${jdk.version.source}"
459       failonerror="true" destdir="${contrib.output.test.dir}" debug="on"
460       fork="yes" srcdir="${contrib.src.test}">
461       <classpath>
462         <path refid="contrib.classpath"/>
463         <pathelement location="${contrib.output.dir}"/>
464         <pathelement location="${junit.jar1.dir}"/>
465       </classpath>
466     </javac>
467   </target>
469   <target name="compile-examples" depends="init">
470     <javac target="${jdk.version.class}" source="${jdk.version.source}"
471       destdir="${examples.output.dir}" debug="on" srcdir="${examples.src}">
472       <classpath refid="examples.classpath"/>
473     </javac>
474   </target>
476   <target name="compile-ooxml" depends="init, check-ooxml-xsds, fetch-ooxml-xsds, compile-ooxml-xsds, compile-main">
477         <!-- openxml4j requires java 1.5, so so must we, for now -->
478     <javac target="1.5" source="1.5"
479       destdir="${ooxml.output.dir}" debug="on" srcdir="${ooxml.src}">
480       <classpath refid="ooxml.classpath"/>
481     </javac>
483     <javac target="1.5" source="1.5"
484       failonerror="true" destdir="${ooxml.output.test.dir}" debug="on"
485       fork="yes" srcdir="${ooxml.src.test}">
486       <classpath>
487         <path refid="ooxml.classpath"/>
488         <pathelement location="${ooxml.output.dir}"/>
489         <pathelement location="${junit.jar1.dir}"/>
490       </classpath>
491     </javac>
492   </target>
494   <target name="test" depends="test-main,test-scratchpad,test-contrib"
495     description="Tests main, contrib and scratchpad"/>
497     <target name="-test-main-check">
498         <uptodate property="main.test.notRequired" targetfile="${main.testokfile}">
499             <srcfiles dir="${main.src}"/>
500             <srcfiles dir="${main.src.test}"/>
501         </uptodate>
502     </target>
504     <path id="test.classpath">
505         <path refid="main.classpath"/>
506         <pathelement location="${main.output.dir}"/>
507         <pathelement location="${main.output.test.dir}"/>
508         <pathelement location="${junit.jar1.dir}"/>
509     </path>
511   <target name="test-main" unless="main.test.notRequired"
512     depends="compile-main, -test-main-check, fail-unless-junit-is-available">
513     <junit fork="no" printsummary="yes" haltonfailure="${halt.on.test.failure}"
514       failureproperty="main.test.failed" showoutput="true">
515       <classpath refid="test.classpath"/>
516       <sysproperty key="HSSF.testdata.path"
517         file="${main.src.test}/org/apache/poi/hssf/data"/> 
518       <sysproperty key="HSLF.testdata.path"
519         file="${main.src.test}/org/apache/poi/hslf/data"/> 
520       <sysproperty key="HWPF.testdata.path"
521         file="${main.src.test}/org/apache/poi/hwpf/data"/> 
522       <sysproperty key="HPSF.testdata.path"
523         file="${main.src.test}/org/apache/poi/hpsf/data"/> 
524       <sysproperty key="POIFS.testdata.path"
525         file="${main.src.test}/org/apache/poi/poifs/data"/> 
526       <sysproperty key="java.awt.headless" value="true"/>
527       <formatter type="plain"/>
528       <formatter type="xml"/>
529       <batchtest todir="${main.reports.test}">
530         <fileset dir="${main.src.test}">
531           <include name="**/Test*.java"/>
532           <exclude name="**/All*Tests.java"/>
533           <exclude name="**/TestUnfixedBugs.java"/>
534           <exclude name="**/TestcaseRecordInputStream.java"/>
535         </fileset>
536       </batchtest>
537     </junit>
538     <delete file="${main.testokfile}"/>
539     <antcall target="-test-main-write-testfile"/>
540   </target>
542   <target name="test-fail" depends="compile-main,
543     fail-unless-junit-is-available"
544     description="run tests that are known to fail">
545     <junit printsummary="yes" showoutput="true" filtertrace="no"
546       haltonfailure="false">
547       <classpath refid="test.classpath"/>
548       <classpath>
549         <path refid="scratchpad.classpath"/>
550         <pathelement location="${main.output.dir}"/>
551         <pathelement location="${scratchpad.output.dir}"/>
552         <pathelement location="${scratchpad.output.test.dir}"/>
553         <pathelement location="${junit.jar1.dir}"/>
554       </classpath>
555       <sysproperty key="HSSF.testdata.path"
556         file="${main.src.test}/org/apache/poi/hssf/data"/>
557       <sysproperty key="HPSF.testdata.path"
558         file="${main.src.test}/org/apache/poi/hpsf/data"/>
559       <sysproperty key="HWPF.testdata.path"
560         file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
561       <sysproperty key="POIFS.testdata.path"
562         file="${main.src.test}/org/apache/poi/poifs/data"/> 
563       <sysproperty key="java.awt.headless" value="true"/>
564       <formatter type="plain" usefile="no"/>
565       <batchtest todir="${main.reports.test}">
566         <fileset dir="${main.src.test}">
567           <include name="**/TestEmptyDocument.java"/>
568           <include name="**/TestUnfixedBugs.java"/>
569         </fileset>
570       </batchtest>
571     </junit>
572   </target>        
576     <target name="single-test" depends="-test-property-check,compile-main" description="Runs a single test case specified with -Dtestcase=classname">
577         <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
578             <classpath refid="test.classpath"/>
579                  <classpath>
580                                 <path refid="test.classpath"/>
581                                 <pathelement location="${main.output.dir}"/>
582                                 <pathelement location="${scratchpad.output.dir}"/>
583                                 <pathelement location="${scratchpad.output.test.dir}"/>
584                                 <pathelement location="${junit.jar1.dir}"/>
585                             </classpath>
586             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
587             <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
588             <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
589             <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
590             <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
591             <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
592             <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/> 
593                 <sysproperty key="java.awt.headless" value="true"/>
594             <formatter type="plain" usefile="no"/>
595             <formatter type="xml"/>
596             <test name="${testcase}"/>
597         </junit>
598     </target>
600     <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." >
601             <echo>Waiting for debugger on port 5001</echo>    
602         <junit printsummary="no" showoutput="true" filtertrace="no" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed">
603             <jvmarg value="-Xdebug"/>
604             <jvmarg value="-Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=y"/>
605             <sysproperty key="java.compiler" value="NONE"/>
606             <classpath refid="test.classpath"/>
607             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
608             <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
609             <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/> 
610             <sysproperty key="java.awt.headless" value="true"/>
611             <formatter type="plain" usefile="no"/>
612             <test name="${testcase}"/>
613         </junit>
614     </target>
616     <target name="-test-property-check" unless="testcase">
617         <echo message="Please use -Dtestcase=org.your.testcase to run a single test"/>
618         <fail/>
619     </target>
621     <target name="-test-main-write-testfile" unless="main.test.failed">
622         <echo file="${main.testokfile}" append="false" message="testok"/>
623     </target>
625     <target name="-test-scratchpad-check">
626         <uptodate property="scratchpad.test.notRequired" targetfile="${scratchpad.testokfile}">
627             <srcfiles dir="${scratchpad.src}"/>
628             <srcfiles dir="${scratchpad.src.test}"/>
629         </uptodate>
630     </target>
632     <target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check" unless="scratchpad.test.notRequired">
633         <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="scratchpad.test.failed">
634             <classpath>
635                 <path refid="scratchpad.classpath"/>
636                 <pathelement location="${main.output.dir}"/>
637                 <pathelement location="${scratchpad.output.dir}"/>
638                 <pathelement location="${scratchpad.output.test.dir}"/>
639                 <pathelement location="${junit.jar1.dir}"/>
640             </classpath>
641             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
642             <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
643             <sysproperty key="HDF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdf/data"/>
644             <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
645             <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
646             <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
647             <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
648             <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/> 
649             <sysproperty key="java.awt.headless" value="true"/>
650             <formatter type="plain"/>
651             <formatter type="xml"/>
652             <batchtest todir="${scratchpad.reports.test}">
653                 <fileset dir="${scratchpad.src.test}">
654                     <include name="**/Test*.java"/>
655                     <exclude name="**/AllTests.java"/>
656                 </fileset>
657             </batchtest>
658         </junit>
659         <delete file="${scratchpad.testokfile}"/>
660         <antcall target="-test-scratchpad-write-testfile"/>
661     </target>
663     <target name="-test-scratchpad-write-testfile" unless="scratchpad.test.failed">
664         <echo file="${scratchpad.testokfile}" append="false" message="testok"/>
665     </target>
667         <target name="single-scratchpad-test" depends="compile-scratchpad,-test-property-check" description="Runs a single test case specified with -Dtestcase=classname">
668                 <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
669                     <classpath refid="test.classpath"/>
670                          <classpath>
671                                         <path refid="scratchpad.classpath"/>
672                                         <pathelement location="${main.output.dir}"/>
673                                         <pathelement location="${scratchpad.output.dir}"/>
674                                         <pathelement location="${scratchpad.output.test.dir}"/>
675                                         <pathelement location="${junit.jar1.dir}"/>
676                                     </classpath>
677                 <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
678                     <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
679                     <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
680                 <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
681                 <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
682                 <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
683                 <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/> 
684                     <sysproperty key="java.awt.headless" value="true"/>
685                         <sysproperty key="java.awt.headless" value="true"/>
686                     <formatter type="plain" usefile="no"/>
687                     <formatter type="xml"/>
688                     <test name="${testcase}"/>
689                 </junit>
690             </target>
691         
692     <target name="-test-contrib-check">
693         <uptodate property="contrib.test.notRequired" targetfile="${contrib.testokfile}">
694             <srcfiles dir="${contrib.src}"/>
695             <srcfiles dir="${contrib.src.test}"/>
696         </uptodate>
697     </target>
699     <target name="test-contrib" depends="compile-main,compile-contrib,-test-contrib-check" unless="contrib.test.notRequired">
700         <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="contrib.test.failed">
701             <classpath>
702                 <path refid="contrib.classpath"/>
703                 <pathelement location="${main.output.dir}"/>
704                 <pathelement location="${contrib.output.dir}"/>
705                 <pathelement location="${contrib.output.test.dir}"/>
706                 <pathelement location="${junit.jar1.dir}"/>
707             </classpath>
708             <sysproperty key="HSSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hssf/data"/>
709             <sysproperty key="HPSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hpsf/data"/>
710             <sysproperty key="java.awt.headless" value="true"/>
711             <formatter type="plain"/>
712             <formatter type="xml"/>
713             <batchtest todir="${contrib.reports.test}">
714                 <fileset dir="${contrib.src.test}">
715                     <include name="**/Test*.java"/>
716                     <exclude name="**/AllTests.java"/>
717                 </fileset>
718             </batchtest>
719         </junit>
720         <delete file="${contrib.testokfile}"/>
721         <antcall target="-test-contrib-write-testfile"/>
722     </target>
724     <target name="-test-contrib-write-testfile" unless="contrib.test.failed">
725         <echo file="${contrib.testokfile}" append="false" message="testok"/>
726     </target>
728     <target name="-test-ooxml-check">
729         <uptodate property="ooxml.test.notRequired" targetfile="${ooxml.testokfile}">
730             <srcfiles dir="${ooxml.src}"/>
731             <srcfiles dir="${ooxml.src.test}"/>
732         </uptodate>
733     </target>
735     <target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check" unless="ooxml.test.notRequired">
736         <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="ooxml.test.failed">
737             <classpath>
738                 <path refid="ooxml.classpath"/>
739                 <pathelement location="${main.output.dir}"/>
740                 <pathelement location="${ooxml.output.dir}"/>
741                 <pathelement location="${ooxml.output.test.dir}"/>
742                 <pathelement location="${junit.jar1.dir}"/>
743             </classpath>
744             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
745             <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
746             <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
747             <sysproperty key="java.awt.headless" value="true"/>
748             <formatter type="plain"/>
749             <formatter type="xml"/>
750             <batchtest todir="${ooxml.reports.test}">
751                 <fileset dir="${ooxml.src.test}">
752                     <include name="**/Test*.java"/>
753                     <exclude name="**/AllTests.java"/>
754                 </fileset>
755             </batchtest>
756         </junit>
757         <delete file="${ooxml.testokfile}"/>
758         <antcall target="-test-ooxml-write-testfile"/>
759     </target>
761     <target name="-test-ooxml-write-testfile" unless="ooxml.test.failed">
762         <echo file="${ooxml.testokfile}" append="false" message="testok"/>
763     </target>
765     <target name="-check-docs">
766         <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html">
767             <srcfiles dir="${build.site.src}"/>
768         </uptodate>
769     </target>
771     <target name="-check-forrest-installed" unless="env.FORREST_HOME">
772         <echo>Please install Apache Forrest (see
773 &lt;http://xml.apache.org/forrest/index.html&gt;) and set the
774 FORREST_HOME environment variable!</echo>
775         <fail message="Apache Forrest is not installed."/>
776     </target>
778     <!--    <target name="check-docs">-->
779     <!--        <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html" >-->
780     <!--            <srcfiles dir= "${build.site.src}"/>-->
781     <!--        </uptodate>-->
782     <!--    </target>-->
784     <target name="docs" depends="init, -check-forrest-installed, -check-docs"
785       unless="main.docs.notRequired" description="Builds the POI website">
787         <mkdir dir="${build.site.src}/src/documentation/content/apidocs"/>
788         <copy todir="${build.site.src}/src/documentation/content/apidocs">
789             <fileset dir="${apidocs.report.dir}"/>
790         </copy>
791         <copy
792           tofile="${build.site.src}/src/documentation/content/jdepend.ehtml"
793           file="${jdepend.report.dir}/index.html" failonerror="false"/>
794         <mkdir dir="${build.site.src}/src/documentation/content/junit"/>
795         <copy todir="${build.site.src}/src/documentation/content/junit">
796             <fileset dir="${junit.report.dir}"/>
797         </copy>
799         <move
800           file="${build.site.src}/src/documentation/content/xdocs/status.xml"
801           tofile="${build.site.src}/status.xml"/>
803         <ant antfile="${forrest.home}/forrest.antproxy.xml" target="site">
804             <property name="project.home" location="${build.site.src}"/>
805         </ant>
807         <echo>Broken links:</echo>
808         <echo file="${build.site}/../tmp/brokenlinks.txt"/>
810         <touch>
811             <fileset dir="${build.site}"/>
812         </touch>
813     </target>
815     <!-- Checks whether reports are required to be run.  If nothing has changed then they dont. -->
816     <target name="-check-reports">
817         <condition property="reports.notRequired">
818             <and>
819                 <equals arg1="${main.test.notRequired}" arg2="true"/>
820                 <equals arg1="${scratchpad.test.notRequired}" arg2="true"/>
821                 <equals arg1="${contrib.test.notRequired}" arg2="true"/>
822             </and>
823         </condition>
824     </target>
828   <!-- Generates a log of the latest changes in the CVS repository. -->
829   <target name="cvschangelog" unless="disconnected"
830     depends="fail-unless-xslt-is-available"
831     description="Generates a CVS change log report">
832     <antcall target="cvs-rsh-warning"/>
833     <cvschangelog destfile="${changelog.file}" daysinpast="30"/>
835     <style in="${changelog.file}"
836       out="${build.site.src}/src/documentation/content/changelog.html"
837       style="changelog.xsl">
838       <param name="title"  expression="POI Change Log"/>
839       <param name="module" expression="jakarta-poi"/>
840       <param name="cvsweb" expression="http://cvs.apache.org/viewcvs/"/>
841     </style>
842   </target>
844   <target name="cvs-rsh-warning" unless="env.CVS_RSH">
845     <echo>
846       WARNING: The environment variable CVS_RSH is not set. If you cannot
847       access the CVS repository this could be one of the reasons for the
848       failure.
849     </echo>
850   </target>
854   <!-- Creates reports and API documentation -->
855   <target name="reports" unless="reports.notRequired" depends="-check-reports,
856     fail-unless-xslt-is-available, fail-unless-junit-is-available,
857     fail-unless-jdepend-is-available, test-ignore-failures, junitreport,
858     jdepend, cvschangelog, javadocs, clover.html"
859     description="Creates various reports and the API documentation">
860   </target>
864   <!-- Runs all JUnit tests without aborting if one of the tests fails. -->
865   <target name="test-ignore-failures" depends="init">
866     <antcall target="test">
867       <param name="halt.on.test.failure" value="false"/>
868     </antcall>
869   </target>
873   <!-- Produces a report of the JUnit test results -->
874   <target name="junitreport"
875     depends="fail-unless-xslt-is-available, test-ignore-failures"
876     description="Produces a report of the JUnit test results">
877     <junitreport todir="${junit.report.dir}">
878       <fileset dir="${main.reports.test}">
879         <include name="TEST-*.xml"/>
880       </fileset>
881       <fileset dir="${scratchpad.reports.test}">
882         <include name="TEST-*.xml"/>
883       </fileset>
884       <fileset dir="${contrib.reports.test}">
885         <include name="TEST-*.xml"/>
886       </fileset>
887       <report format="frames" todir="${junit.report.dir}"/>
888     </junitreport>
889   </target>
893   <!-- Generates the API documentation. -->
894   <target name="javadocs" depends="init, warn-unless-junit-is-available,
895     warn-unless-xslt-is-available"
896     description="Generates the API documentation">
897     <javadoc verbose="false" author="true" destdir="${apidocs.report.dir}"
898       windowtitle="POI API Documentation" use="true" version="true">
900       <packageset dir="${main.src}" defaultexcludes="yes">
901         <include name="org/apache/poi/**"/>
902       </packageset>
903       <packageset dir="${scratchpad.src}" defaultexcludes="yes">
904         <include name="org/apache/poi/**"/>
905         <exclude name="org/apache/poi/hdf/**"/>
906       </packageset>
907       <packageset dir="${contrib.src}" defaultexcludes="yes">
908         <include name="org/apache/poi/**"/>
909       </packageset>
910       <packageset dir="${examples.src}" defaultexcludes="yes">
911         <include name="org/apache/poi/**"/>
912       </packageset>
914       <classpath id="javadoc.classpath">
915         <path refid="main.classpath"/>
916         <path refid="scratchpad.classpath"/>
917         <path refid="contrib.classpath"/>
918         <path refid="examples.classpath"/>
919         <path path="${env.CLASSPATH}"/>
920       </classpath>
922       <doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle>
923       <bottom>
924         <![CDATA[<i>Copyright ${tstamp.year} The Apache Software Foundation or
925         its licensors, as applicable.</i>]]>
926       </bottom>
927       <group>
928         <title>DDF - Dreadful Drawing Format</title>
929         <package name="org.apache.poi.ddf*"/>
930       </group>
931       <group>
932         <title>HPSF - Horrible Property Set Format</title>
933         <package name="org.apache.poi.hpsf*"/>
934       </group>
935       <group>
936         <title>HSSF - Horrible Spreadsheet Format</title>
937         <package name="org.apache.poi.hssf*"/>
938       </group>
939       <group>
940         <title>HWPF - Horrible Word Processor Format</title>
941         <package name="org.apache.poi.hwpf*"/>
942       </group>
943       <group>
944         <title>POIFS - POI File System</title>
945         <package name="org.apache.poi.poifs*"/>
946       </group>
947       <group>
948         <title>Utilities</title>
949         <package name="org.apache.poi.util*"/>
950       </group>
951       <group>
952         <title>Examples</title>
953         <package name="org.apache.poi.hpsf.examples*"/>
954         <package name="org.apache.poi.hssf.usermodel.examples*"/>
955       </group>
956     </javadoc>
958     <antcall target="clover.html"/>
959   </target>
963   <!-- ================================== -->
964   <!--       Generate records                -->
965   <!-- ================================== -->
967   <target name="generate-records" depends="init"
968     description="Generates HSSF records"> 
969     <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
970       <arg file="src/records/definitions"/>
971       <arg file="src/records/styles"/>
972       <arg file="src/java"/>
973       <arg file="src/testcases"/>
974       <classpath>
975         <path refid="scratchpad.classpath"/>
976         <pathelement location="${main.output.dir}"/>
977         <pathelement location="${scratchpad.output.dir}"/>
978       </classpath>
979     </java>  
980   </target>
982   <!-- ================================== -->
983   <!--       Generate types               -->
984   <!-- ================================== -->
986   <target name="generate-types" depends="init"
987     description="Generates word types">
988     <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
989       <arg file="src/types/definitions"/>
990       <arg file="src/types/styles"/>
991       <arg file="src/scratchpad/src"/>
992       <arg file="src/scratchpad/testcases"/>
993       <classpath>
994         <path refid="scratchpad.classpath">
995         </path>
996         <pathelement location="${main.output.dir}"/>
997         <pathelement location="${scratchpad.output.dir}"/>
998       </classpath>
999     </java>
1000   </target>
1004     <!-- Generates documentation and reports -->
1005     <target name="site" depends="reports, docs"
1006       description="Generates POI's website's contents"/>
1009     <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">
1010                 <!-- Copy the jar files into the maven jar directory -->
1011                 <!-- Same jars as for the main release, only lacking the datestamp -->
1012                 <copy
1013                         file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"
1014                         tofile="${mavendist.oap.dir}/jars/${jar.name}-${version.id}.jar" />
1015                 <copy
1016                         file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"
1017                         tofile="${mavendist.oap.dir}/jars/${jar.name}-contrib-${version.id}.jar" />
1018                 <copy
1019                         file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"
1020                         tofile="${mavendist.oap.dir}/jars/${jar.name}-scratchpad-${version.id}.jar" />
1022                 <!-- TODO: Decide about source jars, and copy them if we have some -->
1024                 <!-- Build the org.apache.poi poms -->
1025                 <!-- Copy from the base file, substituting in the version and -->
1026                 <!--  artificat, plus doing the core poi dependency as needed -->
1028                 <!-- Build the main pom -->
1029                 <copy 
1030                         file="poi.pom" 
1031                         tofile="${mavendist.oap.dir}/poms/${jar.name}-${version.id}.pom" 
1032                 >
1033                         <filterchain>
1034                                 <replacetokens>
1035                                         <token key="VERSION" value="${version.id}" />
1036                                         <token key="ARTIFICAT" value="poi" />
1037                                 </replacetokens>
1038                                 <tokenfilter>
1039                                         <filetokenizer/>
1040                                         <replaceregex pattern="START_NON_MAIN.*END_NON_MAIN_DEPENDENCY" replace="No POI dependency on the main jar" flags="s" />
1041                                 </tokenfilter>
1042                         </filterchain>
1043                 </copy>
1044                 <!-- And the contrib pom -->
1045                 <copy 
1046                         file="poi.pom" 
1047                         tofile="${mavendist.oap.dir}/poms/${jar.name}-contrib-${version.id}.pom" 
1048                 >
1049                         <filterchain>
1050                                 <replacetokens>
1051                                         <token key="VERSION" value="${version.id}" />
1052                                         <token key="ARTIFICAT" value="poi-contrib" />
1053                                 </replacetokens>
1054                                 <tokenfilter>
1055                                         <replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1056                                         <replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1057                                 </tokenfilter>
1058                         </filterchain>
1059                 </copy>
1060                 <!-- And the scratchpad pom -->
1061                 <copy 
1062                         file="poi.pom" 
1063                         tofile="${mavendist.oap.dir}/poms/${jar.name}-scratchpad-${version.id}.pom" 
1064                 >
1065                         <filterchain>
1066                                 <replacetokens>
1067                                         <token key="VERSION" value="${version.id}" />
1068                                         <token key="ARTIFICAT" value="poi-scratchpad" />
1069                                 </replacetokens>
1070                                 <tokenfilter>
1071                                         <replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1072                                         <replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1073                                 </tokenfilter>
1074                         </filterchain>
1075                 </copy>
1077                 <!-- Build the poi => org.apache.poi redirect poms -->
1078                 <!-- Copy from the base file, substituting in the version+artifact -->
1079                 <copy 
1080                         file="poi-redirect.pom" 
1081                         tofile="${mavendist.poi.dir}/poms/${jar.name}-${version.id}.pom" 
1082                 >
1083                         <filterchain><replacetokens>
1084                                 <token key="VERSION" value="${version.id}" />
1085                                 <token key="ARTIFICAT" value="poi" />
1086                         </replacetokens></filterchain>
1087                 </copy>
1088                 <copy 
1089                         file="poi-redirect.pom" 
1090                         tofile="${mavendist.poi.dir}/poms/${jar.name}-contrib-${version.id}.pom" 
1091                 >
1092                         <filterchain><replacetokens>
1093                                 <token key="VERSION" value="${version.id}" />
1094                                 <token key="ARTIFICAT" value="poi-contrib" />
1095                         </replacetokens></filterchain>
1096                 </copy>
1097                 <copy 
1098                         file="poi-redirect.pom" 
1099                         tofile="${mavendist.poi.dir}/poms/${jar.name}-scratchpad-${version.id}.pom" 
1100                 >
1101                         <filterchain><replacetokens>
1102                                 <token key="VERSION" value="${version.id}" />
1103                                 <token key="ARTIFICAT" value="poi-scratchpad" />
1104                         </replacetokens></filterchain>
1105                 </copy>
1107                 <!-- And that's it for maven -->
1108         </target>
1110     <target name="jar" depends="compile" description="Creates jar files for distribution">
1111         <jar destfile="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar">
1112                         <fileset dir="${main.output.dir}" />
1113                         <fileset dir="legal/" />
1114             <manifest>
1115                 <attribute name="Built-By" value="${user.name}"/>
1116                 <attribute name="Specification-Title" value="Apache POI"/>
1117                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1118                 <attribute name="Specification-Vendor" value="Apache"/>
1119                 <attribute name="Implementation-Title" value="Apache POI"/>
1120                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1121                 <attribute name="Implementation-Vendor" value="Apache"/>
1122             </manifest>        
1123         </jar>
1124         <jar destfile="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar">
1125                         <fileset dir="${contrib.output.dir}" />
1126                         <fileset dir="legal/" />
1127             <manifest>
1128                 <attribute name="Built-By" value="${user.name}"/>
1129                 <attribute name="Specification-Title" value="Apache POI"/>
1130                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1131                 <attribute name="Specification-Vendor" value="Apache"/>
1132                 <attribute name="Implementation-Title" value="Apache POI"/>
1133                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1134                 <attribute name="Implementation-Vendor" value="Apache"/>
1135             </manifest>        
1136         </jar>
1137         <jar destfile="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar">
1138                         <fileset dir="${scratchpad.output.dir}" />
1139                         <fileset dir="legal/" />
1140             <manifest>
1141                 <attribute name="Built-By" value="${user.name}"/>
1142                 <attribute name="Specification-Title" value="Apache POI"/>
1143                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1144                 <attribute name="Specification-Vendor" value="Apache"/>
1145                 <attribute name="Implementation-Title" value="Apache POI"/>
1146                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1147                 <attribute name="Implementation-Vendor" value="Apache"/>
1148             </manifest>        
1149         </jar>
1150     </target>
1151     <target name="jar-ooxml" depends="compile-ooxml" description="Creates the ooxml jar files for distribution">
1152         <jar destfile="${dist.dir}/${jar.name}-ooxml-${version.id}-${DSTAMP}.jar">
1153                         <fileset dir="${ooxml.output.dir}" />
1154                         <fileset dir="legal/" />
1155             <manifest>
1156                 <attribute name="Built-By" value="${user.name}"/>
1157                 <attribute name="Specification-Title" value="Apache POI"/>
1158                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1159                 <attribute name="Specification-Vendor" value="Apache"/>
1160                 <attribute name="Implementation-Title" value="Apache POI"/>
1161                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1162                 <attribute name="Implementation-Vendor" value="Apache"/>
1163             </manifest>        
1164         </jar>
1165     </target>
1167   <target name="dist" depends="clean, fail-unless-tools-are-available, compile, site, jar"
1168     description="Creates the entire distribution into build/dist, from scratch">
1170         <property name="zipdir" value="${jar.name}-${version.id}" />
1172     <zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
1173       <zipfileset dir="legal/" prefix="${zipdir}" />
1174       <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1175       <zipfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1176       <zipfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1177       <zipfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1178     </zip>
1180     <zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
1181       <zipfileset dir="legal/" prefix="${zipdir}" />
1182       <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1183       <zipfileset dir="." prefix="${zipdir}">
1184         <exclude name="build/**"/>
1185         <exclude name="scripts/**"/>
1186         <exclude name="*.ipr"/>
1187         <exclude name="*.iml"/>
1188         <exclude name="*.iws"/>
1189         <exclude name="*.swp"/>
1190       </zipfileset>
1191     </zip>
1193     <tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz"
1194       compression="gzip">
1195       <tarfileset dir="legal/" prefix="${zipdir}" />
1196       <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1197       <tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1198       <tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1199       <tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1200     </tar>
1202     <tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz"
1203       compression="gzip">
1204       <tarfileset dir="legal/" prefix="${zipdir}" />
1205       <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1206       <tarfileset dir="." prefix="${zipdir}">
1207         <exclude name="build/**"/>
1208         <exclude name="scripts/**"/>
1209         <exclude name="*.ipr"/>
1210         <exclude name="*.iml"/>
1211         <exclude name="*.iws"/>
1212         <exclude name="*.swp"/>
1213       </tarfileset>
1214     </tar>
1216     <echo>Distribution located in build/dist</echo>
1217   </target>
1219   <target name="clean-compile" depends="clean, compile"/>
1221   <target name="clean-dist" depends="clean, dist"
1222     description="Cleans the build directory then creates a distribution"/>
1224   <target name="gump" depends="test, jar"/>
1228   <!-- Generates the Ant document type definition (DTD) -->
1229   <target name="dtd"
1230     description="Generates the Ant document type definition (DTD)">
1231     <antstructure output="ant.dtd"/>
1232   </target>
1237   <!-- Abort the build if JUnit is missing. -->
1238   <target name="fail-unless-junit-is-available" depends="init">
1239     <condition property="isAvailable.junit">
1240       <available classname="junit.framework.TestCase"/>
1241     </condition>
1242     <antcall target="fail-junit"/>
1243   </target>
1245   <target name="fail-junit" unless="isAvailable.junit">
1246     <echo>
1247       JUnit is not available. You must download JUnit from
1248       &lt;http://www.junit.org/&gt; and include the JAR file in your
1249       classpath.
1250     </echo> 
1251     <fail message="JUnit is not available."/>
1252   </target>
1254   <!-- Warn if JUnit is missing. -->
1255   <target name="warn-unless-junit-is-available" depends="init">
1256     <condition property="isAvailable.junit">
1257       <available classname="junit.framework.TestCase"/>
1258     </condition>
1259     <antcall target="warn-junit"/>
1260   </target>
1262   <target name="warn-junit" unless="isAvailable.junit">
1263     <echo>
1264       WARNING: Since JUnit is not available you might encounter failures
1265       subsequently. In order to avoid this you should download JUnit from
1266       &lt;http://www.junit.org/&gt; and include the JAR file in your
1267       classpath.
1268     </echo> 
1269   </target>
1273   <!-- Abort the build if JDepend is missing. -->
1274   <target name="fail-unless-jdepend-is-available" depends="init">
1275     <condition property="isAvailable.jdepend">
1276       <available classname="jdepend.framework.JDepend"/>
1277     </condition>
1278     <antcall target="fail-jdepend"/>
1279   </target>
1281   <target name="fail-jdepend" unless="isAvailable.jdepend">
1282     <echo>
1283       JDepend is not available. You must download JDepend from
1284       &lt;http://www.clarkware.com/software/JDepend.html&gt; and include the
1285       JAR file in your classpath.
1286     </echo> 
1287     <fail message="JDepend is not available."/>
1288   </target>
1292   <!-- Abort the build if an XSLT processor is missing. -->
1293   <target name="fail-unless-xslt-is-available" depends="init">
1294     <condition property="isAvailable.xslt">
1295       <available classname="javax.xml.transform.TransformerFactory"/>
1296     </condition>
1297     <antcall target="fail-xslt"/>
1298   </target>
1300   <target name="fail-xslt" unless="isAvailable.xslt">
1301     <echo>
1302       An XSLT processor is missing. You must download e.g. Xalan from
1303       &lt;http://xml.apache.org/xalan-j/&gt; and include the JAR file in your
1304       classpath.
1305     </echo> 
1306     <fail message="An XSLT processor is not available."/>
1307   </target>
1309   <!-- Warn if an XSLT processor is missing. -->
1310   <target name="warn-unless-xslt-is-available" depends="init">
1311     <condition property="isAvailable.xslt">
1312       <available classname="javax.xml.transform.TransformerFactory"/>
1313     </condition>
1314     <antcall target="warn-xslt"/>
1315   </target>
1317   <target name="warn-xslt" unless="isAvailable.xslt">
1318     <echo>
1319       WARNING: Since an XSLT processor is not available you might encounter
1320       failures subsequently. In order to avoid this you should download
1321       e.g. Xalan from &lt;http://xml.apache.org/xalan-j/&gt; and include the
1322       JAR file in your classpath.
1323     </echo> 
1324   </target>
1328   <!-- Aborts the build if any of the required tools are missing. -->
1329   <target name="fail-unless-tools-are-available"
1330     depends="fail-unless-junit-is-available, fail-unless-junit-is-available,
1331     fail-unless-jdepend-is-available"/>
1335   <!-- Runs jdepend to produce a report about package dependencies -->
1336   <target name="jdepend" depends="fail-unless-jdepend-is-available"
1337     description="Runs jdepend to produce a report about package dependencies">
1338     <jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
1339       <classespath>
1340         <pathelement location="${main.output.dir}"/>
1341         <pathelement location="${contrib.output.dir}"/>
1342         <pathelement location="${scratchpad.output.dir}"/>
1343       </classespath>
1344       <classpath>
1345         <path refid="main.classpath"/>
1346         <path refid="contrib.classpath"/>
1347         <path refid="scratchpad.classpath"/>
1348       </classpath>
1349     </jdepend>
1351     <style basedir="${jdepend.report.dir}"
1352       in="${jdepend.report.dir}/jdepend.xml"
1353       out="${jdepend.report.out.dir}/index.html"
1354       style="jdepend.xsl"/>
1355   </target>
1357 </project>
1359 <!-- Keep this comment at the end of the file
1360 Local variables:
1361 mode: xml
1362 sgml-omittag:nil
1363 sgml-shorttag:nil
1364 sgml-namecase-general:nil
1365 sgml-general-insert-case:lower
1366 sgml-minimize-attributes:nil
1367 sgml-always-quote-attributes:t
1368 sgml-indent-step:2
1369 sgml-indent-data:t
1370 sgml-parent-document:nil
1371 sgml-exposed-tags:nil
1372 sgml-local-catalogs:nil
1373 sgml-local-ecat-files:nil
1374 End: