File: build-coverage.xml

package info (click to toggle)
libjackson-json-java 1.5.3%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 5,392 kB
  • ctags: 7,846
  • sloc: java: 46,768; xml: 938; makefile: 21
file content (88 lines) | stat: -rw-r--r-- 3,722 bytes parent folder | download
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
<?xml version="1.0" standalone='yes'?>

<!-- This Ant build file fragment contains targets needed to run
     code coverage analysis
  -->
<project name="Code coverage tasks for Jackson" basedir=".">

    <!-- Support for Cobertura code coverage tool -->
    <property name="cobertura.coverage.dir" value="${dir.build}/coverage" />
    <path id="cobertura.lib">
      <fileset dir="${dir.lib}/cobertura" includes="*.jar" />
    </path>
    <taskdef classpathref="cobertura.lib" resource="tasks.properties" />

  <!-- Code coverage using Cobertura: -->

  <target name="build.coverage" depends="test.compile">
      <!-- First, need to instrument classes -->
      <property name="cobertura.instr.dir" value="${dir.build}/cobertura-instr" />
      <cobertura-instrument todir="${cobertura.instr.dir}">
        <fileset dir="${dir.build.classes.core}">
          <include name="org/codehaus/jackson/**/*.class"/>
        </fileset>
        <fileset dir="${dir.build.classes.mapper}">
          <include name="org/codehaus/jackson/map/**/*.class"/>
          <include name="org/codehaus/jackson/node/**/*.class"/>
          <include name="org/codehaus/jackson/schema/**/*.class"/>
        </fileset>
      </cobertura-instrument>

      <junit fork="once" printsummary="yes" haltonfailure="no" showoutput="yes"
        maxmemory="300M"
      >
        <sysproperty key="net.sourceforge.cobertura.datafile" file="${basedir}/cobertura.ser" />
            <batchtest fork="no" todir="${dir.test.xmlresults}">
                <fileset dir="${dir.test.classes}">
                    <!-- Need to exclude inner classes... -->
                    <exclude name="**/*$*.class"/>
                    <!-- and one particularly slow test? -->
                    <exclude name="**/TestStringGeneration.class"/>
                    <include name="**/Test*.class"/>
                </fileset>
            </batchtest>
            <formatter type="xml" />
            <!-- Order is important: must first have instrumented classes -->
            <classpath location="${cobertura.instr.dir}" />

            <!-- Actual tests: -->
            <classpath path="${dir.test.classes}" />
            <!-- Cobertura support: -->
            <classpath refid="cobertura.lib" />
            <classpath>
                <!-- Note: while this may seem superfluous, it is actually
                     needed because Cobertura does not instrument things
                     like interfaces. So some of the class files are
                     needed from non-instrumented location
                  -->
                <pathelement path="${dir.build.classes.core}" />
                <pathelement path="${dir.build.classes.mapper}" />
                <pathelement path="${dir.build.classes.xc}" />
                <path refid="test-libs"/>
            </classpath>     
        </junit>
        <!-- and then reporting -->
        <cobertura-report format="html" destdir="${cobertura.coverage.dir}" >
          <fileset dir="${dir.src.java.core}">
            <include name="org/codehaus/**/*.java" />
          </fileset>
          <fileset dir="${dir.src.java.mapper}">
            <include name="org/codehaus/**/*.java" />
          </fileset>
          <fileset dir="${dir.src.java.xc}">
            <include name="org/codehaus/**/*.java" />
          </fileset>
        </cobertura-report>

        <!-- Let's also report junit results? (at least if they fail) -->
<!--
        <junitreport todir="${dir.test.results}">
            <fileset dir="${dir.test.xmlresults}">
                <include name="TEST-*.xml" />
            </fileset>
            <report todir="${dir.test.results}" />
        </junitreport>
-->
    </target>

</project>