-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
206 lines (165 loc) · 7.64 KB
/
build.xml
File metadata and controls
206 lines (165 loc) · 7.64 KB
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
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="Trivial Ant Project" basedir="." default="main"
xmlns:jacoco="antlib:org.jacoco.ant"
xmlns:cover="antlib:com.diffblue.buildsystem.cover.ant">
<taskdef
uri="antlib:com.diffblue.buildsystem.cover.ant"
resource="com/diffblue/cover/buildsystem/ant/antlib.xml">
<classpath path="/path/to/cover-buildsystem-ant.jar"/>
</taskdef>
<antversion property="antversion"/>
<property name="ivy.install.version" value="2.4.0"/>
<property name="ivy.jar.dir" location="${basedir}/ivy"/>
<property name="ivy.jar.file" location="${ivy.jar.dir}/ivy.jar"/>
<property name="main-class" value="io.diffblue.HelloWorld"/>
<property name="java.source" value="11"/>
<property name="java.target" value="11"/>
<property name="file.encoding" value="UTF-8"/>
<property name="lib.dir" location="lib"/>
<property name="build.dir" location="out"/>
<property name="src.dir" location="src"/>
<property name="prod.src.dir" location="${src.dir}/main/java"/>
<property name="prod.classes.dir" location="${build.dir}/classes"/>
<property name="jar.dir" location="${build.dir}/jar"/>
<property name="test.src.dir" location="${src.dir}/test/java"/>
<property name="test.classes.dir" location="${build.dir}/test-classes"/>
<property name="test.report.dir" location="${build.dir}/reports"/>
<property name="junit.report.dir" location="${test.report.dir}/tests"/>
<property name="jacoco.report.dir" location="${test.report.dir}/coverage"/>
<property name="jacoco.exec.file" location="${build.dir}/jacoco.exec"/>
<property name="jacoco.report.xml" location="${test.report.dir}/coverage/report.xml"/>
<property name="pitest.report.dir" location="${test.report.dir}/mutation"/>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="ivy/org.jacoco.ant-0.8.8.jar"/>
</taskdef>
<path id="application" location="${jar.dir}/${ant.project.name}.jar"/>
<property name="test.includes" value="**/*Test.*"/>
<property name="test.excludes" value=""/>
<property name="test.includeTags" value=""/>
<property name="test.excludeTags" value=""/>
<tstamp>
<format property="timestamp" pattern="yyMMdd'T'HHmmss"/>
</tstamp>
<target name="resolve" description="retrieve dependencies">
<ivy:retrieve/>
<ivy:cachepath pathid="compile.path" conf="compile,provided"/>
<ivy:cachepath pathid="test.path" conf="test,provided"/>
<ivy:cachepath pathid="build.path" conf="build"/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="compile" depends="resolve">
<mkdir dir="${prod.classes.dir}"/>
<javac srcdir="${prod.src.dir}" destdir="${prod.classes.dir}"
debug="true" debuglevel="lines,vars,source" source="${java.source}" target="${java.target}"
encoding="${file.encoding}">
<classpath refid="compile.path"/>
</javac>
<copy todir="${prod.classes.dir}">
<fileset dir="${prod.src.dir}" excludes="**/*.java"/>
</copy>
</target>
<path id="test.classpath">
<path refid="test.path"/>
<pathelement location="${prod.classes.dir}"/>
<pathelement location="${test.classes.dir}"/>
</path>
<target name="mutate" depends="resolve,test-compile">
<path id="build.classpath">
<path refid="build.path"/>
</path>
<taskdef name="pitest" classname="org.pitest.ant.PitestTask">
<classpath refid="build.classpath"/>
</taskdef>
<pitest
pitClasspath="build.classpath"
classPath="test.classpath"
targetClasses="io.diffblue.*"
targetTests="io.diffblue.*"
reportDir="${pitest.report.dir}"
sourceDir="${prod.src.dir}"/>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${prod.classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java fork="true" classname="${main-class}">
<classpath>
<path refid="compile.path"/>
<path refid="application"/>
</classpath>
</java>
</target>
<target name="test-compile" depends="compile">
<mkdir dir="${test.classes.dir}"/>
<javac srcdir="${test.src.dir}" destdir="${test.classes.dir}"
debug="true" debuglevel="lines,vars,source" source="${java.source}" target="${java.target}"
encoding="${file.encoding}">
<classpath>
<path refid="test.path"/>
<pathelement path="${build.dir}/classes"/>
</classpath>
</javac>
<copy todir="${test.classes.dir}">
<fileset dir="${prod.src.dir}" excludes="**/*.java"/>
</copy>
</target>
<target name="test" depends="test-compile">
<jacoco:agent property="jacocoagent" destfile="${jacoco.exec.file}"/>
<junitlauncher includeTags="${test.includeTags}" excludeTags="${test.excludeTags}" printsummary="true" haltonfailure="true">
<classpath refid="test.classpath"/>
<testclasses>
<fileset dir="${test.classes.dir}" includes="${test.includes}" excludes="${test.excludes}"/>
<fork>
<jvmarg value="${jacocoagent}"/>
</fork>
</testclasses>
</junitlauncher>
<mkdir dir="${jacoco.report.dir}"/>
<jacoco:report>
<executiondata>
<file file="${jacoco.exec.file}"/>
</executiondata>
<structure name="${ant.project.name} JaCoCo Coverage Report">
<classfiles>
<fileset dir="${prod.classes.dir}"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${prod.src.dir}"/>
</sourcefiles>
</structure>
<xml destfile="${jacoco.report.xml}"/>
<html destdir="${jacoco.report.dir}"/>
</jacoco:report>
</target>
<target name="clean-build" depends="clean,jar"/>
<target name="main" depends="clean,run"/>
<target name="info" depends="compile">
<cover:projectModule>
<cover:moduleName>${ant.project.name}</cover:moduleName>
<cover:version>${antversion}</cover:version>
<cover:location location="${basedir}"/>
<cover:classpath>
<path refid="test.classpath"/>
</cover:classpath>
<cover:productionClasses location="${prod.classes.dir}"/>
<cover:productionSources location="${prod.src.dir}"/>
<cover:testClasses location="${test.classes.dir}"/>
<cover:testSources location="${test.src.dir}"/>
<cover:complianceLevel>${java.target}</cover:complianceLevel>
<cover:encoding>${file.encoding}</cover:encoding>
<cover:junitReport location="${junit.report.dir}"/>
<cover:buildDirectory location="${build.dir}"/>
<cover:jacocoReport location="${jacoco.report.xml}"/>
<cover:jacocoDestFile location="${jacoco.exec.file}"/>
<cover:jacocoFormats>xml</cover:jacocoFormats>
<!-- optional, only needed if you have submodules -->
<cover:submodules/>
</cover:projectModule>
</target>
</project>