forked from apache/logging-log4cxx
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
459 lines (411 loc) · 12.4 KB
/
build.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
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE project [
<!ENTITY license '
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'>
<!ENTITY common SYSTEM 'src/ant/common.xml'>
]>
<!--
This file releases log4cxx using Apache Ant (http://ant.apache.org)
-->
<project name="log4cxx" default="usage">
&common;
<property name="base.dir"
location="."
/>
<property name="src.dir"
location="${base.dir}/src/main/cpp"
/>
<property name="resources.dir"
location="${base.dir}/src/main/resources"
/>
<property name="include.dir"
location="${base.dir}/src/main/include"
/>
<property name="target.dir"
location="${base.dir}/target"
/>
<property name="lib.dir"
location="${target.dir}/lib"
/>
<property name="examples.dir"
location="${base.dir}/src/examples/cpp"
/>
<property name="tests.dir"
location="${base.dir}/src/test"
/>
<property name="tests.cpp.dir"
location="${tests.dir}/cpp"
/>
<property name="tests.resources.dir"
location="${tests.dir}/resources"
/>
<property name="tests.output.dir"
location="${tests.resources.dir}/output"
/>
<property name="m2_repo"
location="${user.home}/.m2/repository"
/>
<property name="log4j.version"
value="1.2.14"
/>
<available property="log4j.jar"
value="/usr/share/java/log4j-1.2.jar"
file="/usr/share/java/log4j-1.2.jar"
/>
<property name="log4j.jar"
location="${m2_repo}/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar"
/>
<property name="doxygen.exe"
value="doxygen"
/>
<property name="lib.name"
value="${project.groupId}"
/>
<property name="lib.prefix"
value=""
/>
<propertyregex property="version.major"
input="${project.version}"
regexp="^(\d+)"
select="\1"
/>
<propertyregex property="version.minor"
input="${project.version}"
regexp="\.(\d+)\."
select="\1"
/>
<propertyregex property="version.rev"
input="${project.version}"
regexp="(\d+)(?:-.+)?$"
select="\1"
/>
<propertyregex property="version.hasSuffix"
input="${project.version}"
regexp="\d+-.+$"
select="\0"
/>
<property name="site.svnRepoUrl"
value="https://svn.apache.org/repos/infra/websites/production/logging/content/log4cxx"
/>
<property name="site.deployDir"
value="target/site-deploy"
/>
<property name="site.deployDir.curVersion"
value="${site.deployDir}/${project.version}"
/>
<property name="site.deployDir.curVersionWoSuffix"
value="${site.deployDir}/${version.major}.${version.minor}.${version.rev}"
/>
<target name="usage"
description="Describes usage of the release script">
<echo>
Ant file for releasing log4cxx
Common invocations:
> ant -p
Displays available targets
</echo>
</target>
<target name="init"
depends="common-init">
<condition property="force-ant"
value="1">
<equals arg1="${find}"
arg2="false"
/>
</condition>
<echo>force-ant: ${force-ant}</echo>
</target>
<target name="make-header-check">
<echo file="${header}.cpp"
append="false">
#include "${header}"
#include "${header}"
</echo>
</target>
<target name="header-check"
description="Checks headers against Effective C++ guidelines">
<fail unless="is-gcc">Requires GCC compiler</fail>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<delete dir="${target.dir}/header-check" />
<mkdir dir="${target.dir}/header-check" />
<copy todir="${target.dir}/header-check"
overwrite="true">
<fileset dir="${include.dir}"
includes="**/*.h">
<!-- obsolete header with #error directive to eliminate its use -->
<exclude name="**/tchar.h" />
<!-- excluded due to conflict between log4cxx/rfa.h and log4cxx/rolling/rfa.h -->
<exclude name="log4cxx/rollingfileappender.h" />
</fileset>
</copy>
<foreach target="make-header-check"
param="header">
<path>
<fileset dir="${target.dir}/header-check"
includes="**/*.h"
/>
</path>
</foreach>
<cc objdir="${target.dir}/header-check"
name="gcc"
exceptions="true"
subsystem="gui"
optimize="${optimize}"
multithreaded="true"
relentless="true"
debug="${debug}"
projectsOnly="${projectsOnly}">
<compilerarg value="-Weffc++"
/>
<compilerarg value="-Wall"
/>
<compilerarg value="${pic-option}"
if="pic-option"
/>
<fileset dir="${target.dir}/header-check"
includes="**/*.cpp"
excludes="log4cxx/private/*.cpp **/aprinitializer.h.cpp"
/>
<includepath path="${include.dir}" />
<project outfile="${projects.dir}/projects/header-check"
type="${project.type}"
if="project.if"
/>
</cc>
</target>
<target name="clean-output"
depends="init">
<delete>
<fileset dir="${tests.dir}"
includes="output/*"
/>
</delete>
</target>
<target name="apidocs"
description="Build log4cxx manual">
<copy file="${base.dir}/src/site/doxy/Doxyfile.in"
tofile="${target.dir}/Doxyfile"
overwrite="true"
/>
<replace file="${target.dir}/Doxyfile">
<replacefilter token="@version@"
value="${project.version}"
/>
<replacefilter token="@base_dir@"
value="${base.dir}"
/>
<replacefilter token="@manual_dest@"
value="${target.dir}/site/apidocs"
/>
</replace>
<!--
Copying project site index data to apidocs index
We need some Apache boilerplate and intro in the apidocs index page and the easiest
solution seems to be to simply copy some of the contents of the project site index.
-->
<xslt in="${target.dir}/site/index.html"
out="${target.dir}/mainpage.dox"
style="${base.dir}/src/site/doxy/mainpage.dox.xsl"
force="true">
<xmlcatalog>
<dtd publicId="-//W3C//DTD XHTML 1.0 Transitional//EN"
location="${base.dir}/src/site/doxy/DTDs/xhtml1-transitional.dtd"
/>
<dtd publicId="-//W3C//ENTITIES Latin 1 for XHTML//EN"
location="${base.dir}/src/site/doxy/DTDs/xhtml-lat1.ent"
/>
<dtd publicId="-//W3C//ENTITIES Symbols for XHTML//EN"
location="${base.dir}/src/site/doxy/DTDs/xhtml-symbol.ent"
/>
<dtd publicId="-//W3C//ENTITIES Special for XHTML//EN"
location="${base.dir}/src/site/doxy/DTDs/xhtml-special.ent"
/>
</xmlcatalog>
</xslt>
<mkdir dir="${target.dir}/site/apidocs" />
<exec executable="${doxygen.exe}"
dir="${target.dir}"
/>
<!--
Links to the main project site
We want links to the main project site and adding them after doxygen seems to be the
only and easiest way.
-->
<replaceregexp match="(<div (?:id="projectname"|class="title")>)(Apache log4cxx)"
replace="\1<a href="http://logging.apache.org/log4cxx">\2</a>"
flags="img">
<fileset dir="${target.dir}/site/apidocs">
<include name="*.html" />
</fileset>
</replaceregexp>
</target>
<target name="site-text-file-cleanup">
<fixcrlf srcDir="${base.dir}/${subDir}"
tab="asis"
tablength="4"
fixlast="false"
eof="asis"
eol="unix"
includes="**/*.css **/*.html"
/>
<replaceregexp flags="mg"
match="(?: |\t)+$"
replace="">
<fileset dir="${base.dir}/${subDir}"
includes="**/*.css, **/*.html"
/>
</replaceregexp>
</target>
<target name="site"
depends="apidocs">
<antcall target="site-text-file-cleanup">
<param name="subDir"
value="target/site"
/>
</antcall>
</target>
<target name="prepare-changes"
description="Prepares changes.xml from a JIRA issues list">
<xslt style="src/changes/changes.xslt"
in="issues.xml"
out="src/changes/changes.xml"
/>
</target>
<target name="checkout-site">
<exec executable="svn"
failonerror="true">
<arg value="co" />
<arg value="${site.svnRepoUrl}" />
<arg value="${site.deployDir}" />
</exec>
</target>
<target name="update-site">
<exec executable="svn"
dir="${site.deployDir}"
failonerror="true">
<arg value="update" />
</exec>
</target>
<target name="post-site"
depends="checkout-site, update-site"
/>
<target name="svn-mime=css">
<exec executable="svn">
<arg value="propset" />
<arg value="svn:mime-type" />
<arg value="text/css" />
<arg value="${src.css}" />
</exec>
</target>
<target name="svn-mime=html">
<exec executable="svn">
<arg value="propset" />
<arg value="svn:mime-type" />
<arg value="text/html" />
<arg value="${src.html}" />
</exec>
</target>
<!--
Was unable to get a version w/o any suffix in pom.xml/distributionManagement, guess it's a
limitation of the property interpolation used. All suggestions found in the net seem to only
work outside that section, e.g. I was able to make a shorter version available in some
phases calling ANT targets. Doesn't get me anything... So I'm dealing with the long vs.
short name here by simply renaming the folder with the long name created by maven.
This only works for SVN clients using only one ".svn" folder per working copy!
https://cwiki.apache.org/confluence/display/MAVENOLD/POM+Interpolation+Refactor
https://stackoverflow.com/a/12002359/2055163
https://gist.github.com/tux2323/970877#file-pom-xml-L24
-->
<target name="svn-shorten-dir-name"
if="version.hasSuffix">
<delete dir="${site.deployDir.curVersionWoSuffix}"
/>
<move file="${site.deployDir.curVersion}"
tofile="${site.deployDir.curVersionWoSuffix}"
/>
</target>
<target name="site-deploy">
<antcall target="svn-shorten-dir-name" />
<delete file="${site.deployDir}/svn-commit.tmp~" />
<exec executable="svn"
failonerror="true">
<arg value="add" />
<arg value="--force" />
<arg value="--depth=infinity" />
<arg value="${site.deployDir.curVersionWoSuffix}" />
</exec>
<taskdef name="foreach"
classname="net.sf.antcontrib.logic.ForEach"
/>
<foreach target="svn-mime=css"
param="src.css">
<path>
<fileset dir="${site.deployDir.curVersionWoSuffix}"
includes="**/*.css"
/>
</path>
</foreach>
<foreach target="svn-mime=html"
param="src.html">
<path>
<fileset dir="${site.deployDir.curVersionWoSuffix}"
includes="**/*.html"
/>
</path>
</foreach>
<antcall target="site-text-file-cleanup">
<param name="subDir"
value="${site.deployDir.curVersionWoSuffix}"
/>
</antcall>
<!--
Is allowed to fail in case of no files to delete:
[exec] svn: E205001: Try 'svn help delete' for more information
[exec] svn: E205001: Not enough arguments provided
-->
<exec executable="sh"
failonerror="false">
<arg value="-c" />
<arg value="svn st "${site.deployDir.curVersionWoSuffix}" | grep ! | cut -d! -f2 | sed 's/^ *//' | sed 's/^/\"/g' | sed 's/$/\"/g' | xargs svn rm" />
</exec>
<!-- Requires that SVN_EDITOR, VISUAL or EDITOR being set to edit commit description. -->
<exec executable="sh"
failonerror="true">
<arg value="-c" />
<arg value="svn ci "${site.deployDir.curVersionWoSuffix}" < /dev/tty > /dev/tty 2> /dev/tty" />
</exec>
</target>
<target name="autogen"
depends="init"
if="is-unix">
<exec executable="sh">
<arg value="autogen.sh" />
</exec>
</target>
</project>