-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
207 lines (182 loc) · 6.43 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<project name="Demo Server" default="server" basedir=".">
<!-- PROPERTIES -->
<!-- ********** -->
<!-- Directory paths for the java server, javascript, and dest dir for the student copy -->
<property name="port.arg" value="8081"/>
<property name="web.arg" value="gameplay"/>
<property name="options.arg" value="ug"/>
<!-- Input folders -->
<property name="java.dir" value="java"/>
<property name="java.src.dir" value="${java.dir}/src"/>
<property name="java.lib.dir" value="${java.dir}/lib"/>
<property name="resources.dir" value="resources"/>
<!-- JavaScript source folder -->
<property name="javascript.dir" value="gameplay/js"/>
<!-- Base output folder -->
<property name="dest.dir" value="docs"/>
<!-- Javadoc output folder -->
<property name="javadoc.dir" value="${dest.dir}/java"/>
<!-- YUIDoc output folder -->
<property name="yuidoc.dir" value="${dest.dir}/javascript"/>
<!-- Jar file path/name from here -->
<property name="demo.dir" value="demo"/>
<property name="server.jar.file" value="${demo.dir}/server.jar"/>
<property name="client.jar.file" value="${demo.dir}/client.jar"/>
<!-- CLASSPATHS -->
<!-- ********** -->
<path id="java.lib.classpath">
<fileset dir="${java.lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<!-- TARGETS -->
<!-- ******* -->
<target name="server" description="Runs the demo server">
<java jar="${server.jar.file}" fork="true" dir="${demo.dir}">
<arg value="${port.arg}"/>
<arg value="${web.arg}"/>
<arg value="${options.arg}"/>
<assertions>
<enable/>
</assertions>
</java>
</target>
<target name="client" description="Runs the demo client">
<java jar="${client.jar.file}" fork="true" dir="${demo.dir}">
<assertions>
<enable/>
</assertions>
</java>
</target>
<target name="make-java-doc" description="Generate the Java docs">
<echo> Making Java documentation </echo>
<delete dir="${javadoc.dir}"/>
<javadoc destdir="${javadoc.dir}" Package="true">
<classpath refid="java.lib.classpath" />
<packageset dir="${java.src.dir}">
<include name="client/**"/>
<include name="shared/**"/>
</packageset>
</javadoc>
</target>
<!--
<target name="make-js-doc" description="Generate the JavaScript docs">
<echo> Making JavaScript documentation </echo>
<exec executable="yuidoc">
<arg value="-o"/>
<arg value="${yuidoc.dir}"/>
<arg value="${javascript.dir}"/>
</exec>
</target>
-->
<property name="java.dir" location="java"/>
<property name="java.src" location="${java.dir}/src"/>
<property name="java.images" location="${java.dir}/images"/>
<property name="java.build" location="${java.dir}/build"/>
<property name="java.dist" location="${java.dir}/dist"/>
<property name="java.lib" location="${java.dir}/lib"/>
<target name="init" description="create build directories">
<tstamp/>
<mkdir dir="${java.build}"/>
<mkdir dir="${java.dist}"/>
</target>
<target name="clean" description="clean build files" >
<delete dir="${java.build}"/>
<delete dir="${java.dist}"/>
</target>
<target name="compile" depends="init" description="compile the source " >
<javac srcdir="${java.src}" destdir="${java.build}" debug="true" includeantruntime="true">
<classpath refid="java.lib.classpath" />
</javac>
</target>
<target name="package" depends="compile" description="package the jar file" >
<mkdir dir="${java.dist}/lib"/>
<copy todir="${java.dist}/lib">
<fileset dir="${java.lib}">
<include name="**"/>
</fileset>
</copy>
<mkdir dir="${java.dist}/images"/>
<copy todir="${java.dist}/images">
<fileset dir="${java.images}">
<include name="**"/>
</fileset>
</copy>
<copy todir="${java.dist}/resources">
<fileset dir="${resources.dir}">
<include name="**"/>
</fileset>
</copy>
<manifestclasspath property="server.classpath"
jarfile="${java.dist}/catan-server.jar">
<classpath refid="java.lib.classpath"/>
</manifestclasspath>
<jar jarfile="${java.dist}/catan-client.jar" basedir="${java.build}">
<manifest>
<attribute name="Main-Class" value="client.main.Catan"/>
<attribute name="Class-Path"
value="lib/gson-2.2.4.jar" />
</manifest>
</jar>
<jar jarfile="${java.dist}/catan-server.jar" basedir="${java.build}">
<manifest>
<attribute name="Main-Class" value="server.http.CatanServer"/>
<attribute name="Class-Path"
value="${server.classpath}" />
</manifest>
</jar>
</target>
<target name="our-client" depends="package" description="compiles, packages, and runs the student client">
<property name="host" value="localhost"/>
<property name="port" value="8081"/>
<java jar="${java.dist}/catan-client.jar" dir="${java.dist}" fork="yes">
<arg value="${host}"/>
<arg value="${port}"/>
<sysproperty key="com.sun.management.jmxremote" value=""/>
<assertions>
<enable/>
</assertions>
</java>
</target>
<target name="our-server" depends="package" description="compiles, packages, and runs the student server">
<property name="database" value="sqlite"/>
<property name="command" value="10"/>
<property name="wipe" value=""/>
<java jar="${java.dist}/catan-server.jar" dir="${java.dist}" fork="yes">
<arg value="${database}"/>
<arg value="${command}"/>
<arg value="${wipe}"/>
<sysproperty key="com.sun.management.jmxremote" value=""/>
<classpath>
<fileset dir="${java.lib}">
<include name="**/*.jar"/>
</fileset>
</classpath>
<assertions>
<enable/>
</assertions>
</java>
</target>
<mkdir dir="${java.dist}/docs"/>
<copy todir="${java.dist}">
<fileset dir="docs"/>
</copy>
<path id="junit.classpath">
<fileset dir="${java.lib.dir}"/>
<fileset dir="${java.dist}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="test" depends="package" description="only runs junit tests">
<junit printsummary="withOutAndErr">
<classpath refid="junit.classpath"/>
<formatter type="plain" usefile="false"/>
<test name="testing.SerializedPersistenceTest"/>
<test name="testing.RelationalPersistenceTest"/>
<!-- TODO put the name of your test classes here, then run ant test -->
</junit>
</target>
<target name="make-tester-zip" depends="package" description="makes a zip file for your testing team">
<zip destfile="./tester.zip" basedir="${java.dist}" />
</target>
</project>