hlship      2004/10/28 15:09:53

  Modified:    .        build.xml
               hivebuild project.xml jar-module.xml jar-module.properties
  Added:       hivebuild war-module.xml module.xml war-module.properties
                        module.properties
  Log:
  Provide support for building both WAR and JAR modules.
  
  Revision  Changes    Path
  1.11      +0 -6      jakarta-hivemind/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/build.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- build.xml 21 Oct 2004 14:57:19 -0000      1.10
  +++ build.xml 28 Oct 2004 22:09:53 -0000      1.11
  @@ -48,10 +48,4 @@
           output-dir="${project.docs.target.dir}/hivedocs"/>
        </target>
        
  -     <target name="fast-site" depends="copy-documentation-to-composite"
  -             description="Generate site documentation from XDocs only, 
omitting reports.">
  -             <reinvoke-ant target="copy-documentation-to-composite"/>
  -             <antcall target="run-forrest"/>
  -     </target>
  -     
   </project>
  
  
  
  1.7       +10 -0     jakarta-hivemind/hivebuild/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/hivebuild/project.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- project.xml       23 Oct 2004 14:17:56 -0000      1.6
  +++ project.xml       28 Oct 2004 22:09:53 -0000      1.7
  @@ -75,4 +75,14 @@
                        <antcall target="run-forrest"/>
                </target>
                
  +     <target name="fast-site" depends="copy-documentation-to-composite"
  +             description="Generate site documentation from XDocs only, 
omitting reports.">
  +    
  +    <!-- This should only be used after running the full site target to 
generate reports. It is used when
  +         "tweaking" the .xdoc files. -->
  +         
  +             <reinvoke-ant target="copy-documentation-to-composite"/>
  +             <antcall target="run-forrest"/>
  +     </target>  
  +      
   </project>
  
  
  
  1.16      +6 -260    jakarta-hivemind/hivebuild/jar-module.xml
  
  Index: jar-module.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/hivebuild/jar-module.xml,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- jar-module.xml    23 Oct 2004 14:17:56 -0000      1.15
  +++ jar-module.xml    28 Oct 2004 22:09:53 -0000      1.16
  @@ -16,236 +16,18 @@
   -->
   <project name="jar-module">
   
  -     <!-- 
  -             Imports are computed relative the this file (to the build.xml
  -             that imported this file). -->
  -     
  -     <import file="hivebuild.xml"/>
  -     <import file="dependency.xml"/>
  -     <import file="forrestdoc.xml"/>
  +     <import file="module.xml"/>
     <property file="${hivebuild.dir}/jar-module.properties"/>
  -             
  -     <property name="forrest.report-menu.file" 
value="${project.forrest.xdocs.dir}/${module.name}/report-menu.ent"/>
  -             
  -     <!-- The default classpath for compilation is all external package 
JARs. -->
  -     
  +  
        <path id="default.compile.classpath">
                        <fileset dir="${module.lib.dir}/compile" 
includes="**/*.jar"/>
        </path>
  -     
  -     <path id="default.test-compile.classpath">
  -             <path refid="default.compile.classpath"/>
  -             <path location="${java.classes.dir}"/>
  -             <fileset dir="${module.lib.dir}" includes="test/**/*.jar"/>
  -     </path>
  -     
  -     <path id="default.test.classpath">
  -             <path refid="default.test-compile.classpath"/>
  -             <pathelement location="${test.classes.dir}"/>
  -    <fileset dir="${module.lib.dir}" includes="run/**/*.jar"/>
  -             
  -             <!-- To pick up any classpath resources. -->
  -             
  -             <path location="${test.src.dir}"/>
  -             
  -             <!-- To pick up log4j.properties or other runtime resources. -->
  -             <pathelement location="${conf.src.dir}"/>       
  -             
  -             <!-- This is pretty specific to HiveMind, but eventually
  -                              everything will be a HiveMind module. Pick up
  -                              the module deployment descriptor. -->
  -                              
  -             <pathelement location="${descriptor.src.dir}"/> 
       
  -    <!-- Pick up the JUnit and XML runtime provided with Ant. -->
  -    
  -    <fileset dir="${ant.home}/lib">
  -      <include name="junit-${module.junit.version}.jar"/>
  -      <include name="xml-apis.jar"/>
  -      <include name="xercesImpl.jar"/>
  -    </fileset>
  -     </path>
  -     
  -     <path id="default.source.path">
  -             <pathelement location="${java.src.dir}"/>
  -             <pathelement location="${generated-java.src.dir}"/>     
  -     </path>
  -     
  -     <macrodef name="copy-source-resources">
  -             <attribute name="classes-dir" default="${java.classes.dir}" 
