forked from kupiakos/CS340
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
289 lines (240 loc) · 10.7 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="DemoServer2" 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"/>
<!-- 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}/catan-client.jar"/>
<property name="java.dir" location="java"/>
<property name="java.src" location="${java.dir}/src"/>
<property name="java.swagger" location="demo/docs"/>
<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"/>
<!-- Variables used for JUnit testing -->
<property name="java.test.report" location="${java.dir}/testreport"/>
<property name="java.test" location="${java.dir}/tests"/>
<!--<property name="java.test.formatter" location="${java.test}" />-->
<property name="java.build.test" location="${java.build}/tests"/>
<!-- command line args -->
<property name="host" value="localhost"/>
<property name="port" value="8081"/>
<property name="persistence" value="postgres"/>
<property name="commandListSize" value="5"/>
<!-- CLASSPATHS -->
<!-- ********** -->
<path id="java.lib.classpath">
<fileset dir="${java.lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="classpath.test">
<fileset dir="${java.lib.dir}">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${java.build}"/>
</path>
<!-- TARGETS -->
<!-- ******* -->
<target name="test" depends="junit"/>
<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>
-->
<target name="init" description="create build directories">
<tstamp/>
<mkdir dir="${java.build}"/>
<mkdir dir="${java.dist}"/>
<mkdir dir="${java.build.test}"/>
<mkdir dir="${java.test.report}/results"/>
<mkdir dir="${java.test.report}/report"/>
</target>
<target name="compile" depends="clean, 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="clean" description="clean build files">
<delete dir="${java.build}"/>
<delete dir="${java.dist}"/>
<delete dir="${java.test.report}"/>
</target>
<target name="test-compile" depends="compile" description="compile the test source ">
<javac srcdir="${java.test}" destdir="${java.build.test}" includeantruntime="false">
<classpath refid="classpath.test"/>
</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>
<mkdir dir="${java.dist}/java/plugins"/>
<mkdir dir="${java.dist}/docs"/>
<copy todir="${java.dist}/docs">
<fileset dir="${java.swagger}">
<include name="**"/>
</fileset>
</copy>
<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.main.CatanServer"/>
<attribute name="Class-Path"
value="lib/gson-2.2.4.jar"/>
</manifest>
<zipgroupfileset dir="${java.lib}" includes="**/*.jar"/>
</jar>
<jar jarfile="${java.dist}/java/plugins/mongodb.jar" basedir="${java.src}/server/db/mongodb">
<manifest>
<attribute name="Main-Class" value="server.db.mongodb.MongoProvider"/>
</manifest>
</jar>
<jar jarfile="${java.dist}/java/plugins/postgres.jar" basedir="${java.src}/server/db/postgres">
<manifest>
<attribute name="Main-Class" value="server.db.postgres.PostgresProvider"/>
</manifest>
</jar>
<copy todir="${java.dist}/java/plugins">
<fileset dir="${java.dir}/plugins">
<include name="config.yaml"/>
</fileset>
</copy>
</target>
<!-- compiles our client -->
<target name="our-client" depends="package" description="compiles, packages, and runs the student client">
<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">
<java jar="${java.dist}/catan-server.jar" dir="${java.dist}" fork="yes">
<arg value="${host}"/>
<arg value="${port}"/>
<arg value="${persistence}"/>
<arg value="${commandListSize}"/>
<sysproperty key="com.sun.management.jmxremote" value=""/>
<assertions>
<enable/>
</assertions>
</java>
</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>
<!-- Run the JUnit Tests -->
<!-- Output is XML, could also be plain-->
<target name="junit" depends="test-compile">
<junit printsummary="on" fork="on" haltonfailure="yes" showoutput="yes">
<!--<junit printsummary="off" fork="on"-->
<!--failureproperty="test.failed" showoutput="off" dir="out"-->
<!--outputtoformatters="false" filtertrace="on" >-->
<classpath>
<path refid="classpath.test"/>
<pathelement location="${java.build.test}"/>
</classpath>
<classpath refid="java.lib.classpath"/>
<formatter type="brief" usefile="false"/>
<!--<formatter classname="java.test.formatter" usefile="false" />-->
<batchtest todir="${java.test.report}">
<fileset dir="${java.test}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
</junit>
<!-- generate report with junitreport -->
<junitreport todir="${java.test.report}">
<fileset dir="${java.test.report}/results"/>
<report todir="${java.test.report}/report"/>
</junitreport>
<!-- concat the report through a filter chain to extract what you want -->
<concat>
<fileset file="${java.test.report}/overview-summary.html"/>
<filterchain>
<linecontainsregexp>
<regexp pattern='title="Display all tests"'/>
</linecontainsregexp>
<tokenfilter>
<replaceregex
pattern='<td><a href="all-tests.html" title="Display all tests">(\d+)</a></td><td><a href="alltests-fails.html" title="Display all failures">(\d+)</a></td><td><a href="alltests-errors.html" title="Display all errors">(\d+).*$'
replace="Run: \1, Failed: \2, Errors: \3"/>
</tokenfilter>
</filterchain>
</concat>
<fail message="test failed" if="test.failure"/>
</target>
<target name="main" depends="compile, test">
<description>Main target</description>
</target>
</project>