source: apps/jetty/build.xml @ edf5ef5

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

remove dup docs from tomcat jars

  • Property mode set to 100644
File size: 11.2 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project basedir="." default="all" name="jetty">
3
4    <property name="jetty.ver" value="6.1.26" />
5    <property name="jetty.base" value="jetty-${jetty.ver}" />
6    <property name="jetty.sha1" value="9485913f1a1945a849a90f1a34853d22350bc524" />
7    <property name="jetty.filename" value="${jetty.base}.zip" />
8    <property name="jetty.url" value="http://dist.codehaus.org/jetty/${jetty.base}/${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    <target name="ensureJettylib" >
16        <available property="jetty.zip.available" file="${jetty.filename}" type="file" />
17        <available property="jetty.zip.extracted" file="jettylib" type="dir" />
18        <ant target="fetchJettylib" />
19        <ant target="verifyJettylib" />
20        <ant target="extractJettylib" />
21    </target>
22
23    <target name="fetchJettylib" unless="jetty.zip.available" >
24        <echo message="It seems that you don't have '${jetty.filename}' deployed." />
25        <echo message="The build script can download this file for you automatically," />
26        <echo message="or alternatively you can obtain it manually from:" />
27        <echo message="${jetty.url}" />
28        <echo message="" />
29        <echo message="The libraries contained in the fetched file provide the Jetty web server" />
30        <echo message="(http://jetty.mortbay.org/). They are not absolutely necessary" />
31        <echo message="but strongly recommended, since they are used by some applications" />
32        <echo message="on top of I2P, like the router console." />
33        <echo message="" />
34        <echo message="Even if you deploy the Jetty archive manually into directory apps/jetty/," />
35        <echo message="the build script will still attempt to verify its checksums, which must be:" />
36        <echo message="SHA1 ${jetty.sha1}" />
37        <echo message="" />
38        <input message="Download Jetty archive automatically?" validargs="y,n" addproperty="jetty.download" />
39        <fail message="Aborting as requested. Please deploy the Jetty archive manually." >
40            <condition>
41                <equals arg1="${jetty.download}" arg2="n"/>
42            </condition>
43        </fail>
44        <get src="${jetty.url}" verbose="true" dest="${jetty.filename}" />
45    </target>
46
47    <condition property="verified.already" >
48        <and>
49            <available file="${jetty.filename}" />
50            <uptodate property="foo.bar.baz" srcfile="${jetty.filename}" targetfile="${verified.filename}" />
51        </and>
52    </condition>
53
54    <target name="verifyJettylib" unless="verified.already" >
55        <condition property="jetty.zip.verified" >
56                <checksum file="${jetty.filename}" algorithm="SHA" property="${jetty.sha1}" />
57        </condition>
58        <fail message="Jetty archive does not match its checksum!" >
59            <condition>
60                <not>
61                    <istrue value="${jetty.zip.verified}" />
62                </not>
63            </condition>
64        </fail>
65        <touch file="${verified.filename}" />
66    </target>
67
68    <target name="extractJettylib" unless="jetty.zip.extracted" >
69      <!-- for .tgz -->
70      <!--
71        <gunzip src="${jetty.filename}" dest="jetty.tar" />
72        <untar src="jetty.tar" dest="." />
73      -->
74      <!-- for .zip -->
75        <unzip src="${jetty.filename}" dest="." />
76        <mkdir dir="jettylib" />
77      <!-- We copy everything to names without the version numbers so we
78           can update them later. Where there was something similar in Jetty 5,
79           we use the same names so they will overwrite the Jetty 5 jar on upgrade.
80           Otherwise we use the same name as the symlink in Ubuntu /usr/share/java.
81           Reasons for inclusion:
82              start.jar: Needed for clients.config startup of eepsites
83              jetty-util-xxx.jar: LifeCycle (base class for stuff), URIUtil (used in i2psnark)
84              jetty-sslengine-xxx.jar: SSL NIO Connector for console
85              jetty-java5-threadpool-xxx.jar: Concurrent thread pool for eepsite
86              glassfish 2.1: Not used, too old, see Tomcat below.
87              jetty-rewrite-handler: Not used by I2P, but only 20KB and could be useful for eepsites
88              All of these are available in the Ubuntu packages libjetty-java and libjetty-extra-java
89        -->
90        <copy preservelastmodified="true" file="${jetty.base}/start.jar" tofile="jettylib/jetty-start.jar" />
91        <copy file="${jetty.base}/lib/${jetty.base}.jar" tofile="jettylib/org.mortbay.jetty.jar" />
92        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-util-${jetty.ver}.jar" tofile="jettylib/jetty-util.jar" />
93        <copy preservelastmodified="true" file="${jetty.base}/lib/ext/jetty-java5-threadpool-${jetty.ver}.jar" tofile="jettylib/jetty-java5-threadpool.jar" />
94        <copy preservelastmodified="true" file="${jetty.base}/lib/ext/jetty-rewrite-handler-${jetty.ver}.jar" tofile="jettylib/jetty-rewrite-handler.jar" />
95        <copy preservelastmodified="true" file="${jetty.base}/lib/ext/jetty-sslengine-${jetty.ver}.jar" tofile="jettylib/jetty-sslengine.jar" />
96        <copy file="${jetty.base}/lib/jsp-2.1/ant-1.6.5.jar" tofile="jettylib/ant.jar" />
97        <delete file="jetty.tar" />
98        <delete dir="${jetty.base}" />
99        <!-- commons-logging.jar not in Jetty 6 but we have it in launch4j so copy it over, we need it
100             for org.apache.jasper.JspC compiler
101          -->
102        <copy preservelastmodified="true" file="../../installer/lib/launch4j/lib/commons-logging.jar" todir="jettylib/" />
103        <ant target="copyTomcatLib" />
104    </target>
105
106    <!-- Tomcat.
107         The glassfish jars bundled in Jetty 6 are way too old.
108         For compatibility with very old I2P installations where the classpath
109         was set individually in wrapper.config, we rename and combine the jars as follows:
110         jasper.jar : jasper-runtime.jar
111         jasper-el.jar + el-api.jar : commons-el.jar
112         servlet-api.jar + jsp-api.jar : javax.servlet.jar
113         tomcat-juli.jar : commons-logging.jar
114         empty jar : jasper-compiler.jar
115         Also, take NOTICE and LICENSE out of each one, we bundle those separately.
116     -->
117    <target name="copyTomcatLib" >
118        <jar destfile="jettylib/jasper-runtime.jar" >
119            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper.jar" />
120        </jar>
121        <jar destfile="jettylib/commons-el.jar" duplicate="preserve" >
122            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper-el.jar" />
123            <zipfileset excludes="META-INF/**/*" src="${tomcat.lib}/el-api.jar" />
124        </jar>
125        <jar destfile="jettylib/javax.servlet.jar" duplicate="preserve" >
126            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/servlet-api.jar" />
127            <zipfileset excludes="META-INF/**/*" src="${tomcat.lib}/jsp-api.jar" />
128        </jar>
129        <jar destfile="jettylib/commons-logging.jar" >
130            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-juli.jar" />
131        </jar>
132        <jar destfile="jettylib/jasper-compiler.jar" />
133    </target>
134
135    <target name="build" depends="jar" />
136
137    <target name="builddep" />
138    <target name="compile" depends="builddep, ensureJettylib" >
139        <mkdir dir="./build" />
140        <mkdir dir="./build/obj" />
141        <javac 
142            srcdir="./java/src" 
143            debug="true" source="1.5" target="1.5" 
144            destdir="./build/obj" 
145            includeAntRuntime="false"
146            classpath="../../core/java/build/i2p.jar:./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar:./jettylib/jetty-util.jar" >
147            <compilerarg line="${javac.compilerargs}" />
148        </javac>
149    </target>
150
151    <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" >
152        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
153            <arg value="list" />
154            <arg value="changed" />
155            <arg value="." />
156        </exec>
157        <!-- \n in an attribute value generates an invalid manifest -->
158        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
159            <arg value="-s" />
160            <arg value="[:space:]" />
161            <arg value="," />
162        </exec>
163    </target>
164
165    <!-- With Jetty 5 we replaced classes in the jar, but with Jetty 6 we
166         put our stuff in its own jar so we can work with standard Jetty 6 packages
167      -->
168    <target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
169        <!-- set if unset -->
170        <property name="workspace.changes.tr" value="" />
171        <copy todir="build/obj" file="resources/log4j.properties" />
172        <jar destfile="./jettylib/jetty-i2p.jar" basedir="./build/obj" includes="**/*.class log4j.properties" >
173            <manifest>
174                <attribute name="Build-Date" value="${build.timestamp}" />
175                <attribute name="Base-Revision" value="${workspace.version}" />
176                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
177            </manifest>
178        </jar>
179    </target>   
180
181    <target name="jarUpToDate">
182        <uptodate property="jar.uptodate" targetfile="jettylib/jetty-i2p.jar" >
183            <srcfiles dir= "build/obj" includes="**/*.class" />
184        </uptodate>
185        <condition property="shouldListChanges" >
186            <and>
187                <not>
188                    <isset property="jar.uptodate" />
189                </not>
190                <isset property="mtn.available" />
191            </and>
192        </condition>
193    </target>   
194
195    <target name="clean" >
196        <delete dir="./build" />
197        <delete file="${verified.filename}" />
198    </target>   
199    <target name="cleandep" depends="clean" />
200    <target name="distclean" depends="clean">
201        <delete dir="./jettylib" />
202        <echo message="Not actually deleting the jetty libs (since they're so large)" />
203    </target>
204    <target name="reallyclean" depends="distclean">
205    </target>
206    <target name="totallyclean" depends="clean">
207        <delete dir="./jettylib" />
208        <delete file="${jetty.filename}" />
209    </target>
210    <target name="javadoc" >
211        <available property="jetty.zip.available" file="${jetty.filename}" type="file" />
212        <available property="jetty.zip.javadocExtracted" file="build/javadoc" type="dir" />
213        <ant target="fetchJettylib" />
214        <ant target="verifyJettylib" />
215        <ant target="extractJavadoc" />
216    </target>
217    <target name="extractJavadoc" unless="jetty.zip.javadocExtracted" >
218        <mkdir dir="./build" />
219        <mkdir dir="./build/javadoc" />
220        <unzip src="${jetty.filename}" dest="./build/javadoc" >
221            <patternset>
222                <include name="${jetty.base}/javadoc/" />
223            </patternset>
224            <mapper type="glob" from="${jetty.base}/javadoc/*" to="javadoc/*" />
225        </unzip>
226    </target>
227
228</project>
Note: See TracBrowser for help on using the repository browser.