<?xml version="1.0" encoding="UTF-8"?>
<!--
   Copyright 1999-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="Tomcat" default="main" basedir=".">

  <!-- Compilation properties -->
  <property file="build.properties"/>
  <property file="${user.home}/.ant.properties"  />
  <property file="${user.home}/build.properties"  />

  <property name="optimize" value="false"/>
  <property name="debug" value="on"/>
  <property name="compile.target" value="1.2" />
  <property name="compile.source" value="${compile.target}" />

  <!-- Version properties -->
  <property name="version" value="3.3.3" />
  <property name="release" value="Dev" />
  <property name="version.release" value="${version} ${release}"/>
  <property name="tomcat.name" value="Tomcat ${version}" />
  <property name="tomcat.name.release" value="Tomcat ${version.release}" />

  <!-- Directories -->
  <!-- Where source packages are located -->
  <property name="ws" value=".." />

  <!-- work.dir is the place where build places the work
       files created in the build process, including the
       build/ and dist/ dirs.
       Set it to ".." ( -D work.dir=.. ) to get the
       previous behavior.
    -->
  <property name="work.dir" value="." />

  <!-- append basedir since jtc will need a full path for tomcat33.home -->
  <property name="tomcat.build" value="${basedir}/${work.dir}/build/tomcat"/>
  <property name="tomcat.dist" value="${basedir}/${work.dir}/dist/tomcat"/>

  <!-- Location where various binaries are installed.
       It can be "c:\Program Files" or /usr/share/java or
       /opt/java. The default is .. ( assuming jakarta-tomcat
       is installed in the same directory ) ( backward compat ).

       Note that this assumes binary packages ( i.e. dists )
   -->
  <property name="install.dir" value=".." />

  <!-- External repositories -->
  <property name="jakarta-tomcat-connectors"
            location="${ws}/jakarta-tomcat-connectors" />
  <property name="jakarta-commons"
            location="${ws}/jakarta-commons" />

  <!-- External packages we depend on -->
  <!-- Tomcat depends on:
       - Ant ( latest 1.4 binary install in jakarta-ant, peer to jakarta-tomcat )
       - jakarta-commons (optional, latest src, peer to jakarta-tomcat )
       - Jaxp ( optional, the jar files from ant can be used instead )
       - Jsse ( optional )
    -->

  <!-- set by default if "ant" command is used -->
  <property name="ant.home" location="${install.dir}/jakarta-ant"/>
  <property name="ant.bin" location="${ant.home}/bin"/>
  <property name="ant.lib" location="${ant.home}/lib"/>
  <property name="ant.jar" location="${ant.home}/lib/ant.jar"/>
  <property name="ant-launcher.jar" location="${ant.home}/lib/ant-launcher.jar"/>
  <property name="optional.jar" location="${ant.home}/lib/optional.jar"/>
  <property name="ant-optional.jar" location="${ant.home}/lib/ant-optional.jar"/>

  <property name="jaxp.home" location="bin" />

  <property name="tomcat-jk.home" location="${jakarta-tomcat-connectors}/jk" />
  <property name="jtc.util.home" location="${jakarta-tomcat-connectors}/util"/>
  <property name="jtc.jni.home" location="${jakarta-tomcat-connectors}/jni" />
  <property name="tomcat-jni.jar" 
            location="${jtc.jni.home}/dist/tomcat-native-1.0.0.jar" />
  <property name="jtc.util.build" location="${jtc.util.home}/build"/>
  <property name="tomcat-util.jar"
            location="${jtc.util.build}/lib/tomcat-util.jar"/>

  <property name="jtc.coyote.home" location="${jakarta-tomcat-connectors}/coyote"/>
  <property name="jtc.coyote.lib" location="${jtc.coyote.home}/build/lib"/>

  <property name="jtc.http11.home" location="${jakarta-tomcat-connectors}/http11"/>
  <property name="jtc.http11.lib" location="${jtc.http11.home}/build/lib"/>

  <property name="jtc.jk.home" location="${jakarta-tomcat-connectors}/jk"/>

  <property name="jsse.home" location="${install.dir}/jsse1.0.2"/>
  <property name="jsse.lib" location="${jsse.home}/lib"/>
  <property name="jsse.jar" location="${jsse.lib}/jsse.jar"/>
  <property name="jnet.jar" location="${jsse.lib}/jnet.jar"/>
  <property name="jcert.jar" location="${jsse.lib}/jcert.jar"/>

  <property name="puretls.home" location="${install.dir}/puretls-0.9b2"/>
  <property name="puretls.lib" location="${puretls.home}/build"/>
  <property name="puretls.jar" location="${puretls.lib}/puretls.jar"/>

  <property name="commons-dbcp.home" location="${jakarta-commons}/dbcp"/>
  <property name="commons-dbcp.lib" location="${commons-dbcp.home}/dist"/>
  <property name="commons-dbcp.jar" location="${commons-dbcp.lib}/commons-dbcp.jar"/>

  <property name="commons-pool.home" location="${jakarta-commons}/pool"/>
  <property name="commons-pool.lib" location="${commons-pool.home}/dist"/>
  <property name="commons-pool.jar" location="${commons-pool.lib}/commons-pool.jar"/>

  <property name="commons-logging.home" location="${jakarta-commons}/commons-logging-1.0.2" />
  <property name="commons-logging.lib" location="${commons-logging.home}" />
  <property name="commons-logging.jar" location="${commons-logging.lib}/commons-logging-api.jar" />
  
  <property name="commons-collections.home" location="${jakarta-commons}/collections"/>
  <property name="commons-collections.lib" location="${commons-collections.home}/dist"/>
  <property name="commons-collections.jar" location="${commons-collections.lib}/commons-collections.jar"/>

  <property name="commons-modeler.home" location="${jakarta-commons}/commons-modeler-1.0" />
  <property name="commons-modeler.lib" location="${commons-modeler.home}" />
  <property name="commons-modeler.jar" location="${commons-modeler.lib}/commons-modeler.jar" />

  <property name="jmx.jar" location="${jakarta-tomcat-connectors}/lib/mx4j-jmx.jar"/>
  <property name="jmxtools.jar" location="${jakarta-tomcat-connectors}/lib/mx4j-tools.jar"/>

  <property name="log4j.jar" location="${install.dir}/log4j/log4j.jar" />
  
  <!-- Binaries checked in ( servlet.jar is not likely to change,
      the 2.2 spec is final -->
  <property name="servlet22.jar" value="bin/servlet22.jar"/>

  <!-- We can assume tomcat.build will hold a working tomcat -->
  <property name="tomcat.home" value="${tomcat.build}"/>

  <!-- ==================== Initialization - guessing config ========== -->
  <target name="detect">
    <available property="jsse.present.runtime"
               classname="javax.net.ssl.SSLServerSocket"/>
    <available property="ant15-present"
               classname="org.apache.tools.ant.taskdefs.optional.jsp.JspC" />
    <available property="jsse.present"
               file="${jsse.jar}"/>
    <available property="puretls.present"
 	       file="${puretls.jar}"/>
    <available property="jdk12.present"
               classname="java.security.PrivilegedAction"/>
    <available property="jaxp-present"
               file="${jaxp.home}/jaxp.jar" />
    <available property="jmx-present"
               file="${jmx.jar}" />
    <available property="jmxtools-present"
               file="${jmxtools.jar}" />
    <available property="jaxp10-present"
               file="${jaxp.home}/parser.jar" />
    <available property="jaxp11-present"
               file="${jaxp.home}/crimson.jar" />
    <available property="xerces-present"
               file="${jaxp.home}/xerces.jar" />
    <available property="log4j-present"
	       file="${log4j.jar}" />
    <condition property="xerces2-present">
      <and>
        <available file="${xerces2.home}/xercesImpl.jar" />
        <available file="${xerces2.home}/xmlParserAPIs.jar" />
      </and>
    </condition>
    <condition property="xml-parser-present">
      <and> 
        <available file="${xml-parser-impl.jar}" />
        <available file="${xml-parser-apis.jar}" />
      </and>
    </condition>
    <available property="jtc-present"
               file="${jakarta-tomcat-connectors}" />
    <condition property="commons-dbcp.complete">
      <and>
        <available file="${commons-dbcp.jar}" />
        <available file="${commons-pool.jar}" />
        <available file="${commons-collections.jar}" />
      </and>
    </condition>

  <!-- Some IDE like Eclipse didn't export ant and xml api  -->
  <!-- jars so javac will faild at compile time             -->
  <!-- To fix that, create some path ref which will be used -->
  
  <path id="ant.class.path">
    <pathelement location="${ant.jar}/"/>
    <pathelement location="${optional.jar}"/>
    <pathelement location="${ant-optional.jar}"/>
  </path>

  <path id="xml-apis.class.path">
    <pathelement location="${jaxp.home}/jaxp.jar"/>
    <pathelement location="${jaxp.home}/crimson.jar"/>
    <pathelement location="${xerces2.home}/xmlParserAPIs.jar"/>
    <pathelement location="${xml-parser-apis.jar}"/>
  </path>

  <path id="tomcat_util.class.path">
    <pathelement location="${tomcat-util.jar}"/>
	<pathelement location="${commons-logging.jar}" />
  </path>

  <path id="crypto.class.path">
    <pathelement location="${jcert.jar}"/>
    <pathelement location="${jnet.jar}"/>
    <pathelement location="${jsse.jar}"/>
    <pathelement location="${puretls.jar}"/>
  </path>

  <path id="jdk.class.path">
    <fileset dir="${java.home}/..">
      <include name="lib/tools.jar"/>
    </fileset>
    <fileset dir="${java.home}">
      <include name="lib/classes.zip"/>
    </fileset>
  </path>

  <path id="javadoc.classpath">
    <pathelement location="${servlet22.jar}"/>
    <pathelement location="${jmx.jar}"/>
    <path refid="ant.class.path"/>
    <path refid="crypto.class.path"/>
    <path refid="jdk.class.path"/>
    <path refid="tomcat_util.class.path"/>
    <path refid="xml-apis.class.path"/>
  </path>

  </target>

  <target name="uptodate">
    <uptodate property="tomcat-util.is.uptodate" targetfile="${tomcat-util.jar}">
      <srcfiles dir="${jtc.util.home}" includes="java/**,build.xml"/>
    </uptodate>
    <uptodate property="tomcat-jni.is.uptodate" targetfile="${tomcat-jni.jar}">
      <srcfiles dir="${jtc.jni.home}" includes="java/**,build.xml"/>
    </uptodate>
  </target>

  <target name="msg.ant15" if="ant15-present" >
    <echo message="Detected Ant 1.5" />
  </target>

  <target name="msg.jdk12" if="jdk12.present" >
    <echo message="Detected JDK1.2" />
  </target>

  <target name="msg.jsse" if="jsse.present" >
    <echo message="Detected JSSE"/>
  </target>

  <target name="msg.jmx" if="jmx-present" >
    <echo message="Detected JMX"/>
  </target>

  <target name="msg.jmxtools" if="jmxtools-present" >
    <echo message="Detected JMX TOOLS"/>
  </target>

  <target name="msg.puretls" if="puretls.present">
    <echo message="Detected PureTLS"/>
  </target>

  <target name="msg.commons-dbcp" if="commons-dbcp.complete" >
    <echo message="Detected commons-DBCP and required jars"/>
  </target>

  <target name="msg.jtc" unless="jtc-present" >
    <fail message="Jakarta-tomcat-connectors repository is required ${jakarta-tomcat-connectors}"/>
  </target>

  <target name="msg.jtc.util" if="tomcat-util.is.uptodate">
    <echo message="tomcat-util.jar is up to date"/>
  </target>

  <target name="msg.log4j" if="log4j-present">
    <echo message="Detected Log4j" />
  </target>

  <target name="init"
          depends="detect,uptodate,msg.ant15,msg.jdk12,msg.jsse,msg.jmx,msg.jmxtools,msg.puretls,msg.commons-dbcp,msg.jtc,msg.jtc.util,msg.log4j" >
  </target>

  <target name="prepare.jaxp101"  depends="detect" if="jaxp10-present" >
    <echo message="Installing JAXP-1.0"/>
    <copy tofile="${tomcat.build}/lib/container/jaxp.jar"
          file="${jaxp.home}/jaxp.jar"/>
    <copy tofile="${tomcat.build}/lib/container/parser.jar"
          file="${jaxp.home}/parser.jar"/>
  </target>

  <target name="include.jaxp" depends="detect" if="jaxp-present" >
    <echo message="Including jaxp.jar" />
    <copy tofile="${tomcat.build}/lib/container/jaxp.jar"
          file="${jaxp.home}/jaxp.jar"/>
  </target>

  <target name="prepare.jaxp11" depends="detect,include.jaxp" if="jaxp11-present" >
    <echo message="Installing JAXP-1.1"/>
    <copy tofile="${tomcat.build}/lib/container/xalan.jar"
          file="${jaxp.home}/xalan.jar"/>
    <copy tofile="${tomcat.build}/lib/container/crimson.jar"
          file="${jaxp.home}/crimson.jar"/>
  </target>

  <target name="prepare.xerces" depends="detect" if="xerces-present" >
    <echo message="Installing XERCES"/>
    <copy tofile="${tomcat.build}/lib/container/xerces.jar"
          file="${jaxp.home}/xerces.jar"/>
    <copy tofile="${tomcat.build}/lib/container/jaxp.jar"
          file="${jaxp.home}/jaxp.jar"/>
  </target>
  
  <target name="prepare.xerces2" depends="detect" if="xerces2-present" >
    <echo message="Installing XERCES-2"/>
    <copy tofile="${tomcat.build}/lib/container/xercesImpl.jar"
          file="${xerces2.home}/xercesImpl.jar"/>
    <copy tofile="${tomcat.build}/lib/container/xmlParserAPIs.jar"
          file="${xerces2.home}/xmlParserAPIs.jar"/>
  </target>

  <target name="prepare.xml-parser" depends="detect" if="xml-parser-present" >
    <echo message="Installing XML-PARSER ${xml-parser-impl.jar} and ${xml-parser-apis.jar}"/>
    <copy todir="${tomcat.build}/lib/container/"
          file="${xml-parser-impl.jar}"/>
    <copy todir="${tomcat.build}/lib/container/"
          file="${xml-parser-apis.jar}"/>
  </target>

  <target name="prepare.jaxp" depends="prepare.jaxp101,prepare.jaxp11,prepare.xerces,prepare.xerces2,prepare.xml-parser" />

  <!-- ==================== Copy static files ==================== -->

  <target name="prepare" depends="init,prepare.dirs,prepare.jaxp" 
	  description="Create the directory structure for build and copy binaries" />

  <target name="prepare.dirs" depends="init">
    <mkdir dir="src/doc"/> <!-- Temp change until dir is not empty -->
    <mkdir dir="${tomcat.build}"/>
    <mkdir dir="${tomcat.build}/conf"/>
    <mkdir dir="${tomcat.build}/conf/auto"/>
    <mkdir dir="${tomcat.build}/classes"/>
    <mkdir dir="${tomcat.build}/lib"/>
    <mkdir dir="${tomcat.build}/lib/apps"/>
    <mkdir dir="${tomcat.build}/lib/container"/>
    <mkdir dir="${tomcat.build}/lib/common"/>
    <mkdir dir="${tomcat.build}/lib/endorsed"/>
    <mkdir dir="${tomcat.build}/logs"/>
    <mkdir dir="${tomcat.build}/bin"/>
    <mkdir dir="${tomcat.build}/doc"/>
    <mkdir dir="${tomcat.build}/webapps"/>
    <mkdir dir="${tomcat.build}/modules"/>
    <mkdir dir="${tomcat.build}/native"/>

    <copy todir="${tomcat.build}/bin">
            <fileset dir="src/shell"/>
        </copy>
    <copy todir="${tomcat.build}/bin"
          file="src/shell/tomcat.bat"
          overwrite="yes">
	    <filterset>
	        <filter token="TITLE" value="${tomcat.name.release}"/>
	    </filterset>
        </copy>
    <copy todir="${tomcat.build}/conf">
            <fileset dir="src/etc"/>
        </copy>
    <copy todir="${tomcat.build}/doc">
            <fileset dir="src/doc"/>
        </copy>
    <copy todir="${tomcat.build}/native">
            <fileset dir="src/native"/>
        </copy>
    <copy tofile="${tomcat.build}/LICENSE" file="LICENSE"/>
    <copy tofile="${tomcat.build}/KEYS" file="KEYS"/>

    <!-- include ant, it is used for testing and will be used for
    configuration and few other tasks
    <copy todir="${tomcat.build}/bin">
            <fileset dir="${ant.bin}"/>
    </copy>
    -->

    <copy file ="src/build/readme/readme.container"
          tofile="${tomcat.build}/lib/container/README" />

    <copy file ="src/build/readme/readme.shared"
          tofile="${tomcat.build}/lib/apps/README" />

    <copy file ="src/build/readme/readme.common"
          tofile="${tomcat.build}/lib/common/README" />

    <copy file ="src/build/readme/readme.endorsed"
          tofile="${tomcat.build}/lib/endorsed/README" />

    <!-- This act as a "default", Tomcat3.3 will not load it in
         classpath, just a hack to ease the transition
     -->
    <copy tofile="${tomcat.build}/lib/common/servlet.jar"
          file="${servlet22.jar}"/>

    <fixcrlf srcdir="${tomcat.build}/bin" includes="**/*.sh" eol="lf"/>
    <fixcrlf srcdir="${tomcat.build}/bin" includes="**/*.bat" eol="crlf"/>

    <chmod perm="+x" file="${tomcat.build}/bin/*.sh"/>

    <move todir="${tomcat.build}/bin">
      <fileset dir="${tomcat.build}/bin" includes="*.sh"/>
      <mapper type="glob" from="*.sh" to="*"/>
    </move>
  </target>

  <target name="dep.tomcat-jni" unless="tomcat-jni.is.uptodate"
         description="Build j-t-c jni which j-t-c util depends on.">
     <ant dir="${jtc.jni.home}" target="jar" >
       <property name="version" value="1.0.0" />
     </ant>
  </target>
  <target name="dep.tomcat-util"  unless="tomcat-util.is.uptodate"
          depends="dep.tomcat-jni"
          description="Build j-t-c util which we depend on. To be called before main">
    <ant dir="${jtc.util.home}" />
  </target>

  <target name="deps" description="Build repositoried that depends on. To be called before main" >
        <ant dir="${jtc.coyote.home}">
            <property name="tomcat33.home" value="${tomcat.build}"/>
            <property name="util.home" value="${jtc.util.home}"/>
        </ant>
        
        <ant dir="${jtc.http11.home}" inheritAll="false">
            <property name="util.home" value="${jtc.util.home}"/>
            <property name="commons-logging.jar" value="${commons-logging.jar}"/>
            <property name="commons-modeler.jar" value="${commons-modeler.jar}"/>
            <property name="jmx.jar" value="${jmx.jar}"/>
            <property name="tomcat-jni.jar" value="${tomcat-jni.jar}" />
        </ant>
            
        <ant dir="${jtc.jk.home}" target="build-jk" inheritAll="false">
            <property name="tomcat33.home" value="${tomcat.build}"/>
            <property name="servlet-api.jar" value="${basedir}/${servlet22.jar}"/>
            <property name="tomcat-apr.jar" value="${tomcat-jni.jar}" />
            <property name="jmx.jar" value="${jmx.jar}" />
            <property name="commons-modeler.jar" value="${commons-modeler.jar}" />
            <property name="commons-logging.jar" value="${commons-logging.jar}" />
        </ant>
  </target>


  <!-- ==================== Tomcat util ==================== -->
  <!-- Local Tomcat utilities -->

  <target name="tomcat_util" depends="prepare">
    <javac destdir="${tomcat.build}/classes"
	   target="${compile.target}"
           source="${compile.source}"
           debug="${debug}"
           optimize="${optimize}"
           deprecation="off"
           srcdir="src/share">
      <classpath>
        <path refid="ant.class.path"/>
        <path refid="xml-apis.class.path"/>
        <path refid="tomcat_util.class.path"/>
      </classpath>
      
      <include name="org/apache/tomcat/util/**"/>

      <exclude name="**/util/compat/Jdk12Support.java"
               unless="jdk12.present"/>
      <exclude name="**/util/depend/DependClassLoader12.java"
               unless="jdk12.present"/>
    </javac>

    <copy todir="${tomcat.build}/classes">
      <fileset dir="src/share">
        <include name="org/apache/tomcat/util/**/*.properties"/>
        <include name="org/apache/tomcat/util/**/*.dtd"/>
      </fileset>
    </copy>

    <!-- Hooks and other tomcat3.3 specific utils needed in core -->
    <jar jarfile="${tomcat.build}/lib/common/core_util.jar" >
      <fileset dir="${tomcat.build}/classes">
          <include name="org/apache/tomcat/util/hooks/**"/>
          <include name="org/apache/tomcat/util/log/**"/>
        <!-- All resource must go to common, bug in StringManager/ResourceBundle -->
        <include name="org/apache/tomcat/util/**/*.properties"/>
      </fileset>
    </jar>

    <!-- Add jakarta-tomcat-connectors utils -->
    <copy todir="${tomcat.build}/lib/common">
      <fileset dir="${jtc.util.build}/lib">
        <include name="*.jar"/>
      </fileset>
    </copy>

    <!-- Copy commons-logging-api.jar since tomcat-util depends on it -->
    <copy todir="${tomcat.build}/lib/common"
          file="${commons-logging.jar}"/>

    <!-- All tomcat3 specific utils -->
    <jar jarfile="${tomcat.build}/lib/container/container_util.jar" >
      <fileset dir="${tomcat.build}/classes">
        <include name="org/apache/tomcat/util/**"/>
        <exclude name="org/apache/tomcat/util/test/**"/>
      </fileset>
    </jar>
  </target>

  <!-- ==================== Tomcat.jar ( starter )  ==================== -->

  <target name="tomcat.jar" depends="prepare,tomcat_modules">
    <javac destdir="${tomcat.build}/classes"
           debug="${debug}"
           optimize="${optimize}"
           deprecation="off"
           source="${compile.source}"
           target="${compile.target}"
           srcdir="src/share">
      <classpath>
        <path refid="tomcat_util.class.path"/>
      </classpath>
      <!-- no dependencies -->
      <include name="org/apache/tomcat/startup/Main.java"/>
      <include name="org/apache/tomcat/util/compat/**"/>
      <include name="org/apache/tomcat/util/depend/**"/>
      <exclude name="**/util/depend/DependClassLoader12.java" 
	       unless="jdk12.present"/>
      <exclude name="**/util/compat/Jdk12Support.java" 
	       unless="jdk12.present"/>
    </javac>
    <jar jarfile="${tomcat.build}/lib/tomcat.jar"
         basedir="${tomcat.build}/classes"
         manifest="src/build/manifests/manifest">
      <include name="org/apache/tomcat/startup/Main.class"/>
      <include name="org/apache/tomcat/modules/server/JNIEndpoint**"/>
      <include name="org/apache/tomcat/modules/server/StartupThread**"/>
      <include name="org/apache/tomcat/startup/Main$*.class"/>
      <include name="org/apache/tomcat/util/depend/**"/>
      <include name="org/apache/tomcat/util/compat/**"/>
      <fileset dir="${jtc.util.build}/classes">
        <include name="org/apache/tomcat/util/IntrospectionUtils**"/>
      </fileset>
    </jar>
  </target>

  <target name="stop-tomcat.jar" depends="prepare">
    <javac destdir="${tomcat.build}/classes"
           debug="${debug}"
           optimize="${optimize}"
           deprecation="off"
           source="${compile.source}"
           target="${compile.target}"
           srcdir="src/share">
      <classpath>
        <pathelement location="${jtc.util.build}/classes"/>
      </classpath>
      <include name="org/apache/tomcat/startup/StopTomcat.java"/>
    </javac>
    <copy todir="${tomcat.build}/classes/org/apache/tomcat/resources">
            <fileset dir="src/share/org/apache/tomcat/resources">
                <include name="**/*.properties"/>
                <include name="**/*.dtd"/>
            </fileset>
    </copy>

    <jar jarfile="${tomcat.build}/lib/stop-tomcat.jar"
         basedir="${tomcat.build}/classes"
         manifest="src/build/manifests/manifest.stop-tomcat">
      <include name="org/apache/tomcat/startup/StopTomcat.class"/>
      <include name="org/apache/tomcat/resources/LocalStrings*"/>
      <fileset dir="${jtc.util.build}/classes">
        <include name="org/apache/tomcat/util/res/StringManager.class"/>
        <include name="org/apache/tomcat/util/IntrospectionUtils**"/>
      </fileset>
    </jar>
  </target>

  <!-- ==================== Tomcat core ==================== -->

  <target name="tomcat_core" depends="prepare,tomcat_util">
    <javac destdir="${tomcat.build}/classes"
           debug="${debug}"
           optimize="${optimize}"
           deprecation="off"
           source="${compile.source}"
           target="${compile.target}"
           srcdir="src/share">
      <classpath>
        <path refid="tomcat_util.class.path"/>
        <pathelement location="${tomcat.build}/lib/container/tomcat_util.jar"/>
      </classpath>
      <include name="org/apache/tomcat/core/**"/>
    </javac>
    <copy todir="${tomcat.build}/classes/org/apache/tomcat">
            <fileset dir="src/share/org/apache/tomcat">
                <include name="**/*.properties"/>
                <include name="**/*.dtd"/>
            </fileset>
        </copy>
    <jar jarfile="${tomcat.build}/lib/common/tomcat_core.jar"
         basedir="${tomcat.build}/classes">
      <include name="org/apache/tomcat/core/**"/>
      <include name="org/apache/tomcat/resources/**"/>
    </jar>
  </target>

  <!-- ==================== Tomcat config ==================== -->

  <target name="tomcat-startup" depends="prepare,tomcat_core">
    <javac destdir="${tomcat.build}/classes"
           debug="${debug}"
           optimize="${optimize}"
           deprecation="off"
           source="${compile.source}"
           target="${compile.target}"
           srcdir="src/share">
      <classpath>
        <path refid="xml-apis.class.path"/>
        <pathelement location="${tomcat-util.jar}"/>
        <pathelement location="${tomcat.build}/lib/container/tomcat_util.jar"/>
        <pathelement location="${tomcat.build}/lib/common/tomcat_core.jar"/>
      </classpath>
      <include name="org/apache/tomcat/startup/**"/>
    </javac>

    <jar jarfile="${tomcat.build}/lib/common/etomcat.jar"
         basedir="${tomcat.build}/classes"
         manifest="src/build/manifests/manifest.embedded">
      <include name="org/apache/tomcat/startup/**"/>
    </jar>
  </target>

  <!-- ==================== Servlet 22 (default) implementation ========== -->
  <target name="facade22" depends="prepare,tomcat_core,jasper">
    <javac
           destdir="${tomcat.build}/classes"
           debug="${debug}"
           optimize="${optimize}"
           deprecation="off"
           source="${compile.source}"
           target="${compile.target}"
           srcdir="src/facade22">
      <classpath>
        <path refid="tomcat_util.class.path"/>
        <path refid="xml-apis.class.path"/>
	    <pathelement location="${servlet22.jar}"/>
        <pathelement location="${tomcat.build}/lib/container/tomcat_util.jar"/>
        <pathelement location="${tomcat.build}/lib/common/tomcat_core.jar"/>
      </classpath>
      <include name="org/apache/tomcat/facade/**"/>
    </javac>
    <jar jarfile="${tomcat.build}/lib/container/facade22.jar"
         basedir="${tomcat.build}/classes"
         manifest="src/build/manifests/manifest.facade22">
      <include name="org/apache/tomcat/facade/**"/>
    </jar>
  </target>


  <target name="commons-prepare" depends="prepare" if="commons-dbcp.complete" >
  <!-- Because of way the build.xml files are set up, we can't call them from
       inside this file.  They need to be run before this script is executed
       if you want the PooledJDBCRealm code to be built.
    <ant antfile="../jakarta-commons/collections/build.xml" target="dist"/>
    <ant antfile="../jakarta-commons/pool/build.xml" target="dist"/>
    <ant antfile="../jakarta-commons/dbcp/build.xml" target="dist"/>
  -->    
    <echo message="copying commons jars for DBCP support"/>
    <copy file="${commons-dbcp.jar}" todir="${tomcat.build}/lib/container"/>
    <copy file="${commons-pool.jar}" todir="${tomcat.build}/lib/container"/>
    <copy file="${commons-collections.jar}" todir="${tomcat.build}/lib/container"/>
  </target>

  <target name="jmx.prepare" depends="prepare" if="jmx-present" >
    <echo message="copying JMX for JMX support"/>
    <copy todir="${tomcat.build}/lib/container/"
          file="${jmx.jar}"/>
  </target>
  
  <target name="jmxtools.prepare" depends="prepare" if="jmxtools-present" >
    <echo message="copying JMX tools jar for JMX HTTP Adapter support"/>
    <copy todir="${tomcat.build}/lib/container/"
          file="${jmxtools.jar}"/>
  </target>

  <!-- ====================  "Standard" interceptors  ========== -->
  <target name="tomcat_modules" depends="prepare,commons-prepare,jmx.prepare,jmxtools.prepare">
    <javac destdir="${tomcat.build}/classes"
           srcdir="src/share"
           debug="${debug}"
           optimize="${optimize}"
           source="${compile.source}"
           target="${compile.target}"
           deprecation="off">
      <classpath>
        <path refid="tomcat_util.class.path"/>
        <path refid="xml-apis.class.path"/>
        <pathelement location="${jmx.jar}"/>
        <pathelement location="${tomcat.build}/lib/container/tomcat_util.jar"/>
        <pathelement location="${tomcat.build}/lib/common/tomcat_core.jar"/>
        <fileset dir="${tomcat.build}/lib/container">
            <include name="*.jar"/>
        </fileset>
      </classpath>
      <include name="org/apache/tomcat/modules/**"/>
      <exclude
          name="org/apache/tomcat/modules/config/LoaderInterceptor12.java"
          unless="jdk12.present"/>
      <exclude
          name="org/apache/tomcat/modules/aaa/PooledJDBCRealm.java"
          unless="commons-dbcp.complete"/>
      <exclude
          name="org/apache/tomcat/modules/config/PolicyInterceptor.java"
          unless="jdk12.present"/>
    </javac>

    <jar
        jarfile="${tomcat.build}/lib/container/tomcat_modules.jar"
        basedir="${tomcat.build}/classes">
      <include name="org/apache/tomcat/modules/**"/>
    </jar>
  </target>

  <!-- ====================  Coyote  ========== -->

  <target name="coyote" depends="prepare,tomcat_core,tomcat_modules"  >
    <echo message="Building Coyote"/>

    <!-- This can't be compiled while j-t-c is built - tomcat is built
         after, so files depending on 3.3 are ignored -->
    <ant dir="${jtc.coyote.home}" target="compile.tomcat33" >
        <property name="tomcat33.home" value="${tomcat.build}"/>
    </ant>

    <copy tofile="${tomcat.build}/lib/common/tomcat33-resource.jar"
          file="${jtc.http11.lib}/tomcat33-resource.jar"/>

    <copy tofile="${tomcat.build}/lib/container/tomcat-coyote.jar"
          file="${jtc.coyote.lib}/tomcat-coyote.jar"/>

    <copy tofile="${tomcat.build}/lib/container/tomcat33-coyote.jar"
          file="${jtc.coyote.lib}/tomcat33-coyote.jar"/>

    <copy tofile="${tomcat.build}/lib/container/tomcat-http11.jar"
          file="${jtc.http11.lib}/tomcat-http11.jar"/>

    <copy todir="${tomcat.build}/lib/container"
          file="${jtc.jk.home}/build/lib/tomcat-jk2.jar"/>

    <copy todir="${tomcat.build}/conf"
          file="${jtc.jk.home}/conf/jk2.properties"/>

  </target>

  <!-- ====================  Jasper ( 1.0 )  ========== -->
  <target name="jasper" depends="prepare">
    <javac
           destdir="${tomcat.build}/classes"
           srcdir="src/share"
           debug="${debug}"
           optimize="${optimize}"
           source="${compile.source}"
           target="${compile.target}"
           deprecation="off">
      <classpath>
        <path refid="xml-apis.class.path"/>
        <path refid="tomcat_util.class.path"/>
        <pathelement location="${servlet22.jar}"/>
      </classpath>
      <include name="org/apache/jasper/**"/>
      <exclude name="org/apache/jasper/servlet/JasperLoader12.java"
        unless="jdk12.present"/>
    </javac>
    <copy todir="${tomcat.build}/classes/org/apache/jasper">
            <fileset dir="src/share/org/apache/jasper">
                <include name="**/*.properties"/>
                <include name="**/*.dtd"/>
            </fileset>
        </copy>
    <jar jarfile="${tomcat.build}/lib/common/jasper-runtime.jar"
         basedir="${tomcat.build}/classes" >
      <include name="org/apache/jasper/Constants.class"/>
      <include name="org/apache/jasper/JasperException.class"/>
      <include name="org/apache/jasper/Options.class"/>
      <include name="org/apache/jasper/runtime/**"/>
      <include name="org/apache/jasper/resources/**"/>
    </jar>

    <jar jarfile="${tomcat.build}/lib/container/jasper.jar"
         basedir="${tomcat.build}/classes"
         manifest="src/build/manifests/manifest.jspc" >
      <include name="org/apache/jasper/**"/>
      <!--
      <exclude name="org/apache/jasper/Constants.class"/>
      <exclude name="org/apache/jasper/JasperException.class"/>
      <exclude name="org/apache/jasper/Options.class"/>
      <exclude name="org/apache/jasper/runtime/**"/>
      <exclude name="org/apache/jasper/resources/**"/>
       -->
    </jar>
  </target>

  <target name="tomcat-jars" depends="prepare,dep.tomcat-util,tomcat_util,stop-tomcat.jar,tomcat_core,jasper,tomcat_modules,tomcat.jar,facade22,tomcat-startup,tomcat-ant">
  </target>

  <target name="tomcat-jars-new" depends="tomcat-jars">
  </target>

  
  <!-- ==================== Ant utilities ========== -->
  <target name="tomcat-ant" depends="detect" if="ant15-present" >
    <delete dir="${tomcat.build}/ant" />
    <javac srcdir="src/share"
	   target="${compile.target}"
           source="${compile.source}"
           destdir="${tomcat.build}/classes" >
       <include name="org/apache/tomcat/ant/*.java" />
       <classpath>
        <path refid="ant.class.path"/>
       </classpath>
    </javac>
    <mkdir dir="${tomcat.build}/ant" />

    <jar jarfile="${tomcat.build}/ant/tomcat-ant.jar">
        <fileset dir="${tomcat.build}/classes">
            <include name="org/apache/tomcat/ant/*.class"/>
        </fileset>
        <fileset dir="src/share/org/apache/tomcat/ant">
            <include name="META-INF/*.properties"/>
        </fileset>
    </jar>
  </target>

  <!-- ==================== Build all web applications ==================== -->

  <target name="webapps" depends="prepare,tomcat_util,tomcat_core">
    <!-- Examples -->
    <mkdir dir="${tomcat.build}/webapps/examples"/>
    <copy todir="${tomcat.build}/webapps/examples">
      <fileset dir="src/examples"/>
    </copy>
    <javac srcdir="src/examples/WEB-INF/classes"
	   target="${compile.target}"
           source="${compile.source}"
           optimize="${optimize}"
           destdir="${tomcat.build}/webapps/examples/WEB-INF/classes"
           classpath="${tomcat.build}/classes;${servlet22.jar}"/>
    <javac srcdir="src/examples/jsp/plugin/applet"
	   target="${compile.target}"
           source="${compile.source}"
           optimize="${optimize}"
           destdir="${tomcat.build}/webapps/examples/jsp/plugin/applet"/>


      <!-- Root context -->
    <mkdir dir="${tomcat.build}/webapps/ROOT"/>
    <copy todir="${tomcat.build}/webapps/ROOT">
      <fileset dir="src/webpages"/>
    </copy>
    <copy todir="${tomcat.build}/webapps/ROOT"
          file="src/webpages/index.html"
          overwrite="yes">
	    <filterset>
	        <filter token="NAME" value="${tomcat.name.release}"/>
	        <filter token="VERSION" value="${version.release}"/>
	    </filterset>
        </copy>
    <copy todir="${tomcat.build}/webapps/ROOT/doc">
      <fileset dir="src/doc"/>
    </copy>
    <mkdir dir="${tomcat.build}/webapps/ROOT/doc/jk2" />
    <mkdir dir="${tomcat.build}/webapps/ROOT/doc/jk2/printer" />    
    <ant dir="${tomcat-jk.home}/xdocs" />
    <copy todir="${tomcat.build}/webapps/ROOT/doc/jk2">
      <fileset dir="${tomcat-jk.home}/build/docs"/>
    </copy>

      <!-- admin context -->
    <mkdir dir="${tomcat.build}/webapps/admin"/>
        <mkdir dir="${tomcat.build}/webapps/admin/WEB-INF/lib"/>
    <copy todir="${tomcat.build}/webapps/admin">
      <fileset dir="src/admin"/>
    </copy>
    <copy tofile="${tomcat.build}/webapps/admin/WEB-INF/lib/ant.jar"
          file="${ant.jar}"/>
    <copy tofile="${tomcat.build}/webapps/admin/WEB-INF/lib/ant-launcher.jar"
          file="${ant-launcher.jar}" failonerror="false" />
    <jar jarfile="${tomcat.build}/webapps/admin/WEB-INF/lib/tomcat_util_test.jar"
         basedir="${tomcat.build}/classes">
      <include name="org/apache/tomcat/util/**"/>
    </jar>
    <javac srcdir="src/admin/WEB-INF/classes"
	   target="${compile.target}"
           source="${compile.source}"
           debug="${debug}"
           optimize="${optimize}"
           destdir="${tomcat.build}/webapps/admin/WEB-INF/classes">
           <classpath>
             <path refid="ant.class.path"/>           
             <pathelement location="${tomcat.build}/classes"/>
             <pathelement location="${servlet22.jar}"/>
             <pathelement location="${tomcat-util.jar}"/>
           </classpath>
    </javac>

  </target>

  <!-- ==================== Build the internal test app =================== -->

  <target name="sanity-test">
    <ant antfile="src/tests/build.xml" />
  </target>

  <target name="watchdog-web-based">
    <ant antfile="src/tests/build.xml" target="watchdog" />
  </target>

  <target name="tests" depends="main,sanity-test,watchdog-web-based" />

  <target name="test.war">
    <jar jarfile="${tomcat.dist}/webapps/test.war"
         basedir="${tomcat.build}/webapps/test"
         includes="**"/>
  </target>

  <target name="tests.dist" depends="tests" >
    <jar jarfile="${tomcat.dist}/webapps/test.war"
         basedir="${tomcat.build}/webapps/test"
         includes="**"/>
  </target>

  <target name="watchdog.dist" depends="tests" >
    <jar jarfile="${tomcat.dist}/webapps/jsp-tests.war"
         basedir="${tomcat.build}/webapps/jsp-tests"
         includes="**"/>
    <jar jarfile="${tomcat.dist}/webapps/servlet-tests.war"
         basedir="${tomcat.build}/webapps/servlet-tests"
         includes="**"/>
  </target>

  <!-- ==================== Build the sample add-on modules =================== -->

  <target name="sample.add-ons">
    <ant antfile="proposals/JmxSupport/build.xml" />
    <ant antfile="proposals/PasswordPrompter/build.xml"/>
    <ant antfile="proposals/StreamHandler/build.xml" />
    <ant antfile="proposals/Log4jHelper/build.xml" />
  </target>

  <target name="sample.add-ons.dist">
    <ant antfile="proposals/JmxSupport/build.xml" target="jmx.support.war"/>
    <ant antfile="proposals/PasswordPrompter/build.xml" target="password.prompter.war"/>
    <ant antfile="proposals/StreamHandler/build.xml" target="stream.handler.war" />
    <ant antfile="proposals/Log4jHelper/build.xml" target="log4j.support.war" />
  </target>

  <target name="sample.add-ons.clean">
    <ant antfile="proposals/JmxSupport/build.xml" target="clean"/>
    <ant antfile="proposals/PasswordPrompter/build.xml" target="clean"/>
    <ant antfile="proposals/StreamHandler/build.xml" target="clean" />
    <ant antfile="proposals/Log4jHelper/build.xml" target="clean" />
  </target>

  <!-- ==================== Embeded tomcat ======== -->

  <target name="etomcat" depends="init">
    <mkdir dir="${tomcat.build}/classes"/>
    <javac destdir="${tomcat.build}/classes"
	   target="${compile.target}"
           source="${compile.source}"
           debug="${debug}"
           optimize="${optimize}"
           deprecation="off"
           srcdir="src/share">
      <classpath>
        <pathelement location="${servlet22.jar}"/>
        <pathelement location="${tomcat-util.jar}"/>
      </classpath>
      <include name="org/apache/**"/>
    </javac>

    <javac destdir="${tomcat.build}/classes"
	   target="${compile.target}"
           source="${compile.source}"
           debug="${debug}"
           optimize="${optimize}"
           deprecation="off"
           srcdir="${jtc.util.home}/java">
      <classpath>
        <path refid="crypto.class.path"/>
        <pathelement location="${servlet22.jar}"/>
      </classpath>
      <include name="org/apache/**"/>
      <exclude name="**/util/net/JSSE*" unless="jsse.present"/>
      <exclude name="**/util/net/PureTLS*" unless="puretls.present"/>
    </javac>

    <javac
	   target="${compile.target}"
           source="${compile.source}"
           destdir="${tomcat.build}/classes"
           debug="${debug}"
           optimize="${optimize}"
           deprecation="off"
           srcdir="src/facade22">
      <classpath>
        <pathelement location="${servlet22.jar}"/>
        <pathelement location="${tomcat.build}/classes"/>
      </classpath>
      <include name="org/apache/tomcat/facade/**"/>
    </javac>

    <copy todir="${tomcat.build}/classes">
      <fileset dir="src/share">
        <include name="org/apache/tomcat/**/*.properties"/>
        <include name="org/apache/tomcat/**/*.dtd"/>
      </fileset>
    </copy>

    <copy todir="${tomcat.build}/classes">
      <fileset dir="${jtc.util.home}/java">
        <include name="org/apache/tomcat/**/*.properties"/>
        <include name="org/apache/tomcat/**/*.dtd"/>
      </fileset>
    </copy>

    <property name="etomcat" value="${tomcat.build}/../etomcat" />

    <mkdir dir="${etomcat}" />
    <copy todir="${etomcat}">
      <fileset dir="${jaxp.home}">
          <include name="jaxp.jar" if="jaxp-present"/>
          <include name="parser.jar" if="jaxp10-present"/>
          <include name="crimson.jar" if="jaxp11-present"/>
          <include name="xalan.jar" if="jaxp11-present"/>
          <include name="xerces.jar" if="xerces-present"/>
      </fileset>
    </copy>
    <copy file="${servlet22.jar}" tofile="${etomcat}/servlet.jar" />

    <jar jarfile="${etomcat}/webserver.jar"
         basedir="${tomcat.build}/classes"
         manifest="src/build/manifests/manifest.webserver">
      <include name="org/apache/**"/>
    </jar>
  </target>


  <!-- ==================== Copy the files to distribution format ======== -->
  <target name="dist" depends="main,dist.prepare,javadoc,dist.war">
  </target>

  <target name="dist.prepare" >

    <mkdir dir="${tomcat.dist}"/>
    <mkdir dir="${tomcat.dist}/webapps"/>
    <copy todir="${tomcat.dist}">
      <fileset dir="${tomcat.build}" >
        <exclude name="classes/**"/>
        <exclude name="webapps/**"/>
      </fileset>
    </copy>

    <!-- Change permissions for unix -->
    <chmod perm="+x" file="${tomcat.dist}/bin/tomcat"/>
    <chmod perm="+x" file="${tomcat.dist}/bin/jspc"/>
    <chmod perm="+x" file="${tomcat.dist}/bin/startup"/>
    <chmod perm="+x" file="${tomcat.dist}/bin/shutdown"/>
  </target>

  <target name="javadoc" depends="main,webapps,tomcat-jars">
    <!-- Add Tomcat internal javadoc -->
    <mkdir dir="${tomcat.build}/webapps/ROOT/javadoc"/>
    <javadoc packagenames="org.apache.*"
             sourcepath="src/share;src/facade22;${jtc.util.home}/java"
             classpathref="javadoc.classpath"
             destdir="${tomcat.build}/webapps/ROOT/javadoc"
             author="true"
             version="true"
             use="true"
             windowtitle="Tomcat and Jasper Internal API"
             doctitle="Tomcat and Jasper Internal API"
             bottom="Copyright © 2001 Apache Software Foundation. All Rights Reserved."
             />
  </target>
  <target name="javadoc.tomcat" depends="main,webapps,tomcat-jars">
    <javadoc packagenames="org.apache.tomcat.*"
             sourcepath="src/share;src/facade22;${jtc.util.home}/java"
             classpathref="javadoc.classpath"
             destdir="${tomcat.build}/webapps/ROOT/javadoc"
             author="true"
             version="true"
             use="true"
             windowtitle="Tomcat API"
             doctitle="Tomcat API"
             bottom="Copyright © 2001 Apache Software Foundation. All Rights Reserved."/>
  </target>
  <target name="javadoc.tomcat.core" depends="main,webapps,tomcat-jars">
    <javadoc packagenames="org.apache.tomcat.core"
             sourcepath="src/share;src/facade22"
             classpathref="javadoc.classpath"
             destdir="${tomcat.build}/webapps/ROOT/javadoc"
             author="true"
             version="true"
             use="true"
             windowtitle="Tomcat Core API"
             doctitle="Tomcat Core API"
             bottom="Copyright © 2001 Apache Software Foundation. All Rights Reserved."/>
  </target>
  <target name="javadoc.tomcat.facade" depends="main,webapps,tomcat-jars">
    <javadoc packagenames="org.apache.tomcat.facade"
             sourcepath="src/share;src/facade22"
             classpathref="javadoc.classpath"
             destdir="${tomcat.build}/webapps/ROOT/javadoc"
             author="true"
             version="true"
             use="true"
             windowtitle="Tomcat Facade API"
             doctitle="Tomcat Facade API"
             bottom="Copyright © 2001 Apache Software Foundation. All Rights Reserved."/>
  </target>
  <target name="javadoc.tomcat.modules" depends="main,webapps,tomcat-jars">
    <javadoc packagenames="org.apache.tomcat.modules.*"
             sourcepath="src/share;src/facade22"
             classpathref="javadoc.classpath"
             destdir="${tomcat.build}/webapps/ROOT/javadoc"
             author="true"
             version="true"
             use="true"
             windowtitle="Tomcat Modules API"
             doctitle="Tomcat Modules API"
             bottom="Copyright © 2001 Apache Software Foundation. All Rights Reserved."/>
  </target>
  <target name="javadoc.tomcat.startup" depends="main,webapps,tomcat-jars">
    <javadoc packagenames="org.apache.tomcat.startup"
             sourcepath="src/share;src/facade22"
             classpathref="javadoc.classpath"
             destdir="${tomcat.build}/webapps/ROOT/javadoc"
             author="true"
             version="true"
             use="true"
             windowtitle="Tomcat Startup API"
             doctitle="Tomcat Startup API"
             bottom="Copyright © 2001 Apache Software Foundation. All Rights Reserved."/>
  </target>
  <target name="javadoc.tomcat.util" depends="main,webapps,tomcat-jars">
    <javadoc packagenames="org.apache.tomcat.util.*"
             sourcepath="src/share;src/facade22;${jtc.util.home}/java"
             classpathref="javadoc.classpath"
             destdir="${tomcat.build}/webapps/ROOT/javadoc"
             author="true"
             version="true"
             use="true"
             windowtitle="Tomcat Utilities API"
             doctitle="Tomcat Utilities API"
             bottom="Copyright © 2001 Apache Software Foundation. All Rights Reserved."/>
  </target>
  <target name="javadoc.jasper" depends="main,webapps,tomcat-jars">
    <javadoc packagenames="org.apache.jasper.*"
             sourcepath="src/share;src/facade22"
             classpathref="javadoc.classpath"
             destdir="${tomcat.build}/webapps/ROOT/javadoc"
             author="true"
             version="true"
             use="true"
             windowtitle="Jasper API"
             doctitle="Jasper API"
             bottom="Copyright © 2001 Apache Software Foundation. All Rights Reserved."/>
  </target>

  <target name="dist.war" depends="dist.prepare" >
    <delete dir="${tomcat.dist}/webapps/examples" />
    <delete dir="${tomcat.dist}/webapps/admin" />
    <delete dir="${tomcat.dist}/webapps/ROOT" />
    <!-- create webapp WARS -->
    <jar jarfile="${tomcat.dist}/webapps/examples.war"
         basedir="${tomcat.build}/webapps/examples"
         includes="**"/>

    <jar jarfile="${tomcat.dist}/webapps/admin.war"
         basedir="${tomcat.build}/webapps/admin"
         includes="**"/>

    <jar jarfile="${tomcat.dist}/webapps/ROOT.war"
         basedir="${tomcat.build}/webapps/ROOT"
         includes="**"/>
  </target>

  <target name="dist.nojavadoc" depends="dist.war">
  </target>

  <!-- =================================================================== -->
  <!-- Packages the distribution with ZIP                                  -->
  <!-- =================================================================== -->
  <target name="dist-zip" depends="dist">
    <zip zipfile="${Name}-${version}.zip" basedir="${tomcat.dist}" includes="**"/>
  </target>

  <target name="main.lite" depends="tomcat,webapps"
          description="Build tomcat in build/, without packaging. Includes only required dependent code" >
  </target>

  <target name="main" depends="main.lite,deps,coyote"
          description="Build tomcat in build/, without packaging. Include coyote" >
  </target>

  <!-- ==================== Admin & agreagate ==================== -->

  <!-- The self-test app should be removed in the release, but it's
       useful to have it builded by default -->
  <target name="tomcat" depends="prepare,tomcat-jars"
          description="Build tomcat core only" >
  </target>

  <target name="clean-classes" depends="init">
    <delete dir="${tomcat.build}/classes"/>
    <delete dir="${tomcat.build}/lib"/>
  </target>

  <target name="clean" depends="init">
    <delete dir="${tomcat.build}"/>
    <delete dir="${tomcat.dist}"/>
    <delete dir="${tomcat.build}/../etomcat"/>
    <ant dir="${jakarta-tomcat-connectors}/util" target="clean" />
    <ant dir="${jakarta-tomcat-connectors}/coyote" target="clean" />
    <ant dir="${jakarta-tomcat-connectors}/http11" target="clean" />
    <ant dir="${jakarta-tomcat-connectors}/jk" target="clean" />
    <ant dir="${jakarta-tomcat-connectors}/jni" target="clean" />
  </target>

  <target name="all" depends="clean,dist"/>
  
  <target name="help" >
    <echo message="Usefull targets: "/>
    <echo message="" />
    <echo message="  tomcat-jars: basic build for all the jars" />
    <echo message="  webapps: example, root, admin " />
    <echo message="  tests: test webapp" />
    <echo message="  webapptests.dist,watchdog.dist:  generate wars " />
    <echo message="  dist:  javadocs, wars, delete expanded dirs" />
    <echo message="  clean-classes: remove classes and jars ( remake with tomcat-jars )" />
  </target>

</project>
