<?xml version="1.0" ?>

<project
 basedir="."
 default="run"
 name="Thinking in Java, 4th Edition (Refreshed) by Bruce Eckel (chapter: interfaces)">

  <description>
    build.xml for the source code for the interfaces chapter of
    Thinking in Java, 4th Edition (Refreshed) by Bruce Eckel
    Source code available at http://www.MindView.net
    See copyright notice in CopyRight.txt

    Ant available from: http://ant.apache.org/

    To see options, type: ant -p
  </description>

  <condition property="version1.8">
    <equals arg1="1.8" arg2="${ant.java.version}"/>
  </condition>

  <target name="net_mindview_util">
    <javac includeantruntime="false"
     classpath="${basedir}/.."
     srcdir="${basedir}/../net/mindview/util/">
      <compilerarg value="-Xmaxerrs"/>
      <compilerarg value="10"/>
    </javac>
  </target>

  <target name="polymorphism_music">
    <javac includeantruntime="false"
     classpath="${basedir}/.."
     srcdir="${basedir}/../polymorphism/music/">
      <compilerarg value="-Xmaxerrs"/>
      <compilerarg value="10"/>
    </javac>
  </target>

  <target
   depends="net_mindview_util,polymorphism_music"
   description="Build all classes in this directory"
   name="build">
    <fail message="J2SE8 required" unless="version1.8"/>
    <echo message="Building 'interfaces'"/>
    <javac includeantruntime="false"
     classpath="${basedir}/.."
     debug="true"
     srcdir="${basedir}">
      <compilerarg value="-Xmaxerrs"/>
      <compilerarg value="10"/>
    </javac>
    <echo message="Build 'interfaces' succeeded"/>
  </target>

  <target name="AdaptedRandomDoubles">
    <java
     classname="AdaptedRandomDoubles"
     classpath="${java.class.path};${basedir};${basedir}/.."
     dir="../interfaces/"
     failonerror="true"
     fork="true"/>
  </target>

  <target name="Adventure">
    <java
     classname="Adventure"
     classpath="${java.class.path};${basedir};${basedir}/.."
     dir="../interfaces/"
     failonerror="true"
     fork="true"/>
  </target>

  <target name="Factories">
    <java
     classname="Factories"
     classpath="${java.class.path};${basedir};${basedir}/.."
     dir="../interfaces/"
     failonerror="true"
     fork="true"/>
  </target>

  <target name="Games">
    <java
     classname="Games"
     classpath="${java.class.path};${basedir};${basedir}/.."
     dir="../interfaces/"
     failonerror="true"
     fork="true"/>
  </target>

  <target name="HorrorShow">
    <java
     classname="HorrorShow"
     classpath="${java.class.path};${basedir};${basedir}/.."
     dir="../interfaces/"
     failonerror="true"
     fork="true"/>
  </target>

  <target name="RandomDoubles">
    <java
     classname="RandomDoubles"
     classpath="${java.class.path};${basedir};${basedir}/.."
     dir="../interfaces/"
     failonerror="true"
     fork="true"/>
  </target>

  <target name="RandomWords">
    <java
     classname="RandomWords"
     classpath="${java.class.path};${basedir};${basedir}/.."
     dir="../interfaces/"
     failonerror="true"
     fork="true"/>
  </target>

  <target name="TestRandVals">
    <java
     classname="TestRandVals"
     classpath="${java.class.path};${basedir};${basedir}/.."
     dir="../interfaces/"
     failonerror="true"
     fork="true"/>
  </target>

  <target name="Apply">
    <java
     classname="interfaces.classprocessor.Apply"
     classpath="${java.class.path};${basedir};${basedir}/.."
     dir="../interfaces/classprocessor/"
     failonerror="true"
     fork="true"/>
  </target>

  <target name="FilterProcessor">
    <java
     classname="interfaces.interfaceprocessor.FilterProcessor"
     classpath="${java.class.path};${basedir};${basedir}/.."
     dir="../interfaces/interfaceprocessor/"
     failonerror="true"
     fork="true"/>
  </target>

  <target name="StringProcessor">
    <java
     classname="interfaces.interfaceprocessor.StringProcessor"
     classpath="${java.class.path};${basedir};${basedir}/.."
     dir="../interfaces/interfaceprocessor/"
     failonerror="true"
     fork="true"/>
  </target>

  <target name="Music4">
    <java
     classname="interfaces.music4.Music4"
     classpath="${java.class.path};${basedir};${basedir}/.."
     dir="../interfaces/music4/"
     failonerror="true"
     fork="true"/>
  </target>

  <target name="Music5">
    <java
     classname="interfaces.music5.Music5"
     classpath="${java.class.path};${basedir};${basedir}/.."
     dir="../interfaces/music5/"
     failonerror="true"
     fork="true"/>
  </target>

  <target name="NestingInterfaces">
    <java
     classname="interfaces.nesting.NestingInterfaces"
     classpath="${java.class.path};${basedir};${basedir}/.."
     dir="../interfaces/nesting/"
     failonerror="true"
     fork="true"/>
  </target>

  <target
   depends="build"
   description="Compile and run"
   name="run">
    <touch file="failures"/>
    <antcall target="AdaptedRandomDoubles"/>
    <antcall target="Adventure"/>
    <antcall target="Factories"/>
    <antcall target="Games"/>
    <antcall target="HorrorShow"/>
    <antcall target="RandomDoubles"/>
    <antcall target="RandomWords"/>
    <antcall target="TestRandVals"/>
    <antcall target="Apply"/>
    <antcall target="FilterProcessor"/>
    <antcall target="StringProcessor"/>
    <antcall target="Music4"/>
    <antcall target="Music5"/>
    <antcall target="NestingInterfaces"/>
    <delete file="failures"/>
  </target>

  <target description="delete all byproducts" name="clean">
    <delete>
      <fileset dir="${basedir}" includes="**/*.class"/>
      <fileset dir="${basedir}" includes="**/*Output.txt"/>
      <fileset dir="${basedir}" includes="**/log.txt"/>
      <fileset dir="${basedir}" includes="failures"/>
    </delete>
    <echo message="clean successful"/>
  </target>

</project>