<?xml version="1.0" ?>
<!DOCTYPE project [
        <!ENTITY properties SYSTEM "../xmls/properties.xml">
        <!ENTITY paths  SYSTEM "../xmls/path_refs.xml">
        <!ENTITY taskdefs SYSTEM "../xmls/taskdefs.xml">
        <!ENTITY targets SYSTEM "../xmls/targets.xml">
]>

<!-- ===================================================================
<description>
   Tools Component file for Axis

Notes:
   This is a build file for use with the Jakarta Ant build tool.

Prerequisites:

   jakarta-ant from http://jakarta.apache.org

Build Instructions:
   To compile
        ant compile
   To execute
        ant run

Author:
  Matt Seibert mseibert@us.ibm.com

Copyright:
  Copyright (c) 2002-2003 Apache Software Foundation.
</description>
==================================================================== -->

<project name="axis tools" default="compile">
 <description>
 Builds the tools jars used with Axis
 </description>

<property name="axis.home" location=".." />
<property name="tools.dir" location="${axis.home}/tools" />

<property name="componentName" value="org/apache/axis/tools/ant" />
        &properties;
        &paths;
        &taskdefs;
        &targets;
<property name="tools.build.dir" location="${build.dir}/tools" />


<target name="clean" description="cleanup">
    <property name="dir.to.clean" 
      location="${tools.build.dir}/${componentName}" />
    <echo message="Removing ${dir.to.clean}" />
    <delete dir="${dir.to.clean}" />
    <delete file="${build.lib}/axis-ant.jar" failonerror="false"/>
</target>

<target name="copy" depends="setenv"/>

<target name="compile" depends="copy" unless="axis-ant.present"
  description="compile everthing and make the JARs">
  <echo message="Compiling tools.*"/>
  <mkdir dir="${tools.build.dir}"/>
    <!-- build my ForEach task -->
  <echo message="Building ForEach" />
  <javac srcdir="${tools.dir}" 
      debug="${debug}"
      source="${source}"
      nowarn="${nowarn}"
      destdir="${tools.build.dir}">
    <classpath refid="classpath"/>
    <include name="${componentName}/foreach/*.java" />
  </javac>

    <!-- build the RunAxisFunctionalTest task -->
  <echo message="Building RunAxisFunctionalTest" />
  <javac srcdir="${tools.dir}" 
      debug="${debug}"
      source="${source}"
      nowarn="${nowarn}"
      destdir="${tools.build.dir}">
    <classpath refid="classpath"/>
    <include name="${componentName}/axis/*.java" />
  </javac>

    <!-- build the wsdl2java and java2wsdl tasks -->
  <echo message="Building WSDL tasks" />
  <javac srcdir="${tools.dir}"
    debug="${debug}"
    source="${source}"
    nowarn="${nowarn}"
    destdir="${tools.build.dir}">
    <classpath>
      <pathelement location="${build.lib}/${name}.jar"/>
      <pathelement location="${build.lib}/${jaxrpc}.jar"/>
      <path refid="classpath"/>
    </classpath>
    <include name="${componentName}/wsdl/*.java" />
  </javac>

  <copy todir="${tools.build.dir}/${componentName}/foreach" >
     <fileset dir="${tools.dir}/${componentName}/foreach" excludes="**/*.java"/>
  </copy>

  <copy todir="${tools.build.dir}" >
    <fileset dir="${tools.dir}"
      includes="*-tasks.properties"/>
    <fileset dir="${tools.dir}" includes="org/**/*.xml"/>
    <fileset dir="${tools.dir}" file="log4j.properties"/>
  </copy>
  
  <tstamp/>
  <jar jarfile="${build.lib}/axis-ant.jar" >
    <fileset dir="${tools.build.dir}"
      includes="**/*.class, **/*.xml, **/*.properties">
    </fileset>
    <manifest>
      <section name="org/apache/axis/tools">
        <attribute name="Implementation-Title" value="Apache Axis"/>
        <attribute name="Implementation-Version" value="${axis.version} ${TSTAMP} ${TODAY}"/> 
        <attribute name="Implementation-Vendor" value="Apache Web Services"/>
      </section>
    </manifest>
  </jar>
</target>

<target name="test" unless="axis-ant.present" description="tests">
   <ant inheritAll="${ant.inheritAll}" inheritRefs="${ant.inheritRefs}" dir="${tools.dir}" antfile="test.xml" /> 
</target>

<property name="xdocs.dir" location="${env.ANT_HOME}/proposal/xdocs" />
<path id="xdoclet.extra.classpath">
  <fileset dir="${build.lib}">
    <include name="**/*.jar"/>
  </fileset>
</path>

<property name="xdoclet.extra.classpath.asprop"
  refid="xdoclet.extra.classpath"/>

<!-- probe for xdocs, which is only in CVS, not redist packages --> 
<target name="probe-xdocs" >
  <available property="xdocs.found" file="${xdocs.dir}/build.xml"/>
</target>

<target name="want-xdocs" depends="probe-xdocs">
  <fail unless="xdocs.found">
    We need the proposal/xdocs source tree from Ant in ${env.ANT_HOME}/proposal/xdocs
   </fail>
</target>

  <property name="build.antdocs.dir" location="${build.dir}/xdocs"/>
  <property name="gen.dir" location="${build.antdocs.dir}/gen"/>
  <property name="gen.dir" location="${build.antdocs.dir}/gen"/>
  <property name="build.docs.dir" location="${build.antdocs.dir}/docs"/>
  <property name="build.xdocs.dir" location="${build.antdocs.dir}/xdocs"/>

<target name="xdocs" depends="want-xdocs,compile"
  description="Run xdoclet over the ant tasks to create doc pages"
  if="xdocs.found">
  <echo>
    running xdocs with classpath=${xdoclet.extra.classpath.asprop}
  </echo>  

  <ant inheritAll="${ant.inheritAll}" inheritRefs="${ant.inheritRefs}" dir="${xdocs.dir}" 
      target="gen-and-prepare-for-docs">
    <property name="src.dir" location="org/apache/axis/tools/ant/"/>
    <property name="src.root" location="."/>
    <property name="xdoclet.extra.classpath" 
      value="${xdoclet.extra.classpath.asprop}"/>
    <property name="gen.dir" location="${gen.dir}"/>
    <property name="xdocs.dir" location="${build.xdocs.dir}"/>
    <property name="build.docs.dir" location="${build.docs.dir}"/>
  </ant>
</target>

<target name="dvsl" depends="want-xdocs">
  <ant inheritAll="${ant.inheritAll}" inheritRefs="${ant.inheritRefs}" dir="${xdocs.dir}/dvsl">
    <property name="src.dir" location="org/apache/axis/tools/ant/"/>
    <property name="build.dir" location="${build.antdocs.dir}"/>
    <property name="taskdocs.src" location="${gen.dir}"/>
    <property name="xdocs.dir" location="${build.xdocs.dir}"/>
    <property name="docs.dest" location="${build.docs.dir}"/>
  </ant>  
</target>

</project>