description="Directory to copy resources to."/>
  -             
  -             <sequential>
  -             
  -                     <announce message="Copying resources to @{classes-dir} 
..."/>
  -                     
  -                     <copy todir="@{classes-dir}" includeEmptyDirs="false">
  -                             <fileset dir="${java.src.dir}">
  -                                     <exclude name="**/*.java"/>     
  -                                     <exclude name="**/package.html"/>
  -                             </fileset>
  -                     </copy>
  -                     
  -             </sequential>
  -             
  -     </macrodef>
  -     
  -     <macrodef name="default-compile">
  -             <attribute name="compile-classpath-id" 
  -                             default="default.compile.classpath"
  -                             description="Reference to a path defining 
compile-time libraries."/>
  -             <attribute name="sourcepath-id"
  -                     default="default.source.path"
  -                     description="Referencce to a path of source directories 
to compile."/>
  -             <attribute name="classes-dir"
  -                             default="${java.classes.dir}"
  -                             description="Directory to compile classes 
into."/>
  -             
  -             <sequential>
  -                     
  -                     <antcall target="-compile-init"/>
  -                     <mkdir dir="@{classes-dir}"/>
  -                     
  -                     <!-- Make the directory, before it is referenced via 
default.compile.classpath.
  -                                The javacc.xml module actually puts files 
into generated Java.  Perhaps
  -                                in the future, an XDoclet extension will 
make use of this as well. -->
  -                     
  -                     <announce message="Compiling Java sources to 
@{classes-dir} ..."/>
  -                     
  -                     <javac
  -                             destdir="@{classes-dir}"
  -                             classpathref="@{compile-classpath-id}"
  -        debug="${module.javac.debug}"
  -        debuglevel="${module.javac.debuglevel}"
  -        optimize="${module.javac.optimize}"
  -        deprecation="${module.javac.deprecation}"
  -        target="${module.javac.target}"
  -        verbose="${module.javac.verbose}"
  -        source="${module.javac.source}"
  -        listfiles="${module.javac.listfiles}"
  -        >
  -                             <src>
  -                                     <path refid="@{sourcepath-id}"/>
  -                             </src>  
  -                     </javac>
  -                             
  -                     <copy-source-resources classes-dir="@{classes-dir}"/>   
                        
  -             </sequential>   
  -     </macrodef>
  -     
  -     <macrodef name="default-compile-tests">
  -             <attribute name="compile-classpath-id"
  -                     default="default.test-compile.classpath"
  -                     description="Reference to a path used to compile unit 
tests."/>
  -    <sequential>
  -      
  -      <ibiblio-dependency artifact="junit" version="3.8.1" group="junit" 
use="${module.junit.use}"/>
  -      
  -      <mkdir dir="${test.classes.dir}"/>
  -      
  -      <announce message="Compiling tests to ${test.classes.dir} ..."/>
  -      
  -      <javac destdir="${test.classes.dir}" 
  -        classpathref="@{compile-classpath-id}"
  -        srcdir="${test.src.dir}" 
  -        debug="${module.javac-test.debug}" 
  -        debuglevel="${module.javac-test.debuglevel}" 
  -        optimize="${module.javac-test.optimize}" 
  -        deprecation="${module.javac-test.deprecation}" 
  -        target="${module.javac-test.target}" 
  -        verbose="${module.javac-test.verbose}" 
  -        source="${module.javac-test.source}" 
  -        listfiles="${module.javac-test.listfiles}" />
  -    </sequential>
  -     </macrodef>
  -     
  -  <available property="junit-available" 
file="${ant.home}/lib/${module.junit.jar}"/>
  -  
  -  <target name="-install-junit" unless="junit-available">
  -      <copy file="${external.lib.dir}/${module.junit.jar}"
  -            todir="${ant.home}/lib"/>
  -             
  -      <announce message="${module.junit.jar} has been installed to 
${ant.home}/lib."/>
  -      <announce message="You must restart the build to continue."/>
  -      
  -      <fail message="You must restart the build to continue."/>            
  -  </target>
  -  
  -     <macrodef name="default-run-tests">
  -             <attribute name="classpath-id" default="default.test.classpath"
  -                     description="Reference to path used for tests."/>
  -             <attribute name="fork" default="${module.junit.fork}" 
