ANT build file

This ANT build file is used by davidc to build distributions of multiple addins. It's not required for general addin development but is provided here for anyone who may wish to use ANT.

You will need ant-contrib for the <foreach> task. Addins should be in individual subdirectories. It will automatically read the addin.xml file to pick up the IDs and version numbers.

<?xml version="1.0"?>
<!--$Id: build.xml 263 2009-04-22 23:53:12Z david $-->
<project name="addins" default="build" basedir=".">
 
  <property name="addins.src" value="src"/>
  <property name="addins.dest" value="dist"/>
 
  <taskdef resource="net/sf/antcontrib/antlib.xml" classpath="../lib/build/ant-contrib-1.0b3.jar"/>
 
 
  <target name="build" description="Builds all addins in the src directory">
    <mkdir dir="${addins.dest}"/>
 
    <foreach target="-foreach-addin" param="src.dir">
      <path>
        <dirset dir="${addins.src}" includes="/*/">
        </dirset>
      </path>
    </foreach>
  </target>
 
  <target name="-foreach-addin">
    <!-- Read the XML file to get the addin name and version -->
    <xmlproperty file="${src.dir}/addin.xml"/>
 
    <fail unless="addin.id" message="No Addin ID set in ${src.dir}"/>
    <fail unless="addin.version" message="No Addin version set in ${src.dir}"/>
 
    <property name="out.file" value="${addins.dest}/${addin.id}_${addin.version}.goomod"/>
 
    <zip file="${out.file}">
      <fileset dir="${src.dir}">
        <exclude name="**/.svn"/>
        <exclude name="**/Thumbs.db"/>
      </fileset>
    </zip>
  </target>
 
  <target name="clean" description="Removes everything that was built">
    <delete dir="${addins.dest}"/>
  </target>
 
</project>