Improved support for read-only recommended workbooks, fixing bug #44536
[poi.git] / build.xml
blob3b1d2b6f39f35ca0ecad7fd119d64a1f28b1c54d
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="**/All*Tests.java"/>
527           <exclude name="**/TestUnfixedBugs.java"/>
528           <exclude name="**/TestcaseRecordInputStream.java"/>
529         </fileset>
530       </batchtest>
531     </junit>
532     <delete file="${main.testokfile}"/>
533     <antcall target="-test-main-write-testfile"/>
534   </target>
536   <target name="test-fail" depends="compile-main,
537     fail-unless-junit-is-available"
538     description="run tests that are known to fail">
539     <junit printsummary="yes" showoutput="true" filtertrace="no"
540       haltonfailure="false">
541       <classpath refid="test.classpath"/>
542       <classpath>
543         <path refid="scratchpad.classpath"/>
544         <pathelement location="${main.output.dir}"/>
545         <pathelement location="${scratchpad.output.dir}"/>
546         <pathelement location="${scratchpad.output.test.dir}"/>
547         <pathelement location="${junit.jar1.dir}"/>
548       </classpath>
549       <sysproperty key="HSSF.testdata.path"
550         file="${main.src.test}/org/apache/poi/hssf/data"/>
551       <sysproperty key="HPSF.testdata.path"
552         file="${main.src.test}/org/apache/poi/hpsf/data"/>
553       <sysproperty key="HWPF.testdata.path"
554         file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
555       <sysproperty key="java.awt.headless" value="true"/>
556       <formatter type="plain" usefile="no"/>
557       <batchtest todir="${main.reports.test}">
558         <fileset dir="${main.src.test}">
559           <include name="**/TestEmptyDocument.java"/>
560           <include name="**/TestUnfixedBugs.java"/>
561         </fileset>
562       </batchtest>
563     </junit>
564   </target>        
568     <target name="single-test" depends="-test-property-check,compile-main" description="Runs a single test case specified with -Dtestcase=classname">
569         <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
570             <classpath refid="test.classpath"/>
571                  <classpath>
572                                 <path refid="test.classpath"/>
573                                 <pathelement location="${main.output.dir}"/>
574                                 <pathelement location="${scratchpad.output.dir}"/>
575                                 <pathelement location="${scratchpad.output.test.dir}"/>
576                                 <pathelement location="${junit.jar1.dir}"/>
577                             </classpath>
578             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
579             <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
580             <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
581             <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
582             <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
583             <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
584                 <sysproperty key="java.awt.headless" value="true"/>
585             <formatter type="plain" usefile="no"/>
586             <formatter type="xml"/>
587             <test name="${testcase}"/>
588         </junit>
589     </target>
591     <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." >
592             <echo>Waiting for debugger on port 5001</echo>    
593         <junit printsummary="no" showoutput="true" filtertrace="no" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed">
594             <jvmarg value="-Xdebug"/>
595             <jvmarg value="-Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=y"/>
596             <sysproperty key="java.compiler" value="NONE"/>
597             <classpath refid="test.classpath"/>
598             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
599             <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
600             <sysproperty key="java.awt.headless" value="true"/>
601             <formatter type="plain" usefile="no"/>
602             <test name="${testcase}"/>
603         </junit>
604     </target>
606     <target name="-test-property-check" unless="testcase">
607         <echo message="Please use -Dtestcase=org.your.testcase to run a single test"/>
608         <fail/>
609     </target>
611     <target name="-test-main-write-testfile" unless="main.test.failed">
612         <echo file="${main.testokfile}" append="false" message="testok"/>
613     </target>
615     <target name="-test-scratchpad-check">
616         <uptodate property="scratchpad.test.notRequired" targetfile="${scratchpad.testokfile}">
617             <srcfiles dir="${scratchpad.src}"/>
618             <srcfiles dir="${scratchpad.src.test}"/>
619         </uptodate>
620     </target>
622     <target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check" unless="scratchpad.test.notRequired">
623         <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="scratchpad.test.failed">
624             <classpath>
625                 <path refid="scratchpad.classpath"/>
626                 <pathelement location="${main.output.dir}"/>
627                 <pathelement location="${scratchpad.output.dir}"/>
628                 <pathelement location="${scratchpad.output.test.dir}"/>
629                 <pathelement location="${junit.jar1.dir}"/>
630             </classpath>
631             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
632             <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
633             <sysproperty key="HDF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdf/data"/>
634             <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
635             <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
636             <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
637             <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
638             <sysproperty key="java.awt.headless" value="true"/>
639             <formatter type="plain"/>
640             <formatter type="xml"/>
641             <batchtest todir="${scratchpad.reports.test}">
642                 <fileset dir="${scratchpad.src.test}">
643                     <include name="**/Test*.java"/>
644                     <exclude name="**/AllTests.java"/>
645                 </fileset>
646             </batchtest>
647         </junit>
648         <delete file="${scratchpad.testokfile}"/>
649         <antcall target="-test-scratchpad-write-testfile"/>
650     </target>
652     <target name="-test-scratchpad-write-testfile" unless="scratchpad.test.failed">
653         <echo file="${scratchpad.testokfile}" append="false" message="testok"/>
654     </target>
656         <target name="single-scratchpad-test" depends="compile-scratchpad,-test-property-check" description="Runs a single test case specified with -Dtestcase=classname">
657                 <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
658                     <classpath refid="test.classpath"/>
659                          <classpath>
660                                         <path refid="scratchpad.classpath"/>
661                                         <pathelement location="${main.output.dir}"/>
662                                         <pathelement location="${scratchpad.output.dir}"/>
663                                         <pathelement location="${scratchpad.output.test.dir}"/>
664                                         <pathelement location="${junit.jar1.dir}"/>
665                                     </classpath>
666                 <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
667                     <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
668                     <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
669                 <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
670                 <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
671                 <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
672                     <sysproperty key="java.awt.headless" value="true"/>
673                         <sysproperty key="java.awt.headless" value="true"/>
674                     <formatter type="plain" usefile="no"/>
675                     <formatter type="xml"/>
676                     <test name="${testcase}"/>
677                 </junit>
678             </target>
679         
680     <target name="-test-contrib-check">
681         <uptodate property="contrib.test.notRequired" targetfile="${contrib.testokfile}">
682             <srcfiles dir="${contrib.src}"/>
683             <srcfiles dir="${contrib.src.test}"/>
684         </uptodate>
685     </target>
687     <target name="test-contrib" depends="compile-main,compile-contrib,-test-contrib-check" unless="contrib.test.notRequired">
688         <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="contrib.test.failed">
689             <classpath>
690                 <path refid="contrib.classpath"/>
691                 <pathelement location="${main.output.dir}"/>
692                 <pathelement location="${contrib.output.dir}"/>
693                 <pathelement location="${contrib.output.test.dir}"/>
694                 <pathelement location="${junit.jar1.dir}"/>
695             </classpath>
696             <sysproperty key="HSSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hssf/data"/>
697             <sysproperty key="HPSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hpsf/data"/>
698             <sysproperty key="java.awt.headless" value="true"/>
699             <formatter type="plain"/>
700             <formatter type="xml"/>
701             <batchtest todir="${contrib.reports.test}">
702                 <fileset dir="${contrib.src.test}">
703                     <include name="**/Test*.java"/>
704                     <exclude name="**/AllTests.java"/>
705                 </fileset>
706             </batchtest>
707         </junit>
708         <delete file="${contrib.testokfile}"/>
709         <antcall target="-test-contrib-write-testfile"/>
710     </target>
712     <target name="-test-contrib-write-testfile" unless="contrib.test.failed">
713         <echo file="${contrib.testokfile}" append="false" message="testok"/>
714     </target>
716     <target name="-test-ooxml-check">
717         <uptodate property="ooxml.test.notRequired" targetfile="${ooxml.testokfile}">
718             <srcfiles dir="${ooxml.src}"/>
719             <srcfiles dir="${ooxml.src.test}"/>
720         </uptodate>
721     </target>
723     <target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check" unless="ooxml.test.notRequired">
724         <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="ooxml.test.failed">
725             <classpath>
726                 <path refid="ooxml.classpath"/>
727                 <pathelement location="${main.output.dir}"/>
728                 <pathelement location="${ooxml.output.dir}"/>
729                 <pathelement location="${ooxml.output.test.dir}"/>
730                 <pathelement location="${junit.jar1.dir}"/>
731             </classpath>
732             <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
733             <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
734             <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
735             <sysproperty key="java.awt.headless" value="true"/>
736             <formatter type="plain"/>
737             <formatter type="xml"/>
738             <batchtest todir="${ooxml.reports.test}">
739                 <fileset dir="${ooxml.src.test}">
740                     <include name="**/Test*.java"/>
741                     <exclude name="**/AllTests.java"/>
742                 </fileset>
743             </batchtest>
744         </junit>
745         <delete file="${ooxml.testokfile}"/>
746         <antcall target="-test-ooxml-write-testfile"/>
747     </target>
749     <target name="-test-ooxml-write-testfile" unless="ooxml.test.failed">
750         <echo file="${ooxml.testokfile}" append="false" message="testok"/>
751     </target>
753     <target name="-check-docs">
754         <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html">
755             <srcfiles dir="${build.site.src}"/>
756         </uptodate>
757     </target>
759     <target name="-check-forrest-installed" unless="env.FORREST_HOME">
760         <echo>Please install Apache Forrest (see
761 &lt;http://xml.apache.org/forrest/index.html&gt;) and set the
762 FORREST_HOME environment variable!</echo>
763         <fail message="Apache Forrest is not installed."/>
764     </target>
766     <!--    <target name="check-docs">-->
767     <!--        <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html" >-->
768     <!--            <srcfiles dir= "${build.site.src}"/>-->
769     <!--        </uptodate>-->
770     <!--    </target>-->
772     <target name="docs" depends="init, -check-forrest-installed, -check-docs"
773       unless="main.docs.notRequired" description="Builds the POI website">
775         <mkdir dir="${build.site.src}/src/documentation/content/apidocs"/>
776         <copy todir="${build.site.src}/src/documentation/content/apidocs">
777             <fileset dir="${apidocs.report.dir}"/>
778         </copy>
779         <copy
780           tofile="${build.site.src}/src/documentation/content/jdepend.ehtml"
781           file="${jdepend.report.dir}/index.html" failonerror="false"/>
782         <mkdir dir="${build.site.src}/src/documentation/content/junit"/>
783         <copy todir="${build.site.src}/src/documentation/content/junit">
784             <fileset dir="${junit.report.dir}"/>
785         </copy>
787         <move
788           file="${build.site.src}/src/documentation/content/xdocs/status.xml"
789           tofile="${build.site.src}/status.xml"/>
791         <ant antfile="${forrest.home}/forrest.antproxy.xml" target="site">
792             <property name="project.home" location="${build.site.src}"/>
793         </ant>
795         <echo>Broken links:</echo>
796         <echo file="${build.site}/../tmp/brokenlinks.txt"/>
798         <touch>
799             <fileset dir="${build.site}"/>
800         </touch>
801     </target>
803     <!-- Checks whether reports are required to be run.  If nothing has changed then they dont. -->
804     <target name="-check-reports">
805         <condition property="reports.notRequired">
806             <and>
807                 <equals arg1="${main.test.notRequired}" arg2="true"/>
808                 <equals arg1="${scratchpad.test.notRequired}" arg2="true"/>
809                 <equals arg1="${contrib.test.notRequired}" arg2="true"/>
810             </and>
811         </condition>
812     </target>
816   <!-- Generates a log of the latest changes in the CVS repository. -->
817   <target name="cvschangelog" unless="disconnected"
818     depends="fail-unless-xslt-is-available"
819     description="Generates a CVS change log report">
820     <antcall target="cvs-rsh-warning"/>
821     <cvschangelog destfile="${changelog.file}" daysinpast="30"/>
823     <style in="${changelog.file}"
824       out="${build.site.src}/src/documentation/content/changelog.html"
825       style="changelog.xsl">
826       <param name="title"  expression="POI Change Log"/>
827       <param name="module" expression="jakarta-poi"/>
828       <param name="cvsweb" expression="http://cvs.apache.org/viewcvs/"/>
829     </style>
830   </target>
832   <target name="cvs-rsh-warning" unless="env.CVS_RSH">
833     <echo>
834       WARNING: The environment variable CVS_RSH is not set. If you cannot
835       access the CVS repository this could be one of the reasons for the
836       failure.
837     </echo>
838   </target>
842   <!-- Creates reports and API documentation -->
843   <target name="reports" unless="reports.notRequired" depends="-check-reports,
844     fail-unless-xslt-is-available, fail-unless-junit-is-available,
845     fail-unless-jdepend-is-available, test-ignore-failures, junitreport,
846     jdepend, cvschangelog, javadocs, clover.html"
847     description="Creates various reports and the API documentation">
848   </target>
852   <!-- Runs all JUnit tests without aborting if one of the tests fails. -->
853   <target name="test-ignore-failures" depends="init">
854     <antcall target="test">
855       <param name="halt.on.test.failure" value="false"/>
856     </antcall>
857   </target>
861   <!-- Produces a report of the JUnit test results -->
862   <target name="junitreport"
863     depends="fail-unless-xslt-is-available, test-ignore-failures"
864     description="Produces a report of the JUnit test results">
865     <junitreport todir="${junit.report.dir}">
866       <fileset dir="${main.reports.test}">
867         <include name="TEST-*.xml"/>
868       </fileset>
869       <fileset dir="${scratchpad.reports.test}">
870         <include name="TEST-*.xml"/>
871       </fileset>
872       <fileset dir="${contrib.reports.test}">
873         <include name="TEST-*.xml"/>
874       </fileset>
875       <report format="frames" todir="${junit.report.dir}"/>
876     </junitreport>
877   </target>
881   <!-- Generates the API documentation. -->
882   <target name="javadocs" depends="init, warn-unless-junit-is-available,
883     warn-unless-xslt-is-available"
884     description="Generates the API documentation">
885     <javadoc verbose="false" author="true" destdir="${apidocs.report.dir}"
886       windowtitle="POI API Documentation" use="true" version="true">
888       <packageset dir="${main.src}" defaultexcludes="yes">
889         <include name="org/apache/poi/**"/>
890       </packageset>
891       <packageset dir="${scratchpad.src}" defaultexcludes="yes">
892         <include name="org/apache/poi/**"/>
893         <exclude name="org/apache/poi/hdf/**"/>
894       </packageset>
895       <packageset dir="${contrib.src}" defaultexcludes="yes">
896         <include name="org/apache/poi/**"/>
897       </packageset>
898       <packageset dir="${examples.src}" defaultexcludes="yes">
899         <include name="org/apache/poi/**"/>
900       </packageset>
902       <classpath id="javadoc.classpath">
903         <path refid="main.classpath"/>
904         <path refid="scratchpad.classpath"/>
905         <path refid="contrib.classpath"/>
906         <path refid="examples.classpath"/>
907         <path path="${env.CLASSPATH}"/>
908       </classpath>
910       <doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle>
911       <bottom>
912         <![CDATA[<i>Copyright ${tstamp.year} The Apache Software Foundation or
913         its licensors, as applicable.</i>]]>
914       </bottom>
915       <group>
916         <title>DDF - Dreadful Drawing Format</title>
917         <package name="org.apache.poi.ddf*"/>
918       </group>
919       <group>
920         <title>HPSF - Horrible Property Set Format</title>
921         <package name="org.apache.poi.hpsf*"/>
922       </group>
923       <group>
924         <title>HSSF - Horrible Spreadsheet Format</title>
925         <package name="org.apache.poi.hssf*"/>
926       </group>
927       <group>
928         <title>HWPF - Horrible Word Processor Format</title>
929         <package name="org.apache.poi.hwpf*"/>
930       </group>
931       <group>
932         <title>POIFS - POI File System</title>
933         <package name="org.apache.poi.poifs*"/>
934       </group>
935       <group>
936         <title>Utilities</title>
937         <package name="org.apache.poi.util*"/>
938       </group>
939       <group>
940         <title>Examples</title>
941         <package name="org.apache.poi.hpsf.examples*"/>
942         <package name="org.apache.poi.hssf.usermodel.examples*"/>
943       </group>
944     </javadoc>
946     <antcall target="clover.html"/>
947   </target>
951   <!-- ================================== -->
952   <!--       Generate records                -->
953   <!-- ================================== -->
955   <target name="generate-records" depends="init"
956     description="Generates HSSF records"> 
957     <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
958       <arg file="src/records/definitions"/>
959       <arg file="src/records/styles"/>
960       <arg file="src/java"/>
961       <arg file="src/testcases"/>
962       <classpath>
963         <path refid="scratchpad.classpath"/>
964         <pathelement location="${main.output.dir}"/>
965         <pathelement location="${scratchpad.output.dir}"/>
966       </classpath>
967     </java>  
968   </target>
970   <!-- ================================== -->
971   <!--       Generate types               -->
972   <!-- ================================== -->
974   <target name="generate-types" depends="init"
975     description="Generates word types">
976     <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
977       <arg file="src/types/definitions"/>
978       <arg file="src/types/styles"/>
979       <arg file="src/scratchpad/src"/>
980       <arg file="src/scratchpad/testcases"/>
981       <classpath>
982         <path refid="scratchpad.classpath">
983         </path>
984         <pathelement location="${main.output.dir}"/>
985         <pathelement location="${scratchpad.output.dir}"/>
986       </classpath>
987     </java>
988   </target>
992     <!-- Generates documentation and reports -->
993     <target name="site" depends="reports, docs"
994       description="Generates POI's website's contents"/>
997     <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">
998                 <!-- Copy the jar files into the maven jar directory -->
999                 <!-- Same jars as for the main release, only lacking the datestamp -->
1000                 <copy
1001                         file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"
1002                         tofile="${mavendist.oap.dir}/jars/${jar.name}-${version.id}.jar" />
1003                 <copy
1004                         file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"
1005                         tofile="${mavendist.oap.dir}/jars/${jar.name}-contrib-${version.id}.jar" />
1006                 <copy
1007                         file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"
1008                         tofile="${mavendist.oap.dir}/jars/${jar.name}-scratchpad-${version.id}.jar" />
1010                 <!-- TODO: Decide about source jars, and copy them if we have some -->
1012                 <!-- Build the org.apache.poi poms -->
1013                 <!-- Copy from the base file, substituting in the version and -->
1014                 <!--  artificat, plus doing the core poi dependency as needed -->
1016                 <!-- Build the main pom -->
1017                 <copy 
1018                         file="poi.pom" 
1019                         tofile="${mavendist.oap.dir}/poms/${jar.name}-${version.id}.pom" 
1020                 >
1021                         <filterchain>
1022                                 <replacetokens>
1023                                         <token key="VERSION" value="${version.id}" />
1024                                         <token key="ARTIFICAT" value="poi" />
1025                                 </replacetokens>
1026                                 <tokenfilter>
1027                                         <filetokenizer/>
1028                                         <replaceregex pattern="START_NON_MAIN.*END_NON_MAIN_DEPENDENCY" replace="No POI dependency on the main jar" flags="s" />
1029                                 </tokenfilter>
1030                         </filterchain>
1031                 </copy>
1032                 <!-- And the contrib pom -->
1033                 <copy 
1034                         file="poi.pom" 
1035                         tofile="${mavendist.oap.dir}/poms/${jar.name}-contrib-${version.id}.pom" 
1036                 >
1037                         <filterchain>
1038                                 <replacetokens>
1039                                         <token key="VERSION" value="${version.id}" />
1040                                         <token key="ARTIFICAT" value="poi-contrib" />
1041                                 </replacetokens>
1042                                 <tokenfilter>
1043                                         <replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1044                                         <replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1045                                 </tokenfilter>
1046                         </filterchain>
1047                 </copy>
1048                 <!-- And the scratchpad pom -->
1049                 <copy 
1050                         file="poi.pom" 
1051                         tofile="${mavendist.oap.dir}/poms/${jar.name}-scratchpad-${version.id}.pom" 
1052                 >
1053                         <filterchain>
1054                                 <replacetokens>
1055                                         <token key="VERSION" value="${version.id}" />
1056                                         <token key="ARTIFICAT" value="poi-scratchpad" />
1057                                 </replacetokens>
1058                                 <tokenfilter>
1059                                         <replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1060                                         <replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
1061                                 </tokenfilter>
1062                         </filterchain>
1063                 </copy>
1065                 <!-- Build the poi => org.apache.poi redirect poms -->
1066                 <!-- Copy from the base file, substituting in the version+artifact -->
1067                 <copy 
1068                         file="poi-redirect.pom" 
1069                         tofile="${mavendist.poi.dir}/poms/${jar.name}-${version.id}.pom" 
1070                 >
1071                         <filterchain><replacetokens>
1072                                 <token key="VERSION" value="${version.id}" />
1073                                 <token key="ARTIFICAT" value="poi" />
1074                         </replacetokens></filterchain>
1075                 </copy>
1076                 <copy 
1077                         file="poi-redirect.pom" 
1078                         tofile="${mavendist.poi.dir}/poms/${jar.name}-contrib-${version.id}.pom" 
1079                 >
1080                         <filterchain><replacetokens>
1081                                 <token key="VERSION" value="${version.id}" />
1082                                 <token key="ARTIFICAT" value="poi-contrib" />
1083                         </replacetokens></filterchain>
1084                 </copy>
1085                 <copy 
1086                         file="poi-redirect.pom" 
1087                         tofile="${mavendist.poi.dir}/poms/${jar.name}-scratchpad-${version.id}.pom" 
1088                 >
1089                         <filterchain><replacetokens>
1090                                 <token key="VERSION" value="${version.id}" />
1091                                 <token key="ARTIFICAT" value="poi-scratchpad" />
1092                         </replacetokens></filterchain>
1093                 </copy>
1095                 <!-- And that's it for maven -->
1096         </target>
1098     <target name="jar" depends="compile" description="Creates jar files for distribution">
1099         <jar destfile="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar">
1100                         <fileset dir="${main.output.dir}" />
1101                         <fileset dir="legal/" />
1102             <manifest>
1103                 <attribute name="Built-By" value="${user.name}"/>
1104                 <attribute name="Specification-Title" value="Apache POI"/>
1105                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1106                 <attribute name="Specification-Vendor" value="Apache"/>
1107                 <attribute name="Implementation-Title" value="Apache POI"/>
1108                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1109                 <attribute name="Implementation-Vendor" value="Apache"/>
1110             </manifest>        
1111         </jar>
1112         <jar destfile="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar">
1113                         <fileset dir="${contrib.output.dir}" />
1114                         <fileset dir="legal/" />
1115             <manifest>
1116                 <attribute name="Built-By" value="${user.name}"/>
1117                 <attribute name="Specification-Title" value="Apache POI"/>
1118                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1119                 <attribute name="Specification-Vendor" value="Apache"/>
1120                 <attribute name="Implementation-Title" value="Apache POI"/>
1121                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1122                 <attribute name="Implementation-Vendor" value="Apache"/>
1123             </manifest>        
1124         </jar>
1125         <jar destfile="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar">
1126                         <fileset dir="${scratchpad.output.dir}" />
1127                         <fileset dir="legal/" />
1128             <manifest>
1129                 <attribute name="Built-By" value="${user.name}"/>
1130                 <attribute name="Specification-Title" value="Apache POI"/>
1131                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1132                 <attribute name="Specification-Vendor" value="Apache"/>
1133                 <attribute name="Implementation-Title" value="Apache POI"/>
1134                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1135                 <attribute name="Implementation-Vendor" value="Apache"/>
1136             </manifest>        
1137         </jar>
1138     </target>
1139     <target name="jar-ooxml" depends="compile-ooxml" description="Creates the ooxml jar files for distribution">
1140         <jar destfile="${dist.dir}/${jar.name}-ooxml-${version.id}-${DSTAMP}.jar">
1141                         <fileset dir="${ooxml.output.dir}" />
1142                         <fileset dir="legal/" />
1143             <manifest>
1144                 <attribute name="Built-By" value="${user.name}"/>
1145                 <attribute name="Specification-Title" value="Apache POI"/>
1146                 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1147                 <attribute name="Specification-Vendor" value="Apache"/>
1148                 <attribute name="Implementation-Title" value="Apache POI"/>
1149                 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1150                 <attribute name="Implementation-Vendor" value="Apache"/>
1151             </manifest>        
1152         </jar>
1153     </target>
1155   <target name="dist" depends="clean, fail-unless-tools-are-available, compile, site, jar"
1156     description="Creates the entire distribution into build/dist, from scratch">
1158         <property name="zipdir" value="${jar.name}-${version.id}" />
1160     <zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
1161       <zipfileset dir="legal/" prefix="${zipdir}" />
1162       <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1163       <zipfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1164       <zipfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1165       <zipfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1166     </zip>
1168     <zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
1169       <zipfileset dir="legal/" prefix="${zipdir}" />
1170       <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1171       <zipfileset dir="." prefix="${zipdir}">
1172         <exclude name="build/**"/>
1173         <exclude name="scripts/**"/>
1174         <exclude name="*.ipr"/>
1175         <exclude name="*.iml"/>
1176         <exclude name="*.iws"/>
1177         <exclude name="*.swp"/>
1178       </zipfileset>
1179     </zip>
1181     <tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz"
1182       compression="gzip">
1183       <tarfileset dir="legal/" prefix="${zipdir}" />
1184       <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1185       <tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1186       <tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1187       <tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1188     </tar>
1190     <tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz"
1191       compression="gzip">
1192       <tarfileset dir="legal/" prefix="${zipdir}" />
1193       <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1194       <tarfileset dir="." prefix="${zipdir}">
1195         <exclude name="build/**"/>
1196         <exclude name="scripts/**"/>
1197         <exclude name="*.ipr"/>
1198         <exclude name="*.iml"/>
1199         <exclude name="*.iws"/>
1200         <exclude name="*.swp"/>
1201       </tarfileset>
1202     </tar>
1204     <echo>Distribution located in build/dist</echo>
1205   </target>
1207   <target name="clean-compile" depends="clean, compile"/>
1209   <target name="clean-dist" depends="clean, dist"
1210     description="Cleans the build directory then creates a distribution"/>
1212   <target name="gump" depends="test, jar"/>
1216   <!-- Generates the Ant document type definition (DTD) -->
1217   <target name="dtd"
1218     description="Generates the Ant document type definition (DTD)">
1219     <antstructure output="ant.dtd"/>
1220   </target>
1225   <!-- Abort the build if JUnit is missing. -->
1226   <target name="fail-unless-junit-is-available" depends="init">
1227     <condition property="isAvailable.junit">
1228       <available classname="junit.framework.TestCase"/>
1229     </condition>
1230     <antcall target="fail-junit"/>
1231   </target>
1233   <target name="fail-junit" unless="isAvailable.junit">
1234     <echo>
1235       JUnit is not available. You must download JUnit from
1236       &lt;http://www.junit.org/&gt; and include the JAR file in your
1237       classpath.
1238     </echo> 
1239     <fail message="JUnit is not available."/>
1240   </target>
1242   <!-- Warn if JUnit is missing. -->
1243   <target name="warn-unless-junit-is-available" depends="init">
1244     <condition property="isAvailable.junit">
1245       <available classname="junit.framework.TestCase"/>
1246     </condition>
1247     <antcall target="warn-junit"/>
1248   </target>
1250   <target name="warn-junit" unless="isAvailable.junit">
1251     <echo>
1252       WARNING: Since JUnit is not available you might encounter failures
1253       subsequently. In order to avoid this you should download JUnit from
1254       &lt;http://www.junit.org/&gt; and include the JAR file in your
1255       classpath.
1256     </echo> 
1257   </target>
1261   <!-- Abort the build if JDepend is missing. -->
1262   <target name="fail-unless-jdepend-is-available" depends="init">
1263     <condition property="isAvailable.jdepend">
1264       <available classname="jdepend.framework.JDepend"/>
1265     </condition>
1266     <antcall target="fail-jdepend"/>
1267   </target>
1269   <target name="fail-jdepend" unless="isAvailable.jdepend">
1270     <echo>
1271       JDepend is not available. You must download JDepend from
1272       &lt;http://www.clarkware.com/software/JDepend.html&gt; and include the
1273       JAR file in your classpath.
1274     </echo> 
1275     <fail message="JDepend is not available."/>
1276   </target>
1280   <!-- Abort the build if an XSLT processor is missing. -->
1281   <target name="fail-unless-xslt-is-available" depends="init">
1282     <condition property="isAvailable.xslt">
1283       <available classname="javax.xml.transform.TransformerFactory"/>
1284     </condition>
1285     <antcall target="fail-xslt"/>
1286   </target>
1288   <target name="fail-xslt" unless="isAvailable.xslt">
1289     <echo>
1290       An XSLT processor is missing. You must download e.g. Xalan from
1291       &lt;http://xml.apache.org/xalan-j/&gt; and include the JAR file in your
1292       classpath.
1293     </echo> 
1294     <fail message="An XSLT processor is not available."/>
1295   </target>
1297   <!-- Warn if an XSLT processor is missing. -->
1298   <target name="warn-unless-xslt-is-available" depends="init">
1299     <condition property="isAvailable.xslt">
1300       <available classname="javax.xml.transform.TransformerFactory"/>
1301     </condition>
1302     <antcall target="warn-xslt"/>
1303   </target>
1305   <target name="warn-xslt" unless="isAvailable.xslt">
1306     <echo>
1307       WARNING: Since an XSLT processor is not available you might encounter
1308       failures subsequently. In order to avoid this you should download
1309       e.g. Xalan from &lt;http://xml.apache.org/xalan-j/&gt; and include the
1310       JAR file in your classpath.
1311     </echo> 
1312   </target>
1316   <!-- Aborts the build if any of the required tools are missing. -->
1317   <target name="fail-unless-tools-are-available"
1318     depends="fail-unless-junit-is-available, fail-unless-junit-is-available,
1319     fail-unless-jdepend-is-available"/>
1323   <!-- Runs jdepend to produce a report about package dependencies -->
1324   <target name="jdepend" depends="fail-unless-jdepend-is-available"
1325     description="Runs jdepend to produce a report about package dependencies">
1326     <jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
1327       <classespath>
1328         <pathelement location="${main.output.dir}"/>
1329         <pathelement location="${contrib.output.dir}"/>
1330         <pathelement location="${scratchpad.output.dir}"/>
1331       </classespath>
1332       <classpath>
1333         <path refid="main.classpath"/>
1334         <path refid="contrib.classpath"/>
1335         <path refid="scratchpad.classpath"/>
1336       </classpath>
1337     </jdepend>
1339     <style basedir="${jdepend.report.dir}"
1340       in="${jdepend.report.dir}/jdepend.xml"
1341       out="${jdepend.report.out.dir}/index.html"
1342       style="jdepend.xsl"/>
1343   </target>
1345 </project>
1347 <!-- Keep this comment at the end of the file
1348 Local variables:
1349 mode: xml
1350 sgml-omittag:nil
1351 sgml-shorttag:nil
1352 sgml-namecase-general:nil
1353 sgml-general-insert-case:lower
1354 sgml-minimize-attributes:nil
1355 sgml-always-quote-attributes:t
1356 sgml-indent-step:2
1357 sgml-indent-data:t
1358 sgml-parent-document:nil
1359 sgml-exposed-tags:nil
1360 sgml-local-catalogs:nil
1361 sgml-local-ecat-files:nil
1362 End: