]> source.dussan.org Git - poi.git/commitdiff
- Improved the build process' with respect to its dependencies on JUnit, JDepend...
authorRainer Klute <klute@apache.org>
Mon, 16 May 2005 21:39:22 +0000 (21:39 +0000)
committerRainer Klute <klute@apache.org>
Mon, 16 May 2005 21:39:22 +0000 (21:39 +0000)
- 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

ant.dtd
build.xml
src/java/org/apache/poi/dev/RecordGenerator.java
src/records/styles/record.xsl
src/scratchpad/src/org/apache/poi/generator/FieldIterator.java

diff --git a/ant.dtd b/ant.dtd
index 9f3ad3cf8f9d06a19420df2e7aa7cc5076722760..fc2ddcd637496409ee0bb6d298ff8330d0fbd6c7 100644 (file)
--- a/ant.dtd
+++ b/ant.dtd
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!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">
 
 <!ELEMENT project (target | %tasks; | %types;)*>
           file 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)*>
 <!ATTLIST copy
           id ID #IMPLIED
           optional %boolean; #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)*>
 <!ATTLIST ejbc
           id ID #IMPLIED
           descriptors 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)*>
 <!ATTLIST vbc
           id ID #IMPLIED
index bdefc4f9e5fedada0cca61b2736dc7c0a9797294..30409b0521ae8097236aaade283fe51e5a3f3818 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -1,5 +1,5 @@
 <?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">
 
 <!--
     compile-contrib, compile-examples"
     description="Compiles the POI main classes, scratchpad, contrib, and examples"/>
 
-    <target name="compile-main" depends="init">
-        <copy todir="${main.output.dir}">
-            <fileset dir="${main.resource1.dir}"/>
-        </copy>
-        <javac srcdir="${main.src}" destdir="${main.output.dir}" debug="on" fork="yes" includeAntRuntime="no" failonerror="true">
-            <classpath refid="main.classpath"/>
-        </javac>
-        <javac srcdir="${main.src.test}" destdir="${main.output.test.dir}" debug="on" fork="yes" includeAntRuntime="no" failonerror="true">
-            <classpath>
-                <path refid="main.classpath"/>
-                <pathelement location="${main.output.dir}"/>
-                <pathelement location="${junit.jar1.dir}"/>
-            </classpath>
-        </javac>
-    </target>
+  <target name="compile-main" depends="fail-unless-xslt-is-available">
+    <copy todir="${main.output.dir}">
+      <fileset dir="${main.resource1.dir}"/>
+    </copy>
+    <javac srcdir="${main.src}" destdir="${main.output.dir}" debug="on"
+      fork="yes" includeAntRuntime="no" failonerror="true">
+      <classpath refid="main.classpath"/>
+    </javac>
+    <javac srcdir="${main.src.test}" destdir="${main.output.test.dir}"
+      debug="on" fork="yes" includeAntRuntime="no" failonerror="true">
+      <classpath>
+        <path refid="main.classpath"/>
+        <pathelement location="${main.output.dir}"/>
+        <pathelement location="${junit.jar1.dir}"/>
+      </classpath>
+    </javac>
+  </target>
 
-    <target name="compile-scratchpad" depends="init">
-        <javac srcdir="${scratchpad.src}" destdir="${scratchpad.output.dir}" debug="on" fork="yes" includeAntRuntime="no" failonerror="true">
-            <classpath refid="scratchpad.classpath"/>
-        </javac>
-        <javac srcdir="${scratchpad.src.test}" destdir="${scratchpad.output.test.dir}" debug="on" fork="yes" includeAntRuntime="no" failonerror="true">
-            <classpath>
-                <path refid="scratchpad.classpath"/>
-                <pathelement location="${scratchpad.output.dir}"/>
-                <pathelement location="${junit.jar1.dir}"/>
-            </classpath>
-        </javac>
-    </target>
+  <target name="compile-scratchpad" depends="init">
+    <javac srcdir="${scratchpad.src}" destdir="${scratchpad.output.dir}"
+      debug="on" fork="yes" includeAntRuntime="no" failonerror="true">
+      <classpath refid="scratchpad.classpath"/>
+    </javac>
+    <javac srcdir="${scratchpad.src.test}"
+      destdir="${scratchpad.output.test.dir}" debug="on" fork="yes"
+      includeAntRuntime="no" failonerror="true">
+      <classpath>
+        <path refid="scratchpad.classpath"/>
+        <pathelement location="${scratchpad.output.dir}"/>
+        <pathelement location="${junit.jar1.dir}"/>
+      </classpath>
+    </javac>
+  </target>
 
