klute       2004/12/31 05:26:32

  Modified:    .        build.xml
  Log:
  - Before running the "test" or "reports" target Ant now checks whether JUnit 
and JDepend are available, i.e. included in the classpath.
  - Started to modularize the "reports" target into independend subtargets in 
order to make it possible to run "ant jdepend", "ant javadocs" etc. 
individually.
  - Fixed the "jdepend" task so that it runs with JDepend 3.9.
  
  Revision  Changes    Path
  1.60      +143 -92   jakarta-poi/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/build.xml,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- build.xml 23 Aug 2004 08:52:54 -0000      1.59
  +++ build.xml 31 Dec 2004 13:26:31 -0000      1.60
  @@ -7,10 +7,14 @@
   
           Glen Stampoultzis   glens at apache.org
   
  +    Modified by:
   
  -    This build was tested with ant 1.5.3 although it will probably work with
  -    other versions.  The following jar files should be installed
  -    into the ant lib directory:
  +        Rainer Klute        [EMAIL PROTECTED]
  +
  +
  +    This build was tested with ant 1.6.2 although it will probably work with
  +    other versions.  The following jar files should be available on the -->
  +    classpath when running ant:
   
       LIBRARY         LOCATION
       =======         ========
  @@ -130,7 +134,7 @@
    debug-test        Runs a single test case specified with 
                      -Dtestcase=classname with remote debug 
                      options turned on.
  - reports           Creates junit,jdepend and javadoc reports
  + reports           Creates junit, jdepend and javadoc reports
    site              Generates the documentation and reports
    dist              Creates the entire distribution into build/dist
    clean-dist        Cleans the build directory then creates a 
  @@ -213,9 +217,7 @@
       </target>
   
       <target name="compile" 
depends="init,compile-main,compile-scratchpad,compile-contrib"
  -        description="Compiles the POI classes">
  -
  -    </target>
  +        description="Compiles the POI classes"/>
   
       <target name="compile-main" depends="init">
           <copy todir="${main.output.dir}">
  @@ -275,7 +277,11 @@
           <pathelement location="${main.output.test.dir}"/>
           <pathelement location="${junit.jar1.dir}"/>
       </path>
  -    <target name="test-main" depends="compile-main,-test-main-check" 
unless="main.test.notRequired">
  +
  +    <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"/>
  @@ -430,14 +436,17 @@
           <copy todir="${build.site.src}/src/documentation/content/apidocs">
               <fileset dir="${apidocs.report.dir}"/>
           </copy>
  -        <copy 
tofile="${build.site.src}/src/documentation/content/jdepend.ehtml" 
file="${jdepend.report.dir}/index.html" failonerror="false"/>
  +        <copy
  +          tofile="${build.site.src}/src/documentation/content/jdepend.ehtml"
  +          file="${jdepend.report.dir}/index.html" failonerror="false"/>
           <mkdir dir="${build.site.src}/src/documentation/content/junit"/>
           <copy todir="${build.site.src}/src/documentation/content/junit">
               <fileset dir="${junit.report.dir}"/>
           </copy>
   
  -        <move 
file="${build.site.src}/src/documentation/content/xdocs/status.xml" 
tofile="${build.site.src}/status.xml"/>
  -
  +        <move
  +          file="${build.site.src}/src/documentation/content/xdocs/status.xml"
  +          tofile="${build.site.src}/status.xml"/>
   
           <ant antfile="${forrest.home}/forrest.antproxy.xml" target="site">
               <property name="project.home" location="${build.site.src}"/>
  @@ -474,88 +483,43 @@
           </style>
       </target>
   
  -    <target name="reports" depends="-check-reports" 
