-
Notifications
You must be signed in to change notification settings - Fork 104
/
build-master-targets.xml
593 lines (523 loc) · 23 KB
/
build-master-targets.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
591
592
593
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
Dec 1, 2008 9:56:08 PM
Build Master Targets
TCSDEVELOPER
====================================================================== -->
<project name="build-master-targets">
<description>
This script file defines the common master targets: compile-all, clean-all,
dist-all and those perform subversion related operations on subprojects.
</description>
<!-- subversion tasks -->
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svn.path" />
<!-- =================================
target: compile-all
================================= -->
<target name="compile-all" description="Runs 'compile' target on every subproject.">
<run-target-all target="compile" />
</target>
<!-- =================================
target: dist-all
================================= -->
<target name="dist-all" description="Runs 'dist' target on every subproject.">
<!-- copy the properties -->
<antcall target="copy_properties" />
<antcall target="dist-backend" />
</target>
<!-- =================================
target: dist-backend
================================= -->
<target name="dist-backend" description="Runs 'dist_tcs' target on every subproject.">
<!-- build the parent project -->
<antcall target="dist-components" />
<antcall target="dist" />
</target>
<target name="dist-components" description="Runs 'dist_direct' target on every components.">
<run-target-all target="dist_direct" config="components.conf"/>
</target>
<!-- =================================
target: clean-all
================================= -->
<target name="clean-all" description="Runs 'clean' target on every subproject.">
<run-target-all target="clean" />
</target>
<!-- =================================
target: checkout-all
================================= -->
<target name="checkout-all" description="Checks out all subprojects">
<condition property="version" value="TRUNK">
<not>
<isset property="version" />
</not>
</condition>
<execute-all prefix="project.current">
<sequential>
<version-path version="${version}" property="url" prefix="project.current" />
<echo message="-------------------- Checking out: ${project.current.basedir} from version: ${version}"/>
<svnex>
<checkout destPath="${basedir}/${project.current.basedir}" url="${url}" />
</svnex>
</sequential>
</execute-all>
</target>
<!-- =================================
target: checkout-all-by-tag
================================= -->
<target name="checkout-all-by-tag" description="Checks out all subprojects">
<fail unless="tagName" message="The 'tagName' version is required. " />
<execute-all prefix="project.current">
<sequential>
<tag-path tag="${tagName}" property="url" prefix="project.current" />
<echo message="${url}" />
<svnex>
<checkout destPath="${basedir}/${project.current.basedir}" url="${url}" />
</svnex>
</sequential>
</execute-all>
</target>
<!-- =================================
target: checkout-all-by-branch
================================= -->
<target name="checkout-all-by-branch" description="Checks out all subprojects">
<fail unless="branchName" message="The 'branchName' version is required. " />
<execute-all prefix="project.current">
<sequential>
<branch-path branch="${branchName}" property="url" prefix="project.current" />
<echo message="${url}" />
<svnex>
<checkout destPath="${basedir}/${project.current.basedir}" url="${url}" />
</svnex>
</sequential>
</execute-all>
</target>
<!-- =================================
target: update-all
================================= -->
<target name="update-all" description="Updates all subprojects.">
<execute-all prefix="project.current">
<sequential>
<echo message="-------------------- Updating: ${project.current.basedir}"/>
<svnex>
<update dir="${basedir}/${project.current.basedir}" />
</svnex>
</sequential>
</execute-all>
</target>
<!-- =================================
target: diff-all
================================= -->
<target name="generate-patch-all" description="Generates a diff file for every subproject and zips the diff files together.">
<mkdir dir="${user.home}/diff-temp" />
<condition property="outFile" value="${basedir}/patch.zip">
<not>
<isset property="outFile" />
</not>
</condition>
<execute-all prefix="project.current">
<sequential>
<svnex>
<diff oldPath="${basedir}/${project.current.basedir}" outFile="${user.home}/diff-temp/${project.current.name}.patch" />
</svnex>
</sequential>
</execute-all>
<zip destfile="${outFile}" basedir="${user.home}/diff-temp">
<include name="**/*.patch" />
</zip>
<delete dir="${user.home}/diff-temp" />
</target>
<!-- =================================
target: diff-version-all
================================= -->
<target name="diff-version-all" description="Generates a diff file for every subproject between two versions and zips the diff files together.">
<mkdir dir="${user.home}/diff-temp" />
<condition property="outFile" value="${basedir}/patch.zip">
<not>
<isset property="outFile" />
</not>
</condition>
<fail unless="from" message="The 'from' version is required." />
<fail unless="to" message="The 'to' version is required. " />
<execute-all prefix="project.current">
<sequential>
<version-path version="${from}" property="oldUrl" prefix="project.current" />
<version-path version="${to}" property="newUrl" prefix="project.current" />
<svnex>
<diff oldUrl="${oldUrl}" newUrl="${newUrl}" outFile="${user.home}/diff-temp/${project.current.name}.patch" />
</svnex>
</sequential>
</execute-all>
<zip destfile="${outFile}" basedir="${user.home}/diff-temp">
<include name="**/*.patch" />
</zip>
<delete dir="${user.home}/diff-temp" />
</target>
<!-- get the diff for the laste release and the current changes." -->
<target name="diff-prev-version">
<property name="from" value="RELEASE" />
<property name="to" value="TRUNK" />
<antcall target="diff-version-all" />
</target>
<!-- =================================
target: patch-all
================================= -->
<target name="apply-patch-all" description="Patches all the subprojects with a zip file containing the patches">
<mkdir dir="${user.home}/patch-temp" />
<condition property="inFile" value="${basedir}/patch.zip">
<not>
<isset property="inFile" />
</not>
</condition>
<unzip dest="${user.home}/patch-temp" src="${inFile}" />
<execute-all prefix="project.current">
<sequential>
<patch patchfile="${user.home}/patch-temp/${project.current.name}.patch" dir="${basedir}/${project.current.basedir}" />
</sequential>
</execute-all>
<delete dir="${user.home}/patch-temp" />
</target>
<!-- =================================
target: commit-all
================================= -->
<target name="commit-all" description="Commits all the subprojects.">
<fail unless="message" message="Commit message must be specified." />
<execute-all prefix="project.current">
<sequential>
<svnex>
<commit dir="${basedir}/${project.current.basedir}" message="${messsage}" />
</svnex>
</sequential>
</execute-all>
</target>
<!-- =================================
target: switch-all
================================= -->
<target name="switch-all" description="Switches all the subprojects to another version.">
<condition property="version" value="TRUNK">
<not>
<isset property="version" />
</not>
</condition>
<execute-all prefix="project.current">
<sequential>
<version-path version="${version}" property="url" prefix="project.current" />
<svnex>
<switch path="${basedir}/${project.current.basedir}" url="${url}" />
</svnex>
</sequential>
</execute-all>
</target>
<!-- =================================
target: switch-to-tag
================================= -->
<target name="switch-to-tag" description="Switches all the subprojects to another version.">
<fail unless="tagName" message="The version to swith to must be specified." />
<execute-all prefix="project.current">
<sequential>
<tag-path tag="${tagName}" property="url" prefix="project.current" />
<echo message="${url}" />
<svnex>
<switch path="${basedir}/${project.current.basedir}" url="${url}" />
</svnex>
</sequential>
</execute-all>
</target>
<!-- =================================
target: switch-to-branch
================================= -->
<target name="switch-to-branch" description="Switches all the subprojects to another version.">
<fail unless="branchName" message="The branchName to swith to must be specified." />
<execute-all prefix="project.current">
<sequential>
<branch-path branch="${branchName}" property="url" prefix="project.current" />
<echo message="${url}" />
<svnex>
<switch path="${basedir}/${project.current.basedir}" url="${url}" />
</svnex>
</sequential>
</execute-all>
</target>
<!-- =================================
target: revert-all
================================= -->
<target name="revert-all" description="Reverts changes on all the subprojects.">
<execute-all prefix="project.current">
<sequential>
<svnex>
<revert dir="${basedir}/${project.current.basedir}" recurse="true" />
</svnex>
</sequential>
</execute-all>
</target>
<target name="tag-all" description="Tags all subprojects.">
<condition property="version" value="TRUNK">
<not>
<isset property="version" />
</not>
</condition>
<fail unless="tagName" message="The 'tagName' version is required. " />
<execute-all prefix="project.current">
<sequential>
<version-path version="${version}" property="url" prefix="project.current" />
<tag-path tag="${tagName}" property="tagUrl" prefix="project.current" />
<echo message="${tagUrl}" />
<svnex>
<copy srcUrl="${url}" destUrl="${tagUrl}" message="tagged the branch as ${tagName}" />
</svnex>
</sequential>
</execute-all>
</target>
<target name="branch-all" description="Branches all subprojects.">
<condition property="version" value="branches/cockpit_trunk">
<not>
<isset property="version" />
</not>
</condition>
<fail unless="branchName" message="The 'branchName' version is required. " />
<execute-all prefix="project.current">
<sequential>
<version-path version="${version}" property="url" prefix="project.current" />
<branch-path branch="${branchName}" property="branchUrl" prefix="project.current" />
<echo message="${branchUrl}" />
<svnex>
<copy srcUrl="${url}" destUrl="${branchUrl}" message="created a branch as ${branchName}" />
</svnex>
</sequential>
</execute-all>
</target>
<target name="test-all" description="run all the test cases.">
<run-target-all target="test" />
</target>
<!-- =================================
target: info-all
================================= -->
<target name="info-all" description="Info on all the subprojects.">
<execute-all prefix="project.current">
<sequential>
<echo message="-------------------- Info for: ${project.current.basedir}"/>
<svnex>
<info target="${basedir}/${project.current.basedir}"/>
</svnex>
<echo message="-------------------- URL: ${svn.info.url}"/>
</sequential>
</execute-all>
</target>
<!-- =================================
target: check-all
================================= -->
<target name="check-all" description="Info on all the subprojects.">
<execute-all prefix="project.current">
<sequential>
<echo message="-------------------- Checking for: ${project.current.basedir}"/>
<svnex>
<info target="${basedir}/${project.current.basedir}"/>
</svnex>
<condition property="version" value="TRUNK">
<not>
<isset property="version" />
</not>
</condition>
<version-path version="${version}" property="url" prefix="project.current" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<if>
<not>
<equals arg1="${svn.info.url}" arg2="${url}"/>
</not>
<then>
<echo message="-------------------- ERROR SVN Path doesn't match for project: ${project.current.basedir}"/>
</then>
</if>
</sequential>
</execute-all>
</target>
<!--
Added the switch-and-checkout target which switches the root project to the specified branch and then syncs all subprojects.
@author: snow01
@since: BUGR-3482
-->
<target name="switch-and-checkout" description="Switches the root to the specified branch and then syncs all subprojects">
<!-- Receives branch url as -DbranchURL=http://... -->
<if>
<isset property="branchURL"/>
<then>
<svnex>
<switch path="${basedir}" url="${branchURL}" />
</svnex>
</then>
</if>
<echo message="DEBUG: -------------------- Starting sync for subprojects"/>
<antcall target="sync-all" />
</target>
<!--
Checkout / sync all subprojects to the branch defined in subprojects.xml.
@author: snow01
@since: BUGR-3482
-->
<target name="sync-all" description="Checkout / sync all subprojects to the branch defined in subprojects.xml.">
<execute-all prefix="project.current">
<sequential>
<echo message="DEBUG: -------------------- Checking for: ${project.current.basedir}"/>
<condition property="version" value="TRUNK">
<not>
<isset property="version" />
</not>
</condition>
<version-path version="${version}" property="url" prefix="project.current" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<!-- check if directory exist -->
<!-- if yes check the branch name -->
<!-- if matches simply update -->
<!-- else switch -->
<if>
<available file="${basedir}/${project.current.basedir}"/>
<then>
<svnex>
<info target="${basedir}/${project.current.basedir}"/>
</svnex>
<if>
<not>
<equals arg1="${svn.info.url}" arg2="${url}"/>
</not>
<then>
<echo message="-------------------- Switching to url: ${url}"/>
<svnex>
<switch path="${basedir}/${project.current.basedir}" url="${url}" />
</svnex>
</then>
<else>
<echo message="-------------------- Updating: ${url}"/>
<svnex>
<update dir="${basedir}/${project.current.basedir}" />
</svnex>
</else>
</if>
</then>
<!-- if not checkout the project -->
<else>
<echo message="-------------------- Checking out: ${project.current.basedir}"/>
<svnex>
<checkout destPath="${basedir}/${project.current.basedir}" url="${url}" />
</svnex>
</else>
</if>
</sequential>
</execute-all>
</target>
<target name="sync" description="Checkout / sync a single subproject to the branch defined in subprojects.xml.">
<if>
<isset property="project"/>
<then>
<execute-single prefix="project.current" subproject="${project}">
<sequential>
<echo message="DEBUG: -------------------- Checking for: ${project.current.basedir}"/>
<condition property="version" value="TRUNK">
<not>
<isset property="version" />
</not>
</condition>
<version-path version="${version}" property="url" prefix="project.current" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<!-- check if directory exist -->
<!-- if yes check the branch name -->
<!-- if matches simply update -->
<!-- else switch -->
<if>
<available file="${basedir}/${project.current.basedir}"/>
<then>
<svnex>
<info target="${basedir}/${project.current.basedir}"/>
</svnex>
<if>
<not>
<equals arg1="${svn.info.url}" arg2="${url}"/>
</not>
<then>
<echo message="-------------------- Switching to url: ${url}"/>
<svnex>
<switch path="${basedir}/${project.current.basedir}" url="${url}" />
</svnex>
</then>
<else>
<echo message="-------------------- Updating: ${url}"/>
<svnex>
<update dir="${basedir}/${project.current.basedir}" />
</svnex>
</else>
</if>
</then>
<!-- if not, checkout the project -->
<else>
<echo message="-------------------- Checking out: ${project.current.basedir}"/>
<svnex>
<checkout destPath="${basedir}/${project.current.basedir}" url="${url}" />
</svnex>
</else>
</if>
</sequential>
</execute-single>
</then>
<else>
<echo message="Please specify the project name to sync like -Dproject=configuration_manager in commandline."/>
</else>
</if>
</target>
<target name="update-single-revision-number" description="update revision number for each single file">
<pathconvert property="pathInPage" pathsep="/" dirsep="/">
<path location="${file}"/>
<map from="${basedir}/src/web" to="" />
</pathconvert>
<svnex>
<status path="${file}" lastChangedRevisionProperty="svn.info.lastRev" />
</svnex>
<replaceregexp byline="true">
<regexp pattern='([href|src])="(.*${pathInPage})(\?v=\d+)?"'/>
<substitution expression='\1="\2?v=${svn.info.lastRev}"'/>
<fileset dir="${webdir}">
<include name="**/*.jsp"/>
</fileset>
</replaceregexp>
</target>
<target name="update-single-revision-number-for-css" description="update revision number for each CSS file">
<update-single-revision-number file="${file}" type="css"/>
</target>
<target name="update-single-revision-number-for-js" description="update revision number for each javascript file">
<update-single-revision-number file="${file}" type="js"/>
</target>
<target name="update-revision-numbers" description="update revision number for static files">
<foreach param="file" target="update-single-revision-number" >
<path>
<fileset dir="${webdir}">
<include name="**/*.css" />
<include name="**/*.js" />
</fileset>
</path>
</foreach>
</target>
<target name="update-revision-numbers-for-jsp" description="update revision number for static files">
<foreach param="file" target="update-single-revision-number-for-css">
<path>
<fileset dir="${webdir}">
<include name="**/*.css"/>
</fileset>
</path>
</foreach>
<foreach param="file" target="update-single-revision-number-for-js">
<path>
<fileset dir="${webdir}">
<include name="**/*.js"/>
<exclude name="**/tinyMCE/"/>
<exclude name="**/jquery*.js/"/>
</fileset>
</path>
</foreach>
</target>
<target name="update-timestamp-version-numbers-for-jsp" description="update timestamp bersion number for javascript and css file">
<replaceregexp byline="true">
<regexp pattern='(href|src|default)="([^"]+)(\.js|\.css)'/>
<substitution expression='\1="\2\3?v=${timestamp}'/>
<fileset dir="${build_distdir}/direct.war">
<include name="**/*.jsp"/>
</fileset>
</replaceregexp>
</target>
</project>