Fix for SharedStringsTable in ooxml excel support, and related test updates now we...
[poi.git] / build.xml
blobb790d5689b6ce6fde0268e2afd8d350ba508016e
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.
49     TO BE COMPLETED:
51     Convert book.xml files to a sitemap.
53  -->
54 <project name="POI Build" default="help" basedir=".">
56   <description>
57     The POI project Ant build.
58   </description>
60   <property environment="env"/>
62   <property name="repository" value="http://www.ibiblio.org/maven"/>
63   <property name="forrest.home" value="${env.FORREST_HOME}"/>
65   <!-- Main: -->
66   <property name="main.resource1.dir" value="src/resources/fontmetrics"/>
67   <property name="main.src" location="src/java"/>
68   <property name="main.src.test" location="src/testcases"/>
69   <property name="main.documentation" value="src/documentation"/>
70   <property name="main.output.dir" location="build/classes"/>
71   <property name="main.output.test.dir" location="build/test-classes"/>
72   <property name="main.lib" location="lib"/>
73   <property name="ooxml.lib" location="ooxml-lib"/>
74   <property name="main.reports.test" location="build/test-results"/>
75   <property name="main.jar1.dir" location="${main.lib}/commons-logging-1.1.jar"/>
76   <property name="main.jar1.url" value="${repository}/commons-logging/jars/commons-logging-1.1.jar"/>
77   <property name="main.jar2.dir" location="${main.lib}/log4j-1.2.13.jar"/>
78   <property name="main.jar2.url" value="${repository}/log4j/jars/log4j-1.2.13.jar"/>
79   <property name="main.testokfile" location="build/main-testokfile.txt"/>
81   <property name="junit.jar1.dir" location="${main.lib}/junit-3.8.1.jar"/>
82   <property name="junit.jar1.url" value="${repository}/junit/jars/junit-3.8.1.jar"/>
84   <!-- Scratchpad: -->
85   <property name="scratchpad.src" location="src/scratchpad/src"/>
86   <property name="scratchpad.src.test" location="src/scratchpad/testcases"/>
87   <property name="scratchpad.lib" location="src/scratchpad/lib"/>
88   <property name="scratchpad.reports.test" location="build/scratchpad-test-results"/>
89   <property name="scratchpad.output.dir" location="build/scratchpad-classes"/>
90   <property name="scratchpad.output.test.dir" location="build/scratchpad-test-classes"/>
91   <property name="scratchpad.testokfile" location="build/scratchpad-testokfile.txt"/>
93   <!-- Contributed software: -->
94   <property name="contrib.src" location="src/contrib/src"/>
95   <property name="contrib.src.test" location="src/contrib/testcases"/>
96   <property name="contrib.lib" location="src/contrib/lib"/>
97   <property name="contrib.reports.test" location="build/contrib-test-results"/>
98   <property name="contrib.output.dir" location="build/contrib-classes"/>
99   <property name="contrib.output.test.dir" location="build/contrib-test-classes"/>
100   <property name="contrib.jar1.dir" location="${contrib.lib}/commons-beanutils-1.7.0.jar"/>
101   <property name="contrib.jar1.url" value="${repository}/commons-beanutils/jars/commons-beanutils-1.7.0.jar"/>
102   <property name="contrib.jar2.dir" location="${contrib.lib}/commons-collections-3.2.jar"/>
103   <property name="contrib.jar2.url" value="${repository}/commons-collections/jars/commons-collections-3.2.jar"/>
104   <property name="contrib.jar3.dir" location="${contrib.lib}/commons-lang-2.1.jar"/>
105   <property name="contrib.jar3.url" value="${repository}/commons-lang/jars/commons-lang-2.1.jar"/>
106   <property name="contrib.testokfile" location="build/contrib-testokfile.txt"/>
108   <!-- Examples: -->
109   <property name="examples.src" location="src/examples/src"/>
110   <property name="examples.src.test" location="src/examples/testcases"/>
111   <property name="examples.lib" location="src/examples/lib"/>
112   <property name="examples.reports.test" location="build/examples-test-results"/>
113   <property name="examples.output.dir" location="build/examples-classes"/>
114   <property name="examples.output.test.dir" location="build/examples-test-classes"/>
115   <property name="examples.jar1.dir" location="${examples.lib}/commons-beanutils-1.7.0.jar"/>
116   <property name="examples.jar1.url" value="${repository}/commons-beanutils/jars/commons-beanutils-1.7.0.jar"/>
117   <property name="examples.jar2.dir" location="${examples.lib}/commons-collections-3.2.jar"/>
118   <property name="examples.jar2.url" value="${repository}/commons-collections/jars/commons-collections-3.2.jar"/>
119   <property name="examples.jar3.dir" location="${examples.lib}/commons-lang-2.1.jar"/>
120   <property name="examples.jar3.url" value="${repository}/commons-lang/jars/commons-lang-2.1.jar"/>
121   <property name="examples.testokfile" location="build/examples-testokfile.txt"/>
123   <!-- Experimental OOXML support: -->
124   <property name="ooxml.src" location="src/scratchpad/ooxml-src"/>
125   <property name="ooxml.src.test" location="src/scratchpad/ooxml-testcases"/>
126   <property name="ooxml.reports.test" location="build/ooxml-test-results"/>
127   <property name="ooxml.output.dir" location="build/ooxml-classes"/>
128   <property name="ooxml.output.test.dir" location="build/ooxml-test-classes"/>
129   <property name="ooxml.testokfile" location="build/ooxml-testokfile.txt"/>
131   <property name="ooxml.jar1.dir" location="${ooxml.lib}/dom4j-1.6.1.jar"/>
132   <property name="ooxml.jar1.url" value="${repository}/dom4j/jars/dom4j-1.6.1.jar"/>
133   <property name="ooxml.jar2.dir" location="${ooxml.lib}/jaxen-1.1.jar"/>
134   <property name="ooxml.jar2.url" value="${repository}/jaxen/jars/jaxen-1.1.jar"/>
135   <property name="ooxml.jar3.dir" location="${ooxml.lib}/xmlbeans-2.3.0.jar"/>
136   <property name="ooxml.jar3.url" value="${repository}/org.apache.xmlbeans/jars/xmlbeans-2.3.0.jar"/>
137   <property name="ooxml.jar4.dir" location="${ooxml.lib}/jsr173_1.0_api.jar"/>
138   <property name="ooxml.jar4.url" value="${repository}/xmlbeans/jars/jsr173_1.0_api.jar"/>
139   <!-- No official release of openxml4j yet -->
140   <property name="ooxml.jar5.dir" location="${ooxml.lib}/openxml4j-bin-prealpha-071224.jar"/>
141   <property name="ooxml.jar5.url" value="http://people.apache.org/~nick/openxml4j-bin-prealpha-071224.jar"/>
143   <!-- See http://www.ecma-international.org/publications/standards/Ecma-376.htm -->
144   <!-- "Copy these file(s), free of charge" -->
145   <property name="ooxml.xsds.ozip" location="${ooxml.lib}/OfficeOpenXML-Part4.zip"/>
146   <property name="ooxml.xsds.izip" location="${ooxml.lib}/OfficeOpenXML-XMLSchema.zip"/>
147   <property name="ooxml.xsds.url" value="http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%20Part%204%20(DOCX).zip" />
148   <property name="ooxml.xsds.jar" location="${ooxml.lib}/ooxml-schemas.jar"/>
150   <property name="build.site" location="build/tmp/site/build/site"/>
151   <property name="build.site.src" location="build/tmp/site"/>
152   <property name="junit.report.dir" location="${build.site}/junit"/>
153   <property name="jdepend.report.dir" location="${build.site}/jdepend"/>
154   <property name="jdepend.report.out.dir" location="${build.site.src}/src/documentation/content/jdepend"/>
155   <property name="apidocs.report.dir" location="${build.site}/apidocs"/>
156   <property name="changelog.file" location="${build.site}/changelog.html"/>
157   <property name="dist.dir" location="build/dist"/>
158   <property name="mavendist.dir" location="build/maven-dist"/>
159   <property name="mavendist.poi.dir" location="build/maven-dist/poi"/>
160   <property name="mavendist.oap.dir" location="build/maven-dist/org.apache.poi"/>
161   <property name="jar.name" value="poi"/>
162   <property name="version.id" value="3.0.2-beta1"/>
163   <property name="halt.on.test.failure" value="true"/>
164   <property name="jdk.version.source" value="1.3"
165     description="JDK version of source code"/>
166   <property name="jdk.version.class" value="1.3"
167     description="JDK version of generated class files"/>  
170     <path id="main.classpath">
171         <pathelement location="${main.jar1.dir}"/>
172         <pathelement location="${main.jar2.dir}"/>
173         <pathelement location="${main.resource1.dir}"/>
174     </path>
176     <path id="scratchpad.classpath">
177         <path refid="main.classpath"/>
178         <pathelement location="${main.output.dir}"/>
179     </path>
181     <path id="contrib.classpath">
182         <path refid="main.classpath"/>
183         <pathelement location="${contrib.jar1.dir}"/>
184         <pathelement location="${contrib.jar2.dir}"/>
185         <pathelement location="${contrib.jar3.dir}"/>
186         <pathelement location="${main.output.dir}"/>
187         <pathelement location="${main.output.test.dir}"/>
188         <pathelement location="${scratchpad.output.dir}"/>
189         <pathelement location="${scratchpad.output.test.dir}"/>
190         <pathelement location="${contrib.output.dir}"/>
191         <pathelement location="${contrib.output.test.dir}"/>
192     </path>
194     <path id="ooxml.classpath">
195         <path refid="main.classpath"/>
196         <path refid="scratchpad.classpath"/>
197         <fileset dir="${ooxml.lib}">
198                         <include name="*.jar" />
199                 </fileset>
200     </path>
203   <path id="examples.classpath">
204     <path refid="main.classpath"/>
205     <pathelement location="${main.output.dir}"/>
206   </path>
210   <!-- Prints POI's Ant usage help -->
211   <target name="help" description="Prints POI's Ant usage help">
212     <echo>
213       - Execute "ant -projecthelp" to view a listing of the main build
214         targets.
215       - Execute "ant help-properties" to view a listing of some properties
216         controlling the build process.
217     </echo>
218   </target>
222   <target name="help-properties"
223     description="Prints a listing of build controlling properties">
224     <echo>
225       The following properties control the build process:
227       -Ddisconnected="true": Do not execute any targets that require an online
228           connection to the Internet.
229       -Dtestcase=org.apache.poi.xxx.xxx : for the single-test target, specify
230               the test to run
232       WARNING: This list is not exhaustive.
233     </echo>
234   </target>
238     <target name="with.clover" if="clover.present">
239         <taskdef resource="clovertasks"/>
240         <clover-setup initString="mycoverage.db"/>
241     </target>
243     <target name="clover.html" depends="with.clover" if="clover.present">
244         <echo>Generating clover report</echo>
245        <clover-report>
246           <current outfile="build/tmp/site/build/site/clover_html">
247              <format type="html"/>
248           </current>
249        </clover-report>
250     </target>
252     <target name="init" depends="check-jars,fetch-jars">
254         <tstamp>
255           <format property="tstamp.year" pattern="yyyy"/>
256         </tstamp>
258         <available resource="clovertasks" property="clover.present"/>
259         <antcall target="with.clover"/>
260         
261         <mkdir dir="build"/>
262         <mkdir dir="${main.output.dir}"/>
263         <mkdir dir="${scratchpad.output.dir}"/>
264         <mkdir dir="${contrib.output.dir}"/>
265         <mkdir dir="${examples.output.dir}"/>
266         <mkdir dir="${ooxml.output.dir}"/>
267         <mkdir dir="${main.output.test.dir}"/>
268         <mkdir dir="${contrib.output.test.dir}"/>
269         <mkdir dir="${scratchpad.output.test.dir}"/>
270         <mkdir dir="${ooxml.output.test.dir}"/>
271         <mkdir dir="${main.reports.test}"/>
272         <mkdir dir="${scratchpad.reports.test}"/>
273         <mkdir dir="${contrib.reports.test}"/>
274         <mkdir dir="${ooxml.reports.test}"/>
275         <mkdir dir="${junit.report.dir}"/>
276         <mkdir dir="${jdepend.report.dir}"/>
277         <mkdir dir="${jdepend.report.out.dir}"/>
278         <mkdir dir="${apidocs.report.dir}"/>
279         <mkdir dir="${dist.dir}"/>
280         <mkdir dir="${build.site.src}/${main.documentation}"/>
282         <mkdir dir="${mavendist.dir}"/>
283         <mkdir dir="${mavendist.poi.dir}"/>
284         <mkdir dir="${mavendist.poi.dir}/poms"/>
285         <mkdir dir="${mavendist.oap.dir}"/>
286         <mkdir dir="${mavendist.oap.dir}/jars"/>
287         <mkdir dir="${mavendist.oap.dir}/poms"/>
289         <copy todir="${build.site.src}/${main.documentation}">
290             <fileset dir="${main.documentation}"/>
291         </copy>
292         <copy file="forrest.properties" tofile="${build.site.src}/forrest.properties"/>
293     </target>
295     <target name="clean">
296         <delete dir="build"/>
297     </target>
299     <target name="check-jars">
300         <condition property="jars.present">
301             <or>
302                 <and>
303                     <available file="${main.jar1.dir}"/>
304                     <available file="${main.jar2.dir}"/>
305                     <available file="${contrib.jar1.dir}"/>
306                     <available file="${contrib.jar2.dir}"/>
307                     <available file="${contrib.jar3.dir}"/>
308                     <available file="${junit.jar1.dir}"/>
309                     <available file="${ooxml.jar1.dir}"/>
310                     <available file="${ooxml.jar2.dir}"/>
311                     <available file="${ooxml.jar3.dir}"/>
312                     <available file="${ooxml.jar4.dir}"/>
313                     <available file="${ooxml.jar5.dir}"/>
314                 </and>
315                 <isset property="disconnected"/>
316             </or>
317         </condition>
318     </target>
320     <target name="fetch-jars" unless="jars.present"
321      description="Fetches needed JAR files from the Internet">
322         <get src="${main.jar1.url}" dest="${main.jar1.dir}"/>
323         <get src="${main.jar2.url}" dest="${main.jar2.dir}"/>
324         <get src="${contrib.jar1.url}" dest="${contrib.jar1.dir}"/>
325         <get src="${contrib.jar2.url}" dest="${contrib.jar2.dir}"/>
326         <get src="${contrib.jar3.url}" dest="${contrib.jar3.dir}"/>
327         <get src="${junit.jar1.url}" dest="${junit.jar1.dir}"/>
329         <get src="${ooxml.jar1.url}" dest="${ooxml.jar1.dir}"/>
330         <get src="${ooxml.jar2.url}" dest="${ooxml.jar2.dir}"/>
331         <get src="${ooxml.jar3.url}" dest="${ooxml.jar3.dir}"/>
332         <get src="${ooxml.jar4.url}" dest="${ooxml.jar4.dir}"/>
333         <get src="${ooxml.jar5.url}" dest="${ooxml.jar5.dir}"/>
334     </target>
336         <target name="check-ooxml-xsds">
337         <condition property="ooxml-xsds.present">
338             <or>
339                 <and>
340                     <available file="${ooxml.xsds.izip}"/>
341                 </and>
342                 <isset property="disconnected"/>
343             </or>
344         </condition>
345         </target>
346     <target name="fetch-ooxml-xsds" unless="ooxml-xsds.present"
347      description="Fetches needed OOXML xsd files from the Internet">
348         <get src="${ooxml.xsds.url}" dest="${ooxml.xsds.ozip}"/>
349                 <unzip src="${ooxml.xsds.ozip}" dest="${ooxml.lib}">
350                         <patternset>
351                                 <include name="OfficeOpenXML-XMLSchema.zip" />
352                         </patternset>
353                 </unzip>
354         </target>
355         <target name="check-compiled-ooxml-xsds">
356         <condition property="ooxml-compiled-xsds.present">
357             <or>
358                 <and>
359                     <available file="${ooxml.xsds.jar}"/>
360                 </and>
361                 <isset property="disconnected"/>
362             </or>
363         </condition>
364         </target>
365         <target name="compile-ooxml-xsds" unless="ooxml-compiled-xsds.present"
366          depends="check-jars,fetch-jars,check-ooxml-xsds,fetch-ooxml-xsds,check-compiled-ooxml-xsds"
367          description="Unpacks the OOXML xsd files, and compiles them into XmlBeans">
368                 <taskdef name="xmlbean"
369                         classname="org.apache.xmlbeans.impl.tool.XMLBean"
370                         classpath="${ooxml.jar3.dir}:${ooxml.jar4.dir}" />
372                 <unzip src="${ooxml.xsds.izip}" dest="build/ooxml-xsds/" />
373                 <!--
374                         schema="build/ooxml-xsds/"
375                         schema="build/ooxml-xsds/sml-workbook.xsd"
376                 -->
377                 <xmlbean
378                         schema="build/ooxml-xsds/"
379                         destfile="${ooxml.xsds.jar}"
380                         javasource="1.4"
381                         failonerror="false"
382                         fork="true"
383                         memoryMaximumSize="512m"
384                 >
385                         <classpath refid="ooxml.classpath"/>
386                 </xmlbean>
387         </target>
389   <target name="compile" depends="init, compile-main, compile-scratchpad,
390     compile-contrib, compile-examples"
391     description="Compiles the POI main classes, scratchpad, contrib, and examples"/>
393   <target name="compile-main" depends="fail-unless-xslt-is-available">
394     <copy todir="${main.output.dir}">
395       <fileset dir="${main.resource1.dir}"/>
396     </copy>
397     <javac target="${jdk.version.class}" source="${jdk.version.source}"
398       failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
399       srcdir="${main.src}">
400       <classpath refid="main.classpath"/>
401     </javac>
402     <javac target="${jdk.version.class}" source="${jdk.version.source}"
403       failonerror="true" destdir="${main.output.test.dir}" debug="on"
404       fork="yes" srcdir="${main.src.test}">
405       <classpath>
406         <path refid="main.classpath"/>
407         <pathelement location="${main.output.dir}"/>
408         <pathelement location="${junit.jar1.dir}"/>
409       </classpath>
410     </javac>
411   </target>
413   <target name="compile-scratchpad" depends="init,compile-main">
414     <javac target="${jdk.version.class}" source="${jdk.version.source}"
415       failonerror="true" destdir="${scratchpad.output.dir}" debug="on"
416       fork="yes" srcdir="${scratchpad.src}">
417       <classpath refid="scratchpad.classpath"/>
418     </javac>
419     <javac target="${jdk.version.class}" source="${jdk.version.source}"
420       failonerror="true" destdir="${scratchpad.output.test.dir}" debug="on"
421       fork="yes" srcdir="${scratchpad.src.test}">
422       <classpath>
423         <path refid="scratchpad.classpath"/>
424         <pathelement location="${scratchpad.output.dir}"/>
425         <pathelement location="${junit.jar1.dir}"/>
426       </classpath>
427     </javac>
429         <!-- Copy HSLF Resources over -->
430         <property name="hslf.data" value="org/apache/poi/hslf/data" />
431         <mkdir dir="${scratchpad.output.dir}/${hslf.data}" />
432         <copy todir="${scratchpad.output.dir}/${hslf.data}">
433                 <fileset dir="${scratchpad.src}/${hslf.data}">
434                         <include name="*.ppt" />
435                 </fileset>
436         </copy>
438         <!-- Copy HDGF Resources over -->
439         <property name="hdgf.chunks" value="org/apache/poi/hdgf/chunks" />
440         <copy todir="${scratchpad.output.dir}/${hdgf.chunks}">
441                 <fileset dir="${scratchpad.src}/${hdgf.chunks}">
442                         <include name="*.tbl" />
443                 </fileset>
444         </copy>
445   </target>
447   <target name="compile-contrib" depends="init">
448     <javac target="${jdk.version.class}" source="${jdk.version.source}"
449       failonerror="true" destdir="${contrib.output.dir}" debug="on" fork="yes"
450       srcdir="${contrib.src}">
451       <classpath refid="contrib.classpath"/>
452     </javac>
453     <javac target="${jdk.version.class}" source="${jdk.version.source}"
454       failonerror="true" destdir="${contrib.output.test.dir}" debug="on"
455       fork="yes" srcdir="${contrib.src.test}">
456       <classpath>
457         <path refid="contrib.classpath"/>
458         <pathelement location="${contrib.output.dir}"/>
459         <pathelement location="${junit.jar1.dir}"/>
460       </classpath>
461     </javac>
462   </target>
464   <target name="compile-examples" depends="init">
465     <javac target="${jdk.version.class}" source="${jdk.version.source}"
466       destdir="${examples.output.dir}" debug="on" srcdir="${examples.src}">
467       <classpath refid="examples.classpath"/>
468     </javac>
469   </target>
471   <target name="compile-ooxml" depends="init, check-ooxml-xsds, fetch-ooxml-xsds, compile-ooxml-xsds, compile-main">
472         <!-- openxml4j requires java 1.5, so so must we, for now -->
473     <javac target="1.5" source="1.5"
474       destdir="${ooxml.output.dir}" debug="on" srcdir="${ooxml.src}">
475       <classpath refid="ooxml.classpath"/>
476     </javac>
477   </target>
479   <target name="test" depends="test-main,test-scratchpad,test-contrib"
480     description="Tests main, contrib and scratchpad"/>
482     <target name="-test-main-check">
483         <uptodate property="main.test.notRequired" targetfile="${main.testokfile}">
484             <srcfiles dir="${main.src}"/>
485             <srcfiles dir="${main.src.test}"/>
486         </uptodate>
487     </target>
489     <path id="test.classpath">
490         <path refid="main.classpath"/>
491         <pathelement location="${main.output.dir}"/>
492         <pathelement location="${main.output.test.dir}"/>
493         <pathelement location="${junit.jar1.dir}"/>
494     </path>
496   <target name="test-main" unless="main.test.notRequired"
497     depends="compile-main, -test-main-check, fail-unless-junit-is-available">
498     <junit fork="no" printsummary="yes" haltonfailure="${halt.on.test.failure}"
499       failureproperty="main.test.failed" showoutput="true">
500       <classpath refid="test.classpath"/>
501       <sysproperty key="HSSF.testdata.path"
502         file="${main.src.test}/org/apache/poi/hssf/data"/> 
503       <sysproperty key="HSLF.testdata.path"
504         file="${main.src.test}/org/apache/poi/hslf/data"/> 
505       <sysproperty key="HWPF.testdata.path"
506         file="${main.src.test}/org/apache/poi/hwpf/data"/> 
507       <sysproperty key="HPSF.testdata.path"
508         file="${main.src.test}/org/apache/poi/hpsf/data"/> 
509       <sysproperty key="java.awt.headless" value="true"/>
510       <formatter type="plain"/>
511       <formatter type="xml"/>
512       <batchtest todir="${main.reports.test}">
513         <fileset dir="${main.src.test}">
514           <include name="**/Test*.java"/>
515           <exclude name="**/AllTests.java"/>
516           <exclude name="**/TestEmptyDocument.java"/>
517           <exclude name="**/TestUnfixedBugs.java"/>
518           <exclude name="**/TestcaseRecordInputStream.java"/>
519         </fileset>
520       </batchtest>
521     </junit>
522     <delete file="${main.testokfile}"/>
523     <antcall target="-test-main-write-testfile"/>
524   </target>
526   <target name="test-fail" depends="compile-main,
527     fail-unless-junit-is-available"
528     description="run tests that are known to fail">
529     <junit printsummary="yes" showoutput="true" filtertrace="no"
530       haltonfailure="false">
531       <classpath refid="test.classpath"/>
532       <classpath>
533         <path refid="scratchpad.classpath"/>
534         <pathelement location="${main.output.dir}"/>
535         <pathelement location="${scratchpad.output.dir}"/>
536         <pathelement location="${scratchpad.output.test.dir}"/>
537         <pathelement location="${junit.jar1.dir}"/>
538       </classpath>
539       <sysproperty key="HSSF.testdata.path"
540         file="${main.src.test}/org/apache/poi/hssf/data"/>
541       <sysproperty key="HPSF.testdata.path"
542         file="${main.src.test}/org/apache/poi/hpsf/data"/>
543       <sysproperty key="HWPF.testdata.path"
544         file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
545       <sysproperty key="java.awt.headless" value="true"/>
546       <formatter type="plain" usefile="no"/>
547       <batchtest todir="${main.reports.test}">
548         <fileset dir="${main.src.test}">
549           <include name="**/TestEmptyDocument.java"/>
550           <include name="**/TestUnfixedBugs.java"/>
551         </fileset>
552       </batchtest>
553     </junit>
554   </target>        
558     <target name="single-test" depends="-test-property-check,compile-main" description="Runs a single test case specified with -Dtestcase=classname">
559         <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
560             <classpath refid="test.classpath"/>
561                  <classpath>
562                                 <path refid="test.classpath"/>
563                                 <pathelement location="${main.output.dir}"/>
564                                 <pathelement location="${scratchpad.output.dir}"/>
565                                 <pathelement location="${scratchpad.output.test.dir}"/>
566                                 <pathelement location="${junit.jar1.dir}"/>
567                             </classpath>
568             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
569             <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
570             <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
571             <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
572             <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
573             <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
574                 <sysproperty key="java.awt.headless" value="true"/>
575             <formatter type="plain" usefile="no"/>
576             <formatter type="xml"/>
577             <test name="${testcase}"/>
578         </junit>
579     </target>
581     <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." >
582             <echo>Waiting for debugger on port 5001</echo>    
583         <junit printsummary="no" showoutput="true" filtertrace="no" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed">
584             <jvmarg value="-Xdebug"/>
585             <jvmarg value="-Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=y"/>
586             <sysproperty key="java.compiler" value="NONE"/>
587             <classpath refid="test.classpath"/>
588             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
589             <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
590             <sysproperty key="java.awt.headless" value="true"/>
591             <formatter type="plain" usefile="no"/>
592             <test name="${testcase}"/>
593         </junit>
594     </target>
596     <target name="-test-property-check" unless="testcase">
597         <echo message="Please use -Dtestcase=org.your.testcase to run a single test"/>
598         <fail/>
599     </target>
601     <target name="-test-main-write-testfile" unless="main.test.failed">
602         <echo file="${main.testokfile}" append="false" message="testok"/>
603     </target>
605     <target name="-test-scratchpad-check">
606         <uptodate property="scratchpad.test.notRequired" targetfile="${scratchpad.testokfile}">
607             <srcfiles dir="${scratchpad.src}"/>
608             <srcfiles dir="${scratchpad.src.test}"/>
609         </uptodate>
610     </target>
612     <target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check" unless="scratchpad.test.notRequired">
613         <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="scratchpad.test.failed">
614             <classpath>
615                 <path refid="scratchpad.classpath"/>
616                 <pathelement location="${main.output.dir}"/>
617                 <pathelement location="${scratchpad.output.dir}"/>
618                 <pathelement location="${scratchpad.output.test.dir}"/>
619                 <pathelement location="${junit.jar1.dir}"/>
620             </classpath>
621             <sysproperty key="HSSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hssf/data"/>
622             <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
623             <sysproperty key="HDF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdf/data"/>
624             <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
625             <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
626             <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
627             <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
628             <sysproperty key="java.awt.headless" value="true"/>
629             <formatter type="plain"/>
630             <formatter type="xml"/>
631             <batchtest todir="${scratchpad.reports.test}">
632                 <fileset dir="${scratchpad.src.test}">
633                     <include name="**/Test*.java"/>
634                     <exclude name="**/AllTests.java"/>
635                 </fileset>
636             </batchtest>
637         </junit>
638         <delete file="${scratchpad.testokfile}"/>
639         <antcall target="-test-scratchpad-write-testfile"/>
640     </target>
642     <target name="-test-scratchpad-write-testfile" unless="scratchpad.test.failed">
643         <echo file="${scratchpad.testokfile}" append="false" message="testok"/>
644     </target>
646         <target name="single-scratchpad-test" depends="compile-scratchpad,-test-property-check" description="Runs a single test case specified with -Dtestcase=classname">
647                 <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
648                     <classpath refid="test.classpath"/>
649                          <classpath>
650                                         <path refid="scratchpad.classpath"/>
651                                         <pathelement location="${main.output.dir}"/>
652                                         <pathelement location="${scratchpad.output.dir}"/>
653                                         <pathelement location="${scratchpad.output.test.dir}"/>
654                                         <pathelement location="${junit.jar1.dir}"/>
655                                     </classpath>
656                     <sysproperty key="HSSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hssf/data"/>
657                     <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
658                     <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
659                 <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
660                 <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
661                 <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
662                     <sysproperty key="java.awt.headless" value="true"/>
663                         <sysproperty key="java.awt.headless" value="true"/>
664                     <formatter type="plain" usefile="no"/>
665                     <formatter type="xml"/>
666                     <test name="${testcase}"/>
667                 </junit>
668             </target>
669         
670     <target name="-test-contrib-check">
671         <uptodate property="contrib.test.notRequired" targetfile="${contrib.testokfile}">
672             <srcfiles dir="${contrib.src}"/>
673             <srcfiles dir="${contrib.src.test}"/>
674         </uptodate>
675     </target>
677     <target name="test-contrib" depends="compile-main,compile-contrib,-test-contrib-check" unless="contrib.test.notRequired">
678         <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="contrib.test.failed">
679             <classpath>
680                 <path refid="contrib.classpath"/>
681                 <pathelement location="${main.output.dir}"/>
682                 <pathelement location="${contrib.output.dir}"/>
683                 <pathelement location="${contrib.output.test.dir}"/>
684                 <pathelement location="${junit.jar1.dir}"/>
685             </classpath>
686             <sysproperty key="HSSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hssf/data"/>
687             <sysproperty key="HPSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hpsf/data"/>
688             <sysproperty key="java.awt.headless" value="true"/>
689             <formatter type="plain"/>
690             <formatter type="xml"/>
691             <batchtest todir="${contrib.reports.test}">
692                 <fileset dir="${contrib.src.test}">
693                     <include name="**/Test*.java"/>
694                     <exclude name="**/AllTests.java"/>
695                 </fileset>
696             </batchtest>
697         </junit>
698         <delete file="${contrib.testokfile}"/>
699         <antcall target="-test-contrib-write-testfile"/>
700     </target>
702     <target name="-test-contrib-write-testfile" unless="contrib.test.failed">
703         <echo file="${contrib.testokfile}" append="false" message="testok"/>
704     </target>
706     <target name="-test-ooxml-check">
707         <uptodate property="ooxml.test.notRequired" targetfile="${ooxml.testokfile}">
708             <srcfiles dir="${ooxml.src}"/>
709             <srcfiles dir="${ooxml.src.test}"/>
710         </uptodate>
711     </target>
713     <target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check" unless="ooxml.test.notRequired">
714         <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="ooxml.test.failed">
715             <classpath>
716                 <path refid="ooxml.classpath"/>
717                 <pathelement location="${main.output.dir}"/>
718                 <pathelement location="${ooxml.output.dir}"/>
719                 <pathelement location="${ooxml.output.test.dir}"/>
720                 <pathelement location="${junit.jar1.dir}"/>
721             </classpath>
722             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
723             <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
724             <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
725             <sysproperty key="java.awt.headless" value="true"/>
726             <formatter type="plain"/>
727             <formatter type="xml"/>
728             <batchtest todir="${ooxml.reports.test}">
729                 <fileset dir="${ooxml.src.test}">
730                     <include name="**/Test*.java"/>
731                     <exclude name="**/AllTests.java"/>
732                 </fileset>
733             </batchtest>
734         </junit>
735         <delete file="${ooxml.testokfile}"/>
736         <antcall target="-test-ooxml-write-testfile"/>
737     </target>
739     <target name="-test-ooxml-write-testfile" unless="ooxml.test.failed">
740         <echo file="${ooxml.testokfile}" append="false" message="testok"/>
741     </target>
743     <target name="-check-docs">
744         <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html">
745             <srcfiles dir="${build.site.src}"/>
746         </uptodate>
747     </target>
749     <target name="-check-forrest-installed" unless="env.FORREST_HOME">
750         <echo>Please install Apache Forrest (see
751 &lt;http://xml.apache.org/forrest/index.html&gt;) and set the
752 FORREST_HOME environment variable!</echo>
753         <fail message="Apache Forrest is not installed."/>
754     </target>
756     <!--    <target name="check-docs">-->
757     <!--        <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html" >-->
758     <!--            <srcfiles dir= "${build.site.src}"/>-->
759     <!--        </uptodate>-->
760     <!--    </target>-->
762     <target name="docs" depends="init, -check-forrest-installed, -check-docs"
763       unless="main.docs.notRequired" description="Builds the POI website">
765         <mkdir dir="${build.site.src}/src/documentation/content/apidocs"/>
766         <copy todir="${build.site.src}/src/documentation/content/apidocs">
767             <fileset dir="${apidocs.report.dir}"/>
768         </copy>
769         <copy
770           tofile="${build.site.src}/src/documentation/content/jdepend.ehtml"
771           file="${jdepend.report.dir}/index.html" failonerror="false"/>
772         <mkdir dir="${build.site.src}/src/documentation/content/junit"/>
773         <copy todir="${build.site.src}/src/documentation/content/junit">
774             <fileset dir="${junit.report.dir}"/>
775         </copy>
777         <move
778           file="${build.site.src}/src/documentation/content/xdocs/status.xml"
779           tofile="${build.site.src}/status.xml"/>
781         <ant antfile="${forrest.home}/forrest.antproxy.xml" target="site">
782             <property name="project.home" location="${build.site.src}"/>
783         </ant>
785         <echo>Broken links:</echo>
786         <echo file="${build.site}/../tmp/brokenlinks.txt"/>
788         <touch>
789             <fileset dir="${build.site}"/>
790         </touch>
791     </target>
793     <!-- Checks whether reports are required to be run.  If nothing has changed then they dont. -->
794     <target name="-check-reports">
795         <condition property="reports.notRequired">
796             <and>
797                 <equals arg1="${main.test.notRequired}" arg2="true"/>
798                 <equals arg1="${scratchpad.test.notRequired}" arg2="true"/>
799                 <equals arg1="${contrib.test.notRequired}" arg2="true"/>
800             </and>
801         </condition>
802     </target>
806   <!-- Generates a log of the latest changes in the CVS repository. -->
807   <target name="cvschangelog" unless="disconnected"
808     depends="fail-unless-xslt-is-available"
809     description="Generates a CVS change log report">
810     <antcall target="cvs-rsh-warning"/>
811     <cvschangelog destfile="${changelog.file}" daysinpast="30"/>
813     <style in="${changelog.file}"
814       out="${build.site.src}/src/documentation/content/changelog.html"
815       style="changelog.xsl">
816       <param name="title"  expression="POI Change Log"/>
817       <param name="module" expression="jakarta-poi"/>
818       <param name="cvsweb" expression="http://cvs.apache.org/viewcvs/"/>
819     </style>
820   </target>
822   <target name="cvs-rsh-warning" unless="env.CVS_RSH">
823     <echo>
824       WARNING: The environment variable CVS_RSH is not set. If you cannot
825       access the CVS repository this could be one of the reasons for the
826       failure.
827     </echo>
828   </target>
832   <!-- Creates reports and API documentation -->
833   <target name="reports" unless="reports.notRequired" depends="-check-reports,
834     fail-unless-xslt-is-available, fail-unless-junit-is-available,
835     fail-unless-jdepend-is-available, test-ignore-failures, junitreport,
836     jdepend, cvschangelog, javadocs, clover.html"
837     description="Creates various reports and the API documentation">
838   </target>
842   <!-- Runs all JUnit tests without aborting if one of the tests fails. -->
843   <target name="test-ignore-failures" depends="init">
844     <antcall target="test">
845       <param name="halt.on.test.failure" value="false"/>
846     </antcall>
847   </target>
851   <!-- Produces a report of the JUnit test results -->
852   <target name="junitreport"
853     depends="fail-unless-xslt-is-available, test-ignore-failures"
854     description="Produces a report of the JUnit test results">
855     <junitreport todir="${junit.report.dir}">
856       <fileset dir="${main.reports.test}">
857         <include name="TEST-*.xml"/>
858       </fileset>
859       <fileset dir="${scratchpad.reports.test}">
860         <include name="TEST-*.xml"/>
861       </fileset>
862       <fileset dir="${contrib.reports.test}">
863         <include name="TEST-*.xml"/>
864       </fileset>
865       <report format="frames" todir="${junit.report.dir}"/>
866     </junitreport>
867   </target>
871   <!-- Generates the API documentation. -->
872   <target name="javadocs" depends="init, warn-unless-junit-is-available,
873     warn-unless-xslt-is-available"
874     description="Generates the API documentation">
875     <javadoc verbose="false" author="true" destdir="${apidocs.report.dir}"
876       windowtitle="POI API Documentation" use="true" version="true">
878       <packageset dir="${main.src}" defaultexcludes="yes">
879         <include name="org/apache/poi/**"/>
880       </packageset>
881       <packageset dir="${scratchpad.src}" defaultexcludes="yes">
882         <include name="org/apache/poi/**"/>
883         <exclude name="org/apache/poi/hdf/**"/>
884       </packageset>
885       <packageset dir="${contrib.src}" defaultexcludes="yes">
886         <include name="org/apache/poi/**"/>
887       </packageset>
888       <packageset dir="${examples.src}" defaultexcludes="yes">
889         <include name="org/apache/poi/**"/>
890       </packageset>
892       <classpath id="javadoc.classpath">
893         <path refid="main.classpath"/>
894         <path refid="scratchpad.classpath"/>
895         <path refid="contrib.classpath"/>
896         <path refid="examples.classpath"/>
897         <path path="${env.CLASSPATH}"/>
898       </classpath>
900       <doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle>
901       <bottom>
902         <![CDATA[<i>Copyright ${tstamp.year} The Apache Software Foundation or
903         its licensors, as applicable.</i>]]>
904       </bottom>
905       <group>
906         <title>DDF - Dreadful Drawing Format</title>
907         <package name="org.apache.poi.ddf*"/>
908       </group>
909       <group>
910         <title>HPSF - Horrible Property Set Format</title>
911         <package name="org.apache.poi.hpsf*"/>
912       </group>
913       <group>
914         <title>HSSF - Horrible Spreadsheet Format</title>
915         <package name="org.apache.poi.hssf*"/>
916       </group>
917       <group>
918         <title>HWPF - Horrible Word Processor Format</title>
919         <package name="org.apache.poi.hwpf*"/>
920       </group>
921       <group>
922         <title>POIFS - POI File System</title>
923         <package name="org.apache.poi.poifs*"/>
924       </group>
925       <group>
926         <title>Utilities</title>
927         <package name="org.apache.poi.util*"/>
928       </group>
929       <group>
930         <title>Examples</title>
931         <package name="org.apache.poi.hpsf.examples*"/>
932         <package name="org.apache.poi.hssf.usermodel.examples*"/>
933       </group>
934     </javadoc>
936     <antcall target="clover.html"/>
937   </target>
941   <!-- ================================== -->
942   <!--       Generate records                -->
943   <!-- ================================== -->
945   <target name="generate-records" depends="init"
946     description="Generates HSSF records"> 
947     <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
948       <arg file="src/records/definitions"/>
949       <arg file="src/records/styles"/>
950       <arg file="src/java"/>
951       <arg file="src/testcases"/>
952       <classpath>
953         <path refid="scratchpad.classpath"/>
954         <pathelement location="${main.output.dir}"/>
955         <pathelement location="${scratchpad.output.dir}"/>
956       </classpath>
957     </java>  
958   </target>
960   <!-- ================================== -->
961   <!--       Generate types               -->
962   <!-- ================================== -->
964   <target name="generate-types" depends="init"
965     description="Generates word types">
966     <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
967       <arg file="src/types/definitions"/>
968       <arg file="src/types/styles"/>
969       <arg file="src/scratchpad/src"/>
970       <arg file="src/scratchpad/testcases"/>
971       <classpath>
972         <path refid="scratchpad.classpath">
973         </path>
974         <pathelement location="${main.output.dir}"/>
975         <pathelement location="${scratchpad.output.dir}"/>
976       </classpath>
977     </java>
978   </target>
982     <!-- Generates documentation and reports -->
983     <target name="site" depends="reports, docs"
984       description="Generates POI's website's contents"/>
987     <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">
988                 <!-- Copy the jar files into the maven jar directory -->
989                 <!-- Same jars as for the main release, only lacking the datestamp -->
990                 <copy
991                         file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"
992                         tofile="${mavendist.oap.dir}/jars/${jar.name}-${version.id}.jar" />
993                 <copy
994                         file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"
995                         tofile="${mavendist.oap.dir}/jars/${jar.name}-contrib-${version.id}.jar" />
996                 <copy
997                         file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"
998                         tofile="${mavendist.oap.dir}/jars/${jar.name}-scratchpad-${version.id}.jar" />
1000                 <!-- TODO: Decide about source jars, and copy them if we have some -->
1002                 <!-- Build the org.apache.poi poms -->
1003                 <!-- Copy from the base file, substituting in the version and -->
1004                 <!--  artificat, plus doing the core poi dependency as needed -->
1006                 <!-- Build the main pom -->
1007                 <copy 
1008                         file="poi.pom" 
1009                         tofile="${mavendist.oap.dir}/poms/${jar.name}-${version.id}.pom" 
1010                 >
1011                         <filterchain>
1012                                 <replacetokens>
1013                                         <token key="VERSION" value="${version.id}" />
1014                                         <token key="ARTIFICAT" value="poi" />
1015                                 </replacetokens>
1016                                 <tokenfilter>
1017                                         <filetokenizer/>
1018                                         <replaceregex pattern="START_NON_MAIN.*END_NON_MAIN_DEPENDENCY" replace="No POI dependency on the main jar" flags="s" />
1019                                 </tokenfilter>
1020                         </filterchain>
1021                 </copy>
1022                 <!-- And the contrib pom -->
1023                 <copy 
1024                         file="poi.pom" 
1025                         tofile="${mavendist.oap.dir}/poms/${jar.name}-contrib-${version.id}.pom" 
1026                 >
1027                         <filterchain>
1028                                 <replacetokens>
1029                                         <token key="VERSION" value="${version.id}" />
1030                                         <token key="ARTIFICAT" value="poi-contrib" />
1031                                 </replacetokens>
1032                                 <tokenfilter>
1033                                         <replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1034                                         <replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1035                                 </tokenfilter>
1036                         </filterchain>
1037                 </copy>
1038                 <!-- And the scratchpad pom -->
1039                 <copy 
1040                         file="poi.pom" 
1041                         tofile="${mavendist.oap.dir}/poms/${jar.name}-scratchpad-${version.id}.pom" 
1042                 >
1043                         <filterchain>
1044                                 <replacetokens>
1045                                         <token key="VERSION" value="${version.id}" />
1046                                         <token key="ARTIFICAT" value="poi-scratchpad" />
1047                                 </replacetokens>
1048                                 <tokenfilter>
1049                                         <replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1050                                         <replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1051                                 </tokenfilter>
1052                         </filterchain>
1053                 </copy>
1055                 <!-- Build the poi => org.apache.poi redirect poms -->
1056                 <!-- Copy from the base file, substituting in the version+artifact -->
1057                 <copy 
1058                         file="poi-redirect.pom" 
1059                         tofile="${mavendist.poi.dir}/poms/${jar.name}-${version.id}.pom" 
1060                 >
1061                         <filterchain><replacetokens>
1062                                 <token key="VERSION" value="${version.id}" />
1063                                 <token key="ARTIFICAT" value="poi" />
1064                         </replacetokens></filterchain>
1065                 </copy>
1066                 <copy 
1067                         file="poi-redirect.pom" 
1068                         tofile="${mavendist.poi.dir}/poms/${jar.name}-contrib-${version.id}.pom" 
1069                 >
1070                         <filterchain><replacetokens>
1071                                 <token key="VERSION" value="${version.id}" />
1072                                 <token key="ARTIFICAT" value="poi-contrib" />
1073                         </replacetokens></filterchain>
1074                 </copy>
1075                 <copy 
1076                         file="poi-redirect.pom" 
1077                         tofile="${mavendist.poi.dir}/poms/${jar.name}-scratchpad-${version.id}.pom" 
1078                 >
1079                         <filterchain><replacetokens>
1080                                 <token key="VERSION" value="${version.id}" />
1081                                 <token key="ARTIFICAT" value="poi-scratchpad" />
1082                         </replacetokens></filterchain>
1083                 </copy>
1085                 <!-- And that's it for maven -->
1086         </target>
1088     <target name="jar" depends="compile" description="Creates jar files for distribution">
1089         <jar destfile="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar">
1090                         <fileset dir="${main.output.dir}" />
1091                         <fileset dir="legal/" />
1092             <manifest>
1093                 <attribute name="Built-By" value="${user.name}"/>
1094                 <attribute name="Specification-Title" value="Apache POI"/>
1095                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1096                 <attribute name="Specification-Vendor" value="Apache"/>
1097                 <attribute name="Implementation-Title" value="Apache POI"/>
1098                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1099                 <attribute name="Implementation-Vendor" value="Apache"/>
1100             </manifest>        
1101         </jar>
1102         <jar destfile="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar">
1103                         <fileset dir="${contrib.output.dir}" />
1104                         <fileset dir="legal/" />
1105             <manifest>
1106                 <attribute name="Built-By" value="${user.name}"/>
1107                 <attribute name="Specification-Title" value="Apache POI"/>
1108                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1109                 <attribute name="Specification-Vendor" value="Apache"/>
1110                 <attribute name="Implementation-Title" value="Apache POI"/>
1111                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1112                 <attribute name="Implementation-Vendor" value="Apache"/>
1113             </manifest>        
1114         </jar>
1115         <jar destfile="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar">
1116                         <fileset dir="${scratchpad.output.dir}" />
1117                         <fileset dir="legal/" />
1118             <manifest>
1119                 <attribute name="Built-By" value="${user.name}"/>
1120                 <attribute name="Specification-Title" value="Apache POI"/>
1121                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1122                 <attribute name="Specification-Vendor" value="Apache"/>
1123                 <attribute name="Implementation-Title" value="Apache POI"/>
1124                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1125                 <attribute name="Implementation-Vendor" value="Apache"/>
1126             </manifest>        
1127         </jar>
1128     </target>
1129     <target name="jar-ooxml" depends="compile-ooxml" description="Creates the ooxml jar files for distribution">
1130         <jar destfile="${dist.dir}/${jar.name}-ooxml-${version.id}-${DSTAMP}.jar">
1131                         <fileset dir="${ooxml.output.dir}" />
1132                         <fileset dir="legal/" />
1133             <manifest>
1134                 <attribute name="Built-By" value="${user.name}"/>
1135                 <attribute name="Specification-Title" value="Apache POI"/>
1136                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1137                 <attribute name="Specification-Vendor" value="Apache"/>
1138                 <attribute name="Implementation-Title" value="Apache POI"/>
1139                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1140                 <attribute name="Implementation-Vendor" value="Apache"/>
1141             </manifest>        
1142         </jar>
1143     </target>
1145   <target name="dist" depends="clean, fail-unless-tools-are-available, compile, site, jar"
1146     description="Creates the entire distribution into build/dist, from scratch">
1148         <property name="zipdir" value="${jar.name}-${version.id}" />
1150     <zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
1151       <zipfileset dir="legal/" prefix="${zipdir}" />
1152       <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1153       <zipfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1154       <zipfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1155       <zipfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1156     </zip>
1158     <zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
1159       <zipfileset dir="legal/" prefix="${zipdir}" />
1160       <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1161       <zipfileset dir="." prefix="${zipdir}">
1162         <exclude name="build/**"/>
1163         <exclude name="scripts/**"/>
1164         <exclude name="*.ipr"/>
1165         <exclude name="*.iml"/>
1166         <exclude name="*.iws"/>
1167         <exclude name="*.swp"/>
1168       </zipfileset>
1169     </zip>
1171     <tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz"
1172       compression="gzip">
1173       <tarfileset dir="legal/" prefix="${zipdir}" />
1174       <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1175       <tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1176       <tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1177       <tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1178     </tar>
1180     <tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz"
1181       compression="gzip">
1182       <tarfileset dir="legal/" prefix="${zipdir}" />
1183       <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1184       <tarfileset dir="." prefix="${zipdir}">
1185         <exclude name="build/**"/>
1186         <exclude name="scripts/**"/>
1187         <exclude name="*.ipr"/>
1188         <exclude name="*.iml"/>
1189         <exclude name="*.iws"/>
1190         <exclude name="*.swp"/>
1191       </tarfileset>
1192     </tar>
1194     <echo>Distribution located in build/dist</echo>
1195   </target>
1197   <target name="clean-compile" depends="clean, compile"/>
1199   <target name="clean-dist" depends="clean, dist"
1200     description="Cleans the build directory then creates a distribution"/>
1202   <target name="gump" depends="test, jar"/>
1206   <!-- Generates the Ant document type definition (DTD) -->
1207   <target name="dtd"
1208     description="Generates the Ant document type definition (DTD)">
1209     <antstructure output="ant.dtd"/>
1210   </target>
1215   <!-- Abort the build if JUnit is missing. -->
1216   <target name="fail-unless-junit-is-available" depends="init">
1217     <condition property="isAvailable.junit">
1218       <available classname="junit.framework.TestCase"/>
1219     </condition>
1220     <antcall target="fail-junit"/>
1221   </target>
1223   <target name="fail-junit" unless="isAvailable.junit">
1224     <echo>
1225       JUnit is not available. You must download JUnit from
1226       &lt;http://www.junit.org/&gt; and include the JAR file in your
1227       classpath.
1228     </echo> 
1229     <fail message="JUnit is not available."/>
1230   </target>
1232   <!-- Warn if JUnit is missing. -->
1233   <target name="warn-unless-junit-is-available" depends="init">
1234     <condition property="isAvailable.junit">
1235       <available classname="junit.framework.TestCase"/>
1236     </condition>
1237     <antcall target="warn-junit"/>
1238   </target>
1240   <target name="warn-junit" unless="isAvailable.junit">
1241     <echo>
1242       WARNING: Since JUnit is not available you might encounter failures
1243       subsequently. In order to avoid this you should download JUnit from
1244       &lt;http://www.junit.org/&gt; and include the JAR file in your
1245       classpath.
1246     </echo> 
1247   </target>
1251   <!-- Abort the build if JDepend is missing. -->
1252   <target name="fail-unless-jdepend-is-available" depends="init">
1253     <condition property="isAvailable.jdepend">
1254       <available classname="jdepend.framework.JDepend"/>
1255     </condition>
1256     <antcall target="fail-jdepend"/>
1257   </target>
1259   <target name="fail-jdepend" unless="isAvailable.jdepend">
1260     <echo>
1261       JDepend is not available. You must download JDepend from
1262       &lt;http://www.clarkware.com/software/JDepend.html&gt; and include the
1263       JAR file in your classpath.
1264     </echo> 
1265     <fail message="JDepend is not available."/>
1266   </target>
1270   <!-- Abort the build if an XSLT processor is missing. -->
1271   <target name="fail-unless-xslt-is-available" depends="init">
1272     <condition property="isAvailable.xslt">
1273       <available classname="javax.xml.transform.TransformerFactory"/>
1274     </condition>
1275     <antcall target="fail-xslt"/>
1276   </target>
1278   <target name="fail-xslt" unless="isAvailable.xslt">
1279     <echo>
1280       An XSLT processor is missing. You must download e.g. Xalan from
1281       &lt;http://xml.apache.org/xalan-j/&gt; and include the JAR file in your
1282       classpath.
1283     </echo> 
1284     <fail message="An XSLT processor is not available."/>
1285   </target>
1287   <!-- Warn if an XSLT processor is missing. -->
1288   <target name="warn-unless-xslt-is-available" depends="init">
1289     <condition property="isAvailable.xslt">
1290       <available classname="javax.xml.transform.TransformerFactory"/>
1291     </condition>
1292     <antcall target="warn-xslt"/>
1293   </target>
1295   <target name="warn-xslt" unless="isAvailable.xslt">
1296     <echo>
1297       WARNING: Since an XSLT processor is not available you might encounter
1298       failures subsequently. In order to avoid this you should download
1299       e.g. Xalan from &lt;http://xml.apache.org/xalan-j/&gt; and include the
1300       JAR file in your classpath.
1301     </echo> 
1302   </target>
1306   <!-- Aborts the build if any of the required tools are missing. -->
1307   <target name="fail-unless-tools-are-available"
1308     depends="fail-unless-junit-is-available, fail-unless-junit-is-available,
1309     fail-unless-jdepend-is-available"/>
1313   <!-- Runs jdepend to produce a report about package dependencies -->
1314   <target name="jdepend" depends="fail-unless-jdepend-is-available"
1315     description="Runs jdepend to produce a report about package dependencies">
1316     <jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
1317       <classespath>
1318         <pathelement location="${main.output.dir}"/>
1319         <pathelement location="${contrib.output.dir}"/>
1320         <pathelement location="${scratchpad.output.dir}"/>
1321       </classespath>
1322       <classpath>
1323         <path refid="main.classpath"/>
1324         <path refid="contrib.classpath"/>
1325         <path refid="scratchpad.classpath"/>
1326       </classpath>
1327     </jdepend>
1329     <style basedir="${jdepend.report.dir}"
1330       in="${jdepend.report.dir}/jdepend.xml"
1331       out="${jdepend.report.out.dir}/index.html"
1332       style="jdepend.xsl"/>
1333   </target>
1335 </project>
1337 <!-- Keep this comment at the end of the file
1338 Local variables:
1339 mode: xml
1340 sgml-omittag:nil
1341 sgml-shorttag:nil
1342 sgml-namecase-general:nil
1343 sgml-general-insert-case:lower
1344 sgml-minimize-attributes:nil
1345 sgml-always-quote-attributes:t
1346 sgml-indent-step:2
1347 sgml-indent-data:t
1348 sgml-parent-document:nil
1349 sgml-exposed-tags:nil
1350 sgml-local-catalogs:nil
1351 sgml-local-ecat-files:nil
1352 End: