-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.xml
230 lines (186 loc) · 8.77 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
<?xml version="1.0" encoding="utf-8"?>
<project default="compile">
<!-- build.xml for Mantis issue
name: P.Conrad for CS56, W11 -->
<property environment="env"/> <!-- load the environment variables -->
<property name="author" value="mastergberry" />
<property name="webRoot" value="${env.HOME}/public_html/" />
<property name="webBaseUrl" value="http://www.cs.ucsb.edu/~${env.USER}/" />
<property name="course" value="cs56" />
<property name="topic" value="games" />
<!--Edited-->
<property name="description" value="client_server.v2" />
<property name="clientName" value="JavaClient" />
<property name="serverName" value="JavaServer" />
<property name="projectName" value="${clientName}" />
<property name="clientClass" value="edu.ucsb.${course}.${topic}.${description}.client.Controllers.${clientName}" />
<property name="serverClass" value="edu.ucsb.${course}.${topic}.${description}.server.Controllers.${serverName}" />
<property name="projectPath" value="${course}/${topic}/${description}" />
<property name="package" value="edu/ucsb/${course}/${topic}/${description}" />
<property name="javadocDest" value="${webRoot}/${projectPath}/javadoc" />
<property name="javadocURL" value="${webBaseUrl}/${projectPath}/javadoc" />
<property name="jwsDest" value="${webRoot}/${projectPath}/jws" />
<property name="jwsURL" value="${webBaseUrl}/${projectPath}/jws" />
<!--Added in Fall 2017-->
<property name="public_javadoc_path" location="../cs56-client-server-javadoc/javadoc"/>
<!-- description 12 -->
<target name="compile" description="compiles source code">
<mkdir dir="build" />
<!-- <mkdir dir="build/${package}/graphics" />
<copy todir="build/${package}/graphics">
<fileset dir="graphics" includes="**" />
</copy> -->
<javac srcdir="src" destdir="build" debug="true" debuglevel="lines,source">
<classpath>
<pathelement location="build"/>
<pathelement location="/cs/faculty/pconrad/public_html/cs56/lib/junit-4.8.2.jar"/>
</classpath>
</javac>
</target>
<!-- description10
-->
<target name="run-client" description="opens a client application" depends="compile">
<java classname="${clientClass}" classpath="build" fork="true"/>
</target>
<!-- description9 -->
<target name="run-server" description="opens a server application" depends="compile">
<java classname="${serverClass}" classpath="build" fork="true" />
</target>
<!--description8 -->
<target name="sign" description="signs the ant-jar with clientname" depends="jar">
<signjar jar="dist/${clientName}.jar" signedjar="dist/${clientName}.jar" alias="alias" storepass="060692" verbose="true"/>
<signjar jar="dist/${serverName}.jar" signedjar="dist/${serverName}.jar" alias="alias" storepass="060692" verbose="true"/>
</target>
<!-- description7-->
<target name="jar" description="creates a new jar file" depends="compile">
<jar destfile="dist/JavaClient.jar" basedir="build">
<fileset dir=".">
<!--<include name="graphics/*.png" /> -->
</fileset>
<manifest>
<attribute name="Main-Class" value="${clientClass}" />
</manifest>
</jar>
<jar destfile="dist/JavaServer.jar" basedir="build">
<manifest>
<attribute name="Main-Class" value="${serverClass}" />
</manifest>
</jar>
</target>
<!-- new description1-->
<target name="clean" description="deletes unnecessary files">
<delete dir="build" quiet="true" />
<delete dir="bin" quiet="true" /> <!-- Eclipse Debug Folder -->
<delete dir="javadoc" quiet="true" />
<delete dir="dist" quiet="true" />
<delete dir="download" quiet="true" />
<delete dir="temp" quiet="true" />
<delete file="numberedsource.txt" quiet="true"/>
</target>
<!--new description2-->
<target name="javadoc" description = "creates a javadoc based on compile" depends="compile">
<delete dir="javadoc" quiet="true" />
<javadoc destdir="javadoc" author="true" version="true" use="true" >
<fileset dir="src" includes="**/*.java"/>
<classpath>
<pathelement location="/cs/faculty/pconrad/public_html/cs56/lib/junit-4.8.2.jar"/>
</classpath>
</javadoc>
<!-- delete the old javadoc -->
<delete quiet="true" dir="${javadocDest}" />
<!-- copy everything you just made to the javadoc destination, and then make it readable -->
<copy todir="${javadocDest}" >
<fileset dir="javadoc"/>
</copy>
<!-- added in Fall 2017-->
<delete quiet="true">
<fileset dir="${public_javadoc_path}" />
</delete>
<mkdir dir="${public_javadoc_path}" />
<copy todir="${public_javadoc_path}">
<fileset dir="javadoc" />
</copy>
<echo>
javadoc copied to ${public_javadoc_path}/index.html
TO PUBLISH: cd into that repo, then git add javadoc;
git commit -m "update javadoc"; git push origin master
</echo>
<!-- Note: this only does the chmod command on the
javadoc subdirectory and its contents. You MIGHT have to
MANUALLY do the chmod on the parent directories. However,
you should only need to do that once. -->
<chmod dir="${javadocDest}" perm="755" type="dir" includes="**" />
<chmod dir="${javadocDest}" perm="755" type="file" includes="**/*" />
<echo>Javadoc deployed to ${javadocURL}</echo>
</target>
<!--description3-->
<target name="dist" description = "package, output to JAR" depends="jar,sign">
<delete quiet="true">
<fileset dir="temp" includes="**/*" />
<fileset dir="download" includes="**/*" />
</delete>
<mkdir dir="download" />
<mkdir dir="temp" />
<mkdir dir="temp/${projectName}" />
<copy todir="temp/${projectName}">
<fileset dir="."
excludes="build/**, javadoc/**, **/*~, temp/**, dist/**, download/**"/>
</copy>
<tar destfile="temp/${projectName}.tar"
basedir="temp"
includes="${projectName}/**"
/>
<gzip zipfile="download/${projectName}.tgz"
src="temp/${projectName}.tar" />
<zip destfile="download/${projectName}.zip"
basedir="temp"
includes="${projectName}/**"
/>
<delete quiet="true">
<fileset dir="temp" includes="**/*"/>
</delete>
</target>
<!--description5-->
<target name="publish" description="publishes .jar" depends="jar,javadoc,dist,jws,linenumbers">
<mkdir dir="${webRoot}/${projectPath}" />
<delete dir="${webRoot}/${projectPath}/browse" />
<mkdir dir="${webRoot}/${projectPath}/browse" />
<delete dir="${webRoot}/${projectPath}/download" />
<mkdir dir="${webRoot}/${projectPath}/download" />
<copy file="html/index.html" todir="${webRoot}/${projectPath}"/>
<copy todir="${webRoot}/${projectPath}/download" >
<fileset dir="download"/>
<fileset dir="dist" />
</copy>
<copy file="build.xml" todir="${webRoot}/${projectPath}/browse" />
<copy file="numberedsource.txt" todir="${webRoot}/${projectPath}/browse" />
<copy todir="${webRoot}/${projectPath}/browse/src" >
<fileset dir="src"/>
</copy>
<chmod dir="${webRoot}/${projectPath}"
perm="755" type="both" includes="**/*"/>
<echo>Project published to ${webBaseUrl}/${projectPath}</echo>
<copy file="numberedsource.txt" todir="${webRoot}/${projectName}/browse"/>
</target>
<!--description4-->
<target name="jws" description = "Compiles a JWS-annotated file into a Web Service" depends="compile,jar,sign">
<delete dir="${webRoot}/${projectName}/jws" />
<mkdir dir="${webRoot}/${projectName}/jws" />
<copy todir="${jwsDest}" file="dist/JavaClient.jar" />
<copy todir="${jwsDest}" file="dist/JavaServer.jar" />
<copy todir="${jwsDest}" >
<fileset dir="jws" includes="*.html"/>
<fileset dir="jws" includes="*.jnlp"/>
<fileset dir="jws" includes="*.png"/>
<fileset dir="jws" includes=".htaccess"/>
</copy>
<echo>Java web start at ${jwsURL}</echo>
</target>
<!--description12-->
<target name="linenumbers" description="Creates a file containing all source files with line numbers">
<exec executable="bash">
<arg value="-c"/>
<arg value='tree -ifQ src | grep \.java\"$ | xargs pr -n > numberedsource.txt'/>
</exec>
</target>
</project>