1 <?xml version="1.0" encoding="utf-8"?>
2 <project name="apjava-lab4" default="compile" basedir=".">
4 <!-- Dir Properties -->
5 <property name="build.dir" location="bin"/>
6 <property name="build.main.dir" location="${build.dir}/main"/>
7 <property name="build.test.dir" location="${build.dir}/test"/>
8 <property name="doc.dir" location="doc"/>
9 <property name="src.dir" location="src"/>
10 <property name="lib.dir" location="lib"/>
11 <property name="test.dir" location="test"/>
12 <property name="test.config.dir" location="${test.dir}/config"/>
13 <property name="index.dir" location="index"/>
15 <!-- Dir program resources -->
16 <property name="src.resources.dir" location="${src.dir}/resources"/>
17 <property name="src.config.dir" location="${src.dir}/config"/>
19 <!-- Package name, dirs -->
20 <property name="name" value="AntiTD" />
21 <property name="version" value="1.0" />
22 <property name="release" value="${name}-${version}" />
24 <property name="dist.dir" location="." />
25 <property name="jar.name" value="${name}.jar" />
26 <property name="jar.path" location="${dist.dir}/${jar.name}" />
29 <path id="project.classpath">
30 <pathelement location="${build.main.dir}" />
31 <pathelement location="${build.test.dir}" />
32 <fileset dir="${lib.dir}">
33 <include name="*.jar"/>
37 <!-- Create build-dirs -->
38 <target name="prepare">
39 <mkdir dir="${build.main.dir}"/>
40 <mkdir dir="${build.test.dir}"/>
43 <!-- Remove build files -->
45 <delete dir="${build.dir}" />
48 <!-- Compile program -->
49 <target name="compile" depends="prepare">
50 <!-- Copy resource dirs -->
51 <copy todir="${build.main.dir}/resources">
52 <fileset dir="${src.resources.dir}"/>
54 <!-- <copy todir="${build.main.dir}/config"> -->
55 <!-- <fileset dir="${src.config.dir}"/> -->
58 <!-- Compile source -->
59 <javac srcdir="${src.dir}" destdir="${build.main.dir}" debug="on">
60 <classpath refid="project.classpath" />
61 <!-- <compilerarg value="-Xlint:unchecked"/> -->
65 <!-- Compile tests -->
66 <target name="compile-tests" depends="compile">
68 <!-- <copy todir="${build.test.dir}/config"> -->
69 <!-- <fileset dir="${test.config.dir}"/> -->
71 <!-- <copy todir="${build.test.dir}/resources"> -->
72 <!-- <fileset dir="${src.resources.dir}"/> -->
75 <javac srcdir="${test.dir}" destdir="${build.test.dir}">
76 <classpath refid="project.classpath" />
81 <target name="test" depends="compile-tests">
82 <junit haltonfailure="true" dir="${build.test.dir}" fork="true">
83 <classpath refid="project.classpath" />
84 <formatter type="plain" usefile="false" />
86 <!-- Run junit tests on all classes with filenames that end with -->
88 <fileset dir="${build.test.dir}"
89 includes="**/*Test.class" />
91 <sysproperty key="doc.dir" value="${doc.dir}" />
92 <sysproperty key="index.dir" value="${index.dir}" />
96 <!-- Generate javadoc -->
97 <target name="javadoc" description="Generaties javadoc">
98 <javadoc destdir="${doc.dir}">
99 <classpath refid="project.classpath" />
100 <fileset dir="${src.dir}/" includes="**/*.java"/>
104 <!-- Easy way to start the program -->
105 <target name="run" description="Run AntiTD" depends="compile">
106 <java classname="se.umu.cs.dit06ajnajs.AntiTD" fork="true" dir="${build.main.dir}">
107 <classpath refid="project.classpath" />
108 <!-- <arg value="somevalue"/> -->
112 <target name="run-editor" description="Run LevelEditor" depends="compile">
113 <java classname="se.umu.cs.dit06ajnajs.util.LevelEditor" fork="true" dir="${build.main.dir}">
114 <classpath refid="project.classpath" />
115 <!-- <arg value="somevalue"/> -->
120 <target name="jar" description="Create jar-file" depends="compile">
121 <mkdir dir="${dist.dir}"/>
123 <!-- create a property containing all .jar files, prefix lib/, and seperated with a space -->
124 <pathconvert property="libs.project" pathsep=" ">
127 <!-- remove absolute path -->
129 <!-- add lib/ prefix -->
130 <globmapper from="*" to="lib/*" />
135 <!-- lib.home contains all jar files, in several subdirectories -->
136 <fileset dir="${lib.dir}">
137 <include name="**/*.jar" />
143 <jar destfile="${jar.path}" basedir="${build.main.dir}">
144 <!-- define MANIFEST.MF -->
146 <attribute name="Built-By" value="${user.name}" />
147 <attribute name="Main-Class" value="se.umu.cs.dit06ajnajs.AntiTD"/>
149 <!-- finally, use the magically generated libs path -->
150 <attribute name="Class-Path" value="${libs.project}" />
155 <target name="print-classpath" description="Prints classpath, convenient for export to emacs and jde-mode">
156 <property name="classpath" refid="project.classpath"/>
157 <echo message="-classpath-${classpath}-classpath-"/>