source: apps/jetty/build.xml @ 094cf14

Last change on this file since 094cf14 was 094cf14, checked in by zzz <zzz@…>, 4 years ago

Debian:
Prep for dependency on libtomcat7
Doesn't work yet, breaks susidns.
glassfish-javaee for jstl.jar and standard.jar version 1.2 won't work with tomcat7,
it's ancient and not compatible with recent el libs.
Add back option to depend on libjakarta-taglibs-standard and libjstl1.1-java which are version 1.1.2,
but not clear if they will work with tomcat7 either, even though they are
dependencies of libjetty8-extra-java.
We switched from JSTL 1.1.2 to JSTL 1.2 when we went from Jetty 5 to Jetty 6 in 2012.
1.2 libs are not available anywhere except for Glassfish, and
Debian only has the ancient Java EE 5 Glassfish 2.1.
Not clear there's any way to get susidns (and bote) to work with both Tomcat 6 and 7.

  • Fix wrong jsp-api version
  • Fix other minor errors in install and links files.
  • Log stack trace for Jetty warnings if log level is WARN
  • SusiDNS: Move standard.jar and jstl.jar out of WEB-INF/lib, where Tomcat 7 build refuses to find them
  • Property mode set to 100644
File size: 19.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project basedir="." default="all" name="jetty">
3
4    <!-- This copies jars, with some modifications and renaming,
5         from the jetty-distribution directory to the jettylib directory.
6         This is disabled if the property with-libjetty8-java=true.
7
8         This copies jars, with some modifications and renaming,
9         from the apache-tomcat-deployer and apache-tomcat directories to the jettylib directory.
10         This is disabled if the property with-libservlet2.5-java=true.
11
12         This also builds the small helper jar jetty-i2p.jar from
13         the source in the java/ directory.
14     -->
15
16    <property name="jetty.ver" value="8.1.17.v20150415" />
17    <property name="jetty.base" value="jetty-distribution-${jetty.ver}" />
18    <property name="jetty.sha1" value="ce7bcd1bdcdac4cf130467f6d55155b9e1517e71" />
19    <property name="jetty.filename" value="${jetty.base}.zip" />
20    <property name="jetty.url" value="http://download.eclipse.org/jetty/${jetty.ver}/dist/${jetty.filename}" />
21    <property name="verified.filename" value="verified.txt" />
22    <property name="javac.compilerargs" value="" />
23    <property name="javac.version" value="1.6" />
24    <property name="tomcat.lib" value="apache-tomcat-deployer/lib" />
25    <property name="tomcat.ver" value="6.0.44" />
26    <property name="tomcat2.lib" value="apache-tomcat-${tomcat.ver}/lib" />
27    <property name="tomcat2.lib.small" value="apache-tomcat/lib" />
28
29    <target name="all" depends="build" />
30
31    <!--
32      - We now check in the jars we need to ${jetty.base}, so
33      - fetchJettylib, verifyJettylib, and extractJettylib are not used unless
34      - updating to a new Jetty version by changing ${jetty.ver} and ${jetty.sha1} above.
35     -->
36
37    <!-- verify everything we need is in jettylib/ -->
38    <target name="ensureJettylib" depends="ensureJettylib1, copyJettylib" />
39
40    <target name="ensureJettylib1" >
41        <condition property="jetty.zip.extracted" >
42            <or>
43                <istrue value="${with-libjetty8-java}" />
44                <available file="${jetty.base}" type="dir" />
45            </or>
46        </condition>
47        <condition property="jetty.zip.available" >
48            <or>
49                <istrue value="${jetty.zip.extracted}" />
50                <available file="${jetty.filename}" type="file" />
51            </or>
52        </condition>
53    </target>
54
55  <!--
56    <target name="ensureJettylib" depends="extractJettylib" />
57   -->
58
59    <target name="fetchJettylib" unless="jetty.zip.available" >
60        <echo message="It seems that you don't have '${jetty.filename}' deployed." />
61        <echo message="The build script can download this file for you automatically," />
62        <echo message="or alternatively you can obtain it manually from:" />
63        <echo message="${jetty.url}" />
64        <echo message="" />
65        <echo message="The libraries contained in the fetched file provide the Jetty web server" />
66        <echo message="(http://jetty.mortbay.org/). They are not absolutely necessary" />
67        <echo message="but strongly recommended, since they are used by some applications" />
68        <echo message="on top of I2P, like the router console." />
69        <echo message="" />
70        <echo message="Even if you deploy the Jetty archive manually into directory apps/jetty/," />
71        <echo message="the build script will still attempt to verify its checksums, which must be:" />
72        <echo message="SHA1 ${jetty.sha1}" />
73        <echo message="" />
74        <input message="Download Jetty archive automatically?" validargs="y,n" addproperty="jetty.download" />
75        <fail message="Aborting as requested. Please deploy the Jetty archive manually." >
76            <condition>
77                <equals arg1="${jetty.download}" arg2="n"/>
78            </condition>
79        </fail>
80        <get src="${jetty.url}" verbose="true" dest="${jetty.filename}" />
81    </target>
82
83    <condition property="verified.already" >
84        <or>
85            <istrue value="${with-libjetty8-java}" />
86            <istrue value="${jetty.zip.extracted}" />
87            <and>
88                <available file="${jetty.filename}" />
89                <uptodate property="foo.bar.baz" srcfile="${jetty.filename}" targetfile="${verified.filename}" />
90            </and>
91        </or>
92    </condition>
93
94    <target name="verifyJettylib" depends="fetchJettylib" unless="verified.already" >
95        <condition property="jetty.zip.verified" >
96                <checksum file="${jetty.filename}" algorithm="SHA" property="${jetty.sha1}" />
97        </condition>
98        <fail message="Jetty archive does not match its checksum!" >
99            <condition>
100                <not>
101                    <istrue value="${jetty.zip.verified}" />
102                </not>
103            </condition>
104        </fail>
105        <touch file="${verified.filename}" />
106    </target>
107
108    <target name="extractJettylib" depends="verifyJettylib" unless="jetty.zip.extracted" >
109      <!-- for .tgz -->
110      <!--
111        <gunzip src="${jetty.filename}" dest="jetty.tar" />
112        <untar src="jetty.tar" dest="." />
113      -->
114      <!-- for .zip -->
115        <unzip src="${jetty.filename}" dest="." />
116    </target>
117
118    <target name="mkJettylibdir" >
119        <mkdir dir="jettylib" />
120    </target>
121
122    <!-- Jetty and tomcat files -->
123    <target name="copyJettylib" depends="mkJettylibdir, copyJettylib1, copyTomcatLib" />
124
125    <!-- Jetty files only -->
126    <target name="copyJettylib1" depends="extractJettylib" unless="${with-libjetty8-java}" >
127      <!-- We copy everything to names without the version numbers so we
128           can update them later. Where there was something similar in Jetty 5/6,
129           we use the same names so they will overwrite the Jetty 5/6 jar on upgrade.
130           Otherwise we use the same name as the symlink in Ubuntu /usr/share/java.
131           Reasons for inclusion:
132              start.jar: Needed for clients.config startup of eepsites
133              jetty-util-xxx.jar: LifeCycle (base class for stuff), URIUtil (used in i2psnark)
134              jetty-deploy, -http, -io, -security, -servlet, -webapp: All split out from main server jar in Jetty 7
135              jetty-continuation-xxx.jar: Needed? Useful?
136              jetty-servlets-xxx.jar: Needed for CGI for eepsite
137              jetty-sslengine-xxx.jar: Old Jetty 6, now a dummy
138              jetty-java5-threadpool-xxx.jar: Old Jetty 6, now a dummy
139              jetty-rewrite-handler: Not used by I2P, but only 20KB and could be useful for eepsites
140              jetty-management: Not used by I2P, but only 34KB and could be useful for eepsites, and we bundled it with Jetty 5
141              javax.servlet.jsp-2.2.0.v201112011158.jar: Required API
142              servlet-api-3.0.jar: Required API
143              All of these are available in the Ubuntu packages libjetty-java and libjetty-extra-java
144        -->
145        <copy preservelastmodified="true" file="${jetty.base}/start.jar" tofile="jettylib/jetty-start.jar" />
146        <copy file="${jetty.base}/lib/jetty-server-${jetty.ver}.jar" tofile="jettylib/org.mortbay.jetty.jar" />
147        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-continuation-${jetty.ver}.jar" tofile="jettylib/jetty-continuation.jar" />
148        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-deploy-${jetty.ver}.jar" tofile="jettylib/jetty-deploy.jar" />
149        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-http-${jetty.ver}.jar" tofile="jettylib/jetty-http.jar" />
150        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-io-${jetty.ver}.jar" tofile="jettylib/jetty-io.jar" />
151        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-jmx-${jetty.ver}.jar" tofile="jettylib/org.mortbay.jmx.jar" />
152        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-rewrite-${jetty.ver}.jar" tofile="jettylib/jetty-rewrite-handler.jar" />
153        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-security-${jetty.ver}.jar" tofile="jettylib/jetty-security.jar" />
154        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-servlet-${jetty.ver}.jar" tofile="jettylib/jetty-servlet.jar" />
155        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-servlets-${jetty.ver}.jar" tofile="jettylib/jetty-servlets.jar" />
156        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-util-${jetty.ver}.jar" tofile="jettylib/jetty-util.jar" />
157        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-webapp-${jetty.ver}.jar" tofile="jettylib/jetty-webapp.jar" />
158        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-xml-${jetty.ver}.jar" tofile="jettylib/jetty-xml.jar" />
159        <jar destfile="jettylib/jetty-java5-threadpool.jar" >
160            <manifest>
161                <attribute name="Note" value="Intentionally empty" />
162            </manifest>
163        </jar>
164        <jar destfile="jettylib/jetty-sslengine.jar" >
165            <manifest>
166                <attribute name="Note" value="Intentionally empty" />
167            </manifest>
168        </jar>
169        <jar destfile="jettylib/javax.servlet.jar" duplicate="preserve" filesetmanifest="mergewithoutmain" >
170            <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties" src="${jetty.base}/lib/servlet-api-3.0.jar" />
171            <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties" src="${jetty.base}/lib/jsp/javax.servlet.jsp-2.2.0.v201112011158.jar" />
172        </jar>
173      <!--
174        <delete file="jetty.tar" />
175        <delete dir="${jetty.base}" />
176      -->
177        <!-- commons-logging.jar not in Jetty 6 but we have it in launch4j so copy it over,
178             needed for old plugins and things. We add tomcat-juli below.
179          -->
180      <!--
181        * Removed in 0.9.24, see ticket #1679
182        * Jetty now uses tomcat-juli (added below to commons-logging.jar), not commons-logging proper,
183        * and no known plugins use it either.
184        <jar destfile="jettylib/commons-logging.jar" filesetmanifest="mergewithoutmain" >
185            <zipfileset excludes="META-INF/LICENSE.txt META-INF/NOTICE.txt" src="../../installer/lib/launch4j/lib/commons-logging.jar" />
186        </jar>
187      -->
188    </target>
189
190    <!-- Tomcat util jar.
191         As of Tomcat 6.0.39, the deployer does not contain some classes that are required
192         to precompile jsps with tags (SusiDNS and i2p-bote).
193         These classes are in the main Tomcat package, in lib/tomcat-coyote.jar.
194         As the jar is 800 KB and we only need 12 KB of that, we extract the required classes
195         to a new jar, created and checked in using this target.
196         Apparently this is only required for precompilation of jsps, so this is put in
197         with the JspC compiler jasper-runtime.jar below.
198     -->
199    <target name="buildTomcatUtilJar" unless="${with-libservlet2.5-java}" >
200        <!-- take only what we need from the tomcat-coyote jar -->
201        <jar destfile="${tomcat2.lib.small}/tomcat-coyote-util.jar" >
202            <zipfileset src="${tomcat2.lib}/tomcat-coyote.jar"
203             includes="org/apache/tomcat/util/descriptor/* org/apache/tomcat/util/res/*" />
204        </jar>
205    </target>
206
207    <!-- Tomcat.
208         The glassfish jars bundled in Jetty 6 are way too old.
209         For compatibility with very old I2P installations where the classpath
210         was set individually in wrapper.config, we rename and combine the jars as follows:
211         jasper.jar : jasper-runtime.jar
212         jasper-el.jar + el-api.jar : commons-el.jar
213         tomcat-juli.jar : Add to commons-logging.jar
214         empty jar : jasper-compiler.jar
215         Also, take NOTICE and LICENSE out of each one, we bundle those separately.
216
217         Not as of Jetty 8 (using from Jetty):
218         servlet-api.jar + jsp-api.jar : javax.servlet.jar
219         If we go to Tomcat 7:
220         tomcat-api.jar + tomcat-util.jar: Add to javax.servlet.jar (as of Tomcat 7 / Jetty 8)
221     -->
222    <target name="copyTomcatLib" depends="mkJettylibdir, copyTomcatLib1, copyTomcatLib2, copyTomcatLib3" />
223
224    <target name="copyTomcatLib1" unless="${with-libservlet2.5-java}" >
225        <condition property="with-libtomcat-java" >
226            <or>
227                <istrue value="${with-libtomcat6-java}" />
228                <istrue value="${with-libtomcat7-java}" />
229            </or>
230        </condition>
231    </target>
232
233
234    <target name="copyTomcatLib2" unless="${with-libtomcat-java}" >
235        <!-- EL libs.
236             Tomcat 6 has EL 2.1.
237             Tomcat 7 / libservlet3.0 has EL 2.2.
238             According to http://stackoverflow.com/questions/7202686/differences-between-el-2-1-and-2-2
239             2.2 is backwards-compatible with 2.1.
240         -->
241        <jar destfile="jettylib/commons-el.jar" duplicate="preserve" filesetmanifest="merge" >
242            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper-el.jar" />
243            <zipfileset excludes="META-INF/**/*" src="${tomcat.lib}/el-api.jar" />
244        </jar>
245
246        <jar destfile="jettylib/jasper-runtime.jar" filesetmanifest="merge" >
247            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper.jar" />
248            <zipfileset src="${tomcat2.lib.small}/tomcat-coyote-util.jar" />
249        </jar>
250<!--
251        <jar destfile="jettylib/javax.servlet.jar" duplicate="preserve" filesetmanifest="mergewithoutmain" >
252            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/servlet-api.jar" />
253            <zipfileset excludes="META-INF/**/*" src="${tomcat.lib}/jsp-api.jar" />
254            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-api.jar" />
255            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-util.jar" />
256        </jar>
257-->
258        <!-- Ant bug, don't set update and filesetmanifest or the update doesn't happen,
259             Their bug tracker claims fixed in 1.8.0 but broken for me in 1.8.1
260          -->
261        <jar destfile="jettylib/commons-logging.jar" update="true" >
262            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-juli.jar" />
263        </jar>
264    </target>
265
266    <target name="copyTomcatLib3" unless="${with-libtomcat-java}" >
267        <jar destfile="jettylib/jasper-compiler.jar" >
268            <manifest>
269                <attribute name="Note" value="Intentionally empty" />
270            </manifest>
271        </jar>
272    </target>
273
274    <target name="build" depends="jar" />
275
276    <target name="builddep" />
277
278    <condition property="depend.available">
279        <typefound name="depend" />
280    </condition>
281
282    <target name="depend" if="depend.available">
283        <depend
284            cache="../../build"
285            srcdir="./java/src" 
286            destdir="./build/obj" >
287            <classpath>
288                <pathelement location="../../../core/java/build/i2p.jar" />
289                <pathelement location="./jettylib/commons-logging.jar" />
290                <pathelement location="./jettylib/org.mortbay.jetty.jar" />
291                <pathelement location="./jettylib/javax.servlet.jar" />
292                <pathelement location="./jettylib/jetty-http.jar" />
293                <pathelement location="./jettylib/jetty-io.jar" />
294                <pathelement location="./jettylib/jetty-security.jar" />
295                <pathelement location="./jettylib/jetty-util.jar" />
296                <pathelement location="./jettylib/jetty-xml.jar" />
297            </classpath>
298        </depend>
299    </target>
300
301    <target name="compile" depends="builddep, ensureJettylib, depend" >
302        <mkdir dir="./build" />
303        <mkdir dir="./build/obj" />
304        <javac 
305            srcdir="./java/src" 
306            debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
307            destdir="./build/obj" 
308            includeAntRuntime="false"
309            classpath="../../core/java/build/i2p.jar:./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar:./jettylib/jetty-http.jar:./jettylib/jetty-io.jar:./jettylib/jetty-security.jar:./jettylib/jetty-util.jar:./jettylib/jetty-xml.jar" >
310            <compilerarg line="${javac.compilerargs}" />
311        </javac>
312    </target>
313
314    <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" >
315        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
316            <arg value="list" />
317            <arg value="changed" />
318            <arg value="." />
319        </exec>
320        <!-- \n in an attribute value generates an invalid manifest -->
321        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
322            <arg value="-s" />
323            <arg value="[:space:]" />
324            <arg value="," />
325        </exec>
326    </target>
327
328    <!-- With Jetty 5 we replaced classes in the jar, but with Jetty 6 we
329         put our stuff in its own jar so we can work with standard Jetty 6 packages
330      -->
331    <target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
332        <!-- set if unset -->
333        <property name="workspace.changes.tr" value="" />
334        <copy todir="build/obj" file="resources/log4j.properties" />
335        <jar destfile="./jettylib/jetty-i2p.jar" basedir="./build/obj" includes="**/*.class log4j.properties" >
336            <manifest>
337                <attribute name="Built-By" value="${build.built-by}" />
338                <attribute name="Build-Date" value="${build.timestamp}" />
339                <attribute name="Base-Revision" value="${workspace.version}" />
340                <!-- needed by JettyStart for pre-0.7.5 wrapper.config -->
341                <attribute name="Class-Path" value="jetty-deploy.jar jetty-xml.jar" />
342                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
343            </manifest>
344        </jar>
345    </target>   
346
347    <target name="jarUpToDate">
348        <uptodate property="jar.uptodate" targetfile="jettylib/jetty-i2p.jar" >
349            <srcfiles dir= "build/obj" includes="**/*.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="clean" >
362        <delete dir="./build" />
363        <delete file="${verified.filename}" />
364    </target>   
365    <target name="cleandep" depends="clean" />
366    <target name="distclean" depends="clean">
367        <delete dir="./jettylib" />
368      <!--
369        <echo message="Not actually deleting the jetty libs (since they're so large)" />
370       -->
371    </target>
372    <target name="reallyclean" depends="distclean">
373    </target>
374    <target name="totallyclean" depends="clean">
375        <delete dir="./jettylib" />
376        <delete file="${jetty.filename}" />
377    </target>
378    <target name="javadoc" >
379        <available property="jetty.zip.available" file="${jetty.filename}" type="file" />
380        <available property="jetty.zip.javadocExtracted" file="build/javadoc" type="dir" />
381        <ant target="fetchJettylib" />
382        <ant target="verifyJettylib" />
383        <ant target="extractJavadoc" />
384    </target>
385    <target name="extractJavadoc" unless="jetty.zip.javadocExtracted" >
386        <mkdir dir="./build" />
387        <mkdir dir="./build/javadoc" />
388        <unzip src="${jetty.filename}" dest="./build/javadoc" >
389            <patternset>
390                <include name="${jetty.base}/javadoc/" />
391            </patternset>
392            <mapper type="glob" from="${jetty.base}/javadoc/*" to="javadoc/*" />
393        </unzip>
394    </target>
395
396</project>
Note: See TracBrowser for help on using the repository browser.