<?xml version="1.0"?>
<project name="Simple" default="build" basedir=".">

   <target name="layout">
      <property name="source.path" value="src"/>
      <property name="javadoc.path" value="javadoc"/>
      <property name="build.path" value="build"/>
      <property name="jar.path" value="jar"/>
      <property name="test.path" value="test"/>
      <property name="lib.path" value="lib"/>
      <property name="version" value="2.3.2"/>
   </target>

   <target name="clean" depends="layout">
      <delete dir="${build.path}"/>
      <delete dir="${jar.path}"/>
   </target>

   <target name="prepare" depends="clean">
      <mkdir dir="${build.path}"/>
      <mkdir dir="${jar.path}"/>
   </target>

   <target name="build" depends="prepare">
      <javac srcdir="${source.path}" destdir="${build.path}" debug="true" debuglevel="lines,vars,source" encoding="UTF-8">
         <classpath>
            <fileset dir="${lib.path}">
               <include name="**/*.jar"/>
            </fileset>
         </classpath>  
      </javac>
      <mkdir dir="${build.path}/META-INF"/>
      <copy todir="${build.path}/META-INF">
         <fileset file="LICENSE.txt"/>
      </copy>
      <jar jarfile="${jar.path}/simple-xml-${version}.jar" basedir="${build.path}"/>
      <delete dir="${build.path}"/>
   </target>

   <target name="test" depends="layout">
      <ant antfile="build.xml" dir="${test.path}" inheritall="false"/>
      <delete dir="${build.path}"/>
   </target>

   <target name="javadoc" depends="layout">
      <mkdir dir="${javadoc.path}"/>
      <javadoc sourcepath="${source.path}" packagenames="org.simpleframework.*" destdir="${javadoc.path}" private="false">
         <classpath>
            <fileset dir="${lib.path}">
               <include name="**/*.jar"/>
            </fileset>
         </classpath>  
      </javadoc>
      <delete dir="${build.path}"/>
   </target>

   <target name="all">
      <antcall target="build"/>
      <antcall target="javadoc"/>
      <antcall target="test"/>
   </target>
</project>
