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 | |
---|
12 | <target name="all" depends="build" /> |
---|
13 | |
---|
14 | <target name="ensureJettylib" > |
---|
15 | <available property="jetty.zip.available" file="${jetty.filename}" type="file" /> |
---|
16 | <available property="jetty.zip.extracted" file="jettylib" type="dir" /> |
---|
17 | <ant target="fetchJettylib" /> |
---|
18 | <ant target="verifyJettylib" /> |
---|
19 | <ant target="extractJettylib" /> |
---|
20 | </target> |
---|
21 | |
---|
22 | <target name="fetchJettylib" unless="jetty.zip.available" > |
---|
23 | <echo message="It seems that you don't have '${jetty.filename}' deployed." /> |
---|
24 | <echo message="The build script can download this file for you automatically," /> |
---|
25 | <echo message="or alternatively you can obtain it manually from:" /> |
---|
26 | <echo message="${jetty.url}" /> |
---|
27 | <echo message="" /> |
---|
28 | <echo message="The libraries contained in the fetched file provide the Jetty web server" /> |
---|
29 | <echo message="(http://jetty.mortbay.org/). They are not absolutely necessary" /> |
---|
30 | <echo message="but strongly recommended, since they are used by some applications" /> |
---|
31 | <echo message="on top of I2P, like the router console." /> |
---|
32 | <echo message="" /> |
---|
33 | <echo message="Even if you deploy the Jetty archive manually into directory apps/jetty/," /> |
---|
34 | <echo message="the build script will still attempt to verify its checksums, which must be:" /> |
---|
35 | <echo message="SHA1 ${jetty.sha1}" /> |
---|
36 | <echo message="" /> |
---|
37 | <input message="Download Jetty archive automatically?" validargs="y,n" addproperty="jetty.download" /> |
---|
38 | <fail message="Aborting as requested. Please deploy the Jetty archive manually." > |
---|
39 | <condition> |
---|
40 | <equals arg1="${jetty.download}" arg2="n"/> |
---|
41 | </condition> |
---|
42 | </fail> |
---|
43 | <get src="${jetty.url}" verbose="true" dest="${jetty.filename}" /> |
---|
44 | </target> |
---|
45 | |
---|
46 | <condition property="verified.already" > |
---|
47 | <and> |
---|
48 | <available file="${jetty.filename}" /> |
---|
49 | <uptodate property="foo.bar.baz" srcfile="${jetty.filename}" targetfile="${verified.filename}" /> |
---|
50 | </and> |
---|
51 | </condition> |
---|
52 | |
---|
53 | <target name="verifyJettylib" unless="verified.already" > |
---|
54 | <condition property="jetty.zip.verified" > |
---|
55 | <checksum file="${jetty.filename}" algorithm="SHA" property="${jetty.sha1}" /> |
---|
56 | </condition> |
---|
57 | <fail message="Jetty archive does not match its checksum!" > |
---|
58 | <condition> |
---|
59 | <not> |
---|
60 | <istrue value="${jetty.zip.verified}" /> |
---|
61 | </not> |
---|
62 | </condition> |
---|
63 | </fail> |
---|
64 | <touch file="${verified.filename}" /> |
---|
65 | </target> |
---|
66 | |
---|
67 | <target name="extractJettylib" unless="jetty.zip.extracted" > |
---|
68 | <!-- for .tgz --> |
---|
69 | <!-- |
---|
70 | <gunzip src="${jetty.filename}" dest="jetty.tar" /> |
---|
71 | <untar src="jetty.tar" dest="." /> |
---|
72 | --> |
---|
73 | <!-- for .zip --> |
---|
74 | <unzip src="${jetty.filename}" dest="." /> |
---|
75 | <mkdir dir="jettylib" /> |
---|
76 | <!-- We copy everything to names without the version numbers so we |
---|
77 | can update them later. Where there was something similar in Jetty 5, |
---|
78 | we use the same names. |
---|
79 | Reasons for inclusion: |
---|
80 | start.jar: Needed for clients.config startup of eepsites |
---|
81 | jetty-util-xxx.jar: LifeCycle (base class for stuff), URIUtil (used in i2psnark) |
---|
82 | jetty-sslengine-xxx.jar: SSL NIO Connector for console |
---|
83 | jetty-java5-threadpool-xxx.jar: Concurrent thread pool for eepsite |
---|
84 | commons-logging.jar: JspC compiler |
---|
85 | TODO which of these are available in the Ubuntu packages? |
---|
86 | --> |
---|
87 | <copy preservelastmodified="true" file="${jetty.base}/lib/${jetty.base}.jar" tofile="jettylib/org.mortbay.jetty.jar" /> |
---|
88 | <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-util-${jetty.ver}.jar" tofile="jettylib/jetty-util.jar" /> |
---|
89 | <copy preservelastmodified="true" file="${jetty.base}/lib/servlet-api-2.5-20081211.jar" tofile="jettylib/javax.servlet.jar" /> |
---|
90 | <copy preservelastmodified="true" file="${jetty.base}/lib/ext/jetty-sslengine-${jetty.ver}.jar" tofile="jettylib/jetty-sslengine.jar" /> |
---|
91 | <copy preservelastmodified="true" file="${jetty.base}/lib/ext/jetty-java5-threadpool-${jetty.ver}.jar" tofile="jettylib/jetty-threadpool.jar" /> |
---|
92 | <copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/ant-1.6.5.jar" tofile="jettylib/ant.jar" /> |
---|
93 | <copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/commons-el-1.0.jar" tofile="jettylib/commons-el.jar" /> |
---|
94 | <copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/jasper-compiler-5.5.15.jar" tofile="jettylib/jasper-compiler.jar" /> |
---|
95 | <copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/jasper-runtime-5.5.15.jar" tofile="jettylib/jasper-runtime.jar" /> |
---|
96 | <copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/jsp-api-2.0.jar" tofile="jettylib/jsp-api.jar" /> |
---|
97 | <copy preservelastmodified="true" file="${jetty.base}/start.jar" tofile="jettylib/jetty-start.jar" /> |
---|
98 | <delete file="jetty.tar" /> |
---|
99 | <delete dir="${jetty.base}" /> |
---|
100 | <!-- commons-logging.jar not in Jetty 6 but we have it in launch4j so copy it over, we need it |
---|
101 | for org.apache.jasper.JspC compiler |
---|
102 | --> |
---|
103 | <copy preservelastmodified="true" file="../../installer/lib/launch4j/lib/commons-logging.jar" todir="jettylib/" /> |
---|
104 | </target> |
---|
105 | |
---|
106 | <target name="build" depends="jar" /> |
---|
107 | |
---|
108 | <target name="builddep" /> |
---|
109 | <target name="compile" depends="builddep, ensureJettylib" > |
---|
110 | <mkdir dir="./build" /> |
---|
111 | <mkdir dir="./build/obj" /> |
---|
112 | <javac |
---|
113 | srcdir="./java/src" |
---|
114 | debug="true" source="1.5" target="1.5" |
---|
115 | destdir="./build/obj" |
---|
116 | includeAntRuntime="false" |
---|
117 | classpath="./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar:./jettylib/jetty-util.jar" > |
---|
118 | <compilerarg line="${javac.compilerargs}" /> |
---|
119 | </javac> |
---|
120 | </target> |
---|
121 | |
---|
122 | <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" > |
---|
123 | <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
124 | <arg value="list" /> |
---|
125 | <arg value="changed" /> |
---|
126 | <arg value="." /> |
---|
127 | </exec> |
---|
128 | <!-- \n in an attribute value generates an invalid manifest --> |
---|
129 | <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
130 | <arg value="-s" /> |
---|
131 | <arg value="[:space:]" /> |
---|
132 | <arg value="," /> |
---|
133 | </exec> |
---|
134 | </target> |
---|
135 | |
---|
136 | <!-- With Jetty 5 we replaced classes in the jar, but with Jetty 6 we |
---|
137 | put our stuff in its own jar so we can work with standard Jetty 6 packages |
---|
138 | --> |
---|
139 | <target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" > |
---|
140 | <!-- set if unset --> |
---|
141 | <property name="workspace.changes.tr" value="" /> |
---|
142 | <jar destfile="./jettylib/jetty-i2p.jar" basedir="./build/obj" includes="**/*.class" > |
---|
143 | <manifest> |
---|
144 | <attribute name="Build-Date" value="${build.timestamp}" /> |
---|
145 | <attribute name="Base-Revision" value="${workspace.version}" /> |
---|
146 | <attribute name="Workspace-Changes" value="${workspace.changes.tr}" /> |
---|
147 | </manifest> |
---|
148 | </jar> |
---|
149 | </target> |
---|
150 | |
---|
151 | <target name="jarUpToDate"> |
---|
152 | <uptodate property="jar.uptodate" targetfile="jettylib/org.mortbay.jetty.jar" > |
---|
153 | <srcfiles dir= "build/obj" includes="**/*.class" /> |
---|
154 | </uptodate> |
---|
155 | <condition property="shouldListChanges" > |
---|
156 | <and> |
---|
157 | <not> |
---|
158 | <isset property="jar.uptodate" /> |
---|
159 | </not> |
---|
160 | <isset property="mtn.available" /> |
---|
161 | </and> |
---|
162 | </condition> |
---|
163 | </target> |
---|
164 | |
---|
165 | <target name="clean" > |
---|
166 | <delete dir="./build" /> |
---|
167 | <delete file="${verified.filename}" /> |
---|
168 | </target> |
---|
169 | <target name="cleandep" depends="clean" /> |
---|
170 | <target name="distclean" depends="clean"> |
---|
171 | <delete dir="./jettylib" /> |
---|
172 | <echo message="Not actually deleting the jetty libs (since they're so large)" /> |
---|
173 | </target> |
---|
174 | <target name="reallyclean" depends="distclean"> |
---|
175 | </target> |
---|
176 | <target name="totallyclean" depends="clean"> |
---|
177 | <delete dir="./jettylib" /> |
---|
178 | <delete file="${jetty.filename}" /> |
---|
179 | </target> |
---|
180 | <target name="javadoc" > |
---|
181 | <available property="jetty.zip.available" file="${jetty.filename}" type="file" /> |
---|
182 | <available property="jetty.zip.javadocExtracted" file="build/javadoc" type="dir" /> |
---|
183 | <ant target="fetchJettylib" /> |
---|
184 | <ant target="verifyJettylib" /> |
---|
185 | <ant target="extractJavadoc" /> |
---|
186 | </target> |
---|
187 | <target name="extractJavadoc" unless="jetty.zip.javadocExtracted" > |
---|
188 | <mkdir dir="./build" /> |
---|
189 | <mkdir dir="./build/javadoc" /> |
---|
190 | <unzip src="${jetty.filename}" dest="./build/javadoc" > |
---|
191 | <patternset> |
---|
192 | <include name="${jetty.base}/javadoc/" /> |
---|
193 | </patternset> |
---|
194 | <mapper type="glob" from="${jetty.base}/javadoc/*" to="javadoc/*" /> |
---|
195 | </unzip> |
---|
196 | </target> |
---|
197 | |
---|
198 | </project> |
---|