source: apps/routerconsole/java/build.xml @ 85db853

Last change on this file since 85db853 was 3527f25, checked in by zzz <zzz@…>, 23 months ago

Debian: Add build option for libtomcat9 (ticket #2364)

  • Property mode set to 100644
File size: 36.1 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project basedir="." default="all" name="routerconsole">
3    <target name="all" depends="clean, build" />
4    <target name="build" depends="builddep, jar" />
5    <target name="builddep">
6        <!-- run from top level build.xml to get dependencies built -->
7    </target>
8    <target name="prepare">
9        <!-- run from top level build.xml to get dependencies built -->
10    </target>
11    <condition property="no.bundle">
12        <isfalse value="${require.gettext}" />
13    </condition>
14    <condition property="depend.available">
15        <typefound name="depend" />
16    </condition>
17    <target name="depend" if="depend.available">
18        <depend
19            cache="../../../build"
20            srcdir="./src" 
21            destdir="./build/obj" >
22            <!-- Depend on classes instead of jars where available -->
23            <classpath>
24                <pathelement location="../../../core/java/build/obj" />
25                <pathelement location="../../../router/java/build/obj" />
26                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
27                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
28                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
29                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
30                <pathelement location="../../systray/java/build/obj" />
31                <pathelement location="../../desktopgui/build" />
32                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
33                <pathelement location="../../jrobin/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    <!-- only used if not set by a higher build.xml -->
50    <property name="javac.compilerargs" value="" />
51    <property name="javac.version" value="1.7" />
52    <property name="manifest.classpath.name" value="Class-Path" />
53
54    <target name="compile" depends="prepare, depend, dependVersion">
55        <mkdir dir="./build" />
56        <mkdir dir="./build/obj" />
57        <javac 
58            srcdir="./src" 
59            debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
60            includeAntRuntime="false"
61            destdir="./build/obj">
62            <compilerarg line="${javac.compilerargs}" />
63            <classpath>
64                <pathelement location="../../../core/java/build/i2p.jar" />
65                <pathelement location="../../../router/java/build/router.jar" />
66                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
67                <pathelement location="../../jetty/jettylib/jetty-http.jar" />
68                <pathelement location="../../jetty/jettylib/jetty-io.jar" />
69                <pathelement location="../../jetty/jettylib/jetty-security.jar" />
70                <pathelement location="../../jetty/jettylib/jetty-servlet.jar" />
71                <pathelement location="../../jetty/jettylib/jetty-servlets.jar" />
72                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
73                <pathelement location="../../jetty/jettylib/jetty-webapp.jar" />
74                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
75                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
76                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
77                <pathelement location="../../systray/java/build/systray.jar" />
78                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
79                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
80                <pathelement location="../../jrobin/java/build/jrobin.jar" />
81
82                <!-- following jars only present for debian builds -->
83                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
84                <pathelement location="../../../core/java/build/json-simple.jar" />
85            </classpath>
86        </javac>
87    </target>
88
89    <!-- newsxml.jar only (subset of routerconsole, no war) for Android -->
90    <target name="compileNewsOnly" depends="prepare, depend, dependVersion">
91        <mkdir dir="./build" />
92        <mkdir dir="./build/obj" />
93        <javac 
94            srcdir="./src" 
95            includes="net/i2p/router/news/*.java"
96            debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
97            includeAntRuntime="false"
98            destdir="./build/obj">
99            <compilerarg line="${javac.compilerargs}" />
100            <classpath>
101                <pathelement location="../../../core/java/build/i2p.jar" />
102                <pathelement location="../../../router/java/build/router.jar" />
103            </classpath>
104        </javac>
105    </target>
106
107    <!-- the jar with the latest message classes from the jsps, and the war too -->
108    <target name="jar" depends="jar1, war, bundle" />
109
110    <!-- the jar without the latest message classes from the jsps -->
111    <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" >
112        <exec executable="mtn" outputproperty="workspace.changes.j" errorproperty="mtn.error2" failifexecutionfails="false" >
113            <arg value="list" />
114            <arg value="changed" />
115            <arg value="." />
116            <arg value="../locale" />
117        </exec>
118        <!-- \n in an attribute value generates an invalid manifest -->
119        <exec executable="tr" inputstring="${workspace.changes.j}" outputproperty="workspace.changes.j.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
120            <arg value="-s" />
121            <arg value="[:space:]" />
122            <arg value="," />
123        </exec>
124    </target>
125
126    <target name="jar1" depends="compile, bundle-news, bundle-countries, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
127        <!-- set if unset -->
128        <property name="workspace.changes.j.tr" value="" />
129        <!-- copy the NDT translations, strip the countries -->
130        <copy file="src/edu/internet2/ndt/locale/Tcpbw100_msgs_en_US.properties" tofile="build/obj/edu/internet2/ndt/locale/Tcpbw100_msgs.properties" />
131        <copy file="src/edu/internet2/ndt/locale/Tcpbw100_msgs_ca_ES.properties" tofile="build/obj/edu/internet2/ndt/locale/Tcpbw100_msgs_ca.properties" />
132        <copy file="src/edu/internet2/ndt/locale/Tcpbw100_msgs_el_GR.properties" tofile="build/obj/edu/internet2/ndt/locale/Tcpbw100_msgs_el.properties" />
133        <copy file="src/edu/internet2/ndt/locale/Tcpbw100_msgs_fr_FR.properties" tofile="build/obj/edu/internet2/ndt/locale/Tcpbw100_msgs_fr.properties" />
134        <copy file="src/edu/internet2/ndt/locale/Tcpbw100_msgs_nb_NO.properties" tofile="build/obj/edu/internet2/ndt/locale/Tcpbw100_msgs_nb.properties" />
135        <copy file="src/edu/internet2/ndt/locale/Tcpbw100_msgs_nl_NL.properties" tofile="build/obj/edu/internet2/ndt/locale/Tcpbw100_msgs_nl.properties" />
136        <copy file="src/edu/internet2/ndt/locale/Tcpbw100_msgs_pt_BR.properties" tofile="build/obj/edu/internet2/ndt/locale/Tcpbw100_msgs_pt.properties" />
137        <copy file="src/edu/internet2/ndt/locale/Tcpbw100_msgs_ru_RU.properties" tofile="build/obj/edu/internet2/ndt/locale/Tcpbw100_msgs_ru.properties" />
138        <jar destfile="./build/routerconsole.jar" basedir="./build/obj" excludes="net/i2p/router/web/helpers/* net/i2p/router/web/servlets/*">
139            <manifest>
140                <!-- DTG added in 0.8.4, not in the classpath for very old installs, before we changed wrapper.config to specify * -->
141                <!-- very old installs don't have i2psnark,jstl,standard in the classpath... not added in WebAppConfiguration any more -->
142                <!-- All new jetty 7 jars should have been in 0.9.6, added in 0.9.7 -->
143                <attribute name="${manifest.classpath.name}" 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" />
144                <attribute name="Implementation-Version" value="${full.version}" />
145                <attribute name="Built-By" value="${build.built-by}" />
146                <attribute name="Build-Date" value="${build.timestamp}" />
147                <attribute name="Base-Revision" value="${workspace.version}" />
148                <attribute name="Main-Class" value="net.i2p.router.news.CommandLine" />
149                <attribute name="Workspace-Changes" value="${workspace.changes.j.tr}" />
150                <attribute name="X-Compile-Source-JDK" value="${javac.version}" />
151                <attribute name="X-Compile-Target-JDK" value="${javac.version}" />
152            </manifest>
153        </jar>
154    </target>
155
156    <!-- newsxml.jar only (subset of routerconsole, no war) for Android -->
157    <target name="newsxmljar" depends="compileNewsOnly" >
158        <jar destfile="./build/newsxml.jar" basedir="./build/obj" includes="**/*.class">
159        </jar>
160    </target>
161
162    <!-- this is tricky because the message classes go in the jar, not in the war -->
163    <target name="bundle" depends="jar1, precompilejsp" unless="no.bundle">
164        <mkdir dir="build/messages-src" />
165        <!-- Update the messages_*.po files.
166             We need to supply the bat file for windows, and then change the fail property to true -->
167        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
168            <env key="JAVA_HOME" value="${java.home}" />
169            <arg value="./bundle-messages.sh" />
170        </exec>
171        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
172            <arg value="./bundle-messages.sh" />
173        </exec>
174                <!-- multi-lang is optional -->
175        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
176            <arg value="./bundle-messages.sh" />
177        </exec>
178        <javac source="${javac.version}" target="${javac.version}" 
179               includeAntRuntime="false"
180               srcdir="build/messages-src" destdir="build/obj">
181            <compilerarg line="${javac.compilerargs}" />
182        </javac>
183        <!-- jar again to get the latest messages_*.class files -->
184        <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/messages_*.class" update="true" />
185    </target>
186
187    <target name="jarUpToDate">
188        <uptodate property="jar.uptodate" targetfile="build/routerconsole.jar" >
189            <srcfiles dir= "build/obj" includes="**/*.class" />
190        </uptodate>
191        <condition property="shouldListChanges" >
192            <and>
193                <not>
194                    <isset property="jar.uptodate" />
195                </not>
196                <isset property="mtn.available" />
197            </and>
198        </condition>
199    </target>
200
201    <target name="poupdate" depends="precompilejsp">
202        <!-- Update the messages_*.po files.
203             We need to supply the bat file for windows, and then change the fail property to true -->
204        <!-- set if unset -->
205        <property name="lg2" value="" />
206        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
207            <env key="LG2" value="${lg2}" />
208            <arg value="./bundle-messages.sh" />
209            <arg value="-p" />
210        </exec>
211        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
212            <env key="LG2" value="${lg2}" />
213            <arg value="./bundle-messages.sh" />
214            <arg value="-p" />
215        </exec>
216        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
217            <env key="LG2" value="${lg2}" />
218            <arg value="./bundle-messages.sh" />
219            <arg value="-p" />
220        </exec>
221    </target>
222
223    <target name="bundle-news" unless="no.bundle">
224        <mkdir dir="build/messages-news-src" />
225        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
226            <env key="JAVA_HOME" value="${java.home}" />
227            <arg value="./bundle-messages-news.sh" />
228        </exec>
229        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
230            <arg value="./bundle-messages-news.sh" />
231        </exec>
232        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
233            <arg value="./bundle-messages-news.sh" />
234        </exec>
235        <javac source="${javac.version}" target="${javac.version}" 
236               includeAntRuntime="false"
237               srcdir="build/messages-news-src" destdir="build/obj">
238            <compilerarg line="${javac.compilerargs}" />
239        </javac>
240    </target>
241
242    <target name="bundle-countries" unless="no.bundle">
243        <mkdir dir="build/messages-countries-src" />
244        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
245            <env key="JAVA_HOME" value="${java.home}" />
246            <arg value="./bundle-messages-countries.sh" />
247        </exec>
248        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
249            <arg value="./bundle-messages-countries.sh" />
250        </exec>
251        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
252            <arg value="./bundle-messages-countries.sh" />
253        </exec>
254        <javac source="${javac.version}" target="${javac.version}" 
255               includeAntRuntime="false"
256               srcdir="build/messages-countries-src" destdir="build/obj">
257            <compilerarg line="${javac.compilerargs}" />
258        </javac>
259    </target>
260
261    <target name="extractProxyTags">
262        <java classname="net.i2p.util.TranslateReader" fork="true" failonerror="true">
263            <classpath>
264                <pathelement location="../../../build/i2p.jar" />
265            </classpath>
266            <arg value="tag" />
267            <arg value="../../../installer/resources/initialNews/initialNews.xml" />
268            <arg value="build/News.java" />
269        </java>
270    </target>
271
272    <target name="poupdate-news" depends="extractProxyTags">
273        <!-- set if unset -->
274        <property name="lg2" value="" />
275        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
276            <env key="LG2" value="${lg2}" />
277            <arg value="./bundle-messages-news.sh" />
278            <arg value="-p" />
279        </exec>
280        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
281            <env key="LG2" value="${lg2}" />
282            <arg value="./bundle-messages-news.sh" />
283            <arg value="-p" />
284        </exec>
285        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
286            <env key="LG2" value="${lg2}" />
287            <arg value="./bundle-messages-news.sh" />
288            <arg value="-p" />
289        </exec>
290    </target>
291
292    <target name="poupdate-countries" depends="extractProxyTags">
293        <!-- set if unset -->
294        <property name="lg2" value="" />
295        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
296            <env key="LG2" value="${lg2}" />
297            <arg value="./bundle-messages-countries.sh" />
298            <arg value="-p" />
299        </exec>
300        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
301            <env key="LG2" value="${lg2}" />
302            <arg value="./bundle-messages-countries.sh" />
303            <arg value="-p" />
304        </exec>
305        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
306            <env key="LG2" value="${lg2}" />
307            <arg value="./bundle-messages-countries.sh" />
308            <arg value="-p" />
309        </exec>
310    </target>
311
312    <target name="listChangedFiles2" depends="warUpToDate" if="shouldListChanges2" >
313        <exec executable="mtn" outputproperty="workspace.changes.w" errorproperty="mtn.error2" failifexecutionfails="false" >
314            <arg value="list" />
315            <arg value="changed" />
316            <arg value="../jsp" />
317        </exec>
318        <!-- \n in an attribute value generates an invalid manifest -->
319        <exec executable="tr" inputstring="${workspace.changes.w}" outputproperty="workspace.changes.w.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
320            <arg value="-s" />
321            <arg value="[:space:]" />
322            <arg value="," />
323        </exec>
324    </target>
325
326    <!-- does NOT update the message classes, as those go in the jar -->
327    <target name="war" depends="precompilejsp, warUpToDate, listChangedFiles2" unless="war.uptodate" >
328        <!-- set if unset -->
329        <property name="workspace.changes.w.tr" value="" />
330        <!-- Don't include the css in the war, the main build.xml will copy it to docs/themes/console/ -->
331        <war destfile="build/routerconsole.war" webxml="../jsp/web-out.xml"
332             basedir="../jsp/" excludes="web.xml, *.css, **/*.java, *.jsp, *.jsi, web-fragment.xml, web-out.xml">
333            <manifest>
334                <attribute name="Implementation-Version" value="${full.version}" />
335                <attribute name="Built-By" value="${build.built-by}" />
336                <attribute name="Build-Date" value="${build.timestamp}" />
337                <attribute name="Base-Revision" value="${workspace.version}" />
338                <attribute name="Workspace-Changes" value="${workspace.changes.w.tr}" />
339                <attribute name="X-Compile-Source-JDK" value="${javac.version}" />
340                <attribute name="X-Compile-Target-JDK" value="${javac.version}" />
341            </manifest>
342            <classes dir="./build/obj" includes="net/i2p/router/web/helpers/* net/i2p/router/web/servlets/*" />
343        </war>
344    </target>
345
346    <target name="warUpToDate">
347        <uptodate property="war.uptodate" targetfile="build/routerconsole.war" >
348            <srcfiles dir= "../jsp" excludes="web.xml, web-fragment.xml, *.css, **/*.java, *.jsp, *.jsi" />
349            <srcfiles dir= "build/obj" includes="net/i2p/router/web/helpers/*.class net/i2p/router/web/servlets/*.class" />
350        </uptodate>
351        <condition property="shouldListChanges" >
352            <and>
353                <not>
354                    <isset property="jar.uptodate" />
355                </not>
356                <isset property="mtn.available" />
357            </and>
358        </condition>
359    </target>
360
361    <target name="precompilejsp" depends="jar1" unless="precompilejsp.uptodate">
362        <delete dir="../jsp/WEB-INF/" />
363        <delete file="../jsp/web-fragment.xml" />
364        <delete file="../jsp/web-out.xml" />
365        <mkdir dir="../jsp/WEB-INF/" />
366        <mkdir dir="../jsp/WEB-INF/classes" />
367
368        <!-- There are various jspc ant tasks, but they all seem a bit flakey.
369             Warning - jspC will fail on unknown options,
370             check oldest libtomcat8-java distro package version we use.
371             Jessie has 8.0.14; xenial has 8.0.32; we bundle for precise/trusty.
372             Add below to get supported options:
373                <arg value="-help" />
374          -->
375        <!--
376           **     Usage: jspc <options> <jsp files>
377           **     where jsp files is
378           **         -webapp <dir>      A directory containing a web-app, whose JSP pages
379           **                            will be processed recursively
380           **     or any number of
381           **         <file>             A file to be parsed as a JSP page
382           **     where options include:
383           **         -help              Print this help message
384           **         -v                 Verbose mode
385           **         -d <dir>           Output Directory (default -Djava.io.tmpdir)
386           **         -l                 Outputs the name of the JSP page upon failure
387           **         -s                 Outputs the name of the JSP page upon success
388           **         -p <name>          Name of target package (default org.apache.jsp)
389           **         -c <name>          Name of target class name (only applies to first JSP page)
390           **         -mapped            Generates separate write() calls for each HTML line in the JSP
391           **         -die[#]            Generates an error return code (#) on fatal errors (default 1)
392           **         -uribase <dir>     The uri directory compilations should be relative to
393           **                            (default "/")
394           **         -uriroot <dir>     Same as -webapp
395           **         -compile           Compiles generated servlets
396           **         -webinc <file>     Creates a partial servlet mappings in the file
397           **         -webxml <file>     Creates a complete web.xml in the file
398           **         -ieplugin <clsid>  Java Plugin classid for Internet Explorer
399           **         -classpath <path>  Overrides java.class.path system property
400           **         -xpoweredBy        Add X-Powered-By response header
401           **         -trimSpaces        Trim spaces in template text between actions, directives
402           **     Following as of ?.?.??:
403           **         -javaEncoding <enc> Set the encoding charset for Java classes (default UTF-8)
404           **         -source <version>   Set the -source argument to the compiler (default 1.7)
405           **         -target <version>   Set the -target argument to the compiler (default 1.7)
406           **     Following as of 8.5.33:
407           **         -threadCount <count>  Number of threads to use for compilation.
408           **                               (default one per core)
409           **                               ("2.0C" means two threads per core)
410        -->
411        <!--
412           **  Simply call org.apache.jasper.JspC, then exit.
413           **
414           **  As of Tomcat 8.5.33, forking their JspC won't complete,
415           **  because the JspC compilation is now threaded and the thread pool workers aren't daemons.
416           **  Will be fixed in 8.5.35, but we don't know what version distros may have.
417           **
418           **  https://tomcat.apache.org/tomcat-8.5-doc/changelog.html
419           **  https://bz.apache.org/bugzilla/show_bug.cgi?id=53492
420           **  http://trac.i2p2.i2p/ticket/2307
421           **  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908884
422           **  https://bz.apache.org/bugzilla/show_bug.cgi?id=62674
423           **
424           **  We could set fork=false in build.xml, but then the paths are all wrong.
425        -->
426        <java classname="net.i2p.servlet.util.JspC" fork="true" failonerror="true">
427            <!-- this prevents tomcat from complaining in debian builds -->
428            <jvmarg value="-Dtomcat.util.scan.StandardJarScanFilter.jarsToSkip=commons-collections.jar,junit.jar,junit4.jar" />
429            <!-- these are to detect tomcat version and reproducible build setting -->
430            <jvmarg value="-Dbuild.reproducible=${build.reproducible}" />
431            <jvmarg value="-Dwith-libtomcat8-java=${with-libtomcat8-java}" />
432            <jvmarg value="-Dwith-libtomcat9-java=${with-libtomcat9-java}" />
433            <jvmarg value="-Djasper.jar=../../jetty/jettylib/jasper-runtime.jar" />
434            <classpath>
435                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
436                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
437
438                <!-- following jars only present for debian builds -->
439                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
440                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
441                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
442                <pathelement location="../../jetty/jettylib/jasper-el.jar" />
443                <pathelement location="../../jetty/jettylib/tomcat-util.jar" />
444                <pathelement location="../../jetty/jettylib/tomcat-util-scan.jar" />
445
446                <pathelement location="../../jetty/jettylib/commons-el.jar" />
447                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
448                <pathelement location="${ant.home}/lib/ant.jar" />
449                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
450                <pathelement location="../../systray/java/build/obj" />
451                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
452                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
453                <pathelement location="build/obj/" />
454                <pathelement location="../../../router/java/build/router.jar" />
455                <pathelement location="../../../core/java/build/i2p.jar" />
456            </classpath>
457            <arg value="-d" />
458            <arg value="../jsp/WEB-INF/classes" />
459            <arg value="-v" />
460            <arg value="-p" />
461            <arg value="net.i2p.router.web.jsp" />
462            <arg value="-webinc" />
463            <arg value="../jsp/web-fragment.xml" />
464            <arg value="-webapp" />
465            <arg value="../jsp/" />
466        </java>
467       
468        <javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
469               encoding="UTF-8"
470               includeAntRuntime="false"
471               destdir="../jsp/WEB-INF/classes/" 
472               srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
473            <compilerarg line="${javac.compilerargs}" />
474            <classpath>
475                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
476                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
477
478                <!-- following jars only present for debian builds -->
479                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
480                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
481                <pathelement location="../../jetty/jettylib/tomcat-util.jar" />
482                <pathelement location="../../jetty/jettylib/tomcat-util-scan.jar" />
483
484                <pathelement location="../../jetty/jettylib/commons-el.jar" />
485                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
486                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
487                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
488                <pathelement location="../../systray/java/build/obj" />
489                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
490                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
491                <pathelement location="build/obj/" />
492                <pathelement location="../../../router/java/build/router.jar" />
493                <pathelement location="../../../core/java/build/i2p.jar" />
494            </classpath>
495        </javac>
496
497        <!-- save these so we can run gettext on the generated java files later
498        <delete>
499            <fileset dir="../jsp/WEB-INF/" includes="**/*.java" />
500            <fileset dir="../jsp/WEB-INF/" includes="**/*.jsp" />
501        </delete>
502        -->
503        <copy file="../jsp/web.xml" tofile="../jsp/web-out.xml" />
504        <loadfile property="jspc.web.fragment" srcfile="../jsp/web-fragment.xml" />
505        <replace file="../jsp/web-out.xml">
506            <replacefilter token="&lt;!-- precompiled servlets --&gt;" value="${jspc.web.fragment}" />
507        </replace>
508        <!-- Add multipart config to servlets that need them -->
509        <property name="__match1" value="&lt;servlet-class&gt;net.i2p.router.web.jsp." />
510        <property name="__match2" value="_jsp&lt;/servlet-class&gt;" />
511        <property name="__class1" value="${__match1}configplugins${__match2}" />
512        <property name="__class2" value="${__match1}configfamily${__match2}" />
513        <property name="__class3" value="${__match1}configreseed${__match2}" />
514        <property name="__multipart" value="&#10;
515       &lt;multipart-config&gt;&#10;
516           &lt;max-file-size&gt;67108864&lt;/max-file-size&gt;&#10;
517           &lt;max-request-size&gt;67108864&lt;/max-request-size&gt;&#10;
518           &lt;file-size-threshold&gt;262144&lt;/file-size-threshold&gt;&#10;
519       &lt;/multipart-config&gt;" />
520        <replace file="../jsp/web-out.xml">
521            <replacefilter token="${__class1}" value="${__class1}${__multipart}" />
522            <replacefilter token="${__class2}" value="${__class2}${__multipart}" />
523            <replacefilter token="${__class3}" value="${__class3}${__multipart}" />
524        </replace>
525    </target>
526
527    <uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml">
528        <srcfiles dir= "../jsp" includes="**/*.jsp, *.jsi, **/*.html, *.css, susimail/susimail, web.xml"/>
529        <!-- so the version is right on logs.jsp -->
530        <srcfiles dir= "../../../router/java/src/net/i2p/router" includes="RouterVersion.java"/>
531    </uptodate>
532
533    <target name="javadoc">
534        <mkdir dir="./build" />
535        <mkdir dir="./build/javadoc" />
536        <javadoc 
537            sourcepath="./src:../../../core/java/src:../../../router/java/src:../../systray/java/src:../../desktopgui/src" destdir="./build/javadoc" 
538            packagenames="*" 
539            use="true" 
540            splitindex="true" 
541            windowtitle="Router Console" />
542    </target>
543
544    <!-- scala paths -->
545    <target name="scala.init">
546        <property name="scala-library.jar" value="${scalatest.libs}/scala-library.jar" />
547        <property name="scala-xml.jar" value="${scalatest.libs}/scala-xml.jar" />
548        <property name="scalactic.jar" value="${scalatest.libs}/scalactic.jar" />
549        <property name="scalatest.jar" value="${scalatest.libs}/scalatest.jar" />
550        <property name="mockito.home" value="${ant.home}/lib" />
551        <taskdef resource="scala/tools/ant/antlib.xml">
552            <classpath>
553                <pathelement location="${scalatest.libs}/scala-compiler.jar" />
554                <pathelement location="${scalatest.libs}/scala-reflect.jar" />
555                <pathelement location="${scala-library.jar}" />
556            </classpath>
557        </taskdef>
558    </target>
559
560    <!-- unit tests -->
561    <target name="builddepscalatest">
562        <ant dir="../../../router/java/" target="jar" />
563        <ant dir="../../../router/java/" target="jarScalaTest" />
564    </target>
565    <target name="scalatest.compileTest" depends="builddepscalatest, compile, scala.init">
566        <mkdir dir="./build" />
567        <mkdir dir="./build/obj_scala" />
568        <scalac srcdir="./test/scalatest" destdir="./build/obj_scala" deprecation="on" >
569            <classpath>
570                <pathelement location="${scala-library.jar}" />
571                <pathelement location="${scalactic.jar}" />
572                <pathelement location="${scalatest.jar}" />
573                <pathelement location="${mockito.home}/byte-buddy.jar" />
574                <pathelement location="${mockito.home}/objenesis.jar" />
575                <pathelement location="${mockito.home}/mockito-core.jar" />
576                <pathelement location="../../../core/java/build/i2pscalatest.jar" />
577                <pathelement location="../../../router/java/build/routerscalatest.jar" />
578                <pathelement location="./build/obj" />
579            </classpath>
580        </scalac>
581    </target>
582    <!-- preparation of code coverage tool of choice -->
583    <target name="prepareClover" depends="compile" if="with.clover">
584        <taskdef resource="clovertasks"/>
585        <mkdir dir="../../../reports/apps/routerconsole/clover" />
586        <clover-setup initString="../../../reports/apps/routerconsole/clover/coverage.db"/>
587    </target>
588    <target name="prepareCobertura" depends="compile" if="with.cobertura">
589        <taskdef classpath="${with.cobertura}" resource="tasks.properties" onerror="report" />
590        <mkdir dir="./build/obj_cobertura" />
591        <delete file="./cobertura.ser" />
592        <cobertura-instrument todir="./build/obj_cobertura">
593            <fileset dir="./build/obj">
594                <include name="**/*.class"/>
595                <exclude name="**/*Test.class" />
596            </fileset>
597        </cobertura-instrument>
598    </target>
599    <target name="prepareTest" depends="prepareClover, prepareCobertura" />
600    <!-- end preparation of code coverage tool -->
601    <target name="scalatest.test" depends="clean, scalatest.compileTest, prepareTest">
602        <mkdir dir="../../../reports/apps/routerconsole/scalatest/" />
603        <delete>
604            <fileset dir="../../../reports/apps/routerconsole/scalatest">
605                <include name="TEST-*.xml"/>
606            </fileset>
607        </delete>
608        <taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestAntTask">
609            <classpath>
610                <pathelement location="${classpath}" />
611                <pathelement location="${scala-library.jar}" />
612                <pathelement location="${scala-xml.jar}" />
613                <pathelement location="${scalactic.jar}" />
614                <pathelement location="${scalatest.jar}" />
615                <pathelement location="./build/obj_cobertura" />
616                <pathelement location="./build/obj" />
617                <pathelement location="${with.clover}" />
618                <pathelement location="${with.cobertura}" />
619            </classpath>
620        </taskdef>
621        <scalatest runpath="./build/obj_scala" fork="yes" maxmemory="384M">
622            <tagsToExclude>
623                SlowTests
624            </tagsToExclude>
625            <reporter type="stdout" />
626            <reporter type="junitxml" directory="../../../reports/apps/routerconsole/scalatest/" />
627        </scalatest>
628        <!-- fetch the real hostname of this machine -->
629        <exec executable="hostname" outputproperty="host.name"/>
630        <!-- set if unset -->
631        <property name="host.fakename" value="i2ptester" />
632        <!-- replace hostname that junit inserts into reports with fake one -->
633        <replace dir="../../../reports/apps/routerconsole/scalatest/" token="${host.name}" value="${host.fakename}"/>
634    </target>
635    <target name="test" depends="scalatest.test"/>
636    <!-- test reports -->
637    <target name="scalatest.report">
638        <junitreport todir="../../../reports/apps/routerconsole/scalatest">
639            <fileset dir="../../../reports/apps/routerconsole/scalatest">
640                <include name="TEST-*.xml"/>
641            </fileset>
642            <report format="frames" todir="../../../reports/apps/routerconsole/html/scalatest"/>
643        </junitreport>
644    </target>
645    <target name="clover.report" depends="test" if="with.clover">
646        <clover-report>
647            <current outfile="../../../reports/apps/routerconsole/html/clover">
648                <format type="html"/>
649            </current>
650        </clover-report>
651    </target>
652    <target name="cobertura.report" depends="test" if="with.cobertura">
653        <mkdir dir="../../../reports/apps/routerconsole/cobertura" />
654        <cobertura-report format="xml" srcdir="./src" destdir="../../../reports/apps/routerconsole/cobertura" />
655        <mkdir dir="../../../reports/apps/routerconsole/html/cobertura" />
656        <cobertura-report format="html" srcdir="./src" destdir="../../../reports/apps/routerconsole/html/cobertura" />
657        <delete file="./cobertura.ser" />
658    </target>
659    <target name="test.report" depends="scalatest.report, clover.report, cobertura.report"/>
660    <!-- end test reports -->
661    <target name="fulltest" depends="cleandep, test, test.report" />
662    <!-- end unit tests -->
663
664    <target name="clean">
665        <delete dir="./build" />
666        <delete dir="../jsp/WEB-INF/" />
667        <delete file="../jsp/web-fragment.xml" />
668        <delete file="../jsp/web-out.xml" />
669    </target>
670    <target name="cleandep" depends="clean">
671    </target>
672    <target name="distclean" depends="clean">
673    </target>
674</project>
Note: See TracBrowser for help on using the repository browser.