source: router/java/build.xml @ c5f04ee

Last change on this file since c5f04ee was c5f04ee, checked in by zzz <zzz@…>, 9 years ago
  • Don't do 'mtn list changed' if not in a workspace or not needed
  • 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_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="listChangedFiles" if="mtn.available" >
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    </target>
69
70    <target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
71        <!-- set if unset -->
72        <property name="workspace.changes.tr" value="" />
73        <jar destfile="./build/router.jar" basedir="./build/obj" includes="**/*.class" >
74            <manifest>
75                <attribute name="Build-Date" value="${build.timestamp}" />
76                <attribute name="Base-Revision" value="${workspace.version}" />
77                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
78            </manifest>
79        </jar>
80    </target>
81
82    <target name="jarUpToDate">
83        <uptodate property="jar.uptodate" targetfile="build/router.jar" >
84            <srcfiles dir= "." includes="build/obj/**/*.class" />
85        </uptodate>
86    </target>
87
88    <target name="jarTest" depends="compileTest">
89        <jar destfile="./build/routertest.jar" basedir="./build/obj" includes="**/*.class" />
90    </target>
91    <target name="javadoc">
92        <mkdir dir="./build" />
93        <mkdir dir="./build/javadoc" />
94        <javadoc 
95            sourcepath="./src:./test:../../core/java/src:../../core/java/test" destdir="./build/javadoc" 
96            packagenames="*" 
97            use="true" 
98            splitindex="true" 
99            windowtitle="I2P Router" />
100    </target>
101    <target name="test" depends="compileTest">
102        <junit printsummary="on" fork="yes">
103            <classpath>
104                <pathelement path="${classpath}" />
105                <pathelement location="./build/obj" />
106                <pathelement location="../../core/java/build/i2ptest.jar" />
107                <pathelement location="../../installer/lib/jbigi/jbigi.jar" />
108                <pathelement path="${ant.home}/lib/clover.jar"/>
109            </classpath>
110            <batchtest>
111                <fileset dir="./test/">
112                    <include name="**/*Test.java" />
113                </fileset>
114            </batchtest>
115            <formatter type="xml"/>
116        </junit>
117        <mkdir dir="../../reports/" />
118        <mkdir dir="../../reports/router/" />
119        <mkdir dir="../../reports/router/junit/" />
120        <delete>
121            <fileset dir="../../reports/router/junit">
122                <include name="TEST-*.xml"/>
123            </fileset>
124        </delete>
125        <copy todir="../../reports/router/junit">
126            <fileset dir=".">
127                <include name="TEST-*.xml"/>
128            </fileset>
129        </copy>
130        <delete>
131            <fileset dir=".">
132                <include name="TEST-*.xml"/>
133            </fileset>
134        </delete>
135    </target>
136    <target name="junit.report">
137        <junitreport todir="../../reports/router/junit">
138            <fileset dir="../../reports/router/junit">
139                <include name="TEST-*.xml"/>
140            </fileset>
141            <report format="frames" todir="../../reports/router/html/junit"/>
142        </junitreport>
143    </target>
144    <target name="clover.report">
145        <taskdef resource="clovertasks"/>
146        <mkdir dir="../../reports/" />
147        <mkdir dir="../../reports/router" />
148        <mkdir dir="../../reports/router/clover" />
149        <clover-setup initString="../../reports/router/clover/coverage.db"/>
150        <clover-report>
151            <current outfile="../../reports/router/html/clover">
152                <format type="html"/>
153            </current>
154        </clover-report>
155    </target>
156    <target name="test.report" depends="junit.report, clover.report"/>
157    <target name="useclover">
158        <taskdef resource="clovertasks"/>
159        <mkdir dir="../../reports/" />
160        <mkdir dir="../../reports/router/" />
161        <mkdir dir="../../reports/router/clover" />
162        <clover-setup initString="../../reports/router/clover/coverage.db"/>
163    </target>
164    <target name="fulltest" depends="cleandep, builddeptest, jarTest, test, junit.report" />
165    <target name="fullclovertest" depends="cleandep, builddeptest, useclover, jarTest, test, test.report" />
166    <target name="clean">
167        <delete dir="./build" />
168    </target>
169    <target name="cleandep" depends="clean">
170    </target>
171    <target name="distclean" depends="clean">
172    </target>
173</project>
Note: See TracBrowser for help on using the repository browser.