| 1 |
<project name="thmmPlugin" default="all" basedir="."> |
| 2 |
<description> Example of a substitution model plugin for BEAST</description> |
| 3 |
<property file="beast_sdk.properties"/> |
| 4 |
<property file="${user.home}/.ant-global.properties"/> |
| 5 |
<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."> |
| 6 |
<condition> |
| 7 |
<not> |
| 8 |
<isset property="beast.root"/> |
| 9 |
</not> |
| 10 |
</condition> |
| 11 |
</fail> |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
<property name="src" location="src"/> |
| 16 |
<property name="build" location="build"/> |
| 17 |
<property name="lib" location="${beast.root}/build/dist"/> |
| 18 |
<property name="dist" location="dist"/> |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
<property name="plugin-class" value="@PLUGIN_CLASS@"/> |
| 23 |
|
| 24 |
<property name="plugin-package" value="@PLUGIN_PACKAGE@"/> |
| 25 |
|
| 26 |
<property name="plugin-jar" value="@PLUGIN_PACKAGE@@PLUGIN_SUBPACKAGES@@[email protected]"/> |
| 27 |
|
| 28 |
<property environment="env"/> |
| 29 |
|
| 30 |
<target name="init"> |
| 31 |
|
| 32 |
<tstamp/> |
| 33 |
<mkdir dir="${build}"/> |
| 34 |
<mkdir dir="${dist}"/> |
| 35 |
</target> |
| 36 |
|
| 37 |
<target name="all" |
| 38 |
depends="compile-all" |
| 39 |
description="Build all run-time stuff"> |
| 40 |
</target> |
| 41 |
|
| 42 |
<target name="build" |
| 43 |
depends="compile-all" |
| 44 |
description="alias to compile-all"> |
| 45 |
</target> |
| 46 |
|
| 47 |
<target name="compile-all" |
| 48 |
depends="compile-basic"> |
| 49 |
</target> |
| 50 |
|
| 51 |
<target name="compile-basic" |
| 52 |
depends="init"> |
| 53 |
|
| 54 |
<javac source="1.5" srcdir="${src}" destdir="${build}" |
| 55 |
classpath="${lib}/beast.jar"> |
| 56 |
@PLUGIN_SRC_PATH@ |
| 57 |
</javac> |
| 58 |
</target> |
| 59 |
|
| 60 |
<target name="dist" |
| 61 |
depends="compile-all" |
| 62 |
description="create the plugin jar and any other resources needed for the distribution"> |
| 63 |
|
| 64 |
<mkdir dir="${dist}"/> |
| 65 |
|
| 66 |
<jar jarfile="${dist}/${plugin-jar}"> |
| 67 |
<manifest> |
| 68 |
<attribute name="Built-By" value="${user.name}"/> |
| 69 |
</manifest> |
| 70 |
<fileset dir="${build}"> |
| 71 |
@PLUGIN_CLASS_FILE_PATH@ |
| 72 |
</fileset> |
| 73 |
</jar> |
| 74 |
</target> |
| 75 |
|
| 76 |
<target name="install" |
| 77 |
depends="dist" |
| 78 |
description="Install the plugin into BEAST's plugins directory"> |
| 79 |
<mkdir dir="${beast.root}/plugins" /> |
| 80 |
<copy file="${dist}/${plugin-jar}" todir="${beast.root}/plugins" /> |
| 81 |
</target> |
| 82 |
|
| 83 |
<target name="uninstall" |
| 84 |
description="Remove the plugin from BEAST's plugins directory"> |
| 85 |
<delete file="${beast.root}/plugins/${plugin-jar}" verbose="true"/> |
| 86 |
</target> |
| 87 |
|
| 88 |
<target name="clean" |
| 89 |
description="Removes build products, but does not uninstall"> |
| 90 |
<delete dir="${build}" verbose="true"/> |
| 91 |
<delete dir="${dist}" verbose="true"/> |
| 92 |
</target> |
| 93 |
|
| 94 |
<target name="test-install" |
| 95 |
depends="install" |
| 96 |
description="Runs integration tests of the plugin"> |
| 97 |
<mkdir dir="scratch" /> |
| 98 |
|
| 99 |
<java jar="${lib}/beast.jar" |
| 100 |
fork="true" |
| 101 |
failonerror="false" |
| 102 |
resultproperty="example.exitcode" |
| 103 |
dir="scratch" |
| 104 |
> |
| 105 |
<sysproperty key="beast.plugins.dir" value="${beast.root}/plugins" /> |
| 106 |
<arg value="${basedir}/example/@EXAMPLE_XML_FILE@"/> |
| 107 |
<classpath> |
| 108 |
<pathelement location="${lib}/beast.jar"/> |
| 109 |
</classpath> |
| 110 |
</java> |
| 111 |
<fail message="The example example/@EXAMPLE_XML_FILE@ failed"> |
| 112 |
<condition> |
| 113 |
<not> <equals arg1="${example.exitcode}" arg2="0"/></not> |
| 114 |
</condition> |
| 115 |
</fail> |
| 116 |
</target> |
| 117 |
</project> |