<?xml version="1.0" encoding="utf-8"?>

<project default="jar" name="jline" basedir=".">
  <property name="class.dir" value="build">
  </property>
  <property name="source.dir" value="src/src">
  </property>
  <property name="doc.dir" value="api">
  </property>
  <property name="jar.name" value="jline.jar">
  </property>
  <property name="demo-jar.name" value="jline-demo.jar">
  </property>

  <patternset id="compiler.resources">
    <include name="**/*.properties"/>
    <include name="**/*.gz"/>
    <include name="**/*.gif"/>
    <include name="**/*.png"/>
    <include name="**/*.jpg"/>
  </patternset>

  <target name="clean">
    <delete dir="${class.dir}" quiet="true" />
    <delete file="${jar.name}" quiet="true" />
    <delete file="${demo-jar.name}" quiet="true" />
    <delete dir="${doc.dir}" quiet="true" />
  </target>

  <target name="compile">
    <mkdir dir="${class.dir}" />
    <javac srcdir="${source.dir}" destdir="${class.dir}"
    deprecation="true" debug="true" optimize="false" />
    <copy todir="${class.dir}">
      <fileset dir="${source.dir}/main/resources">
        <patternset refid="compiler.resources" />
      </fileset>
    </copy>
    <copy todir="${class.dir}">
      <fileset dir="${source.dir}/test/resources">
        <patternset refid="compiler.resources" />
      </fileset>
    </copy>
  </target>

  <target name="jar" description="o Creates the jars" depends="compile">
    <jar jarfile="${jar.name}" basedir="${class.dir}"
    includes="**/jline/*.class,**/jline/*.properties" />
    <jar jarfile="${demo-jar.name}" basedir="${class.dir}" includes="**/example/*"/>
  </target>

  <target name="javadoc" description="Creates Javadoc documentation">
    <mkdir dir="${doc.dir}" />
    <javadoc packagenames="jline" sourcepath="${source.dir}/main/java" destdir="${doc.dir}" />
  </target>

</project>
