source: apps/jetty/build.xml @ e2f048b

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

Debian:
Add dependency on libjetty8-java and libservlet3.0-java packages
Remove those binaries in debian builds
Prep for dependency on libservlet2.5-java package
Prep for dependency on libtomcat6-java package
Prep for dependency on libtomcat7-java package
Prep for dependency on libjakarta-taglibs-standard-java package
Prep for dependency on libjstl1.1-java package
Add build properties for building with packages
Rework of apps/jetty/build.xml for building with packages
Redefine debian/ as the files for the jessie build
Make debian-alt directories for ubuntu builds
Move debian/changelog to debian-alt/trusty/changelog
Move debian-alt/jessie/changelog to debian/changelog
Add apps/jetty/jettylib/jsp-api.jar to classpath for jsp builds

  • Property mode set to 100644
File size: 19.1 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        <jar destfile="jettylib/commons-el.jar" duplicate="preserve" filesetmanifest="merge" >
226            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper-el.jar" />
227            <zipfileset excludes="META-INF/**/*" src="${tomcat.lib}/el-api.jar" />
228        </jar>
229    </target>
230
231    <target name="copyTomcatLib2" unless="${with-libtomcat6-java}" >
232        <jar destfile="jettylib/jasper-runtime.jar" filesetmanifest="merge" >
233            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper.jar" />
234            <zipfileset src="${tomcat2.lib.small}/tomcat-coyote-util.jar" />
235        </jar>
236<!--
237        <jar destfile="jettylib/javax.servlet.jar" duplicate="preserve" filesetmanifest="mergewithoutmain" >
238            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/servlet-api.jar" />
239            <zipfileset excludes="META-INF/**/*" src="${tomcat.lib}/jsp-api.jar" />
240            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-api.jar" />
241            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-util.jar" />
242        </jar>
243-->
244        <!-- Ant bug, don't set update and filesetmanifest or the update doesn't happen,
245             Their bug tracker claims fixed in 1.8.0 but broken for me in 1.8.1
246          -->
247        <jar destfile="jettylib/commons-logging.jar" update="true" >
248            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-juli.jar" />
249        </jar>
250    </target>
251
252    <target name="copyTomcatLib3" unless="${with-libtomcat7-java}" >
253        <jar destfile="jettylib/jasper-compiler.jar" >
254            <manifest>
255                <attribute name="Note" value="Intentionally empty" />
256            </manifest>
257        </jar>
258    </target>
259
260    <target name="build" depends="jar" />
261
262    <target name="builddep" />
263
264    <condition property="depend.available">
265        <typefound name="depend" />
266    </condition>
267
268    <target name="depend" if="depend.available">
269        <depend
270            cache="../../build"
271            srcdir="./java/src" 
272            destdir="./build/obj" >
273            <classpath>
274                <pathelement location="../../../core/java/build/i2p.jar" />
275                <pathelement location="./jettylib/commons-logging.jar" />
276                <pathelement location="./jettylib/org.mortbay.jetty.jar" />
277                <pathelement location="./jettylib/javax.servlet.jar" />
278                <pathelement location="./jettylib/jetty-http.jar" />
279                <pathelement location="./jettylib/jetty-io.jar" />
280                <pathelement location="./jettylib/jetty-security.jar" />
281                <pathelement location="./jettylib/jetty-util.jar" />
282                <pathelement location="./jettylib/jetty-xml.jar" />
283            </classpath>
284        </depend>
285    </target>
286
287    <target name="compile" depends="builddep, ensureJettylib, depend" >
288        <mkdir dir="./build" />
289        <mkdir dir="./build/obj" />
290        <javac 
291            srcdir="./java/src" 
292            debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
293            destdir="./build/obj" 
294            includeAntRuntime="false"
295            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" >
296            <compilerarg line="${javac.compilerargs}" />
297        </javac>
298    </target>
299
300    <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" >
301        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
302            <arg value="list" />
303            <arg value="changed" />
304            <arg value="." />
305        </exec>
306        <!-- \n in an attribute value generates an invalid manifest -->
307        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
308            <arg value="-s" />
309            <arg value="[:space:]" />
310            <arg value="," />
311        </exec>
312    </target>
313
314    <!-- With Jetty 5 we replaced classes in the jar, but with Jetty 6 we
315         put our stuff in its own jar so we can work with standard Jetty 6 packages
316      -->
317    <target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
318        <!-- set if unset -->
319        <property name="workspace.changes.tr" value="" />
320        <copy todir="build/obj" file="resources/log4j.properties" />
321        <jar destfile="./jettylib/jetty-i2p.jar" basedir="./build/obj" includes="**/*.class log4j.properties" >
322            <manifest>
323                <attribute name="Built-By" value="${build.built-by}" />
324                <attribute name="Build-Date" value="${build.timestamp}" />
325                <attribute name="Base-Revision" value="${workspace.version}" />
326                <!-- needed by JettyStart for pre-0.7.5 wrapper.config -->
327                <attribute name="Class-Path" value="jetty-deploy.jar jetty-xml.jar" />
328                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
329            </manifest>
330        </jar>
331    </target>   
332
333    <target name="jarUpToDate">
334        <uptodate property="jar.uptodate" targetfile="jettylib/jetty-i2p.jar" >
335            <srcfiles dir= "build/obj" includes="**/*.class" />
336        </uptodate>
337        <condition property="shouldListChanges" >
338            <and>
339                <not>
340                    <isset property="jar.uptodate" />
341                </not>
342                <isset property="mtn.available" />
343            </and>
344        </condition>
345    </target>   
346
347    <target name="clean" >
348        <delete dir="./build" />
349        <delete file="${verified.filename}" />
350    </target>   
351    <target name="cleandep" depends="clean" />
352    <target name="distclean" depends="clean">
353        <delete dir="./jettylib" />
354      <!--
355        <echo message="Not actually deleting the jetty libs (since they're so large)" />
356       -->
357    </target>
358    <target name="reallyclean" depends="distclean">
359    </target>
360    <target name="totallyclean" depends="clean">
361        <delete dir="./jettylib" />
362        <delete file="${jetty.filename}" />
363    </target>
364    <target name="javadoc" >
365        <available property="jetty.zip.available" file="${jetty.filename}" type="file" />
366        <available property="jetty.zip.javadocExtracted" file="build/javadoc" type="dir" />
367        <ant target="fetchJettylib" />
368        <ant target="verifyJettylib" />
369        <ant target="extractJavadoc" />
370    </target>
371    <target name="extractJavadoc" unless="jetty.zip.javadocExtracted" >
372        <mkdir dir="./build" />
373        <mkdir dir="./build/javadoc" />
374        <unzip src="${jetty.filename}" dest="./build/javadoc" >
375            <patternset>
376                <include name="${jetty.base}/javadoc/" />
377            </patternset>
378            <mapper type="glob" from="${jetty.base}/javadoc/*" to="javadoc/*" />
379        </unzip>
380    </target>
381
382</project>
Note: See TracBrowser for help on using the repository browser.