source: router/java/build.xml @ 7213ff0c

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