<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="all" name="Create Runnable Jar for Limelight">
  <property name="one-jar.dist.dir" value="${basedir}"/>

  <property name="src.dir" location="${basedir}/src"/>
  <property name="libs.dir" location="${basedir}/libs"/>
  <property name="libs.osx64.dir" location="${libs.dir}/osx"/>
  <property name="libs.lin32.dir" location="${libs.dir}/lin32"/>
  <property name="libs.lin64.dir" location="${libs.dir}/lin64"/>
  <property name="libs.win32.dir" location="${libs.dir}/win32"/>
  <property name="libs.win64.dir" location="${libs.dir}/win64"/>

  <property name="lib.dir" location="${basedir}/lib"/>
  <property name="build.dir" location="${basedir}/build"/>

  <property name="classes.dir" location="${basedir}/classes"/>

  <target name="init">
    <mkdir dir="${classes.dir}"/>
    <mkdir dir="${classes.dir}/lib"/>
    <mkdir dir="${classes.dir}/src"/>
    <mkdir dir="${build.dir}"/>
  </target>

  <import file="one-jar-ant-task.xml"/>

  <target name="clean">
    <delete dir="${build.dir}"/>
    <delete dir="${classes.dir}"/>
  </target>

  <target name="all" depends="limelight-osx,limelight-lin32,limelight-lin64,limelight-win32,limelight-win64"/>

  <target name="limelight-osx" depends="init">
    <!-- compile limelight -->
    <javac includeantruntime="false" destdir="${classes.dir}/src">
      <src path="${src.dir}"/>
      <classpath path="${build.dir}"/>
      <classpath>
        <fileset dir="${libs.dir}" includes="*.jar"/>
      </classpath>
    </javac>

    <!-- construct one-jar file -->
    <one-jar destfile="${build.dir}/limelight-osx64.jar">
      <manifest>
        <attribute name="One-Jar-Main-Class" value="com.limelight.Limelight"/>
      </manifest>

      <main>
        <!-- construct limelight.jar -->
        <fileset dir="${classes.dir}/src"/>
      </main>

      <lib>
        <fileset dir="${libs.dir}" includes="*.jar"/>
      </lib>

      <binlib>
        <fileset dir="${libs.osx64.dir}" includes="*"/>
      </binlib>
    </one-jar>
  </target>
  <target name="limelight-lin32" depends="init">
    <!-- compile limelight -->
    <javac includeantruntime="false" destdir="${classes.dir}/src">
      <src path="${src.dir}"/>
      <classpath path="${build.dir}"/>
      <classpath>
        <fileset dir="${libs.dir}" includes="*.jar"/>
      </classpath>
    </javac>

    <!-- construct one-jar file -->
    <one-jar destfile="${build.dir}/limelight-lin32.jar">
      <manifest>
        <attribute name="One-Jar-Main-Class" value="com.limelight.Limelight"/>
      </manifest>

      <main>
        <!-- construct limelight.jar -->
        <fileset dir="${classes.dir}/src"/>
      </main>

      <lib>
        <fileset dir="${libs.dir}" includes="*.jar"/>
      </lib>

      <binlib>
        <fileset dir="${libs.lin32.dir}" includes="*"/>
      </binlib>
    </one-jar>
  </target>

  <target name="limelight-lin64" depends="init">
    <!-- compile limelight -->
    <javac includeantruntime="false" destdir="${classes.dir}/src">
      <src path="${src.dir}"/>
      <classpath path="${build.dir}"/>
      <classpath>
        <fileset dir="${libs.dir}" includes="*.jar"/>
      </classpath>
    </javac>

    <!-- construct one-jar file -->
    <one-jar destfile="${build.dir}/limelight-lin64.jar">
      <manifest>
        <attribute name="One-Jar-Main-Class" value="com.limelight.Limelight"/>
      </manifest>

      <main>
        <!-- construct limelight.jar -->
        <fileset dir="${classes.dir}/src"/>
      </main>

      <lib>
        <fileset dir="${libs.dir}" includes="*.jar"/>
      </lib>

      <binlib>
        <fileset dir="${libs.lin64.dir}" includes="*"/>
      </binlib>
    </one-jar>
  </target>

  <target name="limelight-win32" depends="init">
    <!-- compile limelight -->
    <javac includeantruntime="false" destdir="${classes.dir}/src">
      <src path="${src.dir}"/>
      <classpath path="${build.dir}"/>
      <classpath>
        <fileset dir="${libs.dir}" includes="*.jar"/>
      </classpath>
    </javac>

    <!-- construct one-jar file -->
    <one-jar destfile="${build.dir}/limelight-win32.jar">
      <manifest>
        <attribute name="One-Jar-Main-Class" value="com.limelight.Limelight"/>
      </manifest>

      <main>
        <!-- construct limelight.jar -->
        <fileset dir="${classes.dir}/src"/>
      </main>

      <lib>
        <fileset dir="${libs.dir}" includes="*.jar"/>
      </lib>

      <binlib>
        <fileset dir="${libs.win32.dir}" includes="*"/>
      </binlib>
    </one-jar>
  </target>

  <target name="limelight-win64" depends="init">
    <!-- compile limelight -->
    <javac includeantruntime="false" destdir="${classes.dir}/src">
      <src path="${src.dir}"/>
      <classpath path="${build.dir}"/>
      <classpath>
        <fileset dir="${libs.dir}" includes="*.jar"/>
      </classpath>
    </javac>

    <!-- construct one-jar file -->
    <one-jar destfile="${build.dir}/limelight-win64.jar">
      <manifest>
        <attribute name="One-Jar-Main-Class" value="com.limelight.Limelight"/>
      </manifest>

      <main>
        <!-- construct limelight.jar -->
        <fileset dir="${classes.dir}/src"/>
      </main>

      <lib>
        <fileset dir="${libs.dir}" includes="*.jar"/>
      </lib>

      <binlib>
        <fileset dir="${libs.win64.dir}" includes="*"/>
      </binlib>
    </one-jar>
  </target>


</project>