description="Run the tests in a seperate JVM if on."/>
  -             <element name="junit-elements" optional="true" 
description="Additional elements placed within the junit task."/>
  -             
  -             <sequential>
  -   
  -      <antcall target="-install-junit"/>
  -      
  -                     <mkdir dir="${junit.temp.dir}"/>
  -                     <mkdir dir="${junit.report.dir}"/>
  -
  -                     <announce message="Running unit tests ..."/>
  -
  -                     <junit 
  -                             fork="@{fork}"
  -        forkmode="${module.junit.forkmode}"
  -                             haltonfailure="off"
  -                             failureproperty="junit-failure"
  -                             tempdir="${junit.temp.dir}">
  -                                     
  -                                     <classpath refid="@{classpath-id}"/>
  -          
  -          <sysproperty key="PROJECT_ROOT" value="${project.dir}"/>   
  -          
  -          <jvmarg line="${module.junit.jvmarg}"/>
  -                                     
  -                                     <formatter type="xml"/>
  -          <formatter type="brief" usefile="false"/>
  -          <formatter type="plain"/>
  -                                             
  -                                     <batchtest todir="${junit.report.dir}">
  -                                             <fileset 
dir="${test.classes.dir}">
  -                                                     <!-- Inner classes 
cause problems! -->
  -                                                     <exclude 
name="**/*$*.class"/>
  -                                                     <include 
name="**/Test*.class"/>        
  -                                             </fileset>      
  -                                     </batchtest>    
  -                                     
  -                                     <junit-elements/>                       
                
  -                     </junit>
  -                     
  -                     <fail if="junit-failure" message="Some tests failed."/>
  -                     
  -             </sequential>   
  -     </macrodef>
  -     
  -     <target name="compile-dependencies" description="Overriden to download 
dependencies as external package.">
  -             <!-- Does nothing. This is often overriden, and becomes a 
series of
  -                        calls to macros defined in dependency.xml. -->
  -     </target>
  -      
  -     <target name="-compile-init">
  -             <mkdir dir="${generated-java.src.dir}"/>                        
        
  -     </target>
  -     
  -     <!-- Usually overriden so that the options used when compiling, 
especially compile-classpath-id, can be overriden. -->
  -     
  -     <target name="compile" description="Compile Java source code." 
depends="compile-dependencies">
  -             <default-compile/>
  -     </target>
  -     
  -     <target name="compile-tests" description="Compiles JUnit tests." 
depends="compile">
  -             <default-compile-tests/>
  -     </target>
  -     
  -     <target name="run-tests" description="Runs JUnit tests." 
depends="compile-tests">
  -             <default-run-tests/>    
  -     </target>
  -     
        <target name="jar" depends="run-tests" description="Compile classes and 
package into a JAR.">
                
                <fail unless="module.name" message="Property module.name must 
be set."/>
                
  -             <property name="complete-jar-path" 
value="${module.install.dir}/${module.name}-${project.version}.jar"/>
  +             <property name="complete-jar-path" 
value="${module.install.dir}/${module.jar.file}"/>
                
                <mkdir dir="${module.install.dir}"/>
                
  @@ -261,45 +43,9 @@
            same ext-package directory. -->
       <copy file="${complete-jar-path}" todir="${external.lib.dir}"/>
                
  -     </target>
  -     
  -     <macrodef name="default-javadoc">
  -             <attribute name="sourcepath-id" default="default.source.path" 
description="Reference to source path."/>
  -             <attribute name="classpath-id" 
default="default.compile.classpath"/>
  -             
  -             <sequential>
  -                     <fail unless="javadoc.package" message="You must 
specify property javadoc.packages."/>
  -                     
  -                     <mkdir dir="${javadoc.target.dir}"/>
  -                     
  -                     <announce message="Generating Javadoc ..."/>
  -     
  -                     <javadoc
  -                             destdir="${javadoc.target.dir}"
  -                             classpathref="@{classpath-id}"
  -                             version="yes"
  -                             use="yes"
  -                             splitindex="yes"
  -                             windowtitle="${module.name} - 
${project.version} API">
  -                             <package name="${javadoc.package}"/>
  -                             <sourcepath>
  -                                     <pathelement 
location="${java.src.dir}"/>
  -                                     <pathelement 
location="${generated-java.src.dir}"/>     
  -                             </sourcepath>
  -                     </javadoc>
  -             </sequential>   
  -     </macrodef>
  -     
  -     <target name="javadoc" depends="-compile-init" description="Create 
JavaDoc from Java source files.">
  -             <default-javadoc/>      
  -     </target>
  -     
  +     </target>  
  +
        <target name="install" depends="jar" 
                description="Synonym for 'jar' invoked by the containing 
project."/>
  -                     
  -  <target name="clean-code"
  -    description="Cleans compiled Java code.">
  -    <delete dir="${java.classes.dir}" quiet="true"/>
  -    <delete dir="${test.classes.dir}" quiet="true"/>
  -  </target>      
  +      
   </project>
  
  
  
  1.7       +3 -45     jakarta-hivemind/hivebuild/jar-module.properties
  
  Index: jar-module.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/hivebuild/jar-module.properties,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- jar-module.properties     23 Oct 2004 14:17:56 -0000      1.6
  +++ jar-module.properties     28 Oct 2004 22:09:53 -0000      1.7
  @@ -13,49 +13,7 @@
   # See the License for the specific language governing permissions and
   # limitations under the License.
   
  -# Contains properties specific to jar-modules.  Many properties in 
hivebuild.properties
  -# should move here.
  +# Default name for the jar file. Can be overriden if the name doesn't match
  +# the module name, or if the project version should not be appended.
   
  -# The following several properties define arguments passed to the javac task 
when compiling
  -# target code.
  -
  -module.javac.debug=on
  -module.javac.debuglevel=lines,vars,source
  -module.javac.optimize=off
  -module.javac.deprecation=on
  -module.javac.target=1.1
  -module.javac.verbose=off
  -module.javac.source=1.3
  -module.javac.listfiles=off
  -
  -# Each of the above has a corresponding javac-test that defaults to the same 
value.
  -
  -module.javac-test.debug=${module.javac.test}
  -module.javac-test.debug=${module.javac.debug}
  -module.javac-test.debuglevel=${module.javac.debuglevel}
  -module.javac-test.optimize=${module.javac.optimize}
  -module.javac-test.deprecation=${module.javac.deprecation}
  -module.javac-test.target=${module.javac.target}
  -module.javac-test.verbose=${module.javac.verbose}
  -module.javac-test.source=${module.javac.source}
  -module.javac-test.listfiles=${module.javac.listfiles}
  -
  -# Directorty into which the module's jar should be installed.
  -
  -module.install.dir=${project.target.dir}
  -
  -# Defaults for running unit tests.
  -
  -module.junit.version=3.8.1
  -module.junit.fork=on
  -module.junit.forkmode=once
  -
  -# Used to specify the maximum heap size.
  -module.junit.jvmarg=-Xmx384m
  -module.junit.includeantruntime=on
  -module.junit.jar=junit-${module.junit.version}.jar
  -
  -# Override this to compile if java sources uses JUnit classes.
  -module.junit.use=test
  -
  -forrest.report.folder=${module.name}/
  \ No newline at end of file
  +module.jar.file=${module.name}-${project.version}.jar
  \ No newline at end of file
  
  
  
  1.1                  jakarta-hivemind/hivebuild/war-module.xml
  
  Index: war-module.xml
  ===================================================================
  <?xml version="1.0"?>
  <!-- 
     Copyright 2004 The Apache Software Foundation
  
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
  
         http://www.apache.org/licenses/LICENSE-2.0
  
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
  -->
  <project name="jar-module">
  
        <import file="module.xml"/>
    <property file="${hivebuild.dir}/war-module.properties"/>
  
        <path id="default.compile.classpath">
                        <fileset dir="${module.lib.dir}/compile" 
includes="**/*.jar"/>
        <!-- Runtime modules will be used at compile time and will be packaged 
into WEB-INF/lib -->
        <fileset dir="${module.lib.dir}/run" includes="**/*.jar"/>
        </path>
    
    <target name="war" depends="run-tests" description="Compile classes and 
package into a WAR.">
      
      <fail unless="module.name" message="Property module.name must be set."/>
      
      <mkdir dir="${war.lib.dir}"/>
      <copy todir="${war.lib.dir}" flatten="true">
        <fileset dir="${module.lib.dir}/run" includes="**/*.jar"/>
      </copy>
      
                <property name="complete-war-path" 
value="${module.install.dir}/${module.war.file}"/>
                
                <mkdir dir="${module.install.dir}"/>
                
                <announce message="Packaging as ${complete-war-path} ..."/>
  
                <war
                                destfile="${complete-war-path}"
          webxml="${context.src.dir}/WEB-INF/web.xml">
          
          <fileset dir="${context.src.dir}">
            <exclude name="WEB-INF/web.xml"/>
          </fileset>
          <!-- Causes an error if the descriptor directory doesn't exist.  Hm. 
-->
          <!-- fileset dir="${descriptor.src.dir}"/ -->
          
                                <classes dir="${java.classes.dir}"/>
          
          <!-- Package up "run" dependency libraries in the WEB-INF/lib folder. 
-->
          <!-- We have to copy and flatten the libraries into a single folder. 
-->
          
          <lib dir="${war.lib.dir}"/>
                </war>  
      
    </target>
  
        <target name="install" depends="war" 
                description="Synonym for 'war' invoked by the containing 
project."/>
      
  </project>
  
  
  1.1                  jakarta-hivemind/hivebuild/module.xml
  
  Index: module.xml
  ===================================================================
  <?xml version="1.0"?>
  <!-- 
     Copyright 2004 The Apache Software Foundation
  
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
  
         http://www.apache.org/licenses/LICENSE-2.0
  
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
  -->
  <project name="module">
  
        <!-- 
                Imports are computed relative the this file (to the build.xml
                that imported this file). -->
        
        <import file="hivebuild.xml"/>
        <import file="dependency.xml"/>
        <import file="forrestdoc.xml"/>
    <property file="${hivebuild.dir}/module.properties"/>
                
        <property name="forrest.report-menu.file" 
value="${project.forrest.xdocs.dir}/${module.name}/report-menu.ent"/>
                
        <!-- The default classpath for compilation is all external package 
JARs. -->
        
        <path id="default.test-compile.classpath">
                <path refid="default.compile.classpath"/>
                <path location="${java.classes.dir}"/>
                <fileset dir="${module.lib.dir}" includes="test/**/*.jar"/>
        </path>
        
        <path id="default.test.classpath">
                <path refid="default.test-compile.classpath"/>
                <pathelement location="${test.classes.dir}"/>
      <fileset dir="${module.lib.dir}" includes="run/**/*.jar"/>
                
                <!-- To pick up any classpath resources. -->
                
                <path location="${test.src.dir}"/>
                
                <!-- To pick up log4j.properties or other runtime resources. -->
                <pathelement location="${conf.src.dir}"/>       
                
                <!-- This is pretty specific to HiveMind, but eventually
                                 everything will be a HiveMind module. Pick up
                                 the module deployment descriptor. -->
                                 
                <pathelement location="${descriptor.src.dir}"/> 
      
      <!-- Pick up the JUnit and XML runtime provided with Ant. -->
      
      <fileset dir="${ant.home}/lib">
        <include name="junit-${module.junit.version}.jar"/>
        <include name="xml-apis.jar"/>
        <include name="xercesImpl.jar"/>
      </fileset>
        </path>
        
        <path id="default.source.path">
                <pathelement location="${java.src.dir}"/>
                <pathelement location="${generated-java.src.dir}"/>     
        </path>
        
        <macrodef name="copy-source-resources">
                <attribute name="classes-dir" default="${java.classes.dir}" 
description="Directory to copy resources to."/>
                
                <sequential>
                
                        <announce message="Copying resources to @{classes-dir} 
..."/>
                        
                        <copy todir="@{classes-dir}" includeEmptyDirs="false">
                                <fileset dir="${java.src.dir}">
                                        <exclude name="**/*.java"/>     
                                        <exclude name="**/package.html"/>
                                </fileset>
                        </copy>
                        
                </sequential>
                
        </macrodef>
        
        <macrodef name="default-compile">
                <attribute name="compile-classpath-id" 
                                default="default.compile.classpath"
                                description="Reference to a path defining 
compile-time libraries."/>
                <attribute name="sourcepath-id"
                        default="default.source.path"
                        description="Referencce to a path of source directories 
to compile."/>
                <attribute name="classes-dir"
                                default="${java.classes.dir}"
                                description="Directory to compile classes 
into."/>
                
                <sequential>
                        
                        <antcall target="-compile-init"/>
                        <mkdir dir="@{classes-dir}"/>
                        
                        <!-- Make the directory, before it is referenced via 
default.compile.classpath.
                                   The javacc.xml module actually puts files 
into generated Java.  Perhaps
                                   in the future, an XDoclet extension will 
make use of this as well. -->
                        
                        <announce message="Compiling Java sources to 
@{classes-dir} ..."/>
                        
                        <javac
                                destdir="@{classes-dir}"
                                classpathref="@{compile-classpath-id}"
          debug="${module.javac.debug}"
          debuglevel="${module.javac.debuglevel}"
          optimize="${module.javac.optimize}"
          deprecation="${module.javac.deprecation}"
          target="${module.javac.target}"
          verbose="${module.javac.verbose}"
          source="${module.javac.source}"
          listfiles="${module.javac.listfiles}"
          >
                                <src>
                                        <path refid="@{sourcepath-id}"/>
                                </src>  
                        </javac>
                                
                        <copy-source-resources classes-dir="@{classes-dir}"/>   
                        
                </sequential>   
        </macrodef>
        
        <macrodef name="default-compile-tests">
                <attribute name="compile-classpath-id"
                        default="default.test-compile.classpath"
                        description="Reference to a path used to compile unit 
tests."/>
      <sequential>
        
        <ibiblio-dependency artifact="junit" version="3.8.1" group="junit" 
use="${module.junit.use}"/>
        
        <mkdir dir="${test.classes.dir}"/>
        
        <announce message="Compiling tests to ${test.classes.dir} ..."/>
        
        <javac destdir="${test.classes.dir}" 
          classpathref="@{compile-classpath-id}"
          srcdir="${test.src.dir}" 
          debug="${module.javac-test.debug}" 
          debuglevel="${module.javac-test.debuglevel}" 
          optimize="${module.javac-test.optimize}" 
          deprecation="${module.javac-test.deprecation}" 
          target="${module.javac-test.target}" 
          verbose="${module.javac-test.verbose}" 
          source="${module.javac-test.source}" 
          listfiles="${module.javac-test.listfiles}" />
      </sequential>
        </macrodef>
        
    <available property="junit-available" 
file="${ant.home}/lib/${module.junit.jar}"/>
    
    <target name="-install-junit" unless="junit-available">
        <copy file="${external.lib.dir}/${module.junit.jar}"
              todir="${ant.home}/lib"/>
               
        <announce message="${module.junit.jar} has been installed to 
${ant.home}/lib."/>
        <announce message="You must restart the build to continue."/>
        
        <fail message="You must restart the build to continue."/>            
    </target>
    
        <macrodef name="default-run-tests">
                <attribute name="classpath-id" default="default.test.classpath"
                        description="Reference to path used for tests."/>
                <attribute name="fork" default="${module.junit.fork}" 
description="Run the tests in a seperate JVM if on."/>
                <element name="junit-elements" optional="true" 
description="Additional elements placed within the junit task."/>
                
                <sequential>
     
        <antcall target="-install-junit"/>
        
                        <mkdir dir="${junit.temp.dir}"/>
                        <mkdir dir="${junit.report.dir}"/>
  
                        <announce message="Running unit tests ..."/>
  
                        <junit 
                                fork="@{fork}"
          forkmode="${module.junit.forkmode}"
                                haltonfailure="off"
                                failureproperty="junit-failure"
                                tempdir="${junit.temp.dir}">
                                        
                                        <classpath refid="@{classpath-id}"/>
            
            <sysproperty key="PROJECT_ROOT" value="${project.dir}"/>   
            
            <jvmarg line="${module.junit.jvmarg}"/>
                                        
                                        <formatter type="xml"/>
            <formatter type="brief" usefile="false"/>
            <formatter type="plain"/>
                                                
                                        <batchtest todir="${junit.report.dir}">
                                                <fileset 
dir="${test.classes.dir}">
                                                        <!-- Inner classes 
cause problems! -->
                                                        <exclude 
name="**/*$*.class"/>
                                                        <include 
name="**/Test*.class"/>        
                                                </fileset>      
                                        </batchtest>    
                                        
                                        <junit-elements/>                       
                
                        </junit>
                        
                        <fail if="junit-failure" message="Some tests failed."/>
                        
                </sequential>   
        </macrodef>
        
        <target name="compile-dependencies" description="Overriden to download 
dependencies as external package.">
                <!-- Does nothing. This is often overriden, and becomes a 
