-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildTasks.xml
435 lines (405 loc) · 18.7 KB
/
buildTasks.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
<project>
<description>Tasks file</description>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${ant-contrib.jar.path}"/>
</classpath>
</taskdef>
<!-- Clean build area -->
<target name="clean" description="Clean the project">
<echo message="========================================================================" />
<echo message=".:[Maven] :: Cleaning the project..." />
<echo message="========================================================================" />
<exec executable="mvn" dir="${basedir}">
<arg value="clean"/>
</exec>
</target>
<!-- Init build area -->
<target name="init" depends="clean" description="Initialize the project">
<echo message="========================================================================" />
<echo message=".:[Maven] :: Initializing the project..." />
<echo message="========================================================================" />
<exec executable="mvn" dir="${basedir}">
<arg value="validate"/>
<arg value="generate-test-resources"/>
</exec>
</target>
<target name="compile" depends="clean" description="Compile the source ">
<echo message="========================================================================" />
<echo message=".:[Maven] :: Compiling the sources..." />
<echo message="========================================================================" />
<exec executable="mvn" dir="${basedir}">
<arg value="compile"/>
<arg value="test-compile"/>
</exec>
</target>
<target name="WAR-build" depends="clean" description="Build the WAR">
<echo message="========================================================================" />
<echo message=".:[Maven] :: Packaging the WAR..." />
<echo message="========================================================================" />
<exec executable="mvn" dir="${basedir}">
<env key="MAVEN_WORKING_MODE" value="production"/>
<arg line="-P !development-windows"/>
<arg value="package"/>
<arg line="-DskipTests"/>
</exec>
</target>
<!-- Added for jboss -->
<target name="WAR-build-jboss" depends="clean" description="Build the WAR for JBOSS">
<echo message="========================================================================" />
<echo message=".:[Maven] :: Packaging the Jboss WAR..." />
<echo message="========================================================================" />
<exec executable="mvn" dir="${basedir}">
<env key="MAVEN_WORKING_MODE" value="production-jboss"/>
<arg line="-P !development-windows"/>
<arg value="package"/>
<arg line="-DskipTests"/>
</exec>
</target>
<target name="WAR-build-standalone" depends="clean" description="Build the standalone executable WAR">
<echo message="========================================================================" />
<echo message=".:[Maven] :: Packaging the standalone executable WAR..." />
<echo message="========================================================================" />
<exec executable="mvn" dir="${basedir}">
<env key="MAVEN_WORKING_MODE" value="standalone"/>
<arg line="-P !development-windows"/>
<arg value="package"/>
<arg line="-DskipTests"/>
<arg line="-DskipDerby=false"/>
<arg line="-DskipStandalone=false"/>
</exec>
<move todir="${dist.path}/standalone">
<fileset dir="${dist.path}">
<include name="${webappname}*war-exec*.jar"/>
</fileset>
</move>
</target>
<target name="WAR-undeploy">
<delete file="${tomcat.deploy.path}/${webappname}.war" />
</target>
<!-- deploy the distribution -->
<target name="WAR-deploy" description="Copy the WAR to Tomcat">
<copy file="${dist.path}/${webappname}.war" todir="${tomcat.deploy.path}" />
</target>
<target name="PG-db-backup-tar" description="PostgreSQL db backup in TAR format">
<echo message="Dumping ${webappname}${test.marker}Port...." />
<exec executable="${postgres.bin.path}/${postgres.bin.dump}" dir="${basedir}/src/${project.src.branch}/db/tar">
<env key="PGPASSWORD" value="${postgres.password}"/>
<arg value="-i"/>
<arg line="-h ${postgres.hostname}"/>
<arg line="-p ${postgres.port}"/>
<arg line="-U ${postgres.username}"/>
<arg line="-F t"/>
<arg value="-b"/>
<arg value="-v"/>
<arg line="-f ${webappname}${test.marker}Port.backup"/>
<arg value="${webappname}${test.marker}Port"/>
</exec>
<echo message="${webappname}${test.marker}Port dumped. Compressing...." />
<bzip2 destfile="${basedir}/src/${project.src.branch}/db/tar/${webappname}${test.marker}Port.backup.bz2">
<fileset dir="${basedir}/src/${project.src.branch}/db/tar">
<include name="${webappname}${test.marker}Port.backup"/>
</fileset>
</bzip2>
<delete file="${basedir}/src/${project.src.branch}/db/tar/${webappname}${test.marker}Port.backup" />
<echo message="Dumping ${webappname}${test.marker}Serv...." />
<exec executable="${postgres.bin.path}/${postgres.bin.dump}" dir="${basedir}/src/${project.src.branch}/db/tar">
<env key="PGPASSWORD" value="${postgres.password}"/>
<arg value="-i"/>
<arg line="-h ${postgres.hostname}"/>
<arg line="-p ${postgres.port}"/>
<arg line="-U ${postgres.username}"/>
<arg line="-F t"/>
<arg value="-b"/>
<arg value="-v"/>
<arg line="-f ${webappname}${test.marker}Serv.backup"/>
<arg value="${webappname}${test.marker}Serv"/>
</exec>
<echo message="${webappname}${test.marker}Serv dumped. Compressing...." />
<bzip2 destfile="${basedir}/src/${project.src.branch}/db/tar/${webappname}${test.marker}Serv.backup.bz2" >
<fileset dir="${basedir}/src/${project.src.branch}/db/tar">
<include name="${webappname}${test.marker}Serv.backup"/>
</fileset>
</bzip2>
<delete file="${basedir}/src/${project.src.branch}/db/tar/${webappname}${test.marker}Serv.backup" />
</target>
<target name="PG-db-export-SQL">
<echo message="Dumping ${webappname}${test.marker}Port...." />
<exec executable="${postgres.bin.path}/${postgres.bin.dump}" dir="${basedir}/src/${project.src.branch}/db/export">
<env key="PGPASSWORD" value="${postgres.password}"/>
<arg value="-i"/>
<arg line="-h ${postgres.hostname}"/>
<arg line="-p ${postgres.port}"/>
<arg line="-U ${postgres.username}"/>
<arg line="-F p"/>
<arg value="-s"/>
<arg value="-O"/>
<arg value="-v"/>
<arg line="-f ${webappname}${test.marker}Port_schema.sql"/>
<arg value="${webappname}${test.marker}Port"/>
</exec>
<echo message="Dumping ${webappname}${test.marker}Serv...." />
<exec executable="${postgres.bin.path}/${postgres.bin.dump}" dir="${basedir}/src/${project.src.branch}/db/export">
<env key="PGPASSWORD" value="${postgres.password}"/>
<arg value="-i"/>
<arg line="-h ${postgres.hostname}"/>
<arg line="-p ${postgres.port}"/>
<arg line="-U ${postgres.username}"/>
<arg line="-F p"/>
<arg value="-s"/>
<arg value="-O"/>
<arg value="-v"/>
<arg line="-f ${webappname}${test.marker}Serv_schema.sql"/>
<arg value="${webappname}${test.marker}Serv"/>
</exec>
<echo message="Dumping ${webappname}${test.marker}Port...." />
<exec executable="${postgres.bin.path}/${postgres.bin.dump}" dir="${basedir}/src/${project.src.branch}/db/export">
<env key="PGPASSWORD" value="${postgres.password}"/>
<arg value="-i"/>
<arg line="-h ${postgres.hostname}"/>
<arg line="-p ${postgres.port}"/>
<arg line="-U ${postgres.username}"/>
<arg line="-F p"/>
<arg line="-a"/>
<arg line="-D" />
<arg line="-v" />
<arg line="-f ${webappname}${test.marker}Port_data.sql"/>
<arg value="${webappname}${test.marker}Port"/>
</exec>
<echo message="Dumping ${webappname}${test.marker}Serv...." />
<exec executable="${postgres.bin.path}/${postgres.bin.dump}" dir="${basedir}/src/${project.src.branch}/db/export">
<env key="PGPASSWORD" value="${postgres.password}"/>
<arg value="-i"/>
<arg line="-h ${postgres.hostname}"/>
<arg line="-p ${postgres.port}"/>
<arg line="-U ${postgres.username}"/>
<arg line="-F p"/>
<arg line="-a"/>
<arg line="-D" />
<arg line="-v" />
<arg line="-f ${webappname}${test.marker}Serv_data.sql"/>
<arg value="${webappname}${test.marker}Serv"/>
</exec>
<echo message="Database full backup in plain version done."/>
</target>
<target name="PG-db-restore-tar">
<echo message="Uncompressing ${webappname}${test.marker}Port...." />
<bunzip2 src="${basedir}/src/${project.src.branch}/db/tar/${webappname}${test.marker}Port.backup.bz2" />
<echo message="Restoring ${webappname}${test.marker}Port...." />
<exec executable="${postgres.bin.path}/${postgres.bin.restore}" dir="${basedir}/src/${project.src.branch}/db/tar">
<env key="PGPASSWORD" value="${postgres.password}"/>
<arg value="-i"/>
<arg line="-h ${postgres.hostname}"/>
<arg line="-p ${postgres.port}"/>
<arg line="-U ${postgres.username}"/>
<arg line="-d ${webappname}${test.marker}Port"/>
<arg value="${webappname}${test.marker}Port.backup"/>
</exec>
<delete file="${basedir}/src/${project.src.branch}/db/tar/${webappname}${test.marker}Port.backup" />
<echo message="Uncompressing ${webappname}${test.marker}Serv...." />
<bunzip2 src="${basedir}/src/${project.src.branch}/db/tar/${webappname}${test.marker}Serv.backup.bz2" />
<echo message="Restoring ${webappname}${test.marker}Serv...." />
<exec executable="${postgres.bin.path}/${postgres.bin.restore}" dir="${basedir}/src/${project.src.branch}/db/tar">
<env key="PGPASSWORD" value="${postgres.password}"/>
<arg value="-i"/>
<arg line="-h ${postgres.hostname}"/>
<arg line="-p ${postgres.port}"/>
<arg line="-U ${postgres.username}"/>
<arg line="-d ${webappname}${test.marker}Serv"/>
<arg value="${webappname}${test.marker}Serv.backup"/>
</exec>
<delete file="${basedir}/src/${project.src.branch}/db/tar/${webappname}${test.marker}Serv.backup" />
</target>
<target name="PG-db-full-update-tar" description="PostgreSQL db update from tar file" depends="PG-db-drop, PG-db-create, PG-db-restore-tar">
<echo message="Databases full update [done]" />
</target>
<target name="PG-db-drop">
<echo message="Dropping ${webappname}${test.marker}Port...." />
<exec executable="${postgres.bin.path}/${postgres.bin.drop}">
<env key="PGPASSWORD" value="${postgres.password}"/>
<arg line="-h ${postgres.hostname}"/>
<arg line="-p ${postgres.port}"/>
<arg line="-U ${postgres.username}"/>
<arg value="${webappname}${test.marker}Port"/>
</exec>
<echo message="Dropping ${webappname}${test.marker}Serv...." />
<exec executable="${postgres.bin.path}/${postgres.bin.drop}">
<env key="PGPASSWORD" value="${postgres.password}"/>
<arg line="-h ${postgres.hostname}"/>
<arg line="-p ${postgres.port}"/>
<arg line="-U ${postgres.username}"/>
<arg value="${webappname}${test.marker}Serv"/>
</exec>
</target>
<target name="PG-db-create">
<echo message="Creating ${webappname}${test.marker}Port...." />
<exec executable="${postgres.bin.path}/${postgres.bin.create}">
<env key="PGPASSWORD" value="${postgres.password}"/>
<arg line="-E UTF-8"/>
<arg line="-O ${postgres.username}"/>
<arg value="-e"/>
<arg line="-h ${postgres.hostname}"/>
<arg line="-p ${postgres.port}"/>
<arg line="-U ${postgres.username}"/>
<arg value="${webappname}${test.marker}Port"/>
</exec>
<echo message="Creating ${webappname}${test.marker}Serv...." />
<exec executable="${postgres.bin.path}/${postgres.bin.create}">
<env key="PGPASSWORD" value="${postgres.password}"/>
<arg line="-E UTF-8"/>
<arg line="-O ${postgres.username}"/>
<arg value="-e"/>
<arg line="-h ${postgres.hostname}"/>
<arg line="-p ${postgres.port}"/>
<arg line="-U ${postgres.username}"/>
<arg value="${webappname}${test.marker}Serv"/>
</exec>
</target>
<target name="Test-PG-db-init" description="Use it to restore databases for tests - PostgreSQL">
<echo message="========================================================================" />
<echo message=".:[Ant] :: Updating test DBs only" />
<echo message=" :: Using files in: ${basedir}/src/test/db/tar" />
<echo message="========================================================================" />
<antcall target="PG-db-drop">
<param name="test.marker" value="test" />
<param name="project.src.branch" value="test" />
</antcall>
<antcall target="PG-db-create">
<param name="test.marker" value="test" />
<param name="project.src.branch" value="test" />
</antcall>
</target>
<target name="Test-MySQL-db-init" description="Use it to restore databases for tests - MySQL">
<echo message="========================================================================" />
<echo message=".:[Ant] :: Updating test DBs only" />
<echo message=" :: Using files in: ${basedir}/src/test/db/mysql" />
<echo message="========================================================================" />
<antcall target="MySQL-db-drop">
<param name="test.marker" value="test" />
<param name="project.src.branch" value="test" />
</antcall>
<antcall target="MySQL-db-create">
<param name="test.marker" value="test" />
<param name="project.src.branch" value="test" />
</antcall>
</target>
<target name="Test-PG-db-backup" description="Test - PG db backup in TAR format">
<antcall target="PG-db-backup">
<param name="test.marker" value="test" />
<param name="project.src.branch" value="test" />
</antcall>
</target>
<target name="Test-PG-db-export-SQL" description="Test - PG db backup in plain SQL">
<antcall target="PG-db-export-SQL">
<param name="test.marker" value="test" />
<param name="project.src.branch" value="test" />
</antcall>
</target>
<!-- Generate Site -->
<target name="Site" description="Generate the Site">
<echo message="========================================================================" />
<echo message=".:[Maven] :: Generating the Site..." />
<echo message="========================================================================" />
<exec executable="mvn" dir="${basedir}">
<arg value="site"/>
</exec>
</target>
<!-- MySQL -->
<target name="MySQL-db-backup" description="MySQL db backup">
<echo message="Dumping ${webappname}${test.marker}Port" />
<exec executable="${mysql.bin.path}/${mysql.bin.dump}" dir="${basedir}/src/${project.src.branch}/db/mysql/">
<arg line=" -h${mysql.hostname}"/>
<arg line=" -P${mysql.port}"/>
<arg line=" -u${mysql.username}"/>
<arg line=" -p${mysql.password}"/>
<arg line="--database" />
<arg line="--routines" />
<arg line="${webappname}${test.marker}Port"/>
<arg line="-r"/>
<arg path="${basedir}/src/${project.src.branch}/db/mysql/${webappname}${test.marker}Port.sql" />
</exec>
<echo message="${webappname}${test.marker}Port dumped." />
<echo message="Dumping ${webappname}${test.marker}Serv" />
<exec executable="${mysql.bin.path}/${mysql.bin.dump}" dir="${basedir}/src/${project.src.branch}/db/mysql/">
<arg line=" -h${mysql.hostname}"/>
<arg line=" -P${mysql.port}"/>
<arg line=" -u${mysql.username}"/>
<arg line=" -p${mysql.password}"/>
<arg line="--database" />
<arg line="--routines" />
<arg line="${webappname}${test.marker}Serv"/>
<arg line="-r"/>
<arg path="${basedir}/src/${project.src.branch}/db/mysql/${webappname}${test.marker}Serv.sql" />
</exec>
<echo message="${webappname}${test.marker}Serv dumped." />
</target>
<target name="MySQL-db-restore" description="MySQL db restore">
<echo message="Restoring ${webappname}${test.marker}Port..." />
<exec executable="${mysql.bin.path}/${mysql.bin.restore}" dir="${basedir}/src/${project.src.branch}/db/mysql/">
<arg line=" -h${mysql.hostname}"/>
<arg line=" -P${mysql.port}"/>
<arg line=" -u${mysql.username}"/>
<arg line=" -p${mysql.password}"/>
<arg line=" -e"/>
<arg line=' "source ${basedir}/src/${project.src.branch}/db/mysql/${webappname}${test.marker}Port.sql" '/>
</exec>
<echo message="...${webappname}${test.marker}Port Restored." />
<echo message="Restoring ${webappname}${test.marker}Serv..." />
<exec executable="${mysql.bin.path}/${mysql.bin.restore}" dir="${basedir}/src/${project.src.branch}/db/mysql/">
<arg line=" -h${mysql.hostname}"/>
<arg line=" -P${mysql.port}"/>
<arg line=" -u${mysql.username}"/>
<arg line=" -p${mysql.password}"/>
<arg line=" -e"/>
<arg line=' "source ${basedir}/src/${project.src.branch}/db/mysql/${webappname}${test.marker}Serv.sql" '/>
</exec>
<echo message="...${webappname}${test.marker}Serv Restored." />
</target>
<target name="MySQL-db-drop" description="MySQL db drop">
<echo message="Dropping ${webappname}${test.marker}Port..." />
<exec executable="${mysql.bin.path}/${mysql.bin.drop}">
<arg line=" -h${mysql.hostname}"/>
<arg line=" -P${mysql.port}"/>
<arg line=" -u${mysql.username}"/>
<arg line=" -p${mysql.password}"/>
<arg line=" -e"/>
<arg line=' "drop database `${webappname}${test.marker}Port`;" '/>
</exec>
<echo message="... ${webappname}${test.marker}Port dropped." />
<echo message="Dropping ${webappname}${test.marker}Serv" />
<exec executable="${mysql.bin.path}/${mysql.bin.drop}">
<arg line=" -h${mysql.hostname}"/>
<arg line=" -P${mysql.port}"/>
<arg line=" -u${mysql.username}"/>
<arg line=" -p${mysql.password}"/>
<arg line=" -e"/>
<arg line=' "drop database `${webappname}${test.marker}Serv`;" '/>
</exec>
<echo message="... ${webappname}${test.marker}Serv dropped." />
</target>
<target name="MySQL-db-create" description="MySQL db create">
<echo message="Creating ${webappname}${test.marker}Port..." />
<exec executable="${mysql.bin.path}/${mysql.bin.drop}">
<arg line=" -h${mysql.hostname}"/>
<arg line=" -P${mysql.port}"/>
<arg line=" -u${mysql.username}"/>
<arg line=" -p${mysql.password}"/>
<arg line=" -e"/>
<arg line=' "create database `${webappname}${test.marker}Port`;" '/>
</exec>
<echo message="... ${webappname}${test.marker}Port created" />
<echo message="Creating ${webappname}${test.marker}Serv" />
<exec executable="${mysql.bin.path}/${mysql.bin.drop}">
<arg line=" -h${mysql.hostname}"/>
<arg line=" -P${mysql.port}"/>
<arg line=" -u${mysql.username}"/>
<arg line=" -p${mysql.password}"/>
<arg line=" -e"/>
<arg line=' "create database `${webappname}${test.marker}Serv`;" '/>
</exec>
<echo message="... ${webappname}${test.marker}Serv created" />
</target>
<target name="MySQL-db-full-update" description="MySQL db update" depends="MySQL-db-drop, MySQL-db-restore">
<echo message="Databases full update [done]" />
</target>
</project>