-
Notifications
You must be signed in to change notification settings - Fork 8
/
build-cloud-bridge.xml
477 lines (477 loc) · 19.7 KB
/
build-cloud-bridge.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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
<?xml version="1.0" encoding="utf-8"?>
<project name="CloudBridge" default="help" basedir=".">
<target name="help">
<echo level="info" message="Ant Build File for CloudBridge" />
<echo level="info" message="Type 'ant -projecthelp' to get a list of targets and their descriptions." />
</target>
<target name="usage" depends="help" />
<dirname property="base.dir" file="${ant.file.CloudBridge}" />
<property environment="env" />
<property name="axis2.home" value="${base.dir}" />
<path id="axis2.class.path">
<fileset dir="${axis2.home}">
<include name="lib/*.jar" />
</fileset>
</path>
<taskdef name="wsdl2code" classname="org.apache.axis2.tool.ant.AntCodegenTask" classpathref="axis2.class.path" />
<!-- directories for build and distribution -->
<property name="env.CATALINA_HOME" value="${base.dir}/tomcat" />
<property name="catalina.dir" value="${env.CATALINA_HOME}" />
<property name="build.dir" location="${base.dir}/" />
<property name="buildnumber.dir" location="${build.dir}/" />
<property name="target.dir" location="${base.dir}/target" />
<property name="classes.dir" location="${target.dir}/classes" />
<property name="dist.dir" location="${target.dir}/dist-files" />
<property name="jar.dir" location="${target.dir}/jar" />
<property name="build.log" location="${target.dir}/ant_verbose.txt" />
<property name="thirdparty.dir" location="${base.dir}/lib" />
<property name="rampart.dir" location="${base.dir}/rampart-lib" />
<property file="${build.dir}/build-cloud-bridge.properties" />
<property name="version" value="${company.major.version}.${company.minor.version}.${company.patch.version}" />
<property name="tomcat.home" location="${catalina.dir}" />
<property name="deploy.dir" location="${tomcat.home}" />
<property name="rpm.install.dir" location="${base.dir}/../../../../../../packages/config/rpm/tmp/BUILD/cloud-bridge-${version}-1" />
<property name="rpm.tomcat.dir" location="${rpm.install.dir}/usr/share/cloud/bridge" />
<property name="debian.install.dir" location="${base.dir}/packages/config/debian/tmp" />
<property name="debian.tomcat.dir" location="${debian.install.dir}/usr/share/cloud/bridge" />
<echo level="info" message="deploy home: ${deploy.dir}" />
<path id="thirdparty.classpath">
<fileset dir="${thirdparty.dir}">
<include name="*.jar" />
</fileset>
</path>
<path id="rampart.classpath">
<fileset dir="${rampart.dir}">
<include name="*.jar" />
</fileset>
</path>
<path id="dist.classpath">
<fileset dir="${target.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<target name="-init">
<mkdir dir="${dist.dir}" />
<mkdir dir="${target.dir}" />
<record name="${build.log}" loglevel="verbose" action="start" />
<!-- create a UTC build timestamp using ISO 8601 formatting -->
<tstamp>
<format property="utc.build.timestamp" pattern="yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" timezone="GMT" />
</tstamp>
<!-- remember who/where did the build -->
<exec executable="hostname" outputproperty="host.name" />
<property name="builder.at" value="${user.name} at ${host.name}" />
<property name="builder.id" value="${builder.at}, on ${utc.build.timestamp}" />
<property name="built.by" value="${builder.at}, ${utc.build.timestamp}" />
<echo level="info" message="builder: ${builder.id}" />
<!-- set build.number property, stored in eponymous file -->
<buildnumber file="${buildnumber.dir}/build.number" />
<condition property="impl.version" value="${version}.${build.number}" else="${version}">
<and>
<isset property="update.build.number" />
</and>
</condition>
<echo message="Build number is ${impl.version}" />
<propertyfile file="${base.dir}/conf/ec2-service.properties">
<entry key="cloudbridgeVersion" value="${impl.version}" />
</propertyfile>
<replaceregexp file="wscript"
match="VERSION = '(.*)'"
replace="VERSION = '${impl.version}'"
byline="true"
/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${jar.dir}" />
<mkdir dir="${dep.cache.dir}" />
<record name="${build.log}" action="stop" />
</target>
<target name="clean" description="clean up files generated by the build">
<delete file="${build.log}" />
<delete dir="${classes.dir}" />
<delete dir="${jar.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${target.dir}" />
</target>
<target name="clean-tomcat">
<delete dir="${tomcat.home}/webapps/bridge" />
</target>
<path id="cloud-bridge.classpath">
<path refid="thirdparty.classpath" />
<path refid="rampart.classpath" />
<path refid="dist.classpath" />
</path>
<target name="compile-cloud-bridge" depends="-init" description="Compile Cloud.com Simple Storage Service">
<compile-java jar.name="cloud-bridge.jar" top.dir="${base.dir}" classpath="cloud-bridge.classpath">
<include-files>
<fileset dir="${base.dir}/src">
<include name="**/*.hbm.xml" />
</fileset>
</include-files>
</compile-java>
</target>
<target name="build-cloud-bridge-jar" depends="-init, compile-cloud-bridge" description="Builds cloud-bridge jar file.">
<jar jarfile="${dist.dir}/cloud-bridge.jar" basedir="${target.dir}/classes/cloud-bridge.jar" excludes="**/client/*">
<fileset dir="${base.dir}/src">
<include name="**/*.hbm.xml" />
</fileset>
</jar>
</target>
<target name="build-cloud-bridge-s3" depends="-init, compile-cloud-bridge" description="Builds cloud-bridge S3 AAR file.">
<jar jarfile="${dist.dir}/cloud-s3.aar" basedir="${target.dir}/classes/cloud-bridge.jar" excludes="**/*">
<!--
<metainf dir="${base.dir}/resource/AmazonS3">
<include name="services.xml" />
<include name="AmazonS3.wsdl" />
</metainf>
-->
</jar>
</target>
<target name="build-cloud-auth-s3" depends="-init, compile-cloud-bridge" description="Builds cloud-bridge S3 auth MAR file.">
<jar jarfile="${dist.dir}/cloud-auth-s3.mar" basedir="${target.dir}/classes/cloud-bridge.jar" excludes="**/*">
<fileset dir="${target.dir}/classes/cloud-bridge.jar">
<include name="**/auth/s3/*.class" />
</fileset>
<metainf dir="${base.dir}/src/com/cloud/bridge/auth/s3">
<include name="module.xml" />
</metainf>
</jar>
</target>
<target name="build-cloud-bridge-ec2" depends="-init, compile-cloud-bridge" description="Builds cloud-bridge EC2 AAR file.">
<jar jarfile="${dist.dir}/cloud-ec2.aar" basedir="${target.dir}/classes/cloud-bridge.jar" excludes="**/*">
<metainf dir="${base.dir}/resource/AmazonEC2">
<include name="services.xml" />
<include name="AmazonEC2.wsdl" />
</metainf>
</jar>
</target>
<target name="build-cloud-auth-ec2" depends="-init, compile-cloud-bridge" description="Builds cloud-bridge EC2 auth MAR file.">
<jar jarfile="${dist.dir}/cloud-auth-ec2.mar" basedir="${target.dir}/classes/cloud-bridge.jar" excludes="**/*">
<fileset dir="${target.dir}/classes/cloud-bridge.jar">
<include name="**/auth/ec2/*.class" />
</fileset>
<metainf dir="${base.dir}/src/com/cloud/bridge/auth/ec2">
<include name="module.xml" />
</metainf>
</jar>
</target>
<target name="deploy-axis" depends="-init">
<unwar overwrite="true" src="${base.dir}/lib/axis2.war" dest="${deploy.dir}/webapps/bridge" />
</target>
<condition property="access_key.private.notpresent">
<not>
<available file="${base.dir}/cloud_private_key.pem" type="file" property="access_key.private.notpresent"/>
</not>
</condition>
<!-- Dev Environment ONLY -->
<target name="generate-cloud-access-keys" if="access_key.private.notpresent">
<exec executable="openssl" searchpath="true">
<arg line="req -x509 -nodes -days 365 -newkey rsa:2048 -subj '/C=US/ST=California/L=Cupertino/O=cloud.com/CN=cloudbridge-test' -keyout ${base.dir}/cloud_private_key.pem -out ${base.dir}/cloud_cert.pem"/>
</exec>
</target>
<!-- Dev Environment ONLY - this assumes EC2_ACCESS_KEY, EC2_SECRET_KEY and EC2_URL have already been defined...-->
<target name="register-cloud-bridge" description="Register with cloud-bridge (For Dev environments only)" depends="generate-cloud-access-keys">
<exec executable="${base.dir}/dist/setup/cloud-bridge-register">
<arg value="--apikey=${env.EC2_ACCESS_KEY}" />
<arg value="--secretkey=${env.EC2_SECRET_KEY}" />
<arg value="--cert=${base.dir}/cloud_cert.pem" />
<arg value="--url=${env.EC2_URL}" />
</exec>
</target>
<target name="build-cloud-bridge" depends="build-cloud-bridge-jar,build-cloud-bridge-s3,build-cloud-bridge-ec2,build-cloud-auth-s3,build-cloud-auth-ec2" description="Builds all of cloud-bridge">
</target>
<target name="deploy-cloud-bridge" depends="build-cloud-bridge-jar, build-cloud-bridge">
<!--
<copy todir="${deploy.dir}/webapps/bridge/WEB-INF/services">
<fileset dir="${dist.dir}">
<include name="cloud-s3.aar"/>
</fileset>
</copy>
-->
<copy todir="${deploy.dir}/webapps/bridge/WEB-INF/services">
<fileset dir="${dist.dir}">
<include name="cloud-ec2.aar" />
</fileset>
</copy>
<copy todir="${deploy.dir}/webapps/bridge/WEB-INF/modules">
<fileset dir="${dist.dir}">
<include name="cloud-auth-s3.mar" />
</fileset>
</copy>
<copy todir="${deploy.dir}/webapps/bridge/WEB-INF/modules">
<fileset dir="${dist.dir}">
<include name="cloud-auth-ec2.mar" />
</fileset>
</copy>
<copy todir="${deploy.dir}/webapps/bridge/WEB-INF/lib">
<fileset dir="${jar.dir}">
<include name="cloud-bridge.jar" />
</fileset>
</copy>
<copy todir="${deploy.dir}/webapps/bridge/WEB-INF/lib">
<fileset dir="${base.dir}/lib">
<include name="*.jar" />
<exclude name="mysql-connector-java-5.1.7-bin.jar" />
</fileset>
</copy>
<copy todir="${deploy.dir}/lib">
<fileset dir="${base.dir}/lib">
<include name="mysql-connector-java-5.1.7-bin.jar" />
</fileset>
</copy>
<copy overwrite="false" todir="${deploy.dir}/conf">
<fileset dir="${base.dir}/conf/">
<include name="**/*" />
</fileset>
</copy>
<copy overwrite="true" todir="${deploy.dir}/webapps/bridge/WEB-INF/conf">
<fileset dir="${base.dir}/resource/Axis2/">
<include name="axis2.xml" />
</fileset>
</copy>
<copy overwrite="true" todir="${deploy.dir}/webapps/bridge/WEB-INF">
<fileset dir="${base.dir}/web/">
<include name="web.xml" />
</fileset>
</copy>
<!-- rampart lib goes where the axis lib files go -->
<copy todir="${deploy.dir}/webapps/bridge/WEB-INF/lib">
<fileset dir="${base.dir}/rampart-lib">
<include name="*.jar" />
</fileset>
</copy>
<!-- copying over rampart mar files for WS-Security -->
<copy todir="${deploy.dir}/webapps/bridge/WEB-INF/modules">
<fileset dir="${base.dir}/modules">
<include name="*.mar" />
</fileset>
</copy>
<!-- WS-Security requires this keystore -->
<copy todir="${deploy.dir}/webapps/bridge/WEB-INF/classes">
<fileset dir="${base.dir}/resource/AmazonEC2">
<include name="crypto.properties" />
<include name="xes.keystore" />
</fileset>
</copy>
</target>
<target name="deploy-debian-install" depends="build-cloud-bridge-jar, build-cloud-bridge">
<copy todir="${debian.tomcat.dir}/webapps/bridge/WEB-INF/services">
<fileset dir="${dist.dir}">
<!--
<include name="cloud-s3.aar"/>
-->
<include name="cloud-ec2.aar" />
</fileset>
</copy>
<copy todir="${debian.tomcat.dir}/webapps/bridge/WEB-INF/modules">
<fileset dir="${dist.dir}">
<include name="cloud-auth-s3.mar" />
<include name="cloud-auth-ec2.mar" />
</fileset>
<fileset dir="${base.dir}/modules">
<include name="*.mar" />
</fileset>
</copy>
<copy todir="${debian.tomcat.dir}/webapps/bridge/WEB-INF/lib">
<fileset dir="${base.dir}/rampart-lib">
<include name="*.jar" />
</fileset>
<fileset dir="${jar.dir}">
<include name="cloud-bridge.jar" />
</fileset>
</copy>
<copy todir="${debian.tomcat.dir}/lib">
<fileset dir="${base.dir}/lib">
<include name="*.jar" />
</fileset>
</copy>
<copy todir="${debian.tomcat.dir}/webapps/bridge/WEB-INF/classes">
<fileset dir="${base.dir}/resource/AmazonEC2">
<include name="crypto.properties" />
<include name="xes.keystore" />
</fileset>
</copy>
<copy overwrite="true" todir="${debian.tomcat.dir}/conf">
<fileset dir="${base.dir}/conf/">
<include name="**/*" />
</fileset>
<fileset dir="${base.dir}/dist/tomcat">
<include name="**/*" />
</fileset>
</copy>
<copy overwrite="true" todir="${debian.tomcat.dir}/webapps/bridge/WEB-INF/conf">
<fileset dir="${base.dir}/resource/Axis2/">
<include name="axis2.xml" />
</fileset>
</copy>
<copy overwrite="true" todir="${debian.tomcat.dir}/webapps/bridge/WEB-INF">
<fileset dir="${base.dir}/web/">
<include name="web.xml" />
</fileset>
</copy>
<copy overwrite="true" todir="${debian.install.dir}/usr/share/cloud/setup/bridge/db">
<fileset dir="${base.dir}/db/mysql">
<include name="*.sql" />
<include name="*.sh" />
</fileset>
</copy>
<copy overwrite="true" todir="${debian.install.dir}/etc/init.d">
<fileset dir="${base.dir}/dist/init/debian/">
<include name="cloud-bridge" />
</fileset>
</copy>
<copy overwrite="true" todir="${debian.install.dir}/usr/bin">
<fileset dir="${base.dir}/dist/setup">
<include name="*" />
</fileset>
</copy>
</target>
<target name="deploy-rpm-install" depends="build-cloud-bridge-jar, build-cloud-bridge">
<copy todir="${rpm.tomcat.dir}/webapps/bridge/WEB-INF/services">
<fileset dir="${dist.dir}">
<!--
<include name="cloud-s3.aar"/>
-->
<include name="cloud-ec2.aar" />
</fileset>
</copy>
<copy todir="${rpm.tomcat.dir}/webapps/bridge/WEB-INF/modules">
<fileset dir="${dist.dir}">
<include name="cloud-auth-s3.mar" />
<include name="cloud-auth-ec2.mar" />
</fileset>
<fileset dir="${base.dir}/modules">
<include name="*.mar" />
</fileset>
</copy>
<copy todir="${rpm.tomcat.dir}/webapps/bridge/WEB-INF/lib">
<fileset dir="${base.dir}/rampart-lib">
<include name="*.jar" />
</fileset>
<fileset dir="${jar.dir}">
<include name="cloud-bridge.jar" />
</fileset>
</copy>
<copy todir="${rpm.tomcat.dir}/lib">
<fileset dir="${base.dir}/lib">
<include name="*.jar" />
</fileset>
</copy>
<copy todir="${rpm.tomcat.dir}/webapps/bridge/WEB-INF/classes">
<fileset dir="${base.dir}/resource/AmazonEC2">
<include name="crypto.properties" />
<include name="xes.keystore" />
</fileset>
</copy>
<copy overwrite="false" todir="${rpm.tomcat.dir}/conf">
<fileset dir="${base.dir}/conf/">
<include name="**/*" />
</fileset>
<fileset dir="${base.dir}/dist/tomcat">
<include name="**/*" />
</fileset>
</copy>
<copy overwrite="true" todir="${rpm.tomcat.dir}/webapps/bridge/WEB-INF/conf">
<fileset dir="${base.dir}/resource/Axis2/">
<include name="axis2.xml" />
</fileset>
</copy>
<copy overwrite="true" todir="${rpm.tomcat.dir}/webapps/bridge/WEB-INF">
<fileset dir="${base.dir}/web/">
<include name="web.xml" />
</fileset>
</copy>
<copy overwrite="true" todir="${rpm.install.dir}/usr/share/cloud/setup/bridge/db">
<fileset dir="${base.dir}/db/mysql">
<include name="*.sql" />
<include name="*.sh" />
</fileset>
</copy>
<copy overwrite="true" todir="${rpm.install.dir}/etc/init.d">
<fileset dir="${base.dir}/dist/init/rpm/">
<include name="cloud-bridge" />
</fileset>
</copy>
<copy overwrite="true" todir="${rpm.install.dir}/usr/bin">
<fileset dir="${base.dir}/dist/setup">
<include name="*" />
</fileset>
</copy>
</target>
<target name="deploydb">
<echo message="deploydb" />
<exec dir="${db.dir}" executable="bash">
<arg value="deploy-db-bridge.sh" />
</exec>
</target>
<target name="download-ELB-wsdl">
<echo message="downloading ElasticLoadBalancing.wsdl..." />
<get src="http://elasticloadbalancing.amazonaws.com/doc/2011-04-05/ElasticLoadBalancing.wsdl" dest="wsdl/" verbose="true" usetimestamp="true" overwrite="false"/>
</target>
<target name="codegen-server-s3">
<wsdl2code
wsdlfilename="${base.dir}/wsdl/cloud-AmazonS3.wsdl"
serverside="true"
generateservicexml="true"
skipbuildxml="true"
serversideinterface="true"
namespacetopackages="http://s3.amazonaws.com/doc/2006-03-01/=com.amazon.s3"
targetsourcefolderlocation="src"
targetresourcesfolderlocation="resource/AmazonS3"
overwrite="true"
/>
</target>
<target name="codegen-server-ec2">
<wsdl2code wsdlfilename="${base.dir}/wsdl/AmazonEC2.wsdl" serverside="true" generateservicexml="true" skipbuildxml="true" serversideinterface="true" namespacetopackages="http://ec2.amazonaws.com/doc/2010-11-15/=com.amazon.ec2"
targetsourcefolderlocation="src" targetresourcesfolderlocation="resource/AmazonEC2" overwrite="true" />
</target>
<target name="codegen-server-elb" depends="download-ELB-wsdl">
<wsdl2code wsdlfilename="${base.dir}/wsdl/ElasticLoadBalancing.wsdl" serverside="true" generateservicexml="true" skipbuildxml="true" serversideinterface="true" namespacetopackages="http://elasticloadbalancing.amazonaws.com/doc/2011-04-05/=com.amazon.elb" targetsourcefolderlocation="src" targetresourcesfolderlocation="resource/AmazonELB" overwrite="true" />
</target>
<target name="codegen-client-s3">
<wsdl2code wsdlfilename="${base.dir}/wsdl/cloud-AmazonS3.wsdl" serverside="false" generateservicexml="false" skipbuildxml="true" serversideinterface="false" namespacetopackages="http://s3.amazonaws.com/doc/2006-03-01/=com.amazon.s3.client" targetsourcefolderlocation="src" targetresourcesfolderlocation="resource/AmazonS3" overwrite="true" />
</target>
<target name="codegen-client-ec2">
<wsdl2code wsdlfilename="${base.dir}/wsdl/AmazonEC2.wsdl" serverside="false" generateservicexml="false" skipbuildxml="true" serversideinterface="false" namespacetopackages="http://ec2.amazonaws.com/doc/2010-11-15/=com.amazon.ec2.clieent" targetsourcefolderlocation="src" targetresourcesfolderlocation="resource/AmazonEC2" overwrite="true" />
</target>
<target name="codegen-client-elb" depends="download-ELB-wsdl">
<wsdl2code wsdlfilename="${base.dir}/wsdl/ElasticLoadBalancing.wsdl" serverside="false" generateservicexml="false" skipbuildxml="true" serversideinterface="false" namespacetopackages="http://elasticloadbalancing.amazonaws.com/doc/2011-04-05/=com.amazon.elb.client" targetsourcefolderlocation="src" targetresourcesfolderlocation="resource/AmazonELB" overwrite="true" />
</target>
<target name="run" depends="start-tomcat" />
<target name="stop" depends="stop-tomcat" />
<target name="debug" depends="debug-tomcat" />
<target name="debug-suspend">
<java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
<jvmarg value="-Dcatalina.home=${tomcat.home}" />
<jvmarg value="-Xdebug" />
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y" />
<jvmarg value="-ea" />
<jvmarg value="-Xms256m" />
<jvmarg value="-Xmx384m" />
</java>
</target>
<target name="stop-tomcat">
<java dir="${tomcat.home}/bin/" jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
<arg value="stop" />
</java>
</target>
<target name="start-tomcat" depends="stop-tomcat">
<echo message="Start Tomcat" />
<java dir="${tomcat.home}/bin/" jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
<jvmarg value="${assertion}" />
<jvmarg value="-Xms256m" />
<jvmarg value="-Xmx384m" />
<jvmarg value="-ea" />
<arg value="start" />
</java>
</target>
<target name="debug-tomcat">
<java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
<jvmarg value="-Dcatalina.home=${tomcat.home}" />
<jvmarg value="-Xdebug" />
<jvmarg value="${debug.jvmarg}" />
<jvmarg value="-ea" />
<jvmarg value="-Xms256m" />
<jvmarg value="-Xmx384m" />
</java>
</target>
</project>