Implement CountA, CountIf, Index, Rows and Columns functions. Patch from Josh Micich...
[poi.git] / build.xml
blobd6353fac10c3c2864d8a76d007429cea84012473
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-alpha-080124.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.1-alpha1"/>
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="build/non-ant-classes"/>
263         <mkdir dir="${main.output.dir}"/>
264         <mkdir dir="${scratchpad.output.dir}"/>
265         <mkdir dir="${contrib.output.dir}"/>
266         <mkdir dir="${examples.output.dir}"/>
267         <mkdir dir="${ooxml.output.dir}"/>
268         <mkdir dir="${main.output.test.dir}"/>
269         <mkdir dir="${contrib.output.test.dir}"/>
270         <mkdir dir="${scratchpad.output.test.dir}"/>
271         <mkdir dir="${ooxml.output.test.dir}"/>
272         <mkdir dir="${main.reports.test}"/>
273         <mkdir dir="${scratchpad.reports.test}"/>
274         <mkdir dir="${contrib.reports.test}"/>
275         <mkdir dir="${ooxml.reports.test}"/>
276         <mkdir dir="${junit.report.dir}"/>
277         <mkdir dir="${jdepend.report.dir}"/>
278         <mkdir dir="${jdepend.report.out.dir}"/>
279         <mkdir dir="${apidocs.report.dir}"/>
280         <mkdir dir="${dist.dir}"/>
281         <mkdir dir="${build.site.src}/${main.documentation}"/>
283         <mkdir dir="${mavendist.dir}"/>
284         <mkdir dir="${mavendist.poi.dir}"/>
285         <mkdir dir="${mavendist.poi.dir}/poms"/>
286         <mkdir dir="${mavendist.oap.dir}"/>
287         <mkdir dir="${mavendist.oap.dir}/jars"/>
288         <mkdir dir="${mavendist.oap.dir}/poms"/>
290         <copy todir="${build.site.src}/${main.documentation}">
291             <fileset dir="${main.documentation}"/>
292         </copy>
293         <copy file="forrest.properties" tofile="${build.site.src}/forrest.properties"/>
294     </target>
296     <target name="clean">
297         <delete dir="build"/>
298     </target>
300     <target name="check-jars">
301         <condition property="jars.present">
302             <or>
303                 <and>
304                     <available file="${main.jar1.dir}"/>
305                     <available file="${main.jar2.dir}"/>
306                     <available file="${contrib.jar1.dir}"/>
307                     <available file="${contrib.jar2.dir}"/>
308                     <available file="${contrib.jar3.dir}"/>
309                     <available file="${junit.jar1.dir}"/>
310                     <available file="${ooxml.jar1.dir}"/>
311                     <available file="${ooxml.jar2.dir}"/>
312                     <available file="${ooxml.jar3.dir}"/>
313                     <available file="${ooxml.jar4.dir}"/>
314                     <available file="${ooxml.jar5.dir}"/>
315                 </and>
316                 <isset property="disconnected"/>
317             </or>
318         </condition>
319     </target>
321     <target name="fetch-jars" unless="jars.present"
322      description="Fetches needed JAR files from the Internet">
323         <get src="${main.jar1.url}" dest="${main.jar1.dir}"/>
324         <get src="${main.jar2.url}" dest="${main.jar2.dir}"/>
325         <get src="${contrib.jar1.url}" dest="${contrib.jar1.dir}"/>
326         <get src="${contrib.jar2.url}" dest="${contrib.jar2.dir}"/>
327         <get src="${contrib.jar3.url}" dest="${contrib.jar3.dir}"/>
328         <get src="${junit.jar1.url}" dest="${junit.jar1.dir}"/>
330         <get src="${ooxml.jar1.url}" dest="${ooxml.jar1.dir}"/>
331         <get src="${ooxml.jar2.url}" dest="${ooxml.jar2.dir}"/>
332         <get src="${ooxml.jar3.url}" dest="${ooxml.jar3.dir}"/>
333         <get src="${ooxml.jar4.url}" dest="${ooxml.jar4.dir}"/>
334         <get src="${ooxml.jar5.url}" dest="${ooxml.jar5.dir}"/>
335     </target>
337         <target name="check-ooxml-xsds">
338         <condition property="ooxml-xsds.present">
339             <or>
340                 <and>
341                     <available file="${ooxml.xsds.izip}"/>
342                 </and>
343                 <isset property="disconnected"/>
344             </or>
345         </condition>
346         </target>
347     <target name="fetch-ooxml-xsds" unless="ooxml-xsds.present"
348      description="Fetches needed OOXML xsd files from the Internet">
349         <get src="${ooxml.xsds.url}" dest="${ooxml.xsds.ozip}"/>
350                 <unzip src="${ooxml.xsds.ozip}" dest="${ooxml.lib}">
351                         <patternset>
352                                 <include name="OfficeOpenXML-XMLSchema.zip" />
353                         </patternset>
354                 </unzip>
355         </target>
356         <target name="check-compiled-ooxml-xsds">
357         <condition property="ooxml-compiled-xsds.present">
358             <or>
359                 <and>
360                     <available file="${ooxml.xsds.jar}"/>
361                 </and>
362                 <isset property="disconnected"/>
363             </or>
364         </condition>
365         </target>
366         <target name="compile-ooxml-xsds" unless="ooxml-compiled-xsds.present"
367          depends="check-jars,fetch-jars,check-ooxml-xsds,fetch-ooxml-xsds,check-compiled-ooxml-xsds"
368          description="Unpacks the OOXML xsd files, and compiles them into XmlBeans">
369                 <taskdef name="xmlbean"
370                         classname="org.apache.xmlbeans.impl.tool.XMLBean"
371                         classpath="${ooxml.jar3.dir}:${ooxml.jar4.dir}" />
373                 <unzip src="${ooxml.xsds.izip}" dest="build/ooxml-xsds/" />
374                 <!--
375                         schema="build/ooxml-xsds/"
376                         schema="build/ooxml-xsds/sml-workbook.xsd"
377                 -->
378                 <xmlbean
379                         schema="build/ooxml-xsds/"
380                         destfile="${ooxml.xsds.jar}"
381                         javasource="1.4"
382                         failonerror="false"
383                         fork="true"
384                         memoryMaximumSize="512m"
385                 >
386                         <classpath refid="ooxml.classpath"/>
387                 </xmlbean>
388         </target>
390   <target name="compile" depends="init, compile-main, compile-scratchpad,
391     compile-contrib, compile-examples"
392     description="Compiles the POI main classes, scratchpad, contrib, and examples"/>
394   <target name="compile-main" depends="fail-unless-xslt-is-available">
395     <copy todir="${main.output.dir}">
396       <fileset dir="${main.resource1.dir}"/>
397     </copy>
398     <javac target="${jdk.version.class}" source="${jdk.version.source}"
399       failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
400       srcdir="${main.src}">
401       <classpath refid="main.classpath"/>
402     </javac>
403     <javac target="${jdk.version.class}" source="${jdk.version.source}"
404       failonerror="true" destdir="${main.output.test.dir}" debug="on"
405       fork="yes" srcdir="${main.src.test}">
406       <classpath>
407         <path refid="main.classpath"/>
408         <pathelement location="${main.output.dir}"/>
409         <pathelement location="${junit.jar1.dir}"/>
410       </classpath>
411     </javac>
412   </target>
414   <target name="compile-scratchpad" depends="init,compile-main">
415     <javac target="${jdk.version.class}" source="${jdk.version.source}"
416       failonerror="true" destdir="${scratchpad.output.dir}" debug="on"
417       fork="yes" srcdir="${scratchpad.src}">
418       <classpath refid="scratchpad.classpath"/>
419     </javac>
420     <javac target="${jdk.version.class}" source="${jdk.version.source}"
421       failonerror="true" destdir="${scratchpad.output.test.dir}" debug="on"
422       fork="yes" srcdir="${scratchpad.src.test}">
423       <classpath>
424         <path refid="scratchpad.classpath"/>
425         <pathelement location="${scratchpad.output.dir}"/>
426         <pathelement location="${junit.jar1.dir}"/>
427       </classpath>
428     </javac>
430         <!-- Copy HSLF Resources over -->
431         <property name="hslf.data" value="org/apache/poi/hslf/data" />
432         <mkdir dir="${scratchpad.output.dir}/${hslf.data}" />
433         <copy todir="${scratchpad.output.dir}/${hslf.data}">
434                 <fileset dir="${scratchpad.src}/${hslf.data}">
435                         <include name="*.ppt" />
436                 </fileset>
437         </copy>
439         <!-- Copy HDGF Resources over -->
440         <property name="hdgf.chunks" value="org/apache/poi/hdgf/chunks" />
441         <copy todir="${scratchpad.output.dir}/${hdgf.chunks}">
442                 <fileset dir="${scratchpad.src}/${hdgf.chunks}">
443                         <include name="*.tbl" />
444                 </fileset>
445         </copy>
446   </target>
448   <target name="compile-contrib" depends="init">
449     <javac target="${jdk.version.class}" source="${jdk.version.source}"
450       failonerror="true" destdir="${contrib.output.dir}" debug="on" fork="yes"
451       srcdir="${contrib.src}">
452       <classpath refid="contrib.classpath"/>
453     </javac>
454     <javac target="${jdk.version.class}" source="${jdk.version.source}"
455       failonerror="true" destdir="${contrib.output.test.dir}" debug="on"
456       fork="yes" srcdir="${contrib.src.test}">
457       <classpath>
458         <path refid="contrib.classpath"/>
459         <pathelement location="${contrib.output.dir}"/>
460         <pathelement location="${junit.jar1.dir}"/>
461       </classpath>
462     </javac>
463   </target>
465   <target name="compile-examples" depends="init">
466     <javac target="${jdk.version.class}" source="${jdk.version.source}"
467       destdir="${examples.output.dir}" debug="on" srcdir="${examples.src}">
468       <classpath refid="examples.classpath"/>
469     </javac>
470   </target>
472   <target name="compile-ooxml" depends="init, check-ooxml-xsds, fetch-ooxml-xsds, compile-ooxml-xsds, compile-main">
473         <!-- openxml4j requires java 1.5, so so must we, for now -->
474     <javac target="1.5" source="1.5"
475       destdir="${ooxml.output.dir}" debug="on" srcdir="${ooxml.src}">
476       <classpath refid="ooxml.classpath"/>
477     </javac>
479     <javac target="1.5" source="1.5"
480       failonerror="true" destdir="${ooxml.output.test.dir}" debug="on"
481       fork="yes" srcdir="${ooxml.src.test}">
482       <classpath>
483         <path refid="ooxml.classpath"/>
484         <pathelement location="${ooxml.output.dir}"/>
485         <pathelement location="${junit.jar1.dir}"/>
486       </classpath>
487     </javac>
488   </target>
490   <target name="test" depends="test-main,test-scratchpad,test-contrib"
491     description="Tests main, contrib and scratchpad"/>
493     <target name="-test-main-check">
494         <uptodate property="main.test.notRequired" targetfile="${main.testokfile}">
495             <srcfiles dir="${main.src}"/>
496             <srcfiles dir="${main.src.test}"/>
497         </uptodate>
498     </target>
500     <path id="test.classpath">
501         <path refid="main.classpath"/>
502         <pathelement location="${main.output.dir}"/>
503         <pathelement location="${main.output.test.dir}"/>
504         <pathelement location="${junit.jar1.dir}"/>
505     </path>
507   <target name="test-main" unless="main.test.notRequired"
508     depends="compile-main, -test-main-check, fail-unless-junit-is-available">
509     <junit fork="no" printsummary="yes" haltonfailure="${halt.on.test.failure}"
510       failureproperty="main.test.failed" showoutput="true">
511       <classpath refid="test.classpath"/>
512       <sysproperty key="HSSF.testdata.path"
513         file="${main.src.test}/org/apache/poi/hssf/data"/> 
514       <sysproperty key="HSLF.testdata.path"
515         file="${main.src.test}/org/apache/poi/hslf/data"/> 
516       <sysproperty key="HWPF.testdata.path"
517         file="${main.src.test}/org/apache/poi/hwpf/data"/> 
518       <sysproperty key="HPSF.testdata.path"
519         file="${main.src.test}/org/apache/poi/hpsf/data"/> 
520       <sysproperty key="java.awt.headless" value="true"/>
521       <formatter type="plain"/>
522       <formatter type="xml"/>
523       <batchtest todir="${main.reports.test}">
524         <fileset dir="${main.src.test}">
525           <include name="**/Test*.java"/>
526           <exclude name="**/AllTests.java"/>
527           <exclude name="**/TestEmptyDocument.java"/>
528           <exclude name="**/TestUnfixedBugs.java"/>
529           <exclude name="**/TestcaseRecordInputStream.java"/>
530         </fileset>
531       </batchtest>
532     </junit>
533     <delete file="${main.testokfile}"/>
534     <antcall target="-test-main-write-testfile"/>
535   </target>
537   <target name="test-fail" depends="compile-main,
538     fail-unless-junit-is-available"
539     description="run tests that are known to fail">
540     <junit printsummary="yes" showoutput="true" filtertrace="no"
541       haltonfailure="false">
542       <classpath refid="test.classpath"/>
543       <classpath>
544         <path refid="scratchpad.classpath"/>
545         <pathelement location="${main.output.dir}"/>
546         <pathelement location="${scratchpad.output.dir}"/>
547         <pathelement location="${scratchpad.output.test.dir}"/>
548         <pathelement location="${junit.jar1.dir}"/>
549       </classpath>
550       <sysproperty key="HSSF.testdata.path"
551         file="${main.src.test}/org/apache/poi/hssf/data"/>
552       <sysproperty key="HPSF.testdata.path"
553         file="${main.src.test}/org/apache/poi/hpsf/data"/>
554       <sysproperty key="HWPF.testdata.path"
555         file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
556       <sysproperty key="java.awt.headless" value="true"/>
557       <formatter type="plain" usefile="no"/>
558       <batchtest todir="${main.reports.test}">
559         <fileset dir="${main.src.test}">
560           <include name="**/TestEmptyDocument.java"/>
561           <include name="**/TestUnfixedBugs.java"/>
562         </fileset>
563       </batchtest>
564     </junit>
565   </target>        
569     <target name="single-test" depends="-test-property-check,compile-main" description="Runs a single test case specified with -Dtestcase=classname">
570         <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
571             <classpath refid="test.classpath"/>
572                  <classpath>
573                                 <path refid="test.classpath"/>
574                                 <pathelement location="${main.output.dir}"/>
575                                 <pathelement location="${scratchpad.output.dir}"/>
576                                 <pathelement location="${scratchpad.output.test.dir}"/>
577                                 <pathelement location="${junit.jar1.dir}"/>
578                             </classpath>
579             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
580             <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
581             <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
582             <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
583             <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
584             <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
585                 <sysproperty key="java.awt.headless" value="true"/>
586             <formatter type="plain" usefile="no"/>
587             <formatter type="xml"/>
588             <test name="${testcase}"/>
589         </junit>
590     </target>
592     <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." >
593             <echo>Waiting for debugger on port 5001</echo>    
594         <junit printsummary="no" showoutput="true" filtertrace="no" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed">
595             <jvmarg value="-Xdebug"/>
596             <jvmarg value="-Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=y"/>
597             <sysproperty key="java.compiler" value="NONE"/>
598             <classpath refid="test.classpath"/>
599             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
600             <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
601             <sysproperty key="java.awt.headless" value="true"/>
602             <formatter type="plain" usefile="no"/>
603             <test name="${testcase}"/>
604         </junit>
605     </target>
607     <target name="-test-property-check" unless="testcase">
608         <echo message="Please use -Dtestcase=org.your.testcase to run a single test"/>
609         <fail/>
610     </target>
612     <target name="-test-main-write-testfile" unless="main.test.failed">
613         <echo file="${main.testokfile}" append="false" message="testok"/>
614     </target>
616     <target name="-test-scratchpad-check">
617         <uptodate property="scratchpad.test.notRequired" targetfile="${scratchpad.testokfile}">
618             <srcfiles dir="${scratchpad.src}"/>
619             <srcfiles dir="${scratchpad.src.test}"/>
620         </uptodate>
621     </target>
623     <target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check" unless="scratchpad.test.notRequired">
624         <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="scratchpad.test.failed">
625             <classpath>
626                 <path refid="scratchpad.classpath"/>
627                 <pathelement location="${main.output.dir}"/>
628                 <pathelement location="${scratchpad.output.dir}"/>
629                 <pathelement location="${scratchpad.output.test.dir}"/>
630                 <pathelement location="${junit.jar1.dir}"/>
631             </classpath>
632             <sysproperty key="HSSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hssf/data"/>
633             <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
634             <sysproperty key="HDF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdf/data"/>
635             <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
636             <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
637             <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
638             <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
639             <sysproperty key="java.awt.headless" value="true"/>
640             <formatter type="plain"/>
641             <formatter type="xml"/>
642             <batchtest todir="${scratchpad.reports.test}">
643                 <fileset dir="${scratchpad.src.test}">
644                     <include name="**/Test*.java"/>
645                     <exclude name="**/AllTests.java"/>
646                 </fileset>
647             </batchtest>
648         </junit>
649         <delete file="${scratchpad.testokfile}"/>
650         <antcall target="-test-scratchpad-write-testfile"/>
651     </target>
653     <target name="-test-scratchpad-write-testfile" unless="scratchpad.test.failed">
654         <echo file="${scratchpad.testokfile}" append="false" message="testok"/>
655     </target>
657         <target name="single-scratchpad-test" depends="compile-scratchpad,-test-property-check" description="Runs a single test case specified with -Dtestcase=classname">
658                 <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
659                     <classpath refid="test.classpath"/>
660                          <classpath>
661                                         <path refid="scratchpad.classpath"/>
662                                         <pathelement location="${main.output.dir}"/>
663                                         <pathelement location="${scratchpad.output.dir}"/>
664                                         <pathelement location="${scratchpad.output.test.dir}"/>
665                                         <pathelement location="${junit.jar1.dir}"/>
666                                     </classpath>
667                     <sysproperty key="HSSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hssf/data"/>
668                     <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
669                     <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
670                 <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
671                 <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
672                 <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
673                     <sysproperty key="java.awt.headless" value="true"/>
674                         <sysproperty key="java.awt.headless" value="true"/>
675                     <formatter type="plain" usefile="no"/>
676                     <formatter type="xml"/>
677                     <test name="${testcase}"/>
678                 </junit>
679             </target>
680         
681     <target name="-test-contrib-check">
682         <uptodate property="contrib.test.notRequired" targetfile="${contrib.testokfile}">
683             <srcfiles dir="${contrib.src}"/>
684             <srcfiles dir="${contrib.src.test}"/>
685         </uptodate>
686     </target>
688     <target name="test-contrib" depends="compile-main,compile-contrib,-test-contrib-check" unless="contrib.test.notRequired">
689         <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="contrib.test.failed">
690             <classpath>
691                 <path refid="contrib.classpath"/>
692                 <pathelement location="${main.output.dir}"/>
693                 <pathelement location="${contrib.output.dir}"/>
694                 <pathelement location="${contrib.output.test.dir}"/>
695                 <pathelement location="${junit.jar1.dir}"/>
696             </classpath>
697             <sysproperty key="HSSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hssf/data"/>
698             <sysproperty key="HPSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hpsf/data"/>
699             <sysproperty key="java.awt.headless" value="true"/>
700             <formatter type="plain"/>
701             <formatter type="xml"/>
702             <batchtest todir="${contrib.reports.test}">
703                 <fileset dir="${contrib.src.test}">
704                     <include name="**/Test*.java"/>
705                     <exclude name="**/AllTests.java"/>
706                 </fileset>
707             </batchtest>
708         </junit>
709         <delete file="${contrib.testokfile}"/>
710         <antcall target="-test-contrib-write-testfile"/>
711     </target>
713     <target name="-test-contrib-write-testfile" unless="contrib.test.failed">
714         <echo file="${contrib.testokfile}" append="false" message="testok"/>
715     </target>
717     <target name="-test-ooxml-check">
718         <uptodate property="ooxml.test.notRequired" targetfile="${ooxml.testokfile}">
719             <srcfiles dir="${ooxml.src}"/>
720             <srcfiles dir="${ooxml.src.test}"/>
721         </uptodate>
722     </target>
724     <target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check" unless="ooxml.test.notRequired">
725         <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="ooxml.test.failed">
726             <classpath>
727                 <path refid="ooxml.classpath"/>
728                 <pathelement location="${main.output.dir}"/>
729                 <pathelement location="${ooxml.output.dir}"/>
730                 <pathelement location="${ooxml.output.test.dir}"/>
731                 <pathelement location="${junit.jar1.dir}"/>
732             </classpath>
733             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
734             <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
735             <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
736             <sysproperty key="java.awt.headless" value="true"/>
737             <formatter type="plain"/>
738             <formatter type="xml"/>
739             <batchtest todir="${ooxml.reports.test}">
740                 <fileset dir="${ooxml.src.test}">
741                     <include name="**/Test*.java"/>
742                     <exclude name="**/AllTests.java"/>
743                 </fileset>
744             </batchtest>
745         </junit>
746         <delete file="${ooxml.testokfile}"/>
747         <antcall target="-test-ooxml-write-testfile"/>
748     </target>
750     <target name="-test-ooxml-write-testfile" unless="ooxml.test.failed">
751         <echo file="${ooxml.testokfile}" append="false" message="testok"/>
752     </target>
754     <target name="-check-docs">
755         <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html">
756             <srcfiles dir="${build.site.src}"/>
757         </uptodate>
758     </target>
760     <target name="-check-forrest-installed" unless="env.FORREST_HOME">
761         <echo>Please install Apache Forrest (see
762 &lt;http://xml.apache.org/forrest/index.html&gt;) and set the
763 FORREST_HOME environment variable!</echo>
764         <fail message="Apache Forrest is not installed."/>
765     </target>
767     <!--    <target name="check-docs">-->
768     <!--        <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html" >-->
769     <!--            <srcfiles dir= "${build.site.src}"/>-->
770     <!--        </uptodate>-->
771     <!--    </target>-->
773     <target name="docs" depends="init, -check-forrest-installed, -check-docs"
774       unless="main.docs.notRequired" description="Builds the POI website">
776         <mkdir dir="${build.site.src}/src/documentation/content/apidocs"/>
777         <copy todir="${build.site.src}/src/documentation/content/apidocs">
778             <fileset dir="${apidocs.report.dir}"/>
779         </copy>
780         <copy
781           tofile="${build.site.src}/src/documentation/content/jdepend.ehtml"
782           file="${jdepend.report.dir}/index.html" failonerror="false"/>
783         <mkdir dir="${build.site.src}/src/documentation/content/junit"/>
784         <copy todir="${build.site.src}/src/documentation/content/junit">
785             <fileset dir="${junit.report.dir}"/>
786         </copy>
788         <move
789           file="${build.site.src}/src/documentation/content/xdocs/status.xml"
790           tofile="${build.site.src}/status.xml"/>
792         <ant antfile="${forrest.home}/forrest.antproxy.xml" target="site">
793             <property name="project.home" location="${build.site.src}"/>
794         </ant>
796         <echo>Broken links:</echo>
797         <echo file="${build.site}/../tmp/brokenlinks.txt"/>
799         <touch>
800             <fileset dir="${build.site}"/>
801         </touch>
802     </target>
804     <!-- Checks whether reports are required to be run.  If nothing has changed then they dont. -->
805     <target name="-check-reports">
806         <condition property="reports.notRequired">
807             <and>
808                 <equals arg1="${main.test.notRequired}" arg2="true"/>
809                 <equals arg1="${scratchpad.test.notRequired}" arg2="true"/>
810                 <equals arg1="${contrib.test.notRequired}" arg2="true"/>
811             </and>
812         </condition>
813     </target>
817   <!-- Generates a log of the latest changes in the CVS repository. -->
818   <target name="cvschangelog" unless="disconnected"
819     depends="fail-unless-xslt-is-available"
820     description="Generates a CVS change log report">
821     <antcall target="cvs-rsh-warning"/>
822     <cvschangelog destfile="${changelog.file}" daysinpast="30"/>
824     <style in="${changelog.file}"
825       out="${build.site.src}/src/documentation/content/changelog.html"
826       style="changelog.xsl">
827       <param name="title"  expression="POI Change Log"/>
828       <param name="module" expression="jakarta-poi"/>
829       <param name="cvsweb" expression="http://cvs.apache.org/viewcvs/"/>
830     </style>
831   </target>
833   <target name="cvs-rsh-warning" unless="env.CVS_RSH">
834     <echo>
835       WARNING: The environment variable CVS_RSH is not set. If you cannot
836       access the CVS repository this could be one of the reasons for the
837       failure.
838     </echo>
839   </target>
843   <!-- Creates reports and API documentation -->
844   <target name="reports" unless="reports.notRequired" depends="-check-reports,
845     fail-unless-xslt-is-available, fail-unless-junit-is-available,
846     fail-unless-jdepend-is-available, test-ignore-failures, junitreport,
847     jdepend, cvschangelog, javadocs, clover.html"
848     description="Creates various reports and the API documentation">
849   </target>
853   <!-- Runs all JUnit tests without aborting if one of the tests fails. -->
854   <target name="test-ignore-failures" depends="init">
855     <antcall target="test">
856       <param name="halt.on.test.failure" value="false"/>
857     </antcall>
858   </target>
862   <!-- Produces a report of the JUnit test results -->
863   <target name="junitreport"
864     depends="fail-unless-xslt-is-available, test-ignore-failures"
865     description="Produces a report of the JUnit test results">
866     <junitreport todir="${junit.report.dir}">
867       <fileset dir="${main.reports.test}">
868         <include name="TEST-*.xml"/>
869       </fileset>
870       <fileset dir="${scratchpad.reports.test}">
871         <include name="TEST-*.xml"/>
872       </fileset>
873       <fileset dir="${contrib.reports.test}">
874         <include name="TEST-*.xml"/>
875       </fileset>
876       <report format="frames" todir="${junit.report.dir}"/>
877     </junitreport>
878   </target>
882   <!-- Generates the API documentation. -->
883   <target name="javadocs" depends="init, warn-unless-junit-is-available,
884     warn-unless-xslt-is-available"
885     description="Generates the API documentation">
886     <javadoc verbose="false" author="true" destdir="${apidocs.report.dir}"
887       windowtitle="POI API Documentation" use="true" version="true">
889       <packageset dir="${main.src}" defaultexcludes="yes">
890         <include name="org/apache/poi/**"/>
891       </packageset>
892       <packageset dir="${scratchpad.src}" defaultexcludes="yes">
893         <include name="org/apache/poi/**"/>
894         <exclude name="org/apache/poi/hdf/**"/>
895       </packageset>
896       <packageset dir="${contrib.src}" defaultexcludes="yes">
897         <include name="org/apache/poi/**"/>
898       </packageset>
899       <packageset dir="${examples.src}" defaultexcludes="yes">
900         <include name="org/apache/poi/**"/>
901       </packageset>
903       <classpath id="javadoc.classpath">
904         <path refid="main.classpath"/>
905         <path refid="scratchpad.classpath"/>
906         <path refid="contrib.classpath"/>
907         <path refid="examples.classpath"/>
908         <path path="${env.CLASSPATH}"/>
909       </classpath>
911       <doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle>
912       <bottom>
913         <![CDATA[<i>Copyright ${tstamp.year} The Apache Software Foundation or
914         its licensors, as applicable.</i>]]>
915       </bottom>
916       <group>
917         <title>DDF - Dreadful Drawing Format</title>
918         <package name="org.apache.poi.ddf*"/>
919       </group>
920       <group>
921         <title>HPSF - Horrible Property Set Format</title>
922         <package name="org.apache.poi.hpsf*"/>
923       </group>
924       <group>
925         <title>HSSF - Horrible Spreadsheet Format</title>
926         <package name="org.apache.poi.hssf*"/>
927       </group>
928       <group>
929         <title>HWPF - Horrible Word Processor Format</title>
930         <package name="org.apache.poi.hwpf*"/>
931       </group>
932       <group>
933         <title>POIFS - POI File System</title>
934         <package name="org.apache.poi.poifs*"/>
935       </group>
936       <group>
937         <title>Utilities</title>
938         <package name="org.apache.poi.util*"/>
939       </group>
940       <group>
941         <title>Examples</title>
942         <package name="org.apache.poi.hpsf.examples*"/>
943         <package name="org.apache.poi.hssf.usermodel.examples*"/>
944       </group>
945     </javadoc>
947     <antcall target="clover.html"/>
948   </target>
952   <!-- ================================== -->
953   <!--       Generate records                -->
954   <!-- ================================== -->
956   <target name="generate-records" depends="init"
957     description="Generates HSSF records"> 
958     <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
959       <arg file="src/records/definitions"/>
960       <arg file="src/records/styles"/>
961       <arg file="src/java"/>
962       <arg file="src/testcases"/>
963       <classpath>
964         <path refid="scratchpad.classpath"/>
965         <pathelement location="${main.output.dir}"/>
966         <pathelement location="${scratchpad.output.dir}"/>
967       </classpath>
968     </java>  
969   </target>
971   <!-- ================================== -->
972   <!--       Generate types               -->
973   <!-- ================================== -->
975   <target name="generate-types" depends="init"
976     description="Generates word types">
977     <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
978       <arg file="src/types/definitions"/>
979       <arg file="src/types/styles"/>
980       <arg file="src/scratchpad/src"/>
981       <arg file="src/scratchpad/testcases"/>
982       <classpath>
983         <path refid="scratchpad.classpath">
984         </path>
985         <pathelement location="${main.output.dir}"/>
986         <pathelement location="${scratchpad.output.dir}"/>
987       </classpath>
988     </java>
989   </target>
993     <!-- Generates documentation and reports -->
994     <target name="site" depends="reports, docs"
995       description="Generates POI's website's contents"/>
998     <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">
999                 <!-- Copy the jar files into the maven jar directory -->
1000                 <!-- Same jars as for the main release, only lacking the datestamp -->
1001                 <copy
1002                         file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"
1003                         tofile="${mavendist.oap.dir}/jars/${jar.name}-${version.id}.jar" />
1004                 <copy
1005                         file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"
1006                         tofile="${mavendist.oap.dir}/jars/${jar.name}-contrib-${version.id}.jar" />
1007                 <copy
1008                         file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"
1009                         tofile="${mavendist.oap.dir}/jars/${jar.name}-scratchpad-${version.id}.jar" />
1011                 <!-- TODO: Decide about source jars, and copy them if we have some -->
1013                 <!-- Build the org.apache.poi poms -->
1014                 <!-- Copy from the base file, substituting in the version and -->
1015                 <!--  artificat, plus doing the core poi dependency as needed -->
1017                 <!-- Build the main pom -->
1018                 <copy 
1019                         file="poi.pom" 
1020                         tofile="${mavendist.oap.dir}/poms/${jar.name}-${version.id}.pom" 
1021                 >
1022                         <filterchain>
1023                                 <replacetokens>
1024                                         <token key="VERSION" value="${version.id}" />
1025                                         <token key="ARTIFICAT" value="poi" />
1026                                 </replacetokens>
1027                                 <tokenfilter>
1028                                         <filetokenizer/>
1029                                         <replaceregex pattern="START_NON_MAIN.*END_NON_MAIN_DEPENDENCY" replace="No POI dependency on the main jar" flags="s" />
1030                                 </tokenfilter>
1031                         </filterchain>
1032                 </copy>
1033                 <!-- And the contrib pom -->
1034                 <copy 
1035                         file="poi.pom" 
1036                         tofile="${mavendist.oap.dir}/poms/${jar.name}-contrib-${version.id}.pom" 
1037                 >
1038                         <filterchain>
1039                                 <replacetokens>
1040                                         <token key="VERSION" value="${version.id}" />
1041                                         <token key="ARTIFICAT" value="poi-contrib" />
1042                                 </replacetokens>
1043                                 <tokenfilter>
1044                                         <replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1045                                         <replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1046                                 </tokenfilter>
1047                         </filterchain>
1048                 </copy>
1049                 <!-- And the scratchpad pom -->
1050                 <copy 
1051                         file="poi.pom" 
1052                         tofile="${mavendist.oap.dir}/poms/${jar.name}-scratchpad-${version.id}.pom" 
1053                 >
1054                         <filterchain>
1055                                 <replacetokens>
1056                                         <token key="VERSION" value="${version.id}" />
1057                                         <token key="ARTIFICAT" value="poi-scratchpad" />
1058                                 </replacetokens>
1059                                 <tokenfilter>
1060                                         <replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1061                                         <replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1062                                 </tokenfilter>
1063                         </filterchain>
1064                 </copy>
1066                 <!-- Build the poi => org.apache.poi redirect poms -->
1067                 <!-- Copy from the base file, substituting in the version+artifact -->
1068                 <copy 
1069                         file="poi-redirect.pom" 
1070                         tofile="${mavendist.poi.dir}/poms/${jar.name}-${version.id}.pom" 
1071                 >
1072                         <filterchain><replacetokens>
1073                                 <token key="VERSION" value="${version.id}" />
1074                                 <token key="ARTIFICAT" value="poi" />
1075                         </replacetokens></filterchain>
1076                 </copy>
1077                 <copy 
1078                         file="poi-redirect.pom" 
1079                         tofile="${mavendist.poi.dir}/poms/${jar.name}-contrib-${version.id}.pom" 
1080                 >
1081                         <filterchain><replacetokens>
1082                                 <token key="VERSION" value="${version.id}" />
1083                                 <token key="ARTIFICAT" value="poi-contrib" />
1084                         </replacetokens></filterchain>
1085                 </copy>
1086                 <copy 
1087                         file="poi-redirect.pom" 
1088                         tofile="${mavendist.poi.dir}/poms/${jar.name}-scratchpad-${version.id}.pom" 
1089                 >
1090                         <filterchain><replacetokens>
1091                                 <token key="VERSION" value="${version.id}" />
1092                                 <token key="ARTIFICAT" value="poi-scratchpad" />
1093                         </replacetokens></filterchain>
1094                 </copy>
1096                 <!-- And that's it for maven -->
1097         </target>
1099     <target name="jar" depends="compile" description="Creates jar files for distribution">
1100         <jar destfile="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar">
1101                         <fileset dir="${main.output.dir}" />
1102                         <fileset dir="legal/" />
1103             <manifest>
1104                 <attribute name="Built-By" value="${user.name}"/>
1105                 <attribute name="Specification-Title" value="Apache POI"/>
1106                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1107                 <attribute name="Specification-Vendor" value="Apache"/>
1108                 <attribute name="Implementation-Title" value="Apache POI"/>
1109                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1110                 <attribute name="Implementation-Vendor" value="Apache"/>
1111             </manifest>        
1112         </jar>
1113         <jar destfile="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar">
1114                         <fileset dir="${contrib.output.dir}" />
1115                         <fileset dir="legal/" />
1116             <manifest>
1117                 <attribute name="Built-By" value="${user.name}"/>
1118                 <attribute name="Specification-Title" value="Apache POI"/>
1119                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1120                 <attribute name="Specification-Vendor" value="Apache"/>
1121                 <attribute name="Implementation-Title" value="Apache POI"/>
1122                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1123                 <attribute name="Implementation-Vendor" value="Apache"/>
1124             </manifest>        
1125         </jar>
1126         <jar destfile="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar">
1127                         <fileset dir="${scratchpad.output.dir}" />
1128                         <fileset dir="legal/" />
1129             <manifest>
1130                 <attribute name="Built-By" value="${user.name}"/>
1131                 <attribute name="Specification-Title" value="Apache POI"/>
1132                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1133                 <attribute name="Specification-Vendor" value="Apache"/>
1134                 <attribute name="Implementation-Title" value="Apache POI"/>
1135                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1136                 <attribute name="Implementation-Vendor" value="Apache"/>
1137             </manifest>        
1138         </jar>
1139     </target>
1140     <target name="jar-ooxml" depends="compile-ooxml" description="Creates the ooxml jar files for distribution">
1141         <jar destfile="${dist.dir}/${jar.name}-ooxml-${version.id}-${DSTAMP}.jar">
1142                         <fileset dir="${ooxml.output.dir}" />
1143                         <fileset dir="legal/" />
1144             <manifest>
1145                 <attribute name="Built-By" value="${user.name}"/>
1146                 <attribute name="Specification-Title" value="Apache POI"/>
1147                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1148                 <attribute name="Specification-Vendor" value="Apache"/>
1149                 <attribute name="Implementation-Title" value="Apache POI"/>
1150                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1151                 <attribute name="Implementation-Vendor" value="Apache"/>
1152             </manifest>        
1153         </jar>
1154     </target>
1156   <target name="dist" depends="clean, fail-unless-tools-are-available, compile, site, jar"
1157     description="Creates the entire distribution into build/dist, from scratch">
1159         <property name="zipdir" value="${jar.name}-${version.id}" />
1161     <zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
1162       <zipfileset dir="legal/" prefix="${zipdir}" />
1163       <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1164       <zipfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1165       <zipfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1166       <zipfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1167     </zip>
1169     <zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
1170       <zipfileset dir="legal/" prefix="${zipdir}" />
1171       <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1172       <zipfileset dir="." prefix="${zipdir}">
1173         <exclude name="build/**"/>
1174         <exclude name="scripts/**"/>
1175         <exclude name="*.ipr"/>
1176         <exclude name="*.iml"/>
1177         <exclude name="*.iws"/>
1178         <exclude name="*.swp"/>
1179       </zipfileset>
1180     </zip>
1182     <tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz"
1183       compression="gzip">
1184       <tarfileset dir="legal/" prefix="${zipdir}" />
1185       <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1186       <tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1187       <tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1188       <tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1189     </tar>
1191     <tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz"
1192       compression="gzip">
1193       <tarfileset dir="legal/" prefix="${zipdir}" />
1194       <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1195       <tarfileset dir="." prefix="${zipdir}">
1196         <exclude name="build/**"/>
1197         <exclude name="scripts/**"/>
1198         <exclude name="*.ipr"/>
1199         <exclude name="*.iml"/>
1200         <exclude name="*.iws"/>
1201         <exclude name="*.swp"/>
1202       </tarfileset>
1203     </tar>
1205     <echo>Distribution located in build/dist</echo>
1206   </target>
1208   <target name="clean-compile" depends="clean, compile"/>
1210   <target name="clean-dist" depends="clean, dist"
1211     description="Cleans the build directory then creates a distribution"/>
1213   <target name="gump" depends="test, jar"/>
1217   <!-- Generates the Ant document type definition (DTD) -->
1218   <target name="dtd"
1219     description="Generates the Ant document type definition (DTD)">
1220     <antstructure output="ant.dtd"/>
1221   </target>
1226   <!-- Abort the build if JUnit is missing. -->
1227   <target name="fail-unless-junit-is-available" depends="init">
1228     <condition property="isAvailable.junit">
1229       <available classname="junit.framework.TestCase"/>
1230     </condition>
1231     <antcall target="fail-junit"/>
1232   </target>
1234   <target name="fail-junit" unless="isAvailable.junit">
1235     <echo>
1236       JUnit is not available. You must download JUnit from
1237       &lt;http://www.junit.org/&gt; and include the JAR file in your
1238       classpath.
1239     </echo> 
1240     <fail message="JUnit is not available."/>
1241   </target>
1243   <!-- Warn if JUnit is missing. -->
1244   <target name="warn-unless-junit-is-available" depends="init">
1245     <condition property="isAvailable.junit">
1246       <available classname="junit.framework.TestCase"/>
1247     </condition>
1248     <antcall target="warn-junit"/>
1249   </target>
1251   <target name="warn-junit" unless="isAvailable.junit">
1252     <echo>
1253       WARNING: Since JUnit is not available you might encounter failures
1254       subsequently. In order to avoid this you should download JUnit from
1255       &lt;http://www.junit.org/&gt; and include the JAR file in your
1256       classpath.
1257     </echo> 
1258   </target>
1262   <!-- Abort the build if JDepend is missing. -->
1263   <target name="fail-unless-jdepend-is-available" depends="init">
1264     <condition property="isAvailable.jdepend">
1265       <available classname="jdepend.framework.JDepend"/>
1266     </condition>
1267     <antcall target="fail-jdepend"/>
1268   </target>
1270   <target name="fail-jdepend" unless="isAvailable.jdepend">
1271     <echo>
1272       JDepend is not available. You must download JDepend from
1273       &lt;http://www.clarkware.com/software/JDepend.html&gt; and include the
1274       JAR file in your classpath.
1275     </echo> 
1276     <fail message="JDepend is not available."/>
1277   </target>
1281   <!-- Abort the build if an XSLT processor is missing. -->
1282   <target name="fail-unless-xslt-is-available" depends="init">
1283     <condition property="isAvailable.xslt">
1284       <available classname="javax.xml.transform.TransformerFactory"/>
1285     </condition>
1286     <antcall target="fail-xslt"/>
1287   </target>
1289   <target name="fail-xslt" unless="isAvailable.xslt">
1290     <echo>
1291       An XSLT processor is missing. You must download e.g. Xalan from
1292       &lt;http://xml.apache.org/xalan-j/&gt; and include the JAR file in your
1293       classpath.
1294     </echo> 
1295     <fail message="An XSLT processor is not available."/>
1296   </target>
1298   <!-- Warn if an XSLT processor is missing. -->
1299   <target name="warn-unless-xslt-is-available" depends="init">
1300     <condition property="isAvailable.xslt">
1301       <available classname="javax.xml.transform.TransformerFactory"/>
1302     </condition>
1303     <antcall target="warn-xslt"/>
1304   </target>
1306   <target name="warn-xslt" unless="isAvailable.xslt">
1307     <echo>
1308       WARNING: Since an XSLT processor is not available you might encounter
1309       failures subsequently. In order to avoid this you should download
1310       e.g. Xalan from &lt;http://xml.apache.org/xalan-j/&gt; and include the
1311       JAR file in your classpath.
1312     </echo> 
1313   </target>
1317   <!-- Aborts the build if any of the required tools are missing. -->
1318   <target name="fail-unless-tools-are-available"
1319     depends="fail-unless-junit-is-available, fail-unless-junit-is-available,
1320     fail-unless-jdepend-is-available"/>
1324   <!-- Runs jdepend to produce a report about package dependencies -->
1325   <target name="jdepend" depends="fail-unless-jdepend-is-available"
1326     description="Runs jdepend to produce a report about package dependencies">
1327     <jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
1328       <classespath>
1329         <pathelement location="${main.output.dir}"/>
1330         <pathelement location="${contrib.output.dir}"/>
1331         <pathelement location="${scratchpad.output.dir}"/>
1332       </classespath>
1333       <classpath>
1334         <path refid="main.classpath"/>
1335         <path refid="contrib.classpath"/>
1336         <path refid="scratchpad.classpath"/>
1337       </classpath>
1338     </jdepend>
1340     <style basedir="${jdepend.report.dir}"
1341       in="${jdepend.report.dir}/jdepend.xml"
1342       out="${jdepend.report.out.dir}/index.html"
1343       style="jdepend.xsl"/>
1344   </target>
1346 </project>
1348 <!-- Keep this comment at the end of the file
1349 Local variables:
1350 mode: xml
1351 sgml-omittag:nil
1352 sgml-shorttag:nil
1353 sgml-namecase-general:nil
1354 sgml-general-insert-case:lower
1355 sgml-minimize-attributes:nil
1356 sgml-always-quote-attributes:t
1357 sgml-indent-step:2
1358 sgml-indent-data:t
1359 sgml-parent-document:nil
1360 sgml-exposed-tags:nil
1361 sgml-local-catalogs:nil
1362 sgml-local-ecat-files:nil
1363 End: