ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scotte Zinn" <sz...@patronix.com>
Subject Cascading build.xml files
Date Wed, 16 Aug 2000 00:43:31 GMT
Here is the environment I have:

If anyone has any comments or suggestions, please post them.

-- Scotte

Root Build.xml:

<project name="JavaLibrary" default="main" basedir=".">

    <property file="${user.home}/.ant.properties"/>

    <property name="name" value="Your Name Here"/>
    <property name="version" value="1.0"/>

    <property name="java.javadocs" value="e:/Java/jdk1.3/docs/api"/>

    <property name="src.dir" value="src"/>
    <property name="lib.dir" value="lib"/>

    <property name="build.dir" value="build"/>
    <property name="build.src" value="${build.dir}/src"/>
    <property name="build.classes" value="${build.dir}/classes"/>
    <property name="build.lib" value="${build.dir}/lib"/>
    <property name="build.javadoc" value="${build.dir}/javadoc"/>

    <!--
======================================================================= -->
    <!-- Create the build
          -->
    <!--
======================================================================= -->
    <target name="prepare">
        <mkdir dir="${build.dir}"/>
        <mkdir dir="${build.classes}"/>
        <mkdir dir="${build.lib}"/>
        <tstamp/>
    </target>

    <!--
======================================================================= -->
    <!-- Build SubProject1 -->
    <!--
======================================================================= -->
    <target name="SubProject1" depends="prepare">
        <ant antfile="${src.dir}/SubProject1/Build.xml"
target="SubProject1">
            <!-- Property definitions here to pass to the subproject -->
        </ant>
    </target>

    <!--
======================================================================= -->
    <!-- Prepare the SubProject1 for a javadocs
      -->
    <!--
======================================================================= -->
    <target name="SubProject1.javadocs">
        <ant antfile="${src.dir}/SubProject1/Build.xml"
target="SubProject1.javadocs"/>
    </target>

    <!--
======================================================================= -->
    <!-- Clean SubProject1 -->
    <!--
======================================================================= -->
    <target name="SubProject1.clean">
        <ant antfile="${src.dir}/SubProject1/Build.xml"
target="SubProject1.clean"/>
    </target>

    <!--
======================================================================= -->
    <!-- Build the SubProject2 project.  Needs
            -->
    <!--
======================================================================= -->
    <target name="SubProject2" depends="prepare,SubProject1">
        <ant antfile="${src.dir}/SubProject2/Build.xml"
target="SubProject2">
            <!-- Property definitions here to pass to the subproject -->
        </ant>
    </target>

    <!--
======================================================================= -->
    <!-- Prepare SubProject2 for a javadocs
      -->
    <!--
======================================================================= -->
    <target name="SubProject2.javadocs">
        <ant antfile="${src.dir}/SubProject2/Build.xml"
target="SubProject2.javadocs"/>
    </target>

    <!--
======================================================================= -->
    <!-- Clean SubProject2 -->
    <!--
======================================================================= -->
    <target name="SubProject2.clean">
        <ant antfile="${src.dir}/SubProject2/Build.xml"
target="SubProject2.clean"/>
    </target>

    <!--
======================================================================= -->
    <!-- Build all
         -->
    <!--
======================================================================= -->
    <target name="main" depends="SubProject1,SubProject2"/>

    <!--
======================================================================= -->
    <!-- Build
         -->
    <!--
======================================================================= -->
    <target name="javadocs"
depends="clean.javadocs,SubProject1.javadocs,SubProject2.javadocs">
        <mkdir dir="${build.javadoc}"/>
        <copyfile src="${src.dir}/Overview.html"
dest="${build.src}/javadoc/Overview.html"/>
        <javadoc sourcepath="${build.src}/javadoc"
                 destdir="${build.javadoc}"
                 packagenames="com.yourroot.*"
                 overview="${build.src}/javadoc/Overview.html"
                 classpath="${build.src}/javadoc"
                 author="true"
                 version="true"
                 package="true"
                 windowtitle="Your API"
                 doctitle="Your Company Name Here"
                 bottom="Copyright &#169; 2000 Your Company Name Here.  All