-    <target name="compile-contrib" depends="init">
-        <javac srcdir="${contrib.src}" destdir="${contrib.output.dir}" debug="on" fork="yes" includeAntRuntime="no" failonerror="true">
-            <classpath refid="contrib.classpath"/>
-        </javac>
-        <javac srcdir="${contrib.src.test}" destdir="${contrib.output.test.dir}" debug="on" fork="yes" includeAntRuntime="no" failonerror="true">
-            <classpath>
-                <path refid="contrib.classpath"/>
-                <pathelement location="${contrib.output.dir}"/>
-                <pathelement location="${junit.jar1.dir}"/>
-            </classpath>
-        </javac>
-    </target>
+  <target name="compile-contrib" depends="init">
+    <javac srcdir="${contrib.src}" destdir="${contrib.output.dir}"
+      debug="on" fork="yes" includeAntRuntime="no" failonerror="true">
+      <classpath refid="contrib.classpath"/>
+    </javac>
+    <javac srcdir="${contrib.src.test}"
+      destdir="${contrib.output.test.dir}" debug="on" fork="yes"
+      includeAntRuntime="no" failonerror="true">
+      <classpath>
+        <path refid="contrib.classpath"/>
+        <pathelement location="${contrib.output.dir}"/>
+        <pathelement location="${junit.jar1.dir}"/>
+      </classpath>
+    </javac>
+  </target>
 
   <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"/>
     </javac>
   </target>
 
-    <target name="test" depends="test-main,test-scratchpad,test-contrib"
-        description="Tests main, contrib and scratchpad"/>
+  <target name="test" depends="test-main,test-scratchpad,test-contrib"
+    description="Tests main, contrib and scratchpad"/>
 
     <target name="-test-main-check">
         <uptodate property="main.test.notRequired" targetfile="${main.testokfile}">
         <pathelement location="${junit.jar1.dir}"/>
     </path>
 
-    <target
-      name="test-main"
-      depends="compile-main, -test-main-check, is-available-junit"
-      unless="main.test.notRequired">
-        <junit printsummary="no" showoutput="true" fork="no"
-            haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed">
-            <classpath refid="test.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="java.awt.headless" value="true"/>
-            <formatter type="plain"/>
-            <formatter type="xml"/>
-            <batchtest todir="${main.reports.test}">
-                <fileset dir="${main.src.test}">
-                    <include name="**/Test*.java"/>
-                    <exclude name="**/AllTests.java"/>
-                       <exclude name="**/TestEmptyDocument.java"/>
-                       <exclude name="**/TestUnfixedBugs.java"/>
-                </fileset>
-            </batchtest>
-        </junit>
-        <delete file="${main.testokfile}"/>
-        <antcall target="-test-main-write-testfile"/>
-    </target>
+  <target name="test-main" unless="main.test.notRequired"
+    depends="compile-main, -test-main-check, fail-unless-junit-is-available">
+    <junit fork="no" printsummary="no" haltonfailure="${halt.on.test.failure}"
+      failureproperty="main.test.failed" showoutput="true">
+      <classpath refid="test.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="java.awt.headless" value="true"/>
+      <formatter type="plain"/>
+      <formatter type="xml"/>
+      <batchtest todir="${main.reports.test}">
+        <fileset dir="${main.src.test}">
+          <include name="**/Test*.java"/>
+          <exclude name="**/AllTests.java"/>
+          <exclude name="**/TestEmptyDocument.java"/>
+          <exclude name="**/TestUnfixedBugs.java"/>
+        </fileset>
+      </batchtest>
+    </junit>
+    <delete file="${main.testokfile}"/>
+    <antcall target="-test-main-write-testfile"/>
+  </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">
         <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>
+                 <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"/>
+                <sysproperty key="java.awt.headless" value="true"/>
             <formatter type="plain" usefile="no"/>
             <formatter type="xml"/>
             <test name="${testcase}"/>
@@ -547,7 +564,8 @@ FORREST_HOME environment variable!</echo>
 
 
   <!-- 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">
     <antcall target="cvs-rsh-warning"/>
     <cvschangelog destfile="${changelog.file}" daysinpast="30"/>
@@ -573,9 +591,9 @@ FORREST_HOME environment variable!</echo>
 
   <!-- Creates reports and API documentation -->
   <target name="reports" unless="reports.notRequired" depends="-check-reports,
-    is-available-xslt, is-available-junit, is-available-jdepend,
-    test-ignore-failures, junitreport, jdepend, cvschangelog, javadocs,
-    clover.html"
+    fail-unless-xslt-is-available, fail-unless-junit-is-available,
+    fail-unless-jdepend-is-available, test-ignore-failures, junitreport,
+    jdepend, cvschangelog, javadocs, clover.html"
     description="Creates various reports and the API documentation">
   </target>
 
