source: core/java/build.xml @ 204440b

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

Run full test reports with fulltest target, not just junit report

  • Property mode set to 100644
File size: 7.1 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            </fileset>
99        </cobertura-instrument>
100    </target>
101    <target name="prepareTest" depends="prepareClover, prepareCobertura" />
102    <!-- end preparation of code coverage tool -->
103    <target name="test" depends="clean, compileTest, prepareTest">
104        <mkdir dir="../../reports/core/junit/" />
105        <delete>
106            <fileset dir="../../reports/core/junit">
107                <include name="TEST-*.xml"/>
108            </fileset>
109        </delete>
110        <junit printsummary="on" fork="yes" maxmemory="384m">
111            <sysproperty key="net.sourceforge.cobertura.datafile" file="./cobertura.ser" />
112            <classpath>
113                <pathelement path="${classpath}" />
114                <pathelement location="./build/obj_cobertura" />
115                <pathelement location="./build/obj" />
116                <pathelement location="../../build/jbigi.jar" />
117                <pathelement location="${with.clover}" />
118                <pathelement location="${with.cobertura}" />
119            </classpath>
120            <batchtest todir="../../reports/core/junit/">
121                <fileset dir="./test/">
122                    <include name="**/*Test.java" />
123                    <exclude name="**/ElGamalAESEngineTest.java" />
124                    <exclude name="**/StructureTest.java" />
125                </fileset>
126            </batchtest>
127            <formatter type="xml"/>
128        </junit>
129    </target>
130    <!-- test reports -->
131    <target name="junit.report">
132        <junitreport todir="../../reports/core/junit">
133            <fileset dir="../../reports/core/junit">
134                <include name="TEST-*.xml"/>
135            </fileset>
136            <report format="frames" todir="../../reports/core/html/junit"/>
137        </junitreport>
138    </target>
139    <target name="clover.report" depends="test" if="with.clover">
140        <clover-report>
141            <current outfile="../../reports/core/html/clover">
142                <format type="html"/>
143            </current>
144        </clover-report>
145    </target>
146    <target name="cobertura.report" depends="test" if="with.cobertura">
147        <mkdir dir="../../reports/core/cobertura" />
148        <cobertura-report format="xml" srcdir="./src" destdir="../../reports/core/cobertura" />
149        <mkdir dir="../../reports/core/html/cobertura" />
150        <cobertura-report format="html" srcdir="./src" destdir="../../reports/core/html/cobertura" />
151        <delete file="./cobertura.ser" />
152    </target>
153    <target name="test.report" depends="junit.report, clover.report, cobertura.report"/>
154    <!-- end test reports -->
155    <target name="fulltest" depends="test, test.report" />
156    <!-- end unit tests -->
157
158    <target name="clean">
159        <delete dir="./build" />
160    </target>
161    <target name="cleandep" depends="clean">
162        <!-- noop, since the core doesn't depend on anything -->
163    </target>
164    <target name="distclean" depends="clean">
165        <!-- noop, since the core doesn't depend on anything -->
166    </target>
167</project>
Note: See TracBrowser for help on using the repository browser.