<project name="Tomcat 5.0 Netbuild" default="build" basedir=".">


  <!-- ===================== Initialize Property Values =================== -->

  <!-- See "build.properties.sample" in the top level directory for all     -->
  <!-- property values you must customize for successful building!!!        -->
  <property file="${user.home}/build.properties"/>
  <property file="build.properties"/>
  <property file="build.properties.default"/>

  <!-- Project Properties -->
  <property name="name"                  value="Apache Tomcat" />
  <property name="year"                  value="2003" />
  <property name="version"               value="5.0" />
  <property name="project"               value="jakarta-tomcat" />
  <property name="final.name"            value="${project}-${version}" />
  <property name="final-src.name"        value="${project}-${version}-src" />

  <!-- CVSROOT -->
  <property name="cvsroot" 
           value=":pserver:anoncvs@cvs.apache.org:/home/cvspublic" />

  <!-- Subprojects -->
  <property name="api.project"           value="jakarta-servletapi-5" />
  <property name="tomcat.project"        value="jakarta-tomcat-5" />
  <property name="catalina.project"      value="jakarta-tomcat-catalina" />
  <property name="jtc.project"           value="jakarta-tomcat-connectors" />
  <property name="jasper.project"        value="jakarta-tomcat-jasper" />

  <!-- Dependent projects -->
  <property name="commons-daemon.project"  value="jakarta-commons/daemon" />

  <!-- Source dependencies -->
  <property name="api.home"
           value="${basedir}/${api.project}"/>
  <property name="catalina.home" 
           value="${basedir}/${catalina.project}"/>
  <property name="jasper.home"
           value="${basedir}/${jasper.project}/jasper2"/>
  <property name="jtc.home"
           value="${basedir}/${jtc.project}"/>
  <property name="tomcat.home"
           value="${basedir}/${tomcat.project}"/>

  <target name="build" depends="check.source,check.source.depends,get.source,get.source.depends"
   description="Builds all components">

    <ant dir="${tomcat.home}" target="download" />
    <ant dir="${tomcat.home}" target="deploy" />

  </target>

  <target name="checkout"
          description="Update or checkout required sources from CVS">

    <echo level="info"
        message="If the checkout fails, run `cvs -d ${cvsroot} login` and try again. The password for the anonymous CVS access is `anoncvs`" />

    <cvs cvsroot="${cvsroot}" quiet="true"
         command="checkout -P ${tomcat.project}" 
         dest="${basedir}" compression="true" />
    <cvs cvsroot="${cvsroot}" quiet="true"
         command="checkout -P ${catalina.project}" 
         dest="${basedir}" compression="true" />
    <cvs cvsroot="${cvsroot}" quiet="true"
         command="checkout -P ${jasper.project}" 
         dest="${basedir}" compression="true" />
    <cvs cvsroot="${cvsroot}" quiet="true"
         command="checkout -P ${jtc.project}" 
         dest="${basedir}" compression="true" />
    <cvs cvsroot="${cvsroot}" quiet="true"
         command="checkout -P ${api.project}" 
         dest="${basedir}" compression="true" />

  </target>

  <target name="checkout.depends"
          description="Update or checkout dependent sources from CVS">

    <cvs cvsroot="${cvsroot}" quiet="true"
         command="checkout -P jakarta-commons/LICENSE" 
         dest="${basedir}" compression="true" />
    <cvs cvsroot="${cvsroot}" quiet="true"
         command="checkout -P ${commons-daemon.project}" 
         dest="${basedir}" compression="true" />

  </target>

  <!-- *************** UTILITY TARGETS *************** -->

  <target name="check.source">

    <available property="source.exists"
                   file="${basedir}/${tomcat.project}" type="dir" />

  </target>

  <target name="check.source.depends">

    <available property="source.depends.exists" 
                   file="${basedir}/${commons-daemon.project}" type="dir" />

  </target>

  <target name="get.source" unless="source.exists">

    <antcall target="checkout" />

  </target>

  <target name="get.source.depends" unless="source.depends.exists">

    <antcall target="checkout.depends" />

  </target>

</project>
