Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
304 lines (279 sloc) 10.4 KB
<project name="weka-package" default="compile" basedir=".">
<!--
===========================================================================
Ant build file for weka a weka package.
Type ant -projecthelp for targets and descriptions.
$Revision$
===========================================================================
-->
<!-- set global properties for this build -->
<property name="src" value="src/main/java"/>
<property name="src-test" value="src/test/java"/>
<property name="lib" value="lib" />
<property name="regression_tests_root" value="src/test/resources/wekarefs"/>
<property name="build" value="build"/>
<property name="dist" value="dist"/>
<property name="doc" value="doc"/>
<!-- set specfic properties for this build: lexicons, resources and datasets -->
<property name="lexicons" value="lexicons"/>
<property name="resources" value="resources"/>
<property name="data" value="data"/>
<property name="javac_max_memory" value="256m"/>
<property name="debug" value="on" />
<property name="package" value="AffectiveTweets"/>
<target name="init_all">
<!-- Create the time stamp -->
<tstamp/>
</target>
<!-- general classpath definition, incl. CLASSPATH env. variable,
// but jars in lib directory have precedence over the CLASSPATH variable -->
<path id="project.class.path">
<fileset dir="${lib}">
<include name="*.jar"/>
<include name="*.zip"/>
</fileset>
<pathelement location="${build}/classes"/>
<pathelement location="${build}/testcases"/>
<pathelement path="${java.class.path}" />
</path>
<!--
============================================================================
Compilation and documentation making stuff
============================================================================
-->
<target name="init_compile" depends="init_all">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}/classes"/>
</target>
<!-- Compile the java code from ${src}/weka into ${build}/classes -->
<target name="compile" depends="init_compile"
description="Compile package and deposit class files in build/classes">
<javac srcdir="${src}"
fork="yes" memoryMaximumSize="${javac_max_memory}"
destdir="${build}/classes"
optimize="${optimization}"
debug="${debug}"
deprecation="${deprecation}"
source="1.6" target="1.6">
<classpath refid="project.class.path" />
</javac>
<copy todir="${build}/classes" >
<fileset dir="${src}">
<include name="**/*.gif"/>
<include name="**/*.png"/>
<include name="**/*.jpeg"/>
<include name="**/*.jpg"/>
<include name="**/*.props"/>
<include name="**/*.txt"/>
<include name="**/*.xml"/>
<include name="**/*.cup"/>
<include name="**/*.flex"/>
<include name="**/*.jflex"/>
<include name="**/*.properties"/>
<include name="**/*.default"/>
</fileset>
</copy>
</target>
<!-- Make the javadocs -->
<target name="docs"
depends="init_all"
description="Make javadocs into ./doc">
<mkdir dir="${doc}"/>
<javadoc sourcepath="${src}"
classpathref="project.class.path"
destdir="${doc}"
Author="yes"
Public="yes"
link="http://weka.sourceforge.net/doc.dev/"
maxmemory="256m"/>
</target>
<!--
===========================================================================
Unit testing stuff
===========================================================================
-->
<!-- Junit testing initialization -->
<target name="init_tests" depends="init_all">
<available property="junit.present" classname="junit.framework.TestCase"/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}/testcases"/>
<!-- make this if it doesn't exist so that the compile_test task doesn't faile for
stuff that doesn't have test cases -->
<mkdir dir="${src-test}"/>
</target>
<!-- compile the testcases -->
<target name="compile_tests" depends="init_tests, compile"
description="Compile unit tests into build/testcases">
<javac srcdir="${src-test}"
fork="yes" memoryMaximumSize="${javac_max_memory}"
destdir="${build}/testcases"
optimize="${optimization}"
debug="${debug}"
deprecation="${deprecation}"
source="1.6" target="1.6">
<classpath refid="project.class.path" />
</javac>
<copy todir="${build}/testcases" >
<fileset dir="${src-test}">
<include name="**/*.arff"/>
<include name="**/*.cost"/>
<include name="**/*.xml"/>
<include name="**/*.matrix"/>
</fileset>
</copy>
</target>
<!-- Put everything in ${build}/testcases into the ${package}-tests.jar file -->
<target name="jar_tests" depends="compile_tests, init_dist"
description="Creates a jar file with the test cases in ./dist. Run with -Dpackage=[package name]">
<jar jarfile="${dist}/${package}-tests.jar"
basedir="${build}/testcases">
</jar>
</target>
<target name="run_tests_all" depends="compile_tests"
description="Execute unit tests (fast)">
<java fork="yes" dir="."
classname="junit.textui.TestRunner"
taskname="junit" failonerror="${run_tests_fail}">
<arg value="weka.AllPackageTests"/>
<classpath refid="project.class.path" />
<jvmarg value="-server"/>
<!-- <jvmarg value="-Xint"/> -->
<jvmarg value="-Djava.awt.headless=${headless}"/>
<jvmarg value="-Dweka.test.Regression.root=${regression_tests_root}"/>
<jvmarg value="-Duser.timezone=Pacific/Auckland"/>
</java>
</target>
<!--
===========================================================================
Release making stuff
===========================================================================
-->
<target name = "init_dist" depends="init_all">
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
</target>
<!-- Put everything in ${build}/classes into the ${package}.jar file -->
<target name="exejar" depends="compile, docs, init_dist"
description="Create a binary jar file in ./dist">
<jar jarfile="${dist}/${package}.jar"
basedir="${build}/classes">
</jar>
</target>
<target name="make_package" depends="exejar" description="Make the package zip file. Run with -Dpackage=[package name]">
<mkdir dir="${dist}/${package}"/>
<copy todir="${dist}/${package}">
<fileset dir="${dist}">
<include name="*.jar"/>
</fileset>
</copy>
<delete>
<fileset dir="${dist}">
<include name="*.jar"/>
</fileset>
</delete>
<copy file="Description.props"
todir="${dist}/${package}"/>
<copy file="GenericPropertiesCreator.props"
todir="${dist}/${package}"/>
<copy file="GUIEditors.props"
todir="${dist}/${package}"/>
<mkdir dir="${dist}/${package}/lib"/>
<copy todir="${dist}/${package}/lib" >
<fileset dir="${lib}">
<include name="*.jar"/>
<exclude name="weka.jar"/>
<exclude name="weka-tests.jar"/>
<exclude name="junit.jar"/>
<include name="*.zip"/>
</fileset>
</copy>
<mkdir dir="${dist}/${package}/lexicons"/>
<copy todir="${dist}/${package}/lexicons" >
<fileset dir="${lexicons}">
<include name="**/*"/>
</fileset>
</copy>
<mkdir dir="${dist}/${package}/data"/>
<copy todir="${dist}/${package}/data" >
<fileset dir="${data}">
<include name="**/*"/>
</fileset>
</copy>
<mkdir dir="${dist}/${package}/resources"/>
<copy todir="${dist}/${package}/resources" >
<fileset dir="${resources}">
<include name="**/*"/>
</fileset>
</copy>
<mkdir dir="${dist}/${package}/doc"/>
<copy todir="${dist}/${package}/doc" >
<fileset dir="${doc}">
<include name="**/*"/>
</fileset>
</copy>
<mkdir dir="${dist}/${package}/src"/>
<copy todir="${dist}/${package}" >
<fileset dir=".">
<include name="*.xml"/>
<include name="src/**/*.excludes"/>
<include name="src/**/*.gif"/>
<include name="src/**/*.java"/>
<include name="src/**/*.jpeg"/>
<include name="src/**/*.jpg"/>
<include name="src/**/*.props"/>
<include name="src/**/*.txt"/>
<include name="src/**/*.xml"/>
<include name="src/**/*.cup"/>
<include name="src/**/*.flex"/>
<include name="src/**/*.jflex"/>
<include name="src/**/*.properties"/>
<include name="src/**/*.default"/>
<include name="src/**/*.cost"/>
<include name="src/**/*.arff"/>
<include name="src/**/*.matrix"/>
</fileset>
</copy>
<zip destfile="${dist}/${package}.zip"
basedir="${dist}/${package}">
</zip>
</target>
<!-- Put all .java, and .props files into ${dist}/${package}-src.jar-->
<target name="srcjar" depends="init_dist, init_all"
description="Create a jar file containing weka source in ./dist. Run with -Dpackage=[package name]">
<!-- jar up the source -->
<jar jarfile="${dist}/${package}-src.jar"
basedir=".">
<include name="*.xml"/>
<include name="src/**/*.excludes"/>
<include name="src/**/*.gif"/>
<include name="src/**/*.java"/>
<include name="src/**/*.jpeg"/>
<include name="src/**/*.jpg"/>
<include name="src/**/*.props"/>
<include name="src/**/*.txt"/>
<include name="src/**/*.xml"/>
<include name="src/**/*.cup"/>
<include name="src/**/*.flex"/>
<include name="src/**/*.jflex"/>
<include name="src/**/*.properties"/>
<include name="src/**/*.default"/>
<include name="src/**/*.cost"/>
<include name="src/**/*.arff"/>
<include name="src/**/*.matrix"/>
<include name="lib/**/*.jar"/>
</jar>
</target>
<!-- Clean -->
<target name="clean" depends="init_all"
description="Removes the build, dist and reports directories">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<target name="superclean" depends="clean"
description="Clean plus removes source trees! and doc directories">
<!-- WARNING, this deletes the source and doc directories -->
<delete dir="${src}"/>
<delete dir="${doc}"/>
</target>
</project>
You can’t perform that action at this time.