-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathbuild.xml
More file actions
102 lines (88 loc) · 3.39 KB
/
build.xml
File metadata and controls
102 lines (88 loc) · 3.39 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
<project name="sample_java_mongo" default="dist" basedir=".">
<description>
Shippable sample Java project with MongoDB using Ant
</description>
<property file="build.properties" />
<path id="cobertura.classpath">
<fileset dir="${cobertura.dir}">
<include name="cobertura-2.0.3.jar" />
<include name="lib/**/*.jar" />
</fileset>
</path>
<path id="lib.classpath">
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
<target name="init">
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build.dir}" />
<mkdir dir="${instrumented.dir}" />
<mkdir dir="${reports.xml.dir}" />
<mkdir dir="${coverage.xml.dir}" />
</target>
<target name="compile" depends="init">
<javac srcdir="${src.dir}" destdir="${build.dir}" debug="yes">
<classpath refid="cobertura.classpath"/>
<classpath refid="lib.classpath"/>
</javac>
</target>
<target name="instrument" depends="init,compile">
<!--Remove the old coverage data and instrumentation.-->
<delete file="cobertura.ser"/>
<delete dir="${instrumented.dir}" />
<!--Instrument the application classes, writing the
instrumented classes into ${build.instrumented.dir}.-->
<cobertura-instrument todir="${instrumented.dir}">
<!--Ignore any source line containing a reference to log4j, for the
purposes of coverage reporting.-->
<ignore regex="org.apache.log4j.*" />
<auxClasspath>
<path refid="lib.classpath" />
</auxClasspath>
<fileset dir="${build.dir}">
<!--Instrument all the application classes, but
not the test classes.-->
<include name="**/*.class" />
<exclude name="**/*Test.class" />
</fileset>
</cobertura-instrument>
</target>
<target name="test" depends="init,compile">
<junit haltonfailure="no" showoutput="true" fork="true">
<!--
Note the classpath order: instrumented classes are before the
original (uninstrumented) classes. This is important.
-->
<classpath location="${instrumented.dir}" />
<classpath location="${build.dir}" />
<!--
The instrumented classes reference classes used by the
Cobertura runtime, so Cobertura and its dependencies
must be on your classpath.
-->
<classpath refid="cobertura.classpath" />
<classpath refid="lib.classpath" />
<test name="test.AppTest" todir="${reports.xml.dir}" />
<formatter type="plain" usefile="false"/>
<formatter type="xml"/>
</junit>
</target>
<target name="coverage-check">
<cobertura-check branchrate="49" totallinerate="75" />
</target>
<target name="coverage-report">
<!--Generate an XML file containing the coverage data using the "srcdir" attribute.-->
<cobertura-report srcdir="${src.dir}" destdir="${coverage.xml.dir}" format="xml" />
</target>
<target name="clean" description="Remove all files created by the build/test process.">
<delete dir="${build.dir}" />
<delete dir="${instrumented.dir}" />
<delete dir="${reports.dir}" />
<delete file="cobertura.log" />
<delete file="cobertura.ser" />
</target>
<target name="coverage" depends="compile,instrument,test,coverage-report" description="Compile, instrument the classes, run the tests and generate JUnit and coverage reports."/>
</project>