filebot/build.xml

135 lines
3.9 KiB
XML

<?xml version="1.0"?>
<project name="FileBot" default="fatjar">
<property name="title" value="${ant.project.name}" />
<property name="version" value="1.9" />
<property name="dir.source" location="${basedir}/source" />
<property name="dir.test" location="${basedir}/test" />
<property name="dir.build" location="${basedir}/build" />
<property name="dir.dist" location="${basedir}/dist" />
<property name="dir.lib" location="${basedir}/lib" />
<property name="executable" location="${dir.dist}/${title}.jar" />
<property name="lib.xerces" location="${dir.lib}/xercesImpl.jar" />
<property name="lib.nekohtml" location="${dir.lib}/nekohtml-1.9.7.jar" />
<property name="lib.simmetrics" location="${dir.lib}/simmetrics_jar_v1_6_2_d07_02_07.jar" />
<property name="lib.xmlrpc" location="${dir.lib}/xmlrpc-client-1.1.jar" />
<property name="lib.glazedlists" location="${dir.lib}/glazedlists-1.7.0_java15.jar" />
<property name="lib.args4j" location="${dir.lib}/args4j-2.0.9.jar" />
<property name="lib.junit" location="${dir.lib}/junit-4.4.jar" />
<target name="fatjar" depends="clean, build">
<!-- create dist dir -->
<mkdir dir="${dir.dist}" />
<jar destfile="${executable}" duplicate="fail">
<fileset dir="${dir.build}" />
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Main-Class" value="Main" />
<attribute name="Version" value="${version}" />
</manifest>
<!-- include libs -->
<zipfileset src="${lib.xerces}">
<include name="org/apache/html/dom/**" />
<include name="org/apache/xerces/dom/**" />
<include name="org/apache/xerces/impl/**" />
<include name="org/apache/xerces/parsers/**" />
<include name="org/apache/xerces/util/**" />
<include name="org/apache/xerces/xni/**" />
<include name="org/apache/xerces/xs/**" />
</zipfileset>
<zipfileset src="${lib.nekohtml}">
<include name="**/*.class" />
<include name="**/*.properties" />
</zipfileset>
<zipfileset src="${lib.simmetrics}">
<include name="uk/ac/shef/wit/simmetrics/math/**" />
<include name="uk/ac/shef/wit/simmetrics/similaritymetrics/**" />
<include name="uk/ac/shef/wit/simmetrics/tokenisers/**" />
<include name="uk/ac/shef/wit/simmetrics/wordhandlers/**" />
</zipfileset>
<zipfileset src="${lib.xmlrpc}">
<include name="**/*.class" />
</zipfileset>
<zipfileset src="${lib.glazedlists}">
<include name="ca/odell/glazedlists/**" />
</zipfileset>
<zipfileset src="${lib.args4j}">
<include name="*/**" />
</zipfileset>
</jar>
</target>
<target name="build">
<!-- create build dir -->
<mkdir dir="${dir.build}" />
<!-- compile -->
<javac srcdir="${dir.source}" destdir="${dir.build}">
<classpath>
<fileset dir="${dir.lib}" includes="*.jar" />
</classpath>
</javac>
<!-- copy resources -->
<copy todir="${dir.build}">
<fileset dir="${dir.source}">
<include name="**/*.png" />
<include name="**/*.gif" />
</fileset>
</copy>
</target>
<target name="build-test" depends="build">
<javac srcdir="${dir.test}" destdir="${dir.build}">
<classpath>
<fileset dir="${dir.lib}" includes="*.jar" />
</classpath>
</javac>
</target>
<target name="clean">
<delete dir="${dir.dist}" />
<delete dir="${dir.build}" />
</target>
<target name="test" depends="clean, build-test, fatjar">
<junit printsummary="yes" showoutput="yes">
<classpath>
<pathelement location="${executable}"/>
<pathelement location="${lib.junit}"/>
</classpath>
<formatter type="plain" />
<test name="AllTests" outfile="test-report" />
</junit>
</target>
<target name="run" depends="fatjar">
<java jar="${executable}" fork="yes" />
</target>
</project>