build.xml 2.76 KB
Newer Older
petter's avatar
petter committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
<project name="TTT" default ="all" basedir=".">
  <property name="java"       location="java" />
  <property name="lib"       location="lib" />
  <property name="classes"   location="bin" />
  <property name="dist"      location="dist"/>
  <property name="etc" 	     location="etc" />
  <property environment="env" />

  <taskdef name="nsis" classname="net.sf.nsisant.Task">
    <classpath location="${lib}/nsisant-1.2.jar"/>
  </taskdef>

  <path id="sources">
    <fileset dir="${src}">
      <include name="**/**.java" />
    </fileset>
  </path>

  <path id="libraries">
     <pathelement location="${classes}" />
     <pathelement location="${lib}" />
     <fileset dir="${lib}">
       <include name="**/*.jar" />
       <include name="**/*.zip" />
     </fileset>
     <!-- here, we include all necessary libraries -->
     <!--fileset dir="${plugins}">
       <include name="**/*.jar" />
     </fileset-->
     <pathelement path="${java.class.path}" />
  </path>

  <!-- initialize the workspace -->
  <target name="init">
    <mkdir dir="${classes}" />
    <mkdir dir="${dist}" />    
  </target>

  <!-- deletes all build-related directories -->
  <target name="clean">
    <delete>
      <fileset dir="." defaultexcludes="no" includes="**/*~"/>
      <fileset dir="." defaultexcludes="no" includes="**/#*#"/>
    </delete>
    <delete dir="${classes}" />
    <delete dir="${dist}" />
    <delete dir="${etc}" />
  </target>


  <!-- Compiles the .java files to the classes directory -->
  <target name="classes" depends="init">
    <depend srcdir="${java}" destdir="${classes}" cache="${etc}" />
    <javac srcdir="${java}" destdir="${classes}" verbose="off" listfiles="off"
      source="6"  debug="on" encoding="Cp1252" >
      <classpath refid="libraries"/>
    </javac>
    <copy todir="${classes}/ttt/resources"><fileset dir="${java}/ttt/resources"></fileset></copy>
  </target>

  <!-- Packs the classes into single .jar files -->
  <target name="pack" depends="classes">
    <jar jarfile="${dist}/ttt.jar" basedir="${classes}"> 
      <fileset dir="${classes}/ttt/resources"/>
      <manifest>
       <attribute name="Main-Class" value="ttt/TTT" />
       <attribute name="Class-Path" value="itext-1.4.8.jar jsch-0.1.32-patched.jar swing-layout-1.0.2.jar jmf-2.1.1e.jar mp3plugin.jar" />
     </manifest>
     </jar>
    <copy todir="${dist}"><fileset dir="${lib}"></fileset></copy>
    <zip destfile="./ttt.zip" basedir="${dist}" update="true"/> 
  </target>

  <target name="installer" depends="pack">
    <nsis nocd="on" verbosity="2" script="nsis/ttt.nsi"/>
  </target>

  <!-- build the whole project -->
  <target name="all" depends="pack" />
  <target name="run" depends="pack">
    <java jar="${dist}/ttt.jar" fork="true">
      <assertions><disable /></assertions>
    </java>
  </target>
</project>