This repository has been archived by the owner on Sep 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
/
build-packages.xml
590 lines (510 loc) · 21.9 KB
/
build-packages.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
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
<?xml version="1.0"?>
<!--
Portions of this file Copyright 1999-2005 University of Chicago
Portions of this file Copyright 1999-2005 The University of Southern California.
This file or a portion of this file is licensed under the
terms of the Globus Toolkit Public License, found at
http://www.globus.org/toolkit/download/license.html.
If you redistribute this file, with or without
modifications, you must include this notice in the file.
-->
<!-- ===================================================================
Build file for Web Services Resource Framework (WSRF) Packaging
Notes:
This is a build file for use with the Jakarta Ant build tool.
Prerequisites:
jakarta-ant from http://jakarta.apache.org
Build Instructions:
To build, run
java org.apache.tools.ant.Main <target>
on the directory where this file is located with the target you want.
Most useful targets:
- makeGar -> creates a Grid archive that can be deployed in a Grid service
container
- deployGar -> deploys Gar in Standalone Grid service container
- undeployGar -> undeploys Gar from Standalone Grid service container
Copyright:
Copyright (c) 1999-2005 University of Chicago and The University of
Southern California. All Rights Reserved.
==================================================================== -->
<project default="makeGar" basedir=".">
<!-- Give user a chance to override without editing this file
(and without typing -D each time it compiles it) -->
<description>
This build script may be used to create, deploy and undeploy
GAR (Globus ARchive) files.
The targets in this script honor the following parameters:
makeGar:
- garjars.id A optional reference to a fileset
containing jar files
- garschema.id A optional reference to a fileset
containing wsdl and schema files
- garetc.id A optional reference to a fileset
containing files to be placed under
etc. Note that if this directory contains a
ant build file with the name
post-deploy.xml containing a target named
setup then this target will be executed as
the last step in deploying a gar.
- garshare.id A optional reference to a fileset
containing files to be placed under share
- gardocs.id A optional reference to a fileset
containing files to be placed under docs
- garbin.id A optional reference to a filset containing
executables
- garserverdeployment.file A optional property
containing the name of a server side wsdd
file. Defaults to deploy-server.wsdd
- garclientdeployment.file A optional property
containing the name of a client side wsdd
file. Defaults to deploy-client.wsdd
- garjndiconfigdeployment.file A optional property
containing the name of a JNDI configuration
file. Defaults to deploy-jndi-config.xml
- gar.dest A optional temporary directory used for
building the gar. Defaults to ${basedir}/tmp/gar
- gar.name The name of the gar, e.g. globus_java_wsrf_common.gar
deployGar:
- deploy.dir The directory to deploy to. Defaults to
$GLOBUS_LOCATION if set and the current
directory if not set.
- profile A optional name of a configuration profile
to use. In essence installing with a non
default configuration profile allows one to
install the same gar using multiple
configurations.
- gar.name The name of the gar to install.
- noSchema A optional parameter indicating whether
schema files included in the gar should be
installed or not.
- createBackup A optional parameter indicating whether
to make a backup of all the existing configuration files
in $GLOBUS_LOCATION/etc/${gar.id} directory.
undeployGar:
- deploy.dir The directory from which to
undeploy. Defaults to $GLOBUS_LOCATION if
set and the current directory if not set.
- gar.id The id of the gar to undeploy,
e.g. globus_java_wsrf_common
</description>
<property environment="env"/>
<property file="build.properties"/>
<property name="gar.dest" value="${basedir}/tmp/gar"/>
<property name="gar.name" value="${gar.id}.gar"/>
<property name="garserverdeployment.file"
value="deploy-server.wsdd"/>
<property name="garclientdeployment.file"
value="deploy-client.wsdd"/>
<property name="garjndiconfigdeployment.file"
value="deploy-jndi-config.xml"/>
<property name="env.GLOBUS_LOCATION" value="."/>
<property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
<property name="abs.deploy.dir" location="${deploy.dir}"/>
<property name="config.dir" value="etc"/>
<path id="classpath">
<fileset dir=".">
<include name="lib/*.jar"/>
</fileset>
<fileset dir="${abs.deploy.dir}/lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${java.class.path}"/>
</path>
<!-- ================================================================ -->
<!-- Target used to build a GAR -->
<!-- ================================================================ -->
<target name="makeGar" description="Build a GAR file">
<antcall target="copyJars">
<reference refid="${garjars.id}"/>
</antcall>
<antcall target="copySchema">
<reference refid="${garschema.id}"/>
</antcall>
<antcall target="copyEtc">
<reference refid="${garetc.id}"/>
</antcall>
<antcall target="copyShare">
<reference refid="${garshare.id}"/>
</antcall>
<antcall target="copyDocs">
<reference refid="${gardocs.id}"/>
</antcall>
<antcall target="copyBin">
<reference refid="${garbin.id}"/>
</antcall>
<antcall target="copyServerDeployWSDD" />
<antcall target="copyClientDeployWSDD" />
<antcall target="copyJndiConfig" />
<jar destfile="${gar.name}" basedir="${gar.dest}"/>
<delete dir="${gar.dest}"/>
</target>
<target name="testServerDeployWSDD">
<condition property="ignore.sdWSDD">
<isset property="forget.server-deploy.wsdd"/>
</condition>
</target>
<target name="copyServerDeployWSDD" depends="testServerDeployWSDD" unless="ignore.sdWSDD">
<copy file="${garserverdeployment.file}"
tofile="${gar.dest}/server-deploy.wsdd"
failonerror="false"/>
</target>
<target name="testClientDeployWSDD">
<condition property="ignore.cdWSDD">
<isset property="forget.client-deploy.wsdd"/>
</condition>
</target>
<target name="copyClientDeployWSDD" depends="testClientDeployWSDD" unless="ignore.cdWSDD">
<copy file="${garclientdeployment.file}"
tofile="${gar.dest}/client-deploy.wsdd"
failonerror="false"/>
</target>
<target name="testJndiConfig">
<condition property="ignore.jndiconfig">
<isset property="forget.jndi-config-deploy.xml"/>
</condition>
</target>
<target name="copyJndiConfig" depends="testJndiConfig" unless="ignore.jndiconfig">
<copy file="${garjndiconfigdeployment.file}"
tofile="${gar.dest}/jndi-config-deploy.xml"
failonerror="false"/>
</target>
<target name="testShare">
<condition property="share.available">
<isset property="garshare.id"/>
</condition>
</target>
<target name="copyShare" depends="testShare" if="share.available">
<copy todir="${gar.dest}/share">
<fileset refid="${garshare.id}"/>
</copy>
</target>
<target name="testEtc">
<condition property="etc.available">
<isset property="garetc.id"/>
</condition>
</target>
<target name="copyEtc" depends="testEtc" if="etc.available">
<copy todir="${gar.dest}/etc">
<fileset refid="${garetc.id}"/>
</copy>
</target>
<target name="testDocs">
<condition property="docs.available">
<isset property="gardocs.id"/>
</condition>
</target>
<target name="copyDocs" depends="testDocs" if="docs.available">
<copy todir="${gar.dest}/docs">
<fileset refid="${gardocs.id}"/>
</copy>
</target>
<target name="testBin">
<condition property="bin.available">
<isset property="garbin.id"/>
</condition>
</target>
<target name="copyBin" depends="testBin" if="bin.available">
<copy todir="${gar.dest}/bin">
<fileset refid="${garbin.id}"/>
</copy>
</target>
<target name="testPostDeployAvailable" depends="setGarID">
<property name="postDeploy.file"
value="${gar.dest}/etc/post-deploy.xml"/>
<available property="postDeploy.available" type="file"
file="${postDeploy.file}"/>
</target>
<target name="postDeploy" depends="testPostDeployAvailable"
if="postDeploy.available">
<ant antfile="${postDeploy.file}" target="setup"/>
<delete file="${postDeploy.file}" failonerror="false"/>
</target>
<target name="testJars">
<condition property="jars.available">
<isset property="garjars.id"/>
</condition>
</target>
<target name="copyJars" depends="testJars" if="jars.available">
<copy todir="${gar.dest}/lib">
<fileset refid="${garjars.id}"/>
</copy>
</target>
<target name="testSchema">
<condition property="schema.available">
<isset property="garschema.id"/>
</condition>
</target>
<target name="copySchema" depends="testSchema" if="schema.available">
<copy todir="${gar.dest}/schema">
<fileset refid="${garschema.id}"/>
</copy>
</target>
<!--
User callable task
Input: 'gar.name' - gar file location
'profile' - name of the cfg profile
'noSchema' - if true, schema files in the gar will not be deployed
-->
<target name="deployGar" description="Deploy a GAR file.">
<condition property="profile.name" value="${profile}-">
<isset property="profile"/>
</condition>
<condition property="profile.name" value="">
<not>
<isset property="profile"/>
</not>
</condition>
<condition property="profile.desc" value="${profile}">
<isset property="profile"/>
</condition>
<condition property="profile.desc" value="<default>">
<not>
<isset property="profile"/>
</not>
</condition>
<echo message="Deploying gar with profile: ${profile.desc}"/>
<antcall target="deployGarFiles"/>
<antcall target="deployServer"/>
<antcall target="deployClient"/>
<antcall target="deployJNDIConfig"/>
<antcall target="generateUndeploy"/>
<antcall target="postDeploy"/>
<delete dir="${gar.dest}"/>
</target>
<target name="setGarID">
<basename property="gar.id" file="${gar.name}" suffix=".gar"/>
</target>
<target name="testServerDeployAvailable">
<available property="serverDeploy.available" type="file"
file="${gar.dest}/server-deploy.wsdd"/>
</target>
<target name="deployServer"
depends="testServerDeployAvailable, setGarID"
if="serverDeploy.available">
<echo message="deploying server config..."/>
<mkdir dir="${abs.deploy.dir}/${config.dir}/${gar.id}"/>
<chmod dir="${abs.deploy.dir}/${config.dir}/${gar.id}" perm="755"/>
<copy file="${gar.dest}/server-deploy.wsdd"
tofile="${abs.deploy.dir}/${config.dir}/${gar.id}/${profile.name}server-config.wsdd"
overwrite="true">
<filterset>
<filter token="gar.id" value="${gar.id}"/>
<filter token="config.dir" value="etc/${gar.id}"/>
</filterset>
</copy>
<chmod file="${abs.deploy.dir}/${config.dir}/${gar.id}/${profile.name}server-config.wsdd" perm="600"/>
</target>
<target name="testJNDIConfigDeployAvailable">
<available property="jndiConfigDeploy.available" type="file"
file="${gar.dest}/jndi-config-deploy.xml"/>
</target>
<target name="deployJNDIConfig"
depends="testJNDIConfigDeployAvailable, setGarID"
if="jndiConfigDeploy.available">
<echo message="deploying JNDI config..."/>
<mkdir dir="${abs.deploy.dir}/${config.dir}/${gar.id}"/>
<chmod dir="${abs.deploy.dir}/${config.dir}/${gar.id}" perm="755"/>
<copy file="${gar.dest}/jndi-config-deploy.xml"
tofile="${abs.deploy.dir}/${config.dir}/${gar.id}/${profile.name}jndi-config.xml"
overwrite="true">
<filterset>
<filter token="gar.id" value="${gar.id}"/>
<filter token="config.dir" value="etc/${gar.id}"/>
</filterset>
</copy>
<chmod file="${abs.deploy.dir}/${config.dir}/${gar.id}/${profile.name}jndi-config.xml" perm="600"/>
</target>
<!--
User callable task
Input: 'gar.id' - gar id to remove - all cfg profiles are removed.
-->
<target name="undeployGar" description="Undeploy a GAR file.">
<fail message="Must specify gar id to undeploy" unless="gar.id"/>
<ant dir="${abs.deploy.dir}/etc/globus_packages/${gar.id}"
inheritAll="false" antfile="undeploy.xml">
<property name="deploy.dir" location="${abs.deploy.dir}"/>
</ant>
<delete file="${abs.deploy.dir}/etc/globus_packages/${gar.id}/undeploy.xml"/>
<delete dir="${abs.deploy.dir}/etc/globus_packages/${gar.id}"/>
</target>
<target name="testClientDeployAvailable">
<available property="clientDeploy.available" type="file"
file="${gar.dest}/client-deploy.wsdd"/>
</target>
<target name="deployClient" depends="testClientDeployAvailable"
if="clientDeploy.available">
<echo message="deploying client config..."/>
<java classname="org.apache.axis.utils.Admin"
classpathref="classpath"
dir="${abs.deploy.dir}"
fork="true"
failonerror="true">
<arg value="client"/>
<arg value="${gar.dest}/client-deploy.wsdd"/>
</java>
<fixcrlf srcdir="${abs.deploy.dir}" eol="lf"
includes="client-config.wsdd"/>
</target>
<target name="deployGarFiles" depends="setGarID">
<mkdir dir="${gar.dest}"/>
<chmod file="${gar.dest}" perm="700"/>
<mkdir dir="${gar.dest}/schema"/>
<mkdir dir="${gar.dest}/etc"/>
<mkdir dir="${gar.dest}/bin"/>
<mkdir dir="${gar.dest}/docs"/>
<mkdir dir="${gar.dest}/share"/>
<mkdir dir="${gar.dest}/lib"/>
<unjar src="${gar.name}" dest="${gar.dest}"/>
<copy todir="${abs.deploy.dir}/docs/${gar.id}"
overwrite="true"
includeEmptyDirs="false">
<fileset dir="${gar.dest}/docs"/>
</copy>
<antcall target="setDefaultPermissions" inheritAll="false">
<param name="target.dir" value="${abs.deploy.dir}/docs/${gar.id}"/>
<param name="source.dir" value="${gar.dest}/docs"/>
</antcall>
<copy todir="${abs.deploy.dir}/share/${gar.id}"
overwrite="true"
includeEmptyDirs="false">
<fileset dir="${gar.dest}/share"/>
</copy>
<antcall target="setDefaultPermissions" inheritAll="false">
<param name="target.dir" value="${abs.deploy.dir}/share/${gar.id}"/>
<param name="source.dir" value="${gar.dest}/share"/>
</antcall>
<antcall target="deploySchema"/>
<antcall target="makeEtcBackup"/>
<copy todir="${abs.deploy.dir}/etc/${gar.id}"
overwrite="true"
includeEmptyDirs="false">
<fileset dir="${gar.dest}/etc">
<exclude name="post-deploy.xml"/>
</fileset>
</copy>
<antcall target="setDefaultPermissions" inheritAll="false">
<param name="target.dir" value="${abs.deploy.dir}/etc/${gar.id}"/>
<param name="source.dir" value="${gar.dest}/etc"/>
</antcall>
<copy todir="${abs.deploy.dir}/bin"
overwrite="true">
<fileset dir="${gar.dest}/bin"/>
</copy>
<antcall target="setExecutablePermissions" inheritAll="false">
<param name="target.dir" value="${abs.deploy.dir}/bin"/>
<param name="source.dir" value="${gar.dest}/bin"/>
</antcall>
<copy todir="${abs.deploy.dir}/lib"
overwrite="true">
<fileset dir="${gar.dest}/lib">
<include name="**/*.jar"/>
</fileset>
</copy>
<antcall target="setDefaultPermissions" inheritAll="false">
<param name="target.dir" value="${abs.deploy.dir}/lib"/>
<param name="source.dir" value="${gar.dest}/lib"/>
</antcall>
<copy todir="${abs.deploy.dir}/share/licenses"
overwrite="true">
<fileset dir="${gar.dest}/lib">
<include name="**/*LICENSE*"/>
</fileset>
</copy>
<antcall target="setDefaultPermissions" inheritAll="false">
<param name="target.dir" value="${abs.deploy.dir}/share/licenses"/>
<param name="source.dir" value="${gar.dest}/lib"/>
</antcall>
</target>
<target name="deploySchema" unless="noSchema">
<copy todir="${abs.deploy.dir}/share/schema"
overwrite="true">
<fileset dir="${gar.dest}/schema"/>
</copy>
<antcall target="setDefaultPermissions" inheritAll="false">
<param name="target.dir" value="${abs.deploy.dir}/share/schema"/>
<param name="source.dir" value="${gar.dest}/schema"/>
</antcall>
</target>
<target name="makeEtcBackup" if="createBackup">
<tstamp>
<format property="bak.timestamp" pattern="yyMMddHHmmss"/>
</tstamp>
<copy todir="${abs.deploy.dir}/etc/${gar.id}/backup.${bak.timestamp}"
overwrite="true"
failonerror="false"
includeEmptyDirs="false">
<fileset dir="${abs.deploy.dir}/etc/${gar.id}">
<exclude name="backup.*/**"/>
</fileset>
</copy>
<chmod perm="700" dir="${abs.deploy.dir}" type="dir"
includes="etc/${gar.id}/backup.${bak.timestamp}"/>
</target>
<target name="addDocs">
<!-- work around for bug in ant 1.5 with jar update -->
<touch file="${gar.name}" millis="0"/>
<copy todir="${gar.dest}/docs/">
<fileset dir="${docs.dir}"/>
</copy>
<jar destfile="${gar.name}" update="true" basedir="${gar.dest}"/>
<delete dir="${gar.dest}"/>
</target>
<target name="addEtc">
<!-- work around for bug in ant 1.5 with jar update -->
<touch file="${gar.name}" millis="0"/>
<copy todir="${gar.dest}/etc/">
<fileset dir="${etc.dir}"/>
</copy>
<jar destfile="${gar.name}" update="true" basedir="${gar.dest}"/>
<delete dir="${gar.dest}"/>
</target>
<target name="addBin">
<!-- work around for bug in ant 1.5 with jar update -->
<touch file="${gar.name}" millis="0"/>
<copy todir="${gar.dest}/bin/">
<fileset dir="${bin.dir}"/>
</copy>
<jar destfile="${gar.name}" update="true" basedir="${gar.dest}"/>
<delete dir="${gar.dest}"/>
</target>
<target name="getDocs">
<unjar src="${gar.name}" dest="${docs.dest}">
<patternset>
<include name="docs/*"/>
</patternset>
</unjar>
</target>
<target name="generateUndeploy">
<java classname="org.globus.tools.gar.GenerateUndeploy"
classpathref="classpath"
fork="true"
failonerror="true">
<arg value="${gar.name}"/>
<arg value="${abs.deploy.dir}"/>
</java>
</target>
<target name="targetDirExists">
<available file="${target.dir}" property="target.dir.exists"/>
</target>
<target name="setDefaultPermissions" depends="targetDirExists" if="target.dir.exists">
<chmod perm="644" type="file">
<fileset dir="${target.dir}">
<present targetdir="${source.dir}"/>
</fileset>
</chmod>
<chmod perm="755" type="dir">
<fileset file="${target.dir}"/>
<fileset dir="${target.dir}">
<present targetdir="${source.dir}"/>
</fileset>
</chmod>
</target>
<target name="setExecutablePermissions" depends="targetDirExists" if="target.dir.exists">
<chmod perm="755">
<fileset file="${target.dir}"/>
<fileset dir="${target.dir}">
<present targetdir="${source.dir}"/>
</fileset>
</chmod>
</target>
</project>