Source

mallet / build.xml

<project name="mallet" default="compile" basedir=".">
  <description>A Machine Learning for Language Toolkit</description>
  <!-- 
    Properties
    -->
  <property name="src" location="src"/>
  <property name="testsrc" location="tests"/>
  <property name="class" location="class"/>
  <property name="lib" location="lib"/>
  <property name="dist" location="dist"/>
  <property name="doc" location="doc/api"/>
  <property name="test" location="test"/>
  <property name="java_version" value="1.5"/>

  <path id="project.classpath">
    <pathelement path="${class}"/>
    <fileset dir="lib" includes="*.jar"/>
  </path>

  <path id="project.base.source.files">
    <fileset dir="${src}" includes="cc/mallet/**/*.java"/>
  </path>

  <fileset id="project.resources"
    dir="${src}">
    <include name="**/resources/*.*"/>
    <include name="**/*.properties"/>
  </fileset>

  <!--
    Initialization 
    -->
  <target name="init">
    <!-- Create a time stamp -->
    <tstamp/>
    <!-- Create an output directory for class files -->
    <mkdir dir="${class}"/>
    <copy todir="${class}" overwrite="true" includeemptydirs="true">
      <fileset refid="project.resources"/>
    </copy>
    <!-- Create an output directory for the final jar -->
    <mkdir dir="${dist}"/>
    <copy file="${lib}/mallet-deps.jar" todir="${dist}"/>
    <mkdir dir="${test}"/>
  </target>
  
  <!--
    Target: compile
    -->
  <target
    name="compile"
    depends="init"
    description="Compile all the source files">
    <javac
      source="${java_version}"
      destdir="${class}"
      classpathref="project.classpath"
      debug="true"
      deprecation="off"
      listfiles="no"
      >
      <src path="${src}"/>
      <include name="cc/**/*.java"/>
	  <!-- compilerarg value="-Xlint:unchecked"/ --> 
    </javac>
    </target>

  <!--
    Target: compile-test
    -->
  <target
    name="compile-test"
    depends="compile"
    description="Compile all the test files">
    <javac
      source="${java_version}"
      destdir="${class}"
      classpathref="project.classpath"
      debug="true"
      deprecation="off"
      listfiles="no"
      >
      <src path="${testsrc}"/>
      <include name="cc/**/*.java"/>
	  <!-- compilerarg value="-Xlint:unchecked"/ --> 
    </javac>
  </target>
 
  <!--
    Target: doc   {build javadoc API documentation}
    -->
  <target
    name="doc"
    depends="init"
    description="Build Javadoc API webpages for all the source files">
    <javadoc
      destdir="${doc}"
      classpathref="project.classpath"
      author="true" version="true" use="true"
      windowtitle="Mallet 2 API"
      >
      <packageset dir="${src}" defaultexcludes="yes">
        <include name="cc/mallet/**"/>
      </packageset>
    </javadoc>
  </target>
 
  <!-- Create a jar file -->
  <target name="jar" depends="compile">
      <jar destfile="${dist}/mallet.jar" basedir="${class}"/>
  </target>

  <target name="test" depends="compile-test">

    <junit printsummary="yes" >
      <classpath>
	<pathelement path="${class}"/>
	<fileset dir="lib" includes="*.jar"/>
      </classpath>
      
      <formatter type="plain"/>
      
      <!-- test name="cc.mallet.types.tests.TestInstanceListWeights" todir="${test}" /-->

      <batchtest fork="yes" todir="${test}">
	<fileset dir="${testsrc}">
	  <include name="**/*Test*.java"/>
	</fileset>
      </batchtest>
    </junit>
  </target>

</project>