source: apps/routerconsole/java/build.xml @ 78acf70

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

JRobin: 1.6.0-1, 2014-10-28, checked in as source
from https://github.com/OpenNMS/jrobin/releases
Replaces 1.5.9.1 from 2008-09-05
Needed for Java 9 to remove dependency on Sun private classes.
No modifications, but includes only core, data, and graph;
cmd, convertor, inspector, and tests are not included.
Using source instead of jar because:

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