27
|
1 <?xml version="1.0" encoding="UTF-8"?>
|
|
2 <project name="jacoco-project-tasks" default="" basedir="."
|
|
3 xmlns:ivy="antlib:fr.jayasoft.ivy.ant"
|
|
4 xmlns:ssdt="http://www.ssdt-ohio.org/ant/common"
|
|
5 xmlns:jacoco="antlib:org.jacoco.ant">
|
|
6
|
|
7 <description>jacoco Ant tasks</description>
|
|
8
|
|
9 <property name="jacoco.report.dir" value="build/jacoco"/>
|
|
10 <property name="jacoco.data.file" value="build/jacoco/jacoco.exec"/>
|
|
11
|
|
12 <target name="-check.jacoco" depends="project.init,ivy-info">
|
|
13 <property name="jacoco.ant.jar.file"
|
|
14 value="${user.home.ant.lib}/jacoco-ant.jar"/>
|
|
15 <property name="jacoco.agent.jar.file"
|
|
16 value="${ssdt.devel.kit}/jacoco-agent.jar"/>
|
|
17 <property name="ssdt.jacoco.ant.jar.src"
|
|
18 value="http://ivy.ssdt.nwoca.org/repository/jacoco/jacocoant.jar"/>
|
|
19 <property name="ssdt.jacoco.agent.jar.src"
|
|
20 value="http://ivy.ssdt.nwoca.org/repository/jacoco/jacocoagent.jar"/>
|
|
21 <ssdt:fetch dest="${jacoco.ant.jar.file}"
|
|
22 src="${ssdt.jacoco.ant.jar.src}"/>
|
|
23 <ssdt:fetch dest="${jacoco.agent.jar.file}"
|
|
24 src="${ssdt.jacoco.agent.jar.src}"/>
|
|
25 <property name="jacoco.installed" value="true"/>
|
|
26 <property name="jacoco.dir" value="${build.dir}/jacoco"/>
|
|
27
|
|
28 </target>
|
|
29
|
|
30 <target name="with.coverage" depends="-check.jacoco" if="jacoco.installed">
|
|
31 <property name="coverage.run.with.jacoco" value="true"/>
|
|
32 <mkdir dir="${jacoco.dir}"/>
|
|
33 <copy file="${jacoco.agent.jar.file}" tofile="${jacoco.dir}/jacocoagent.jar"/>
|
|
34 <property name="_jacoco.agentFile" value="${jacoco.dir}/jacocoagent.jar"/>
|
|
35 <taskdef uri="antlib:org.jacoco.ant"
|
|
36 classpath="${jacoco.ant.jar.file}"
|
|
37 resource="org/jacoco/ant/antlib.xml"/>
|
|
38 <jacoco:agent property="jacoco.coverage.agent"
|
|
39 destfile="${jacoco.data.file}"/>
|
|
40 </target>
|
|
41
|
|
42 <target name="coverage.xml"
|
|
43 description="Generates an XML converage report."
|
|
44 depends="-check.jacoco,project.init"
|
|
45 if="jacoco.installed">
|
|
46 <mkdir dir="${jacoco.report.dir}"/>
|
|
47 <jacoco:report>
|
|
48 <executiondata>
|
|
49 <file file="${jacoco.data.file}"/>
|
|
50 </executiondata>
|
|
51 <structure name="${ivy.project.module}">
|
|
52 <classfiles>
|
|
53 <fileset dir="${build.classes.dir}"/>
|
|
54 </classfiles>
|
|
55 <sourcefiles encoding="UTF-8">
|
|
56 <fileset dir="${src.dir}"/>
|
|
57 </sourcefiles>
|
|
58 </structure>
|
|
59 <xml destfile="${jacoco.report.dir}/jacoco.xml"/>
|
|
60 </jacoco:report>
|
|
61
|
|
62 </target>
|
|
63
|
|
64 <target name="coverage.html"
|
|
65 description="Generates an HTML converage report."
|
|
66 depends="-check.jacoco"
|
|
67 if="jacoco.installed">
|
|
68 <mkdir dir="${jacoco.report.dir}"/>
|
|
69 <jacoco:report>
|
|
70 <executiondata>
|
|
71 <file file="${jacoco.data.file}"/>
|
|
72 </executiondata>
|
|
73 <structure name="${ivy.project.module}">
|
|
74 <classfiles>
|
|
75 <fileset dir="${build.classes.dir}"/>
|
|
76 </classfiles>
|
|
77 <sourcefiles encoding="UTF-8">
|
|
78 <fileset dir="${src.dir}"/>
|
|
79 </sourcefiles>
|
|
80 </structure>
|
|
81 <html destdir="${jacoco.report.dir}"/>
|
|
82 </jacoco:report>
|
|
83 </target>
|
|
84
|
|
85 </project>
|