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