-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathbuild-config.xml
executable file
·362 lines (340 loc) · 18.9 KB
/
build-config.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
<?xml version="1.0"?>
<!--
~ Copyright © 2005 - 2018 TIBCO Software Inc.
~ http://www.jaspersoft.com.
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<!-- =============================================================== -->
<!-- Ant convention to copy config files to some target -->
<!-- Properties expected: -->
<!-- js-path: path to CE source dir -->
<!-- js-pro-path: path to Pro source dir (here) -->
<!-- target: where to copy the files -->
<!-- =============================================================== -->
<project name="ce-config" default="copy-config" basedir=".">
<description>Copy config file sets</description>
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<!-- define dependencies -->
<property name="ce.webapp.deps" value="ce.webapp, ce.common, ce.ftp"/>
<property name="ce.unit-test.deps" value="ce.unit-test, ce.common, ce.export-shared"/>
<property name="ce.esapi.deps" value="ce.common.esapi"/>
<property name="ce.api-impl.deps" value="ce.common.esapi"/>
<property name="ce.production-tests.deps" value="ce.production-tests, ce.common, ce.export-shared, ce.sso"/>
<property name="ce.export.deps" value="ce.export, ce.export-shared, ce.common"/>
<!-- define paths -->
<property name="ce.common.path" value="${js-path}/common/shared-config"/>
<property name="ce.common.esapi.path" value="${js-path}/common/shared-config/classes/esapi"/>
<property name="ce.webapp.path" value="${js-path}/jasperserver-war/shared-config"/>
<property name="ce.unit-test.path" value="${js-path}/jasperserver-unit-test/shared-config"/>
<property name="ce.production-tests.path" value="${js-path}/production-tests/shared-config"/>
<!-- 1/30/2013 - New functionality to copy single application context files from <module>'s to a classpath:
example - copy applicationContext-security-web.xml from jasperserver-war/shared-config to production-tests/target/target-classes-->
<property name="ce.production-tests.files" value="${js-path}/jasperserver-war/shared-config/applicationContext-security-web.xml"/>
<property name="ce.export.path" value="${js-path}/jasperserver-export-package/config"/>
<property name="ce.export-shared.path" value="${js-path}/jasperserver-export-package/shared-config"/>
<property name="ce.sso.path" value="${js-path}/samples/externalAuth-sample-config"/>
<property name="ce.ftp.path" value="${js-path}/jasperserver-ftp/shared-config"/>
<!--
Comma-separated list of files with platform-specific values;
in buildomatic these are created in the build_conf/<cfg-name>/templates directory.
You have to set the platform-path property to point to them
-->
<property name="platform.files" value="js.jdbc.properties, js.quartz.properties, js.diagnostic.properties, js.aws.datasource.properties, js.externalAuth.properties, js.config.properties, relativedate.properties"/>
<target name="copy-config" description="copy config files for a specific module (requires target property to be set)">
<!-- lookup pathlist of deps for specified module -->
<propertycopy property="path-list" from="${module}.deps"/>
<process-config path-list="${path-list}"/>
<!-- after copy-deps, copy over the list of platform-specific files -->
<if>
<and>
<isset property="platform-path"/>
<or>
<not>
<isset property="exclude.platform.files"/>
</not>
<equals arg1="exclude.platform.files" arg2="false"/>
</or>
</and>
<then>
<copy toDir="${target}" overwrite="true" verbose="true">
<fileset dir="${platform-path}" includes="${platform.files}"/>
</copy>
</then>
</if>
</target>
<target name="list-config">
<!-- lookup pathlist of deps for specified module -->
<propertycopy property="path-list" from="${module}.deps"/>
<process-config path-list="${path-list}" do-what="listfiles-relative"/>
</target>
<!-- list the modules available -->
<target name="list-modules">
<!-- get all "deps" properties -->
<propertyselector property="mod-list"
match="(.*)\.deps"
select="\1"/>
<!-- sort them, then list paths for each module -->
<sortlist property="sorted-mod-list" override="true" value="${mod-list}"/>
<for list="${sorted-mod-list}" param="mod">
<sequential>
<propertycopy property="deps" override="true" from="@{mod}.deps"/>
<echo message="Module @{mod} has these paths:"/>
<process-config path-list="${deps}" do-what="list"/>
</sequential>
</for>
</target>
<target name="list-files">
<!-- grep? -->
<if>
<isset property="grep"/>
<then>
<property name="do" value="grep"/>
</then>
<else>
<property name="do" value="listfiles-full"/>
</else>
</if>
<!-- get all "path" properties -->
<propertyselector property="path-list"
match="(.*)\.path$"
select="\1"/>
<!-- sort them, then list paths for each module -->
<sortlist property="sorted-path-list" override="true" value="${path-list}"/>
<for list="${sorted-path-list}" param="pathname">
<sequential>
<if>
<and>
<available file="${@{pathname}.path}"/>
<not>
<equals arg1="@{pathname}.path" arg2="sun.boot.library.path"/>
</not>
</and>
<then>
<echo level="debug" message="ok path @{pathname}.path: ${@{pathname}.path}"/>
<process-config path-list="@{pathname}" do-what="${do}"/>
</then>
<else>
<echo level="debug" message="weird path @{pathname}.path: ${@{pathname}.path}"/>
</else>
</if>
</sequential>
</for>
</target>
<!-- this macro recurses over a path list (which can contain other path lists) and takes an action for each path.
"do-what" can take these values:
copy: copy files under the paths to ${target}
listfiles-relative: echo the file names relative to each path
listfiles-full: echo the full file names for each path
list: just echo the paths
-->
<macrodef name="process-config">
<attribute name="path-list"/>
<attribute name="do-what" default="copy"/>
<sequential>
<for list="@{path-list}" delimiter=", " param="path-name">
<sequential>
<if>
<isset property="@{path-name}.pathlist"/>
<then>
<!-- echo message="path list is ${@{path-name}.pathlist}"/ -->
<process-config path-list="${@{path-name}.pathlist}" do-what="@{do-what}"/>
</then>
<elseif>
<isset property="@{path-name}.path"/>
<then>
<var name="path" value="${@{path-name}.path}"/>
<if>
<equals arg1="@{do-what}" arg2="copy"/>
<then>
<!-- set copy-overwrite to default (can be set to false to just update new files) -->
<property name="copy-overwrite" value="true"/>
<copy toDir="${target}" overwrite="${copy-overwrite}">
<fileset dir="${path}"/>
</copy>
</then>
<elseif>
<equals arg1="@{do-what}" arg2="listfiles-relative"/>
<then>
<echo level="info" message=" ${path}"/>
<for param="file">
<fileset dir="${path}"/>
<sequential>
<var name="relpath" unset="true"/>
<pathconvert dirsep="/" property="relpath">
<file file="@{file}"/>
<filtermapper>
<replacestring from="\" to="/"/>
<replacestring from="${path}/" to=""/>
</filtermapper>
</pathconvert>
<echo message=" ${relpath}"/>
</sequential>
</for>
</then>
</elseif>
<elseif>
<equals arg1="@{do-what}" arg2="listfiles-full"/>
<then>
<echo level="info" message=" ${path}"/>
<for param="file">
<fileset dir="${path}"/>
<sequential>
<var name="fullpath" unset="true"/>
<pathconvert dirsep="/" property="fullpath">
<file file="@{file}"/>
<filtermapper>
<replacestring from="\" to="/"/>
</filtermapper>
</pathconvert>
<echo message=" ${fullpath}"/>
</sequential>
</for>
</then>
</elseif>
<elseif>
<equals arg1="@{do-what}" arg2="grep"/>
<then>
<for param="file">
<fileset dir="${path}"/>
<sequential>
<var name="matches" unset="true"/>
<loadresource property="matches">
<concat>
<path path="@{file}"/>
<filterchain>
<containsregex pattern="${grep}" flags="i"/>
<prefixlines prefix=" "/>
</filterchain>
</concat>
</loadresource>
<if>
<isset property="matches"/>
<then>
<echo message="@{file}:"/>
<echo message="${matches}"/>
<echo/>
</then>
</if>
</sequential>
</for>
</then>
</elseif>
<elseif>
<equals arg1="@{do-what}" arg2="list"/>
<then>
<echo message=" ${path}"/>
</then>
</elseif>
</if>
</then>
</elseif>
<else>
<fail message="Couldn't find path or pathlist for '@{path-name}'" />
</else>
</if>
<!-- 1/30/2013 - New functionality to copy single application context files from <module>'s to a classpath:
example - copy applicationContext-security-web.xml from jasperserver-war/shared-config to production-tests/target/target-classes-->
<if>
<isset property="@{path-name}.files"/>
<then>
<var name="file-list" value="${@{path-name}.files}"/>
<if>
<equals arg1="@{do-what}" arg2="copy"/>
<then>
<for list="${file-list}" delimiter=", " param="file">
<sequential>
<copy file="@{file}" toDir="${target}" overwrite="true"/>
</sequential>
</for>
</then>
<elseif>
<equals arg1="@{do-what}" arg2="listfiles-relative"/>
<then>
<echo level="info" message=" ${file-list}"/>
<for list="${file-list}" delimiter=", " param="file">
<sequential>
<var name="relpath" unset="true"/>
<pathconvert dirsep="/" property="relpath">
<file file="@{file}"/>
<filtermapper>
<replacestring from="\" to="/"/>
<replaceregex pattern=".*/" replace=""/>
</filtermapper>
</pathconvert>
<echo message=" ${relpath}"/>
</sequential>
</for>
</then>
</elseif>
<elseif>
<equals arg1="@{do-what}" arg2="listfiles-full"/>
<then>
<echo level="info" message=" ${file-list}"/>
<for list="${file-list}" delimiter=", " param="file">
<sequential>
<var name="fullpath" unset="true"/>
<pathconvert dirsep="/" property="fullpath">
<file file="@{file}"/>
<filtermapper>
<replacestring from="\" to="/"/>
</filtermapper>
</pathconvert>
<echo message=" ${fullpath}"/>
</sequential>
</for>
</then>
</elseif>
<elseif>
<equals arg1="@{do-what}" arg2="grep"/>
<then>
<for list="${file-list}" delimiter=", " param="file">
<sequential>
<var name="matches" unset="true"/>
<loadresource property="matches">
<concat>
<path path="@{file}"/>
<filterchain>
<containsregex pattern="${grep}" flags="i"/>
<prefixlines prefix=" "/>
</filterchain>
</concat>
</loadresource>
<if>
<isset property="matches"/>
<then>
<echo message="@{file}:"/>
<echo message="${matches}"/>
<echo/>
</then>
</if>
</sequential>
</for>
</then>
</elseif>
<elseif>
<equals arg1="@{do-what}" arg2="list"/>
<then>
<echo message=" ${path}"/>
</then>
</elseif>
</if>
</then>
</if>
<!-- 1/30/2013 -->
</sequential>
</for>
</sequential>
</macrodef>
</project>