Rights Reserved&lt;br&gt;${DSTAMP} ${TSTAMP}"
                 >
            <link href="${java.javadocs}"/>
            <!-- group definitions here -->
        </javadoc>
    </target>

    <!--
======================================================================= -->
    <!-- Clean out the build
     -->
    <!--
======================================================================= -->
    <target name="clean">
        <deltree dir="${build.dir}"/>
    </target>

    <!--
======================================================================= -->
    <!-- Clean out the javadocs build
     -->
    <!--
======================================================================= -->
    <target name="clean.javadocs">
        <deltree dir="${build.javadoc}"/>
    </target>

    <!--
======================================================================= -->
    <!-- Clean out all generated
      -->
    <!--
======================================================================= -->
    <target name="realclean" depends="clean">
        <deltree dir="${lib.dir}"/>
    </target>
</project>


--- Each SubProject Build.xml

<?xml version="1.0"?>
<!-- $Id: //depot/dev/projects/Java/src/SubProject1/Build.xml#1 $ -->

<!--
======================================================================= -->
<!-- Build the Project -->
<!--
======================================================================= -->
<project name="SubProject1" default="main" basedir="../..">

    <!--
======================================================================= -->
    <!-- Default project
             -->

        -->
    <!-- This entry-point will just build the DebugLib
         -->
    <!--
======================================================================= -->
    <target name="main">
        <ant antfile="Build.xml" target="SubProject1"/>
    </target>

    <!--
======================================================================= -->
    <!-- Clean out the project files in the build area                  -->
    <!--
======================================================================= -->
    <target name="clean">
        <ant antfile="Build.xml" target="SubProject1.clean"/>
    </target>


    <!--
======================================================================= -->
    <!-- Clean out project from the build area.                     -->

        -->
    <!-- This target is called from the main Build.xml
      -->
    <!--
======================================================================= -->
    <target name="SubProject1.clean">
        <deltree dir="${build.classes}/SubProject1"/>
        <deltree dir="${build.src}/SubProject1"/>
        <delete file="${build.lib}/SubProject1.jar"/>
    </target>

    <!--
======================================================================= -->
    <!-- Prepare for the javadocs
       -->

        -->
    <!-- This target is called from the main Build.xml
      -->
    <!--
======================================================================= -->
    <target name="SubProject1.javadocs">
        <copydir src="${src.dir}/SubProject1"
                 dest="${build.src}/javadoc">
            <include name="**"/>
            <exclude name="**/Build.xml"/>
            <exclude name="**/tests/**"/>
        </copydir>
    </target>

    <!--
======================================================================= -->
    <!-- Build and copy the .jar file to the library
     -->

        -->
    <!-- This target is called from the main Build.xml
      -->
    <!--
======================================================================= -->
    <target name="SubProject1" depends="jar,jar.tests">
        <copyfile src="${build.lib}/SubProject1.jar"
dest="${lib.dir}/SubProject1.jar"/>
    </target>

    <!--
======================================================================= -->
    <!-- Build the jar file based on all of the compiled
        -->
    <!--
======================================================================= -->
    <target name="jar" depends="compile">
        <jar jarfile="${build.lib}/SubProject1.jar"
             basedir="${build.classes}/SubProject1"
             includes="**"/>
    </target>

    <!--
======================================================================= -->
    <!-- Compile the java code that was copied from the source
     -->
    <!--
======================================================================= -->
    <target name="compile" depends="copy">
        <mkdir dir="${build.classes}/SubProject1"/>
        <javac srcdir="${build.src}/SubProject1"
               destdir="${build.classes}/SubProject1"
               classpath="${classpath}"           <!-- Add the other
required libraries here -->
               debug="${compile.flag.debug}"
               deprecation="off"
               optimize="on">
            <include name="**/*.java"/>
        </javac>
    </target>

    <!--
======================================================================= -->
    <!-- Create the source tree that needs to be
         -->
    <!--
======================================================================= -->
    <target name="copy">
        <copydir src="${src.dir}/SubProject1"
                 dest="${build.src}/SubProject1">
            <exclude name="**/tests/**"/>
        </copydir>
    </target>
</project>


Mime
View raw message