source: apps/i2ptunnel/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: 21.3 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project basedir="." default="all" name="i2ptunnel">
3    <target name="all" depends="clean, build" />
4    <target name="build" depends="builddep, jar, war" />
5    <target name="builddep">
6        <!-- run from top level build.xml to get dependencies built -->
7    </target>
8    <condition property="depend.available">
9        <typefound name="depend" />
10    </condition>
11    <target name="depend" if="depend.available">
12        <depend
13            cache="../../../build"
14            srcdir="./src" 
15            destdir="./build/obj" >
16            <!-- Depend on classes instead of jars where available -->
17            <classpath>
18                <pathelement location="../../../core/java/build/obj" />
19                <pathelement location="../../../core/java/build/gnu-getopt.jar" />
20                <pathelement location="../../ministreaming/java/build/obj" />
21            </classpath>
22        </depend>
23    </target>
24
25    <condition property="no.bundle">
26        <isfalse value="${require.gettext}" />
27    </condition>
28
29    <!-- only used if not set by a higher build.xml -->
30    <property name="javac.compilerargs" value="" />
31    <property name="javac.version" value="1.7" />
32    <property name="require.gettext" value="true" />
33
34    <!-- Compile includes ui/ classes but not web/ classes here -->
35    <target name="compile" depends="depend">
36        <mkdir dir="./build" />
37        <mkdir dir="./build/obj" />
38        <javac 
39            srcdir="./src" 
40            excludes="net/i2p/i2ptunnel/web/**/*"
41            debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
42            destdir="./build/obj" 
43            includeAntRuntime="false"
44            classpath="../../../core/java/build/i2p.jar:../../../core/java/build/gnu-getopt.jar:../../ministreaming/java/build/mstreaming.jar" >
45            <compilerarg line="${javac.compilerargs}" />
46        </javac>
47    </target>
48
49    <!-- Compile web/ classes only here. Not for Android. -->
50    <target name="compileWeb" depends="jar">
51        <mkdir dir="./build" />
52        <mkdir dir="./build/obj" />
53        <javac 
54            srcdir="./src" 
55            includes="net/i2p/i2ptunnel/web/**/*"
56            debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
57            destdir="./build/obj" 
58            includeAntRuntime="false"
59            classpath="../../../core/java/build/i2p.jar:build/i2ptunnel.jar:../../jetty/jettylib/jetty-i2p.jar:../../jetty/jettylib/jetty-util.jar:../../jetty/jettylib/jetty-xml.jar" >
60            <compilerarg line="${javac.compilerargs}" />
61        </javac>
62    </target>
63
64    <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" >
65        <exec executable="mtn" outputproperty="workspace.changes.j" errorproperty="mtn.error2" failifexecutionfails="false" >
66            <arg value="list" />
67            <arg value="changed" />
68            <arg value="." />
69        </exec>
70        <!-- \n in an attribute value generates an invalid manifest -->
71        <exec executable="tr" inputstring="${workspace.changes.j}" outputproperty="workspace.changes.j.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
72            <arg value="-s" />
73            <arg value="[:space:]" />
74            <arg value="," />
75        </exec>
76    </target>
77
78
79    <!-- The web classes are now in the war not the jar - they are not part of the API -->
80    <target name="jar" depends="builddep, compile, bundle-proxy, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
81        <!-- set if unset -->
82        <property name="workspace.changes.j.tr" value="" />
83        <jar destfile="./build/i2ptunnel.jar" basedir="./build/obj" includes="**/*.class" excludes="**/ui/*.class **/web/*.class" >
84            <manifest>
85                <attribute name="Main-Class" value="net.i2p.i2ptunnel.I2PTunnel" />
86                <attribute name="Class-Path" value="i2p.jar mstreaming.jar" />
87                <attribute name="Implementation-Version" value="${full.version}" />
88                <attribute name="Built-By" value="${build.built-by}" />
89                <attribute name="Build-Date" value="${build.timestamp}" />
90                <attribute name="Base-Revision" value="${workspace.version}" />
91                <attribute name="Workspace-Changes" value="${workspace.changes.j.tr}" />
92                <attribute name="X-Compile-Source-JDK" value="${javac.version}" />
93                <attribute name="X-Compile-Target-JDK" value="${javac.version}" />
94            </manifest>
95        </jar>
96    </target>
97
98    <!-- web/ and ui/ classes that will go in the war. Not for Android. -->
99    <target name="jarTempBeans" depends="builddep, compileWeb" >
100        <jar destfile="./build/temp-beans.jar" basedir="./build/obj" includes="**/ui/*.class **/web/*.class" />
101    </target>
102
103    <target name="jarUpToDate">
104        <uptodate property="jar.uptodate" targetfile="build/i2ptunnel.jar" >
105            <srcfiles dir= "build/obj" includes="**/*.class" />
106        </uptodate>
107        <condition property="shouldListChanges" >
108            <and>
109                <not>
110                    <isset property="jar.uptodate" />
111                </not>
112                <isset property="mtn.available" />
113            </and>
114        </condition>
115    </target>
116
117    <!-- Separate jar for general UI classes (but not web) -->
118    <!-- This is for Android only -->
119    <target name="uiJar" depends="jar, uiJarUpToDate, listChangedFiles" unless="uiJar.uptodate" >
120        <!-- set if unset -->
121        <property name="workspace.changes.j.tr" value="" />
122        <jar destfile="./build/i2ptunnel-ui.jar" basedir="./build/obj" includes="**/ui/*.class" >
123            <manifest>
124                <attribute name="Class-Path" value="i2p.jar mstreaming.jar i2ptunnel.jar" />
125                <attribute name="Implementation-Version" value="${full.version}" />
126                <attribute name="Built-By" value="${build.built-by}" />
127                <attribute name="Build-Date" value="${build.timestamp}" />
128                <attribute name="Base-Revision" value="${workspace.version}" />
129                <attribute name="Workspace-Changes" value="${workspace.changes.j.tr}" />
130                <attribute name="X-Compile-Source-JDK" value="${javac.version}" />
131                <attribute name="X-Compile-Target-JDK" value="${javac.version}" />
132            </manifest>
133        </jar>
134    </target>
135
136    <target name="uiJarUpToDate">
137        <uptodate property="uiJar.uptodate" targetfile="build/i2ptunnel-ui.jar" >
138            <srcfiles dir= "build/obj" includes="**/ui/*.class" />
139        </uptodate>
140        <condition property="shouldListChanges" >
141            <and>
142                <not>
143                    <isset property="uiJar.uptodate" />
144                </not>
145                <isset property="mtn.available" />
146            </and>
147        </condition>
148    </target>
149
150    <!-- servlet translations go in the war, not the jar -->
151    <target name="bundle" depends="compile, 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="../jsp/WEB-INF/classes">
169            <compilerarg line="${javac.compilerargs}" />
170        </javac>
171    </target>
172
173    <target name="poupdate" depends="compile, precompilejsp">
174        <!-- Update the messages_*.po files. -->
175        <!-- set if unset -->
176        <property name="lg2" value="" />
177        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
178            <env key="LG2" value="${lg2}" />
179            <arg value="./bundle-messages.sh" />
180            <arg value="-p" />
181        </exec>
182        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
183            <env key="LG2" value="${lg2}" />
184            <arg value="./bundle-messages.sh" />
185            <arg value="-p" />
186        </exec>
187        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
188            <env key="LG2" value="${lg2}" />
189            <arg value="./bundle-messages.sh" />
190            <arg value="-p" />
191        </exec>
192    </target>
193
194    <!-- proxy error page translations go in the jar, not the war -->
195    <target name="bundle-proxy" unless="no.bundle">
196        <mkdir dir="build/messages-proxy-src" />
197        <!-- Update the messages_*.po files.
198             We need to supply the bat file for windows, and then change the fail property to true -->
199        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
200            <env key="JAVA_HOME" value="${java.home}" />
201            <arg value="./bundle-messages-proxy.sh" />
202        </exec>
203        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
204            <arg value="./bundle-messages-proxy.sh" />
205        </exec>
206                <!-- multi-lang is optional -->
207        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
208            <arg value="./bundle-messages-proxy.sh" />
209        </exec>
210        <javac source="${javac.version}" target="${javac.version}" 
211               includeAntRuntime="false"
212               srcdir="build/messages-proxy-src" destdir="build/obj">
213            <compilerarg line="${javac.compilerargs}" />
214        </javac>
215    </target>
216
217    <target name="extractProxyTags">
218        <java classname="net.i2p.util.TranslateReader" fork="true" failonerror="true">
219            <classpath>
220                <pathelement location="../../../build/i2p.jar" />
221            </classpath>
222            <arg value="tag" />
223            <arg value="../../../installer/resources/proxy/" />
224            <arg value="build/Proxy.java" />
225        </java>
226    </target>
227
228    <target name="poupdate-proxy" depends="extractProxyTags">
229        <!-- Update the messages_*.po files. -->
230        <!-- set if unset -->
231        <property name="lg2" value="" />
232        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
233            <env key="LG2" value="${lg2}" />
234            <arg value="./bundle-messages-proxy.sh" />
235            <arg value="-p" />
236        </exec>
237        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
238            <env key="LG2" value="${lg2}" />
239            <arg value="./bundle-messages-proxy.sh" />
240            <arg value="-p" />
241        </exec>
242        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
243            <env key="LG2" value="${lg2}" />
244            <arg value="./bundle-messages-proxy.sh" />
245            <arg value="-p" />
246        </exec>
247    </target>
248
249    <target name="listChangedFiles2" depends="warUpToDate" if="shouldListChanges2" >
250        <exec executable="mtn" outputproperty="workspace.changes.w" errorproperty="mtn.error2" failifexecutionfails="false" >
251            <arg value="list" />
252            <arg value="changed" />
253            <arg value="../jsp" />
254        </exec>
255        <!-- \n in an attribute value generates an invalid manifest -->
256        <exec executable="tr" inputstring="${workspace.changes.w}" outputproperty="workspace.changes.w.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
257            <arg value="-s" />
258            <arg value="[:space:]" />
259            <arg value="," />
260        </exec>
261    </target>
262
263    <!-- The web classes are now in the war not the jar - they are not part of the API -->
264    <target name="war" depends="compileWeb, precompilejsp, bundle, warUpToDate, listChangedFiles2" unless="war.uptodate" > 
265        <!-- set if unset -->
266        <property name="workspace.changes.w.tr" value="" />
267        <copy todir="../jsp/WEB-INF/classes/net/i2p/i2ptunnel/ui">
268                <fileset dir="build/obj/net/i2p/i2ptunnel/ui" />
269        </copy>
270        <copy todir="../jsp/WEB-INF/classes/net/i2p/i2ptunnel/web">
271            <fileset dir="build/obj/net/i2p/i2ptunnel/web" />
272        </copy>
273        <war destfile="build/i2ptunnel.war" webxml="../jsp/web-out.xml"
274             basedir="../jsp/" excludes="web.xml, web-fragment.xml, web-out.xml, **/*.java, *.jsp, *.jsi">
275            <manifest>
276                <attribute name="Implementation-Version" value="${full.version}" />
277                <attribute name="Built-By" value="${build.built-by}" />
278                <attribute name="Build-Date" value="${build.timestamp}" />
279                <attribute name="Base-Revision" value="${workspace.version}" />
280                <attribute name="Workspace-Changes" value="${workspace.changes.w.tr}" />
281                <attribute name="X-Compile-Source-JDK" value="${javac.version}" />
282                <attribute name="X-Compile-Target-JDK" value="${javac.version}" />
283            </manifest>
284        </war>
285    </target>
286
287    <target name="warUpToDate">
288        <uptodate property="war.uptodate" targetfile="build/i2ptunnel.war" >
289            <srcfiles dir= "../jsp" excludes="web.xml, web-fragment.xml, **/*.java, *.jsp, *.jsi" />
290            <srcfiles dir= "build/obj" includes="**/ui/*.class **/web/*.class" />
291        </uptodate>
292        <condition property="shouldListChanges2" >
293            <and>
294                <not>
295                    <isset property="war.uptodate" />
296                </not>
297                <isset property="mtn.available" />
298            </and>
299        </condition>
300    </target>
301
302    <target name="precompilejsp" depends="jarTempBeans" unless="precompilejsp.uptodate">
303        <delete dir="../jsp/WEB-INF/" />
304        <delete file="../jsp/web-fragment.xml" />
305        <delete file="../jsp/web-out.xml" />
306        <mkdir dir="../jsp/WEB-INF/" />
307        <mkdir dir="../jsp/WEB-INF/classes" />
308        <!-- See apps/routerconsole/java/build.xml for important JspC build documentation -->
309        <java classname="net.i2p.servlet.util.JspC" fork="true" failonerror="true">
310            <classpath>
311                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
312                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
313
314                <!-- following jars only present for debian builds -->
315                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
316                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
317                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
318                <pathelement location="../../jetty/jettylib/tomcat-util.jar" />
319                <pathelement location="../../jetty/jettylib/tomcat-util-scan.jar" />
320
321                <pathelement location="../../jetty/jettylib/jasper-el.jar" />
322                <pathelement location="../../jetty/jettylib/commons-el.jar" />
323                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
324                <pathelement location="${ant.home}/lib/ant.jar" />
325                <pathelement location="build/i2ptunnel.jar" />
326                <pathelement location="build/temp-beans.jar" />
327                <pathelement location="../../../core/java/build/i2p.jar" />
328                <!-- required for multipart form handling in register.jsp -->
329                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
330            </classpath>
331            <arg value="-d" />
332            <arg value="../jsp/WEB-INF/classes" />
333            <arg value="-v" />
334            <arg value="-p" />
335            <arg value="net.i2p.i2ptunnel.jsp" />
336            <arg value="-webinc" />
337            <arg value="../jsp/web-fragment.xml" />
338            <arg value="-webapp" />
339            <arg value="../jsp/" />
340        </java>
341        <javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
342               includeAntRuntime="false"
343               destdir="../jsp/WEB-INF/classes/" srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
344            <compilerarg line="${javac.compilerargs}" />
345            <classpath>
346                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
347                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
348
349                <!-- following jars only present for debian builds -->
350                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
351                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
352                <pathelement location="../../jetty/jettylib/jasper-el.jar" />
353                <pathelement location="../../jetty/jettylib/tomcat-util.jar" />
354                <pathelement location="../../jetty/jettylib/tomcat-util-scan.jar" />
355
356                <pathelement location="../../jetty/jettylib/commons-el.jar" />
357                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
358                <pathelement location="build/i2ptunnel.jar" />
359                <pathelement location="build/temp-beans.jar" />
360                <pathelement location="../../../core/java/build/i2p.jar" />
361                <!-- required for multipart form handling in register.jsp -->
362                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
363            </classpath>
364        </javac>
365        <copy file="../jsp/web.xml" tofile="../jsp/web-out.xml" />
366        <loadfile property="jspc.web.fragment" srcfile="../jsp/web-fragment.xml" />
367        <replace file="../jsp/web-out.xml">
368            <replacefilter token="&lt;!-- precompiled servlets --&gt;" value="${jspc.web.fragment}" />
369        </replace>
370        <!-- Add multipart config to servlets that need them -->
371        <property name="__match1" value="&lt;servlet-class&gt;net.i2p.i2ptunnel.jsp." />
372        <property name="__match2" value="_jsp&lt;/servlet-class&gt;" />
373        <property name="__class1" value="${__match1}register${__match2}" />
374        <property name="__multipart" value="&#10;
375       &lt;multipart-config&gt;&#10;
376           &lt;max-file-size&gt;131072&lt;/max-file-size&gt;&#10;
377           &lt;max-request-size&gt;131072&lt;/max-request-size&gt;&#10;
378       &lt;/multipart-config&gt;" />
379        <replace file="../jsp/web-out.xml">
380            <replacefilter token="${__class1}" value="${__class1}${__multipart}" />
381        </replace>
382    </target>
383
384    <uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml">
385        <srcfiles dir= "../jsp" includes="*.jsp, *.jsi, *.html, web.xml"/>
386        <srcfiles dir= "src/net/i2p/i2ptunnel/web" includes="*.java"/>
387    </uptodate>
388
389    <target name="javadoc">
390        <mkdir dir="./build" />
391        <mkdir dir="./build/javadoc" />
392        <javadoc 
393            sourcepath="./src:../../../core/java/src:../../ministreaming/java/src" destdir="./build/javadoc" 
394            packagenames="*" 
395            use="true" 
396            splitindex="true" 
397            windowtitle="I2PTunnel" />
398    </target>
399
400    <target name="compileTest">
401        <mkdir dir="./build" />
402        <mkdir dir="./build/obj" />
403        <!-- We need the ant runtime, as it includes junit -->
404        <javac srcdir="./src:./test/junit" debug="true" source="${javac.version}" target="${javac.version}"
405               includeAntRuntime="true"
406               deprecation="on" destdir="./build/obj" >
407            <compilerarg line="${javac.compilerargs}" />
408            <classpath>
409                <pathelement location="../../../core/java/build/i2p.jar" />
410                <pathelement location="../../ministreaming/java/build/mstreaming.jar" />
411            </classpath>
412        </javac>
413    </target>
414
415    <target name="test" depends="clean, compileTest">
416        <junit printsummary="on" fork="yes">
417            <classpath>
418                <pathelement path="${classpath}" />
419                <pathelement location="./build/obj" />
420                <pathelement location="../../../core/java/build/i2p.jar" />
421            </classpath>
422            <batchtest>
423                <fileset dir="./test/junit/">
424                    <include name="**/*Test.java" />
425                </fileset>
426            </batchtest>
427            <formatter type="xml"/>
428        </junit>
429        <mkdir dir="../../../reports/" />
430        <mkdir dir="../../../reports/i2ptunnel/" />
431        <mkdir dir="../../../reports/i2ptunnel/junit/" />
432        <delete>
433            <fileset dir="../../../reports/i2ptunnel/junit">
434                <include name="TEST-*.xml"/>
435            </fileset>
436        </delete>
437        <copy todir="../../../reports/i2ptunnel/junit">
438            <fileset dir=".">
439                <include name="TEST-*.xml"/>
440            </fileset>
441        </copy>
442        <delete>
443            <fileset dir=".">
444                <include name="TEST-*.xml"/>
445            </fileset>
446        </delete>
447    </target>
448
449    <target name="clean">
450        <delete dir="./build" />
451        <delete dir="../jsp/WEB-INF/" />
452        <delete file="../jsp/web-fragment.xml" />
453        <delete file="../jsp/web-out.xml" />
454    </target>
455    <target name="cleandep" depends="clean">
456    </target>
457    <target name="distclean" depends="clean">
458    </target>
459</project>
Note: See TracBrowser for help on using the repository browser.