- Improved the build process' with respect to its dependencies on JUnit, JDepend and an XSLT processor.

- Included DDF in the generated javadoc API documentation.
- Excluded the obsolete HDF from the generated javadoc API documentation.
- Included the CLASSPATH environment variable in the javadoc classpath so that references to third-party packages can be resolved.
- Removed all explicit references to Xalan and changed the HSSF record generator to use any XSLT processor. However, that stuff seems to be very much out of date: The XSL stylesheet won't compile even after an obvious fix. Thus my modifications are untested but that stuff won't work anyway. I doubt it is important.
- Did some beautifications on the build.xml file.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353683 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rainer Klute 2005-05-16 21:39:22 +00:00
parent 09f4225d74
commit c71b3635a9
5 changed files with 358 additions and 292 deletions

54
ant.dtd
View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!ENTITY % boolean "(true|false|on|off|yes|no)"> <!ENTITY % boolean "(true|false|on|off|yes|no)">
<!ENTITY % tasks "propertyfile | ccmkdir | importtypelib | vsscheckin | sql | cvspass | p4reopen | csc | dirname | wlrun | p4label | p4revert | replaceregexp | get | jjtree | sleep | jarlib-display | dependset | zip | patch | jspc | style | test | tstamp | unwar | vsshistory | icontract | cvschangelog | p4submit | ccmcheckin | p4change | bzip2 | sync | p4delete | vssadd | javadoc | p4integrate | translate | signjar | cclock | chown | vajload | jarlib-available | rexec | WsdlToDotnet | buildnumber | jpcovmerge | ejbjar | war | stlist | rename | sequential | serverdeploy | property | subant | move | ildasm | copydir | cccheckin | ccunlock | wljspc | fixcrlf | telnet | sosget | pathconvert | record | p4sync | exec | ccmklabel | p4edit | manifest | maudit | antlr | netrexxc | ftp | jpcovreport | execon | ccmcheckout | ant | xmlvalidate | xslt | p4resolve | iplanet-ejbc | ccmcheckintask | gzip | native2ascii | ccrmtype | starteam | ear | input | presetdef | rmic | checksum | mail | loadfile | vsscheckout | stylebook | soscheckin | mimemail | stlabel | gunzip | concat | cab | touch | parallel | splash | antcall | ccmkbl | cccheckout | typedef | p4have | filter | xmlproperty | import | jdepend | copy | jsharpc | symlink | antstructure | script | ccmcreatetask | rpm | delete | replace | mmetrics | attrib | waitfor | untar | loadproperties | available | echoproperties | junit | stcheckin | chgrp | vajexport | stcheckout | bunzip2 | whichresource | copyfile | p4labelsync | vsscreate | macrodef | unjar | ejbc | vbc | wsdltodotnet | mkdir | cvs | condition | tempfile | junitreport | ccmkattr | taskdef | echo | ccupdate | java | vsslabel | renameext | basename | javadoc2 | tar | vsscp | vajimport | p4fstat | setproxy | p4counter | wlstop | ilasm | soscheckout | apply | ccuncheckout | jarlib-resolve | jlink | cvstagdiff | javacc | chmod | pvcs | jarlib-manifest | jar | ccmklbtype | sound | scriptdef | defaultexcludes | mparse | blgenclient | uptodate | jjdoc | genkey | javah | ccmkelem | ccmreconfigure | fail | unzip | javac | p4add | jpcoverage | soslabel | depend | vssget | deltree | ddcreator"> <!ENTITY % tasks "propertyfile | ccmkdir | importtypelib | vsscheckin | sql | cvspass | p4reopen | csc | dirname | wlrun | p4label | p4revert | replaceregexp | get | jjtree | sleep | jarlib-display | dependset | zip | patch | jspc | style | test | tstamp | unwar | vsshistory | icontract | cvschangelog | p4submit | ccmcheckin | p4change | bzip2 | sync | p4delete | vssadd | javadoc | p4integrate | translate | signjar | cclock | chown | vajload | jarlib-available | rexec | WsdlToDotnet | buildnumber | jpcovmerge | ejbjar | war | stlist | rename | sequential | serverdeploy | property | subant | move | ildasm | copydir | cccheckin | ccunlock | wljspc | fixcrlf | telnet | sosget | pathconvert | record | p4sync | exec | ccmklabel | p4edit | manifest | maudit | antlr | netrexxc | ftp | jpcovreport | execon | ccmcheckout | ant | xmlvalidate | xslt | p4resolve | iplanet-ejbc | ccmcheckintask | gzip | native2ascii | ccrmtype | starteam | ear | input | presetdef | rmic | checksum | mail | loadfile | vsscheckout | stylebook | soscheckin | mimemail | stlabel | gunzip | concat | cab | touch | parallel | splash | antcall | ccmkbl | cccheckout | typedef | p4have | filter | xmlproperty | import | copy | jsharpc | symlink | antstructure | script | ccmcreatetask | rpm | delete | replace | mmetrics | attrib | waitfor | untar | loadproperties | available | echoproperties | junit | stcheckin | chgrp | vajexport | stcheckout | bunzip2 | whichresource | copyfile | p4labelsync | vsscreate | macrodef | ejbc | unjar | vbc | wsdltodotnet | mkdir | cvs | condition | tempfile | junitreport | ccmkattr | taskdef | echo | ccupdate | java | vsslabel | renameext | basename | javadoc2 | tar | vsscp | vajimport | p4fstat | setproxy | p4counter | wlstop | ilasm | soscheckout | apply | ccuncheckout | jarlib-resolve | jlink | cvstagdiff | javacc | chmod | pvcs | jarlib-manifest | jar | ccmklbtype | sound | scriptdef | defaultexcludes | mparse | blgenclient | uptodate | jjdoc | genkey | javah | ccmkelem | ccmreconfigure | fail | unzip | javac | p4add | jpcoverage | soslabel | depend | vssget | deltree | ddcreator">
<!ENTITY % types "patternset | assertions | propertyset | filterset | libfileset | mergemapper | identitymapper | filterreader | unpackagemapper | scriptfilter | concatfilter | extension | fileset | dirset | globmapper | filelist | filterchain | path | compositemapper | classfileset | regexpmapper | selector | xmlcatalog | flattenmapper | description | chainedmapper | packagemapper | mapper | zipfileset | substitution | extensionSet | redirector | regexp"> <!ENTITY % types "patternset | assertions | propertyset | filterset | libfileset | mergemapper | identitymapper | filterreader | unpackagemapper | scriptfilter | concatfilter | extension | fileset | dirset | globmapper | filelist | filterchain | path | compositemapper | classfileset | regexpmapper | selector | xmlcatalog | flattenmapper | description | chainedmapper | packagemapper | mapper | zipfileset | substitution | extensionSet | redirector | regexp">
<!ELEMENT project (target | %tasks; | %types;)*> <!ELEMENT project (target | %tasks; | %types;)*>
@ -3556,38 +3556,6 @@
file CDATA #IMPLIED file CDATA #IMPLIED
description CDATA #IMPLIED> description CDATA #IMPLIED>
<!ELEMENT jdepend (exclude | classpath | sourcespath | classespath)*>
<!ATTLIST jdepend
id ID #IMPLIED
haltonerror %boolean; #IMPLIED
fork %boolean; #IMPLIED
classpath CDATA #IMPLIED
jvm CDATA #IMPLIED
dir CDATA #IMPLIED
outputfile CDATA #IMPLIED
includeruntime %boolean; #IMPLIED
timeout CDATA #IMPLIED
classpathref IDREF #IMPLIED
taskname CDATA #IMPLIED
format (xml | text) #IMPLIED
description CDATA #IMPLIED>
<!ELEMENT sourcespath (fileset | dirset | extdirs | existing | filelist | pathelement | path)*>
<!ATTLIST sourcespath
id ID #IMPLIED
location CDATA #IMPLIED
refid IDREF #IMPLIED
description CDATA #IMPLIED
path CDATA #IMPLIED>
<!ELEMENT classespath (fileset | dirset | extdirs | existing | filelist | pathelement | path)*>
<!ATTLIST classespath
id ID #IMPLIED
location CDATA #IMPLIED
refid IDREF #IMPLIED
description CDATA #IMPLIED
path CDATA #IMPLIED>
<!ELEMENT copy (filterchain | fileset | filterset | mapper)*> <!ELEMENT copy (filterchain | fileset | filterset | mapper)*>
<!ATTLIST copy <!ATTLIST copy
id ID #IMPLIED id ID #IMPLIED
@ -4139,16 +4107,6 @@
optional %boolean; #IMPLIED optional %boolean; #IMPLIED
description CDATA #IMPLIED> description CDATA #IMPLIED>
<!ELEMENT unjar (fileset | patternset)*>
<!ATTLIST unjar
id ID #IMPLIED
taskname CDATA #IMPLIED
dest CDATA #IMPLIED
overwrite %boolean; #IMPLIED
description CDATA #IMPLIED
encoding CDATA #IMPLIED
src CDATA #IMPLIED>
<!ELEMENT ejbc (patternset | exclude | include | custom | present | none | not | type | modified | or | contains | depend | different | size | majority | containsregexp | filename | selector | includesfile | date | excludesfile | depth | and)*> <!ELEMENT ejbc (patternset | exclude | include | custom | present | none | not | type | modified | or | contains | depend | different | size | majority | containsregexp | filename | selector | includesfile | date | excludesfile | depth | and)*>
<!ATTLIST ejbc <!ATTLIST ejbc
id ID #IMPLIED id ID #IMPLIED
@ -4168,6 +4126,16 @@
descriptors CDATA #IMPLIED descriptors CDATA #IMPLIED
includes CDATA #IMPLIED> includes CDATA #IMPLIED>
<!ELEMENT unjar (fileset | patternset)*>
<!ATTLIST unjar
id ID #IMPLIED
taskname CDATA #IMPLIED
dest CDATA #IMPLIED
overwrite %boolean; #IMPLIED
description CDATA #IMPLIED
encoding CDATA #IMPLIED
src CDATA #IMPLIED>
<!ELEMENT vbc (patternset | exclude | include | custom | present | none | resource | define | not | type | modified | reference | src | or | contains | depend | different | size | majority | containsregexp | filename | selector | includesfile | date | excludesfile | depth | and)*> <!ELEMENT vbc (patternset | exclude | include | custom | present | none | resource | define | not | type | modified | reference | src | or | contains | depend | different | size | majority | containsregexp | filename | selector | includesfile | date | excludesfile | depth | and)*>
<!ATTLIST vbc <!ATTLIST vbc
id ID #IMPLIED id ID #IMPLIED

