1 <?xml version="1.0" encoding="utf-8"?>
2 <project name="apjava-lab4" default="compile" basedir=".">
3 <!-- Dir Properties -->
4 <property name="build.dir" location="bin"/>
5 <property name="build.main.dir" location="${build.dir}"/>
6 <property name="build.test.dir" location="${build.dir}/test"/>
7 <property name="doc.dir" location="doc"/>
8 <property name="src.dir" location="src"/>
9 <property name="lib.dir" location="lib"/>
10 <property name="test.dir" location="test"/>
11 <property name="test.config.dir" location="${test.dir}/config"/>
12 <property name="index.dir" location="index"/>
14 <!-- Dir program resources -->
15 <property name="src.resources.dir" location="${src.dir}/resources"/>
16 <property name="src.config.dir" location="${src.dir}/config"/>
19 <path id="project.classpath">
20 <pathelement location="${build.main.dir}" />
21 <pathelement location="${build.test.dir}" />
22 <fileset dir="${lib.dir}">
23 <include name="*.jar"/>
27 <!-- Create build-dirs -->
28 <target name="prepare">
29 <mkdir dir="${build.main.dir}"/>
30 <mkdir dir="${build.test.dir}"/>
33 <!-- Remove build files -->
35 <delete dir="${build.dir}" />
38 <!-- Compile program -->
39 <target name="compile" depends="prepare">
40 <!-- Copy resource dirs -->
41 <copy todir="${build.main.dir}/resources">
42 <fileset dir="${src.resources.dir}"/>
44 <copy todir="${build.main.dir}/config">
45 <fileset dir="${src.config.dir}"/>
48 <!-- Compile source -->
49 <javac srcdir="${src.dir}" destdir="${build.main.dir}" debug="on">
50 <classpath refid="project.classpath" />
51 <!-- <compilerarg value="-Xlint:unchecked"/> -->
55 <!-- Compile tests -->
56 <target name="compile-tests" depends="compile">
58 <copy todir="${build.test.dir}/config">
59 <fileset dir="${test.config.dir}"/>
61 <copy todir="${build.test.dir}/resources">
62 <fileset dir="${src.resources.dir}"/>
65 <javac srcdir="${test.dir}" destdir="${build.test.dir}">
66 <classpath refid="project.classpath" />
71 <target name="test" depends="compile-tests">
72 <junit haltonfailure="true" dir="${build.test.dir}" fork="true">
73 <classpath refid="project.classpath" />
74 <formatter type="plain" usefile="false" />
76 <!-- Run junit tests on all classes with filenames that end with -->
78 <fileset dir="${build.test.dir}"
79 includes="**/*Test.class" />
81 <sysproperty key="doc.dir" value="${doc.dir}" />
82 <sysproperty key="index.dir" value="${index.dir}" />
86 <!-- Generate javadoc -->
87 <target name="javadoc" description="Generaties javadoc">
88 <javadoc destdir="${doc.dir}">
89 <classpath refid="project.classpath" />
90 <fileset dir="${src.dir}/" includes="**/*.java"/>
94 <!-- Easy way to start the program -->
95 <target name="run" description="Run AntiTD" depends="compile">
96 <java classname="AntiTD" fork="true" dir="${build.main.dir}">
97 <classpath refid="project.classpath" />
98 <!-- <arg value="somevalue"/> -->
102 <target name="print-classpath" description="Prints classpath, convenient for export to emacs and jde-mode">
103 <property name="classpath" refid="project.classpath"/>
104 <echo message="-classpath-${classpath}-classpath-"/>