@@ -591,7 +609,8 @@ FORREST_HOME environment variable!</echo>
 
 
   <!-- 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">
     <junitreport todir="${junit.report.dir}">
       <fileset dir="${main.reports.test}">
@@ -610,21 +629,18 @@ FORREST_HOME environment variable!</echo>
 
 
   <!-- 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">
-    <javadoc
-      destdir="${apidocs.report.dir}"
-      author="true"
-      version="true"
-      use="true"
-      verbose="false"
-      windowtitle="POI API Documentation">
+    <javadoc verbose="false" author="true" destdir="${apidocs.report.dir}"
+      windowtitle="POI API Documentation" use="true" version="true">
 
       <packageset dir="${main.src}" defaultexcludes="yes">
         <include name="org/apache/poi/**"/>
       </packageset>
       <packageset dir="${scratchpad.src}" defaultexcludes="yes">
         <include name="org/apache/poi/**"/>
+        <exclude name="org/apache/poi/hdf/**"/>
       </packageset>
       <packageset dir="${contrib.src}" defaultexcludes="yes">
         <include name="org/apache/poi/**"/>
@@ -633,11 +649,12 @@ FORREST_HOME environment variable!</echo>
         <include name="org/apache/poi/**"/>
       </packageset>
 
-      <classpath>
+      <classpath id="javadoc.classpath">
         <path refid="main.classpath"/>
         <path refid="scratchpad.classpath"/>
         <path refid="contrib.classpath"/>
         <path refid="examples.classpath"/>
+        <path path="${env.CLASSPATH}"/>
       </classpath>
 
       <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
         its licensors, as applicable.</i>]]>
       </bottom>
-      <group title="HDF" packages="org.apache.poi.hdf*"/>
-      <group title="HPSF" packages="org.apache.poi.hpsf*"/>
-      <group title="HSSF" packages="org.apache.poi.hssf*"/>
-      <group title="HWPF" packages="org.apache.poi.hwpf*"/>
-      <group title="POIFS" packages="org.apache.poi.poifs*"/>
-      <group title="Record Generator" packages="org.apache.poi.record*"/>
-      <group title="Utils" packages="org.apache.poi.util*"/>
+      <group>
+        <title>DDF - Dreadful Drawing Format</title>
+        <package name="org.apache.poi.ddf*"/>
+      </group>
+      <group>
+        <title>HPSF - Horrible Property Set Format</title>
+        <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>
         <title>Examples</title>
         <package name="org.apache.poi.hpsf.examples*"/>
@@ -660,53 +694,48 @@ FORREST_HOME environment variable!</echo>
     </javadoc>
 
     <antcall target="clover.html"/>
-
   </target>
 
 
 
-    <!-- ================================== -->
-    <!--       Generate records                -->
-    <!-- ================================== -->
+  <!-- ================================== -->
+  <!--       Generate records                -->
+  <!-- ================================== -->
 
-    <target name="generate-records" depends="init"
-        description="Generates HSSF records">
-        <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
-            <arg location="src/records/definitions"/>
-            <arg location="src/records/styles"/>
-            <arg location="src/java"/>
-            <arg location="src/testcases"/>
-            <classpath>
-                <path refid="scratchpad.classpath">
-                </path>
-                <pathelement location="${main.output.dir}"/>
-                <pathelement location="${scratchpad.output.dir}"/>
-            </classpath>
-        </java>
-
-    </target>
-
-    <!-- ================================== -->
-    <!--       Generate types                -->
-    <!-- ================================== -->
-
-    <target name="generate-types" depends="init"
-        description="Generates word types">
-
-        <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
-            <arg location="src/types/definitions"/>
-            <arg location="src/types/styles"/>
-            <arg location="src/scratchpad/src"/>
-            <arg location="src/scratchpad/testcases"/>
-            <classpath>
-                <path refid="scratchpad.classpath">
-                </path>
-                <pathelement location="${main.output.dir}"/>
-                <pathelement location="${scratchpad.output.dir}"/>
-            </classpath>
-        </java>
+  <target name="generate-records" depends="init"
+    description="Generates HSSF records"> 
+    <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
+      <arg file="src/records/definitions"/>
+      <arg file="src/records/styles"/>
+      <arg file="src/java"/>
+      <arg file="src/testcases"/>
+      <classpath>
+        <path refid="scratchpad.classpath"/>
+        <pathelement location="${main.output.dir}"/>
+        <pathelement location="${scratchpad.output.dir}"/>
+      </classpath>
+    </java>  
+  </target>
 
