view build.xml @ 6:83e0c27b4dbc

Added property to check if the matlab files changed (only calling this task if there are any changes)
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 27 Nov 2013 17:58:27 +0000
parents f6cffd6abce3
children 81cbea09cc75
line wrap: on
line source
<project name="EchoWebApp" default="compile-matlab" basedir=".">
    <description>
        Simple build file for the EchoLocation WebApp.
    </description>

  <!-- set global properties for this build -->
  <property name="matlab-src" location="webapp/WEB-INF/mcode"/>
  <property name="matlab-build" location="scratch"/>
  <property name="lib" location="webapp/WEB-INF/lib"/>
  <property name="compile-test" location="webapp/WEB-INF/lib"/>

  <property name="dist"  location="dist"/>

  <uptodate property="matlabCompile.notRequired" targetfile="${matlab-build}/isvr.jar" >
    <srcfiles dir= "${matlab-src}/" includes="*.m"/>
  </uptodate>

  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${matlab-build}"/>
  </target>

  <target name="compile-matlab" depends="init" unless="matlabCompile.notRequired"
    description="compile the MATLAB source" >

    <exec executable="/Applications/MATLAB_R2013b.app/bin/mcc">
      <!-- Will create the java package with the HumanEcho class -->
      <arg line='-W "java:uk.ac.soton.isvr,HumanEcho" -d ${matlab-build} -T "link:lib" -v "class{HumanEcho:${matlab-src}/simulateBinauralSignals.m}"'/>
    </exec>

    <!-- Copy the generated jar to the lib folder -->
    <copy file="${matlab-build}/isvr.jar" tofile="${lib}/isvr.jar" overwrite="true" />

  </target>

  <target name="dist" depends="compile-matlab"
        description="generate the distribution" >
    <!-- Create the distribution directory -->
    <mkdir dir="${dist}/lib"/>

    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
    <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
  </target>

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