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-libjetty9-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 | <!-- Note: Change version numbers in top-level build.xml if you update to a new Tomcat or Jetty! --> |
---|
17 | |
---|
18 | <!-- jetty.branch unused until we go to 9.3 --> |
---|
19 | <property name="jetty.branch" value="stable-9" /> |
---|
20 | <property name="jetty.base" value="jetty-distribution-${jetty.ver}" /> |
---|
21 | <property name="jetty.sha1" value="086212b8536faa9a584777ebd59618fa4d7176a0" /> |
---|
22 | <property name="jetty.filename" value="${jetty.base}.zip" /> |
---|
23 | <!-- change jetty.ver to jetty.branch for 9.3 --> |
---|
24 | <property name="jetty.url" value="http://central.maven.org/maven2/org/eclipse/jetty/jetty-distribution/${jetty.ver}/${jetty.filename}" /> |
---|
25 | <property name="verified.filename" value="verified.txt" /> |
---|
26 | <property name="javac.compilerargs" value="" /> |
---|
27 | <property name="javac.version" value="1.7" /> |
---|
28 | <property name="manifest.classpath.name" value="Class-Path" /> |
---|
29 | |
---|
30 | <!-- everything we need is in the deployer package, except for tomcat-api.jar in the full package, |
---|
31 | so we just use the full package instead. |
---|
32 | <property name="tomcat.lib" value="apache-tomcat-${tomcat.ver}-deployer/lib" /> |
---|
33 | --> |
---|
34 | <property name="tomcat.lib" value="apache-tomcat-${tomcat.ver}/lib" /> |
---|
35 | <property name="tomcat.bin" value="apache-tomcat-${tomcat.ver}/bin" /> |
---|
36 | |
---|
37 | <target name="all" depends="build" /> |
---|
38 | |
---|
39 | <!-- |
---|
40 | - We now check in the jars we need to ${jetty.base}, so |
---|
41 | - fetchJettylib, verifyJettylib, and extractJettylib are not used unless |
---|
42 | - updating to a new Jetty version by changing ${jetty.ver} and ${jetty.sha1} above. |
---|
43 | --> |
---|
44 | |
---|
45 | <!-- verify everything we need is in jettylib/ --> |
---|
46 | <target name="ensureJettylib" depends="ensureJettylib1, copyJettylib" /> |
---|
47 | |
---|
48 | <target name="ensureJettylib1" > |
---|
49 | <condition property="jetty.zip.extracted" > |
---|
50 | <or> |
---|
51 | <istrue value="${with-libjetty9-java}" /> |
---|
52 | <available file="${jetty.base}" type="dir" /> |
---|
53 | </or> |
---|
54 | </condition> |
---|
55 | <condition property="jetty.zip.available" > |
---|
56 | <or> |
---|
57 | <istrue value="${jetty.zip.extracted}" /> |
---|
58 | <available file="${jetty.filename}" type="file" /> |
---|
59 | </or> |
---|
60 | </condition> |
---|
61 | <condition property="verified.already" > |
---|
62 | <or> |
---|
63 | <istrue value="${with-libjetty9-java}" /> |
---|
64 | <istrue value="${jetty.zip.extracted}" /> |
---|
65 | <and> |
---|
66 | <available file="${jetty.filename}" /> |
---|
67 | <uptodate property="foo.bar.baz" srcfile="${jetty.filename}" targetfile="${verified.filename}" /> |
---|
68 | </and> |
---|
69 | </or> |
---|
70 | </condition> |
---|
71 | </target> |
---|
72 | |
---|
73 | <!-- |
---|
74 | <target name="ensureJettylib" depends="extractJettylib" /> |
---|
75 | --> |
---|
76 | |
---|
77 | <target name="fetchJettylib" unless="jetty.zip.available" > |
---|
78 | <fail message="Error - jetty.ver property not set - you must run from top level build.xml" > |
---|
79 | <condition> |
---|
80 | <not> |
---|
81 | <isset property="jetty.ver" /> |
---|
82 | </not> |
---|
83 | </condition> |
---|
84 | </fail> |
---|
85 | <echo message="It seems that you don't have '${jetty.filename}' deployed." /> |
---|
86 | <echo message="The build script can download this file for you automatically," /> |
---|
87 | <echo message="or alternatively you can obtain it manually from:" /> |
---|
88 | <echo message="${jetty.url}" /> |
---|
89 | <echo message="" /> |
---|
90 | <echo message="The libraries contained in the fetched file provide the Jetty web server" /> |
---|
91 | <echo message="(http://jetty.mortbay.org/). They are not absolutely necessary" /> |
---|
92 | <echo message="but strongly recommended, since they are used by some applications" /> |
---|
93 | <echo message="on top of I2P, like the router console." /> |
---|
94 | <echo message="" /> |
---|
95 | <echo message="Even if you deploy the Jetty archive manually into directory apps/jetty/," /> |
---|
96 | <echo message="the build script will still attempt to verify its checksums, which must be:" /> |
---|
97 | <echo message="SHA1 ${jetty.sha1}" /> |
---|
98 | <echo message="" /> |
---|
99 | <input message="Download Jetty archive automatically?" validargs="y,n" addproperty="jetty.download" /> |
---|
100 | <fail message="Aborting as requested. Please deploy the Jetty archive manually." > |
---|
101 | <condition> |
---|
102 | <equals arg1="${jetty.download}" arg2="n"/> |
---|
103 | </condition> |
---|
104 | </fail> |
---|
105 | <get src="${jetty.url}" verbose="true" dest="${jetty.filename}" /> |
---|
106 | </target> |
---|
107 | |
---|
108 | <target name="verifyJettylib" depends="fetchJettylib" unless="verified.already" > |
---|
109 | <condition property="jetty.zip.verified" > |
---|
110 | <checksum file="${jetty.filename}" algorithm="SHA" property="${jetty.sha1}" /> |
---|
111 | </condition> |
---|
112 | <fail message="Jetty archive does not match its checksum!" > |
---|
113 | <condition> |
---|
114 | <not> |
---|
115 | <istrue value="${jetty.zip.verified}" /> |
---|
116 | </not> |
---|
117 | </condition> |
---|
118 | </fail> |
---|
119 | <touch file="${verified.filename}" /> |
---|
120 | </target> |
---|
121 | |
---|
122 | <target name="extractJettylib" depends="verifyJettylib" unless="jetty.zip.extracted" > |
---|
123 | <!-- for .tgz --> |
---|
124 | <!-- |
---|
125 | <gunzip src="${jetty.filename}" dest="jetty.tar" /> |
---|
126 | <untar src="jetty.tar" dest="." /> |
---|
127 | --> |
---|
128 | <!-- for .zip --> |
---|
129 | <unzip src="${jetty.filename}" dest="." /> |
---|
130 | </target> |
---|
131 | |
---|
132 | <target name="mkJettylibdir" > |
---|
133 | <mkdir dir="jettylib" /> |
---|
134 | </target> |
---|
135 | |
---|
136 | <!-- Jetty and tomcat files --> |
---|
137 | <!-- |
---|
138 | We support the following configurations: |
---|
139 | no system jars: Precise, Trusty |
---|
140 | with-libtomcat8-java: Jessie (without backports), Wheezy |
---|
141 | with-libtomcat8-java AND with-libjetty9-java: Xenial, Jessie (with backports), Stretch |
---|
142 | with-libtomcat9-java: Buster |
---|
143 | with-libtomcat9-java AND with-libjetty9-java: Buster |
---|
144 | with-libjetty9-java (only): not supported |
---|
145 | --> |
---|
146 | <target name="copyJettylib" depends="mkJettylibdir, copyJettylib1, copyTomcatLib1, copyJettylib2, copyJettylib3, copyTomcatLib" /> |
---|
147 | |
---|
148 | <!-- Jetty files only --> |
---|
149 | <target name="copyJettylib1" depends="extractJettylib, buildPatches" unless="${with-libjetty9-java}" > |
---|
150 | <!-- We copy everything to names without the version numbers so we |
---|
151 | can update them later. Where there was something similar in Jetty 5/6, |
---|
152 | we use the same names so they will overwrite the Jetty 5/6 jar on upgrade. |
---|
153 | Otherwise we use the same name as the symlink in Ubuntu /usr/share/java. |
---|
154 | Reasons for inclusion: |
---|
155 | start.jar: Needed for clients.config startup of eepsites |
---|
156 | jetty-util-xxx.jar: LifeCycle (base class for stuff), URIUtil (used in i2psnark) |
---|
157 | jetty-deploy, -http, -io, -security, -servlet, -webapp: All split out from main server jar in Jetty 7 |
---|
158 | jetty-continuation-xxx.jar: Needed? Useful? |
---|
159 | jetty-servlets-xxx.jar: Needed for CGI for eepsite |
---|
160 | jetty-sslengine-xxx.jar: Old Jetty 6, now a dummy |
---|
161 | jetty-java5-threadpool-xxx.jar: Old Jetty 6, now a dummy |
---|
162 | jetty-rewrite-handler: Not used by I2P, but only 20KB and could be useful for eepsites |
---|
163 | jetty-management: Not used by I2P, but only 34KB and could be useful for eepsites, and we bundled it with Jetty 5 |
---|
164 | javax.servlet.jsp-2.2.0.v201112011158.jar: Required API |
---|
165 | servlet-api-3.0.jar: Required API |
---|
166 | All of these are available in the Ubuntu packages libjetty-java and libjetty-extra-java |
---|
167 | --> |
---|
168 | <copy preservelastmodified="true" file="${jetty.base}/start.jar" tofile="jettylib/jetty-start.jar" /> |
---|
169 | <copy file="${jetty.base}/lib/jetty-server-${jetty.ver}.jar" tofile="jettylib/org.mortbay.jetty.jar" /> |
---|
170 | <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-continuation-${jetty.ver}.jar" tofile="jettylib/jetty-continuation.jar" /> |
---|
171 | <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-deploy-${jetty.ver}.jar" tofile="jettylib/jetty-deploy.jar" /> |
---|
172 | <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-http-${jetty.ver}.jar" tofile="jettylib/jetty-http.jar" /> |
---|
173 | <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-io-${jetty.ver}.jar" tofile="jettylib/jetty-io.jar" /> |
---|
174 | <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-jmx-${jetty.ver}.jar" tofile="jettylib/org.mortbay.jmx.jar" /> |
---|
175 | <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-rewrite-${jetty.ver}.jar" tofile="jettylib/jetty-rewrite-handler.jar" /> |
---|
176 | <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-security-${jetty.ver}.jar" tofile="jettylib/jetty-security.jar" /> |
---|
177 | <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-servlet-${jetty.ver}.jar" tofile="jettylib/jetty-servlet.jar" /> |
---|
178 | <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-servlets-${jetty.ver}.jar" tofile="jettylib/jetty-servlets.jar" /> |
---|
179 | <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-util-${jetty.ver}.jar" tofile="jettylib/jetty-util.jar" /> |
---|
180 | <!-- comment out above line and uncomment below and the patches section further down if we need patches |
---|
181 | <jar destfile="jettylib/jetty-util.jar" manifest="${jetty.base}/lib/jetty-util-${jetty.ver}.jar" filesetmanifest="mergewithoutmain" > |
---|
182 | <zipfileset excludes="**/RolloverFileOutputStream*.class" src="${jetty.base}/lib/jetty-util-${jetty.ver}.jar" /> |
---|
183 | <zipfileset src="build/jetty-util-patch.jar" /> |
---|
184 | </jar> |
---|
185 | --> |
---|
186 | <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-webapp-${jetty.ver}.jar" tofile="jettylib/jetty-webapp.jar" /> |
---|
187 | <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-xml-${jetty.ver}.jar" tofile="jettylib/jetty-xml.jar" /> |
---|
188 | <jar destfile="jettylib/jetty-java5-threadpool.jar" > |
---|
189 | <manifest> |
---|
190 | <attribute name="Note" value="Intentionally empty" /> |
---|
191 | </manifest> |
---|
192 | </jar> |
---|
193 | <jar destfile="jettylib/jetty-sslengine.jar" > |
---|
194 | <manifest> |
---|
195 | <attribute name="Note" value="Intentionally empty" /> |
---|
196 | </manifest> |
---|
197 | </jar> |
---|
198 | </target> |
---|
199 | |
---|
200 | <!-- |
---|
201 | Make javax.servlet.jar. |
---|
202 | If with-libtomcat8-java or with-libtomcat9-java but not with-libjetty9-java, we don't do this. |
---|
203 | copyTomcatLib1 dependency to set the with-libtomcat-java variable. |
---|
204 | --> |
---|
205 | <target name="copyJettylib2" depends="extractJettylib, copyTomcatLib1" unless="${with-libtomcat-java}" > |
---|
206 | <jar destfile="jettylib/javax.servlet.jar" duplicate="preserve" filesetmanifest="mergewithoutmain" > |
---|
207 | <!-- all versions - Servlet API --> |
---|
208 | <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" /> |
---|
209 | |
---|
210 | <!-- |
---|
211 | Jetty version - see below for why we don't use this one |
---|
212 | <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" /> |
---|
213 | --> |
---|
214 | |
---|
215 | <!-- Apache in Jetty package version --> |
---|
216 | <!-- Also includes org.apache.*, this is copied into jasper-runtime.jar below --> |
---|
217 | <!-- In Debian packages they are found in /usr/share/java/tomcat8-servlet-api.jar in the libtomcat8-java package --> |
---|
218 | <!-- javax/servlet/jsp/resources are dups of those in apache-jsp jar --> |
---|
219 | <!-- |
---|
220 | <zipfileset includes="javax/**/*" src="${jetty.base}/lib/apache-jsp/org.mortbay.jasper.apache-jsp-8.0.33.jar"/> |
---|
221 | <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties javax/servlet/jsp/resources/*" src="${jetty.base}/lib/jetty-schemas-3.1.jar" /> |
---|
222 | --> |
---|
223 | |
---|
224 | <!-- Apache package version --> |
---|
225 | <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jsp-api.jar"/> |
---|
226 | <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties" src="${jetty.base}/lib/jetty-schemas-3.1.jar" /> |
---|
227 | </jar> |
---|
228 | <!-- |
---|
229 | <delete file="jetty.tar" /> |
---|
230 | <delete dir="${jetty.base}" /> |
---|
231 | --> |
---|
232 | </target> |
---|
233 | |
---|
234 | <!-- Copy jetty-apache-jsp.jar --> |
---|
235 | <!-- ONLY if with-libtomcat8-java but NOT with-libjetty9-java (wheezy/jessie configuration) --> |
---|
236 | <!-- If neither with-libtomcat8-java nor with-libjetty9-java, it's merged into jasper-runtime.jar in the copyTomcatLib2 target below --> |
---|
237 | <target name="copyJettylib3" depends="extractJettylib, copyTomcatLib1" if="${with-libtomcat-without-libjetty}" > |
---|
238 | <copy preservelastmodified="true" file="${jetty.base}/lib/apache-jsp/org.eclipse.jetty.apache-jsp-${jetty.ver}.jar" tofile="jettylib/jetty-apache-jsp.jar" /> |
---|
239 | </target> |
---|
240 | |
---|
241 | <!-- Tomcat. |
---|
242 | The glassfish jars bundled in Jetty 6 are way too old. |
---|
243 | For compatibility with very old I2P installations where the classpath |
---|
244 | was set individually in wrapper.config, we rename and combine the jars as follows: |
---|
245 | jasper.jar : jasper-runtime.jar |
---|
246 | jasper-el.jar + el-api.jar : commons-el.jar |
---|
247 | tomcat-juli.jar : Add to jasper-runtime.jar |
---|
248 | empty jar : jasper-compiler.jar |
---|
249 | Also, take NOTICE and LICENSE out of each one, we bundle those separately. |
---|
250 | |
---|
251 | Not as of Jetty 8 (using from Jetty): |
---|
252 | servlet-api.jar + jsp-api.jar : javax.servlet.jar |
---|
253 | If we go to Tomcat 7: |
---|
254 | tomcat-api.jar + tomcat-util.jar: Add to javax.servlet.jar (as of Tomcat 7 / Jetty 8) |
---|
255 | --> |
---|
256 | <target name="copyTomcatLib" depends="mkJettylibdir, copyTomcatLib1, copyTomcatLib2, copyTomcatLib3" /> |
---|
257 | |
---|
258 | <target name="copyTomcatLib1" > |
---|
259 | <condition property="with-libtomcat-java" > |
---|
260 | <or> |
---|
261 | <istrue value="${with-libtomcat6-java}" /> |
---|
262 | <istrue value="${with-libtomcat7-java}" /> |
---|
263 | <istrue value="${with-libtomcat8-java}" /> |
---|
264 | <istrue value="${with-libtomcat9-java}" /> |
---|
265 | </or> |
---|
266 | </condition> |
---|
267 | <condition property="with-libtomcat-without-libjetty" > |
---|
268 | <and> |
---|
269 | <istrue value="${with-libtomcat-java}" /> |
---|
270 | <not> |
---|
271 | <istrue value="${with-libjetty9-java}" /> |
---|
272 | </not> |
---|
273 | </and> |
---|
274 | </condition> |
---|
275 | </target> |
---|
276 | |
---|
277 | |
---|
278 | <!-- Make commons-el.jar and jasper-runtime.jar --> |
---|
279 | <target name="copyTomcatLib2" unless="${with-libtomcat-java}" > |
---|
280 | <!-- EL API and compiler libs. |
---|
281 | Tomcat 6 has EL 2.1. |
---|
282 | Tomcat 7 / libservlet3.0 has EL 2.2. |
---|
283 | Jetty 9 / Tomcat 8 / libservlet3.1 has EL 3.0. |
---|
284 | According to http://stackoverflow.com/questions/7202686/differences-between-el-2-1-and-2-2 |
---|
285 | 2.2 is backwards-compatible with 2.1. |
---|
286 | --> |
---|
287 | <!-- the javax.el API, AND the com.sun.el parser --> |
---|
288 | <!-- actually from jetty9, not tomcat8... this will fail unless we have the jetty files also --> |
---|
289 | <jar destfile="jettylib/commons-el.jar" duplicate="preserve" filesetmanifest="mergewithoutmain"> |
---|
290 | <!-- |
---|
291 | Jetty version |
---|
292 | <zipfileset src="${jetty.base}/lib/jsp/javax.el-3.0.0.jar"/> |
---|
293 | --> |
---|
294 | |
---|
295 | <!-- Apache in Jetty package version --> |
---|
296 | <!-- |
---|
297 | <zipfileset src="${jetty.base}/lib/apache-jsp/org.mortbay.jasper.apache-el-${tomcat.ver}.jar"/> |
---|
298 | --> |
---|
299 | |
---|
300 | <!-- Apache package version --> |
---|
301 | <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/el-api.jar"/> |
---|
302 | <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper-el.jar"/> |
---|
303 | </jar> |
---|
304 | |
---|
305 | <!-- actually from jetty9, not tomcat8... this will fail unless we have the jetty files also --> |
---|
306 | <jar destfile="jettylib/jasper-runtime.jar" duplicate="preserve" filesetmanifest="mergewithoutmain" > |
---|
307 | <!-- |
---|
308 | Jetty version |
---|
309 | <zipfileset src="${jetty.base}/lib/jsp/javax.servlet.jsp-2.3.2.jar"/> |
---|
310 | To be included in jasper-runtime.jar? |
---|
311 | Server complains "NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet" even with this included (but it still works). |
---|
312 | The following file has the class, but /usr/share/java/jetty8-jsp.jar is empty |
---|
313 | We don't use this one, because we want to be consistent with Debian builds that |
---|
314 | must use Apache (aka libtomcat8). |
---|
315 | <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties" src="${jetty.base}/lib/jsp/jetty-jsp-${jetty.ver}.jar" /> |
---|
316 | --> |
---|
317 | |
---|
318 | <!-- For both Apache in Jetty package and Apache package versions --> |
---|
319 | <!-- required Jetty initializer (see RouterConsoleRunner) --> |
---|
320 | <zipfileset src="${jetty.base}/lib/apache-jsp/org.eclipse.jetty.apache-jsp-${jetty.ver}.jar"/> |
---|
321 | |
---|
322 | <!-- Apache in Jetty package version --> |
---|
323 | <!-- Also includes javax.servlet.jsp.*, this is copied into javax.servlet.jar above --> |
---|
324 | <!-- |
---|
325 | <zipfileset src="${jetty.base}/lib/apache-jsp/org.mortbay.jasper.apache-jsp-${jetty.ver}.jar"/> |
---|
326 | --> |
---|
327 | |
---|
328 | <!-- Apache package version --> |
---|
329 | <!-- we match what was bundled in the Jetty package version --> |
---|
330 | <!-- except we need compat/ as of 8.5.29 or JspC fails in the jar scan --> |
---|
331 | <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper.jar"/> |
---|
332 | <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-api.jar"/> |
---|
333 | <zipfileset includes="org/apache/juli/logging/**/*" src="${tomcat.bin}/tomcat-juli.jar"/> |
---|
334 | <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE org/apache/tomcat/util/codec/ org/apache/tomcat/util/threads/" src="${tomcat.lib}/tomcat-util.jar"/> |
---|
335 | <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-util-scan.jar"/> |
---|
336 | </jar> |
---|
337 | |
---|
338 | <jar destfile="jettylib/commons-logging.jar" update="true" > |
---|
339 | <manifest> |
---|
340 | <attribute name="Note" value="Intentionally empty" /> |
---|
341 | </manifest> |
---|
342 | </jar> |
---|
343 | </target> |
---|
344 | |
---|
345 | <target name="copyTomcatLib3" unless="${with-libtomcat-java}" > |
---|
346 | <jar destfile="jettylib/jasper-compiler.jar" > |
---|
347 | <manifest> |
---|
348 | <attribute name="Note" value="Intentionally empty" /> |
---|
349 | </manifest> |
---|
350 | </jar> |
---|
351 | </target> |
---|
352 | |
---|
353 | <target name="build" depends="jar" /> |
---|
354 | |
---|
355 | <target name="builddep" /> |
---|
356 | |
---|
357 | <condition property="depend.available"> |
---|
358 | <typefound name="depend" /> |
---|
359 | </condition> |
---|
360 | |
---|
361 | <target name="depend" if="depend.available"> |
---|
362 | <depend |
---|
363 | cache="../../build" |
---|
364 | srcdir="./java/src" |
---|
365 | destdir="./build/obj" > |
---|
366 | <classpath> |
---|
367 | <pathelement location="../../../core/java/build/i2p.jar" /> |
---|
368 | <pathelement location="./jettylib/org.mortbay.jetty.jar" /> |
---|
369 | <pathelement location="./jettylib/javax.servlet.jar" /> |
---|
370 | <pathelement location="./jettylib/jetty-http.jar" /> |
---|
371 | <pathelement location="./jettylib/jetty-io.jar" /> |
---|
372 | <pathelement location="./jettylib/jetty-security.jar" /> |
---|
373 | <pathelement location="./jettylib/jetty-servlet.jar" /> |
---|
374 | <pathelement location="./jettylib/jetty-util.jar" /> |
---|
375 | <pathelement location="./jettylib/jetty-xml.jar" /> |
---|
376 | </classpath> |
---|
377 | </depend> |
---|
378 | </target> |
---|
379 | |
---|
380 | <target name="compile" depends="builddep, ensureJettylib, depend" > |
---|
381 | <mkdir dir="./build" /> |
---|
382 | <mkdir dir="./build/obj" /> |
---|
383 | <javac |
---|
384 | srcdir="./java/src" |
---|
385 | debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" |
---|
386 | destdir="./build/obj" |
---|
387 | includeAntRuntime="false" |
---|
388 | classpath="../../core/java/build/i2p.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar:./jettylib/jetty-http.jar:./jettylib/jetty-io.jar:./jettylib/jetty-security.jar:./jettylib/jetty-servlet.jar:./jettylib/jetty-util.jar:./jettylib/jetty-xml.jar" > |
---|
389 | <compilerarg line="${javac.compilerargs}" /> |
---|
390 | </javac> |
---|
391 | </target> |
---|
392 | |
---|
393 | <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" > |
---|
394 | <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
395 | <arg value="list" /> |
---|
396 | <arg value="changed" /> |
---|
397 | <arg value="." /> |
---|
398 | </exec> |
---|
399 | <!-- \n in an attribute value generates an invalid manifest --> |
---|
400 | <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
401 | <arg value="-s" /> |
---|
402 | <arg value="[:space:]" /> |
---|
403 | <arg value="," /> |
---|
404 | </exec> |
---|
405 | </target> |
---|
406 | |
---|
407 | <!-- With Jetty 5 we replaced classes in the jar, but with Jetty 6 we |
---|
408 | put our stuff in its own jar so we can work with standard Jetty 6 packages |
---|
409 | --> |
---|
410 | <target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" > |
---|
411 | <!-- set if unset --> |
---|
412 | <property name="workspace.changes.tr" value="" /> |
---|
413 | <copy todir="build/obj" file="resources/log4j.properties" /> |
---|
414 | <jar destfile="./jettylib/jetty-i2p.jar" basedir="./build/obj" includes="**/*.class log4j.properties" > |
---|
415 | <manifest> |
---|
416 | <attribute name="Built-By" value="${build.built-by}" /> |
---|
417 | <attribute name="Build-Date" value="${build.timestamp}" /> |
---|
418 | <attribute name="Base-Revision" value="${workspace.version}" /> |
---|
419 | <!-- needed by JettyStart for pre-0.7.5 wrapper.config --> |
---|
420 | <attribute name="${manifest.classpath.name}" value="jetty-deploy.jar jetty-xml.jar" /> |
---|
421 | <attribute name="Workspace-Changes" value="${workspace.changes.tr}" /> |
---|
422 | <attribute name="X-Compile-Source-JDK" value="${javac.version}" /> |
---|
423 | <attribute name="X-Compile-Target-JDK" value="${javac.version}" /> |
---|
424 | </manifest> |
---|
425 | </jar> |
---|
426 | </target> |
---|
427 | |
---|
428 | <target name="jarUpToDate"> |
---|
429 | <uptodate property="jar.uptodate" targetfile="jettylib/jetty-i2p.jar" > |
---|
430 | <srcfiles dir= "build/obj" includes="**/*.class" /> |
---|
431 | </uptodate> |
---|
432 | <condition property="shouldListChanges" > |
---|
433 | <and> |
---|
434 | <not> |
---|
435 | <isset property="jar.uptodate" /> |
---|
436 | </not> |
---|
437 | <isset property="mtn.available" /> |
---|
438 | </and> |
---|
439 | </condition> |
---|
440 | </target> |
---|
441 | |
---|
442 | <!-- empty, uncomment below if needed --> |
---|
443 | <target name="buildPatches" unless="${with-libjetty9-java}" /> |
---|
444 | <!-- |
---|
445 | <target name="buildPatches" depends="jarPatches" unless="${with-libjetty9-java}" /> |
---|
446 | |
---|
447 | <target name="compilePatches" unless="${with-libjetty9-java}" > |
---|
448 | <mkdir dir="./build" /> |
---|
449 | <mkdir dir="./build/objPatches" /> |
---|
450 | <javac |
---|
451 | srcdir="./patches/jetty-util/src/main/java" |
---|
452 | debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" |
---|
453 | destdir="./build/objPatches" |
---|
454 | includeAntRuntime="false" |
---|
455 | classpath="" > |
---|
456 | <compilerarg line="${javac.compilerargs}" /> |
---|
457 | </javac> |
---|
458 | </target> |
---|
459 | |
---|
460 | <target name="jarPatches" depends="compilePatches, jarPatchesUpToDate" unless="jarPatches.uptodate" > |
---|
461 | <jar destfile="./build/jetty-util-patch.jar" basedir="./build/objPatches" includes="**/*.class" > |
---|
462 | </jar> |
---|
463 | </target> |
---|
464 | |
---|
465 | <target name="jarPatchesUpToDate" > |
---|
466 | <condition property="jarPatches.uptodate" > |
---|
467 | <or> |
---|
468 | <equals arg1="${with-libjetty9-java}" arg2="true" /> |
---|
469 | <uptodate property="jarPatches.uptodate" targetfile="jettylib/jetty-i2p.jar" > |
---|
470 | <srcfiles dir= "build/objPatches" includes="**/*.class" /> |
---|
471 | </uptodate> |
---|
472 | </or> |
---|
473 | </condition> |
---|
474 | </target> |
---|
475 | --> |
---|
476 | |
---|
477 | <target name="clean" > |
---|
478 | <delete dir="./build" /> |
---|
479 | <delete file="${verified.filename}" /> |
---|
480 | </target> |
---|
481 | <target name="cleandep" depends="clean" /> |
---|
482 | <target name="distclean" depends="clean"> |
---|
483 | <delete dir="./jettylib" /> |
---|
484 | <!-- |
---|
485 | <echo message="Not actually deleting the jetty libs (since they're so large)" /> |
---|
486 | --> |
---|
487 | </target> |
---|
488 | <target name="reallyclean" depends="distclean"> |
---|
489 | </target> |
---|
490 | <target name="totallyclean" depends="clean"> |
---|
491 | <delete dir="./jettylib" /> |
---|
492 | <delete file="${jetty.filename}" /> |
---|
493 | </target> |
---|
494 | <target name="javadoc" > |
---|
495 | <available property="jetty.zip.available" file="${jetty.filename}" type="file" /> |
---|
496 | <available property="jetty.zip.javadocExtracted" file="build/javadoc" type="dir" /> |
---|
497 | <ant target="fetchJettylib" /> |
---|
498 | <ant target="verifyJettylib" /> |
---|
499 | <ant target="extractJavadoc" /> |
---|
500 | </target> |
---|
501 | <target name="extractJavadoc" unless="jetty.zip.javadocExtracted" > |
---|
502 | <mkdir dir="./build" /> |
---|
503 | <mkdir dir="./build/javadoc" /> |
---|
504 | <unzip src="${jetty.filename}" dest="./build/javadoc" > |
---|
505 | <patternset> |
---|
506 | <include name="${jetty.base}/javadoc/" /> |
---|
507 | </patternset> |
---|
508 | <mapper type="glob" from="${jetty.base}/javadoc/*" to="javadoc/*" /> |
---|
509 | </unzip> |
---|
510 | </target> |
---|
511 | |
---|
512 | <!-- for Maven Central --> |
---|
513 | <target name="servletJar" depends="compile" > |
---|
514 | <!-- set if unset --> |
---|
515 | <jar destfile="./build/servlet-i2p-${release.number}.jar" basedir="./build/obj" includes="net/i2p/servlet/filters/*.class" > |
---|
516 | <manifest> |
---|
517 | <attribute name="Specification-Title" value="I2P Servlet classes" /> |
---|
518 | <attribute name="Specification-Version" value="${release.number}" /> |
---|
519 | <attribute name="Specification-Vendor" value="The I2P Project https://geti2p.net/" /> |
---|
520 | <attribute name="Implementation-Title" value="I2P Java Servlet classes" /> |
---|
521 | <attribute name="Implementation-Version" value="${full.version}" /> |
---|
522 | <attribute name="Implementation-Vendor" value="The I2P Project https://geti2p.net/" /> |
---|
523 | <attribute name="Built-By" value="${build.built-by}" /> |
---|
524 | <attribute name="Build-Date" value="${build.timestamp}" /> |
---|
525 | <attribute name="Base-Revision" value="${workspace.version}" /> |
---|
526 | <attribute name="X-Compile-Source-JDK" value="${javac.version}" /> |
---|
527 | <attribute name="X-Compile-Target-JDK" value="${javac.version}" /> |
---|
528 | </manifest> |
---|
529 | </jar> |
---|
530 | </target> |
---|
531 | |
---|
532 | <target name="servletJavadoc"> |
---|
533 | <mkdir dir="./build" /> |
---|
534 | <mkdir dir="./build/servlet-i2p-javadoc" /> |
---|
535 | <javadoc access="package" |
---|
536 | source="${javac.version}" |
---|
537 | destdir="./build/servlet-i2p-javadoc" |
---|
538 | packagenames="*" |
---|
539 | use="true" |
---|
540 | splitindex="true" |
---|
541 | failonerror="true" |
---|
542 | additionalparam="-notimestamp" |
---|
543 | doctitle="I2P Javadocs for Release ${release.number} Build ${i2p.build.number}${build.extra}" |
---|
544 | windowtitle="I2P Anonymous Network - Java Documentation - Version ${release.number}"> |
---|
545 | <group title="Jetty Utilities" packages="*" /> |
---|
546 | <sourcepath> |
---|
547 | <pathelement location="./java/src" /> |
---|
548 | </sourcepath> |
---|
549 | <classpath> |
---|
550 | <pathelement location="../../core/java/build/i2p.jar" /> |
---|
551 | <pathelement location="./jettylib/org.mortbay.jetty.jar" /> |
---|
552 | <pathelement location="./jettylib/javax.servlet.jar" /> |
---|
553 | <pathelement location="./jettylib/jetty-http.jar" /> |
---|
554 | <pathelement location="./jettylib/jetty-io.jar" /> |
---|
555 | <pathelement location="./jettylib/jetty-security.jar" /> |
---|
556 | <pathelement location="./jettylib/jetty-servlet.jar" /> |
---|
557 | <pathelement location="./jettylib/jetty-util.jar" /> |
---|
558 | <pathelement location="./jettylib/jetty-xml.jar" /> |
---|
559 | <!-- following are only for debian builds --> |
---|
560 | <pathelement location="../../core/java/build/libintl.jar" /> |
---|
561 | <pathelement location="../../core/java/build/gnu-getopt.jar" /> |
---|
562 | <pathelement location="../../core/java/build/json-simple.jar" /> |
---|
563 | </classpath> |
---|
564 | <!-- These variables are stored in build.properties. |
---|
565 | End-users can override by creating the file override.properties --> |
---|
566 | <link offline="true" href="${javasedocs.url}" packagelistLoc="../../installer/resources/package-lists/java/" /> |
---|
567 | <link offline="true" href="${javaeedocs.url}" packagelistLoc="../../installer/resources/package-lists/javaee/" /> |
---|
568 | <link offline="true" href="${jettydocs.url}" packagelistLoc="../../installer/resources/package-lists/jetty/" /> |
---|
569 | <link offline="true" href="${wrapperdocs.url}" packagelistLoc="../../installer/resources/package-lists/wrapper/" /> |
---|
570 | </javadoc> |
---|
571 | </target> |
---|
572 | |
---|
573 | <target name="servletJavadocJar" depends="servletJavadoc"> |
---|
574 | <jar jarfile="./build/servlet-i2p-${release.number}-javadoc.jar"> |
---|
575 | <fileset dir="./build/servlet-i2p-javadoc" /> |
---|
576 | </jar> |
---|
577 | </target> |
---|
578 | |
---|
579 | <target name="servletSourcesJar"> |
---|
580 | <jar jarfile="./build/servlet-i2p-${release.number}-sources.jar"> |
---|
581 | <fileset dir="./java/src" includes="net/i2p/servlet/filters/**" /> |
---|
582 | </jar> |
---|
583 | </target> |
---|
584 | |
---|
585 | </project> |
---|