source: apps/streaming/java/build.xml @ e704bad

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

SchedulerDead? tests

  • Property mode set to 100644
File size: 11.4 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project basedir="." default="all" name="streaming">
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:./test/junit"
15            destdir="./build/obj" >
16            <!-- Depend on classes instead of jars where available -->
17            <classpath>
18                <pathelement location="../../../core/java/build/obj" />
19                <pathelement location="../../ministreaming/java/build/obj" />
20            </classpath>
21        </depend>
22    </target>
23
24    <!-- only used if not set by a higher build.xml -->
25    <property name="javac.compilerargs" value="" />
26    <property name="javac.version" value="1.6" />
27
28    <target name="compile" depends="depend">
29        <mkdir dir="./build" />
30        <mkdir dir="./build/obj" />
31        <javac
32            srcdir="./src"
33            debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
34            includeAntRuntime="false"
35            destdir="./build/obj"
36            classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar" >
37            <compilerarg line="${javac.compilerargs}" />
38        </javac>
39    </target>
40    <target name="builddeptest">
41        <ant dir="../../../core/java" target="jar" />
42        <ant dir="../../../apps/ministreaming/java/" target="jar" />
43    </target>
44    <target name="junit.compileTest" depends="builddeptest, compile">
45
46        <echo message="[DEBUG] ant home is ${ant.home}" />
47        <echo message="[DEBUG] junit home before override is ${junit.home}" />
48        <echo message="[DEBUG] hamcrest home before override is ${hamcrest.home}" />
49        <echo message="[DEBUG] mockito home before override is ${mockito.home}" />
50
51        <property name="junit.home" value="${ant.home}/lib" />
52        <property name="hamcrest.home" value="${ant.home}/lib" />
53        <property name="mockito.home" value="${ant.home}/lib" />
54
55        <echo message="[DEBUG] junit home after override is ${junit.home}" />
56        <echo message="[DEBUG] hamcrest home after override is ${hamcrest.home}" />
57        <echo message="[DEBUG] mockito home after override is ${mockito.home}" />
58
59        <javac
60            srcdir="./test/junit"
61            debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
62            includeAntRuntime="false"
63            destdir="./build/obj" >
64            <classpath>
65                <pathelement location="../../../core/java/build/i2p.jar" />
66                <pathelement location="../../ministreaming/java/build/mstreaming.jar" />
67                <pathelement location="${junit.home}/junit4.jar" />
68                <pathelement location="${hamcrest.home}/hamcrest.jar" />
69                <pathelement location="${hamcrest.home}/hamcrest-all.jar" />
70                <pathelement location="${mockito.home}/byte-buddy.jar" />
71                <pathelement location="${mockito.home}/objenesis.jar" />
72                <pathelement location="${mockito.home}/mockito-core.jar" />
73            </classpath>
74            <compilerarg line="${javac.compilerargs}" />
75        </javac>
76    </target>
77
78    <!-- preparation of code coverage tool of choice -->
79    <target name="prepareClover" depends="compile" if="with.clover">
80        <taskdef resource="clovertasks"/>
81        <mkdir dir="../../../reports/streaming/clover" />
82        <clover-setup initString="../../../reports/streaming/clover/coverage.db"/>
83    </target>
84    <target name="prepareCobertura" depends="compile" if="with.cobertura">
85        <taskdef classpath="${with.cobertura}" resource="tasks.properties" onerror="report" />
86        <mkdir dir="./build/obj_cobertura" />
87        <delete file="./cobertura.ser" />
88        <cobertura-instrument todir="./build/obj_cobertura">
89            <fileset dir="./build/obj">
90                <include name="**/*.class"/>
91                <!-- exclude Test classes -->
92                <exclude name="**/*Test.class" />
93                <exclude name="**/*TestBase.class" />
94                <exclude name="**/*IT.class" />
95                <exclude name="**/*IT$*.class" />
96                <exclude name="**/StreamingITBase.class" />
97                <exclude name="**/StreamingITBase$*.class" />
98                <!-- exclude anything not in net.i2p.* -->
99                <exclude name="org/cybergarage/**/*.class" />
100                <exclude name="org/freenetproject/**/*.class" />
101                <exclude name="org/xlattice/**/*.class" />
102            </fileset>
103        </cobertura-instrument>
104    </target>
105
106    <target name="prepareTest" depends="prepareClover, prepareCobertura" />
107
108    <target name="junit.test" depends="clean, junit.compileTest, prepareTest">
109        <mkdir dir="../../../reports/streaming/junit/" />
110        <delete>
111            <fileset dir="../../../reports/streaming/junit">
112                <include name="TEST-*.xml"/>
113            </fileset>
114        </delete>
115
116        <property name="junit.home" value="${ant.home}/lib" />
117        <property name="hamcrest.home" value="${ant.home}/lib" />
118        <property name="mockito.home" value="${ant.home}/lib" />
119
120        <junit printsummary="withOutAndErr" fork="yes" showoutput="yes" >
121            <sysproperty key="net.sourceforge.cobertura.datafile" file="./cobertura.ser" />
122            <classpath>
123                <pathelement path="${javac.classpath}" />
124                <pathelement location="${hamcrest.home}/hamcrest-core.jar" />
125                <pathelement location="${hamcrest.home}/hamcrest-library.jar" />
126                <pathelement location="${hamcrest.home}/hamcrest-integration.jar" />
127                <pathelement location="${hamcrest.home}/hamcrest-all.jar" />
128                <pathelement location="${mockito.home}/byte-buddy.jar" />
129                <pathelement location="${mockito.home}/objenesis.jar" />
130                <pathelement location="${mockito.home}/mockito-core.jar" />
131                <pathelement location="${junit.home}/junit4.jar" />
132                <pathelement location="./build/obj_cobertura" />
133                <pathelement location="./build/obj" />
134                <pathelement location="../../../core/java/build/i2ptest.jar" />
135                <pathelement location="../../../core/java/build/i2p.jar" />
136                <pathelement location="../../ministreaming/java/build/mstreaming.jar" />
137                <pathelement location="../../build/jbigi.jar" />
138                <pathelement location="${with.clover}" />
139                <pathelement location="${with.cobertura}" />
140            </classpath>
141            <batchtest todir="../../../reports/streaming/junit/">
142                <fileset dir="./test/junit">
143                    <include name="**/*Test.java" />
144                    <include name="**/*IT.java" if="runIntegrationTests" />
145                </fileset>
146            </batchtest>
147            <formatter type="xml"/>
148        </junit>
149        <!-- set if unset -->
150        <property name="host.fakename" value="i2ptester" />
151        <!-- replace hostname that junit inserts into reports with fake one -->
152        <replaceregexp byline="true"
153            match="(hostname=)&quot;[^&quot;]+&quot;"
154            replace="\1&quot;${host.fakename}&quot;">
155            <fileset dir="../../../reports/streaming/junit/" />
156        </replaceregexp>
157    </target>
158    <target name="test" depends="junit.test"/>
159    <!-- test reports -->
160    <target name="junit.report">
161        <junitreport todir="../../../reports/streaming/junit">
162            <fileset dir="../../../reports/streaming/junit">
163                <include name="TEST-*.xml"/>
164            </fileset>
165            <report format="frames" todir="../../../reports/streaming/html/junit"/>
166        </junitreport>
167    </target>
168    <target name="clover.report" depends="test" if="with.clover">
169        <clover-report>
170            <current outfile="../../../reports/streaming/html/clover">
171                <format type="html"/>
172            </current>
173        </clover-report>
174    </target>
175    <target name="cobertura.report" depends="test" if="with.cobertura">
176        <mkdir dir="../../../reports/streaming/cobertura" />
177        <cobertura-report format="xml" srcdir="./src" destdir="../../../reports/streaming/cobertura" />
178        <mkdir dir="../../../reports/streaming/html/cobertura" />
179        <cobertura-report format="html" srcdir="./src" destdir="../../../reports/streaming/html/cobertura" />
180        <delete file="./cobertura.ser" />
181    </target>
182    <target name="test.report" depends="junit.report, clover.report, cobertura.report"/>
183    <!-- end test reports -->
184    <target name="fulltest" depends="cleandep, test, test.report" />
185    <!-- end unit tests -->
186
187    <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" >
188        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
189            <arg value="list" />
190            <arg value="changed" />
191            <arg value="." />
192        </exec>
193        <!-- \n in an attribute value generates an invalid manifest -->
194        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
195            <arg value="-s" />
196            <arg value="[:space:]" />
197            <arg value="," />
198        </exec>
199    </target>
200
201    <target name="jar" depends="builddep, compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
202        <!-- set if unset -->
203        <property name="workspace.changes.tr" value="" />
204        <jar destfile="./build/streaming.jar" basedir="./build/obj" includes="**/*.class" >
205            <manifest>
206                <attribute name="Implementation-Version" value="${full.version}" />
207                <attribute name="Built-By" value="${build.built-by}" />
208                <attribute name="Build-Date" value="${build.timestamp}" />
209                <attribute name="Base-Revision" value="${workspace.version}" />
210                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
211            </manifest>
212        </jar>
213    </target>
214
215    <target name="jarUpToDate">
216        <uptodate property="jar.uptodate" targetfile="build/streaming.jar" >
217            <srcfiles dir= "." includes="build/obj/**/*.class" />
218        </uptodate>
219        <condition property="shouldListChanges" >
220            <and>
221                <not>
222                    <isset property="jar.uptodate" />
223                </not>
224                <isset property="mtn.available" />
225            </and>
226        </condition>
227    </target>
228
229    <target name="jarTest" depends="jar, junit.compileTest">
230        <jar destfile="./build/streaming.jar" basedir="./build/obj" includes="**/*Test*.class" update="true" />
231    </target>
232    <target name="javadoc">
233        <mkdir dir="./build" />
234        <mkdir dir="./build/javadoc" />
235        <javadoc
236            sourcepath="./src:../../../core/java/src:../../ministreaming/java/src" destdir="./build/javadoc"
237            packagenames="*"
238            use="true"
239            splitindex="true"
240            windowtitle="Streaming" />
241    </target>
242    <target name="clean">
243        <delete dir="./build" />
244    </target>
245    <target name="cleandep" depends="clean">
246    </target>
247    <target name="distclean" depends="clean">
248    </target>
249</project>
Note: See TracBrowser for help on using the repository browser.