-    </target>
+  <!-- ================================== -->
+  <!--       Generate types               -->
+  <!-- ================================== -->
+
+  <target name="generate-types" depends="init"
+    description="Generates word types">
+    <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
+      <arg file="src/types/definitions"/>
+      <arg file="src/types/styles"/>
+      <arg file="src/scratchpad/src"/>
+      <arg file="src/scratchpad/testcases"/>
+      <classpath>
+        <path refid="scratchpad.classpath">
+        </path>
+        <pathelement location="${main.output.dir}"/>
+        <pathelement location="${scratchpad.output.dir}"/>
+      </classpath>
+    </java>
+  </target>
 
 
 
@@ -758,60 +787,62 @@ FORREST_HOME environment variable!</echo>
         </jar>
     </target>
 
-    <target name="dist" depends="compile,site,jar" description="Creates the entire distribution into build/dist">
-
-        <zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
-            <zipfileset dir="${build.site}" prefix="docs"/>
-            <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}-scratchpad-${version.id}-${DSTAMP}.jar"/>
-            <zipfileset dir="legal" prefix="legal"/>
-        </zip>
-
-        <zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
-            <zipfileset dir="${build.site}" prefix="docs"/>
-            <zipfileset dir=".">
-                <exclude name="build/**"/>
-                <exclude name="scripts/**"/>
-                <exclude name="*.ipr"/>
-                <exclude name="*.iml"/>
-                <exclude name="*.iws"/>
-            </zipfileset>
-        </zip>
-
-        <tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz" compression="gzip">
-            <tarfileset dir="${build.site}" prefix="docs"/>
-            <tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"/>
-            <tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"/>
-            <tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"/>
-            <tarfileset dir="legal" prefix="legal"/>
-        </tar>
-
-        <tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz" compression="gzip">
-            <tarfileset dir="${build.site}" prefix="docs"/>
-            <tarfileset dir=".">
-                <exclude name="build/**"/>
-                <exclude name="scripts/**"/>
-                <exclude name="*.ipr"/>
-                <exclude name="*.iml"/>
-                <exclude name="*.iws"/>
-            </tarfileset>
-        </tar>
-
-        <echo>Distribution located in build/dist</echo>
-
-    </target>
+  <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">
+      <zipfileset dir="${build.site}" prefix="docs"/>
+      <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}-scratchpad-${version.id}-${DSTAMP}.jar"/>
+      <zipfileset dir="legal" prefix="legal"/>
+    </zip>
+
+    <zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
+      <zipfileset dir="${build.site}" prefix="docs"/>
+      <zipfileset dir=".">
+        <exclude name="build/**"/>
+        <exclude name="scripts/**"/>
+        <exclude name="*.ipr"/>
+        <exclude name="*.iml"/>
+        <exclude name="*.iws"/>
+      </zipfileset>
+    </zip>
+
+    <tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz"
+      compression="gzip">
+      <tarfileset dir="${build.site}" prefix="docs"/>
+      <tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"/>
+      <tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"/>
+      <tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"/>
+      <tarfileset dir="legal" prefix="legal"/>
+    </tar>
+
+    <tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz"
+      compression="gzip">
+      <tarfileset dir="${build.site}" prefix="docs"/>
+      <tarfileset dir=".">
+        <exclude name="build/**"/>
+        <exclude name="scripts/**"/>
+        <exclude name="*.ipr"/>
+        <exclude name="*.iml"/>
+        <exclude name="*.iws"/>
+      </tarfileset>
+    </tar>
+
+    <echo>Distribution located in build/dist</echo>
+  </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"
+    description="Cleans the build directory then creates a distribution"/>
 
-    <target name="gump" depends="test,jar"/>
+  <target name="gump" depends="test, jar"/>
 
 
 
-  <!-- Generates the ANT document type definition (DTD) -->
+  <!-- Generates the Ant document type definition (DTD) -->
   <target name="dtd"
     description="Generates the Ant document type definition (DTD)">
     <antstructure output="ant.dtd"/>
@@ -819,17 +850,16 @@ FORREST_HOME environment variable!</echo>
 
 
 
-  <!-- Still experimental targets: -->
 
   <!-- 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">
       <available classname="junit.framework.TestCase"/>
     </condition>
-    <antcall target="check-junit"/>
+    <antcall target="fail-junit"/>
   </target>
 
-  <target name="check-junit" unless="isAvailable.junit">
+  <target name="fail-junit" unless="isAvailable.junit">
     <echo>
       JUnit is not available. You must download JUnit from
       &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."/>
   </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. -->
