New game, next level thread-bugs fixed
[AntiTD.git] / build.xml
blobc8cea61e4ce8b8f2c74de3082ff2e1e400821ad7
1 <?xml version="1.0" encoding="utf-8"?>
2 <project name="apjava-lab4" default="compile" basedir=".">
3   
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"/>
18   
19   <!-- Package name, dirs -->
20   <property name="name" value="AntiTD" /> 
21   <property name="version" value="1.0" /> 
22   <property name="release" value="${name}-${version}" /> 
23   
24   <property name="dist.dir" location="dist" />
25   <property name="jar.name" value="${name}.jar" /> 
26   <property name="jar.path" location="${dist.dir}/${jar.name}" /> 
28   <!-- Classpath -->
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"/>
34     </fileset>
35   </path>
37   <!-- Create build-dirs -->
38   <target name="prepare">
39     <mkdir dir="${build.main.dir}"/>
40     <mkdir dir="${build.test.dir}"/>
41   </target>
43   <!-- Remove build files -->
44   <target name="clean">
45     <delete dir="${build.dir}" />
46   </target>
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}"/>
53     </copy>
54     <!--     <copy todir="${build.main.dir}/config"> -->
55     <!--       <fileset dir="${src.config.dir}"/> -->
56     <!--     </copy> -->
58     <!-- Compile source -->
59     <javac srcdir="${src.dir}" destdir="${build.main.dir}" debug="on">
60       <classpath refid="project.classpath" />
61       <!-- <compilerarg value="-Xlint:unchecked"/> -->
62     </javac>
63   </target>
65   <!-- Compile tests -->
66   <target name="compile-tests" depends="compile">
67     <!-- Copy dirs -->
68     <!--     <copy todir="${build.test.dir}/config"> -->
69     <!--       <fileset dir="${test.config.dir}"/> -->
70     <!--     </copy> -->
71     <!--     <copy todir="${build.test.dir}/resources"> -->
72     <!--       <fileset dir="${src.resources.dir}"/> -->
73     <!--     </copy> -->
74     <!-- Compile -->
75     <javac srcdir="${test.dir}" destdir="${build.test.dir}">
76       <classpath refid="project.classpath" />
77     </javac>
78   </target>
80   <!-- Run tests -->
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" />
85       <batchtest>
86         <!-- Run junit tests on all classes with filenames that end with -->
87         <!-- Test.class -->
88         <fileset dir="${build.test.dir}"
89                  includes="**/*Test.class" />
90       </batchtest>
91       <sysproperty key="doc.dir" value="${doc.dir}" />
92       <sysproperty key="index.dir" value="${index.dir}" />
93     </junit>
94   </target>
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"/>
101     </javadoc>
102   </target>
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"/> -->
109     </java>
110   </target>
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"/> -->
116     </java>
117   </target>
118   
119   <!--   Create jar -->
120   <target name="jar" description="Create jar-file" depends="compile">
121     <mkdir dir="${dist.dir}"/> 
122     <jar destfile="${jar.path}" basedir="${build.main.dir}">
123       <manifest>
124         <attribute name="Main-Class" value="se.umu.cs.dit06ajnajs.AntiTD"/>
125         <attribute name="Class-Path" value="${lib.dir}/jdom.jar"/>
126       </manifest>
127     </jar>
128   </target> 
130   <target name="print-classpath" description="Prints classpath, convenient for export to emacs and jde-mode">
131     <property name="classpath" refid="project.classpath"/>
132     <echo message="-classpath-${classpath}-classpath-"/>
133   </target>
134 </project>