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
20 <!DOCTYPE project PUBLIC "-//Ant//Project 1.5//EN" "ant.dtd">
23 POI Build System. Written by:
25 Glen Stampoultzis glens at apache.org
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:
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
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
55 Convert book.xml files to a sitemap.
58 <project name="POI Build" default="help" basedir=".">
61 The POI project Ant build.
64 <property environment="env"/>
66 <property name="repository" value="http://www.ibiblio.org/maven"/>
67 <property name="forrest.home" value="${env.FORREST_HOME}"/>
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="main.reports.test" location="build/test-results"/>
78 <property name="main.jar1.dir" location="${main.lib}/commons-logging-1.1.jar"/>
79 <property name="main.jar1.url" value="${repository}/commons-logging/jars/commons-logging-1.1.jar"/>
80 <property name="main.jar2.dir" location="${main.lib}/log4j-1.2.13.jar"/>
81 <property name="main.jar2.url" value="${repository}/log4j/jars/log4j-1.2.13.jar"/>
82 <property name="main.testokfile" location="build/main-testokfile.txt"/>
84 <property name="junit.jar1.dir" location="${main.lib}/junit-3.8.1.jar"/>
85 <property name="junit.jar1.url" value="${repository}/junit/jars/junit-3.8.1.jar"/>
88 <property name="scratchpad.resource1.dir" value="src/resources/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"/>
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 <property name="build.site" location="build/tmp/site/build/site"/>
128 <property name="build.site.src" location="build/tmp/site"/>
129 <property name="junit.report.dir" location="${build.site}/junit"/>
130 <property name="jdepend.report.dir" location="${build.site}/jdepend"/>
131 <property name="jdepend.report.out.dir" location="${build.site.src}/src/documentation/content/jdepend"/>
132 <property name="apidocs.report.dir" location="${build.site}/apidocs"/>
133 <property name="changelog.file" location="${build.site}/changelog.html"/>
134 <property name="dist.dir" location="build/dist"/>
135 <property name="mavendist.dir" location="build/maven-dist"/>
136 <property name="mavendist.poi.dir" location="build/maven-dist/poi"/>
137 <property name="mavendist.oap.dir" location="build/maven-dist/org.apache.poi"/>
138 <property name="jar.name" value="poi"/>
139 <property name="version.id" value="3.2-alpha1"/>
140 <property name="halt.on.test.failure" value="true"/>
141 <property name="jdk.version.source" value="1.3"
142 description="JDK version of source code"/>
143 <property name="jdk.version.class" value="1.3"
144 description="JDK version of generated class files"/>
147 <path id="main.classpath">
148 <pathelement location="${main.jar1.dir}"/>
149 <pathelement location="${main.jar2.dir}"/>
150 <pathelement location="${main.resource1.dir}"/>
153 <path id="scratchpad.classpath">
154 <path refid="main.classpath"/>
155 <pathelement location="${main.output.dir}"/>
156 <pathelement location="${scratchpad.resource1.dir}"/>
159 <path id="contrib.classpath">
160 <path refid="main.classpath"/>
161 <pathelement location="${contrib.jar1.dir}"/>
162 <pathelement location="${contrib.jar2.dir}"/>
163 <pathelement location="${contrib.jar3.dir}"/>
164 <pathelement location="${main.output.dir}"/>
165 <pathelement location="${main.output.test.dir}"/>
166 <pathelement location="${scratchpad.output.dir}"/>
167 <pathelement location="${scratchpad.output.test.dir}"/>
168 <pathelement location="${contrib.output.dir}"/>
169 <pathelement location="${contrib.output.test.dir}"/>
172 <path id="examples.classpath">
173 <path refid="main.classpath"/>
174 <pathelement location="${main.output.dir}"/>
175 <pathelement location="${scratchpad.output.dir}"/>
180 <!-- Prints POI's Ant usage help -->
181 <target name="help" description="Prints POI's Ant usage help">
183 - Execute "ant -projecthelp" to view a listing of the main build
185 - Execute "ant help-properties" to view a listing of some properties
186 controlling the build process.
192 <target name="help-properties"
193 description="Prints a listing of build controlling properties">
195 The following properties control the build process:
197 -Ddisconnected="true": Do not execute any targets that require an online
198 connection to the Internet.
199 -Dtestcase=org.apache.poi.xxx.xxx : for the single-test target, specify
202 WARNING: This list is not exhaustive.
208 <target name="with.clover" if="clover.present">
209 <taskdef resource="clovertasks"/>
210 <clover-setup initString="mycoverage.db"/>
213 <target name="clover.html" depends="with.clover" if="clover.present">
214 <echo>Generating clover report</echo>
216 <current outfile="build/tmp/site/build/site/clover_html">
217 <format type="html"/>
222 <target name="init" depends="check-jars,fetch-jars">
225 <format property="tstamp.year" pattern="yyyy"/>
228 <available resource="clovertasks" property="clover.present"/>
229 <antcall target="with.clover"/>
232 <mkdir dir="build/non-ant-classes"/>
233 <mkdir dir="${main.output.dir}"/>
234 <mkdir dir="${scratchpad.output.dir}"/>
235 <mkdir dir="${contrib.output.dir}"/>
236 <mkdir dir="${examples.output.dir}"/>
237 <mkdir dir="${main.output.test.dir}"/>
238 <mkdir dir="${contrib.output.test.dir}"/>
239 <mkdir dir="${scratchpad.output.test.dir}"/>
240 <mkdir dir="${main.reports.test}"/>
241 <mkdir dir="${scratchpad.reports.test}"/>
242 <mkdir dir="${contrib.reports.test}"/>
243 <mkdir dir="${junit.report.dir}"/>
244 <mkdir dir="${jdepend.report.dir}"/>
245 <mkdir dir="${jdepend.report.out.dir}"/>
246 <mkdir dir="${apidocs.report.dir}"/>
247 <mkdir dir="${dist.dir}"/>
248 <mkdir dir="${build.site.src}/${main.documentation}"/>
250 <mkdir dir="${mavendist.dir}"/>
251 <mkdir dir="${mavendist.poi.dir}"/>
252 <mkdir dir="${mavendist.poi.dir}/poms"/>
253 <mkdir dir="${mavendist.oap.dir}"/>
254 <mkdir dir="${mavendist.oap.dir}/jars"/>
255 <mkdir dir="${mavendist.oap.dir}/poms"/>
257 <copy todir="${build.site.src}/${main.documentation}">
258 <fileset dir="${main.documentation}"/>
260 <copy file="forrest.properties" tofile="${build.site.src}/forrest.properties"/>
263 <target name="clean">
264 <delete dir="build"/>
267 <target name="check-jars">
268 <condition property="jars.present">
271 <available file="${main.jar1.dir}"/>
272 <available file="${main.jar2.dir}"/>
273 <available file="${contrib.jar1.dir}"/>
274 <available file="${contrib.jar2.dir}"/>
275 <available file="${contrib.jar3.dir}"/>
276 <available file="${junit.jar1.dir}"/>
278 <isset property="disconnected"/>
283 <target name="fetch-jars" unless="jars.present"
284 description="Fetches needed JAR files from the Internet">
285 <get src="${main.jar1.url}" dest="${main.jar1.dir}"/>
286 <get src="${main.jar2.url}" dest="${main.jar2.dir}"/>
287 <get src="${contrib.jar1.url}" dest="${contrib.jar1.dir}"/>
288 <get src="${contrib.jar2.url}" dest="${contrib.jar2.dir}"/>
289 <get src="${contrib.jar3.url}" dest="${contrib.jar3.dir}"/>
290 <get src="${junit.jar1.url}" dest="${junit.jar1.dir}"/>
293 <target name="compile" depends="init, compile-main, compile-scratchpad,
294 compile-contrib, compile-examples"
295 description="Compiles the POI main classes, scratchpad, contrib, and examples"/>
297 <target name="compile-main" depends="fail-unless-xslt-is-available">
298 <copy todir="${main.output.dir}">
299 <fileset dir="${main.resource1.dir}"/>
301 <javac target="${jdk.version.class}" source="${jdk.version.source}"
302 failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
303 srcdir="${main.src}">
304 <classpath refid="main.classpath"/>
306 <javac target="${jdk.version.class}" source="${jdk.version.source}"
307 failonerror="true" destdir="${main.output.test.dir}" debug="on"
308 fork="yes" srcdir="${main.src.test}">
310 <path refid="main.classpath"/>
311 <pathelement location="${main.output.dir}"/>
312 <pathelement location="${junit.jar1.dir}"/>
317 <target name="compile-scratchpad" depends="init,compile-main">
318 <javac target="${jdk.version.class}" source="${jdk.version.source}"
319 failonerror="true" destdir="${scratchpad.output.dir}" debug="on"
320 fork="yes" srcdir="${scratchpad.src}">
321 <classpath refid="scratchpad.classpath"/>
323 <javac target="${jdk.version.class}" source="${jdk.version.source}"
324 failonerror="true" destdir="${scratchpad.output.test.dir}" debug="on"
325 fork="yes" srcdir="${scratchpad.src.test}">
327 <path refid="scratchpad.classpath"/>
328 <pathelement location="${scratchpad.output.dir}"/>
329 <pathelement location="${junit.jar1.dir}"/>
333 <!-- Copy HSLF Resources over -->
334 <property name="hslf.data" value="org/apache/poi/hslf/data" />
335 <mkdir dir="${scratchpad.output.dir}/${hslf.data}" />
336 <copy todir="${scratchpad.output.dir}/${hslf.data}">
337 <fileset dir="${scratchpad.src}/${hslf.data}">
338 <include name="*.ppt" />
342 <!-- Copy HDGF Resources over -->
343 <copy todir="${scratchpad.output.dir}">
344 <fileset dir="${scratchpad.resource1.dir}"/>
348 <target name="compile-contrib" depends="init">
349 <javac target="${jdk.version.class}" source="${jdk.version.source}"
350 failonerror="true" destdir="${contrib.output.dir}" debug="on" fork="yes"
351 srcdir="${contrib.src}">
352 <classpath refid="contrib.classpath"/>
354 <javac target="${jdk.version.class}" source="${jdk.version.source}"
355 failonerror="true" destdir="${contrib.output.test.dir}" debug="on"
356 fork="yes" srcdir="${contrib.src.test}">
358 <path refid="contrib.classpath"/>
359 <pathelement location="${contrib.output.dir}"/>
360 <pathelement location="${junit.jar1.dir}"/>
365 <target name="compile-examples" depends="init">
366 <javac target="${jdk.version.class}" source="${jdk.version.source}"
367 destdir="${examples.output.dir}" debug="on" srcdir="${examples.src}">
368 <classpath refid="examples.classpath"/>
372 <target name="test" depends="test-main,test-scratchpad,test-contrib"
373 description="Tests main, contrib and scratchpad"/>
375 <target name="-test-main-check">
376 <uptodate property="main.test.notRequired" targetfile="${main.testokfile}">
377 <srcfiles dir="${main.src}"/>
378 <srcfiles dir="${main.src.test}"/>
382 <path id="test.classpath">
383 <path refid="main.classpath"/>
384 <pathelement location="${main.output.dir}"/>
385 <pathelement location="${main.output.test.dir}"/>
386 <pathelement location="${junit.jar1.dir}"/>
389 <target name="test-main" unless="main.test.notRequired"
390 depends="compile-main, -test-main-check, fail-unless-junit-is-available">
391 <junit fork="no" printsummary="yes" haltonfailure="${halt.on.test.failure}"
392 failureproperty="main.test.failed" showoutput="true">
393 <classpath refid="test.classpath"/>
394 <sysproperty key="HSSF.testdata.path"
395 file="${main.src.test}/org/apache/poi/hssf/data"/>
396 <sysproperty key="HSLF.testdata.path"
397 file="${main.src.test}/org/apache/poi/hslf/data"/>
398 <sysproperty key="HWPF.testdata.path"
399 file="${main.src.test}/org/apache/poi/hwpf/data"/>
400 <sysproperty key="HPSF.testdata.path"
401 file="${main.src.test}/org/apache/poi/hpsf/data"/>
402 <sysproperty key="POIFS.testdata.path"
403 file="${main.src.test}/org/apache/poi/poifs/data"/>
404 <sysproperty key="DDF.testdata.path"
405 file="${main.src.test}/org/apache/poi/ddf/data"/>
406 <sysproperty key="java.awt.headless" value="true"/>
407 <formatter type="plain"/>
408 <formatter type="xml"/>
409 <batchtest todir="${main.reports.test}">
410 <fileset dir="${main.src.test}">
411 <include name="**/Test*.java"/>
412 <exclude name="**/All*Tests.java"/>
413 <exclude name="**/TestUnfixedBugs.java"/>
414 <exclude name="**/TestcaseRecordInputStream.java"/>
418 <delete file="${main.testokfile}"/>
419 <antcall target="-test-main-write-testfile"/>
422 <target name="test-fail" depends="compile-main,
423 fail-unless-junit-is-available"
424 description="run tests that are known to fail">
425 <junit printsummary="yes" showoutput="true" filtertrace="no"
426 haltonfailure="false">
427 <classpath refid="test.classpath"/>
429 <path refid="scratchpad.classpath"/>
430 <pathelement location="${main.output.dir}"/>
431 <pathelement location="${scratchpad.output.dir}"/>
432 <pathelement location="${scratchpad.output.test.dir}"/>
433 <pathelement location="${junit.jar1.dir}"/>
435 <sysproperty key="HSSF.testdata.path"
436 file="${main.src.test}/org/apache/poi/hssf/data"/>
437 <sysproperty key="HPSF.testdata.path"
438 file="${main.src.test}/org/apache/poi/hpsf/data"/>
439 <sysproperty key="HWPF.testdata.path"
440 file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
441 <sysproperty key="POIFS.testdata.path"
442 file="${main.src.test}/org/apache/poi/poifs/data"/>
443 <sysproperty key="java.awt.headless" value="true"/>
444 <formatter type="plain" usefile="no"/>
445 <batchtest todir="${main.reports.test}">
446 <fileset dir="${main.src.test}">
447 <include name="**/TestEmptyDocument.java"/>
448 <include name="**/TestUnfixedBugs.java"/>
456 <target name="single-test" depends="-test-property-check,compile-main" description="Runs a single test case specified with -Dtestcase=classname">
457 <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
458 <classpath refid="test.classpath"/>
460 <path refid="test.classpath"/>
461 <pathelement location="${main.output.dir}"/>
462 <pathelement location="${scratchpad.output.dir}"/>
463 <pathelement location="${scratchpad.output.test.dir}"/>
464 <pathelement location="${junit.jar1.dir}"/>
466 <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
467 <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
468 <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
469 <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
470 <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
471 <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
472 <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
473 <sysproperty key="java.awt.headless" value="true"/>
474 <formatter type="plain" usefile="no"/>
475 <formatter type="xml"/>
476 <test name="${testcase}"/>
480 <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." >
481 <echo>Waiting for debugger on port 5001</echo>
482 <junit printsummary="no" showoutput="true" filtertrace="no" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed">
483 <jvmarg value="-Xdebug"/>
484 <jvmarg value="-Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=y"/>
485 <sysproperty key="java.compiler" value="NONE"/>
486 <classpath refid="test.classpath"/>
487 <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
488 <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
489 <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
490 <sysproperty key="java.awt.headless" value="true"/>
491 <formatter type="plain" usefile="no"/>
492 <test name="${testcase}"/>
496 <target name="-test-property-check" unless="testcase">
497 <echo message="Please use -Dtestcase=org.your.testcase to run a single test"/>
501 <target name="-test-main-write-testfile" unless="main.test.failed">
502 <echo file="${main.testokfile}" append="false" message="testok"/>
505 <target name="-test-scratchpad-check">
506 <uptodate property="scratchpad.test.notRequired" targetfile="${scratchpad.testokfile}">
507 <srcfiles dir="${scratchpad.src}"/>
508 <srcfiles dir="${scratchpad.src.test}"/>
512 <target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check" unless="scratchpad.test.notRequired">
513 <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="scratchpad.test.failed">
515 <path refid="scratchpad.classpath"/>
516 <pathelement location="${main.output.dir}"/>
517 <pathelement location="${scratchpad.output.dir}"/>
518 <pathelement location="${scratchpad.output.test.dir}"/>
519 <pathelement location="${junit.jar1.dir}"/>
521 <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
522 <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
523 <sysproperty key="HDF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdf/data"/>
524 <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
525 <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
526 <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
527 <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
528 <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
529 <sysproperty key="java.awt.headless" value="true"/>
530 <formatter type="plain"/>
531 <formatter type="xml"/>
532 <batchtest todir="${scratchpad.reports.test}">
533 <fileset dir="${scratchpad.src.test}">
534 <include name="**/Test*.java"/>
535 <exclude name="**/AllTests.java"/>
539 <delete file="${scratchpad.testokfile}"/>
540 <antcall target="-test-scratchpad-write-testfile"/>
543 <target name="-test-scratchpad-write-testfile" unless="scratchpad.test.failed">
544 <echo file="${scratchpad.testokfile}" append="false" message="testok"/>
547 <target name="single-scratchpad-test" depends="compile-scratchpad,-test-property-check" description="Runs a single test case specified with -Dtestcase=classname">
548 <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
549 <classpath refid="test.classpath"/>
551 <path refid="scratchpad.classpath"/>
552 <pathelement location="${main.output.dir}"/>
553 <pathelement location="${scratchpad.output.dir}"/>
554 <pathelement location="${scratchpad.output.test.dir}"/>
555 <pathelement location="${junit.jar1.dir}"/>
557 <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
558 <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
559 <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
560 <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
561 <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
562 <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
563 <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
564 <sysproperty key="java.awt.headless" value="true"/>
565 <sysproperty key="java.awt.headless" value="true"/>
566 <formatter type="plain" usefile="no"/>
567 <formatter type="xml"/>
568 <test name="${testcase}"/>
572 <target name="-test-contrib-check">
573 <uptodate property="contrib.test.notRequired" targetfile="${contrib.testokfile}">
574 <srcfiles dir="${contrib.src}"/>
575 <srcfiles dir="${contrib.src.test}"/>
579 <target name="test-contrib" depends="compile-main,compile-contrib,-test-contrib-check" unless="contrib.test.notRequired">
580 <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="contrib.test.failed">
582 <path refid="contrib.classpath"/>
583 <pathelement location="${main.output.dir}"/>
584 <pathelement location="${contrib.output.dir}"/>
585 <pathelement location="${contrib.output.test.dir}"/>
586 <pathelement location="${junit.jar1.dir}"/>
588 <sysproperty key="HSSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hssf/data"/>
589 <sysproperty key="HPSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hpsf/data"/>
590 <sysproperty key="java.awt.headless" value="true"/>
591 <formatter type="plain"/>
592 <formatter type="xml"/>
593 <batchtest todir="${contrib.reports.test}">
594 <fileset dir="${contrib.src.test}">
595 <include name="**/Test*.java"/>
596 <exclude name="**/AllTests.java"/>
600 <delete file="${contrib.testokfile}"/>
601 <antcall target="-test-contrib-write-testfile"/>
604 <target name="-test-contrib-write-testfile" unless="contrib.test.failed">
605 <echo file="${contrib.testokfile}" append="false" message="testok"/>
608 <target name="-check-docs">
609 <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html">
610 <srcfiles dir="${build.site.src}"/>
614 <target name="-check-forrest-installed" unless="env.FORREST_HOME">
615 <echo>Please install Apache Forrest (see
616 <http://xml.apache.org/forrest/index.html>) and set the
617 FORREST_HOME environment variable!</echo>
618 <fail message="Apache Forrest is not installed."/>
621 <!-- <target name="check-docs">-->
622 <!-- <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html" >-->
623 <!-- <srcfiles dir= "${build.site.src}"/>-->
627 <target name="docs" depends="init, -check-forrest-installed, -check-docs"
628 unless="main.docs.notRequired" description="Builds the POI website">
630 <mkdir dir="${build.site.src}/src/documentation/content/apidocs"/>
631 <copy todir="${build.site.src}/src/documentation/content/apidocs">
632 <fileset dir="${apidocs.report.dir}"/>
635 tofile="${build.site.src}/src/documentation/content/jdepend.ehtml"
636 file="${jdepend.report.dir}/index.html" failonerror="false"/>
637 <mkdir dir="${build.site.src}/src/documentation/content/junit"/>
638 <copy todir="${build.site.src}/src/documentation/content/junit">
639 <fileset dir="${junit.report.dir}"/>
643 file="${build.site.src}/src/documentation/content/xdocs/status.xml"
644 tofile="${build.site.src}/status.xml"/>
646 <ant antfile="${forrest.home}/forrest.antproxy.xml" target="site">
647 <property name="project.home" location="${build.site.src}"/>
650 <echo>Broken links:</echo>
651 <echo file="${build.site}/../tmp/brokenlinks.txt"/>
654 <fileset dir="${build.site}"/>
658 <!-- Checks whether reports are required to be run. If nothing has changed then they dont. -->
659 <target name="-check-reports">
660 <condition property="reports.notRequired">
662 <equals arg1="${main.test.notRequired}" arg2="true"/>
663 <equals arg1="${scratchpad.test.notRequired}" arg2="true"/>
664 <equals arg1="${contrib.test.notRequired}" arg2="true"/>
671 <!-- Generates a log of the latest changes in the CVS repository. -->
672 <target name="cvschangelog" unless="disconnected"
673 depends="fail-unless-xslt-is-available"
674 description="Generates a CVS change log report">
675 <antcall target="cvs-rsh-warning"/>
676 <cvschangelog destfile="${changelog.file}" daysinpast="30"/>
678 <style in="${changelog.file}"
679 out="${build.site.src}/src/documentation/content/changelog.html"
680 style="changelog.xsl">
681 <param name="title" expression="POI Change Log"/>
682 <param name="module" expression="jakarta-poi"/>
683 <param name="cvsweb" expression="http://cvs.apache.org/viewcvs/"/>
687 <target name="cvs-rsh-warning" unless="env.CVS_RSH">
689 WARNING: The environment variable CVS_RSH is not set. If you cannot
690 access the CVS repository this could be one of the reasons for the
697 <!-- Creates reports and API documentation -->
698 <target name="reports" unless="reports.notRequired" depends="-check-reports,
699 fail-unless-xslt-is-available, fail-unless-junit-is-available,
700 fail-unless-jdepend-is-available, test-ignore-failures, junitreport,
701 jdepend, cvschangelog, javadocs, clover.html"
702 description="Creates various reports and the API documentation">
707 <!-- Runs all JUnit tests without aborting if one of the tests fails. -->
708 <target name="test-ignore-failures" depends="init">
709 <antcall target="test">
710 <param name="halt.on.test.failure" value="false"/>
716 <!-- Produces a report of the JUnit test results -->
717 <target name="junitreport"
718 depends="fail-unless-xslt-is-available, test-ignore-failures"
719 description="Produces a report of the JUnit test results">
720 <junitreport todir="${junit.report.dir}">
721 <fileset dir="${main.reports.test}">
722 <include name="TEST-*.xml"/>
724 <fileset dir="${scratchpad.reports.test}">
725 <include name="TEST-*.xml"/>
727 <fileset dir="${contrib.reports.test}">
728 <include name="TEST-*.xml"/>
730 <report format="frames" todir="${junit.report.dir}"/>
736 <!-- Generates the API documentation. -->
737 <target name="javadocs" depends="init, warn-unless-junit-is-available,
738 warn-unless-xslt-is-available"
739 description="Generates the API documentation">
740 <javadoc verbose="false" author="true" destdir="${apidocs.report.dir}"
741 windowtitle="POI API Documentation" use="true" version="true">
743 <packageset dir="${main.src}" defaultexcludes="yes">
744 <include name="org/apache/poi/**"/>
746 <packageset dir="${scratchpad.src}" defaultexcludes="yes">
747 <include name="org/apache/poi/**"/>
748 <exclude name="org/apache/poi/hdf/**"/>
750 <packageset dir="${contrib.src}" defaultexcludes="yes">
751 <include name="org/apache/poi/**"/>
753 <packageset dir="${examples.src}" defaultexcludes="yes">
754 <include name="org/apache/poi/**"/>
757 <classpath id="javadoc.classpath">
758 <path refid="main.classpath"/>
759 <path refid="scratchpad.classpath"/>
760 <path refid="contrib.classpath"/>
761 <path refid="examples.classpath"/>
762 <path path="${env.CLASSPATH}"/>
765 <doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle>
767 <![CDATA[<i>Copyright ${tstamp.year} The Apache Software Foundation or
768 its licensors, as applicable.</i>]]>
771 <title>DDF - Dreadful Drawing Format</title>
772 <package name="org.apache.poi.ddf*"/>
775 <title>HPSF - Horrible Property Set Format</title>
776 <package name="org.apache.poi.hpsf*"/>
779 <title>HSSF - Horrible Spreadsheet Format</title>
780 <package name="org.apache.poi.hssf*"/>
783 <title>HWPF - Horrible Word Processor Format</title>
784 <package name="org.apache.poi.hwpf*"/>
787 <title>POIFS - POI File System</title>
788 <package name="org.apache.poi.poifs*"/>
791 <title>Utilities</title>
792 <package name="org.apache.poi.util*"/>
795 <title>Examples</title>
796 <package name="org.apache.poi.hpsf.examples*"/>
797 <package name="org.apache.poi.hssf.usermodel.examples*"/>
801 <antcall target="clover.html"/>
806 <!-- ================================== -->
807 <!-- Generate records -->
808 <!-- ================================== -->
810 <target name="generate-records" depends="init"
811 description="Generates HSSF records">
812 <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
813 <arg file="src/records/definitions"/>
814 <arg file="src/records/styles"/>
815 <arg file="src/java"/>
816 <arg file="src/testcases"/>
818 <path refid="scratchpad.classpath"/>
819 <pathelement location="${main.output.dir}"/>
820 <pathelement location="${scratchpad.output.dir}"/>
825 <!-- ================================== -->
826 <!-- Generate types -->
827 <!-- ================================== -->
829 <target name="generate-types" depends="init"
830 description="Generates word types">
831 <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
832 <arg file="src/types/definitions"/>
833 <arg file="src/types/styles"/>
834 <arg file="src/scratchpad/src"/>
835 <arg file="src/scratchpad/testcases"/>
837 <path refid="scratchpad.classpath">
839 <pathelement location="${main.output.dir}"/>
840 <pathelement location="${scratchpad.output.dir}"/>
847 <!-- Generates documentation and reports -->
848 <target name="site" depends="reports, docs"
849 description="Generates POI's website's contents"/>
852 <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">
853 <!-- Copy the jar files into the maven jar directory -->
854 <!-- Same jars as for the main release, only lacking the datestamp -->
856 file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"
857 tofile="${mavendist.oap.dir}/jars/${jar.name}-${version.id}.jar" />
859 file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"
860 tofile="${mavendist.oap.dir}/jars/${jar.name}-contrib-${version.id}.jar" />
862 file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"
863 tofile="${mavendist.oap.dir}/jars/${jar.name}-scratchpad-${version.id}.jar" />
865 <!-- TODO: Decide about source jars, and copy them if we have some -->
867 <!-- Build the org.apache.poi poms -->
868 <!-- Copy from the base file, substituting in the version and -->
869 <!-- artificat, plus doing the core poi dependency as needed -->
871 <!-- Build the main pom -->
874 tofile="${mavendist.oap.dir}/poms/${jar.name}-${version.id}.pom"
878 <token key="VERSION" value="${version.id}" />
879 <token key="ARTIFICAT" value="poi" />
883 <replaceregex pattern="START_NON_MAIN.*END_NON_MAIN_DEPENDENCY" replace="No POI dependency on the main jar" flags="s" />
887 <!-- And the contrib pom -->
890 tofile="${mavendist.oap.dir}/poms/${jar.name}-contrib-${version.id}.pom"
894 <token key="VERSION" value="${version.id}" />
895 <token key="ARTIFICAT" value="poi-contrib" />
898 <replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
899 <replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
903 <!-- And the scratchpad pom -->
906 tofile="${mavendist.oap.dir}/poms/${jar.name}-scratchpad-${version.id}.pom"
910 <token key="VERSION" value="${version.id}" />
911 <token key="ARTIFICAT" value="poi-scratchpad" />
914 <replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
915 <replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
920 <!-- Build the poi => org.apache.poi redirect poms -->
921 <!-- Copy from the base file, substituting in the version+artifact -->
923 file="poi-redirect.pom"
924 tofile="${mavendist.poi.dir}/poms/${jar.name}-${version.id}.pom"
926 <filterchain><replacetokens>
927 <token key="VERSION" value="${version.id}" />
928 <token key="ARTIFICAT" value="poi" />
929 </replacetokens></filterchain>
932 file="poi-redirect.pom"
933 tofile="${mavendist.poi.dir}/poms/${jar.name}-contrib-${version.id}.pom"
935 <filterchain><replacetokens>
936 <token key="VERSION" value="${version.id}" />
937 <token key="ARTIFICAT" value="poi-contrib" />
938 </replacetokens></filterchain>
941 file="poi-redirect.pom"
942 tofile="${mavendist.poi.dir}/poms/${jar.name}-scratchpad-${version.id}.pom"
944 <filterchain><replacetokens>
945 <token key="VERSION" value="${version.id}" />
946 <token key="ARTIFICAT" value="poi-scratchpad" />
947 </replacetokens></filterchain>
950 <!-- And that's it for maven -->
953 <target name="jar" depends="compile" description="Creates jar files for distribution">
954 <jar destfile="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar">
955 <fileset dir="${main.output.dir}" />
956 <fileset dir="legal/" />
958 <attribute name="Built-By" value="${user.name}"/>
959 <attribute name="Specification-Title" value="Apache POI"/>
960 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
961 <attribute name="Specification-Vendor" value="Apache"/>
962 <attribute name="Implementation-Title" value="Apache POI"/>
963 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
964 <attribute name="Implementation-Vendor" value="Apache"/>
967 <jar destfile="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar">
968 <fileset dir="${contrib.output.dir}" />
969 <fileset dir="legal/" />
971 <attribute name="Built-By" value="${user.name}"/>
972 <attribute name="Specification-Title" value="Apache POI"/>
973 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
974 <attribute name="Specification-Vendor" value="Apache"/>
975 <attribute name="Implementation-Title" value="Apache POI"/>
976 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
977 <attribute name="Implementation-Vendor" value="Apache"/>
980 <jar destfile="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar">
981 <fileset dir="${scratchpad.output.dir}" />
982 <fileset dir="legal/" />
984 <attribute name="Built-By" value="${user.name}"/>
985 <attribute name="Specification-Title" value="Apache POI"/>
986 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
987 <attribute name="Specification-Vendor" value="Apache"/>
988 <attribute name="Implementation-Title" value="Apache POI"/>
989 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
990 <attribute name="Implementation-Vendor" value="Apache"/>
995 <target name="dist" depends="clean, fail-unless-tools-are-available, compile, site, jar"
996 description="Creates the entire distribution into build/dist, from scratch">
998 <property name="zipdir" value="${jar.name}-${version.id}" />
1000 <zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
1001 <zipfileset dir="legal/" prefix="${zipdir}" />
1002 <zipfileset dir="lib/" prefix="${zipdir}/lib" />
1003 <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1004 <zipfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1005 <zipfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1006 <zipfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1009 <zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
1010 <zipfileset dir="legal/" prefix="${zipdir}" />
1011 <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1012 <zipfileset dir="." prefix="${zipdir}">
1013 <exclude name="build/**"/>
1014 <exclude name="scripts/**"/>
1015 <exclude name="*.ipr"/>
1016 <exclude name="*.iml"/>
1017 <exclude name="*.iws"/>
1018 <exclude name="*.swp"/>
1022 <tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz"
1024 <tarfileset dir="legal/" prefix="${zipdir}" />
1025 <tarfileset dir="lib/" prefix="${zipdir}/lib" />
1026 <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1027 <tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1028 <tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1029 <tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1032 <tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz"
1034 <tarfileset dir="legal/" prefix="${zipdir}" />
1035 <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1036 <tarfileset dir="." prefix="${zipdir}">
1037 <exclude name="build/**"/>
1038 <exclude name="scripts/**"/>
1039 <exclude name="*.ipr"/>
1040 <exclude name="*.iml"/>
1041 <exclude name="*.iws"/>
1042 <exclude name="*.swp"/>
1046 <echo>Distribution located in build/dist</echo>
1049 <target name="clean-compile" depends="clean, compile"/>
1051 <target name="clean-dist" depends="clean, dist"
1052 description="Cleans the build directory then creates a distribution"/>
1054 <target name="gump" depends="test, jar"/>
1058 <!-- Generates the Ant document type definition (DTD) -->
1060 description="Generates the Ant document type definition (DTD)">
1061 <antstructure output="ant.dtd"/>
1067 <!-- Abort the build if JUnit is missing. -->
1068 <target name="fail-unless-junit-is-available" depends="init">
1069 <condition property="isAvailable.junit">
1070 <available classname="junit.framework.TestCase"/>
1072 <antcall target="fail-junit"/>
1075 <target name="fail-junit" unless="isAvailable.junit">
1077 JUnit is not available. You must download JUnit from
1078 <http://www.junit.org/> and include the JAR file in your
1081 <fail message="JUnit is not available."/>
1084 <!-- Warn if JUnit is missing. -->
1085 <target name="warn-unless-junit-is-available" depends="init">
1086 <condition property="isAvailable.junit">
1087 <available classname="junit.framework.TestCase"/>
1089 <antcall target="warn-junit"/>
1092 <target name="warn-junit" unless="isAvailable.junit">
1094 WARNING: Since JUnit is not available you might encounter failures
1095 subsequently. In order to avoid this you should download JUnit from
1096 <http://www.junit.org/> and include the JAR file in your
1103 <!-- Abort the build if JDepend is missing. -->
1104 <target name="fail-unless-jdepend-is-available" depends="init">
1105 <condition property="isAvailable.jdepend">
1106 <available classname="jdepend.framework.JDepend"/>
1108 <antcall target="fail-jdepend"/>
1111 <target name="fail-jdepend" unless="isAvailable.jdepend">
1113 JDepend is not available. You must download JDepend from
1114 <http://www.clarkware.com/software/JDepend.html> and include the
1115 JAR file in your classpath.
1117 <fail message="JDepend is not available."/>
1122 <!-- Abort the build if an XSLT processor is missing. -->
1123 <target name="fail-unless-xslt-is-available" depends="init">
1124 <condition property="isAvailable.xslt">
1125 <available classname="javax.xml.transform.TransformerFactory"/>
1127 <antcall target="fail-xslt"/>
1130 <target name="fail-xslt" unless="isAvailable.xslt">
1132 An XSLT processor is missing. You must download e.g. Xalan from
1133 <http://xml.apache.org/xalan-j/> and include the JAR file in your
1136 <fail message="An XSLT processor is not available."/>
1139 <!-- Warn if an XSLT processor is missing. -->
1140 <target name="warn-unless-xslt-is-available" depends="init">
1141 <condition property="isAvailable.xslt">
1142 <available classname="javax.xml.transform.TransformerFactory"/>
1144 <antcall target="warn-xslt"/>
1147 <target name="warn-xslt" unless="isAvailable.xslt">
1149 WARNING: Since an XSLT processor is not available you might encounter
1150 failures subsequently. In order to avoid this you should download
1151 e.g. Xalan from <http://xml.apache.org/xalan-j/> and include the
1152 JAR file in your classpath.
1158 <!-- Aborts the build if any of the required tools are missing. -->
1159 <target name="fail-unless-tools-are-available"
1160 depends="fail-unless-junit-is-available, fail-unless-junit-is-available,
1161 fail-unless-jdepend-is-available"/>
1165 <!-- Runs jdepend to produce a report about package dependencies -->
1166 <target name="jdepend" depends="fail-unless-jdepend-is-available"
1167 description="Runs jdepend to produce a report about package dependencies">
1168 <jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
1170 <pathelement location="${main.output.dir}"/>
1171 <pathelement location="${contrib.output.dir}"/>
1172 <pathelement location="${scratchpad.output.dir}"/>
1175 <path refid="main.classpath"/>
1176 <path refid="contrib.classpath"/>
1177 <path refid="scratchpad.classpath"/>
1181 <style basedir="${jdepend.report.dir}"
1182 in="${jdepend.report.dir}/jdepend.xml"
1183 out="${jdepend.report.out.dir}/index.html"
1184 style="jdepend.xsl"/>
1189 <!-- Keep this comment at the end of the file
1194 sgml-namecase-general:nil
1195 sgml-general-insert-case:lower
1196 sgml-minimize-attributes:nil
1197 sgml-always-quote-attributes:t
1200 sgml-parent-document:nil
1201 sgml-exposed-tags:nil
1202 sgml-local-catalogs:nil
1203 sgml-local-ecat-files:nil