-  <target name="is-available-jdepend" depends="init">
+  <target name="fail-unless-jdepend-is-available" depends="init">
     <condition property="isAvailable.jdepend">
       <available classname="jdepend.framework.JDepend"/>
     </condition>
-    <antcall target="check-jdepend"/>
+    <antcall target="fail-jdepend"/>
   </target>
 
-  <target name="check-jdepend" unless="isAvailable.jdepend">
+  <target name="fail-jdepend" unless="isAvailable.jdepend">
     <echo>
       JDepend is not available. You must download JDepend from
       &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
-       "junitreport" task seems to explicitly require Xalan instead of being
-       able to cope with any XSLT processor. -->
-  <target name="is-available-xslt" depends="init">
+  <!-- Abort the build if an XSLT processor is missing. -->
+  <target name="fail-unless-xslt-is-available" depends="init">
     <condition property="isAvailable.xslt">
-      <and>
-        <available
-          classname="javax.xml.transform.TransformerFactory"/>
-        <available
-          classname="org.apache.xalan.processor.TransformerFactoryImpl"/> 
-      </and>
+      <available classname="javax.xml.transform.TransformerFactory"/>
     </condition>
-    <antcall target="check-xslt"/>
+    <antcall target="fail-xslt"/>
   </target>
 
-  <target name="check-xslt" unless="isAvailable.xslt">
+  <target name="fail-xslt" unless="isAvailable.xslt">
     <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
       classpath.
     </echo> 
-    <fail message="The Xalan XSLT processor is not available."/>
+    <fail message="An XSLT processor is not available."/>
+  </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 -->
-  <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">
     <jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
       <classespath>
index 345f609e57a105cd86d0db69e2fd4d5bc231f717..870183a7a7c8284edaff375825c5a7ac5d89648c 100644 (file)
         
 package org.apache.poi.dev;
 
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
+import java.io.File;
+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.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
@@ -79,11 +91,7 @@ public class RecordGenerator {
                 File destinationPathFile = new File(destinationPath);
                 destinationPathFile.mkdirs();
                 String destinationFilepath = destinationPath + "/" + recordName + suffix + ".java";
-                String args[] = new String[]{"-in", file.getAbsolutePath(), "-xsl", recordStyleDir + "/" + extendstg.toLowerCase() + ".xsl",
-                        "-out", destinationFilepath,
-                        "-TEXT"};
-
-                org.apache.xalan.xslt.Process.main(args);
+                transform(file, new File(destinationFilepath), new File(recordStyleDir + "/" + extendstg.toLowerCase() + ".xsl"));
                 System.out.println("Generated " + suffix + ": " + destinationFilepath);
 
                 // Generate test (if not already generated)
@@ -93,11 +101,7 @@ public class RecordGenerator {
                 destinationFilepath = destinationPath + "/Test" + recordName + suffix + ".java";
                 if (new File(destinationFilepath).exists() == false) {
                     String temp = (recordStyleDir + "/" + extendstg.toLowerCase() + "_test.xsl");
-                    args = new String[]{"-in", file.getAbsolutePath(), "-xsl",
-                            temp,
-                            "-out", destinationFilepath,
-                            "-TEXT"};
-                    org.apache.xalan.xslt.Process.main(args);
+                    transform(file, new File(destinationFilepath), new File(temp));
                     System.out.println("Generated test: " + destinationFilepath);
                 } else {
                     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);        
+    }
+
 }
index da9f851f35e88e084978fa05a8ab8e2e450b2d4a..e9615d7fda8e8261eab72d671d0fa50920eb312e 100644 (file)
@@ -115,9 +115,9 @@ public class <xsl:value-of select="@name"/>Record
 <xsl:text>        int pos = 0;
 </xsl:text>
 
- <xsl:variable name="fieldIterator" select="field:new()"/>
+ <xsl:variable name="fieldIterator1" select="field:new()"/>
 <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>
     }
 
@@ -137,9 +137,9 @@ public class <xsl:value-of select="@name"/>Record
 
         LittleEndian.putShort(data, 0 + offset, sid);
         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: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>
 
         return getRecordSize();
@@ -150,10 +150,10 @@ public class <xsl:value-of select="@name"/>Record
      */
     public int getRecordSize()
     {
-<xsl:variable name="fieldIterator" select="field:new()"/>
+<xsl:variable name="fieldIterator3" select="field:new()"/>
 <xsl:text>        return 4 </xsl:text>
 <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>;
     }
 
index 927e8d477227cdb17158f228099dd00fd00a9ffd..a7a97b59cafbaec7c15bf832c71e5aa043124fc8 100644 (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
      *