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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
<project name="thmmPlugin" default="all" basedir=".">
<description> Example of a substitution model plugin for BEAST</description>
<property file="beast_sdk.properties"/>
<property file="${user.home}/.ant-global.properties"/>
<fail message="The beast.root property must be set. This is usually done by copying the beast_sdk.properties.in to beast_sdk.properties and modifying it to so that beast.root refers to the appropriate path.">
<condition>
<not>
<isset property="beast.root"/>
</not>
</condition>
</fail>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="lib" location="${beast.root}/build/dist"/>
<property name="dist" location="dist"/>
<!-- the following 2 properties will be changed for every plugin that you write -->
<!-- the plugin-class is the class that implements dr.app.plugin.Plugin -->
<property name="plugin-class" value="@PLUGIN_CLASS@"/>
<!-- the plugin-package is the package that contains your plugin-class -->
<property name="plugin-package" value="@PLUGIN_PACKAGE@"/>
<!-- plugin-jar name should list the fully qualified name to your plugin class -->
<property name="plugin-jar" value="@PLUGIN_PACKAGE@@PLUGIN_SUBPACKAGES@@PLUGIN_CLASS@.jar"/>
<property environment="env"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<mkdir dir="${build}"/>
<mkdir dir="${dist}"/>
</target>
<target name="all"
depends="compile-all"
description="Build all run-time stuff">
</target>
<target name="build"
depends="compile-all"
description="alias to compile-all">
</target>
<target name="compile-all"
depends="compile-basic">
</target>
<target name="compile-basic"
depends="init">
<!-- Compile the java code from ${src} into ${build} -->
<javac source="1.5" srcdir="${src}" destdir="${build}"
classpath="${lib}/beast.jar">
@PLUGIN_SRC_PATH@
</javac>
</target>
<target name="dist"
depends="compile-all"
description="create the plugin jar and any other resources needed for the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
<!-- Put everything in ${build} into the treestat.jar file -->
<jar jarfile="${dist}/${plugin-jar}">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
</manifest>
<fileset dir="${build}">
@PLUGIN_CLASS_FILE_PATH@
</fileset>
</jar>
</target>
<target name="install"
depends="dist"
description="Install the plugin into BEAST's plugins directory">
<mkdir dir="${beast.root}/plugins" />
<copy file="${dist}/${plugin-jar}" todir="${beast.root}/plugins" />
</target>
<target name="uninstall"
description="Remove the plugin from BEAST's plugins directory">
<delete file="${beast.root}/plugins/${plugin-jar}" verbose="true"/>
</target>
<target name="clean"
description="Removes build products, but does not uninstall">
<delete dir="${build}" verbose="true"/>
<delete dir="${dist}" verbose="true"/>
</target>
<target name="test-install"
depends="install"
description="Runs integration tests of the plugin">
<mkdir dir="scratch" />
<!-- run the example xml file -->
<java jar="${lib}/beast.jar"
fork="true"
failonerror="false"
resultproperty="example.exitcode"
dir="scratch"
>
<sysproperty key="beast.plugins.dir" value="${beast.root}/plugins" />
<arg value="${basedir}/example/@EXAMPLE_XML_FILE@"/>
<classpath>
<pathelement location="${lib}/beast.jar"/>
</classpath>
</java>
<fail message="The example example/@EXAMPLE_XML_FILE@ failed">
<condition>
<not> <equals arg1="${example.exitcode}" arg2="0"/></not>
</condition>
</fail>
</target>
</project>
|