source: router/java/build.xml @ f6bda35

Last change on this file since f6bda35 was f6bda35, checked in by zzz <zzz@…>, 9 years ago
  • Build: Add new jetty jars to router.jar classpath so it works on very old installs with individual jars specified in the wrapper.config classpath
  • 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_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                <!-- so people with very old wrapper.config files will still work with Jetty 6 -->
76                <attribute name="Class-Path" value="jetty-i2p.jar jetty-java5-threadpool.jar jetty-rewrite-handler.jar jetty-sslengine.jar jetty-start.jar jetty-util.jar" />
77                <attribute name="Implementation-Version" value="${full.version}" />
78                <attribute name="Built-By" value="${build.built-by}" />
79                <attribute name="Build-Date" value="${build.timestamp}" />
80                <attribute name="Base-Revision" value="${workspace.version}" />
81                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
82            </manifest>
83        </jar>
84    </target>
85
86    <target name="jarUpToDate">
87        <uptodate property="jar.uptodate" targetfile="build/router.jar" >
88            <srcfiles dir= "." includes="build/obj/**/*.class" />
89        </uptodate>
90    </target>
91
92    <target name="jarTest" depends="compileTest">
93        <jar destfile="./build/routertest.jar" basedir="./build/obj" includes="**/*.class" />
94    </target>
95    <target name="javadoc">
96        <mkdir dir="./build" />
97        <mkdir dir="./build/javadoc" />
98        <javadoc 
99            sourcepath="./src:./test:../../core/java/src:../../core/java/test" destdir="./build/javadoc" 
100            packagenames="*" 
101            use="true" 
102            splitindex="true" 
103            windowtitle="I2P Router" />
104    </target>
105    <target name="test" depends="compileTest">
106        <junit printsummary="on" fork="yes">
107            <classpath>
108                <pathelement path="${classpath}" />
109                <pathelement location="./build/obj" />
110                <pathelement location="../../core/java/build/i2ptest.jar" />
111                <pathelement location="../../installer/lib/jbigi/jbigi.jar" />
112                <pathelement path="${ant.home}/lib/clover.jar"/>
113            </classpath>
114            <batchtest>
115                <fileset dir="./test/">
116                    <include name="**/*Test.java" />
117                </fileset>
118            </batchtest>
119            <formatter type="xml"/>
120        </junit>
121        <mkdir dir="../../reports/" />
122        <mkdir dir="../../reports/router/" />
123        <mkdir dir="../../reports/router/junit/" />
124        <delete>
125            <fileset dir="../../reports/router/junit">
126                <include name="TEST-*.xml"/>
127            </fileset>
128        </delete>
129        <copy todir="../../reports/router/junit">
130            <fileset dir=".">
131                <include name="TEST-*.xml"/>
132            </fileset>
133        </copy>
134        <delete>
135            <fileset dir=".">
136                <include name="TEST-*.xml"/>
137            </fileset>
138        </delete>
139    </target>
140    <target name="junit.report">
141        <junitreport todir="../../reports/router/junit">
142            <fileset dir="../../reports/router/junit">
143                <include name="TEST-*.xml"/>
144            </fileset>
145            <report format="frames" todir="../../reports/router/html/junit"/>
146        </junitreport>
147    </target>
148    <target name="clover.report">
149        <taskdef resource="clovertasks"/>
150        <mkdir dir="../../reports/" />
151        <mkdir dir="../../reports/router" />
152        <mkdir dir="../../reports/router/clover" />
153        <clover-setup initString="../../reports/router/clover/coverage.db"/>
154        <clover-report>
155            <current outfile="../../reports/router/html/clover">
156                <format type="html"/>
157            </current>
158        </clover-report>
159    </target>
160    <target name="test.report" depends="junit.report, clover.report"/>
161    <target name="useclover">
162        <taskdef resource="clovertasks"/>
163        <mkdir dir="../../reports/" />
164        <mkdir dir="../../reports/router/" />
165        <mkdir dir="../../reports/router/clover" />
166        <clover-setup initString="../../reports/router/clover/coverage.db"/>
167    </target>
168    <target name="fulltest" depends="cleandep, builddeptest, jarTest, test, junit.report" />
169    <target name="fullclovertest" depends="cleandep, builddeptest, useclover, jarTest, test, test.report" />
170    <target name="clean">
171        <delete dir="./build" />
172    </target>
173    <target name="cleandep" depends="clean">
174    </target>
175    <target name="distclean" depends="clean">
176    </target>
177</project>
Note: See TracBrowser for help on using the repository browser.