-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
288 lines (209 loc) · 13.4 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="CS290B-HW2" basedir=".">
<description>
Builds, tests, and runs the project CS-290B-HW2.
</description>
<property name="src" location="source"/>
<property name="build" location="build/classes"/>
<property name="dist" location="dist"/>
<!-- ant jsch JAR details -->
<property name="ant_jsch_location_local" location="/home/${username}/.ant/lib/"/>
<property name="ant_jsch_location_remote" location="/cs/student/${username}/.ant/lib/"/>
<property name="ant_jsch_name" value="jsch-0.1.43.jar"/>
<!-- codebase properties -->
<property name="client_file_codebase" location="/cs/student/kowshik/public_html/CS290B/HW2/"/>
<property name="client_web_codebase" value="http://www.cs.ucsb.edu/~kowshik/CS290B/HW2/"/>
<property name="client_codebase_server" value="csil.cs.ucsb.edu"/>
<!-- host names -->
<property name="host1" value="blind.cs.ucsb.edu"/>
<property name="host2" value="satchmo.cs.ucsb.edu"/>
<property name="host_computespace" value="snoopy.cs.ucsb.edu"/>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<sshexec host="${client_codebase_server}" username="${username}" keyfile="/home/${username}/.ssh/headless_rsa" trust="true" command="rm -fr ${client_file_codebase}/tasks/" passphrase=""/>
<sshexec host="${client_codebase_server}" username="${username}" keyfile="/home/${username}/.ssh/headless_rsa" trust="true" command="mkdir -p ${client_file_codebase}/tasks/" passphrase=""/>
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<target name="compile" description="compiles the source">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>
<target name="javadoc" description="create javadocs" depends="compile">
<javadoc packagenames="tasks.*,api.*,client.*,system.*" sourcepath="${src}" destdir="documents/javadoc"/>
</target>
<target name="build_client" description="builds client" depends="compile">
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
<!-- Make client.jar file -->
<jar jarfile="${dist}/client.jar" basedir="${build}" includes="api/** client/** tasks/** system/**"/>
<!-- Copy to web server -->
<scp keyfile="/home/${username}/.ssh/headless_rsa" passphrase="" todir="${username}@${client_codebase_server}:${client_file_codebase}/tasks/">
<fileset dir="${build}/tasks/">
<include name="*.class"/>
</fileset>
</scp>
</target>
<target name="build_computer" description="builds computer" depends="compile">
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
<!-- Make computer.jar file -->
<jar jarfile="${dist}/computer.jar" basedir="${build}" includes="api/** system/Computer.class system/Computer2Space.class system/ComputerImpl.class system/ResultImpl.class"/>
</target>
<target name="runLocalComputer" depends="build_computer" description="run a computer locally">
<!-- run computer -->
<java classname="system.ComputerImpl" fork="true">
<jvmarg value="-Djava.security.policy=policy/policy"/>
<arg value="localhost:2672"/>
<classpath>
<pathelement location="${dist}/computer.jar"/>
</classpath>
</java>
</target>
<target name="runRemoteComputers" depends="build_computer" description="run remote computers">
<!-- create ~/.ant/lib in remote computers -->
<sshexec host="${host1}" username="${username}" keyfile="/home/${username}/.ssh/headless_rsa" trust="true" command="mkdir -p /cs/student/${username}/.ant/lib/" passphrase=""/>
<sshexec host="${host2}" username="${username}" keyfile="/home/${username}/.ssh/headless_rsa" trust="true" command="mkdir -p /cs/student/${username}/.ant/lib/" passphrase=""/>
<!-- scp ant-jsch jar to each of the remote computers -->
<scp keyfile="/home/${username}/.ssh/headless_rsa" passphrase="" todir="${username}@${host1}:${ant_jsch_location_remote}">
<fileset dir="${ant_jsch_location_local}">
<include name="${ant_jsch_name}"/>
</fileset>
</scp>
<scp keyfile="/home/${username}/.ssh/headless_rsa" passphrase="" todir="${username}@${host2}:${ant_jsch_location_remote}">
<fileset dir="${ant_jsch_location_local}">
<include name="${ant_jsch_name}"/>
</fileset>
</scp>
<!-- create location to place build.xml, policy file, computer.jar in remote computers -->
<sshexec host="${host1}" username="${username}" keyfile="/home/${username}/.ssh/headless_rsa" trust="true" command="mkdir -p /cs/student/${username}/computer_${host1}/policy" passphrase=""/>
<sshexec host="${host2}" username="${username}" keyfile="/home/${username}/.ssh/headless_rsa" trust="true" command="mkdir -p /cs/student/${username}/computer_${host2}/policy" passphrase=""/>
<!-- scp build.xml, policy fule and computer.jar to each of the remote computers -->
<scp keyfile="/home/${username}/.ssh/headless_rsa" passphrase="" todir="${username}@${host1}:/cs/student/${username}/computer_${host1}/">
<fileset dir="${dist}/">
<include name="computer.jar"/>
</fileset>
</scp>
<scp keyfile="/home/${username}/.ssh/headless_rsa" passphrase="" todir="${username}@${host1}:/cs/student/${username}/computer_${host1}/">
<fileset dir="./">
<include name="build_remotecomputer.xml"/>
</fileset>
</scp>
<scp keyfile="/home/${username}/.ssh/headless_rsa" passphrase="" todir="${username}@${host1}:/cs/student/${username}/computer_${host1}/policy/">
<fileset dir="policy/">
<include name="policy"/>
</fileset>
</scp>
<scp keyfile="/home/${username}/.ssh/headless_rsa" passphrase="" todir="${username}@${host2}:/cs/student/${username}/computer_${host2}/">
<fileset dir="${dist}/">
<include name="computer.jar"/>
</fileset>
</scp>
<scp keyfile="/home/${username}/.ssh/headless_rsa" passphrase="" todir="${username}@${host2}:/cs/student/${username}/computer_${host2}/">
<fileset dir="./">
<include name="build_remotecomputer.xml"/>
</fileset>
</scp>
<scp keyfile="/home/${username}/.ssh/headless_rsa" passphrase="" todir="${username}@${host1}:/cs/student/${username}/computer_${host2}/policy/">
<fileset dir="policy/">
<include name="policy"/>
</fileset>
</scp>
<!-- run computer in remote hosts -->
<parallel>
<sshexec host="${host1}" username="${username}" keyfile="/home/${username}/.ssh/headless_rsa" trust="true" command="cd /cs/student/${username}/computer_${host1}/; ant -buildfile build_remotecomputer.xml runRemoteComputer" passphrase=""/>
<sshexec host="${host2}" username="${username}" keyfile="/home/${username}/.ssh/headless_rsa" trust="true" command="cd /cs/student/${username}/computer_${host2}/; ant -buildfile build_remotecomputer.xml runRemoteComputer" passphrase=""/>
</parallel>
</target>
<target name="build_space" depends="compile" description="build space">
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
<!-- Make space.jar file -->
<jar jarfile="${dist}/space.jar" basedir="${build}" includes="api/** system/SpaceImpl.class system/ComputerProxy.class system/Computer2Space.class system/Computer.class system/ResultImpl.class"/>
</target>
<target name="runLocalSpace" depends="build_space" description="run compute space locally">
<!-- run space -->
<java classname="system.SpaceImpl" fork="true">
<jvmarg value="-Djava.security.policy=policy/policy"/>
<classpath>
<pathelement location="${dist}/space.jar"/>
</classpath>
</java>
</target>
<target name="runRemoteSpace" depends="build_space" description="runs a remote compute space">
<!-- create ~/.ant/lib in remote computers -->
<sshexec host="${host_computespace}" username="${username}" keyfile="/home/${username}/.ssh/headless_rsa" trust="true" command="mkdir -p /cs/student/${username}/.ant/lib/" passphrase=""/>
<!-- scp ant-jsch jar to each of the remote computers -->
<scp keyfile="/home/${username}/.ssh/headless_rsa" passphrase="" todir="${username}@${host_computespace}:${ant_jsch_location_remote}">
<fileset dir="${ant_jsch_location_local}">
<include name="${ant_jsch_name}"/>
</fileset>
</scp>
<!-- create location to place build.xml, policy file, computer.jar in remote computers -->
<sshexec host="${host_computespace}" username="${username}" keyfile="/home/${username}/.ssh/headless_rsa" trust="true" command="mkdir -p /cs/student/${username}/computespace_${host_computespace}/policy" passphrase=""/>
<!-- scp build.xml, policy file and computer.jar to each of the remote computers -->
<scp keyfile="/home/${username}/.ssh/headless_rsa" passphrase="" todir="${username}@${host_computespace}:/cs/student/${username}/computespace_${host_computespace}/">
<fileset dir="${dist}/">
<include name="space.jar"/>
</fileset>
</scp>
<scp keyfile="/home/${username}/.ssh/headless_rsa" passphrase="" todir="${username}@${host_computespace}:/cs/student/${username}/computespace_${host_computespace}/">
<fileset dir="./">
<include name="build_remotespace.xml"/>
</fileset>
</scp>
<scp keyfile="/home/${username}/.ssh/headless_rsa" passphrase="" todir="${username}@${host_computespace}:/cs/student/${username}/computespace_${host_computespace}/policy/">
<fileset dir="policy/">
<include name="policy"/>
</fileset>
</scp>
<!-- run compute space in remote hosts -->
<sshexec host="${host_computespace}" username="${username}" keyfile="/home/${username}/.ssh/headless_rsa" trust="true" command="cd /cs/student/${username}/computespace_${host_computespace}/; ant -buildfile build_remotespace.xml runRemoteSpace" passphrase=""/>
</target>
<target name="runMandelbrotSetClient" description="run mandelbrot set client" depends="build_client">
<!-- run client -->
<java classname="client.MandelbrotSetClient" fork="true">
<jvmarg value="-Djava.rmi.server.codebase=${client_web_codebase}"/>
<jvmarg value="-Djava.security.policy=policy/policy"/>
<arg value="snoopy.cs.ucsb.edu:2672"/>
<classpath>
<pathelement location="${dist}/client.jar"/>
</classpath>
</java>
</target>
<target name="runTspClient" description="run travelling salesman problem client" depends="build_client">
<!-- run client -->
<java classname="client.TspClient" fork="true">
<jvmarg value="-Djava.rmi.server.codebase=${client_web_codebase}"/>
<jvmarg value="-Djava.security.policy=policy/policy"/>
<arg value="snoopy.cs.ucsb.edu:2672"/>
<classpath>
<pathelement location="${dist}/client.jar"/>
</classpath>
</java>
</target>
<target name="runLocalMandelbrotSetClient" description="run mandelbrot set client locally" depends="build_client">
<!-- run client -->
<java classname="client.MandelbrotSetClient" fork="true">
<jvmarg value="-Djava.rmi.server.codebase=${client_web_codebase}"/>
<jvmarg value="-Djava.security.policy=policy/policy"/>
<arg value="localhost:2672"/>
<classpath>
<pathelement location="${dist}/client.jar"/>
</classpath>
</java>
</target>
<target name="runLocalTspClient" description="run travelling salesman problem client locally" depends="build_client">
<!-- run client -->
<java classname="client.TspClient" fork="true">
<jvmarg value="-Djava.rmi.server.codebase=${client_web_codebase}"/>
<jvmarg value="-Djava.security.policy=policy/policy"/>
<arg value="localhost:2672"/>
<classpath>
<pathelement location="${dist}/client.jar"/>
</classpath>
</java>
</target>
</project>