-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
221 lines (198 loc) · 7.66 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
<?xml version="1.0"?>
<project name="cope util" default="build" basedir="."
xmlns:if="ant:if"
xmlns:unless="ant:unless"
xmlns:jacoco="antlib:org.jacoco.ant">
<target name="checkAntIfUnless">
<property name="antSupportsGenericIfUnless" value="true"/>
<fail message="ant 1.9.1 required: https://ant.apache.org/manual/ifunless.html" unless:set="antSupportsGenericIfUnless"/>
</target>
<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>
<target name="compile">
<compile srcdir="src">
<classpath>
<fileset dir="lib/runtime" />
<pathelement location="lib/jsr305/jsr305.jar" />
</classpath>
</compile>
</target>
<target name="servlet.compile" depends="compile">
<compile srcdir="servletsrc">
<classpath>
<pathelement location="build/classes/src" />
<fileset dir="lib/servlet" />
<pathelement location="lib/jsr305/jsr305.jar" />
</classpath>
</compile>
</target>
<target name="test.compile" depends="compile,servlet.compile">
<compile srcdir="testsrc">
<classpath>
<pathelement location="build/classes/src" />
<pathelement location="build/classes/servletsrc" />
<fileset dir="lib/test" />
</classpath>
</compile>
</target>
<target name="test.run" depends="test.compile, checkAntIfUnless">
<runtest name="moscow" userTimezone="Europe/Moscow" />
<runtest name="berlin" userTimezone="Europe/Berlin" />
<runtest name="canada" userTimezone="Canada/Mountain" />
<runtest name="pacific" userTimezone="Pacific/Kiritimati" />
</target>
<macrodef name="runtest">
<attribute name="name" />
<attribute name="userTimezone" />
<sequential>
<echo message="@{userTimezone} (@{name})" />
<mkdir dir="build/testresults" />
<mkdir dir="build/testtmpdir" />
<java taskname="junit" fork="yes" dir="${basedir}"
failonerror="true"
classname="org.junit.platform.console.ConsoleLauncher">
<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,address=8000" if:set="test.debug"/>
<arg line="--details ${test-details}" />
<arg line="--disable-ansi-colors" if:set="disable-ansi-colors" />
<classpath>
<pathelement location="build/classes/src" />
<pathelement location="build/classes/servletsrc" />
<pathelement location="build/classes/testsrc" />
<fileset dir="lib/test" />
</classpath>
<arg line="--fail-if-no-tests" />
<arg line="--scan-class-path build/classes/testsrc" unless:set="test" />
<arg line="--exclude-tag nondeterministic" unless:set="test" if:set="test.deterministicOnly" />
<arg line="--select-class ${test}" if:set="test" unless:set="method" />
<arg line="--select-method ${test}#${method}" if:set="method" />
<arg line="--reports-dir build/testresults/@{name}" />
<sysproperty key="java.io.tmpdir" value="${basedir}/build/testtmpdir" />
<sysproperty key="user.timezone" value="@{userTimezone}" />
<assertions><enable/></assertions>
<!--jvmarg value="-Xcomp" /--><!-- for performance tests -->
</java>
</sequential>
</macrodef>
<target name="test" depends="test.run" />
<target name="jar" depends="compile,servlet.compile">
<jar jarfile="build/${artifacts.name}.jar" basedir="build/classes/src" filesonly="true" duplicate="fail" strict="fail" level="9">
<fileset dir="build/classes/servletsrc"/>
<manifest>
<attribute name="Specification-Title" value="${artifacts.title}"/>
<attribute name="Specification-Version" value="${build.tag}"/>
<attribute name="Specification-Vendor" value="exedio GmbH"/>
<attribute name="Implementation-Title" value="${artifacts.title}"/>
<attribute name="Implementation-Version" value="${build.tag}"/>
<attribute name="Implementation-Vendor" value="exedio GmbH"/>
</manifest>
</jar>
<plot file="build/${artifacts.name}.jar" />
</target>
<target name="jar.src">
<mkdir dir="build" />
<zip destfile="build/${artifacts.name}-src.zip" filesonly="true" whenempty="fail" duplicate="fail" level="9">
<zipfileset dir="${basedir}/src">
<include name="**/*.java" />
</zipfileset>
<zipfileset dir="${basedir}/servletsrc">
<include name="**/*.java" />
</zipfileset>
</zip>
<plot file="build/${artifacts.name}-src.zip" />
</target>
<target name="clean">
<delete dir="build" />
<delete dir="api" /><!-- not created anymore-->
</target>
<target name="api">
<api title="${artifacts.title}">
<src>
<fileset file="src/com" includes="**/*.java" />
</src>
<myClasspath>
<fileset dir="lib/runtime" />
<pathelement location="lib/jsr305/jsr305.jar" />
</myClasspath>
</api>
</target>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" onerror="failall">
<classpath>
<fileset dir="lib/jacoco" />
</classpath>
</taskdef>
<target name="jacoco" depends="test.compile, checkAntIfUnless" unless="skip.jacoco">
<mkdir dir="build/jacocotestresults" />
<mkdir dir="build/jacocotesttmpdir" />
<jacoco:coverage destfile="build/jacoco.exec">
<java taskname="jacoco" fork="yes" dir="${basedir}"
failonerror="true"
classname="org.junit.platform.console.ConsoleLauncher">
<arg line="--details ${test-details}" />
<arg line="--disable-ansi-colors" if:set="disable-ansi-colors" />
<classpath>
<pathelement location="build/classes/src" />
<pathelement location="build/classes/servletsrc" />
<pathelement location="build/classes/testsrc" />
<fileset dir="lib/test" />
</classpath>
<sysproperty key="java.io.tmpdir" value="${basedir}/build/jacocotesttmpdir" />
<arg line="--fail-if-no-tests" />
<arg line="--scan-class-path build/classes/testsrc" unless:set="test" />
<arg line="--exclude-tag nondeterministic" unless:set="test" if:set="test.deterministicOnly" />
<arg line="--select-class ${test}" if:set="test" unless:set="method" />
<arg line="--select-method ${test}#${method}" if:set="method" />
<arg line="--reports-dir build/jacocotestresults" />
<assertions><enable/></assertions>
</java>
</jacoco:coverage>
<jacoco:report>
<executiondata>
<file file="build/jacoco.exec" />
</executiondata>
<structure name="CopeUtil">
<classfiles>
<fileset dir="build/classes/src" />
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="src" />
</sourcefiles>
</structure>
<html destdir="build/html" />
<xml destfile="build/report.xml" />
</jacoco:report>
</target>
<target name="build" depends="compile, test, jar, api" />
<target name="all" depends="build, jar.src, jacoco" />
<target name="jenkins" depends="all">
<copy todir="${basedir}/build/success">
<fileset file="${basedir}/build/${artifacts.name}.jar" />
<fileset file="${basedir}/build/${artifacts.name}-src.zip" />
<fileset file="${basedir}/${artifacts.name}-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>
<target name="licenseheaders" description="Updates the license headers in the source files.">
<loadfile property="javaheader" srcFile="javaheader.txt"/>
<replaceregexp match="(/\*.*\*/.*)??^package " flags="sm" replace="${javaheader}${line.separator}package ">
<fileset dir=".">
<include name="**/*.java" />
</fileset>
</replaceregexp>
</target>
</project>