-
Notifications
You must be signed in to change notification settings - Fork 43
/
build.xml
78 lines (65 loc) · 2.58 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
<project default="all" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:jacoco="antlib:org.jacoco.ant">
<property name="target.report.dir" value="build/test-reports"/>
<!-- Install Ivy in ant lib. Is is far better tha to keep jars in repository -->
<ivy:retrieve file="./ivy.xml" sync="true" />
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="lib/org.jacoco.ant-0.7.2.201409121644.jar"/>
</taskdef>
<path id="test.lib.path">
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
</path>
<property name="test.lib" refid="test.lib.path"/>
<target name="clean">
<delete dir="build"/>
</target>
<target name="compile">
<mkdir dir="build/classes"/>
<javac srcdir="src/main" destdir="build/classes"/>
</target>
<target name="test-compile" depends="compile">
<mkdir dir="build/test-classes"/>
<javac srcdir="src/test" destdir="build/test-classes">
<classpath>
<path location="build/classes"/>
<pathelement path="${test.lib}"/>
</classpath>
</javac>
</target>
<target name="unit-tests" depends="test-compile">
<jacoco:coverage>
<java classname="org.junit.platform.console.ConsoleLauncher" classpath="build/classes:build/test-classes:${test.lib}:${test.lib}" fork="true">
<arg value="-scan-classpath"/>
<arg value="-n"/>
<arg value="^.*Spec?$"/>
<arg value="--reports-dir"/>
<arg value="${target.report.dir}"/>
</java>
</jacoco:coverage>
</target>
<target name="report" depends="unit-tests">
<mkdir dir="${target.report.dir}/html"/>
<junitreport todir="${target.report.dir}">
<fileset dir="${target.report.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report todir="${target.report.dir}/html"/>
</junitreport>
<jacoco:report>
<executiondata>
<file file="jacoco.exec"/>
</executiondata>
<structure name="BooksToRead.com">
<classfiles>
<fileset dir="build/classes"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="src/main"/>
</sourcefiles>
</structure>
<html destdir="${target.report.dir}/coverage"/>
</jacoco:report>
</target>
<target name="all" depends="clean, unit-tests, report"></target>
</project>