This repository has been archived by the owner on Oct 6, 2021. It is now read-only.
forked from tomcat-slf4j-logback/tomcat-slf4j-logback
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
273 lines (258 loc) · 14 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="tomcat-slf4j-logback" basedir="." default="dist" xmlns:ivy="antlib:org.apache.ivy.ant">
<property file="build.properties" />
<property file="build.properties.default" />
<target name="info">
<echo>Tomcat + SLF4J + Logback integration</echo>
</target>
<target name="dist" depends="dependencies,fix-logback-access-for-tomcat7">
<!-- slf4j-api -->
<antcall target="downloadfile">
<param name="sourcefile" value="${slf4j-api.src.location}" />
<param name="destfile" value="${slf4j-api.src.jar}" />
<param name="destdir" value="${slf4j-api.home}" />
</antcall>
<delete dir="${slf4j-api.home}/slf4j-api-${slf4j.version}-sources" />
<unjar src="${slf4j-api.src.jar}" dest="${slf4j-api.home}/slf4j-api-${slf4j.version}-sources" />
<replace dir="${slf4j-api.home}/slf4j-api-${slf4j.version}-sources" encoding="UTF-8">
<replacefilter token="org.slf4j" value="org.apache.juli.logging.org.slf4j" />
<replacefilter token="org/slf4j" value="org/apache/juli/logging/org/slf4j" />
</replace>
<mkdir dir="${slf4j-api.home}/slf4j-api-${slf4j.version}-sources/org/apache/juli/logging/org/slf4j" />
<move todir="${slf4j-api.home}/slf4j-api-${slf4j.version}-sources/org/apache/juli/logging/org/slf4j">
<fileset dir="${slf4j-api.home}/slf4j-api-${slf4j.version}-sources/org/slf4j" />
</move>
<delete dir="${slf4j-api.home}/tomcat-juli-slf4j-api-${slf4j.version}" />
<mkdir dir="${slf4j-api.home}/tomcat-juli-slf4j-api-${slf4j.version}" />
<javac srcdir="${slf4j-api.home}/slf4j-api-${slf4j.version}-sources" destdir="${slf4j-api.home}/tomcat-juli-slf4j-api-${slf4j.version}"
source="1.5" target="1.5" nowarn="true" encoding="UTF-8" debug="on" includeAntRuntime="false" />
<copy todir="${slf4j-api.home}/tomcat-juli-slf4j-api-${slf4j.version}">
<fileset dir="${slf4j-api.home}/slf4j-api-${slf4j.version}-sources">
<exclude name="META-INF" />
<exclude name="META-INF/*" />
<exclude name="**/*.java" />
</fileset>
</copy>
<jar destfile="${dist.path}/tomcat-juli-slf4j-api-${slf4j.version}.jar">
<fileset dir="${slf4j-api.home}/tomcat-juli-slf4j-api-${slf4j.version}">
<exclude name="org/apache/juli/logging/org/slf4j/impl/*.class" />
</fileset>
</jar>
<!-- jcl-over-slf4j -->
<antcall target="downloadfile">
<param name="sourcefile" value="${jcl-over-slf4j.src.location}" />
<param name="destfile" value="${jcl-over-slf4j.src.jar}" />
<param name="destdir" value="${jcl-over-slf4j.home}" />
</antcall>
<delete dir="${jcl-over-slf4j.home}/jcl-over-slf4j-${slf4j.version}-sources" />
<unjar src="${jcl-over-slf4j.src.jar}" dest="${jcl-over-slf4j.home}/jcl-over-slf4j-${slf4j.version}-sources" />
<delete dir="${jcl-over-slf4j.home}/tomcat-juli-jcl-over-slf4j-${slf4j.version}" />
<mkdir dir="${jcl-over-slf4j.home}/tomcat-juli-jcl-over-slf4j-${slf4j.version}" />
<unjar src="_external/tomcat-juli.jar" dest="${jcl-over-slf4j.home}/tomcat-juli-jcl-over-slf4j-${slf4j.version}">
<patternset>
<include name="**/ClassLoaderLogManager*.class" />
</patternset>
</unjar>
<replace dir="${jcl-over-slf4j.home}/jcl-over-slf4j-${slf4j.version}-sources" encoding="UTF-8">
<replacefilter token="org.slf4j" value="org.apache.juli.logging.org.slf4j" />
<replacefilter token="org/slf4j" value="org/apache/juli/logging/org/slf4j" />
<replacefilter token="org.apache.commons" value="org.apache.juli" />
<replacefilter token="org/apache/commons" value="org/apache/juli" />
</replace>
<mkdir dir="${jcl-over-slf4j.home}/jcl-over-slf4j-${slf4j.version}-sources/org/apache/juli" />
<move todir="${jcl-over-slf4j.home}/jcl-over-slf4j-${slf4j.version}-sources/org/apache/juli">
<fileset dir="${jcl-over-slf4j.home}/jcl-over-slf4j-${slf4j.version}-sources/org/apache/commons" />
</move>
<javac srcdir="${jcl-over-slf4j.home}/jcl-over-slf4j-${slf4j.version}-sources" destdir="${jcl-over-slf4j.home}/tomcat-juli-jcl-over-slf4j-${slf4j.version}"
source="1.5" target="1.5" nowarn="true" encoding="UTF-8" debug="on" includeAntRuntime="false">
<classpath>
<fileset dir="${dist.path}">
<include name="*.jar" />
</fileset>
</classpath>
</javac>
<copy todir="${jcl-over-slf4j.home}/tomcat-juli-jcl-over-slf4j-${slf4j.version}">
<fileset dir="${jcl-over-slf4j.home}/jcl-over-slf4j-${slf4j.version}-sources">
<exclude name="META-INF" />
<exclude name="META-INF/*" />
<exclude name="**/*.java" />
</fileset>
</copy>
<jar destfile="${dist.path}/tomcat-juli.jar">
<fileset dir="${jcl-over-slf4j.home}/tomcat-juli-jcl-over-slf4j-${slf4j.version}" />
<manifest>
<attribute name="Class-Path" value="tomcat-juli-slf4j-api-${slf4j.version}.jar tomcat-juli-logback-core-${logback.version}.jar tomcat-juli-logback-classic-${logback.version}.jar ../conf/logback" />
</manifest>
</jar>
<!-- logback core -->
<antcall target="downloadfile">
<param name="sourcefile" value="${logback-core.src.location}" />
<param name="destfile" value="${logback-core.src.jar}" />
<param name="destdir" value="${logback-core.home}" />
</antcall>
<delete dir="${logback-core.home}/logback-core-${logback.version}-sources" />
<unjar src="${logback-core.src.jar}" dest="${logback-core.home}/logback-core-${logback.version}-sources" />
<replace dir="${logback-core.home}/logback-core-${logback.version}-sources" encoding="UTF-8">
<replacefilter token="ch.qos.logback" value="org.apache.juli.logging.ch.qos.logback" />
<replacefilter token="ch/qos/logback" value="org/apache/juli/logging/ch/qos/logback" />
</replace>
<mkdir dir="${logback-core.home}/logback-core-${logback.version}-sources/org/apache/juli/logging/ch" />
<move todir="${logback-core.home}/logback-core-${logback.version}-sources/org/apache/juli/logging/ch">
<fileset dir="${logback-core.home}/logback-core-${logback.version}-sources/ch" />
</move>
<delete dir="${logback-core.home}/tomcat-juli-logback-core-${logback.version}" />
<mkdir dir="${logback-core.home}/tomcat-juli-logback-core-${logback.version}" />
<javac srcdir="${logback-core.home}/logback-core-${logback.version}-sources" destdir="${logback-core.home}/tomcat-juli-logback-core-${logback.version}"
source="1.5" target="1.5" nowarn="true" encoding="UTF-8" debug="on" includeAntRuntime="false">
<classpath>
<fileset dir="${dist.path}">
<include name="*.jar" />
</fileset>
<fileset dir="_lib/jar">
<include name="*.jar" />
</fileset>
</classpath>
</javac>
<copy todir="${logback-core.home}/tomcat-juli-logback-core-${logback.version}">
<fileset dir="${logback-core.home}/logback-core-${logback.version}-sources">
<exclude name="META-INF" />
<exclude name="META-INF/*" />
<exclude name="**/*.java" />
</fileset>
</copy>
<jar destfile="${dist.path}/tomcat-juli-logback-core-${logback.version}.jar">
<fileset dir="${logback-core.home}/tomcat-juli-logback-core-${logback.version}" />
</jar>
<!-- logback classic -->
<antcall target="downloadfile">
<param name="sourcefile" value="${logback-classic.src.location}" />
<param name="destfile" value="${logback-classic.src.jar}" />
<param name="destdir" value="${logback-classic.home}" />
</antcall>
<delete dir="${logback-classic.home}/logback-classic-${logback.version}-sources" />
<unjar src="${logback-classic.src.jar}" dest="${logback-classic.home}/logback-classic-${logback.version}-sources" />
<replace dir="${logback-classic.home}/logback-classic-${logback.version}-sources" encoding="UTF-8">
<replacefilter token="org.slf4j" value="org.apache.juli.logging.org.slf4j" />
<replacefilter token="org/slf4j" value="org/apache/juli/logging/org/slf4j" />
<replacefilter token="ch.qos.logback" value="org.apache.juli.logging.ch.qos.logback" />
<replacefilter token="ch/qos/logback" value="org/apache/juli/logging/ch/qos/logback" />
<replacefilter token=""logback.configurationFile"" value=""juli-logback.configurationFile"" />
</replace>
<mkdir dir="${logback-classic.home}/logback-classic-${logback.version}-sources/org/apache/juli/logging/ch" />
<move todir="${logback-classic.home}/logback-classic-${logback.version}-sources/org/apache/juli/logging/ch">
<fileset dir="${logback-classic.home}/logback-classic-${logback.version}-sources/ch" />
</move>
<move todir="${logback-classic.home}/logback-classic-${logback.version}-sources/org/apache/juli/logging/org/slf4j/impl">
<fileset dir="${logback-classic.home}/logback-classic-${logback.version}-sources/org/slf4j/impl" />
</move>
<delete dir="${logback-classic.home}/logback-classic-${logback.version}-sources/org/slf4j" />
<delete dir="${logback-classic.home}/tomcat-juli-logback-classic-${logback.version}" />
<mkdir dir="${logback-classic.home}/tomcat-juli-logback-classic-${logback.version}" />
<javac srcdir="${logback-classic.home}/logback-classic-${logback.version}-sources" destdir="${logback-classic.home}/tomcat-juli-logback-classic-${logback.version}"
source="1.5" target="1.5" nowarn="true" encoding="UTF-8" debug="on" includeAntRuntime="false">
<classpath>
<fileset dir="${dist.path}">
<include name="*.jar" />
</fileset>
<fileset dir="_lib/jar">
<include name="*.jar" />
</fileset>
<fileset dir="_external">
<include name="*.jar" />
</fileset>
</classpath>
</javac>
<copy todir="${logback-classic.home}/tomcat-juli-logback-classic-${logback.version}">
<fileset dir="${logback-classic.home}/logback-classic-${logback.version}-sources">
<exclude name="META-INF" />
<exclude name="META-INF/*" />
<exclude name="**/*.java" />
</fileset>
</copy>
<jar destfile="${dist.path}/tomcat-juli-logback-classic-${logback.version}.jar">
<fileset dir="${logback-classic.home}/tomcat-juli-logback-classic-${logback.version}" />
</jar>
</target>
<target name="dependencies">
<mkdir dir="${dist.path}" />
<mkdir dir="${externals.path}" />
<ivy:settings file="ivysettings.xml" />
<ivy:retrieve pattern="_lib/[type]/[artifact]-[revision].[ext]" sync="true" />
</target>
<!-- fix until LBACCESS-17 is resolved -->
<target name="fix-logback-access-for-tomcat7" unless="tomcat-below-version7" depends="dependencies,original-tomcat-juli">
<echo>Fixing LBACCESS-17</echo>
<antcall target="downloadfile">
<param name="sourcefile" value="${logback-access.src.location}" />
<param name="destfile" value="${logback-access.src.jar}" />
<param name="destdir" value="${logback-access.home}" />
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${logback-access.location}" />
<param name="destfile" value="${logback-access.jar}" />
<param name="destdir" value="${logback-access.home}" />
</antcall>
<delete dir="${logback-access.home}/logback-access-${logback.version}-sources" />
<unjar src="${logback-access.src.jar}" dest="${logback-access.home}/logback-access-${logback.version}-sources" />
<replace dir="${logback-access.home}/logback-access-${logback.version}-sources/ch/qos/logback/access/tomcat" encoding="UTF-8">
<replacefilter token="public void start() {" value="public void startInternal() throws org.apache.catalina.LifecycleException { setState(org.apache.catalina.LifecycleState.STARTING);" />
<replacefilter token="public void stop() {" value="public void stopInternal() throws org.apache.catalina.LifecycleException { setState(org.apache.catalina.LifecycleState.STOPPING);" />
</replace>
<mkdir dir="${logback-access.home}/logback-access-${logback.version}-tomcat-${tomcat.version}/ch/qos/logback/access/tomcat" />
<unjar src="${logback-access.jar}" dest="${logback-access.home}/logback-access-${logback.version}-tomcat-${tomcat.version}" />
<delete file="_lib/jar/catalina-6.0.20.jar" />
<javac srcdir="${logback-access.home}/logback-access-${logback.version}-sources/ch/qos/logback/access/tomcat" destdir="${logback-access.home}/logback-access-${logback.version}-tomcat-${tomcat.version}"
source="1.5" target="1.5" nowarn="true" encoding="UTF-8" debug="on" includeAntRuntime="false">
<classpath>
<fileset dir="${dist.path}">
<include name="*.jar" />
</fileset>
<fileset dir="_lib/jar">
<include name="*.jar" />
</fileset>
<fileset dir="_external">
<include name="*.jar" />
</fileset>
</classpath>
</javac>
<jar destfile="${dist.path}/logback-access-${logback.version}-tomcat-${tomcat.version}.jar">
<fileset dir="${logback-access.home}/logback-access-${logback.version}-tomcat-${tomcat.version}" />
</jar>
</target>
<target name="clean">
<delete dir="_dist" />
<delete dir="_lib" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="_external">
<exclude name="tomcat-juli.jar" />
</fileset>
</delete>
</target>
<target name="downloadfile" unless="exist" depends="testexist">
<mkdir dir="${destdir}" />
<get src="${sourcefile}" dest="${destfile}" />
</target>
<target name="testexist">
<echo message="Testing for ${destfile}" />
<available file="${destfile}" property="exist" />
</target>
<target name="original-tomcat-juli">
<!-- tomcat-juli -->
<antcall target="downloadfile">
<param name="sourcefile" value="${tomcat-juli.location}" />
<param name="destfile" value="tomcat-juli.jar" />
<param name="destdir" value="${tomcat-juli.home}" />
</antcall>
<echo message="Testing for tomcat-juli.jar" />
<condition property="tomcat-juli-present">
<or>
<available file="_external/tomcat-juli.jar" />
</or>
</condition>
<condition property="tomcat-below-version7">
<matches pattern="^[^789].*$" string="${tomcat.version}" />
</condition>
<echo>Tomcat version below 7.0.0: ${tomcat-below-version7}</echo>
<fail unless="tomcat-juli-present" message="Please put a proper version of tomcat-juli.jar into _externals directory. It is required for generating patched version of logback-access." />
</target>
</project>