512
build.xml
View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. --> <!-- Copyright 2005 The Apache Software Foundation. Aöll rights reserved. -->
<!DOCTYPE project PUBLIC "-//Ant//Project 1.5//EN" "ant.dtd"> <!DOCTYPE project PUBLIC "-//Ant//Project 1.5//EN" "ant.dtd">
<!-- <!--
@ -252,56 +252,65 @@
compile-contrib, compile-examples" compile-contrib, compile-examples"
description="Compiles the POI main classes, scratchpad, contrib, and examples"/> description="Compiles the POI main classes, scratchpad, contrib, and examples"/>
<target name="compile-main" depends="init"> <target name="compile-main" depends="fail-unless-xslt-is-available">
<copy todir="${main.output.dir}"> <copy todir="${main.output.dir}">
<fileset dir="${main.resource1.dir}"/> <fileset dir="${main.resource1.dir}"/>
</copy> </copy>
<javac srcdir="${main.src}" destdir="${main.output.dir}" debug="on" fork="yes" includeAntRuntime="no" failonerror="true"> <javac srcdir="${main.src}" destdir="${main.output.dir}" debug="on"
<classpath refid="main.classpath"/> fork="yes" includeAntRuntime="no" failonerror="true">
</javac> <classpath refid="main.classpath"/>
<javac srcdir="${main.src.test}" destdir="${main.output.test.dir}" debug="on" fork="yes" includeAntRuntime="no" failonerror="true"> </javac>
<classpath> <javac srcdir="${main.src.test}" destdir="${main.output.test.dir}"
<path refid="main.classpath"/> debug="on" fork="yes" includeAntRuntime="no" failonerror="true">
<pathelement location="${main.output.dir}"/> <classpath>
<pathelement location="${junit.jar1.dir}"/> <path refid="main.classpath"/>
</classpath> <pathelement location="${main.output.dir}"/>
</javac> <pathelement location="${junit.jar1.dir}"/>
</target> </classpath>
</javac>
</target>
<target name="compile-scratchpad" depends="init"> <target name="compile-scratchpad" depends="init">
<javac srcdir="${scratchpad.src}" destdir="${scratchpad.output.dir}" debug="on" fork="yes" includeAntRuntime="no" failonerror="true"> <javac srcdir="${scratchpad.src}" destdir="${scratchpad.output.dir}"
<classpath refid="scratchpad.classpath"/> debug="on" fork="yes" includeAntRuntime="no" failonerror="true">
</javac> <classpath refid="scratchpad.classpath"/>
<javac srcdir="${scratchpad.src.test}" destdir="${scratchpad.output.test.dir}" debug="on" fork="yes" includeAntRuntime="no" failonerror="true"> </javac>
<classpath> <javac srcdir="${scratchpad.src.test}"
<path refid="scratchpad.classpath"/> destdir="${scratchpad.output.test.dir}" debug="on" fork="yes"
<pathelement location="${scratchpad.output.dir}"/> includeAntRuntime="no" failonerror="true">
<pathelement location="${junit.jar1.dir}"/> <classpath>
</classpath> <path refid="scratchpad.classpath"/>
</javac> <pathelement location="${scratchpad.output.dir}"/>
</target> <pathelement location="${junit.jar1.dir}"/>
</classpath>
</javac>
</target>
<target name="compile-contrib" depends="init"> <target name="compile-contrib" depends="init">
<javac srcdir="${contrib.src}" destdir="${contrib.output.dir}" debug="on" fork="yes" includeAntRuntime="no" failonerror="true"> <javac srcdir="${contrib.src}" destdir="${contrib.output.dir}"
<classpath refid="contrib.classpath"/> debug="on" fork="yes" includeAntRuntime="no" failonerror="true">
</javac> <classpath refid="contrib.classpath"/>
<javac srcdir="${contrib.src.test}" destdir="${contrib.output.test.dir}" debug="on" fork="yes" includeAntRuntime="no" failonerror="true"> </javac>
<classpath> <javac srcdir="${contrib.src.test}"
<path refid="contrib.classpath"/> destdir="${contrib.output.test.dir}" debug="on" fork="yes"
<pathelement location="${contrib.output.dir}"/> includeAntRuntime="no" failonerror="true">
<pathelement location="${junit.jar1.dir}"/> <classpath>
</classpath> <path refid="contrib.classpath"/>
</javac> <pathelement location="${contrib.output.dir}"/>
</target> <pathelement location="${junit.jar1.dir}"/>
</classpath>
</javac>
</target>
<target name="compile-examples" depends="init"> <target name="compile-examples" depends="init">
<javac srcdir="${examples.src}" destdir="${examples.output.dir}" debug="on"> <javac srcdir="${examples.src}" destdir="${examples.output.dir}"
debug="on">
<classpath refid="examples.classpath"/> <classpath refid="examples.classpath"/>
</javac> </javac>
</target> </target>
<target name="test" depends="test-main,test-scratchpad,test-contrib" <target name="test" depends="test-main,test-scratchpad,test-contrib"
description="Tests main, contrib and scratchpad"/> description="Tests main, contrib and scratchpad"/>
<target name="-test-main-check"> <target name="-test-main-check">
<uptodate property="main.test.notRequired" targetfile="${main.testokfile}"> <uptodate property="main.test.notRequired" targetfile="${main.testokfile}">
@ -317,69 +326,77 @@
<pathelement location="${junit.jar1.dir}"/> <pathelement location="${junit.jar1.dir}"/>
</path> </path>
<target <target name="test-main" unless="main.test.notRequired"
name="test-main" depends="compile-main, -test-main-check, fail-unless-junit-is-available">
depends="compile-main, -test-main-check, is-available-junit" <junit fork="no" printsummary="no" haltonfailure="${halt.on.test.failure}"
unless="main.test.notRequired"> failureproperty="main.test.failed" showoutput="true">
<junit printsummary="no" showoutput="true" fork="no" <classpath refid="test.classpath"/>
haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed"> <sysproperty key="HSSF.testdata.path"
<classpath refid="test.classpath"/> file="${main.src.test}/org/apache/poi/hssf/data"/>
<sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/> <sysproperty key="HPSF.testdata.path"
<sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/> file="${main.src.test}/org/apache/poi/hpsf/data"/>
<sysproperty key="java.awt.headless" value="true"/> <sysproperty key="java.awt.headless" value="true"/>
<formatter type="plain"/> <formatter type="plain"/>
<formatter type="xml"/> <formatter type="xml"/>
<batchtest todir="${main.reports.test}"> <batchtest todir="${main.reports.test}">
<fileset dir="${main.src.test}"> <fileset dir="${main.src.test}">
<include name="**/Test*.java"/> <include name="**/Test*.java"/>
<exclude name="**/AllTests.java"/> <exclude name="**/AllTests.java"/>
<exclude name="**/TestEmptyDocument.java"/> <exclude name="**/TestEmptyDocument.java"/>
<exclude name="**/TestUnfixedBugs.java"/> <exclude name="**/TestUnfixedBugs.java"/>
</fileset> </fileset>
</batchtest> </batchtest>
</junit> </junit>
<delete file="${main.testokfile}"/> <delete file="${main.testokfile}"/>
<antcall target="-test-main-write-testfile"/> <antcall target="-test-main-write-testfile"/>
</target> </target>
<target name="test-fail" depends="compile-main,
fail-unless-junit-is-available"
description="run tests that are known to fail">
<junit printsummary="yes" showoutput="true" filtertrace="no"
haltonfailure="false">
<classpath refid="test.classpath"/>
<classpath>
<path refid="scratchpad.classpath"/>
<pathelement location="${main.output.dir}"/>
<pathelement location="${scratchpad.output.dir}"/>
<pathelement location="${scratchpad.output.test.dir}"/>
<pathelement location="${junit.jar1.dir}"/>
</classpath>
<sysproperty key="HSSF.testdata.path"
file="${main.src.test}/org/apache/poi/hssf/data"/>
<sysproperty key="HPSF.testdata.path"
file="${main.src.test}/org/apache/poi/hpsf/data"/>
<sysproperty key="HWPF.testdata.path"
file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
<sysproperty key="java.awt.headless" value="true"/>
<formatter type="plain" usefile="no"/>
<batchtest todir="${main.reports.test}">
<fileset dir="${main.src.test}">
<include name="**/TestEmptyDocument.java"/>
<include name="**/TestUnfixedBugs.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test-fail" depends = "compile-main, is-available-junit" description="run tests that are known to fail">
<junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
<classpath refid="test.classpath"/>
<classpath>
<path refid="scratchpad.classpath"/>
<pathelement location="${main.output.dir}"/>
<pathelement location="${scratchpad.output.dir}"/>
<pathelement location="${scratchpad.output.test.dir}"/>
<pathelement location="${junit.jar1.dir}"/>
</classpath>
<sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
<sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
<sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
<sysproperty key="java.awt.headless" value="true"/>
<formatter type="plain" usefile="no"/>
<batchtest todir="${main.reports.test}">
<fileset dir="${main.src.test}">
<include name="**/TestEmptyDocument.java"/>
<include name="**/TestUnfixedBugs.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="single-test" depends="-test-property-check,compile-main" description="Runs a single test case specified with -Dtestcase=classname"> <target name="single-test" depends="-test-property-check,compile-main" description="Runs a single test case specified with -Dtestcase=classname">
<junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" > <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
<classpath refid="test.classpath"/> <classpath refid="test.classpath"/>
<classpath> <classpath>
<path refid="scratchpad.classpath"/> <path refid="scratchpad.classpath"/>
<pathelement location="${main.output.dir}"/> <pathelement location="${main.output.dir}"/>
<pathelement location="${scratchpad.output.dir}"/> <pathelement location="${scratchpad.output.dir}"/>
<pathelement location="${scratchpad.output.test.dir}"/> <pathelement location="${scratchpad.output.test.dir}"/>
<pathelement location="${junit.jar1.dir}"/> <pathelement location="${junit.jar1.dir}"/>
</classpath> </classpath>
<sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/> <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
<sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/> <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
<sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/> <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
<sysproperty key="java.awt.headless" value="true"/> <sysproperty key="java.awt.headless" value="true"/>
<formatter type="plain" usefile="no"/> <formatter type="plain" usefile="no"/>
<formatter type="xml"/> <formatter type="xml"/>
<test name="${testcase}"/> <test name="${testcase}"/>
@ -547,7 +564,8 @@ FORREST_HOME environment variable!</echo>
<!-- Generates a log of the latest changes in the CVS repository. --> <!-- Generates a log of the latest changes in the CVS repository. -->
<target name="cvschangelog" unless="disconnected" depends="is-available-xslt" <target name="cvschangelog" unless="disconnected"
depends="fail-unless-xslt-is-available"
description="Generates a CVS change log report"> description="Generates a CVS change log report">
<antcall target="cvs-rsh-warning"/> <antcall target="cvs-rsh-warning"/>
<cvschangelog destfile="${changelog.file}" daysinpast="30"/> <cvschangelog destfile="${changelog.file}" daysinpast="30"/>
@ -573,9 +591,9 @@ FORREST_HOME environment variable!</echo>
<!-- Creates reports and API documentation --> <!-- Creates reports and API documentation -->
<target name="reports" unless="reports.notRequired" depends="-check-reports, <target name="reports" unless="reports.notRequired" depends="-check-reports,
is-available-xslt, is-available-junit, is-available-jdepend, fail-unless-xslt-is-available, fail-unless-junit-is-available,
test-ignore-failures, junitreport, jdepend, cvschangelog, javadocs, fail-unless-jdepend-is-available, test-ignore-failures, junitreport,
clover.html" jdepend, cvschangelog, javadocs, clover.html"
description="Creates various reports and the API documentation"> description="Creates various reports and the API documentation">
</target> </target>
@ -591,7 +609,8 @@ FORREST_HOME environment variable!</echo>
<!-- Produces a report of the JUnit test results --> <!-- Produces a report of the JUnit test results -->
<target name="junitreport" depends="is-available-xslt, test-ignore-failures" <target name="junitreport"
depends="fail-unless-xslt-is-available, test-ignore-failures"
description="Produces a report of the JUnit test results"> description="Produces a report of the JUnit test results">
<junitreport todir="${junit.report.dir}"> <junitreport todir="${junit.report.dir}">
<fileset dir="${main.reports.test}"> <fileset dir="${main.reports.test}">
@ -610,21 +629,18 @@ FORREST_HOME environment variable!</echo>
<!-- Generates the API documentation. --> <!-- Generates the API documentation. -->
<target name="javadocs" depends="init" <target name="javadocs" depends="init, warn-unless-junit-is-available,
warn-unless-xslt-is-available"
description="Generates the API documentation"> description="Generates the API documentation">
<javadoc <javadoc verbose="false" author="true" destdir="${apidocs.report.dir}"
destdir="${apidocs.report.dir}" windowtitle="POI API Documentation" use="true" version="true">
author="true"
version="true"
use="true"
verbose="false"
windowtitle="POI API Documentation">
<packageset dir="${main.src}" defaultexcludes="yes"> <packageset dir="${main.src}" defaultexcludes="yes">
<include name="org/apache/poi/**"/> <include name="org/apache/poi/**"/>
</packageset> </packageset>
<packageset dir="${scratchpad.src}" defaultexcludes="yes"> <packageset dir="${scratchpad.src}" defaultexcludes="yes">
<include name="org/apache/poi/**"/> <include name="org/apache/poi/**"/>
<exclude name="org/apache/poi/hdf/**"/>
</packageset> </packageset>
<packageset dir="${contrib.src}" defaultexcludes="yes"> <packageset dir="${contrib.src}" defaultexcludes="yes">
<include name="org/apache/poi/**"/> <include name="org/apache/poi/**"/>
@ -633,11 +649,12 @@ FORREST_HOME environment variable!</echo>
<include name="org/apache/poi/**"/> <include name="org/apache/poi/**"/>
</packageset> </packageset>
<classpath> <classpath id="javadoc.classpath">
<path refid="main.classpath"/> <path refid="main.classpath"/>
<path refid="scratchpad.classpath"/> <path refid="scratchpad.classpath"/>
<path refid="contrib.classpath"/> <path refid="contrib.classpath"/>
<path refid="examples.classpath"/> <path refid="examples.classpath"/>
<path path="${env.CLASSPATH}"/>
</classpath> </classpath>
<doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle> <doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle>
@ -645,13 +662,30 @@ FORREST_HOME environment variable!</echo>
<![CDATA[<i>Copyright ${tstamp.year} The Apache Software Foundation or <![CDATA[<i>Copyright ${tstamp.year} The Apache Software Foundation or
its licensors, as applicable.</i>]]> its licensors, as applicable.</i>]]>
</bottom> </bottom>
<group title="HDF" packages="org.apache.poi.hdf*"/> <group>
<group title="HPSF" packages="org.apache.poi.hpsf*"/> <title>DDF - Dreadful Drawing Format</title>
<group title="HSSF" packages="org.apache.poi.hssf*"/> <package name="org.apache.poi.ddf*"/>
<group title="HWPF" packages="org.apache.poi.hwpf*"/> </group>
<group title="POIFS" packages="org.apache.poi.poifs*"/> <group>
<group title="Record Generator" packages="org.apache.poi.record*"/> <title>HPSF - Horrible Property Set Format</title>
<group title="Utils" packages="org.apache.poi.util*"/> <package name="org.apache.poi.hpsf*"/>
</group>
<group>
<title>HSSF - Horrible Spreadsheet Format</title>
<package name="org.apache.poi.hssf*"/>
</group>
<group>
<title>HWPF - Horrible Word Processor Format</title>
<package name="org.apache.poi.hwpf*"/>
</group>
<group>
<title>POIFS - POI File System</title>
<package name="org.apache.poi.poifs*"/>
</group>
<group>
<title>Utilities</title>
<package name="org.apache.poi.util*"/>
</group>
<group> <group>
<title>Examples</title> <title>Examples</title>
<package name="org.apache.poi.hpsf.examples*"/> <package name="org.apache.poi.hpsf.examples*"/>
@ -660,53 +694,48 @@ FORREST_HOME environment variable!</echo>
</javadoc> </javadoc>
<antcall target="clover.html"/> <antcall target="clover.html"/>
</target> </target>
<!-- ================================== --> <!-- ================================== -->
<!-- Generate records --> <!-- Generate records -->
<!-- ================================== --> <!-- ================================== -->
<target name="generate-records" depends="init" <target name="generate-records" depends="init"
description="Generates HSSF records"> description="Generates HSSF records">
<java classname="org.apache.poi.dev.RecordGenerator" fork="yes"> <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
<arg location="src/records/definitions"/> <arg file="src/records/definitions"/>
<arg location="src/records/styles"/> <arg file="src/records/styles"/>
<arg location="src/java"/> <arg file="src/java"/>
<arg location="src/testcases"/> <arg file="src/testcases"/>
<classpath> <classpath>
<path refid="scratchpad.classpath"> <path refid="scratchpad.classpath"/>
</path> <pathelement location="${main.output.dir}"/>
<pathelement location="${main.output.dir}"/> <pathelement location="${scratchpad.output.dir}"/>
<pathelement location="${scratchpad.output.dir}"/> </classpath>
</classpath> </java>
</java> </target>
</target> <!-- ================================== -->
<!-- Generate types -->
<!-- ================================== -->
<!-- ================================== --> <target name="generate-types" depends="init"
<!-- Generate types --> description="Generates word types">
<!-- ================================== --> <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
<arg file="src/types/definitions"/>
<target name="generate-types" depends="init" <arg file="src/types/styles"/>
description="Generates word types"> <arg file="src/scratchpad/src"/>
<arg file="src/scratchpad/testcases"/>
<java classname="org.apache.poi.dev.RecordGenerator" fork="yes"> <classpath>
<arg location="src/types/definitions"/> <path refid="scratchpad.classpath">
<arg location="src/types/styles"/> </path>
<arg location="src/scratchpad/src"/> <pathelement location="${main.output.dir}"/>
<arg location="src/scratchpad/testcases"/> <pathelement location="${scratchpad.output.dir}"/>
<classpath> </classpath>
<path refid="scratchpad.classpath"> </java>
</path> </target>
<pathelement location="${main.output.dir}"/>
<pathelement location="${scratchpad.output.dir}"/>
</classpath>
</java>
</target>
@ -758,60 +787,62 @@ FORREST_HOME environment variable!</echo>
</jar> </jar>
</target> </target>
<target name="dist" depends="compile,site,jar" description="Creates the entire distribution into build/dist"> <target name="dist" depends="fail-unless-tools-are-available, compile, site, jar"
description="Creates the entire distribution into build/dist">
<zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip"> <zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
<zipfileset dir="${build.site}" prefix="docs"/> <zipfileset dir="${build.site}" prefix="docs"/>
<zipfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"/> <zipfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"/>
<zipfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"/> <zipfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"/>
<zipfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"/> <zipfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"/>
<zipfileset dir="legal" prefix="legal"/> <zipfileset dir="legal" prefix="legal"/>
</zip> </zip>
<zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip"> <zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
<zipfileset dir="${build.site}" prefix="docs"/> <zipfileset dir="${build.site}" prefix="docs"/>
<zipfileset dir="."> <zipfileset dir=".">
<exclude name="build/**"/> <exclude name="build/**"/>
<exclude name="scripts/**"/> <exclude name="scripts/**"/>
<exclude name="*.ipr"/> <exclude name="*.ipr"/>
<exclude name="*.iml"/> <exclude name="*.iml"/>
<exclude name="*.iws"/> <exclude name="*.iws"/>
</zipfileset> </zipfileset>
</zip> </zip>
<tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz" compression="gzip"> <tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz"
<tarfileset dir="${build.site}" prefix="docs"/> compression="gzip">
<tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"/> <tarfileset dir="${build.site}" prefix="docs"/>
<tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"/> <tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"/>
<tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"/> <tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"/>
<tarfileset dir="legal" prefix="legal"/> <tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"/>
</tar> <tarfileset dir="legal" prefix="legal"/>
</tar>
<tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz" compression="gzip"> <tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz"
<tarfileset dir="${build.site}" prefix="docs"/> compression="gzip">
<tarfileset dir="."> <tarfileset dir="${build.site}" prefix="docs"/>
<exclude name="build/**"/> <tarfileset dir=".">
<exclude name="scripts/**"/> <exclude name="build/**"/>
<exclude name="*.ipr"/> <exclude name="scripts/**"/>
<exclude name="*.iml"/> <exclude name="*.ipr"/>
<exclude name="*.iws"/> <exclude name="*.iml"/>
</tarfileset> <exclude name="*.iws"/>
</tar> </tarfileset>
</tar>
<echo>Distribution located in build/dist</echo> <echo>Distribution located in build/dist</echo>
</target>
</target> <target name="clean-compile" depends="clean, compile"/>
<target name="clean-compile" depends="clean,compile"/> <target name="clean-dist" depends="clean, dist"
description="Cleans the build directory then creates a distribution"/>
<target name="clean-dist" depends="clean,dist" <target name="gump" depends="test, jar"/>
description="Cleans the build directory then creates a distribution"/>
<target name="gump" depends="test,jar"/>
<!-- Generates the ANT document type definition (DTD) --> <!-- Generates the Ant document type definition (DTD) -->
<target name="dtd" <target name="dtd"
description="Generates the Ant document type definition (DTD)"> description="Generates the Ant document type definition (DTD)">
<antstructure output="ant.dtd"/> <antstructure output="ant.dtd"/>
@ -819,17 +850,16 @@ FORREST_HOME environment variable!</echo>
<!-- Still experimental targets: -->
<!-- Abort the build if JUnit is missing. --> <!-- Abort the build if JUnit is missing. -->
<target name="is-available-junit" depends="init"> <target name="fail-unless-junit-is-available" depends="init">
<condition property="isAvailable.junit"> <condition property="isAvailable.junit">
<available classname="junit.framework.TestCase"/> <available classname="junit.framework.TestCase"/>
</condition> </condition>
<antcall target="check-junit"/> <antcall target="fail-junit"/>
</target> </target>
<target name="check-junit" unless="isAvailable.junit"> <target name="fail-junit" unless="isAvailable.junit">
<echo> <echo>
JUnit is not available. You must download JUnit from JUnit is not available. You must download JUnit from
&lt;http://www.junit.org/&gt; and include the JAR file in your &lt;http://www.junit.org/&gt; and include the JAR file in your
@ -838,17 +868,34 @@ FORREST_HOME environment variable!</echo>
<fail message="JUnit is not available."/> <fail message="JUnit is not available."/>
</target> </target>
<!-- Warn if JUnit is missing. -->
<target name="warn-unless-junit-is-available" depends="init">
<condition property="isAvailable.junit">
<available classname="junit.framework.TestCase"/>
</condition>
<antcall target="warn-junit"/>
</target>
<target name="warn-junit" unless="isAvailable.junit">
<echo>
WARNING: Since JUnit is not available you might encounter failures
subsequently. In order to avoid this you should download JUnit from
&lt;http://www.junit.org/&gt; and include the JAR file in your
classpath.
</echo>
</target>
<!-- Abort the build if JDepend is missing. --> <!-- Abort the build if JDepend is missing. -->
<target name="is-available-jdepend" depends="init"> <target name="fail-unless-jdepend-is-available" depends="init">
<condition property="isAvailable.jdepend"> <condition property="isAvailable.jdepend">
<available classname="jdepend.framework.JDepend"/> <available classname="jdepend.framework.JDepend"/>
</condition> </condition>
<antcall target="check-jdepend"/> <antcall target="fail-jdepend"/>
</target> </target>
<target name="check-jdepend" unless="isAvailable.jdepend"> <target name="fail-jdepend" unless="isAvailable.jdepend">
<echo> <echo>
JDepend is not available. You must download JDepend from JDepend is not available. You must download JDepend from
&lt;http://www.clarkware.com/software/JDepend.html&gt; and include the &lt;http://www.clarkware.com/software/JDepend.html&gt; and include the
@ -859,34 +906,51 @@ FORREST_HOME environment variable!</echo>
<!-- Abort the build if the Xalan XSLT processor is missing. The <!-- Abort the build if an XSLT processor is missing. -->
"junitreport" task seems to explicitly require Xalan instead of being <target name="fail-unless-xslt-is-available" depends="init">
able to cope with any XSLT processor. -->
<target name="is-available-xslt" depends="init">
<condition property="isAvailable.xslt"> <condition property="isAvailable.xslt">
<and> <available classname="javax.xml.transform.TransformerFactory"/>
<available
classname="javax.xml.transform.TransformerFactory"/>
<available
classname="org.apache.xalan.processor.TransformerFactoryImpl"/>
</and>
</condition> </condition>
<antcall target="check-xslt"/> <antcall target="fail-xslt"/>
</target> </target>
<target name="check-xslt" unless="isAvailable.xslt"> <target name="fail-xslt" unless="isAvailable.xslt">
<echo> <echo>
The Xalan XSLT processor is not available. You must download Xalan from An XSLT processor is missing. You must download e.g. Xalan from
&lt;http://xml.apache.org/xalan-j/&gt; and include the JAR file in your &lt;http://xml.apache.org/xalan-j/&gt; and include the JAR file in your
classpath. classpath.
</echo> </echo>
<fail message="The Xalan XSLT processor is not available."/> <fail message="An XSLT processor is not available."/>
</target> </target>
<!-- Warn if an XSLT processor is missing. -->
<target name="warn-unless-xslt-is-available" depends="init">
<condition property="isAvailable.xslt">
<available classname="javax.xml.transform.TransformerFactory"/>
</condition>
<antcall target="warn-xslt"/>
</target>
<target name="warn-xslt" unless="isAvailable.xslt">
<echo>
WARNING: Since an XSLT processor is not available you might encounter
failures subsequently. In order to avoid this you should download
e.g. Xalan from &lt;http://xml.apache.org/xalan-j/&gt; and include the
JAR file in your classpath.
</echo>
</target>
<!-- Aborts the build if any of the required tools are missing. -->
<target name="fail-unless-tools-are-available"
depends="fail-unless-junit-is-available, fail-unless-junit-is-available,
fail-unless-jdepend-is-available"/>
<!-- Runs jdepend to produce a report about package dependencies --> <!-- Runs jdepend to produce a report about package dependencies -->
<target name="jdepend" depends="is-available-jdepend" <target name="jdepend" depends="fail-unless-jdepend-is-available"
description="Runs jdepend to produce a report about package dependencies"> description="Runs jdepend to produce a report about package dependencies">
<jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml"> <jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
<classespath> <classespath>

