source: apps/i2ptunnel/java/build.xml @ 92b9d0a

Last change on this file since 92b9d0a was 92b9d0a, checked in by zzz <zzz@…>, 9 years ago

First cut at migrating to Jetty 6 and prep for using an external
Jetty 6 package.

  • Add several jars from the Jetty 6 distribution
  • Update jetty.xml
  • Add context XML files
  • Update WorkingDir? to migrate the content XML files
  • Update RouterConsoleRunner? and LocaleWebAppHandler?
  • Remove all old Jetty 5.1.15 local mods; this will break Seedless using a custom Server() constructor
  • Update I2PRequestLog to be a mod of NCSARequestLog from 6.1.26
  • Put I2PRequestLog in its own jar
  • Copy MultiPartRequest? and other required classes from Jetty 5.1.15 and add it to susimail, as the replacement MultiPartFilter? in Jetty 6 is difficult to migrate to, and does not support content-type
  • Update i2psnark for Jetty 6
  • Disable i2psnark RunStandalone?, unused and instantiated Jetty 5
  • Fix up all webapp build.xml to reference new jars

Not yet working: Plugin/webapp run detection and stopping, eepsite CGI
Not well tested: Plugins, classpaths, webapps

  • Property mode set to 100644
File size: 11.9 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="../../ministreaming/java/build/obj" />
20            </classpath>
21        </depend>
22    </target>
23
24    <property name="javac.compilerargs" value="" />
25    <property name="require.gettext" value="true" />
26
27    <target name="compile" depends="depend">
28        <mkdir dir="./build" />
29        <mkdir dir="./build/obj" />
30        <javac 
31            srcdir="./src" 
32            debug="true" deprecation="on" source="1.5" target="1.5" 
33            destdir="./build/obj" 
34            includeAntRuntime="false"
35            classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar" >
36            <compilerarg line="${javac.compilerargs}" />
37        </javac>
38    </target>
39
40    <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" >
41        <exec executable="mtn" outputproperty="workspace.changes.j" errorproperty="mtn.error2" failifexecutionfails="false" >
42            <arg value="list" />
43            <arg value="changed" />
44            <arg value="." />
45        </exec>
46        <!-- \n in an attribute value generates an invalid manifest -->
47        <exec executable="tr" inputstring="${workspace.changes.j}" outputproperty="workspace.changes.j.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
48            <arg value="-s" />
49            <arg value="[:space:]" />
50            <arg value="," />
51        </exec>
52    </target>
53
54
55    <!-- TODO: Move the web classes from the jar to the war - they are not part of the API
56      -  This will require sponge to rewrite some seedless stuff that uses it.
57     -->
58    <target name="jar" depends="builddep, compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
59        <!-- set if unset -->
60        <property name="workspace.changes.j.tr" value="" />
61        <jar destfile="./build/i2ptunnel.jar" basedir="./build/obj" includes="**/*.class">
62            <manifest>
63                <attribute name="Main-Class" value="net.i2p.i2ptunnel.I2PTunnel" />
64                <attribute name="Class-Path" value="i2p.jar mstreaming.jar" />
65                <attribute name="Build-Date" value="${build.timestamp}" />
66                <attribute name="Base-Revision" value="${workspace.version}" />
67                <attribute name="Workspace-Changes" value="${workspace.changes.j.tr}" />
68            </manifest>
69        </jar>
70    </target>
71
72    <target name="jarUpToDate">
73        <uptodate property="jar.uptodate" targetfile="build/i2ptunnel.jar" >
74            <srcfiles dir= "build/obj" includes="**/*.class" />
75        </uptodate>
76        <condition property="shouldListChanges" >
77            <and>
78                <not>
79                    <isset property="jar.uptodate" />
80                </not>
81                <isset property="mtn.available" />
82            </and>
83        </condition>
84    </target>
85
86    <target name="bundle" depends="compile, precompilejsp">
87        <!-- Update the messages_*.po files.
88             We need to supply the bat file for windows, and then change the fail property to true -->
89        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
90            <arg value="./bundle-messages.sh" />
91        </exec>
92        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
93            <arg value="./bundle-messages.sh" />
94        </exec>
95                <!-- multi-lang is optional -->
96        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
97            <arg value="./bundle-messages.sh" />
98        </exec>
99    </target>
100
101    <target name="poupdate" depends="compile, precompilejsp">
102        <!-- Update the messages_*.po files. -->
103        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
104            <arg value="./bundle-messages.sh" />
105            <arg value="-p" />
106        </exec>
107        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
108            <arg value="./bundle-messages.sh" />
109            <arg value="-p" />
110        </exec>
111        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
112            <arg value="./bundle-messages.sh" />
113            <arg value="-p" />
114        </exec>
115    </target>
116
117    <target name="listChangedFiles2" depends="warUpToDate" if="shouldListChanges2" >
118        <exec executable="mtn" outputproperty="workspace.changes.w" errorproperty="mtn.error2" failifexecutionfails="false" >
119            <arg value="list" />
120            <arg value="changed" />
121            <arg value="../jsp" />
122        </exec>
123        <!-- \n in an attribute value generates an invalid manifest -->
124        <exec executable="tr" inputstring="${workspace.changes.w}" outputproperty="workspace.changes.w.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
125            <arg value="-s" />
126            <arg value="[:space:]" />
127            <arg value="," />
128        </exec>
129    </target>
130
131    <target name="war" depends="precompilejsp, bundle, warUpToDate, listChangedFiles2" unless="war.uptodate" > 
132        <!-- set if unset -->
133        <property name="workspace.changes.w.tr" value="" />
134        <war destfile="build/i2ptunnel.war" webxml="../jsp/web-out.xml"
135             basedir="../jsp/" excludes="web.xml, web-fragment.xml, web-out.xml, **/*.java, *.jsp">
136            <manifest>
137                <attribute name="Build-Date" value="${build.timestamp}" />
138                <attribute name="Base-Revision" value="${workspace.version}" />
139                <attribute name="Workspace-Changes" value="${workspace.changes.w.tr}" />
140            </manifest>
141        </war>
142    </target>
143
144    <target name="warUpToDate">
145        <uptodate property="war.uptodate" targetfile="build/i2ptunnel.war" >
146            <srcfiles dir= "../jsp" excludes="web.xml, web-fragment.xml, **/*.java, *.jsp" />
147        </uptodate>
148        <condition property="shouldListChanges2" >
149            <and>
150                <not>
151                    <isset property="war.uptodate" />
152                </not>
153                <isset property="mtn.available" />
154            </and>
155        </condition>
156    </target>
157
158    <target name="precompilejsp" depends="jar" unless="precompilejsp.uptodate">
159        <delete dir="../jsp/WEB-INF/" />
160        <delete file="../jsp/web-fragment.xml" />
161        <delete file="../jsp/web-out.xml" />
162        <mkdir dir="../jsp/WEB-INF/" />
163        <mkdir dir="../jsp/WEB-INF/classes" />
164        <!-- there are various jspc ant tasks, but they all seem a bit flakey -->
165        <java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
166            <classpath>
167                <pathelement location="../../jetty/jettylib/jasper-compiler.jar" />
168                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
169                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
170                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
171                <pathelement location="../../jetty/jettylib/commons-el.jar" />
172                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
173                <pathelement location="../../jetty/jettylib/ant.jar" />
174                <pathelement location="build/i2ptunnel.jar" />
175            </classpath>
176            <arg value="-d" />
177            <arg value="../jsp/WEB-INF/classes" />
178            <arg value="-p" />
179            <arg value="net.i2p.i2ptunnel.jsp" />
180            <arg value="-webinc" />
181            <arg value="../jsp/web-fragment.xml" />
182            <arg value="-webapp" />
183            <arg value="../jsp/" />
184        </java>
185        <javac debug="true" deprecation="on" source="1.5" target="1.5" 
186               includeAntRuntime="false"
187               destdir="../jsp/WEB-INF/classes/" srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
188            <compilerarg line="${javac.compilerargs}" />
189            <classpath>
190                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
191                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
192                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
193                <pathelement location="../../jetty/jettylib/commons-el.jar" />
194                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
195                <pathelement location="build/i2ptunnel.jar" />
196            </classpath>
197        </javac>
198        <copy file="../jsp/web.xml" tofile="../jsp/web-out.xml" />
199        <loadfile property="jspc.web.fragment" srcfile="../jsp/web-fragment.xml" />
200        <replace file="../jsp/web-out.xml">
201            <replacefilter token="&lt;!-- precompiled servlets --&gt;" value="${jspc.web.fragment}" />
202        </replace>
203    </target>
204
205    <uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml">
206        <srcfiles dir= "../jsp" includes="*.jsp, *.html, web.xml"/>
207    </uptodate>
208
209    <target name="javadoc">
210        <mkdir dir="./build" />
211        <mkdir dir="./build/javadoc" />
212        <javadoc 
213            sourcepath="./src:../../../core/java/src:../../ministreaming/java/src" destdir="./build/javadoc" 
214            packagenames="*" 
215            use="true" 
216            splitindex="true" 
217            windowtitle="I2PTunnel" />
218    </target>
219
220    <target name="compileTest">
221        <mkdir dir="./build" />
222        <mkdir dir="./build/obj" />
223        <!-- We need the ant runtime, as it includes junit -->
224        <javac srcdir="./src:./test" debug="true" source="1.5" target="1.5"
225               includeAntRuntime="true"
226               deprecation="on" destdir="./build/obj" >
227            <compilerarg line="${javac.compilerargs}" />
228            <classpath>
229                <pathelement location="../../../core/java/build/i2p.jar" />
230                <pathelement location="../../ministreaming/java/build/mstreaming.jar" />
231            </classpath>
232        </javac>
233    </target>
234    <target name="test" depends="clean, compileTest">
235        <junit printsummary="on" fork="yes">
236            <classpath>
237                <pathelement path="${classpath}" />
238                <pathelement location="./build/obj" />
239                <pathelement location="../../../core/java/build/i2p.jar" />
240            </classpath>
241            <batchtest>
242                <fileset dir="./test/">
243                    <include name="**/*Test.java" />
244                </fileset>
245            </batchtest>
246            <formatter type="xml"/>
247        </junit>
248        <mkdir dir="../../../reports/" />
249        <mkdir dir="../../../reports/i2ptunnel/" />
250        <mkdir dir="../../../reports/i2ptunnel/junit/" />
251        <delete>
252            <fileset dir="../../../reports/i2ptunnel/junit">
253                <include name="TEST-*.xml"/>
254            </fileset>
255        </delete>
256        <copy todir="../../../reports/i2ptunnel/junit">
257            <fileset dir=".">
258                <include name="TEST-*.xml"/>
259            </fileset>
260        </copy>
261        <delete>
262            <fileset dir=".">
263                <include name="TEST-*.xml"/>
264            </fileset>
265        </delete>
266    </target>
267
268    <target name="clean">
269        <delete dir="./build" />
270        <delete dir="../jsp/WEB-INF/" />
271        <delete file="../jsp/web-fragment.xml" />
272        <delete file="../jsp/web-out.xml" />
273    </target>
274    <target name="cleandep" depends="clean">
275    </target>
276    <target name="distclean" depends="clean">
277    </target>
278</project>
Note: See TracBrowser for help on using the repository browser.