-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
200 lines (166 loc) · 6.14 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
<project name="Record Indexer" default="compile" basedir=".">
<!-- PROPERTIES -->
<!-- ********** -->
<!-- Directory containing application source code -->
<property name="src" location="src"/>
<!-- Directory containing testing source code -->
<property name="test" location="test"/>
<!-- Directory containing Java libraries -->
<property name="lib" location="lib"/>
<!-- Directory where the Java compiler puts .class files -->
<property name="build" location="build"/>
<!-- Directory containing database files -->
<property name="database" location="data"/>
<!-- Directory containing demo files -->
<property name="demo" location="demo"/>
<!-- Directory containing passoff files -->
<property name="passoff" location="passoff"/>
<!-- Database file used by the server -->
<property name="db-file" location="${database}/IndexDb.sqlite"/>
<!-- Database file containing empty tables. -->
<property name="empty-db-file" location="${database}/IndexDb_Blank.sqlite"/>
<!-- File containing the report output by Checkstyle -->
<property name="checkstyle-report-file" location="checkstyle-report.txt"/>
<!-- Default values for command-line properties. Values specified on the command-line will override these. -->
<property name="file" value="./data/Records.xml"/>
<property name="host" value="localhost"/>
<property name="port" value="39640"/>
<!-- CLASS PATHS -->
<!-- *********** -->
<path id="lib-classpath">
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</path>
<path id="all-classpath">
<path refid="lib-classpath"/>
<pathelement location="${build}"/>
</path>
<path id="passoff-classpath">
<path refid="all-classpath"/>
<pathelement location="${passoff}/server-passoff.jar"/>
</path>
<!-- TASK DEFINITIONS -->
<!-- **************** -->
<taskdef classpathref="lib-classpath" resource="checkstyletask.properties"/>
<!-- TARGETS -->
<!-- ******* -->
<target name="init" description="create build directories">
<tstamp/>
<mkdir dir="${build}"/>
<mkdir dir="${passoff}"/>
</target>
<target name="clean" description="delete build files and directories">
<delete dir="${build}"/>
<delete dir="${passoff}"/>
</target>
<target name="compile" depends="init" description="compile the source code">
<javac srcdir="${src}" classpathref="lib-classpath" destdir="${build}" debug="true" includeantruntime="true" />
<javac srcdir="${test}" classpathref="lib-classpath" destdir="${build}" debug="true" includeantruntime="true" />
</target>
<!-- ant import -Dfile=<INDEXER_DATA_XML_FILE> -->
<!-- EXAMPLE: ant import -Dfile=dir1/dir2/indexer_data.xml -->
<target name="import" depends="compile" description="import indexer data">
<copy file="${empty-db-file}" tofile="${db-file}" overwrite="true"/>
<java classname="server.DataImporter" fork="yes">
<classpath>
<path refid="all-classpath"/>
</classpath>
<arg value="${file}"/>
<assertions>
<enable/>
</assertions>
</java>
</target>
<!-- ant server {-Dport=<SERVER_PORT_NUMBER>} -->
<!-- EXAMPLE: ant server -Dport=39640 -->
<!-- If port number is omitted, run on default port. -->
<!-- EXAMPLE: ant server -->
<target name="server" depends="compile" description="run server on specified port">
<java classname="server.Server" fork="yes">
<classpath>
<path refid="all-classpath"/>
</classpath>
<arg value="${port}"/>
<assertions>
<enable/>
</assertions>
</java>
</target>
<target name="server-gui" depends="compile" description="run the server test gui">
<java classname="serverTester.GuiTester" fork="yes">
<classpath>
<path refid="all-classpath"/>
</classpath>
<assertions>
<enable/>
</assertions>
</java>
</target>
<target name="server-tests" depends="compile" description="run automated server tests">
<java classname="server.ServerUnitTests" fork="yes">
<classpath>
<path refid="all-classpath"/>
</classpath>
<assertions>
<enable/>
</assertions>
</java>
</target>
<!-- ant server-passoff {-Dhost=<SERVER_HOST>} {-Dport=<SERVER_PORT_NUMBER>} -->
<!-- EXAMPLE: ant server-passoff -Dhost=testserver.cs.byu.edu -Dport=39640 -->
<!-- If host and/or port number are omitted, default values are used. -->
<!-- EXAMPLE: ant server-passoff -->
<target name="server-passoff" depends="compile" description="run server passoff using server on specified host and port">
<java classname="passoff.ServerPassoff" fork="yes">
<classpath>
<path refid="passoff-classpath"/>
</classpath>
<arg value="${host}"/>
<arg value="${port}"/>
<assertions>
<enable/>
</assertions>
</java>
</target>
<!-- ant client {-Dhost=<SERVER_HOST>} {-Dport=<SERVER_PORT_NUMBER>} -->
<!-- EXAMPLE: ant client -Dhost=testserver.cs.byu.edu -Dport=39640 -->
<!-- If host and/or port number are omitted, default values are used. -->
<!-- EXAMPLE: ant client -->
<target name="client" depends="compile" description="run client using server on specified host and port">
<java classname="client.gui.IndexerClient" fork="yes">
<classpath>
<path refid="all-classpath"/>
</classpath>
<arg value="${host}"/>
<arg value="${port}"/>
<assertions>
<enable/>
</assertions>
</java>
</target>
<target name="client-tests" depends="compile" description="run automated client tests">
<java classname="client.ClientUnitTests" fork="yes">
<classpath>
<path refid="all-classpath"/>
</classpath>
<assertions>
<enable/>
</assertions>
</java>
</target>
<target name="checkstyle" depends="compile" description="run checkstyle on all source code">
<checkstyle config="checkstyle.xml">
<fileset dir="${src}" includes="**/*.java">
</fileset>
<formatter type="plain" toFile="${checkstyle-report-file}"/>
<classpath>
<pathelement location="${build}"/>
</classpath>
</checkstyle>
</target>
<target name="demo" description="run the demo">
<java jar="${demo}/record-indexer-demo.jar" fork="yes" dir="${demo}">
</java>
</target>
</project>