View File

@ -17,12 +17,24 @@
package org.apache.poi.dev; package org.apache.poi.dev;
import org.w3c.dom.Document; import java.io.File;
import org.w3c.dom.Element; import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;
import java.util.Properties;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File; import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/** /**
* Description of the Class * Description of the Class
@ -79,11 +91,7 @@ public class RecordGenerator {
File destinationPathFile = new File(destinationPath); File destinationPathFile = new File(destinationPath);
destinationPathFile.mkdirs(); destinationPathFile.mkdirs();
String destinationFilepath = destinationPath + "/" + recordName + suffix + ".java"; String destinationFilepath = destinationPath + "/" + recordName + suffix + ".java";
String args[] = new String[]{"-in", file.getAbsolutePath(), "-xsl", recordStyleDir + "/" + extendstg.toLowerCase() + ".xsl", transform(file, new File(destinationFilepath), new File(recordStyleDir + "/" + extendstg.toLowerCase() + ".xsl"));
"-out", destinationFilepath,
"-TEXT"};
org.apache.xalan.xslt.Process.main(args);
System.out.println("Generated " + suffix + ": " + destinationFilepath); System.out.println("Generated " + suffix + ": " + destinationFilepath);
// Generate test (if not already generated) // Generate test (if not already generated)
@ -93,11 +101,7 @@ public class RecordGenerator {
destinationFilepath = destinationPath + "/Test" + recordName + suffix + ".java"; destinationFilepath = destinationPath + "/Test" + recordName + suffix + ".java";
if (new File(destinationFilepath).exists() == false) { if (new File(destinationFilepath).exists() == false) {
String temp = (recordStyleDir + "/" + extendstg.toLowerCase() + "_test.xsl"); String temp = (recordStyleDir + "/" + extendstg.toLowerCase() + "_test.xsl");
args = new String[]{"-in", file.getAbsolutePath(), "-xsl", transform(file, new File(destinationFilepath), new File(temp));
temp,
"-out", destinationFilepath,
"-TEXT"};
org.apache.xalan.xslt.Process.main(args);
System.out.println("Generated test: " + destinationFilepath); System.out.println("Generated test: " + destinationFilepath);
} else { } else {
System.out.println("Skipped test generation: " + destinationFilepath); System.out.println("Skipped test generation: " + destinationFilepath);
@ -105,4 +109,40 @@ public class RecordGenerator {
} }
} }
} }
/**
* <p>Executes an XSL transformation. This process transforms an XML input
* file into a text output file controlled by an XSLT specification.</p>
*
* @param in the XML input file
* @param out the text output file
* @param xslt the XSLT specification, i.e. an XSL style sheet
* @throws FileNotFoundException
* @throws TransformerException
*/
private static void transform(final File in, final File out, final File xslt)
throws FileNotFoundException, TransformerException
{
final Reader r = new FileReader(xslt);
final StreamSource ss = new StreamSource(r);
final TransformerFactory tf = TransformerFactory.newInstance();
final Transformer t;
try
{
t = tf.newTransformer(ss);
}
catch (TransformerException ex)
{
System.err.println("Error compiling XSL style sheet " + xslt);
throw ex;
}
final Properties p = new Properties();
p.setProperty(OutputKeys.METHOD, "text");
t.setOutputProperties(p);
final Result result = new StreamResult(out);
t.transform(new StreamSource(in), result);
}
} }