unless="reports.notRequired"
  -        description="Creates junit,jdepend and javadoc reports">
  -        <antcall target="test">
  -            <param name="halt.on.test.failure" value="false"/>
  -        </antcall>
  -        <junitreport todir="${junit.report.dir}">
  -            <fileset dir="${main.reports.test}">
  -                <include name="TEST-*.xml"/>
  -            </fileset>
  -            <fileset dir="${scratchpad.reports.test}">
  -                <include name="TEST-*.xml"/>
  -            </fileset>
  -            <fileset dir="${contrib.reports.test}">
  -                <include name="TEST-*.xml"/>
  -            </fileset>
  -            <report format="frames" todir="${junit.report.dir}"/>
  -        </junitreport>
  -
  -        <jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
  -            <sourcespath>
  -                <pathelement location="${main.src}"/>
  -                <pathelement location="${contrib.src}"/>
  -                <pathelement location="${scratchpad.src}"/>
  -            </sourcespath>
  -            <classpath>
  -                <path refid="main.classpath"/>
  -                <path refid="contrib.classpath"/>
  -                <path refid="scratchpad.classpath"/>
  -                <pathelement location="${main.output.dir}"/>
  -                <pathelement location="${contrib.output.dir}"/>
  -                <pathelement location="${scratchpad.output.dir}"/>
  -            </classpath>
  -        </jdepend>
  +  <!-- FIXME: This target has to be split into several targets so that each
  +       of them can be executed individually. -->
  +  <target name="reports"
  +    depends="-check-reports, is-available-junit, is-available-jdepend"
  +    unless="reports.notRequired"
  +    description="Creates JUnit and JDepend reports and generates the API 
documentation">
  +
  +    <antcall target="test">
  +      <param name="halt.on.test.failure" value="false"/>
  +    </antcall>
  +
  +    <junitreport todir="${junit.report.dir}">
  +      <fileset dir="${main.reports.test}">
  +        <include name="TEST-*.xml"/>
  +      </fileset>
  +      <fileset dir="${scratchpad.reports.test}">
  +        <include name="TEST-*.xml"/>
  +      </fileset>
  +      <fileset dir="${contrib.reports.test}">
  +        <include name="TEST-*.xml"/>
  +      </fileset>
  +      <report format="frames" todir="${junit.report.dir}"/>
  +    </junitreport>
   
  -        <style basedir="${jdepend.report.dir}"
  -            in="${jdepend.report.dir}/jdepend.xml"
  -            out="${jdepend.report.out.dir}/index.html"
  -            style="jdepend.xsl"/>
  -
  -        <antcall target="-cvschangelog"/>
  -
  -        <javadoc
  -            destdir="${apidocs.report.dir}"
  -            author="true"
  -            version="true"
  -            use="true"
  -            verbose="false"
  -            windowtitle="POI API">
  -
  -            <packageset dir="${main.src}" defaultexcludes="yes">
  -                <include name="org/apache/poi/**"/>
  -            </packageset>
  -            <packageset dir="${scratchpad.src}" defaultexcludes="yes">
  -                <include name="org/apache/poi/**"/>
  -            </packageset>
  -            <packageset dir="${contrib.src}" defaultexcludes="yes">
  -                <include name="org/apache/poi/**"/>
  -            </packageset>
  +    <antcall target="jdepend"/>
   
  -            <classpath>
  -                <path refid="main.classpath"/>
  -                <path refid="scratchpad.classpath"/>
  -                <path refid="contrib.classpath"/>
  -            </classpath>
  +    <antcall target="-cvschangelog"/>
   
  -            <doctitle><![CDATA[<h1>POI Documentation</h1>]]></doctitle>
  -            <bottom><![CDATA[<i>Copyright &#169; 2003 Apache Software 
Foundation.</i>]]></bottom>
  -            <group title="HSSF" packages="org.apache.poi.hssf*"/>
  -            <group title="HPSF" packages="org.apache.poi.hpsf*"/>
  -            <group title="POIFS" packages="org.apache.poi.poifs*"/>
  -            <group title="HDF" packages="org.apache.poi.hdf*"/>
  -            <group title="Record Generator" 
