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