series of
                           calls to macros defined in dependency.xml. -->
        </target>
         
        <target name="-compile-init">
                <mkdir dir="${generated-java.src.dir}"/>                        
        
        </target>
        
        <!-- Usually overriden so that the options used when compiling, 
especially compile-classpath-id, can be overriden. -->
        
        <target name="compile" description="Compile Java source code." 
depends="compile-dependencies">
                <default-compile/>
        </target>
        
        <target name="compile-tests" description="Compiles JUnit tests." 
depends="compile">
                <default-compile-tests/>
        </target>
        
        <target name="run-tests" description="Runs JUnit tests." 
depends="compile-tests">
                <default-run-tests/>    
        </target>
        
        <macrodef name="default-javadoc">
                <attribute name="sourcepath-id" default="default.source.path" 
description="Reference to source path."/>
                <attribute name="classpath-id" 
default="default.compile.classpath"/>
                
                <sequential>
                        <fail unless="javadoc.package" message="You must 
specify property javadoc.packages."/>
                        
                        <mkdir dir="${javadoc.target.dir}"/>
                        
                        <announce message="Generating Javadoc ..."/>
        
                        <javadoc
                                destdir="${javadoc.target.dir}"
                                classpathref="@{classpath-id}"
                                version="yes"
                                use="yes"
                                splitindex="yes"
                                windowtitle="${module.name} - 
${project.version} API">
                                <package name="${javadoc.package}"/>
                                <sourcepath>
                                        <pathelement 
location="${java.src.dir}"/>
                                        <pathelement 
location="${generated-java.src.dir}"/>     
                                </sourcepath>
                        </javadoc>
                </sequential>   
        </macrodef>
        
        <target name="javadoc" depends="-compile-init" description="Create 
JavaDoc from Java source files.">
                <default-javadoc/>      
        </target>
                        
    <target name="clean-code"
      description="Cleans compiled Java code.">
      <delete dir="${java.classes.dir}" quiet="true"/>
      <delete dir="${test.classes.dir}" quiet="true"/>
    </target>      
  </project>
  
  
  1.1                  jakarta-hivemind/hivebuild/war-module.properties
  
  Index: war-module.properties
  ===================================================================
  #
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  
  # The directory containing the web application context, including the web.xml 
inside
  # WEB-INF
  
  context.src.dir=${src.dir}/context
  
  # Default name for the jar file. Can be overriden if the name doesn't match
  # the module name, or if the project version should be appended.
  
  module.war.file=${module.name}.war
  war.lib.dir=${target.dir}/war-lib
  
  
  
  1.1                  jakarta-hivemind/hivebuild/module.properties
  
  Index: module.properties
  ===================================================================
  #
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  
  # Contains properties specific to modules (jars and wars).  Many properties 
in hivebuild.properties
  # should move here.
  
  # The following several properties define arguments passed to the javac task 
when compiling
  # target code.
  
  module.javac.debug=on
  module.javac.debuglevel=lines,vars,source
  module.javac.optimize=off
  module.javac.deprecation=on
  module.javac.target=1.1
  module.javac.verbose=off
  module.javac.source=1.3
  module.javac.listfiles=off
  
  # Each of the above has a corresponding javac-test that defaults to the same 
value.
  
  module.javac-test.debug=${module.javac.test}
  module.javac-test.debug=${module.javac.debug}
  module.javac-test.debuglevel=${module.javac.debuglevel}
  module.javac-test.optimize=${module.javac.optimize}
  module.javac-test.deprecation=${module.javac.deprecation}
  module.javac-test.target=${module.javac.target}
  module.javac-test.verbose=${module.javac.verbose}
  module.javac-test.source=${module.javac.source}
  module.javac-test.listfiles=${module.javac.listfiles}
  
  # Directorty into which the module's jar should be installed.
  
  module.install.dir=${project.target.dir}
  
  # Defaults for running unit tests.
  
  module.junit.version=3.8.1
  module.junit.fork=on
  module.junit.forkmode=once
  
  # Used to specify the maximum heap size.
  module.junit.jvmarg=-Xmx384m
  module.junit.includeantruntime=on
  module.junit.jar=junit-${module.junit.version}.jar
  
  # Override this to compile if java sources uses JUnit classes.
  module.junit.use=test
  
  forrest.report.folder=${module.name}/
  
  

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

Reply via email to