source: router/java/build.xml @ ceda7c9c

Last change on this file since ceda7c9c was ceda7c9c, checked in by str4d <str4d@…>, 8 years ago

Fix jbigi.jar path in test target of router build.xml

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