View File

@ -115,9 +115,9 @@ public class <xsl:value-of select="@name"/>Record
<xsl:text> int pos = 0; <xsl:text> int pos = 0;
</xsl:text> </xsl:text>
<xsl:variable name="fieldIterator" select="field:new()"/> <xsl:variable name="fieldIterator1" select="field:new()"/>
<xsl:for-each select="//fields/field"> <xsl:for-each select="//fields/field">
<xsl:text> </xsl:text><xsl:value-of select="field:fillDecoder2($fieldIterator,position(),@name,@size,@type)"/>; <xsl:text> </xsl:text><xsl:value-of select="field:fillDecoder2($fieldIterator1,position(),@name,@size,@type)"/>;
</xsl:for-each> </xsl:for-each>
} }
@ -137,9 +137,9 @@ public class <xsl:value-of select="@name"/>Record
LittleEndian.putShort(data, 0 + offset, sid); LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
<xsl:variable name="fieldIterator" select="field:new()"/> <xsl:variable name="fieldIterator2" select="field:new()"/>
<xsl:for-each select="//fields/field"><xsl:text> <xsl:for-each select="//fields/field"><xsl:text>
</xsl:text><xsl:value-of select="field:serialiseEncoder($fieldIterator,position(),@name,@size,@type)"/> </xsl:text><xsl:value-of select="field:serialiseEncoder($fieldIterator2,position(),@name,@size,@type)"/>
</xsl:for-each> </xsl:for-each>
return getRecordSize(); return getRecordSize();
@ -150,10 +150,10 @@ public class <xsl:value-of select="@name"/>Record
*/ */
public int getRecordSize() public int getRecordSize()
{ {
<xsl:variable name="fieldIterator" select="field:new()"/> <xsl:variable name="fieldIterator3" select="field:new()"/>
<xsl:text> return 4 </xsl:text> <xsl:text> return 4 </xsl:text>
<xsl:for-each select="//fields/field"> <xsl:for-each select="//fields/field">
<xsl:value-of select="field:calcSize($fieldIterator,position(),@name,@size,@type)"/> <xsl:value-of select="field:calcSize($fieldIterator3,position(),@name,@size,@type)"/>
</xsl:for-each>; </xsl:for-each>;
} }

View File

@ -32,12 +32,6 @@ public class FieldIterator
{ {
} }
public void init(org.apache.xalan.extensions.XSLProcessorContext context,
org.apache.xalan.templates.ElemExtensionCall extElem)
{
offset = 0;
}
/** /**
* This utility function returns a fill method entry for a given field * This utility function returns a fill method entry for a given field
* *