<?xml version="1.0"?>

<project name="sheepit-renderfarm-client" default="client">
    <property name="compile.debug" value="true"/>
    <property name="compile.deprecation" value="true"/>
    <property name="compile.optimize" value="true"/>
    <property name="compile.version" value="1.7"/>
    <property name="compile.release" value="5.0.0"/>
    
    <target name="precompile">
        <antcall target="clean" />
        
        <mkdir dir="build"/>
        <mkdir dir="bin"/>
        <echo file="build/VERSION" message="${compile.release}" />
    </target>
    
    <target name="client">
        <antcall target="precompile" />
        <javac srcdir="src"
               destdir="build"
               target="${compile.version}"
               source="${compile.version}"
               debug="${compile.debug}"
               optimize="${compile.optimize}"
               deprecation="${compile.deprecation}"
               includes="**">
               <classpath>
                     <pathelement location="extern/platform.jar"/>
                     <pathelement location="extern/jna.jar"/>
                     <pathelement location="extern/args4j.jar"/>
                     <pathelement location="extern/zip4j.jar"/>
                     <pathelement location="extern/jaxb-api.jar"/>
                     <pathelement location="extern/jaxb-core.jar"/>
                     <pathelement location="extern/jaxb-impl.jar"/>
               </classpath>
        </javac>
        
        <unjar src="extern/platform.jar" dest="build">
            <filelist dir="." files="extern/jna.jar" />
            <filelist dir="." files="extern/args4j.jar" />
            <filelist dir="." files="extern/zip4j.jar" />
            <filelist dir="." files="extern/jaxb-api.jar" />
            <filelist dir="." files="extern/jaxb-core.jar" />
            <filelist dir="." files="extern/jaxb-impl.jar" />
        </unjar>
        
        <copy file="resources/icon.png" tofile="build/icon.png" overwrite="true" />
        <copy file="resources/title.png" tofile="build/title.png" overwrite="true" />
        
        <jar destfile="bin/sheepit-client.jar"
            basedir="build/">
            <include name="**"/>
            <manifest>
                <attribute name="Main-Class" value="com.sheepit.client.standalone.Worker"/>
                <attribute name="Application-Name" value="SheepIt-client"/>
                <attribute name="Trusted-Library" value="true"/>
                <attribute name="Permissions" value="all-permissions"/>
                <attribute name="Codebase" value="*"/>
            </manifest>
        </jar>
    </target>
    
    <target name="clean" description="clean files">
        <delete dir="build"/>
        <delete dir="bin"/>
    </target>
 </project>

