source: apps/routerconsole/java/build.xml @ ec6c244

Last change on this file since ec6c244 was ec6c244, checked in by zzz <zzz@…>, 3 years ago

Debian build fixes

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