-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
369 lines (341 loc) · 12 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
<?xml version="1.0"?>
<project name="cops" default="build" basedir=".">
<echo taskname="which ant" message="${ant.version}" />
<echo taskname="which java" message="${java.vm.name} ${java.version}" />
<!--suppress AntMissingPropertiesFileInspection -->
<property file="local.properties" />
<property file="project.properties" />
<import>
<fileset dir="macros">
<include name="*.xml" />
</fileset>
</import>
<taskdef classpath="lib/ant-contrib.jar" resource="net/sf/antcontrib/antcontrib.properties" />
<taskdef
resource="com/exedio/jspm/ant.properties"
classpath="lib/exedio-jspm.jar" />
<target name="runtime.jspm">
<jspm>
<fileset dir="src">
<include name="**/*.jspm" />
</fileset>
</jspm>
</target>
<target name="compile" depends="runtime.jspm">
<mkdir dir="build/classes" />
<javac srcdir="src"
destdir="build/classes"
includeAntRuntime="false"
deprecation="on"
debug="on"
optimize="off">
<classpath>
<pathelement location="lib/javax.servlet-api.jar" />
<pathelement location="lib/slf4j-api.jar" />
<pathelement location="lib/micrometer-core.jar" />
<pathelement location="lib/exedio-cope-util.jar" />
</classpath>
<compilerarg value="-Xlint" />
<compilerarg value="-encoding" />
<compilerarg value="ascii" />
</javac>
<copy todir="build/classes">
<fileset dir="src">
<include name="**/*.css" />
<include name="**/*.js" />
<include name="**/*.png" />
</fileset>
</copy>
</target>
<target name="test.compile" depends="compile">
<mkdir dir="build/testclasses" />
<javac srcdir="testsrc"
destdir="build/testclasses"
includeAntRuntime="false"
deprecation="on"
debug="on"
optimize="off">
<classpath>
<pathelement location="build/classes" />
<pathelement location="lib/javax.servlet-api.jar" />
<pathelement location="lib/junit.jar" />
</classpath>
<compilerarg value="-Xlint" />
<compilerarg value="-encoding" />
<compilerarg value="ascii" />
</javac>
<copy todir="build/testclasses">
<fileset dir="testsrc">
<include name="**/*.bin" />
</fileset>
</copy>
</target>
<target name="test.run" depends="test.compile">
<mkdir dir="build/testresults" />
<junit fork="yes"
haltonerror="true" haltonfailure="true"
showoutput="true" printsummary="true">
<formatter type="brief" usefile="false" />
<formatter type="xml" />
<classpath>
<pathelement location="build/classes" />
<pathelement location="build/testclasses" />
<pathelement location="lib/junit.jar" />
<pathelement location="lib/javax.servlet-api.jar" />
<pathelement location="lib/slf4j-api.jar" />
<pathelement location="lib/slf4j-log4j12.jar" />
<pathelement location="lib/log4j-bundle.jar" />
<pathelement location="lib/exedio-cope-util.jar" />
</classpath>
<test name="com.exedio.cops.PackageTest" todir="build/testresults" outfile="cops" />
<assertions><enable/></assertions>
</junit>
</target>
<target name="test" depends="test.run" />
<target name="jar" depends="compile">
<jar jarfile="build/exedio-cops.jar" basedir="build/classes" filesonly="true" duplicate="fail" strict="fail" level="9">
<manifest>
<attribute name="Specification-Title" value="exedio cops"/>
<attribute name="Specification-Version" value="${build.tag}"/>
<attribute name="Specification-Vendor" value="exedio GmbH"/>
<attribute name="Implementation-Title" value="exedio cops"/>
<attribute name="Implementation-Version" value="${build.tag}"/>
<attribute name="Implementation-Vendor" value="exedio GmbH"/>
</manifest>
</jar>
<plot file="build/exedio-cops.jar" />
</target>
<target name="jar.src">
<mkdir dir="build" />
<zip destfile="build/exedio-cops-src.zip" filesonly="true" whenempty="fail" duplicate="fail" level="9">
<zipfileset dir="${basedir}/src">
<include name="**/*.java" />
<exclude name="**/*_Jspm.java" />
</zipfileset>
</zip>
<plot file="build/exedio-cops-src.zip" />
</target>
<target name="example.jspm">
<jspm>
<fileset dir="example/src" includes="**/*.jspm" />
</jspm>
</target>
<target name="example.compile" depends="compile, example.jspm">
<mkdir dir="build/exampleclasses" />
<javac srcdir="example/src"
destdir="build/exampleclasses"
deprecation="on"
debug="on"
optimize="off">
<classpath>
<pathelement location="build/classes" />
<pathelement location="lib/javax.servlet-api.jar" />
<pathelement location="lib/micrometer-core.jar" />
<pathelement location="lib/micrometer-registry-prometheus.jar" />
<pathelement location="lib/simpleclient-bundle.jar" />
<pathelement location="lib/exedio-cope-util.jar" />
<pathelement location="lib/exedio-cope-servletutil.jar" />
</classpath>
<compilerarg value="-Xlint" />
<compilerarg value="-encoding" />
<compilerarg value="ascii" />
</javac>
<copy todir="build/exampleclasses">
<fileset dir="example/src">
<include name="**/*.png" />
<include name="**/*.txt" />
<include name="**/*.properties" />
</fileset>
</copy>
</target>
<target name="example.web" depends="compile, example.compile">
<copy todir="example/web/WEB-INF/lib">
<fileset dir="lib">
<include name="exedio-cope-util.jar" />
<include name="exedio-cope-servletutil.jar" />
<include name="slf4j-api.jar" />
<include name="slf4j-log4j12.jar" />
<include name="micrometer-core.jar" />
<include name="LatencyUtils.jar" />
<include name="micrometer-registry-prometheus.jar" />
<include name="simpleclient-bundle.jar" />
<include name="simpleclient_common-bundle.jar" />
<include name="simpleclient_servlet-bundle.jar" />
<include name="simpleclient_servlet_common-bundle.jar" />
<include name="log4j-bundle.jar" />
</fileset>
</copy>
<copy todir="example/web/WEB-INF/classes">
<fileset dir="build/classes" />
<fileset dir="build/exampleclasses" />
</copy>
<touch file="example/web/WEB-INF/web.xml" />
</target>
<target name="catalina">
<property name="catalina.root" value="apache-tomcat-9.0.43" />
<untar src="lib/tomcat.tar.gz"
compression="gzip"
dest="${basedir}">
<patternset>
<exclude name="${catalina.root}/conf/server.xml" />
<exclude name="${catalina.root}/conf/tomcat-users.xml" />
<exclude name="${catalina.root}/webapps/ROOT/**" />
<exclude name="${catalina.root}/webapps/docs/**" />
<exclude name="${catalina.root}/webapps/examples/**" />
</patternset>
<mapper type="glob" from="${catalina.root}/*" to="tomcat/*" />
</untar>
<chmod dir="tomcat/bin" perm="ugo+x" includes="*.sh" />
<copy todir="tomcat/conf">
<fileset dir="example/conf">
<include name="tomcat-users.xml" />
<include name="keystore" />
</fileset>
</copy>
<echo message="tomcat ports: shutdown=${tomcat.port.shutdown} http=${tomcat.port.http} https=${tomcat.port.https}" />
<copy file="example/conf/server.xml" todir="tomcat/conf" overwrite="true">
<filterset>
<filter token="PORT_SHUTDOWN" value="${tomcat.port.shutdown}" />
<filter token="PORT_HTTP" value="${tomcat.port.http}" />
<filter token="PORT_HTTPS" value="${tomcat.port.https}" />
</filterset>
</copy>
</target>
<target name="example.tomcat" depends="example.web, catalina">
<copy file="example/context.xml" tofile="tomcat/conf/Catalina/localhost/cops.xml" />
</target>
<target name="example" depends="example.tomcat" />
<target name="webtest.compile">
<mkdir dir="build/webtestclasses" />
<javac srcdir="webtestsrc"
destdir="build/webtestclasses"
includeAntRuntime="false"
deprecation="on"
debug="on"
optimize="off">
<classpath>
<pathelement location="lib/junit.jar" />
</classpath>
<compilerarg value="-Xlint" />
<compilerarg value="-encoding" />
<compilerarg value="ascii" />
</javac>
</target>
<target name="webtest" depends="example.tomcat, webtest.compile">
<trycatch>
<try>
<echo message="tomcat: starting ..." />
<condition property="catalina.executable" value="catalina.bat" else="catalina.sh">
<os family="windows" />
</condition>
<forget>
<exec dir="${basedir}/tomcat/bin"
executable="${basedir}/tomcat/bin/${catalina.executable}"
failonerror="true"
output="build/catalina-start.log">
<arg value="run" />
</exec>
</forget>
<echo message="tomcat: waiting to be ready ..." />
<waitfor
maxwait="40" maxwaitunit="second"
checkevery="5" checkeveryunit="second"
timeoutproperty="server.app.init.failed">
<http url="http://127.0.0.1:${tomcat.port.http}/cops" />
</waitfor>
<echo message="tomcat: ready ..." />
<fail if="server.app.init.failed" message="tomcat could not be started." />
<mkdir dir="build/testresults" />
<junit fork="yes"
haltonerror="true" haltonfailure="true"
showoutput="true" printsummary="true">
<formatter type="brief" usefile="false" />
<formatter type="xml" />
<classpath>
<pathelement location="build/webtestclasses" />
<pathelement location="lib/junit.jar" />
</classpath>
<test name="com.exedio.cops.webtest.PackageTest" todir="build/testresults" outfile="copsweb" />
<sysproperty key="tomcat.port.http" value="${tomcat.port.http}" />
<assertions><enable/></assertions>
</junit>
</try>
<finally>
<echo message="tomcat: stopping ..." />
<exec dir="${basedir}/tomcat/bin"
executable="${basedir}/tomcat/bin/${catalina.executable}"
failonerror="true"
output="build/catalina-stop.log">
<arg value="stop" />
</exec>
<echo message="tomcat: waiting to be stopped ..." />
<sleep seconds="10" />
<echo message="tomcat: stopped." />
</finally>
</trycatch>
</target>
<target name="clean">
<delete dir="build" />
<delete dir="tomcat" />
<delete dir="example/web/files" /><!-- no longer created -->
<delete dir="example/web/WEB-INF/lib" />
<delete dir="example/web/WEB-INF/classes" />
<delete>
<fileset dir="src">
<include name="**/*_Jspm.java" />
</fileset>
<fileset dir="example/src">
<include name="**/*_Jspm.java" />
</fileset>
</delete>
</target>
<target name="api">
<delete dir="api" />
<mkdir dir="api" />
<javadoc
sourcepath="src"
destdir="api"
maxmemory="60m"
author="on"
use="on"
version="on"
windowtitle="exedio cops"
splitindex="on"
failonerror="true"
>
<doctitle><![CDATA[Cops<br>API Specification]]></doctitle>
<header>exedio cops</header>
<footer>exedio cops</footer>
<bottom><![CDATA[<small>Copyright © 2004-2008 <a href="https://www.exedio.com/" target="_top">exedio</a> Gesellschaft für Softwareentwicklung mbH. All rights reserved.</small><br><font size="-3">${build.tag}</font>]]></bottom>
<package name="com.*" />
<arg value="-Xdoclint:all,-missing" />
<classpath>
<pathelement location="lib/javax.servlet-api.jar" />
<pathelement location="lib/exedio-cope-util.jar" />
<pathelement location="lib/slf4j-api.jar" />
<pathelement location="lib/micrometer-core.jar" />
</classpath>
</javadoc>
</target>
<target name="jspm" depends="runtime.jspm, example.jspm" />
<target name="src" depends="jspm" description="creates all sources, so the IDE does not complain" />
<target name="build" depends="compile, test, webtest, jar, example, api" />
<target name="all" depends="build, jar.src" />
<target name="tomcat" depends="example.tomcat" />
<target name="jenkins" depends="all">
<copy todir="${basedir}/build/success">
<fileset file="${basedir}/build/exedio-cops.jar" />
<fileset file="${basedir}/build/exedio-cops-src.zip" />
<fileset file="${basedir}/exedio-cops-log.txt" />
</copy>
<copy file="ivy/ivy.xml" todir="build/success" overwrite="true">
<filterset>
<filter token="BUILD_REVISION" value="${build.revision}" />
<filter token="BUILD_STATUS" value="${build.status}" />
</filterset>
</copy>
</target>
<target name="publishlocally" depends="jar, jar.src">
<ant dir="ivy" target="publishlocally" />
</target>
</project>