<!--
    Table Viewer Build Script

Tasks:
- compile: Compiles the code.
- jar: Makes the runnable jar file.
- clean: Cleans up the project.
-->

<project name="Java TableMyProject Viewer" default="jar" basedir=".">
  <description>
    simple example build file
  </description>
  <!-- set global properties for this build -->
  <property name="src.dir" location="src"/>
  <property name="build.dir" location="build"/>
  <property name="lib.dir"  location="lib"/>
  <property name="dist.dir"  location="dist/tools"/>
  
  <property name="revision"  value="rUNVERSIONED"/>

  <path id="external.jars">
    <fileset dir="${lib.dir}" includes="**/*.jar"/>
  </path>

  <path id="project.classpath">
    <pathelement location="${src.dir}"/>
    <path refid="external.jars" />
  </path>

  <target name="init">
  </target>

  <target name="compile" description="compile the source " >
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build.dir}"/>
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src.dir}" destdir="${build.dir}"
	   includeAntRuntime="no"
	   includeJavaRuntime="no"
	   classpathref="project.classpath"/>
  </target>

  <target name="jar" depends="compile" description="generate the distribution" >
    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
    <jar jarfile="${dist.dir}/TableViewer-${revision}.jar" basedir="${build.dir}">
	<zipgroupfileset dir="lib/" includes="*.jar" />
	<manifest>
	  <attribute name="Main-Class" value="edu.wpi.first.table_viewer.TableViewer"/>
	</manifest>
    </jar>
  </target>

  <target name="clean" description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build.dir}"/>
    <delete dir="${dist.dir}"/>
  </target>
</project>
