source: apps/jetty/build.xml @ 994b51b

Last change on this file since 994b51b was 994b51b, checked in by zzz <zzz@…>, 3 years ago

update to Jetty 9.2.20

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