-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjcoverage.xml
executable file
·144 lines (124 loc) · 4.41 KB
/
jcoverage.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
<!--
This ant build file performs coverage testing using JCoverage
and the tests in test.xml.
Usage:
ant -Djcoverage.home=.../jcoverage-1.0.5 -f jcoverage.xml
JCoverage may be obtained from http://www.jcoverage.com.
-->
<project name="dynamator" default="all">
<!-- user-defined configuration -->
<property name="configuration.file" value="build.properties"/>
<property file="${user.home}/dynamator.build.properties" />
<property file="${user.home}/build.properties" />
<property file="${basedir}/${configuration.file}" />
<!-- destination directories -->
<property name="dir.build" location="${basedir}/build"/>
<property name="dir.classes" location="${dir.build}/classes"/>
<property name="dir.coverage-report"
location="${dir.build}/coverage-report"/>
<property name="dir.coverage-src"
location="${dir.build}/coverage/src"/>
<property name="dir.coverage-classes"
location="${dir.build}/coverage/classes"/>
<property name="dir.coverage-instrumented"
location="${dir.build}/coverage/coverage-classes"/>
<property name="jcoverage.home" value=""/>
<path id="classpath.jcoverage">
<fileset dir="${jcoverage.home}">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="classpath.ant">
<fileset dir="${ant.home}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="classpath.override">
<pathelement location="${dir.coverage-instrumented}"/>
<path refid="classpath.jcoverage"/>
</path>
<path id="classpath.project">
<path refid="classpath.override"/>
<fileset dir="${basedir}">
<include name="lib/**/*.jar"/>
</fileset>
<pathelement path="${java.class.path}"/>
</path>
<taskdef classpathref="classpath.jcoverage"
resource="tasks.properties"/>
<target name="check-preconditions">
<available property="preconditions.satisfied"
classname="com.jcoverage.ant.InstrumentTask"
classpathref="classpath.jcoverage"/>
</target>
<target name="preconditions"
depends="check-preconditions"
unless="preconditions.satisfied">
<fail>
JCoverage not found in classpath.
Property 'jcoverage.home' = '${jcoverage.home}'.</fail>
</target>
<!-- Merge all the source directory trees so JCoverage can find them. -->
<target name="merge-src"
depends="preconditions">
<mkdir dir="${dir.coverage-src}"/>
<copy todir="${dir.coverage-src}">
<fileset dir="src">
<include name="**/*.java"/>
</fileset>
<fileset dir="languages">
<include name="**/*.java"/>
<exclude name="**/test/**"/>
</fileset>
<fileset dir="tools">
<include name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="compile"
depends="merge-src">
<mkdir dir="${dir.coverage-classes}"/>
<javac
srcdir="${dir.coverage-src}"
destdir="${dir.coverage-classes}"
debug="true"
>
<classpath refid="classpath.project"/>
</javac>
</target>
<target name="instrument"
depends="compile">
<delete file="jcoverage.ser"/>
<delete dir="${dir.coverage-instrumented}"/>
<instrument todir="${dir.coverage-instrumented}">
<fileset dir="${dir.coverage-classes}">
<include name="**/*.class"/>
</fileset>
</instrument>
</target>
<target name="coverage"
depends="instrument">
<!-- For some reason the Dynamate task can't find Tidy unless
the whole classpath is provided in the override -->
<property name="classpath.override" refid="classpath.project"/>
<property name="classpath.ant" refid="classpath.ant"/>
<java classname="org.apache.tools.ant.Main"
fork="true"
classpath="${classpath.override};${classpath.ant}"
>
<jvmarg value="-Xms64m"/>
<jvmarg value="-Xmx128M"/>
<arg value="-Dtrace=${dir.build}/trace.out"/>
<arg value="-Dclasspath.override=${classpath.project}"/>
<arg value="-f"/>
<arg value="test.xml"/>
</java>
</target>
<target name="report">
<report srcdir="${dir.coverage-src}" destdir="${dir.coverage-report}"/>
<echo message="Coverage report is at ${dir.coverage-report}/index.html"/>
</target>
<target name="all"
depends="coverage, report"
/>
</project>