source: core/java/build.xml @ 24268c51

Last change on this file since 24268c51 was 24268c51, checked in by str4d <str4d@…>, 9 years ago

Exclude classes from code coverage report that aren't in net.i2p.*

The classes are specifically excluded rather than only including net.i2p.*
so that only classes we know we want to exclude get excluded.

  • Property mode set to 100644
File size: 7.5 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project basedir="." default="all" name="i2p_sdk">
3    <target name="all" depends="clean, build" />
4    <target name="build" depends="builddep, jar" />
5    <target name="builddep">
6        <!-- noop, since the core doesnt depend on anything -->
7    </target>
8    <condition property="depend.available">
9        <typefound name="depend" />
10    </condition>
11    <target name="depend" if="depend.available">
12        <depend
13            cache="../../build"
14            srcdir="./src" 
15            destdir="./build/obj" >
16        </depend>
17    </target>
18    <!-- only used if not set by a higher build.xml -->
19    <property name="javac.compilerargs" value="" />
20    <property name="javac.classpath" value="" />
21    <target name="compile" depends="depend">
22        <mkdir dir="./build" />
23        <mkdir dir="./build/obj" />
24        <javac srcdir="./src" debug="true" source="1.5" target="1.5" deprecation="on"
25               includeAntRuntime="false"
26               destdir="./build/obj" classpath="${javac.classpath}" >
27            <compilerarg line="${javac.compilerargs}" />
28        </javac>
29    </target>
30
31    <target name="listChangedFiles" if="mtn.available" >
32        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
33            <arg value="list" />
34            <arg value="changed" />
35            <arg value="." />
36        </exec>
37        <!-- \n in an attribute value generates an invalid manifest -->
38        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
39            <arg value="-s" />
40            <arg value="[:space:]" />
41            <arg value="," />
42        </exec>
43    </target>
44
45    <target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
46        <!-- set if unset -->
47        <property name="workspace.changes.tr" value="" />
48        <jar destfile="./build/i2p.jar" basedir="./build/obj" includes="**/*.class" >
49            <manifest>
50                <attribute name="Implementation-Version" value="${full.version}" />
51                <attribute name="Build-Date" value="${build.timestamp}" />
52                <attribute name="Base-Revision" value="${workspace.version}" />
53                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
54            </manifest>
55        </jar>
56    </target>
57
58    <target name="jarUpToDate" >
59        <uptodate property="jar.uptodate" targetfile="build/i2p.jar" >
60            <srcfiles dir= "build/obj" includes="**/*.class" />
61        </uptodate>
62    </target>
63
64    <target name="javadoc">
65        <mkdir dir="./build" />
66        <mkdir dir="./build/javadoc" />
67        <javadoc sourcepath="./src:./test" destdir="./build/javadoc" packagenames="*" use="true" splitindex="true" windowtitle="I2P SDK" />
68    </target>
69
70    <!-- unit tests -->
71    <target name="compileTest">
72        <mkdir dir="./build" />
73        <mkdir dir="./build/obj" />
74        <!-- junit classes are in ant runtime -->
75        <javac srcdir="./src:./test" debug="true" source="1.5" target="1.5" deprecation="on"
76               includeAntRuntime="true"
77               destdir="./build/obj" >
78            <compilerarg line="${javac.compilerargs}" />
79        </javac>
80    </target>
81    <target name="jarTest" depends="compileTest">
82        <jar destfile="./build/i2ptest.jar" basedir="./build/obj" includes="**/*.class" />
83    </target>
84    <!-- preparation of code coverage tool of choice -->
85    <target name="prepareClover" depends="compileTest" if="with.clover">
86        <taskdef resource="clovertasks"/>
87        <mkdir dir="../../reports/core/clover" />
88        <clover-setup initString="../../reports/core/clover/coverage.db"/>
89    </target>
90    <target name="prepareCobertura" depends="compileTest" if="with.cobertura">
91        <taskdef classpath="${with.cobertura}" resource="tasks.properties" onerror="report" />
92        <mkdir dir="./build/obj_cobertura" />
93        <delete file="./cobertura.ser" />
94        <cobertura-instrument todir="./build/obj_cobertura">
95            <fileset dir="./build/obj">
96                <include name="**/*.class"/>
97                <exclude name="**/*Test.class" />
98                <exclude name="**/AllCoreTests.class" />
99                <exclude name="com/nettgryppa/**/*.class" />
100                <exclude name="freenet/**/*.class" />
101                <exclude name="gnu/**/*.class" />
102                <exclude name="net/metanotion/**/*.class" />
103                <exclude name="org/bouncycastle/**/*.class" />
104                <exclude name="org/xlattice/**/*.class" />
105            </fileset>
106        </cobertura-instrument>
107    </target>
108    <target name="prepareTest" depends="prepareClover, prepareCobertura" />
109    <!-- end preparation of code coverage tool -->
110    <target name="test" depends="clean, compileTest, prepareTest">
111        <mkdir dir="../../reports/core/junit/" />
112        <delete>
113            <fileset dir="../../reports/core/junit">
114                <include name="TEST-*.xml"/>
115            </fileset>
116        </delete>
117        <junit printsummary="on" fork="yes" maxmemory="384m">
118            <sysproperty key="net.sourceforge.cobertura.datafile" file="./cobertura.ser" />
119            <classpath>
120                <pathelement path="${classpath}" />
121                <pathelement location="./build/obj_cobertura" />
122                <pathelement location="./build/obj" />
123                <pathelement location="../../build/jbigi.jar" />
124                <pathelement location="${with.clover}" />
125                <pathelement location="${with.cobertura}" />
126            </classpath>
127            <batchtest todir="../../reports/core/junit/">
128                <fileset dir="./test/">
129                    <include name="**/*Test.java" />
130                    <exclude name="**/ElGamalAESEngineTest.java" />
131                    <exclude name="**/StructureTest.java" />
132                </fileset>
133            </batchtest>
134            <formatter type="xml"/>
135        </junit>
136    </target>
137    <!-- test reports -->
138    <target name="junit.report">
139        <junitreport todir="../../reports/core/junit">
140            <fileset dir="../../reports/core/junit">
141                <include name="TEST-*.xml"/>
142            </fileset>
143            <report format="frames" todir="../../reports/core/html/junit"/>
144        </junitreport>
145    </target>
146    <target name="clover.report" depends="test" if="with.clover">
147        <clover-report>
148            <current outfile="../../reports/core/html/clover">
149                <format type="html"/>
150            </current>
151        </clover-report>
152    </target>
153    <target name="cobertura.report" depends="test" if="with.cobertura">
154        <mkdir dir="../../reports/core/cobertura" />
155        <cobertura-report format="xml" srcdir="./src" destdir="../../reports/core/cobertura" />
156        <mkdir dir="../../reports/core/html/cobertura" />
157        <cobertura-report format="html" srcdir="./src" destdir="../../reports/core/html/cobertura" />
158        <delete file="./cobertura.ser" />
159    </target>
160    <target name="test.report" depends="junit.report, clover.report, cobertura.report"/>
161    <!-- end test reports -->
162    <target name="fulltest" depends="test, test.report" />
163    <!-- end unit tests -->
164
165    <target name="clean">
166        <delete dir="./build" />
167    </target>
168    <target name="cleandep" depends="clean">
169        <!-- noop, since the core doesn't depend on anything -->
170    </target>
171    <target name="distclean" depends="clean">
172        <!-- noop, since the core doesn't depend on anything -->
173    </target>
174</project>
Note: See TracBrowser for help on using the repository browser.