blob: 1f00cbbd5af99cf404f98b643f9ad7c85c7101e7 [file] [log] [blame]
<?xml version="1.0"?>
<!-- Imported by plugin build.xml files to define default targets. -->
<project>
<property name="name" value="${ant.project.name}"/>
<property name="root" value="${basedir}"/>
<!-- Load all the default properties, and any the user wants -->
<!-- to contribute (without having to type -D or edit this file -->
<property file="${user.home}/${name}.build.properties" />
<property file="${root}/build.properties" />
<property name="nutch.root" location="${root}/../../../"/>
<property name="src.dir" location="${root}/src/java"/>
<property name="src.test" location="${root}/src/test"/>
<available file="${src.test}" type="dir" property="test.available"/>
<property name="conf.dir" location="${nutch.root}/conf"/>
<property name="build.dir" location="${nutch.root}/build/${name}"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="build.test" location="${build.dir}/test"/>
<property name="deploy.dir" location="${nutch.root}/build/plugins/${name}"/>
<property name="javac.deprecation" value="off"/>
<property name="javac.debug" value="on"/>
<property name="javadoc.link"
value="http://java.sun.com/j2se/1.4/docs/api/"/>
<property name="build.encoding" value="ISO-8859-1"/>
<fileset id="lib.jars" dir="${root}" includes="lib/*.jar"/>
<!-- the normal classpath -->
<path id="classpath">
<pathelement location="${build.classes}"/>
<fileset refid="lib.jars"/>
<pathelement location="${nutch.root}/build/classes"/>
<fileset dir="${nutch.root}/lib">
<include name="*.jar" />
</fileset>
</path>
<!-- the unit test classpath -->
<path id="test.classpath">
<pathelement location="${build.test}" />
<pathelement location="${nutch.root}/build/test/classes"/>
<pathelement location="${nutch.root}/src/test"/>
<pathelement location="${conf.dir}"/>
<pathelement location="${nutch.root}/build"/>
<path refid="classpath"/>
</path>
<!-- ====================================================== -->
<!-- Stuff needed by all targets -->
<!-- ====================================================== -->
<target name="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.test}"/>
<antcall target="init-plugin"/>
</target>
<!-- to be overridden by sub-projects -->
<target name="init-plugin"/>
<!-- ====================================================== -->
<!-- Compile the Java files -->
<!-- ====================================================== -->
<target name="compile" depends="init">
<echo message="Compiling plugin: ${name}"/>
<javac
encoding="${build.encoding}"
srcdir="${src.dir}"
includes="**/*.java"
destdir="${build.classes}"
debug="${javac.debug}"
deprecation="${javac.deprecation}">
<classpath refid="classpath"/>
</javac>
</target>
<!-- ================================================================== -->
<!-- Make plugin .jar -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="jar" depends="compile">
<jar
jarfile="${build.dir}/${name}.jar"
basedir="${build.classes}"
/>
</target>
<!-- ================================================================== -->
<!-- Deploy plugin to ${deploy.dir} -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="deploy" depends="jar">
<mkdir dir="${deploy.dir}"/>
<copy file="plugin.xml" todir="${deploy.dir}"
preservelastmodified="true"/>
<copy file="${build.dir}/${name}.jar" todir="${deploy.dir}"/>
<copy todir="${deploy.dir}" flatten="true">
<fileset refid="lib.jars"/>
</copy>
</target>
<!-- ================================================================== -->
<!-- Compile test code -->
<!-- ================================================================== -->
<target name="compile-test" depends="compile" if="test.available">
<javac
encoding="${build.encoding}"
srcdir="${src.test}"
includes="**/*.java"
destdir="${build.test}"
debug="${debug}">
<classpath refid="test.classpath"/>
</javac>
</target>
<!-- ================================================================== -->
<!-- Run unit tests -->
<!-- ================================================================== -->
<target name="test" depends="compile-test, deploy" if="test.available">
<echo message="Testing plugin: ${name}"/>
<junit printsummary="yes" haltonfailure="no" fork="yes"
errorProperty="tests.failed" failureProperty="tests.failed">
<sysproperty key="test.data" value="${build.test}/data"/>
<sysproperty key="test.input" value="${root}/data"/>
<classpath refid="test.classpath"/>
<formatter type="plain" />
<batchtest todir="${build.test}" unless="testcase">
<fileset dir="${src.test}"
includes="**/Test*.java" excludes="**/${test.exclude}.java" />
</batchtest>
<batchtest todir="${build.test}" if="testcase">
<fileset dir="${src.test}" includes="**/${testcase}.java"/>
</batchtest>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</target>
<!-- ================================================================== -->
<!-- Clean. Delete the build files, and their directories -->
<!-- ================================================================== -->
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${deploy.dir}"/>
</target>
</project>