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="compile-version" depends="init"
373 description="Compiles the version class">
374 <!-- Generate the .java file -->
375 <property name="version.java" value="${main.output.dir}/org/apache/poi/Version.java" />
376 <delete file="${version.java}" />
378 file="src/resources/version/Version.java.template"
379 tofile="${version.java}">
381 <filter token="VERSION" value="${version.id}" />
382 <filter token="DSTAMP" value="${DSTAMP}" />
387 <javac target="${jdk.version.class}" source="${jdk.version.source}"
388 failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
389 srcdir="${main.output.dir}" />
392 <delete file="${version.java}" />
395 <target name="test" depends="test-main,test-scratchpad,test-contrib"
396 description="Tests main, contrib and scratchpad"/>
398 <target name="-test-main-check">
399 <uptodate property="main.test.notRequired" targetfile="${main.testokfile}">
400 <srcfiles dir="${main.src}"/>
401 <srcfiles dir="${main.src.test}"/>
405 <path id="test.classpath">
406 <path refid="main.classpath"/>
407 <pathelement location="${main.output.dir}"/>
408 <pathelement location="${main.output.test.dir}"/>
409 <pathelement location="${junit.jar1.dir}"/>
412 <target name="test-main" unless="main.test.notRequired"
413 depends="compile-main, -test-main-check, fail-unless-junit-is-available">
414 <junit fork="no" printsummary="yes" haltonfailure="${halt.on.test.failure}"
415 failureproperty="main.test.failed" showoutput="true">
416 <classpath refid="test.classpath"/>
417 <sysproperty key="HSSF.testdata.path"
418 file="${main.src.test}/org/apache/poi/hssf/data"/>
419 <sysproperty key="HSLF.testdata.path"
420 file="${main.src.test}/org/apache/poi/hslf/data"/>
421 <sysproperty key="HWPF.testdata.path"
422 file="${main.src.test}/org/apache/poi/hwpf/data"/>
423 <sysproperty key="HPSF.testdata.path"
424 file="${main.src.test}/org/apache/poi/hpsf/data"/>
425 <sysproperty key="POIFS.testdata.path"
426 file="${main.src.test}/org/apache/poi/poifs/data"/>
427 <sysproperty key="DDF.testdata.path"
428 file="${main.src.test}/org/apache/poi/ddf/data"/>
429 <sysproperty key="java.awt.headless" value="true"/>
430 <formatter type="plain"/>
431 <formatter type="xml"/>
432 <batchtest todir="${main.reports.test}">
433 <fileset dir="${main.src.test}">
434 <include name="**/Test*.java"/>
435 <exclude name="**/All*Tests.java"/>
436 <exclude name="**/TestUnfixedBugs.java"/>
437 <exclude name="**/TestcaseRecordInputStream.java"/>
441 <delete file="${main.testokfile}"/>
442 <antcall target="-test-main-write-testfile"/>
445 <target name="test-fail" depends="compile-main,
446 fail-unless-junit-is-available"
447 description="run tests that are known to fail">
448 <junit printsummary="yes" showoutput="true" filtertrace="no"
449 haltonfailure="false">
450 <classpath refid="test.classpath"/>
452 <path refid="scratchpad.classpath"/>
453 <pathelement location="${main.output.dir}"/>
454 <pathelement location="${scratchpad.output.dir}"/>
455 <pathelement location="${scratchpad.output.test.dir}"/>
456 <pathelement location="${junit.jar1.dir}"/>
458 <sysproperty key="HSSF.testdata.path"
459 file="${main.src.test}/org/apache/poi/hssf/data"/>
460 <sysproperty key="HPSF.testdata.path"
461 file="${main.src.test}/org/apache/poi/hpsf/data"/>
462 <sysproperty key="HWPF.testdata.path"
463 file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
464 <sysproperty key="POIFS.testdata.path"
465 file="${main.src.test}/org/apache/poi/poifs/data"/>
466 <sysproperty key="java.awt.headless" value="true"/>
467 <formatter type="plain" usefile="no"/>
468 <batchtest todir="${main.reports.test}">
469 <fileset dir="${main.src.test}">
470 <include name="**/TestEmptyDocument.java"/>
471 <include name="**/TestUnfixedBugs.java"/>
479 <target name="single-test" depends="-test-property-check,compile-main" description="Runs a single test case specified with -Dtestcase=classname">
480 <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
481 <classpath refid="test.classpath"/>
483 <path refid="test.classpath"/>
484 <pathelement location="${main.output.dir}"/>
485 <pathelement location="${scratchpad.output.dir}"/>
486 <pathelement location="${scratchpad.output.test.dir}"/>
487 <pathelement location="${junit.jar1.dir}"/>
489 <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
490 <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
491 <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
492 <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
493 <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
494 <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
495 <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
496 <sysproperty key="java.awt.headless" value="true"/>
497 <formatter type="plain" usefile="no"/>
498 <formatter type="xml"/>
499 <test name="${testcase}"/>
503 <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." >
504 <echo>Waiting for debugger on port 5001</echo>
505 <junit printsummary="no" showoutput="true" filtertrace="no" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed">
506 <jvmarg value="-Xdebug"/>
507 <jvmarg value="-Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=y"/>
508 <sysproperty key="java.compiler" value="NONE"/>
509 <classpath refid="test.classpath"/>
510 <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
511 <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
512 <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
513 <sysproperty key="java.awt.headless" value="true"/>
514 <formatter type="plain" usefile="no"/>
515 <test name="${testcase}"/>
519 <target name="-test-property-check" unless="testcase">
520 <echo message="Please use -Dtestcase=org.your.testcase to run a single test"/>
524 <target name="-test-main-write-testfile" unless="main.test.failed">
525 <echo file="${main.testokfile}" append="false" message="testok"/>
528 <target name="-test-scratchpad-check">
529 <uptodate property="scratchpad.test.notRequired" targetfile="${scratchpad.testokfile}">
530 <srcfiles dir="${scratchpad.src}"/>
531 <srcfiles dir="${scratchpad.src.test}"/>
535 <target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check" unless="scratchpad.test.notRequired">
536 <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="scratchpad.test.failed">
538 <path refid="scratchpad.classpath"/>
539 <pathelement location="${main.output.dir}"/>
540 <pathelement location="${scratchpad.output.dir}"/>
541 <pathelement location="${scratchpad.output.test.dir}"/>
542 <pathelement location="${junit.jar1.dir}"/>
544 <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
545 <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
546 <sysproperty key="HDF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdf/data"/>
547 <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
548 <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
549 <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
550 <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
551 <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
552 <sysproperty key="java.awt.headless" value="true"/>
553 <formatter type="plain"/>
554 <formatter type="xml"/>
555 <batchtest todir="${scratchpad.reports.test}">
556 <fileset dir="${scratchpad.src.test}">
557 <include name="**/Test*.java"/>
558 <exclude name="**/AllTests.java"/>
562 <delete file="${scratchpad.testokfile}"/>
563 <antcall target="-test-scratchpad-write-testfile"/>
566 <target name="-test-scratchpad-write-testfile" unless="scratchpad.test.failed">
567 <echo file="${scratchpad.testokfile}" append="false" message="testok"/>
570 <target name="single-scratchpad-test" depends="compile-scratchpad,-test-property-check" description="Runs a single test case specified with -Dtestcase=classname">
571 <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
572 <classpath refid="test.classpath"/>
574 <path refid="scratchpad.classpath"/>
575 <pathelement location="${main.output.dir}"/>
576 <pathelement location="${scratchpad.output.dir}"/>
577 <pathelement location="${scratchpad.output.test.dir}"/>
578 <pathelement location="${junit.jar1.dir}"/>
580 <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
581 <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
582 <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
583 <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
584 <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
585 <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
586 <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
587 <sysproperty key="java.awt.headless" value="true"/>
588 <sysproperty key="java.awt.headless" value="true"/>
589 <formatter type="plain" usefile="no"/>
590 <formatter type="xml"/>
591 <test name="${testcase}"/>
595 <target name="-test-contrib-check">
596 <uptodate property="contrib.test.notRequired" targetfile="${contrib.testokfile}">
597 <srcfiles dir="${contrib.src}"/>
598 <srcfiles dir="${contrib.src.test}"/>
602 <target name="test-contrib" depends="compile-main,compile-contrib,-test-contrib-check" unless="contrib.test.notRequired">
603 <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="contrib.test.failed">
605 <path refid="contrib.classpath"/>
606 <pathelement location="${main.output.dir}"/>
607 <pathelement location="${contrib.output.dir}"/>
608 <pathelement location="${contrib.output.test.dir}"/>
609 <pathelement location="${junit.jar1.dir}"/>
611 <sysproperty key="HSSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hssf/data"/>
612 <sysproperty key="HPSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hpsf/data"/>
613 <sysproperty key="java.awt.headless" value="true"/>
614 <formatter type="plain"/>
615 <formatter type="xml"/>
616 <batchtest todir="${contrib.reports.test}">
617 <fileset dir="${contrib.src.test}">
618 <include name="**/Test*.java"/>
619 <exclude name="**/AllTests.java"/>
623 <delete file="${contrib.testokfile}"/>
624 <antcall target="-test-contrib-write-testfile"/>
627 <target name="-test-contrib-write-testfile" unless="contrib.test.failed">
628 <echo file="${contrib.testokfile}" append="false" message="testok"/>
631 <target name="-check-docs">
632 <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html">
633 <srcfiles dir="${build.site.src}"/>
637 <target name="-check-forrest-installed" unless="env.FORREST_HOME">
638 <echo>Please install Apache Forrest (see
639 <http://xml.apache.org/forrest/index.html>) and set the
640 FORREST_HOME environment variable!</echo>
641 <fail message="Apache Forrest is not installed."/>
644 <!-- <target name="check-docs">-->
645 <!-- <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html" >-->
646 <!-- <srcfiles dir= "${build.site.src}"/>-->
650 <target name="docs" depends="init, -check-forrest-installed, -check-docs"
651 unless="main.docs.notRequired" description="Builds the POI website">
653 <mkdir dir="${build.site.src}/src/documentation/content/apidocs"/>
654 <copy todir="${build.site.src}/src/documentation/content/apidocs">
655 <fileset dir="${apidocs.report.dir}"/>
658 tofile="${build.site.src}/src/documentation/content/jdepend.ehtml"
659 file="${jdepend.report.dir}/index.html" failonerror="false"/>
660 <mkdir dir="${build.site.src}/src/documentation/content/junit"/>
661 <copy todir="${build.site.src}/src/documentation/content/junit">
662 <fileset dir="${junit.report.dir}"/>
666 file="${build.site.src}/src/documentation/content/xdocs/status.xml"
667 tofile="${build.site.src}/status.xml"/>
669 <ant antfile="${forrest.home}/forrest.antproxy.xml" target="site">
670 <property name="project.home" location="${build.site.src}"/>
673 <echo>Broken links:</echo>
674 <echo file="${build.site}/../tmp/brokenlinks.txt"/>
677 <fileset dir="${build.site}"/>
681 <!-- Checks whether reports are required to be run. If nothing has changed then they dont. -->
682 <target name="-check-reports">
683 <condition property="reports.notRequired">
685 <equals arg1="${main.test.notRequired}" arg2="true"/>
686 <equals arg1="${scratchpad.test.notRequired}" arg2="true"/>
687 <equals arg1="${contrib.test.notRequired}" arg2="true"/>
694 <!-- Generates a log of the latest changes in the CVS repository. -->
695 <target name="cvschangelog" unless="disconnected"
696 depends="fail-unless-xslt-is-available"
697 description="Generates a CVS change log report">
698 <antcall target="cvs-rsh-warning"/>
699 <cvschangelog destfile="${changelog.file}" daysinpast="30"/>
701 <style in="${changelog.file}"
702 out="${build.site.src}/src/documentation/content/changelog.html"
703 style="changelog.xsl">
704 <param name="title" expression="POI Change Log"/>
705 <param name="module" expression="jakarta-poi"/>
706 <param name="cvsweb" expression="http://cvs.apache.org/viewcvs/"/>
710 <target name="cvs-rsh-warning" unless="env.CVS_RSH">
712 WARNING: The environment variable CVS_RSH is not set. If you cannot
713 access the CVS repository this could be one of the reasons for the
720 <!-- Creates reports and API documentation -->
721 <target name="reports" unless="reports.notRequired" depends="-check-reports,
722 fail-unless-xslt-is-available, fail-unless-junit-is-available,
723 fail-unless-jdepend-is-available, test-ignore-failures, junitreport,
724 jdepend, cvschangelog, javadocs, clover.html"
725 description="Creates various reports and the API documentation">
730 <!-- Runs all JUnit tests without aborting if one of the tests fails. -->
731 <target name="test-ignore-failures" depends="init">
732 <antcall target="test">
733 <param name="halt.on.test.failure" value="false"/>
739 <!-- Produces a report of the JUnit test results -->
740 <target name="junitreport"
741 depends="fail-unless-xslt-is-available, test-ignore-failures"
742 description="Produces a report of the JUnit test results">
743 <junitreport todir="${junit.report.dir}">
744 <fileset dir="${main.reports.test}">
745 <include name="TEST-*.xml"/>
747 <fileset dir="${scratchpad.reports.test}">
748 <include name="TEST-*.xml"/>
750 <fileset dir="${contrib.reports.test}">
751 <include name="TEST-*.xml"/>
753 <report format="frames" todir="${junit.report.dir}"/>
759 <!-- Generates the API documentation. -->
760 <target name="javadocs" depends="init, warn-unless-junit-is-available,
761 warn-unless-xslt-is-available"
762 description="Generates the API documentation">
763 <javadoc verbose="false" author="true" destdir="${apidocs.report.dir}"
764 windowtitle="POI API Documentation" use="true" version="true">
766 <packageset dir="${main.src}" defaultexcludes="yes">
767 <include name="org/apache/poi/**"/>
769 <packageset dir="${scratchpad.src}" defaultexcludes="yes">
770 <include name="org/apache/poi/**"/>
771 <exclude name="org/apache/poi/hdf/**"/>
773 <packageset dir="${contrib.src}" defaultexcludes="yes">
774 <include name="org/apache/poi/**"/>
776 <packageset dir="${examples.src}" defaultexcludes="yes">
777 <include name="org/apache/poi/**"/>
780 <classpath id="javadoc.classpath">
781 <path refid="main.classpath"/>
782 <path refid="scratchpad.classpath"/>
783 <path refid="contrib.classpath"/>
784 <path refid="examples.classpath"/>
785 <path path="${env.CLASSPATH}"/>
788 <doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle>
790 <![CDATA[<i>Copyright ${tstamp.year} The Apache Software Foundation or
791 its licensors, as applicable.</i>]]>
794 <title>DDF - Dreadful Drawing Format</title>
795 <package name="org.apache.poi.ddf*"/>
798 <title>HPSF - Horrible Property Set Format</title>
799 <package name="org.apache.poi.hpsf*"/>
802 <title>HSSF - Horrible Spreadsheet Format</title>
803 <package name="org.apache.poi.hssf*"/>
806 <title>HWPF - Horrible Word Processor Format</title>
807 <package name="org.apache.poi.hwpf*"/>
810 <title>POIFS - POI File System</title>
811 <package name="org.apache.poi.poifs*"/>
814 <title>Utilities</title>
815 <package name="org.apache.poi.util*"/>
818 <title>Examples</title>
819 <package name="org.apache.poi.hpsf.examples*"/>
820 <package name="org.apache.poi.hssf.usermodel.examples*"/>
824 <antcall target="clover.html"/>
829 <!-- ================================== -->
830 <!-- Generate records -->
831 <!-- ================================== -->
833 <target name="generate-records" depends="init"
834 description="Generates HSSF records">
835 <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
836 <arg file="src/records/definitions"/>
837 <arg file="src/records/styles"/>
838 <arg file="src/java"/>
839 <arg file="src/testcases"/>
841 <path refid="scratchpad.classpath"/>
842 <pathelement location="${main.output.dir}"/>
843 <pathelement location="${scratchpad.output.dir}"/>
848 <!-- ================================== -->
849 <!-- Generate types -->
850 <!-- ================================== -->
852 <target name="generate-types" depends="init"
853 description="Generates word types">
854 <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
855 <arg file="src/types/definitions"/>
856 <arg file="src/types/styles"/>
857 <arg file="src/scratchpad/src"/>
858 <arg file="src/scratchpad/testcases"/>
860 <path refid="scratchpad.classpath">
862 <pathelement location="${main.output.dir}"/>
863 <pathelement location="${scratchpad.output.dir}"/>
870 <!-- Generates documentation and reports -->
871 <target name="site" depends="reports, docs"
872 description="Generates POI's website's contents"/>
875 <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">
876 <!-- Copy the jar files into the maven jar directory -->
877 <!-- Same jars as for the main release, only lacking the datestamp -->
879 file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"
880 tofile="${mavendist.oap.dir}/jars/${jar.name}-${version.id}.jar" />
882 file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"
883 tofile="${mavendist.oap.dir}/jars/${jar.name}-contrib-${version.id}.jar" />
885 file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"
886 tofile="${mavendist.oap.dir}/jars/${jar.name}-scratchpad-${version.id}.jar" />
888 <!-- TODO: Decide about source jars, and copy them if we have some -->
890 <!-- Build the org.apache.poi poms -->
891 <!-- Copy from the base file, substituting in the version and -->
892 <!-- artificat, plus doing the core poi dependency as needed -->
894 <!-- Build the main pom -->
897 tofile="${mavendist.oap.dir}/poms/${jar.name}-${version.id}.pom"
901 <token key="VERSION" value="${version.id}" />
902 <token key="ARTIFICAT" value="poi" />
906 <replaceregex pattern="START_NON_MAIN.*END_NON_MAIN_DEPENDENCY" replace="No POI dependency on the main jar" flags="s" />
910 <!-- And the contrib pom -->
913 tofile="${mavendist.oap.dir}/poms/${jar.name}-contrib-${version.id}.pom"
917 <token key="VERSION" value="${version.id}" />
918 <token key="ARTIFICAT" value="poi-contrib" />
921 <replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
922 <replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
926 <!-- And the scratchpad pom -->
929 tofile="${mavendist.oap.dir}/poms/${jar.name}-scratchpad-${version.id}.pom"
933 <token key="VERSION" value="${version.id}" />
934 <token key="ARTIFICAT" value="poi-scratchpad" />
937 <replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
938 <replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
943 <!-- Build the poi => org.apache.poi redirect poms -->
944 <!-- Copy from the base file, substituting in the version+artifact -->
946 file="poi-redirect.pom"
947 tofile="${mavendist.poi.dir}/poms/${jar.name}-${version.id}.pom"
949 <filterchain><replacetokens>
950 <token key="VERSION" value="${version.id}" />
951 <token key="ARTIFICAT" value="poi" />
952 </replacetokens></filterchain>
955 file="poi-redirect.pom"
956 tofile="${mavendist.poi.dir}/poms/${jar.name}-contrib-${version.id}.pom"
958 <filterchain><replacetokens>
959 <token key="VERSION" value="${version.id}" />
960 <token key="ARTIFICAT" value="poi-contrib" />
961 </replacetokens></filterchain>
964 file="poi-redirect.pom"
965 tofile="${mavendist.poi.dir}/poms/${jar.name}-scratchpad-${version.id}.pom"
967 <filterchain><replacetokens>
968 <token key="VERSION" value="${version.id}" />
969 <token key="ARTIFICAT" value="poi-scratchpad" />
970 </replacetokens></filterchain>
973 <!-- And that's it for maven -->
976 <target name="jar" depends="compile,compile-version" description="Creates jar files for distribution">
977 <jar destfile="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar">
978 <fileset dir="${main.output.dir}" />
979 <fileset dir="legal/" />
981 <attribute name="Built-By" value="${user.name}"/>
982 <attribute name="Specification-Title" value="Apache POI"/>
983 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
984 <attribute name="Specification-Vendor" value="Apache"/>
985 <attribute name="Implementation-Title" value="Apache POI"/>
986 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
987 <attribute name="Implementation-Vendor" value="Apache"/>
990 <jar destfile="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar">
991 <fileset dir="${contrib.output.dir}" />
992 <fileset dir="legal/" />
994 <attribute name="Built-By" value="${user.name}"/>
995 <attribute name="Specification-Title" value="Apache POI"/>
996 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
997 <attribute name="Specification-Vendor" value="Apache"/>
998 <attribute name="Implementation-Title" value="Apache POI"/>
999 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1000 <attribute name="Implementation-Vendor" value="Apache"/>
1003 <jar destfile="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar">
1004 <fileset dir="${scratchpad.output.dir}" />
1005 <fileset dir="legal/" />
1007 <attribute name="Built-By" value="${user.name}"/>
1008 <attribute name="Specification-Title" value="Apache POI"/>
1009 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
1010 <attribute name="Specification-Vendor" value="Apache"/>
1011 <attribute name="Implementation-Title" value="Apache POI"/>
1012 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
1013 <attribute name="Implementation-Vendor" value="Apache"/>
1018 <target name="dist" depends="clean, fail-unless-tools-are-available, compile, site, jar"
1019 description="Creates the entire distribution into build/dist, from scratch">
1021 <property name="zipdir" value="${jar.name}-${version.id}" />
1023 <zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
1024 <zipfileset dir="legal/" prefix="${zipdir}" />
1025 <zipfileset dir="lib/" prefix="${zipdir}/lib" />
1026 <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1027 <zipfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1028 <zipfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1029 <zipfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1032 <zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
1033 <zipfileset dir="legal/" prefix="${zipdir}" />
1034 <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1035 <zipfileset dir="." prefix="${zipdir}">
1036 <exclude name="build/**"/>
1037 <exclude name="scripts/**"/>
1038 <exclude name="*.ipr"/>
1039 <exclude name="*.iml"/>
1040 <exclude name="*.iws"/>
1041 <exclude name="*.swp"/>
1045 <tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz"
1047 <tarfileset dir="legal/" prefix="${zipdir}" />
1048 <tarfileset dir="lib/" prefix="${zipdir}/lib" />
1049 <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1050 <tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1051 <tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1052 <tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1055 <tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz"
1057 <tarfileset dir="legal/" prefix="${zipdir}" />
1058 <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1059 <tarfileset dir="." prefix="${zipdir}">
1060 <exclude name="build/**"/>
1061 <exclude name="scripts/**"/>
1062 <exclude name="*.ipr"/>
1063 <exclude name="*.iml"/>
1064 <exclude name="*.iws"/>
1065 <exclude name="*.swp"/>
1069 <echo>Distribution located in build/dist</echo>
1072 <target name="clean-compile" depends="clean, compile"/>
1074 <target name="clean-dist" depends="clean, dist"
1075 description="Cleans the build directory then creates a distribution"/>
1077 <target name="gump" depends="test, jar"/>
1081 <!-- Generates the Ant document type definition (DTD) -->
1083 description="Generates the Ant document type definition (DTD)">
1084 <antstructure output="ant.dtd"/>
1090 <!-- Abort the build if JUnit is missing. -->
1091 <target name="fail-unless-junit-is-available" depends="init">
1092 <condition property="isAvailable.junit">
1093 <available classname="junit.framework.TestCase"/>
1095 <antcall target="fail-junit"/>
1098 <target name="fail-junit" unless="isAvailable.junit">
1100 JUnit is not available. You must download JUnit from
1101 <http://www.junit.org/> and include the JAR file in your
1104 <fail message="JUnit is not available."/>
1107 <!-- Warn if JUnit is missing. -->
1108 <target name="warn-unless-junit-is-available" depends="init">
1109 <condition property="isAvailable.junit">
1110 <available classname="junit.framework.TestCase"/>
1112 <antcall target="warn-junit"/>
1115 <target name="warn-junit" unless="isAvailable.junit">
1117 WARNING: Since JUnit is not available you might encounter failures
1118 subsequently. In order to avoid this you should download JUnit from
1119 <http://www.junit.org/> and include the JAR file in your
1126 <!-- Abort the build if JDepend is missing. -->
1127 <target name="fail-unless-jdepend-is-available" depends="init">
1128 <condition property="isAvailable.jdepend">
1129 <available classname="jdepend.framework.JDepend"/>
1131 <antcall target="fail-jdepend"/>
1134 <target name="fail-jdepend" unless="isAvailable.jdepend">
1136 JDepend is not available. You must download JDepend from
1137 <http://www.clarkware.com/software/JDepend.html> and include the
1138 JAR file in your classpath.
1140 <fail message="JDepend is not available."/>
1145 <!-- Abort the build if an XSLT processor is missing. -->
1146 <target name="fail-unless-xslt-is-available" depends="init">
1147 <condition property="isAvailable.xslt">
1148 <available classname="javax.xml.transform.TransformerFactory"/>
1150 <antcall target="fail-xslt"/>
1153 <target name="fail-xslt" unless="isAvailable.xslt">
1155 An XSLT processor is missing. You must download e.g. Xalan from
1156 <http://xml.apache.org/xalan-j/> and include the JAR file in your
1159 <fail message="An XSLT processor is not available."/>
1162 <!-- Warn if an XSLT processor is missing. -->
1163 <target name="warn-unless-xslt-is-available" depends="init">
1164 <condition property="isAvailable.xslt">
1165 <available classname="javax.xml.transform.TransformerFactory"/>
1167 <antcall target="warn-xslt"/>
1170 <target name="warn-xslt" unless="isAvailable.xslt">
1172 WARNING: Since an XSLT processor is not available you might encounter
1173 failures subsequently. In order to avoid this you should download
1174 e.g. Xalan from <http://xml.apache.org/xalan-j/> and include the
1175 JAR file in your classpath.
1181 <!-- Aborts the build if any of the required tools are missing. -->
1182 <target name="fail-unless-tools-are-available"
1183 depends="fail-unless-junit-is-available, fail-unless-junit-is-available,
1184 fail-unless-jdepend-is-available"/>
1188 <!-- Runs jdepend to produce a report about package dependencies -->
1189 <target name="jdepend" depends="fail-unless-jdepend-is-available"
1190 description="Runs jdepend to produce a report about package dependencies">
1191 <jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
1193 <pathelement location="${main.output.dir}"/>
1194 <pathelement location="${contrib.output.dir}"/>
1195 <pathelement location="${scratchpad.output.dir}"/>
1198 <path refid="main.classpath"/>
1199 <path refid="contrib.classpath"/>
1200 <path refid="scratchpad.classpath"/>
1204 <style basedir="${jdepend.report.dir}"
1205 in="${jdepend.report.dir}/jdepend.xml"
1206 out="${jdepend.report.out.dir}/index.html"
1207 style="jdepend.xsl"/>
1212 <!-- Keep this comment at the end of the file
1217 sgml-namecase-general:nil
1218 sgml-general-insert-case:lower
1219 sgml-minimize-attributes:nil
1220 sgml-always-quote-attributes:t
1223 sgml-parent-document:nil
1224 sgml-exposed-tags:nil
1225 sgml-local-catalogs:nil
1226 sgml-local-ecat-files:nil