packages="org.apache.poi.record*"/>
  -            <group title="Utils" packages="org.apache.poi.util*"/>
  -        </javadoc>
  +    <antcall target="javadocs"/>
   
  -        <antcall target="clover.html"/>
  +    <antcall target="clover.html"/>
   
  -    </target>
  +  </target>
   
   
   
  -  <target name="javadocs" description="Generate javadocs">
  +  <target name="javadocs" description="Generates the API documentation">
       <javadoc
         destdir="${apidocs.report.dir}"
         author="true"
  @@ -565,19 +529,19 @@
         windowtitle="POI API">
   
         <packageset dir="${main.src}" defaultexcludes="yes">
  -     <include name="org/apache/poi/**"/>
  +        <include name="org/apache/poi/**"/>
         </packageset>
         <packageset dir="${scratchpad.src}" defaultexcludes="yes">
  -     <include name="org/apache/poi/**"/>
  +        <include name="org/apache/poi/**"/>
         </packageset>
         <packageset dir="${contrib.src}" defaultexcludes="yes">
  -     <include name="org/apache/poi/**"/>
  +        <include name="org/apache/poi/**"/>
         </packageset>
   
         <classpath>
  -     <path refid="main.classpath"/>
  -     <path refid="scratchpad.classpath"/>
  -     <path refid="contrib.classpath"/>
  +        <path refid="main.classpath"/>
  +        <path refid="scratchpad.classpath"/>
  +        <path refid="contrib.classpath"/>
         </classpath>
   
         <doctitle><![CDATA[<h1>POI Documentation</h1>]]></doctitle>
  @@ -730,8 +694,95 @@
   
       <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"/>
   
  +
  +
  +  <!-- Generates the ANT document type definition (DTD) -->
  +  <target name="dtd"
  +    description="Generates the ANT document type definition (DTD)">
  +    <antstructure output="ant.dtd"/>
  +  </target>
  +
  +
  +
  +  <!-- Still experimental targets: -->
  +
  +  <target name="is-available-junit" depends="init">
  +    <condition property="isAvailable.junit">
  +      <available classname="junit.framework.TestCase"/>
  +    </condition>
  +    <antcall target="check-junit"/>
  +  </target>
  +
  +  <!-- Abort the build because JUnit is missing. -->
  +  <target name="check-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
  +      classpath."
  +    </echo> 
  +    <fail message="JUnit is not available." unless="available.junit"/>
  +  </target>
  +
  +  <target name="is-available-jdepend" depends="init">
  +    <condition property="isAvailable.jdepend">
  +      <available classname="jdepend.framework.JDepend"/>
  +    </condition>
  +    <antcall target="check-jdepend"/>
  +  </target>
  +
  +  <!-- Abort the build because JDepend is missing. -->
  +  <target name="check-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
  +      JAR file in your classpath."
  +    </echo> 
  +    <fail message="JDepend is not available." unless="available.jdepend"/>
  +  </target>
  +
  +  <!-- FIXME: Make target "reports" depend on this! -->
  +  <target name="jdepend" depends="is-available-jdepend"
  +    description="Runs jdepend to produce a report about package 
dependencies">
  +    <jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
  +      <classespath>
  +        <pathelement location="${main.output.dir}"/>
  +        <pathelement location="${contrib.output.dir}"/>
  +        <pathelement location="${scratchpad.output.dir}"/>
  +      </classespath>
  +      <classpath>
  +        <path refid="main.classpath"/>
  +        <path refid="contrib.classpath"/>
  +        <path refid="scratchpad.classpath"/>
  +      </classpath>
  +    </jdepend>
  +
  +    <style basedir="${jdepend.report.dir}"
  +      in="${jdepend.report.dir}/jdepend.xml"
  +      out="${jdepend.report.out.dir}/index.html"
  +      style="jdepend.xsl"/>
  +  </target>
  +
   </project>
  +
  +<!-- Keep this comment at the end of the file
  +Local variables:
  +mode: xml
  +sgml-omittag:nil
  +sgml-shorttag:nil
  +sgml-namecase-general:nil
  +sgml-general-insert-case:lower
  +sgml-minimize-attributes:nil
  +sgml-always-quote-attributes:t
  +sgml-indent-step:2
  +sgml-indent-data:t
  +sgml-parent-document:nil
  +sgml-exposed-tags:nil
  +sgml-local-catalogs:nil
  +sgml-local-ecat-files:nil
  +End:
  +-->
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to