source: apps/routerconsole/java/build.xml @ 08d1ea8

Last change on this file since 08d1ea8 was 08d1ea8, checked in by zzz <zzz@…>, 4 years ago

Build: Set Java 7 build target for all jars;
embedders (esp. Android) targetting 1.6 must
set javac.version=1.6 in override.properties and set
both bootclasspath variables.

  • Property mode set to 100644
File size: 29.1 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project basedir="." default="all" name="routerconsole">
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="prepare">
9        <!-- run from top level build.xml to get dependencies built -->
10    </target>
11    <condition property="no.bundle">
12        <isfalse value="${require.gettext}" />
13    </condition>
14    <condition property="depend.available">
15        <typefound name="depend" />
16    </condition>
17    <target name="depend" if="depend.available">
18        <depend
19            cache="../../../build"
20            srcdir="./src" 
21            destdir="./build/obj" >
22            <!-- Depend on classes instead of jars where available -->
23            <classpath>
24                <pathelement location="../../../core/java/build/obj" />
25                <pathelement location="../../../router/java/build/obj" />
26                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
27                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
28                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
29                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
30                <pathelement location="../../systray/java/build/obj" />
31                <pathelement location="../../desktopgui/build" />
32                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
33                <pathelement location="../../jrobin/jrobin-1.5.9.1.jar" />
34            </classpath>
35        </depend>
36    </target>
37    <target name="dependVersion">
38        <!-- Force the dependency on the RouterVersion as depend doesn't recognize constant changes  -->
39        <dependset>
40             <srcfilelist dir="." files="../../../router/java/build/obj/net/i2p/router/RouterVersion.class" />
41             <targetfilelist dir="." files="build/obj/net/i2p/router/web/NewsFetcher.class" />
42             <targetfilelist dir="." files="build/obj/net/i2p/router/web/OldConsoleHelper.class" />
43             <targetfilelist dir="." files="build/obj/net/i2p/router/web/PluginStarter.class" />
44             <targetfilelist dir="." files="build/obj/net/i2p/router/web/SummaryHelper.class" />
45             <targetfilelist dir="." files="build/obj/net/i2p/router/web/UpdateHandler.class" />
46        </dependset>
47    </target>
48
49    <property name="javac.compilerargs" value="" />
50    <property name="javac.version" value="1.7" />
51
52    <target name="compile" depends="prepare, depend, dependVersion">
53        <mkdir dir="./build" />
54        <mkdir dir="./build/obj" />
55        <javac 
56            srcdir="./src" 
57            debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
58            includeAntRuntime="false"
59            destdir="./build/obj">
60            <compilerarg line="${javac.compilerargs}" />
61            <classpath>
62                <pathelement location="../../../core/java/build/i2p.jar" />
63                <pathelement location="../../../router/java/build/router.jar" />
64                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
65                <pathelement location="../../jetty/jettylib/jetty-http.jar" />
66                <pathelement location="../../jetty/jettylib/jetty-io.jar" />
67                <pathelement location="../../jetty/jettylib/jetty-security.jar" />
68                <pathelement location="../../jetty/jettylib/jetty-servlet.jar" />
69                <pathelement location="../../jetty/jettylib/jetty-servlets.jar" />
70                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
71                <pathelement location="../../jetty/jettylib/jetty-webapp.jar" />
72                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
73                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
74                <pathelement location="../../systray/java/build/systray.jar" />
75                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
76                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
77                <pathelement location="../../jrobin/jrobin-1.5.9.1.jar" />
78            </classpath>
79        </javac>
80    </target>
81
82    <!-- newsxml.jar only (subset of routerconsole, no war) for Android -->
83    <target name="compileNewsOnly" depends="prepare, depend, dependVersion">
84        <mkdir dir="./build" />
85        <mkdir dir="./build/obj" />
86        <javac 
87            srcdir="./src" 
88            includes="net/i2p/router/news/*.java"
89            debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
90            includeAntRuntime="false"
91            destdir="./build/obj">
92            <compilerarg line="${javac.compilerargs}" />
93            <classpath>
94                <pathelement location="../../../core/java/build/i2p.jar" />
95                <pathelement location="../../../router/java/build/router.jar" />
96            </classpath>
97        </javac>
98    </target>
99
100    <!-- the jar with the latest message classes from the jsps, and the war too -->
101    <target name="jar" depends="jar1, war, bundle" />
102
103    <!-- the jar without the latest message classes from the jsps -->
104    <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" >
105        <exec executable="mtn" outputproperty="workspace.changes.j" errorproperty="mtn.error2" failifexecutionfails="false" >
106            <arg value="list" />
107            <arg value="changed" />
108            <arg value="." />
109            <arg value="../locale" />
110        </exec>
111        <!-- \n in an attribute value generates an invalid manifest -->
112        <exec executable="tr" inputstring="${workspace.changes.j}" outputproperty="workspace.changes.j.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
113            <arg value="-s" />
114            <arg value="[:space:]" />
115            <arg value="," />
116        </exec>
117    </target>
118
119    <target name="jar1" depends="compile, bundle-news, bundle-countries, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
120        <!-- set if unset -->
121        <property name="workspace.changes.j.tr" value="" />
122        <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class">
123            <manifest>
124                <!-- top level installer will rename to jrobin.jar -->
125                <!-- DTG added in 0.8.4, not in the classpath for very old installs, before we changed wrapper.config to specify * -->
126                <!-- very old installs don't have i2psnark,jstl,standard in the classpath... not added in WebAppConfiguration any more -->
127                <!-- All new jetty 7 jars should have been in 0.9.6, added in 0.9.7 -->
128                <attribute name="Class-Path" value="i2p.jar router.jar jrobin.jar desktopgui.jar i2psnark.jar jstl.jar standard.jar jetty-continuation.jar jetty-http.jar jetty-io.jar jetty-security.jar jetty-servlet.jar jetty-servlets.jar jetty-util.jar jetty-webapp.jar" />
129                <attribute name="Implementation-Version" value="${full.version}" />
130                <attribute name="Built-By" value="${build.built-by}" />
131                <attribute name="Build-Date" value="${build.timestamp}" />
132                <attribute name="Base-Revision" value="${workspace.version}" />
133                <attribute name="Workspace-Changes" value="${workspace.changes.j.tr}" />
134            </manifest>
135        </jar>
136    </target>
137
138    <!-- newsxml.jar only (subset of routerconsole, no war) for Android -->
139    <target name="newsxmljar" depends="compileNewsOnly" >
140        <jar destfile="./build/newsxml.jar" basedir="./build/obj" includes="**/*.class">
141        </jar>
142    </target>
143
144    <!-- this is tricky because the message classes go in the jar, not in the war -->
145    <target name="bundle" depends="jar1, precompilejsp" unless="no.bundle">
146        <mkdir dir="build/messages-src" />
147        <!-- Update the messages_*.po files.
148             We need to supply the bat file for windows, and then change the fail property to true -->
149        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
150            <env key="JAVA_HOME" value="${java.home}" />
151            <arg value="./bundle-messages.sh" />
152        </exec>
153        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
154            <arg value="./bundle-messages.sh" />
155        </exec>
156                <!-- multi-lang is optional -->
157        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
158            <arg value="./bundle-messages.sh" />
159        </exec>
160        <javac source="${javac.version}" target="${javac.version}" 
161               includeAntRuntime="false"
162               srcdir="build/messages-src" destdir="build/obj">
163            <compilerarg line="${javac.compilerargs}" />
164        </javac>
165        <!-- jar again to get the latest messages_*.class files -->
166        <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class" update="true" />
167    </target>
168
169    <target name="jarUpToDate">
170        <uptodate property="jar.uptodate" targetfile="build/routerconsole.jar" >
171            <srcfiles dir= "build/obj" includes="**/*.class" />
172        </uptodate>
173        <condition property="shouldListChanges" >
174            <and>
175                <not>
176                    <isset property="jar.uptodate" />
177                </not>
178                <isset property="mtn.available" />
179            </and>
180        </condition>
181    </target>
182
183    <target name="poupdate" depends="precompilejsp">
184        <!-- Update the messages_*.po files.
185             We need to supply the bat file for windows, and then change the fail property to true -->
186        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
187            <arg value="./bundle-messages.sh" />
188            <arg value="-p" />
189        </exec>
190        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
191            <arg value="./bundle-messages.sh" />
192            <arg value="-p" />
193        </exec>
194        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
195            <arg value="./bundle-messages.sh" />
196            <arg value="-p" />
197        </exec>
198    </target>
199
200    <target name="bundle-news" unless="no.bundle">
201        <mkdir dir="build/messages-news-src" />
202        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
203            <env key="JAVA_HOME" value="${java.home}" />
204            <arg value="./bundle-messages-news.sh" />
205        </exec>
206        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
207            <arg value="./bundle-messages-news.sh" />
208        </exec>
209        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
210            <arg value="./bundle-messages-news.sh" />
211        </exec>
212        <javac source="${javac.version}" target="${javac.version}" 
213               includeAntRuntime="false"
214               srcdir="build/messages-news-src" destdir="build/obj">
215            <compilerarg line="${javac.compilerargs}" />
216        </javac>
217    </target>
218
219    <target name="bundle-countries" unless="no.bundle">
220        <mkdir dir="build/messages-countries-src" />
221        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
222            <env key="JAVA_HOME" value="${java.home}" />
223            <arg value="./bundle-messages-countries.sh" />
224        </exec>
225        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
226            <arg value="./bundle-messages-countries.sh" />
227        </exec>
228        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
229            <arg value="./bundle-messages-countries.sh" />
230        </exec>
231        <javac source="${javac.version}" target="${javac.version}" 
232               includeAntRuntime="false"
233               srcdir="build/messages-countries-src" destdir="build/obj">
234            <compilerarg line="${javac.compilerargs}" />
235        </javac>
236    </target>
237
238    <target name="extractProxyTags">
239        <java classname="net.i2p.util.TranslateReader" fork="true" failonerror="true">
240            <classpath>
241                <pathelement location="../../../build/i2p.jar" />
242            </classpath>
243            <arg value="tag" />
244            <arg value="../../../installer/resources/initialNews/initialNews.xml" />
245            <arg value="build/News.java" />
246        </java>
247    </target>
248
249    <target name="poupdate-news" depends="extractProxyTags">
250        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
251            <arg value="./bundle-messages-news.sh" />
252            <arg value="-p" />
253        </exec>
254        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
255            <arg value="./bundle-messages-news.sh" />
256            <arg value="-p" />
257        </exec>
258        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
259            <arg value="./bundle-messages-news.sh" />
260            <arg value="-p" />
261        </exec>
262    </target>
263
264    <target name="poupdate-countries" depends="extractProxyTags">
265        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
266            <arg value="./bundle-messages-countries.sh" />
267            <arg value="-p" />
268        </exec>
269        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
270            <arg value="./bundle-messages-countries.sh" />
271            <arg value="-p" />
272        </exec>
273        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
274            <arg value="./bundle-messages-countries.sh" />
275            <arg value="-p" />
276        </exec>
277    </target>
278
279    <target name="listChangedFiles2" depends="warUpToDate" if="shouldListChanges2" >
280        <exec executable="mtn" outputproperty="workspace.changes.w" errorproperty="mtn.error2" failifexecutionfails="false" >
281            <arg value="list" />
282            <arg value="changed" />
283            <arg value="../jsp" />
284        </exec>
285        <!-- \n in an attribute value generates an invalid manifest -->
286        <exec executable="tr" inputstring="${workspace.changes.w}" outputproperty="workspace.changes.w.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
287            <arg value="-s" />
288            <arg value="[:space:]" />
289            <arg value="," />
290        </exec>
291    </target>
292
293    <!-- does NOT update the message classes, as those go in the jar -->
294    <target name="war" depends="precompilejsp, warUpToDate, listChangedFiles2" unless="war.uptodate" >
295        <!-- set if unset -->
296        <property name="workspace.changes.w.tr" value="" />
297        <!-- Don't include the css in the war, the main build.xml will copy it to docs/themes/console/ -->
298        <war destfile="build/routerconsole.war" webxml="../jsp/web-out.xml"
299             basedir="../jsp/" excludes="web.xml, *.css, **/*.java, *.jsp, *.jsi, web-fragment.xml, web-out.xml">
300            <manifest>
301                <attribute name="Implementation-Version" value="${full.version}" />
302                <attribute name="Built-By" value="${build.built-by}" />
303                <attribute name="Build-Date" value="${build.timestamp}" />
304                <attribute name="Base-Revision" value="${workspace.version}" />
305                <attribute name="Workspace-Changes" value="${workspace.changes.w.tr}" />
306            </manifest>
307        </war>
308    </target>
309
310    <target name="warUpToDate">
311        <uptodate property="war.uptodate" targetfile="build/routerconsole.war" >
312            <srcfiles dir= "../jsp" excludes="web.xml, web-fragment.xml, *.css, **/*.java, *.jsp, *.jsi" />
313        </uptodate>
314        <condition property="shouldListChanges" >
315            <and>
316                <not>
317                    <isset property="jar.uptodate" />
318                </not>
319                <isset property="mtn.available" />
320            </and>
321        </condition>
322    </target>
323
324    <target name="precompilejsp" depends="jar1" unless="precompilejsp.uptodate">
325        <delete dir="../jsp/WEB-INF/" />
326        <delete file="../jsp/web-fragment.xml" />
327        <delete file="../jsp/web-out.xml" />
328        <mkdir dir="../jsp/WEB-INF/" />
329        <mkdir dir="../jsp/WEB-INF/classes" />
330
331        <!-- there are various jspc ant tasks, but they all seem a bit flakey -->
332        <!--
333           **     Usage: jspc <options> <jsp files>
334           **     where jsp files is
335           **         -webapp <dir>      A directory containing a web-app, whose JSP pages
336           **                            will be processed recursively
337           **     or any number of
338           **         <file>             A file to be parsed as a JSP page
339           **     where options include:
340           **         -help              Print this help message
341           **         -v                 Verbose mode
342           **         -d <dir>           Output Directory (default -Djava.io.tmpdir)
343           **         -l                 Outputs the name of the JSP page upon failure
344           **         -s                 Outputs the name of the JSP page upon success
345           **         -p <name>          Name of target package (default org.apache.jsp)
346           **         -c <name>          Name of target class name (only applies to first JSP page)
347           **         -mapped            Generates separate write() calls for each HTML line in the JSP
348           **         -die[#]            Generates an error return code (#) on fatal errors (default 1)
349           **         -uribase <dir>     The uri directory compilations should be relative to
350           **                            (default "/")
351           **         -uriroot <dir>     Same as -webapp
352           **         -compile           Compiles generated servlets
353           **         -webinc <file>     Creates a partial servlet mappings in the file
354           **         -webxml <file>     Creates a complete web.xml in the file
355           **         -ieplugin <clsid>  Java Plugin classid for Internet Explorer
356           **         -classpath <path>  Overrides java.class.path system property
357           **         -xpoweredBy        Add X-Powered-By response header
358           **         -trimSpaces        Trim spaces in template text between actions, directives
359        -->
360        <java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
361            <classpath>
362                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
363                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
364                <!-- jsp-api.jar only present for debian builds -->
365                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
366                <!-- tomcat-api.jar only present for debian builds -->
367                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
368                <!-- jasper-el.jar only present for debian builds -->
369                <pathelement location="../../jetty/jettylib/jasper-el.jar" />
370                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
371                <pathelement location="../../jetty/jettylib/commons-el.jar" />
372                <pathelement location="${ant.home}/lib/ant.jar" />
373                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
374                <pathelement location="../../systray/java/build/obj" />
375                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
376                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
377                <pathelement location="build/routerconsole.jar" />
378                <pathelement location="build/" />
379                <pathelement location="../../../router/java/build/router.jar" />
380                <pathelement location="../../../core/java/build/i2p.jar" />
381            </classpath>
382            <arg value="-d" />
383            <arg value="../jsp/WEB-INF/classes" />
384            <arg value="-v" />
385            <arg value="-p" />
386            <arg value="net.i2p.router.web.jsp" />
387            <arg value="-webinc" />
388            <arg value="../jsp/web-fragment.xml" />
389            <arg value="-webapp" />
390            <arg value="../jsp/" />
391        </java>
392       
393        <javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
394               encoding="UTF-8"
395               includeAntRuntime="false"
396               destdir="../jsp/WEB-INF/classes/" 
397               srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
398            <compilerarg line="${javac.compilerargs}" />
399            <classpath>
400                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
401                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
402                <!-- jsp-api.jar only present for debian builds -->
403                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
404                <!-- tomcat-api.jar only present for debian builds -->
405                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
406                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
407                <pathelement location="../../jetty/jettylib/commons-el.jar" />
408                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
409                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
410                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
411                <pathelement location="../../systray/java/build/obj" />
412                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
413                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
414                <pathelement location="build/routerconsole.jar" />
415                <pathelement location="build" />
416                <pathelement location="../../../router/java/build/router.jar" />
417                <pathelement location="../../../core/java/build/i2p.jar" />
418            </classpath>
419        </javac>
420
421        <!-- save these so we can run gettext on the generated java files later
422        <delete>
423            <fileset dir="../jsp/WEB-INF/" includes="**/*.java" />
424            <fileset dir="../jsp/WEB-INF/" includes="**/*.jsp" />
425        </delete>
426        -->
427        <copy file="../jsp/web.xml" tofile="../jsp/web-out.xml" />
428        <loadfile property="jspc.web.fragment" srcfile="../jsp/web-fragment.xml" />
429        <replace file="../jsp/web-out.xml">
430            <replacefilter token="&lt;!-- precompiled servlets --&gt;" value="${jspc.web.fragment}" />
431        </replace>
432    </target>
433
434    <uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml">
435        <srcfiles dir= "../jsp" includes="**/*.jsp, *.jsi, **/*.html, *.css, susimail/susimail, web.xml"/>
436        <!-- so the version is right on logs.jsp -->
437        <srcfiles dir= "../../../router/java/src/net/i2p/router" includes="RouterVersion.java"/>
438    </uptodate>
439
440    <target name="javadoc">
441        <mkdir dir="./build" />
442        <mkdir dir="./build/javadoc" />
443        <javadoc 
444            sourcepath="./src:../../../core/java/src:../../../router/java/src:../../systray/java/src:../../desktopgui/src" destdir="./build/javadoc" 
445            packagenames="*" 
446            use="true" 
447            splitindex="true" 
448            windowtitle="Router Console" />
449    </target>
450
451    <!-- scala paths -->
452    <target name="scala.init">
453        <property name="scala-library.jar" value="${scalatest.libs}/scala-library.jar" />
454        <property name="scalatest.jar" value="${scalatest.libs}/scalatest.jar" />
455        <taskdef resource="scala/tools/ant/antlib.xml">
456            <classpath>
457                <pathelement location="${scalatest.libs}/scala-compiler.jar" />
458                <pathelement location="${scala-library.jar}" />
459            </classpath>
460        </taskdef>
461    </target>
462
463    <!-- unit tests -->
464    <target name="builddepscalatest">
465        <ant dir="../../../router/java/" target="jar" />
466        <ant dir="../../../router/java/" target="jarScalaTest" />
467    </target>
468    <target name="scalatest.compileTest" depends="builddepscalatest, compile, scala.init">
469        <mkdir dir="./build" />
470        <mkdir dir="./build/obj_scala" />
471        <scalac srcdir="./test/scalatest" destdir="./build/obj_scala" deprecation="on" >
472            <classpath>
473                <pathelement location="${scala-library.jar}" />
474                <pathelement location="${scalatest.jar}" />
475                <pathelement location="${scalatest.libs}/mockito-all.jar" />
476                <pathelement location="../../../core/java/build/i2pscalatest.jar" />
477                <pathelement location="../../../router/java/build/routerscalatest.jar" />
478                <pathelement location="./build/obj" />
479            </classpath>
480        </scalac>
481    </target>
482    <!-- preparation of code coverage tool of choice -->
483    <target name="prepareClover" depends="compile" if="with.clover">
484        <taskdef resource="clovertasks"/>
485        <mkdir dir="../../../reports/apps/routerconsole/clover" />
486        <clover-setup initString="../../../reports/apps/routerconsole/clover/coverage.db"/>
487    </target>
488    <target name="prepareCobertura" depends="compile" if="with.cobertura">
489        <taskdef classpath="${with.cobertura}" resource="tasks.properties" onerror="report" />
490        <mkdir dir="./build/obj_cobertura" />
491        <delete file="./cobertura.ser" />
492        <cobertura-instrument todir="./build/obj_cobertura">
493            <fileset dir="./build/obj">
494                <include name="**/*.class"/>
495                <exclude name="**/*Test.class" />
496            </fileset>
497        </cobertura-instrument>
498    </target>
499    <target name="prepareTest" depends="prepareClover, prepareCobertura" />
500    <!-- end preparation of code coverage tool -->
501    <target name="scalatest.test" depends="clean, scalatest.compileTest, prepareTest">
502        <mkdir dir="../../../reports/apps/routerconsole/scalatest/" />
503        <delete>
504            <fileset dir="../../../reports/apps/routerconsole/scalatest">
505                <include name="TEST-*.xml"/>
506            </fileset>
507        </delete>
508        <taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestAntTask">
509            <classpath>
510                <pathelement location="${classpath}" />
511                <pathelement location="${scala-library.jar}" />
512                <pathelement location="${scalatest.jar}" />
513                <pathelement location="./build/obj_cobertura" />
514                <pathelement location="./build/obj" />
515                <pathelement location="${with.clover}" />
516                <pathelement location="${with.cobertura}" />
517            </classpath>
518        </taskdef>
519        <scalatest runpath="./build/obj_scala" fork="yes" maxmemory="384M">
520            <tagsToExclude>
521                SlowTests
522            </tagsToExclude>
523            <reporter type="stdout" />
524            <reporter type="junitxml" directory="../../../reports/apps/routerconsole/scalatest/" />
525        </scalatest>
526        <!-- fetch the real hostname of this machine -->
527        <exec executable="hostname" outputproperty="host.name"/>
528        <!-- set if unset -->
529        <property name="host.fakename" value="i2ptester" />
530        <!-- replace hostname that junit inserts into reports with fake one -->
531        <replace dir="../../../reports/apps/routerconsole/scalatest/" token="${host.name}" value="${host.fakename}"/>
532    </target>
533    <target name="test" depends="scalatest.test"/>
534    <!-- test reports -->
535    <target name="scalatest.report">
536        <junitreport todir="../../../reports/apps/routerconsole/scalatest">
537            <fileset dir="../../../reports/apps/routerconsole/scalatest">
538                <include name="TEST-*.xml"/>
539            </fileset>
540            <report format="frames" todir="../../../reports/apps/routerconsole/html/scalatest"/>
541        </junitreport>
542    </target>
543    <target name="clover.report" depends="test" if="with.clover">
544        <clover-report>
545            <current outfile="../../../reports/apps/routerconsole/html/clover">
546                <format type="html"/>
547            </current>
548        </clover-report>
549    </target>
550    <target name="cobertura.report" depends="test" if="with.cobertura">
551        <mkdir dir="../../../reports/apps/routerconsole/cobertura" />
552        <cobertura-report format="xml" srcdir="./src" destdir="../../../reports/apps/routerconsole/cobertura" />
553        <mkdir dir="../../../reports/apps/routerconsole/html/cobertura" />
554        <cobertura-report format="html" srcdir="./src" destdir="../../../reports/apps/routerconsole/html/cobertura" />
555        <delete file="./cobertura.ser" />
556    </target>
557    <target name="test.report" depends="scalatest.report, clover.report, cobertura.report"/>
558    <!-- end test reports -->
559    <target name="fulltest" depends="cleandep, test, test.report" />
560    <!-- end unit tests -->
561
562    <target name="clean">
563        <delete dir="./build" />
564        <delete dir="../jsp/WEB-INF/" />
565        <delete file="../jsp/web-fragment.xml" />
566        <delete file="../jsp/web-out.xml" />
567    </target>
568    <target name="cleandep" depends="clean">
569    </target>
570    <target name="distclean" depends="clean">
571    </target>
572</project>
Note: See TracBrowser for help on using the repository browser.