source: apps/routerconsole/java/build.xml @ 6b53a4f

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

Build: Fix hang with Tomcat 8.5.33+ (ticket #2307)

  • Property mode set to 100644
File size: 34.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/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             Warning - jspC will fail on unknown options,
358             check oldest libtomcat8-java distro package version we use.
359             Jessie has 8.0.14; xenial has 8.0.32; we bundle for precise/trusty.
360             Add below to get supported options:
361                <arg value="-help" />
362          -->
363        <!--
364           **     Usage: jspc <options> <jsp files>
365           **     where jsp files is
366           **         -webapp <dir>      A directory containing a web-app, whose JSP pages
367           **                            will be processed recursively
368           **     or any number of
369           **         <file>             A file to be parsed as a JSP page
370           **     where options include:
371           **         -help              Print this help message
372           **         -v                 Verbose mode
373           **         -d <dir>           Output Directory (default -Djava.io.tmpdir)
374           **         -l                 Outputs the name of the JSP page upon failure
375           **         -s                 Outputs the name of the JSP page upon success
376           **         -p <name>          Name of target package (default org.apache.jsp)
377           **         -c <name>          Name of target class name (only applies to first JSP page)
378           **         -mapped            Generates separate write() calls for each HTML line in the JSP
379           **         -die[#]            Generates an error return code (#) on fatal errors (default 1)
380           **         -uribase <dir>     The uri directory compilations should be relative to
381           **                            (default "/")
382           **         -uriroot <dir>     Same as -webapp
383           **         -compile           Compiles generated servlets
384           **         -webinc <file>     Creates a partial servlet mappings in the file
385           **         -webxml <file>     Creates a complete web.xml in the file
386           **         -ieplugin <clsid>  Java Plugin classid for Internet Explorer
387           **         -classpath <path>  Overrides java.class.path system property
388           **         -xpoweredBy        Add X-Powered-By response header
389           **         -trimSpaces        Trim spaces in template text between actions, directives
390           **     Following as of ?.?.??:
391           **         -javaEncoding <enc> Set the encoding charset for Java classes (default UTF-8)
392           **         -source <version>   Set the -source argument to the compiler (default 1.7)
393           **         -target <version>   Set the -target argument to the compiler (default 1.7)
394           **     Following as of 8.5.33:
395           **         -threadCount <count>  Number of threads to use for compilation.
396           **                               (default one per core)
397           **                               ("2.0C" means two threads per core)
398        -->
399        <!--
400           **  Simply call org.apache.jasper.JspC, then exit.
401           **
402           **  As of Tomcat 8.5.33, forking their JspC won't complete,
403           **  because the JspC compilation is now threaded and the thread pool workers aren't daemons.
404           **  May be fixed in a future release, maybe not, but we don't know what version distros may have.
405           **
406           **  https://tomcat.apache.org/tomcat-8.5-doc/changelog.html
407           **  https://bz.apache.org/bugzilla/show_bug.cgi?id=53492
408           **
409           **  We could set fork=false in build.xml, but then the paths are all wrong.
410        -->
411        <java classname="net.i2p.servlet.util.JspC" fork="true" failonerror="true">
412            <!-- this prevents tomcat from complaining in debian builds -->
413            <jvmarg value="-Dtomcat.util.scan.StandardJarScanFilter.jarsToSkip=commons-collections.jar,junit.jar,junit4.jar" />
414            <classpath>
415                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
416                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
417
418                <!-- following jars only present for debian builds -->
419                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
420                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
421                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
422                <pathelement location="../../jetty/jettylib/jasper-el.jar" />
423                <pathelement location="../../jetty/jettylib/tomcat-util.jar" />
424                <pathelement location="../../jetty/jettylib/tomcat-util-scan.jar" />
425
426                <pathelement location="../../jetty/jettylib/commons-el.jar" />
427                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
428                <pathelement location="${ant.home}/lib/ant.jar" />
429                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
430                <pathelement location="../../systray/java/build/obj" />
431                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
432                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
433                <pathelement location="build/obj/" />
434                <pathelement location="../../../router/java/build/router.jar" />
435                <pathelement location="../../../core/java/build/i2p.jar" />
436            </classpath>
437            <arg value="-d" />
438            <arg value="../jsp/WEB-INF/classes" />
439            <arg value="-v" />
440            <arg value="-p" />
441            <arg value="net.i2p.router.web.jsp" />
442            <arg value="-webinc" />
443            <arg value="../jsp/web-fragment.xml" />
444            <arg value="-webapp" />
445            <arg value="../jsp/" />
446        </java>
447       
448        <javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
449               encoding="UTF-8"
450               includeAntRuntime="false"
451               destdir="../jsp/WEB-INF/classes/" 
452               srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
453            <compilerarg line="${javac.compilerargs}" />
454            <classpath>
455                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
456                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
457
458                <!-- following jars only present for debian builds -->
459                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
460                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
461                <pathelement location="../../jetty/jettylib/tomcat-util.jar" />
462                <pathelement location="../../jetty/jettylib/tomcat-util-scan.jar" />
463
464                <pathelement location="../../jetty/jettylib/commons-el.jar" />
465                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
466                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
467                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
468                <pathelement location="../../systray/java/build/obj" />
469                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
470                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
471                <pathelement location="build/obj/" />
472                <pathelement location="../../../router/java/build/router.jar" />
473                <pathelement location="../../../core/java/build/i2p.jar" />
474            </classpath>
475        </javac>
476
477        <!-- save these so we can run gettext on the generated java files later
478        <delete>
479            <fileset dir="../jsp/WEB-INF/" includes="**/*.java" />
480            <fileset dir="../jsp/WEB-INF/" includes="**/*.jsp" />
481        </delete>
482        -->
483        <copy file="../jsp/web.xml" tofile="../jsp/web-out.xml" />
484        <loadfile property="jspc.web.fragment" srcfile="../jsp/web-fragment.xml" />
485        <replace file="../jsp/web-out.xml">
486            <replacefilter token="&lt;!-- precompiled servlets --&gt;" value="${jspc.web.fragment}" />
487        </replace>
488        <!-- Add multipart config to servlets that need them -->
489        <property name="__match1" value="&lt;servlet-class&gt;net.i2p.router.web.jsp." />
490        <property name="__match2" value="_jsp&lt;/servlet-class&gt;" />
491        <property name="__class1" value="${__match1}configplugins${__match2}" />
492        <property name="__class2" value="${__match1}configfamily${__match2}" />
493        <property name="__class3" value="${__match1}configreseed${__match2}" />
494        <property name="__multipart" value="&#10;
495       &lt;multipart-config&gt;&#10;
496           &lt;max-file-size&gt;67108864&lt;/max-file-size&gt;&#10;
497           &lt;max-request-size&gt;67108864&lt;/max-request-size&gt;&#10;
498           &lt;file-size-threshold&gt;262144&lt;/file-size-threshold&gt;&#10;
499       &lt;/multipart-config&gt;" />
500        <replace file="../jsp/web-out.xml">
501            <replacefilter token="${__class1}" value="${__class1}${__multipart}" />
502            <replacefilter token="${__class2}" value="${__class2}${__multipart}" />
503            <replacefilter token="${__class3}" value="${__class3}${__multipart}" />
504        </replace>
505    </target>
506
507    <uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml">
508        <srcfiles dir= "../jsp" includes="**/*.jsp, *.jsi, **/*.html, *.css, susimail/susimail, web.xml"/>
509        <!-- so the version is right on logs.jsp -->
510        <srcfiles dir= "../../../router/java/src/net/i2p/router" includes="RouterVersion.java"/>
511    </uptodate>
512
513    <target name="javadoc">
514        <mkdir dir="./build" />
515        <mkdir dir="./build/javadoc" />
516        <javadoc 
517            sourcepath="./src:../../../core/java/src:../../../router/java/src:../../systray/java/src:../../desktopgui/src" destdir="./build/javadoc" 
518            packagenames="*" 
519            use="true" 
520            splitindex="true" 
521            windowtitle="Router Console" />
522    </target>
523
524    <!-- scala paths -->
525    <target name="scala.init">
526        <property name="scala-library.jar" value="${scalatest.libs}/scala-library.jar" />
527        <property name="scala-xml.jar" value="${scalatest.libs}/scala-xml.jar" />
528        <property name="scalactic.jar" value="${scalatest.libs}/scalactic.jar" />
529        <property name="scalatest.jar" value="${scalatest.libs}/scalatest.jar" />
530        <property name="mockito.home" value="${ant.home}/lib" />
531        <taskdef resource="scala/tools/ant/antlib.xml">
532            <classpath>
533                <pathelement location="${scalatest.libs}/scala-compiler.jar" />
534                <pathelement location="${scalatest.libs}/scala-reflect.jar" />
535                <pathelement location="${scala-library.jar}" />
536            </classpath>
537        </taskdef>
538    </target>
539
540    <!-- unit tests -->
541    <target name="builddepscalatest">
542        <ant dir="../../../router/java/" target="jar" />
543        <ant dir="../../../router/java/" target="jarScalaTest" />
544    </target>
545    <target name="scalatest.compileTest" depends="builddepscalatest, compile, scala.init">
546        <mkdir dir="./build" />
547        <mkdir dir="./build/obj_scala" />
548        <scalac srcdir="./test/scalatest" destdir="./build/obj_scala" deprecation="on" >
549            <classpath>
550                <pathelement location="${scala-library.jar}" />
551                <pathelement location="${scalactic.jar}" />
552                <pathelement location="${scalatest.jar}" />
553                <pathelement location="${mockito.home}/byte-buddy.jar" />
554                <pathelement location="${mockito.home}/objenesis.jar" />
555                <pathelement location="${mockito.home}/mockito-core.jar" />
556                <pathelement location="../../../core/java/build/i2pscalatest.jar" />
557                <pathelement location="../../../router/java/build/routerscalatest.jar" />
558                <pathelement location="./build/obj" />
559            </classpath>
560        </scalac>
561    </target>
562    <!-- preparation of code coverage tool of choice -->
563    <target name="prepareClover" depends="compile" if="with.clover">
564        <taskdef resource="clovertasks"/>
565        <mkdir dir="../../../reports/apps/routerconsole/clover" />
566        <clover-setup initString="../../../reports/apps/routerconsole/clover/coverage.db"/>
567    </target>
568    <target name="prepareCobertura" depends="compile" if="with.cobertura">
569        <taskdef classpath="${with.cobertura}" resource="tasks.properties" onerror="report" />
570        <mkdir dir="./build/obj_cobertura" />
571        <delete file="./cobertura.ser" />
572        <cobertura-instrument todir="./build/obj_cobertura">
573            <fileset dir="./build/obj">
574                <include name="**/*.class"/>
575                <exclude name="**/*Test.class" />
576            </fileset>
577        </cobertura-instrument>
578    </target>
579    <target name="prepareTest" depends="prepareClover, prepareCobertura" />
580    <!-- end preparation of code coverage tool -->
581    <target name="scalatest.test" depends="clean, scalatest.compileTest, prepareTest">
582        <mkdir dir="../../../reports/apps/routerconsole/scalatest/" />
583        <delete>
584            <fileset dir="../../../reports/apps/routerconsole/scalatest">
585                <include name="TEST-*.xml"/>
586            </fileset>
587        </delete>
588        <taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestAntTask">
589            <classpath>
590                <pathelement location="${classpath}" />
591                <pathelement location="${scala-library.jar}" />
592                <pathelement location="${scala-xml.jar}" />
593                <pathelement location="${scalactic.jar}" />
594                <pathelement location="${scalatest.jar}" />
595                <pathelement location="./build/obj_cobertura" />
596                <pathelement location="./build/obj" />
597                <pathelement location="${with.clover}" />
598                <pathelement location="${with.cobertura}" />
599            </classpath>
600        </taskdef>
601        <scalatest runpath="./build/obj_scala" fork="yes" maxmemory="384M">
602            <tagsToExclude>
603                SlowTests
604            </tagsToExclude>
605            <reporter type="stdout" />
606            <reporter type="junitxml" directory="../../../reports/apps/routerconsole/scalatest/" />
607        </scalatest>
608        <!-- fetch the real hostname of this machine -->
609        <exec executable="hostname" outputproperty="host.name"/>
610        <!-- set if unset -->
611        <property name="host.fakename" value="i2ptester" />
612        <!-- replace hostname that junit inserts into reports with fake one -->
613        <replace dir="../../../reports/apps/routerconsole/scalatest/" token="${host.name}" value="${host.fakename}"/>
614    </target>
615    <target name="test" depends="scalatest.test"/>
616    <!-- test reports -->
617    <target name="scalatest.report">
618        <junitreport todir="../../../reports/apps/routerconsole/scalatest">
619            <fileset dir="../../../reports/apps/routerconsole/scalatest">
620                <include name="TEST-*.xml"/>
621            </fileset>
622            <report format="frames" todir="../../../reports/apps/routerconsole/html/scalatest"/>
623        </junitreport>
624    </target>
625    <target name="clover.report" depends="test" if="with.clover">
626        <clover-report>
627            <current outfile="../../../reports/apps/routerconsole/html/clover">
628                <format type="html"/>
629            </current>
630        </clover-report>
631    </target>
632    <target name="cobertura.report" depends="test" if="with.cobertura">
633        <mkdir dir="../../../reports/apps/routerconsole/cobertura" />
634        <cobertura-report format="xml" srcdir="./src" destdir="../../../reports/apps/routerconsole/cobertura" />
635        <mkdir dir="../../../reports/apps/routerconsole/html/cobertura" />
636        <cobertura-report format="html" srcdir="./src" destdir="../../../reports/apps/routerconsole/html/cobertura" />
637        <delete file="./cobertura.ser" />
638    </target>
639    <target name="test.report" depends="scalatest.report, clover.report, cobertura.report"/>
640    <!-- end test reports -->
641    <target name="fulltest" depends="cleandep, test, test.report" />
642    <!-- end unit tests -->
643
644    <target name="clean">
645        <delete dir="./build" />
646        <delete dir="../jsp/WEB-INF/" />
647        <delete file="../jsp/web-fragment.xml" />
648        <delete file="../jsp/web-out.xml" />
649    </target>
650    <target name="cleandep" depends="clean">
651    </target>
652    <target name="distclean" depends="clean">
653    </target>
654</project>
Note: See TracBrowser for help on using the repository browser.