source: apps/routerconsole/java/build.xml @ 761affc9

Last change on this file since 761affc9 was 761affc9, checked in by zzz <zzz@…>, 2 years ago

Console: Move servlet to new package (ticket #2265)

  • Property mode set to 100644
File size: 32.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" excludes="net/i2p/router/web/helpers/* net/i2p/router/web/servlets/*">
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 jstlel.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="**/messages_*.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        <!-- set if unset -->
193        <property name="lg2" value="" />
194        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
195            <env key="LG2" value="${lg2}" />
196            <arg value="./bundle-messages.sh" />
197            <arg value="-p" />
198        </exec>
199        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
200            <env key="LG2" value="${lg2}" />
201            <arg value="./bundle-messages.sh" />
202            <arg value="-p" />
203        </exec>
204        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
205            <env key="LG2" value="${lg2}" />
206            <arg value="./bundle-messages.sh" />
207            <arg value="-p" />
208        </exec>
209    </target>
210
211    <target name="bundle-news" unless="no.bundle">
212        <mkdir dir="build/messages-news-src" />
213        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
214            <env key="JAVA_HOME" value="${java.home}" />
215            <arg value="./bundle-messages-news.sh" />
216        </exec>
217        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
218            <arg value="./bundle-messages-news.sh" />
219        </exec>
220        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
221            <arg value="./bundle-messages-news.sh" />
222        </exec>
223        <javac source="${javac.version}" target="${javac.version}" 
224               includeAntRuntime="false"
225               srcdir="build/messages-news-src" destdir="build/obj">
226            <compilerarg line="${javac.compilerargs}" />
227        </javac>
228    </target>
229
230    <target name="bundle-countries" unless="no.bundle">
231        <mkdir dir="build/messages-countries-src" />
232        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
233            <env key="JAVA_HOME" value="${java.home}" />
234            <arg value="./bundle-messages-countries.sh" />
235        </exec>
236        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
237            <arg value="./bundle-messages-countries.sh" />
238        </exec>
239        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
240            <arg value="./bundle-messages-countries.sh" />
241        </exec>
242        <javac source="${javac.version}" target="${javac.version}" 
243               includeAntRuntime="false"
244               srcdir="build/messages-countries-src" destdir="build/obj">
245            <compilerarg line="${javac.compilerargs}" />
246        </javac>
247    </target>
248
249    <target name="extractProxyTags">
250        <java classname="net.i2p.util.TranslateReader" fork="true" failonerror="true">
251            <classpath>
252                <pathelement location="../../../build/i2p.jar" />
253            </classpath>
254            <arg value="tag" />
255            <arg value="../../../installer/resources/initialNews/initialNews.xml" />
256            <arg value="build/News.java" />
257        </java>
258    </target>
259
260    <target name="poupdate-news" depends="extractProxyTags">
261        <!-- set if unset -->
262        <property name="lg2" value="" />
263        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
264            <env key="LG2" value="${lg2}" />
265            <arg value="./bundle-messages-news.sh" />
266            <arg value="-p" />
267        </exec>
268        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
269            <env key="LG2" value="${lg2}" />
270            <arg value="./bundle-messages-news.sh" />
271            <arg value="-p" />
272        </exec>
273        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
274            <env key="LG2" value="${lg2}" />
275            <arg value="./bundle-messages-news.sh" />
276            <arg value="-p" />
277        </exec>
278    </target>
279
280    <target name="poupdate-countries" depends="extractProxyTags">
281        <!-- set if unset -->
282        <property name="lg2" value="" />
283        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
284            <env key="LG2" value="${lg2}" />
285            <arg value="./bundle-messages-countries.sh" />
286            <arg value="-p" />
287        </exec>
288        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
289            <env key="LG2" value="${lg2}" />
290            <arg value="./bundle-messages-countries.sh" />
291            <arg value="-p" />
292        </exec>
293        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
294            <env key="LG2" value="${lg2}" />
295            <arg value="./bundle-messages-countries.sh" />
296            <arg value="-p" />
297        </exec>
298    </target>
299
300    <target name="listChangedFiles2" depends="warUpToDate" if="shouldListChanges2" >
301        <exec executable="mtn" outputproperty="workspace.changes.w" errorproperty="mtn.error2" failifexecutionfails="false" >
302            <arg value="list" />
303            <arg value="changed" />
304            <arg value="../jsp" />
305        </exec>
306        <!-- \n in an attribute value generates an invalid manifest -->
307        <exec executable="tr" inputstring="${workspace.changes.w}" outputproperty="workspace.changes.w.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
308            <arg value="-s" />
309            <arg value="[:space:]" />
310            <arg value="," />
311        </exec>
312    </target>
313
314    <!-- does NOT update the message classes, as those go in the jar -->
315    <target name="war" depends="precompilejsp, warUpToDate, listChangedFiles2" unless="war.uptodate" >
316        <!-- set if unset -->
317        <property name="workspace.changes.w.tr" value="" />
318        <!-- Don't include the css in the war, the main build.xml will copy it to docs/themes/console/ -->
319        <war destfile="build/routerconsole.war" webxml="../jsp/web-out.xml"
320             basedir="../jsp/" excludes="web.xml, *.css, **/*.java, *.jsp, *.jsi, web-fragment.xml, web-out.xml">
321            <manifest>
322                <attribute name="Implementation-Version" value="${full.version}" />
323                <attribute name="Built-By" value="${build.built-by}" />
324                <attribute name="Build-Date" value="${build.timestamp}" />
325                <attribute name="Base-Revision" value="${workspace.version}" />
326                <attribute name="Workspace-Changes" value="${workspace.changes.w.tr}" />
327                <attribute name="X-Compile-Source-JDK" value="${javac.version}" />
328                <attribute name="X-Compile-Target-JDK" value="${javac.version}" />
329            </manifest>
330            <classes dir="./build/obj" includes="net/i2p/router/web/helpers/* net/i2p/router/web/servlets/*" />
331        </war>
332    </target>
333
334    <target name="warUpToDate">
335        <uptodate property="war.uptodate" targetfile="build/routerconsole.war" >
336            <srcfiles dir= "../jsp" excludes="web.xml, web-fragment.xml, *.css, **/*.java, *.jsp, *.jsi" />
337            <srcfiles dir= "build/obj" includes="net/i2p/router/web/helpers/*.class net/i2p/router/web/servlets/*.class" />
338        </uptodate>
339        <condition property="shouldListChanges" >
340            <and>
341                <not>
342                    <isset property="jar.uptodate" />
343                </not>
344                <isset property="mtn.available" />
345            </and>
346        </condition>
347    </target>
348
349    <target name="precompilejsp" depends="jar1" unless="precompilejsp.uptodate">
350        <delete dir="../jsp/WEB-INF/" />
351        <delete file="../jsp/web-fragment.xml" />
352        <delete file="../jsp/web-out.xml" />
353        <mkdir dir="../jsp/WEB-INF/" />
354        <mkdir dir="../jsp/WEB-INF/classes" />
355
356        <!-- there are various jspc ant tasks, but they all seem a bit flakey -->
357        <!--
358           **     Usage: jspc <options> <jsp files>
359           **     where jsp files is
360           **         -webapp <dir>      A directory containing a web-app, whose JSP pages
361           **                            will be processed recursively
362           **     or any number of
363           **         <file>             A file to be parsed as a JSP page
364           **     where options include:
365           **         -help              Print this help message
366           **         -v                 Verbose mode
367           **         -d <dir>           Output Directory (default -Djava.io.tmpdir)
368           **         -l                 Outputs the name of the JSP page upon failure
369           **         -s                 Outputs the name of the JSP page upon success
370           **         -p <name>          Name of target package (default org.apache.jsp)
371           **         -c <name>          Name of target class name (only applies to first JSP page)
372           **         -mapped            Generates separate write() calls for each HTML line in the JSP
373           **         -die[#]            Generates an error return code (#) on fatal errors (default 1)
374           **         -uribase <dir>     The uri directory compilations should be relative to
375           **                            (default "/")
376           **         -uriroot <dir>     Same as -webapp
377           **         -compile           Compiles generated servlets
378           **         -webinc <file>     Creates a partial servlet mappings in the file
379           **         -webxml <file>     Creates a complete web.xml in the file
380           **         -ieplugin <clsid>  Java Plugin classid for Internet Explorer
381           **         -classpath <path>  Overrides java.class.path system property
382           **         -xpoweredBy        Add X-Powered-By response header
383           **         -trimSpaces        Trim spaces in template text between actions, directives
384        -->
385        <java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
386            <!-- this prevents tomcat from complaining in debian builds -->
387            <jvmarg value="-Dtomcat.util.scan.StandardJarScanFilter.jarsToSkip=commons-collections.jar,junit.jar,junit4.jar" />
388            <classpath>
389                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
390                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
391
392                <!-- following jars only present for debian builds -->
393                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
394                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
395                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
396                <pathelement location="../../jetty/jettylib/jasper-el.jar" />
397                <pathelement location="../../jetty/jettylib/tomcat-util.jar" />
398                <pathelement location="../../jetty/jettylib/tomcat-util-scan.jar" />
399
400                <pathelement location="../../jetty/jettylib/commons-el.jar" />
401                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
402                <pathelement location="${ant.home}/lib/ant.jar" />
403                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
404                <pathelement location="../../systray/java/build/obj" />
405                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
406                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
407                <pathelement location="build/obj/" />
408                <pathelement location="../../../router/java/build/router.jar" />
409                <pathelement location="../../../core/java/build/i2p.jar" />
410            </classpath>
411            <arg value="-d" />
412            <arg value="../jsp/WEB-INF/classes" />
413            <arg value="-v" />
414            <arg value="-p" />
415            <arg value="net.i2p.router.web.jsp" />
416            <arg value="-webinc" />
417            <arg value="../jsp/web-fragment.xml" />
418            <arg value="-webapp" />
419            <arg value="../jsp/" />
420        </java>
421       
422        <javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
423               encoding="UTF-8"
424               includeAntRuntime="false"
425               destdir="../jsp/WEB-INF/classes/" 
426               srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
427            <compilerarg line="${javac.compilerargs}" />
428            <classpath>
429                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
430                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
431
432                <!-- following jars only present for debian builds -->
433                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
434                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
435                <pathelement location="../../jetty/jettylib/tomcat-util.jar" />
436                <pathelement location="../../jetty/jettylib/tomcat-util-scan.jar" />
437
438                <pathelement location="../../jetty/jettylib/commons-el.jar" />
439                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
440                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
441                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
442                <pathelement location="../../systray/java/build/obj" />
443                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
444                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
445                <pathelement location="build/obj/" />
446                <pathelement location="../../../router/java/build/router.jar" />
447                <pathelement location="../../../core/java/build/i2p.jar" />
448            </classpath>
449        </javac>
450
451        <!-- save these so we can run gettext on the generated java files later
452        <delete>
453            <fileset dir="../jsp/WEB-INF/" includes="**/*.java" />
454            <fileset dir="../jsp/WEB-INF/" includes="**/*.jsp" />
455        </delete>
456        -->
457        <copy file="../jsp/web.xml" tofile="../jsp/web-out.xml" />
458        <loadfile property="jspc.web.fragment" srcfile="../jsp/web-fragment.xml" />
459        <replace file="../jsp/web-out.xml">
460            <replacefilter token="&lt;!-- precompiled servlets --&gt;" value="${jspc.web.fragment}" />
461        </replace>
462        <!-- Add multipart config to servlets that need them -->
463        <property name="__match1" value="&lt;servlet-class&gt;net.i2p.router.web.jsp." />
464        <property name="__match2" value="_jsp&lt;/servlet-class&gt;" />
465        <property name="__class1" value="${__match1}configplugins${__match2}" />
466        <property name="__class2" value="${__match1}configfamily${__match2}" />
467        <property name="__class3" value="${__match1}configreseed${__match2}" />
468        <property name="__multipart" value="&#10;
469       &lt;multipart-config&gt;&#10;
470           &lt;max-file-size&gt;67108864&lt;/max-file-size&gt;&#10;
471           &lt;max-request-size&gt;67108864&lt;/max-request-size&gt;&#10;
472           &lt;file-size-threshold&gt;262144&lt;/file-size-threshold&gt;&#10;
473       &lt;/multipart-config&gt;" />
474        <replace file="../jsp/web-out.xml">
475            <replacefilter token="${__class1}" value="${__class1}${__multipart}" />
476            <replacefilter token="${__class2}" value="${__class2}${__multipart}" />
477            <replacefilter token="${__class3}" value="${__class3}${__multipart}" />
478        </replace>
479    </target>
480
481    <uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml">
482        <srcfiles dir= "../jsp" includes="**/*.jsp, *.jsi, **/*.html, *.css, susimail/susimail, web.xml"/>
483        <!-- so the version is right on logs.jsp -->
484        <srcfiles dir= "../../../router/java/src/net/i2p/router" includes="RouterVersion.java"/>
485    </uptodate>
486
487    <target name="javadoc">
488        <mkdir dir="./build" />
489        <mkdir dir="./build/javadoc" />
490        <javadoc 
491            sourcepath="./src:../../../core/java/src:../../../router/java/src:../../systray/java/src:../../desktopgui/src" destdir="./build/javadoc" 
492            packagenames="*" 
493            use="true" 
494            splitindex="true" 
495            windowtitle="Router Console" />
496    </target>
497
498    <!-- scala paths -->
499    <target name="scala.init">
500        <property name="scala-library.jar" value="${scalatest.libs}/scala-library.jar" />
501        <property name="scala-xml.jar" value="${scalatest.libs}/scala-xml.jar" />
502        <property name="scalactic.jar" value="${scalatest.libs}/scalactic.jar" />
503        <property name="scalatest.jar" value="${scalatest.libs}/scalatest.jar" />
504        <property name="mockito.home" value="${ant.home}/lib" />
505        <taskdef resource="scala/tools/ant/antlib.xml">
506            <classpath>
507                <pathelement location="${scalatest.libs}/scala-compiler.jar" />
508                <pathelement location="${scalatest.libs}/scala-reflect.jar" />
509                <pathelement location="${scala-library.jar}" />
510            </classpath>
511        </taskdef>
512    </target>
513
514    <!-- unit tests -->
515    <target name="builddepscalatest">
516        <ant dir="../../../router/java/" target="jar" />
517        <ant dir="../../../router/java/" target="jarScalaTest" />
518    </target>
519    <target name="scalatest.compileTest" depends="builddepscalatest, compile, scala.init">
520        <mkdir dir="./build" />
521        <mkdir dir="./build/obj_scala" />
522        <scalac srcdir="./test/scalatest" destdir="./build/obj_scala" deprecation="on" >
523            <classpath>
524                <pathelement location="${scala-library.jar}" />
525                <pathelement location="${scalactic.jar}" />
526                <pathelement location="${scalatest.jar}" />
527                <pathelement location="${mockito.home}/byte-buddy.jar" />
528                <pathelement location="${mockito.home}/objenesis.jar" />
529                <pathelement location="${mockito.home}/mockito-core.jar" />
530                <pathelement location="../../../core/java/build/i2pscalatest.jar" />
531                <pathelement location="../../../router/java/build/routerscalatest.jar" />
532                <pathelement location="./build/obj" />
533            </classpath>
534        </scalac>
535    </target>
536    <!-- preparation of code coverage tool of choice -->
537    <target name="prepareClover" depends="compile" if="with.clover">
538        <taskdef resource="clovertasks"/>
539        <mkdir dir="../../../reports/apps/routerconsole/clover" />
540        <clover-setup initString="../../../reports/apps/routerconsole/clover/coverage.db"/>
541    </target>
542    <target name="prepareCobertura" depends="compile" if="with.cobertura">
543        <taskdef classpath="${with.cobertura}" resource="tasks.properties" onerror="report" />
544        <mkdir dir="./build/obj_cobertura" />
545        <delete file="./cobertura.ser" />
546        <cobertura-instrument todir="./build/obj_cobertura">
547            <fileset dir="./build/obj">
548                <include name="**/*.class"/>
549                <exclude name="**/*Test.class" />
550            </fileset>
551        </cobertura-instrument>
552    </target>
553    <target name="prepareTest" depends="prepareClover, prepareCobertura" />
554    <!-- end preparation of code coverage tool -->
555    <target name="scalatest.test" depends="clean, scalatest.compileTest, prepareTest">
556        <mkdir dir="../../../reports/apps/routerconsole/scalatest/" />
557        <delete>
558            <fileset dir="../../../reports/apps/routerconsole/scalatest">
559                <include name="TEST-*.xml"/>
560            </fileset>
561        </delete>
562        <taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestAntTask">
563            <classpath>
564                <pathelement location="${classpath}" />
565                <pathelement location="${scala-library.jar}" />
566                <pathelement location="${scala-xml.jar}" />
567                <pathelement location="${scalactic.jar}" />
568                <pathelement location="${scalatest.jar}" />
569                <pathelement location="./build/obj_cobertura" />
570                <pathelement location="./build/obj" />
571                <pathelement location="${with.clover}" />
572                <pathelement location="${with.cobertura}" />
573            </classpath>
574        </taskdef>
575        <scalatest runpath="./build/obj_scala" fork="yes" maxmemory="384M">
576            <tagsToExclude>
577                SlowTests
578            </tagsToExclude>
579            <reporter type="stdout" />
580            <reporter type="junitxml" directory="../../../reports/apps/routerconsole/scalatest/" />
581        </scalatest>
582        <!-- fetch the real hostname of this machine -->
583        <exec executable="hostname" outputproperty="host.name"/>
584        <!-- set if unset -->
585        <property name="host.fakename" value="i2ptester" />
586        <!-- replace hostname that junit inserts into reports with fake one -->
587        <replace dir="../../../reports/apps/routerconsole/scalatest/" token="${host.name}" value="${host.fakename}"/>
588    </target>
589    <target name="test" depends="scalatest.test"/>
590    <!-- test reports -->
591    <target name="scalatest.report">
592        <junitreport todir="../../../reports/apps/routerconsole/scalatest">
593            <fileset dir="../../../reports/apps/routerconsole/scalatest">
594                <include name="TEST-*.xml"/>
595            </fileset>
596            <report format="frames" todir="../../../reports/apps/routerconsole/html/scalatest"/>
597        </junitreport>
598    </target>
599    <target name="clover.report" depends="test" if="with.clover">
600        <clover-report>
601            <current outfile="../../../reports/apps/routerconsole/html/clover">
602                <format type="html"/>
603            </current>
604        </clover-report>
605    </target>
606    <target name="cobertura.report" depends="test" if="with.cobertura">
607        <mkdir dir="../../../reports/apps/routerconsole/cobertura" />
608        <cobertura-report format="xml" srcdir="./src" destdir="../../../reports/apps/routerconsole/cobertura" />
609        <mkdir dir="../../../reports/apps/routerconsole/html/cobertura" />
610        <cobertura-report format="html" srcdir="./src" destdir="../../../reports/apps/routerconsole/html/cobertura" />
611        <delete file="./cobertura.ser" />
612    </target>
613    <target name="test.report" depends="scalatest.report, clover.report, cobertura.report"/>
614    <!-- end test reports -->
615    <target name="fulltest" depends="cleandep, test, test.report" />
616    <!-- end unit tests -->
617
618    <target name="clean">
619        <delete dir="./build" />
620        <delete dir="../jsp/WEB-INF/" />
621        <delete file="../jsp/web-fragment.xml" />
622        <delete file="../jsp/web-out.xml" />
623    </target>
624    <target name="cleandep" depends="clean">
625    </target>
626    <target name="distclean" depends="clean">
627    </target>
628</project>
Note: See TracBrowser for help on using the repository browser.