-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·117 lines (97 loc) · 3.9 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!-- Ant build script -->
<project name="BinMaster" default="build-clean" basedir="./src/Dugeon/">
<description>
Build BinMaster game
</description>
<property name="project_name" value="BinMaster" />
<property name="main_class_client" value="com.rmit.sea.dungeon.Dungeon" />
<property name="main_class_server" value="com.rmit.sea.webserver.WebServer" />
<!-- set global properties for this build -->
<property name="lib" location="lib" />
<property name="res" location="res" />
<property name="src" location="src" />
<property name="build" location="build" />
<property name="build-test" location="${build}/test" />
<property name="dist" location="dist" />
<property name="dist-res" location="${dist}/res" />
<target name="init" description="initialize the build environment">
<!-- Create the time stamp -->
<tstamp />
<!-- Create directory structures -->
<mkdir dir="${build}" />
<mkdir dir="${dist}" />
</target>
<target name="compile" description="compile the source" depends="init">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" includeantruntime="false">
<classpath>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
</target>
<target name="test" depends="compile" description="run test suites">
<junit printsummary="yes" haltonfailure="yes" showoutput="yes">
<classpath>
<pathelement location="${src}" />
<pathelement location="${build}" />
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${dist}" />
</classpath>
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="${src}">
<include name="**/*Test*.java" />
</fileset>
</batchtest>
</junit>
<!-- delete all tests which are built before -->
<delete dir="${build-test}" />
</target>
<target name="dist-client" depends="test" description="generate the distribution">
<!-- create the jar file -->
<jar jarfile="${dist}/${project_name}-${DSTAMP}-client.jar" basedir="${build}">
<!-- Put everything in ${lib} into the jar file, except junit and mockito libs -->
<zipgroupfileset dir="${lib}" includes="*.jar">
<exclude name="*junit*" />
<exclude name="*mockito" />
</zipgroupfileset>
<!-- copy Spring beans file to the jar file -->
<fileset dir="${src}" casesensitive="yes">
<filename name="*.xml"/>
</fileset>
<!-- Set the main class in jar manifest -->
<manifest>
<attribute name="Main-Class" value="${main_class_client}" />
</manifest>
</jar>
<!-- copy recource files to the same dir with jar file -->
<copy todir="${dist-res}">
<fileset dir="${res}">
<filename name="*.*" />
</fileset>
</copy>
</target>
<target name="dist-server" depends="test" description="generate the distribution">
<!-- create the jar file -->
<jar jarfile="${dist}/${project_name}-${DSTAMP}-server.jar" basedir="${build}">
<!-- Set the main class in jar manifest -->
<manifest>
<attribute name="Main-Class" value="${main_class_server}" />
</manifest>
</jar>
</target>
<target name="build-clean" description="clean up" depends="dist-client, dist-server">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}" />
<echo message="BUILD SUCCESSFUL" />
<echo message="To run the program:" />
<echo message=" cd src/Dugeon/dist/" />
<echo message=" java -jar BinMaster-*-server.jar" />
<echo message=" java -jar BinMaster-*-client.jar" />
<echo message="Enjoy it !!!" />
</target>
</project>