<?xml version="1.0"?>
<project name="test" default="compile" basedir=".">

    <property name="src" value="src"/>
    <property name="bin" value="bin"/>
    <property name="lib" value="lib"/>
    <property name="dist" value="dist"/>
    <property name="antlib" value="antlib"/>
    <property name="nsis" value="nsis"/>
    <property name="cp" value="${lib}/com.yourkit.javaprofiler.controller_7.0.4.jar:${lib}/de.ugoe.cs.swe.trex.antlr_2.7.6.jar:${lib}/org.eclipse.core.resources_3.4.0.v20080604-1400.jar:${lib}/org.eclipse.core.runtime_3.4.0.v20080512.jar:${lib}/org.eclipse.equinox.common_3.4.0.v20080421-2006.jar:${lib}/org.eclipse.osgi_3.4.0.v20080605-1900.jar:${lib}/stringtemplate.jar:${lib}/xstream-1.3.1.jar:${lib}/xpp3_min-1.1.4c.jar:${lib}/commons-cli-1.2.jar:${lib}/org.etsi.common.jar:${lib}/de.ugoe.cs.swe.trex.core_0.6.0.201003090301.jar"/>

    <taskdef name="nsis" classname="net.sf.nsisant.Task">
        <classpath location="${antlib}/nsisant-1.2.jar"/>
    </taskdef>
	
	<target name="init">
        <mkdir dir="${bin}"/>
    </target>

   	<target name="compile" depends="init">
        <javac srcdir="${src}" destdir="${bin}" classpath="${cp}"/>
    </target>

    <target name="clean" description="Removes previous build">
      <delete includeEmptyDirs="true">
        <fileset dir="${bin}"/>
      </delete>
    </target>
    
    <target name="make-dist" depends="compile" description="Creates an T3Q distribution directory">
        <echo>Building T3Q Distribution in ${dist}...</echo>
        <delete includeEmptyDirs="true">
            <fileset dir="${dist}"/>
        </delete>
        <jar destfile="${lib}/t3q.jar" basedir="${bin}/"/> 
        <mkdir dir="${dist}"/>
        <mkdir dir="${dist}/lib"/>
		<copy file="t3q" tofile="${dist}/t3q"/>
		<copy file="t3q.bat" tofile="${dist}/t3q.bat"/> 
        <copy todir="${dist}/lib">
        	<fileset dir="${lib}"/>
        </copy>
    </target>
	
    <target name="nsis" depends="make-dist" description="Creates an NSIS Installer from the dist directory">
        <nsis script="${nsis}/t3q.nsi" verbosity="4" out="${nsis}/build.log" noconfig="yes">
            <define name="VERSION" value="2.1"/>
            <scriptcmd cmd="AutoCloseWindow true"/>
        </nsis>
    </target>
	
</project>
