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.src" location="src/scratchpad/src"/>
89 <property name="scratchpad.src.test" location="src/scratchpad/testcases"/>
90 <property name="scratchpad.lib" location="src/scratchpad/lib"/>
91 <property name="scratchpad.reports.test" location="build/scratchpad-test-results"/>
92 <property name="scratchpad.output.dir" location="build/scratchpad-classes"/>
93 <property name="scratchpad.output.test.dir" location="build/scratchpad-test-classes"/>
94 <property name="scratchpad.testokfile" location="build/scratchpad-testokfile.txt"/>
96 <!-- Contributed software: -->
97 <property name="contrib.src" location="src/contrib/src"/>
98 <property name="contrib.src.test" location="src/contrib/testcases"/>
99 <property name="contrib.lib" location="src/contrib/lib"/>
100 <property name="contrib.reports.test" location="build/contrib-test-results"/>
101 <property name="contrib.output.dir" location="build/contrib-classes"/>
102 <property name="contrib.output.test.dir" location="build/contrib-test-classes"/>
103 <property name="contrib.jar1.dir" location="${contrib.lib}/commons-beanutils-1.7.0.jar"/>
104 <property name="contrib.jar1.url" value="${repository}/commons-beanutils/jars/commons-beanutils-1.7.0.jar"/>
105 <property name="contrib.jar2.dir" location="${contrib.lib}/commons-collections-3.2.jar"/>
106 <property name="contrib.jar2.url" value="${repository}/commons-collections/jars/commons-collections-3.2.jar"/>
107 <property name="contrib.jar3.dir" location="${contrib.lib}/commons-lang-2.1.jar"/>
108 <property name="contrib.jar3.url" value="${repository}/commons-lang/jars/commons-lang-2.1.jar"/>
109 <property name="contrib.testokfile" location="build/contrib-testokfile.txt"/>
112 <property name="examples.src" location="src/examples/src"/>
113 <property name="examples.src.test" location="src/examples/testcases"/>
114 <property name="examples.lib" location="src/examples/lib"/>
115 <property name="examples.reports.test" location="build/examples-test-results"/>
116 <property name="examples.output.dir" location="build/examples-classes"/>
117 <property name="examples.output.test.dir" location="build/examples-test-classes"/>
118 <property name="examples.jar1.dir" location="${examples.lib}/commons-beanutils-1.7.0.jar"/>
119 <property name="examples.jar1.url" value="${repository}/commons-beanutils/jars/commons-beanutils-1.7.0.jar"/>
120 <property name="examples.jar2.dir" location="${examples.lib}/commons-collections-3.2.jar"/>
121 <property name="examples.jar2.url" value="${repository}/commons-collections/jars/commons-collections-3.2.jar"/>
122 <property name="examples.jar3.dir" location="${examples.lib}/commons-lang-2.1.jar"/>
123 <property name="examples.jar3.url" value="${repository}/commons-lang/jars/commons-lang-2.1.jar"/>
124 <property name="examples.testokfile" location="build/examples-testokfile.txt"/>
126 <property name="build.site" location="build/tmp/site/build/site"/>
127 <property name="build.site.src" location="build/tmp/site"/>
128 <property name="junit.report.dir" location="${build.site}/junit"/>
129 <property name="jdepend.report.dir" location="${build.site}/jdepend"/>
130 <property name="jdepend.report.out.dir" location="${build.site.src}/src/documentation/content/jdepend"/>
131 <property name="apidocs.report.dir" location="${build.site}/apidocs"/>
132 <property name="changelog.file" location="${build.site}/changelog.html"/>
133 <property name="dist.dir" location="build/dist"/>
134 <property name="mavendist.dir" location="build/maven-dist"/>
135 <property name="mavendist.poi.dir" location="build/maven-dist/poi"/>
136 <property name="mavendist.oap.dir" location="build/maven-dist/org.apache.poi"/>
137 <property name="jar.name" value="poi"/>
138 <property name="version.id" value="3.2-alpha1"/>
139 <property name="halt.on.test.failure" value="true"/>
140 <property name="jdk.version.source" value="1.3"
141 description="JDK version of source code"/>
142 <property name="jdk.version.class" value="1.3"
143 description="JDK version of generated class files"/>
146 <path id="main.classpath">
147 <pathelement location="${main.jar1.dir}"/>
148 <pathelement location="${main.jar2.dir}"/>
149 <pathelement location="${main.resource1.dir}"/>
152 <path id="scratchpad.classpath">
153 <path refid="main.classpath"/>
154 <pathelement location="${main.output.dir}"/>
157 <path id="contrib.classpath">
158 <path refid="main.classpath"/>
159 <pathelement location="${contrib.jar1.dir}"/>
160 <pathelement location="${contrib.jar2.dir}"/>
161 <pathelement location="${contrib.jar3.dir}"/>
162 <pathelement location="${main.output.dir}"/>
163 <pathelement location="${main.output.test.dir}"/>
164 <pathelement location="${scratchpad.output.dir}"/>
165 <pathelement location="${scratchpad.output.test.dir}"/>
166 <pathelement location="${contrib.output.dir}"/>
167 <pathelement location="${contrib.output.test.dir}"/>
170 <path id="examples.classpath">
171 <path refid="main.classpath"/>
172 <pathelement location="${main.output.dir}"/>
173 <pathelement location="${scratchpad.output.dir}"/>
178 <!-- Prints POI's Ant usage help -->
179 <target name="help" description="Prints POI's Ant usage help">
181 - Execute "ant -projecthelp" to view a listing of the main build
183 - Execute "ant help-properties" to view a listing of some properties
184 controlling the build process.
190 <target name="help-properties"
191 description="Prints a listing of build controlling properties">
193 The following properties control the build process:
195 -Ddisconnected="true": Do not execute any targets that require an online
196 connection to the Internet.
197 -Dtestcase=org.apache.poi.xxx.xxx : for the single-test target, specify
200 WARNING: This list is not exhaustive.
206 <target name="with.clover" if="clover.present">
207 <taskdef resource="clovertasks"/>
208 <clover-setup initString="mycoverage.db"/>
211 <target name="clover.html" depends="with.clover" if="clover.present">
212 <echo>Generating clover report</echo>
214 <current outfile="build/tmp/site/build/site/clover_html">
215 <format type="html"/>
220 <target name="init" depends="check-jars,fetch-jars">
223 <format property="tstamp.year" pattern="yyyy"/>
226 <available resource="clovertasks" property="clover.present"/>
227 <antcall target="with.clover"/>
230 <mkdir dir="build/non-ant-classes"/>
231 <mkdir dir="${main.output.dir}"/>
232 <mkdir dir="${scratchpad.output.dir}"/>
233 <mkdir dir="${contrib.output.dir}"/>
234 <mkdir dir="${examples.output.dir}"/>
235 <mkdir dir="${main.output.test.dir}"/>
236 <mkdir dir="${contrib.output.test.dir}"/>
237 <mkdir dir="${scratchpad.output.test.dir}"/>
238 <mkdir dir="${main.reports.test}"/>
239 <mkdir dir="${scratchpad.reports.test}"/>
240 <mkdir dir="${contrib.reports.test}"/>
241 <mkdir dir="${junit.report.dir}"/>
242 <mkdir dir="${jdepend.report.dir}"/>
243 <mkdir dir="${jdepend.report.out.dir}"/>
244 <mkdir dir="${apidocs.report.dir}"/>
245 <mkdir dir="${dist.dir}"/>
246 <mkdir dir="${build.site.src}/${main.documentation}"/>
248 <mkdir dir="${mavendist.dir}"/>
249 <mkdir dir="${mavendist.poi.dir}"/>
250 <mkdir dir="${mavendist.poi.dir}/poms"/>
251 <mkdir dir="${mavendist.oap.dir}"/>
252 <mkdir dir="${mavendist.oap.dir}/jars"/>
253 <mkdir dir="${mavendist.oap.dir}/poms"/>
255 <copy todir="${build.site.src}/${main.documentation}">
256 <fileset dir="${main.documentation}"/>
258 <copy file="forrest.properties" tofile="${build.site.src}/forrest.properties"/>
261 <target name="clean">
262 <delete dir="build"/>
265 <target name="check-jars">
266 <condition property="jars.present">
269 <available file="${main.jar1.dir}"/>
270 <available file="${main.jar2.dir}"/>
271 <available file="${contrib.jar1.dir}"/>
272 <available file="${contrib.jar2.dir}"/>
273 <available file="${contrib.jar3.dir}"/>
274 <available file="${junit.jar1.dir}"/>
276 <isset property="disconnected"/>
281 <target name="fetch-jars" unless="jars.present"
282 description="Fetches needed JAR files from the Internet">
283 <get src="${main.jar1.url}" dest="${main.jar1.dir}"/>
284 <get src="${main.jar2.url}" dest="${main.jar2.dir}"/>
285 <get src="${contrib.jar1.url}" dest="${contrib.jar1.dir}"/>
286 <get src="${contrib.jar2.url}" dest="${contrib.jar2.dir}"/>
287 <get src="${contrib.jar3.url}" dest="${contrib.jar3.dir}"/>
288 <get src="${junit.jar1.url}" dest="${junit.jar1.dir}"/>
291 <target name="compile" depends="init, compile-main, compile-scratchpad,
292 compile-contrib, compile-examples"
293 description="Compiles the POI main classes, scratchpad, contrib, and examples"/>
295 <target name="compile-main" depends="fail-unless-xslt-is-available">
296 <copy todir="${main.output.dir}">
297 <fileset dir="${main.resource1.dir}"/>
299 <javac target="${jdk.version.class}" source="${jdk.version.source}"
300 failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
301 srcdir="${main.src}">
302 <classpath refid="main.classpath"/>
304 <javac target="${jdk.version.class}" source="${jdk.version.source}"
305 failonerror="true" destdir="${main.output.test.dir}" debug="on"
306 fork="yes" srcdir="${main.src.test}">
308 <path refid="main.classpath"/>
309 <pathelement location="${main.output.dir}"/>
310 <pathelement location="${junit.jar1.dir}"/>
315 <target name="compile-scratchpad" depends="init,compile-main">
316 <javac target="${jdk.version.class}" source="${jdk.version.source}"
317 failonerror="true" destdir="${scratchpad.output.dir}" debug="on"
318 fork="yes" srcdir="${scratchpad.src}">
319 <classpath refid="scratchpad.classpath"/>
321 <javac target="${jdk.version.class}" source="${jdk.version.source}"
322 failonerror="true" destdir="${scratchpad.output.test.dir}" debug="on"
323 fork="yes" srcdir="${scratchpad.src.test}">
325 <path refid="scratchpad.classpath"/>
326 <pathelement location="${scratchpad.output.dir}"/>
327 <pathelement location="${junit.jar1.dir}"/>
331 <!-- Copy HSLF Resources over -->
332 <property name="hslf.data" value="org/apache/poi/hslf/data" />
333 <mkdir dir="${scratchpad.output.dir}/${hslf.data}" />
334 <copy todir="${scratchpad.output.dir}/${hslf.data}">
335 <fileset dir="${scratchpad.src}/${hslf.data}">
336 <include name="*.ppt" />
340 <!-- Copy HDGF Resources over -->
341 <property name="hdgf.chunks" value="org/apache/poi/hdgf/chunks" />
342 <copy todir="${scratchpad.output.dir}/${hdgf.chunks}">
343 <fileset dir="${scratchpad.src}/${hdgf.chunks}">
344 <include name="*.tbl" />
349 <target name="compile-contrib" depends="init">
350 <javac target="${jdk.version.class}" source="${jdk.version.source}"
351 failonerror="true" destdir="${contrib.output.dir}" debug="on" fork="yes"
352 srcdir="${contrib.src}">
353 <classpath refid="contrib.classpath"/>
355 <javac target="${jdk.version.class}" source="${jdk.version.source}"
356 failonerror="true" destdir="${contrib.output.test.dir}" debug="on"
357 fork="yes" srcdir="${contrib.src.test}">
359 <path refid="contrib.classpath"/>
360 <pathelement location="${contrib.output.dir}"/>
361 <pathelement location="${junit.jar1.dir}"/>
366 <target name="compile-examples" depends="init">
367 <javac target="${jdk.version.class}" source="${jdk.version.source}"
368 destdir="${examples.output.dir}" debug="on" srcdir="${examples.src}">
369 <classpath refid="examples.classpath"/>
373 <target name="test" depends="test-main,test-scratchpad,test-contrib"
374 description="Tests main, contrib and scratchpad"/>
376 <target name="-test-main-check">
377 <uptodate property="main.test.notRequired" targetfile="${main.testokfile}">
378 <srcfiles dir="${main.src}"/>
379 <srcfiles dir="${main.src.test}"/>
383 <path id="test.classpath">
384 <path refid="main.classpath"/>
385 <pathelement location="${main.output.dir}"/>
386 <pathelement location="${main.output.test.dir}"/>
387 <pathelement location="${junit.jar1.dir}"/>
390 <target name="test-main" unless="main.test.notRequired"
391 depends="compile-main, -test-main-check, fail-unless-junit-is-available">
392 <junit fork="no" printsummary="yes" haltonfailure="${halt.on.test.failure}"
393 failureproperty="main.test.failed" showoutput="true">
394 <classpath refid="test.classpath"/>
395 <sysproperty key="HSSF.testdata.path"
396 file="${main.src.test}/org/apache/poi/hssf/data"/>
397 <sysproperty key="HSLF.testdata.path"
398 file="${main.src.test}/org/apache/poi/hslf/data"/>
399 <sysproperty key="HWPF.testdata.path"
400 file="${main.src.test}/org/apache/poi/hwpf/data"/>
401 <sysproperty key="HPSF.testdata.path"
402 file="${main.src.test}/org/apache/poi/hpsf/data"/>
403 <sysproperty key="POIFS.testdata.path"
404 file="${main.src.test}/org/apache/poi/poifs/data"/>
405 <sysproperty key="DDF.testdata.path"
406 file="${main.src.test}/org/apache/poi/ddf/data"/>
407 <sysproperty key="java.awt.headless" value="true"/>
408 <formatter type="plain"/>
409 <formatter type="xml"/>
410 <batchtest todir="${main.reports.test}">
411 <fileset dir="${main.src.test}">
412 <include name="**/Test*.java"/>
413 <exclude name="**/All*Tests.java"/>
414 <exclude name="**/TestUnfixedBugs.java"/>
415 <exclude name="**/TestcaseRecordInputStream.java"/>
419 <delete file="${main.testokfile}"/>
420 <antcall target="-test-main-write-testfile"/>
423 <target name="test-fail" depends="compile-main,
424 fail-unless-junit-is-available"
425 description="run tests that are known to fail">
426 <junit printsummary="yes" showoutput="true" filtertrace="no"
427 haltonfailure="false">
428 <classpath refid="test.classpath"/>
430 <path refid="scratchpad.classpath"/>
431 <pathelement location="${main.output.dir}"/>
432 <pathelement location="${scratchpad.output.dir}"/>
433 <pathelement location="${scratchpad.output.test.dir}"/>
434 <pathelement location="${junit.jar1.dir}"/>
436 <sysproperty key="HSSF.testdata.path"
437 file="${main.src.test}/org/apache/poi/hssf/data"/>
438 <sysproperty key="HPSF.testdata.path"
439 file="${main.src.test}/org/apache/poi/hpsf/data"/>
440 <sysproperty key="HWPF.testdata.path"
441 file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
442 <sysproperty key="POIFS.testdata.path"
443 file="${main.src.test}/org/apache/poi/poifs/data"/>
444 <sysproperty key="java.awt.headless" value="true"/>
445 <formatter type="plain" usefile="no"/>
446 <batchtest todir="${main.reports.test}">
447 <fileset dir="${main.src.test}">
448 <include name="**/TestEmptyDocument.java"/>
449 <include name="**/TestUnfixedBugs.java"/>
457 <target name="single-test" depends="-test-property-check,compile-main" description="Runs a single test case specified with -Dtestcase=classname">
458 <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
459 <classpath refid="test.classpath"/>
461 <path refid="test.classpath"/>
462 <pathelement location="${main.output.dir}"/>
463 <pathelement location="${scratchpad.output.dir}"/>
464 <pathelement location="${scratchpad.output.test.dir}"/>
465 <pathelement location="${junit.jar1.dir}"/>
467 <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
468 <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
469 <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
470 <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
471 <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
472 <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
473 <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
474 <sysproperty key="java.awt.headless" value="true"/>
475 <formatter type="plain" usefile="no"/>
476 <formatter type="xml"/>
477 <test name="${testcase}"/>
481 <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." >
482 <echo>Waiting for debugger on port 5001</echo>
483 <junit printsummary="no" showoutput="true" filtertrace="no" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed">
484 <jvmarg value="-Xdebug"/>
485 <jvmarg value="-Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=y"/>
486 <sysproperty key="java.compiler" value="NONE"/>
487 <classpath refid="test.classpath"/>
488 <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
489 <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
490 <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
491 <sysproperty key="java.awt.headless" value="true"/>
492 <formatter type="plain" usefile="no"/>
493 <test name="${testcase}"/>
497 <target name="-test-property-check" unless="testcase">
498 <echo message="Please use -Dtestcase=org.your.testcase to run a single test"/>
502 <target name="-test-main-write-testfile" unless="main.test.failed">
503 <echo file="${main.testokfile}" append="false" message="testok"/>
506 <target name="-test-scratchpad-check">
507 <uptodate property="scratchpad.test.notRequired" targetfile="${scratchpad.testokfile}">
508 <srcfiles dir="${scratchpad.src}"/>
509 <srcfiles dir="${scratchpad.src.test}"/>
513 <target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check" unless="scratchpad.test.notRequired">
514 <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="scratchpad.test.failed">
516 <path refid="scratchpad.classpath"/>
517 <pathelement location="${main.output.dir}"/>
518 <pathelement location="${scratchpad.output.dir}"/>
519 <pathelement location="${scratchpad.output.test.dir}"/>
520 <pathelement location="${junit.jar1.dir}"/>
522 <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
523 <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
524 <sysproperty key="HDF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdf/data"/>
525 <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
526 <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
527 <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
528 <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
529 <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
530 <sysproperty key="java.awt.headless" value="true"/>
531 <formatter type="plain"/>
532 <formatter type="xml"/>
533 <batchtest todir="${scratchpad.reports.test}">
534 <fileset dir="${scratchpad.src.test}">
535 <include name="**/Test*.java"/>
536 <exclude name="**/AllTests.java"/>
540 <delete file="${scratchpad.testokfile}"/>
541 <antcall target="-test-scratchpad-write-testfile"/>
544 <target name="-test-scratchpad-write-testfile" unless="scratchpad.test.failed">
545 <echo file="${scratchpad.testokfile}" append="false" message="testok"/>
548 <target name="single-scratchpad-test" depends="compile-scratchpad,-test-property-check" description="Runs a single test case specified with -Dtestcase=classname">
549 <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
550 <classpath refid="test.classpath"/>
552 <path refid="scratchpad.classpath"/>
553 <pathelement location="${main.output.dir}"/>
554 <pathelement location="${scratchpad.output.dir}"/>
555 <pathelement location="${scratchpad.output.test.dir}"/>
556 <pathelement location="${junit.jar1.dir}"/>
558 <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
559 <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
560 <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
561 <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
562 <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
563 <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
564 <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
565 <sysproperty key="java.awt.headless" value="true"/>
566 <sysproperty key="java.awt.headless" value="true"/>
567 <formatter type="plain" usefile="no"/>
568 <formatter type="xml"/>
569 <test name="${testcase}"/>
573 <target name="-test-contrib-check">
574 <uptodate property="contrib.test.notRequired" targetfile="${contrib.testokfile}">
575 <srcfiles dir="${contrib.src}"/>
576 <srcfiles dir="${contrib.src.test}"/>
580 <target name="test-contrib" depends="compile-main,compile-contrib,-test-contrib-check" unless="contrib.test.notRequired">
581 <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="contrib.test.failed">
583 <path refid="contrib.classpath"/>
584 <pathelement location="${main.output.dir}"/>
585 <pathelement location="${contrib.output.dir}"/>
586 <pathelement location="${contrib.output.test.dir}"/>
587 <pathelement location="${junit.jar1.dir}"/>
589 <sysproperty key="HSSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hssf/data"/>
590 <sysproperty key="HPSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hpsf/data"/>
591 <sysproperty key="java.awt.headless" value="true"/>
592 <formatter type="plain"/>
593 <formatter type="xml"/>
594 <batchtest todir="${contrib.reports.test}">
595 <fileset dir="${contrib.src.test}">
596 <include name="**/Test*.java"/>
597 <exclude name="**/AllTests.java"/>
601 <delete file="${contrib.testokfile}"/>
602 <antcall target="-test-contrib-write-testfile"/>
605 <target name="-test-contrib-write-testfile" unless="contrib.test.failed">
606 <echo file="${contrib.testokfile}" append="false" message="testok"/>
609 <target name="-check-docs">
610 <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html">
611 <srcfiles dir="${build.site.src}"/>
615 <target name="-check-forrest-installed" unless="env.FORREST_HOME">
616 <echo>Please install Apache Forrest (see
617 <http://xml.apache.org/forrest/index.html>) and set the
618 FORREST_HOME environment variable!</echo>
619 <fail message="Apache Forrest is not installed."/>
622 <!-- <target name="check-docs">-->
623 <!-- <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html" >-->
624 <!-- <srcfiles dir= "${build.site.src}"/>-->
628 <target name="docs" depends="init, -check-forrest-installed, -check-docs"
629 unless="main.docs.notRequired" description="Builds the POI website">
631 <mkdir dir="${build.site.src}/src/documentation/content/apidocs"/>
632 <copy todir="${build.site.src}/src/documentation/content/apidocs">
633 <fileset dir="${apidocs.report.dir}"/>
636 tofile="${build.site.src}/src/documentation/content/jdepend.ehtml"
637 file="${jdepend.report.dir}/index.html" failonerror="false"/>
638 <mkdir dir="${build.site.src}/src/documentation/content/junit"/>
639 <copy todir="${build.site.src}/src/documentation/content/junit">
640 <fileset dir="${junit.report.dir}"/>
644 file="${build.site.src}/src/documentation/content/xdocs/status.xml"
645 tofile="${build.site.src}/status.xml"/>
647 <ant antfile="${forrest.home}/forrest.antproxy.xml" target="site">
648 <property name="project.home" location="${build.site.src}"/>
651 <echo>Broken links:</echo>
652 <echo file="${build.site}/../tmp/brokenlinks.txt"/>
655 <fileset dir="${build.site}"/>
659 <!-- Checks whether reports are required to be run. If nothing has changed then they dont. -->
660 <target name="-check-reports">
661 <condition property="reports.notRequired">
663 <equals arg1="${main.test.notRequired}" arg2="true"/>
664 <equals arg1="${scratchpad.test.notRequired}" arg2="true"/>
665 <equals arg1="${contrib.test.notRequired}" arg2="true"/>
672 <!-- Generates a log of the latest changes in the CVS repository. -->
673 <target name="cvschangelog" unless="disconnected"
674 depends="fail-unless-xslt-is-available"
675 description="Generates a CVS change log report">
676 <antcall target="cvs-rsh-warning"/>
677 <cvschangelog destfile="${changelog.file}" daysinpast="30"/>
679 <style in="${changelog.file}"
680 out="${build.site.src}/src/documentation/content/changelog.html"
681 style="changelog.xsl">
682 <param name="title" expression="POI Change Log"/>
683 <param name="module" expression="jakarta-poi"/>
684 <param name="cvsweb" expression="http://cvs.apache.org/viewcvs/"/>
688 <target name="cvs-rsh-warning" unless="env.CVS_RSH">
690 WARNING: The environment variable CVS_RSH is not set. If you cannot
691 access the CVS repository this could be one of the reasons for the
698 <!-- Creates reports and API documentation -->
699 <target name="reports" unless="reports.notRequired" depends="-check-reports,
700 fail-unless-xslt-is-available, fail-unless-junit-is-available,
701 fail-unless-jdepend-is-available, test-ignore-failures, junitreport,
702 jdepend, cvschangelog, javadocs, clover.html"
703 description="Creates various reports and the API documentation">
708 <!-- Runs all JUnit tests without aborting if one of the tests fails. -->
709 <target name="test-ignore-failures" depends="init">
710 <antcall target="test">
711 <param name="halt.on.test.failure" value="false"/>
717 <!-- Produces a report of the JUnit test results -->
718 <target name="junitreport"
719 depends="fail-unless-xslt-is-available, test-ignore-failures"
720 description="Produces a report of the JUnit test results">
721 <junitreport todir="${junit.report.dir}">
722 <fileset dir="${main.reports.test}">
723 <include name="TEST-*.xml"/>
725 <fileset dir="${scratchpad.reports.test}">
726 <include name="TEST-*.xml"/>
728 <fileset dir="${contrib.reports.test}">
729 <include name="TEST-*.xml"/>
731 <report format="frames" todir="${junit.report.dir}"/>
737 <!-- Generates the API documentation. -->
738 <target name="javadocs" depends="init, warn-unless-junit-is-available,
739 warn-unless-xslt-is-available"
740 description="Generates the API documentation">
741 <javadoc verbose="false" author="true" destdir="${apidocs.report.dir}"
742 windowtitle="POI API Documentation" use="true" version="true">
744 <packageset dir="${main.src}" defaultexcludes="yes">
745 <include name="org/apache/poi/**"/>
747 <packageset dir="${scratchpad.src}" defaultexcludes="yes">
748 <include name="org/apache/poi/**"/>
749 <exclude name="org/apache/poi/hdf/**"/>
751 <packageset dir="${contrib.src}" defaultexcludes="yes">
752 <include name="org/apache/poi/**"/>
754 <packageset dir="${examples.src}" defaultexcludes="yes">
755 <include name="org/apache/poi/**"/>
758 <classpath id="javadoc.classpath">
759 <path refid="main.classpath"/>
760 <path refid="scratchpad.classpath"/>
761 <path refid="contrib.classpath"/>
762 <path refid="examples.classpath"/>
763 <path path="${env.CLASSPATH}"/>
766 <doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle>
768 <![CDATA[<i>Copyright ${tstamp.year} The Apache Software Foundation or
769 its licensors, as applicable.</i>]]>
772 <title>DDF - Dreadful Drawing Format</title>
773 <package name="org.apache.poi.ddf*"/>
776 <title>HPSF - Horrible Property Set Format</title>
777 <package name="org.apache.poi.hpsf*"/>
780 <title>HSSF - Horrible Spreadsheet Format</title>
781 <package name="org.apache.poi.hssf*"/>
784 <title>HWPF - Horrible Word Processor Format</title>
785 <package name="org.apache.poi.hwpf*"/>
788 <title>POIFS - POI File System</title>
789 <package name="org.apache.poi.poifs*"/>
792 <title>Utilities</title>
793 <package name="org.apache.poi.util*"/>
796 <title>Examples</title>
797 <package name="org.apache.poi.hpsf.examples*"/>
798 <package name="org.apache.poi.hssf.usermodel.examples*"/>
802 <antcall target="clover.html"/>
807 <!-- ================================== -->
808 <!-- Generate records -->
809 <!-- ================================== -->
811 <target name="generate-records" depends="init"
812 description="Generates HSSF records">
813 <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
814 <arg file="src/records/definitions"/>
815 <arg file="src/records/styles"/>
816 <arg file="src/java"/>
817 <arg file="src/testcases"/>
819 <path refid="scratchpad.classpath"/>
820 <pathelement location="${main.output.dir}"/>
821 <pathelement location="${scratchpad.output.dir}"/>
826 <!-- ================================== -->
827 <!-- Generate types -->
828 <!-- ================================== -->
830 <target name="generate-types" depends="init"
831 description="Generates word types">
832 <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
833 <arg file="src/types/definitions"/>
834 <arg file="src/types/styles"/>
835 <arg file="src/scratchpad/src"/>
836 <arg file="src/scratchpad/testcases"/>
838 <path refid="scratchpad.classpath">
840 <pathelement location="${main.output.dir}"/>
841 <pathelement location="${scratchpad.output.dir}"/>
848 <!-- Generates documentation and reports -->
849 <target name="site" depends="reports, docs"
850 description="Generates POI's website's contents"/>
853 <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">
854 <!-- Copy the jar files into the maven jar directory -->
855 <!-- Same jars as for the main release, only lacking the datestamp -->
857 file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"
858 tofile="${mavendist.oap.dir}/jars/${jar.name}-${version.id}.jar" />
860 file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"
861 tofile="${mavendist.oap.dir}/jars/${jar.name}-contrib-${version.id}.jar" />
863 file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"
864 tofile="${mavendist.oap.dir}/jars/${jar.name}-scratchpad-${version.id}.jar" />
866 <!-- TODO: Decide about source jars, and copy them if we have some -->
868 <!-- Build the org.apache.poi poms -->
869 <!-- Copy from the base file, substituting in the version and -->
870 <!-- artificat, plus doing the core poi dependency as needed -->
872 <!-- Build the main pom -->
875 tofile="${mavendist.oap.dir}/poms/${jar.name}-${version.id}.pom"
879 <token key="VERSION" value="${version.id}" />
880 <token key="ARTIFICAT" value="poi" />
884 <replaceregex pattern="START_NON_MAIN.*END_NON_MAIN_DEPENDENCY" replace="No POI dependency on the main jar" flags="s" />
888 <!-- And the contrib pom -->
891 tofile="${mavendist.oap.dir}/poms/${jar.name}-contrib-${version.id}.pom"
895 <token key="VERSION" value="${version.id}" />
896 <token key="ARTIFICAT" value="poi-contrib" />
899 <replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
900 <replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
904 <!-- And the scratchpad pom -->
907 tofile="${mavendist.oap.dir}/poms/${jar.name}-scratchpad-${version.id}.pom"
911 <token key="VERSION" value="${version.id}" />
912 <token key="ARTIFICAT" value="poi-scratchpad" />
915 <replaceregex pattern="..-- START_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
916 <replaceregex pattern="..-- END_NON_MAIN_DEPENDENCY --." replace="" flags="s"/>
921 <!-- Build the poi => org.apache.poi redirect poms -->
922 <!-- Copy from the base file, substituting in the version+artifact -->
924 file="poi-redirect.pom"
925 tofile="${mavendist.poi.dir}/poms/${jar.name}-${version.id}.pom"
927 <filterchain><replacetokens>
928 <token key="VERSION" value="${version.id}" />
929 <token key="ARTIFICAT" value="poi" />
930 </replacetokens></filterchain>
933 file="poi-redirect.pom"
934 tofile="${mavendist.poi.dir}/poms/${jar.name}-contrib-${version.id}.pom"
936 <filterchain><replacetokens>
937 <token key="VERSION" value="${version.id}" />
938 <token key="ARTIFICAT" value="poi-contrib" />
939 </replacetokens></filterchain>
942 file="poi-redirect.pom"
943 tofile="${mavendist.poi.dir}/poms/${jar.name}-scratchpad-${version.id}.pom"
945 <filterchain><replacetokens>
946 <token key="VERSION" value="${version.id}" />
947 <token key="ARTIFICAT" value="poi-scratchpad" />
948 </replacetokens></filterchain>
951 <!-- And that's it for maven -->
954 <target name="jar" depends="compile" description="Creates jar files for distribution">
955 <jar destfile="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar">
956 <fileset dir="${main.output.dir}" />
957 <fileset dir="legal/" />
959 <attribute name="Built-By" value="${user.name}"/>
960 <attribute name="Specification-Title" value="Apache POI"/>
961 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
962 <attribute name="Specification-Vendor" value="Apache"/>
963 <attribute name="Implementation-Title" value="Apache POI"/>
964 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
965 <attribute name="Implementation-Vendor" value="Apache"/>
968 <jar destfile="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar">
969 <fileset dir="${contrib.output.dir}" />
970 <fileset dir="legal/" />
972 <attribute name="Built-By" value="${user.name}"/>
973 <attribute name="Specification-Title" value="Apache POI"/>
974 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
975 <attribute name="Specification-Vendor" value="Apache"/>
976 <attribute name="Implementation-Title" value="Apache POI"/>
977 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
978 <attribute name="Implementation-Vendor" value="Apache"/>
981 <jar destfile="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar">
982 <fileset dir="${scratchpad.output.dir}" />
983 <fileset dir="legal/" />
985 <attribute name="Built-By" value="${user.name}"/>
986 <attribute name="Specification-Title" value="Apache POI"/>
987 <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
988 <attribute name="Specification-Vendor" value="Apache"/>
989 <attribute name="Implementation-Title" value="Apache POI"/>
990 <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
991 <attribute name="Implementation-Vendor" value="Apache"/>
996 <target name="dist" depends="clean, fail-unless-tools-are-available, compile, site, jar"
997 description="Creates the entire distribution into build/dist, from scratch">
999 <property name="zipdir" value="${jar.name}-${version.id}" />
1001 <zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
1002 <zipfileset dir="legal/" prefix="${zipdir}" />
1003 <zipfileset dir="lib/" prefix="${zipdir}/lib" />
1004 <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1005 <zipfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1006 <zipfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1007 <zipfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1010 <zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
1011 <zipfileset dir="legal/" prefix="${zipdir}" />
1012 <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1013 <zipfileset dir="." prefix="${zipdir}">
1014 <exclude name="build/**"/>
1015 <exclude name="scripts/**"/>
1016 <exclude name="*.ipr"/>
1017 <exclude name="*.iml"/>
1018 <exclude name="*.iws"/>
1019 <exclude name="*.swp"/>
1023 <tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz"
1025 <tarfileset dir="legal/" prefix="${zipdir}" />
1026 <tarfileset dir="lib/" prefix="${zipdir}/lib" />
1027 <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1028 <tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1029 <tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1030 <tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
1033 <tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz"
1035 <tarfileset dir="legal/" prefix="${zipdir}" />
1036 <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
1037 <tarfileset dir="." prefix="${zipdir}">
1038 <exclude name="build/**"/>
1039 <exclude name="scripts/**"/>
1040 <exclude name="*.ipr"/>
1041 <exclude name="*.iml"/>
1042 <exclude name="*.iws"/>
1043 <exclude name="*.swp"/>
1047 <echo>Distribution located in build/dist</echo>
1050 <target name="clean-compile" depends="clean, compile"/>
1052 <target name="clean-dist" depends="clean, dist"
1053 description="Cleans the build directory then creates a distribution"/>
1055 <target name="gump" depends="test, jar"/>
1059 <!-- Generates the Ant document type definition (DTD) -->
1061 description="Generates the Ant document type definition (DTD)">
1062 <antstructure output="ant.dtd"/>
1068 <!-- Abort the build if JUnit is missing. -->
1069 <target name="fail-unless-junit-is-available" depends="init">
1070 <condition property="isAvailable.junit">
1071 <available classname="junit.framework.TestCase"/>
1073 <antcall target="fail-junit"/>
1076 <target name="fail-junit" unless="isAvailable.junit">
1078 JUnit is not available. You must download JUnit from
1079 <http://www.junit.org/> and include the JAR file in your
1082 <fail message="JUnit is not available."/>
1085 <!-- Warn if JUnit is missing. -->
1086 <target name="warn-unless-junit-is-available" depends="init">
1087 <condition property="isAvailable.junit">
1088 <available classname="junit.framework.TestCase"/>
1090 <antcall target="warn-junit"/>
1093 <target name="warn-junit" unless="isAvailable.junit">
1095 WARNING: Since JUnit is not available you might encounter failures
1096 subsequently. In order to avoid this you should download JUnit from
1097 <http://www.junit.org/> and include the JAR file in your
1104 <!-- Abort the build if JDepend is missing. -->
1105 <target name="fail-unless-jdepend-is-available" depends="init">
1106 <condition property="isAvailable.jdepend">
1107 <available classname="jdepend.framework.JDepend"/>
1109 <antcall target="fail-jdepend"/>
1112 <target name="fail-jdepend" unless="isAvailable.jdepend">
1114 JDepend is not available. You must download JDepend from
1115 <http://www.clarkware.com/software/JDepend.html> and include the
1116 JAR file in your classpath.
1118 <fail message="JDepend is not available."/>
1123 <!-- Abort the build if an XSLT processor is missing. -->
1124 <target name="fail-unless-xslt-is-available" depends="init">
1125 <condition property="isAvailable.xslt">
1126 <available classname="javax.xml.transform.TransformerFactory"/>
1128 <antcall target="fail-xslt"/>
1131 <target name="fail-xslt" unless="isAvailable.xslt">
1133 An XSLT processor is missing. You must download e.g. Xalan from
1134 <http://xml.apache.org/xalan-j/> and include the JAR file in your
1137 <fail message="An XSLT processor is not available."/>
1140 <!-- Warn if an XSLT processor is missing. -->
1141 <target name="warn-unless-xslt-is-available" depends="init">
1142 <condition property="isAvailable.xslt">
1143 <available classname="javax.xml.transform.TransformerFactory"/>
1145 <antcall target="warn-xslt"/>
1148 <target name="warn-xslt" unless="isAvailable.xslt">
1150 WARNING: Since an XSLT processor is not available you might encounter
1151 failures subsequently. In order to avoid this you should download
1152 e.g. Xalan from <http://xml.apache.org/xalan-j/> and include the
1153 JAR file in your classpath.
1159 <!-- Aborts the build if any of the required tools are missing. -->
1160 <target name="fail-unless-tools-are-available"
1161 depends="fail-unless-junit-is-available, fail-unless-junit-is-available,
1162 fail-unless-jdepend-is-available"/>
1166 <!-- Runs jdepend to produce a report about package dependencies -->
1167 <target name="jdepend" depends="fail-unless-jdepend-is-available"
1168 description="Runs jdepend to produce a report about package dependencies">
1169 <jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
1171 <pathelement location="${main.output.dir}"/>
1172 <pathelement location="${contrib.output.dir}"/>
1173 <pathelement location="${scratchpad.output.dir}"/>
1176 <path refid="main.classpath"/>
1177 <path refid="contrib.classpath"/>
1178 <path refid="scratchpad.classpath"/>
1182 <style basedir="${jdepend.report.dir}"
1183 in="${jdepend.report.dir}/jdepend.xml"
1184 out="${jdepend.report.out.dir}/index.html"
1185 style="jdepend.xsl"/>
1190 <!-- Keep this comment at the end of the file
1195 sgml-namecase-general:nil
1196 sgml-general-insert-case:lower
1197 sgml-minimize-attributes:nil
1198 sgml-always-quote-attributes:t
1201 sgml-parent-document:nil
1202 sgml-exposed-tags:nil
1203 sgml-local-catalogs:nil
1204 sgml-local-ecat-files:nil