source: router/java/build.xml @ f9b2c771

Last change on this file since f9b2c771 was f9b2c771, checked in by zzz <zzz@…>, 9 years ago

fix RateTest?; includeAntRuntime=true for router tests

  • Property mode set to 100644
File size: 6.9 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project basedir="." default="all" name="i2p_router">
3    <target name="all" depends="clean, build" />
4    <target name="build" depends="builddep, jar" />
5    <target name="builddep">
6        <!-- run from top level build.xml to get dependencies built -->
7    </target>
8    <target name="builddeptest">
9        <ant dir="../../core/java/" target="jarTest" />
10    </target>
11    <condition property="depend.available">
12        <typefound name="depend" />
13    </condition>
14    <target name="depend" if="depend.available">
15        <depend
16            cache="../../build"
17            srcdir="./src" 
18            destdir="./build/obj" >
19            <!-- Depend on classes instead of jars where available -->
20            <classpath>
21                <pathelement location="../../core/java/build/obj" />
22            </classpath>
23        </depend>
24    </target>
25    <target name="dependVersion">
26        <!-- Force the dependency on the RouterVersion as depend doesn't recognize constant changes  -->
27        <dependset>
28             <srcfilelist dir="." files="build/obj/net/i2p/router/RouterVersion.class" />
29             <targetfilelist dir="." files="build/obj/net/i2p/router/Router.class" />
30             <targetfilelist dir="." files="build/obj/net/i2p/router/StatisticsManager.class" />
31        </dependset>
32    </target>
33    <!-- only used if not set by a higher build.xml -->
34    <property name="javac.compilerargs" value="" />
35    <target name="compile" depends="depend, dependVersion">
36        <mkdir dir="./build" />
37        <mkdir dir="./build/obj" />
38        <javac srcdir="./src" debug="true" source="1.5" target="1.5" deprecation="on"
39               includeAntRuntime="false"
40               destdir="./build/obj" classpath="../../core/java/build/i2p.jar" >
41            <compilerarg line="${javac.compilerargs}" />
42        </javac>
43    </target>
44
45    <target name="compileTest" depends="builddeptest">
46        <mkdir dir="./build" />
47        <mkdir dir="./build/obj" />
48        <!-- junit classes are in ant runtime -->
49        <javac srcdir="./src:./test" debug="true" source="1.5" target="1.5" deprecation="on"
50               includeAntRuntime="true"
51               destdir="./build/obj" classpath="../../core/java/build/i2ptest.jar" >
52            <compilerarg line="${javac.compilerargs}" />
53        </javac>
54    </target>
55
56    <target name="jar" depends="compile, jarUpToDate" unless="jar.uptodate" >
57        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
58            <arg value="list" />
59            <arg value="changed" />
60            <arg value="." />
61        </exec>
62        <!-- \n in an attribute value generates an invalid manifest -->
63        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
64            <arg value="-s" />
65            <arg value="[:space:]" />
66            <arg value="," />
67        </exec>
68        <jar destfile="./build/router.jar" basedir="./build/obj" includes="**/*.class" >
69            <manifest>
70                <attribute name="Build-Date" value="${build.timestamp}" />
71                <attribute name="Base-Revision" value="${workspace.version}" />
72                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
73            </manifest>
74        </jar>
75    </target>
76
77    <target name="jarUpToDate">
78        <uptodate property="jar.uptodate" targetfile="build/router.jar" >
79            <srcfiles dir= "." includes="build/obj/**/*.class" />
80        </uptodate>
81    </target>
82
83    <target name="jarTest" depends="compileTest">
84        <jar destfile="./build/routertest.jar" basedir="./build/obj" includes="**/*.class" />
85    </target>
86    <target name="javadoc">
87        <mkdir dir="./build" />
88        <mkdir dir="./build/javadoc" />
89        <javadoc 
90            sourcepath="./src:./test:../../core/java/src:../../core/java/test" destdir="./build/javadoc" 
91            packagenames="*" 
92            use="true" 
93            splitindex="true" 
94            windowtitle="I2P Router" />
95    </target>
96    <target name="test" depends="compileTest">
97        <junit printsummary="on" fork="yes">
98            <classpath>
99                <pathelement path="${classpath}" />
100                <pathelement location="./build/obj" />
101                <pathelement location="../../core/java/build/i2ptest.jar" />
102                <pathelement location="../../installer/lib/jbigi/jbigi.jar" />
103                <pathelement path="${ant.home}/lib/clover.jar"/>
104            </classpath>
105            <batchtest>
106                <fileset dir="./test/">
107                    <include name="**/*Test.java" />
108                </fileset>
109            </batchtest>
110            <formatter type="xml"/>
111        </junit>
112        <mkdir dir="../../reports/" />
113        <mkdir dir="../../reports/router/" />
114        <mkdir dir="../../reports/router/junit/" />
115        <delete>
116            <fileset dir="../../reports/router/junit">
117                <include name="TEST-*.xml"/>
118            </fileset>
119        </delete>
120        <copy todir="../../reports/router/junit">
121            <fileset dir=".">
122                <include name="TEST-*.xml"/>
123            </fileset>
124        </copy>
125        <delete>
126            <fileset dir=".">
127                <include name="TEST-*.xml"/>
128            </fileset>
129        </delete>
130    </target>
131    <target name="junit.report">
132        <junitreport todir="../../reports/router/junit">
133            <fileset dir="../../reports/router/junit">
134                <include name="TEST-*.xml"/>
135            </fileset>
136            <report format="frames" todir="../../reports/router/html/junit"/>
137        </junitreport>
138    </target>
139    <target name="clover.report">
140        <taskdef resource="clovertasks"/>
141        <mkdir dir="../../reports/" />
142        <mkdir dir="../../reports/router" />
143        <mkdir dir="../../reports/router/clover" />
144        <clover-setup initString="../../reports/router/clover/coverage.db"/>
145        <clover-report>
146            <current outfile="../../reports/router/html/clover">
147                <format type="html"/>
148            </current>
149        </clover-report>
150    </target>
151    <target name="test.report" depends="junit.report, clover.report"/>
152    <target name="useclover">
153        <taskdef resource="clovertasks"/>
154        <mkdir dir="../../reports/" />
155        <mkdir dir="../../reports/router/" />
156        <mkdir dir="../../reports/router/clover" />
157        <clover-setup initString="../../reports/router/clover/coverage.db"/>
158    </target>
159    <target name="fulltest" depends="cleandep, builddeptest, jarTest, test, junit.report" />
160    <target name="fullclovertest" depends="cleandep, builddeptest, useclover, jarTest, test, test.report" />
161    <target name="clean">
162        <delete dir="./build" />
163    </target>
164    <target name="cleandep" depends="clean">
165    </target>
166    <target name="distclean" depends="clean">
167    </target>
168</project>
Note: See TracBrowser for help on using the repository browser.