This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
211 lines (187 loc) · 7.03 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
<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="requests.arg" value="ug"/>
<property name="plugin.arg" value="SQLitePersistenceManager"/>
<property name="N.arg" value="10"/>
<!-- Input folders -->
<property name="java.dir" value="java"/>
<property name="java.src.dir" value="${java.dir}/src"/>
<property name="java.test.dir" value="${java.dir}/test"/>
<property name="java.lib.dir" value="${java.dir}/lib"/>
<property name="java.plugin.dir" value="${java.src.dir}/server/plugin"/>
<property name="java.build" location="${java.dir}/build"/>
<!-- 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="jar.file" value="server.jar"/>
<!-- CLASSPATHS -->
<!-- ********** -->
<path id="java.lib.classpath">
<fileset dir="${java.lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<path id="java.tests.classpath">
<path refid="java.lib.classpath" />
<path location="${java.build}" />
</path>
<!-- TARGETS -->
<!-- ******* -->
<target name="server" description="Runs the demo server">
<java jar="${jar.file}" fork="true">
<arg value="${port.arg}"/>
<arg value="${web.arg}"/>
<arg value="${requests.arg}"/>
<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/**"/>
<include name="server/**"/>
</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.test" location="${java.dir}/test/"/>
<property name="java.images" location="${java.dir}/images"/>
<property name="java.build.plugin" location="${java.build}/server/plugin"/>
<property name="java.dist" location="${java.dir}/dist"/>
<property name="java.lib" location="${java.dir}/lib"/>
<property name="dist.plugins" value="${java.dist}/plugins" />
<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>
<mkdir dir="${java.dist}/docs"/>
<copy todir="${java.dist}/docs">
<fileset dir="docs">
<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.Server"/>
<attribute name="Class-Path"
value="lib/gson-2.2.4.jar lib/sqlite-jdbc-3.7.2.jar" />
</manifest>
</jar>
</target>
<target name="client" depends="package" description="compiles, packages, and runs the student client">
<java jar="${java.dist}/catan-client.jar" dir="${java.dist}" fork="yes">
<sysproperty key="com.sun.management.jmxremote" value=""/>
<assertions>
<enable/>
</assertions>
</java>
</target>
<target name="our-server" depends="package,compile-plugins" description="compiles, packages, and runs the student server">
<java jar="${java.dist}/catan-server.jar" dir="${java.dist}" fork="yes">
<arg value="${port.arg}"/>
<arg value="${plugin.arg}"/>
<arg value="${N.arg}"/>
<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>
<!-- Compile the plugins -->
<target name="compile-plugins" depends="compile" description="compiles the Plugins">
<jar destfile="${dist.plugins}/SQLitePersistenceManager.jar"
basedir="${java.build.plugin}"
includes="*SQLite*.class"/>
<jar destfile="${dist.plugins}/FolderPersistenceManager.jar"
basedir="${java.build.plugin}"
includes="*Folder*.class"/>
<jar destfile="${dist.plugins}/NoPersistenceManager.jar"
basedir="${java.build.plugin}"
includes="*NoPersistence*.class"/>
</target>
<!-- JUnit 4 Tests -->
<target name="compile-tests" depends="compile" description="compiles the JUnit tests">
<javac srcdir="${java.test}" destdir="${java.build}" debug="true" includeantruntime="true">
<classpath refid="java.lib.classpath" />
</javac>
</target>
<target name="test" depends="compile-tests,compile-plugins" description="runs all tests">
<echo>Make sure there are NO instances of the Catan server running!</echo>
<echo>Individual tests start the server as needed.</echo>
<junit dir="${java.dist}" fork="yes" outputtoformatters="false">
<classpath>
<path refid="java.lib.classpath" />
<path location="${java.build}" />
</classpath>
<formatter type="plain" usefile="false" />
<batchtest fork="yes">
<fileset dir="${java.test}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
<assertions>
<enable/>
</assertions>
</junit>
</target>
</project>