<project default="jars">
    <property name="src.dir" value="src/main"/>
    <property name="component.src.dir" value="${src.dir}/org/apache/ant/component"/>
    <property name="build.dir" value="build"/>
    <property name="build.classes" value="build/classes"/>
    <property name="component.classes.dir" value="org/apache/ant/component"/>
    <property name="build.javadocs" value="build/javadocs"/>
    <property name="build.lib" value="${build.dir}/lib"/>
    <property name="frontend.manifest" value="${src.dir}/org/apache/ant/frontend/manifest.mf"/>
    <property name="egg.manifest" value="${src.dir}/org/apache/ant/frontend/eggmanifest.mf"/>
    
    <target name="compile">
        <mkdir dir="${build.classes}"/>
        <depend srcdir="${src.dir}"
                destdir="${build.classes}" closure="yes" 
                cache="${build.dir}/depcache"/>
        <javac srcdir="${src.dir}"
               destdir="${build.classes}"
               deprecation="true"
               debug="true"/>
    </target>

    <target name="build-task">
        <echo message="building Task jar from ${component.classes.dir}/${taskset}/**/*.class"/>
        <jar jarfile="${build.lib}/task/${taskset}.tsk" 
             basedir="${build.classes}">
            <zipfileset dir="${component.src.dir}/${taskset}" 
                        prefix="ANT-INF" 
                        includes="antlib.xml"/>
            <include name="${component.classes.dir}/${taskset}/**/*.class" />
        </jar>
    </target>

    
    <target name="jars" depends="compile">
        <mkdir dir="${build.lib}"/>
        <mkdir dir="${build.lib}/task"/>
        <jar jarfile="${build.lib}/frontend.jar" 
             basedir="${build.classes}"
             manifest="${frontend.manifest}">
            <include name="org/apache/ant/frontend/*.class" />
        </jar>
        <jar jarfile="${build.lib}/egg.jar" 
             basedir="${build.classes}"
             manifest="${egg.manifest}">
            <include name="org/apache/ant/frontend/RemoteLauncher.class" />
            <include name="org/apache/ant/core/support/AntClassLoader.class" />
        </jar>
        <jar jarfile="${build.lib}/core.jar" 
             basedir="${build.classes}">
            <include name="org/apache/ant/core/**/*.class" />
        </jar>
        <antcall target="build-task">
            <param name="taskset" value="core"/>
        </antcall>
        <antcall target="build-task">
            <param name="taskset" value="file"/>
        </antcall>
        <antcall target="build-task">
            <param name="taskset" value="thread"/>
        </antcall>
        <copy todir="${build.lib}">
          <fileset dir="lib"/>
        </copy>
    </target>
    
    <target name="clean">
        <delete dir="${build.dir}"/>
    </target>
    
    <target name="javadoc">
        <mkdir dir="${build.javadocs}"/>
        <javadoc packagenames="org.apache.*"
                 sourcepath="${src.dir}"
                 destdir="${build.javadocs}"
                 author="true"
                 version="true"
                 windowtitle="Ant 2.0 API"
                 doctitle="Ant 2.0"
                 private="true"
                 bottom="Copyright &#169; 2001 Apache Software Foundation. All Rights Reserved.">
          <group title="Ant Core" packages="org.apache.ant.core*" />
          <group title="Front End" packages="org.apache.ant.frontend*" />
          <group title="XML Parsing" packages="org.apache.ant.xml*" />
        </javadoc>
    </target>
</project>