1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <project basedir="." default="all" name="jetty"> |
---|
3 | |
---|
4 | <property name="jetty.base" value="jetty-5.1.15" /> |
---|
5 | <property name="jetty.sha1" value="3a7a3de50f86f0cdb23c33aec632ea7f44132c5e" /> |
---|
6 | <property name="jetty.filename" value="${jetty.base}.tgz" /> |
---|
7 | <property name="jetty.url" value="http://dist.codehaus.org/jetty/jetty-5.1.x/${jetty.filename}" /> |
---|
8 | <property name="verified.filename" value="verified.txt" /> |
---|
9 | <property name="javac.compilerargs" value="" /> |
---|
10 | |
---|
11 | <target name="all" depends="build" /> |
---|
12 | |
---|
13 | <target name="ensureJettylib" > |
---|
14 | <available property="jetty.zip.available" file="${jetty.filename}" type="file" /> |
---|
15 | <available property="jetty.zip.extracted" file="jettylib" type="dir" /> |
---|
16 | <ant target="fetchJettylib" /> |
---|
17 | <ant target="verifyJettylib" /> |
---|
18 | <ant target="extractJettylib" /> |
---|
19 | </target> |
---|
20 | |
---|
21 | <target name="fetchJettylib" unless="jetty.zip.available" > |
---|
22 | <echo message="It seems that you don't have '${jetty.filename}' deployed." /> |
---|
23 | <echo message="The build script can download this file for you automatically," /> |
---|
24 | <echo message="or alternatively you can obtain it manually from:" /> |
---|
25 | <echo message="${jetty.url}" /> |
---|
26 | <echo message="" /> |
---|
27 | <echo message="The libraries contained in the fetched file provide the Jetty web server" /> |
---|
28 | <echo message="(http://jetty.mortbay.org/). They are not absolutely necessary" /> |
---|
29 | <echo message="but strongly recommended, since they are used by some applications" /> |
---|
30 | <echo message="on top of I2P, like the router console." /> |
---|
31 | <echo message="" /> |
---|
32 | <echo message="Even if you deploy the Jetty archive manually into directory apps/jetty/," /> |
---|
33 | <echo message="the build script will still attempt to verify its checksums, which must be:" /> |
---|
34 | <echo message="SHA1 ${jetty.sha1}" /> |
---|
35 | <echo message="" /> |
---|
36 | <input message="Download Jetty archive automatically?" validargs="y,n" addproperty="jetty.download" /> |
---|
37 | <fail message="Aborting as requested. Please deploy the Jetty archive manually." > |
---|
38 | <condition> |
---|
39 | <equals arg1="${jetty.download}" arg2="n"/> |
---|
40 | </condition> |
---|
41 | </fail> |
---|
42 | <get src="${jetty.url}" verbose="true" dest="${jetty.filename}" /> |
---|
43 | </target> |
---|
44 | |
---|
45 | <condition property="verified.already" > |
---|
46 | <and> |
---|
47 | <available file="${jetty.filename}" /> |
---|
48 | <uptodate property="foo.bar.baz" srcfile="${jetty.filename}" targetfile="${verified.filename}" /> |
---|
49 | </and> |
---|
50 | </condition> |
---|
51 | |
---|
52 | <target name="verifyJettylib" unless="verified.already" > |
---|
53 | <condition property="jetty.zip.verified" > |
---|
54 | <checksum file="${jetty.filename}" algorithm="SHA" property="${jetty.sha1}" /> |
---|
55 | </condition> |
---|
56 | <fail message="Jetty archive does not match its checksum!" > |
---|
57 | <condition> |
---|
58 | <not> |
---|
59 | <istrue value="${jetty.zip.verified}" /> |
---|
60 | </not> |
---|
61 | </condition> |
---|
62 | </fail> |
---|
63 | <touch file="${verified.filename}" /> |
---|
64 | </target> |
---|
65 | |
---|
66 | <target name="extractJettylib" unless="jetty.zip.extracted" > |
---|
67 | <gunzip src="${jetty.filename}" dest="jetty.tar" /> |
---|
68 | <untar src="jetty.tar" dest="." /> |
---|
69 | <mkdir dir="jettylib" /> |
---|
70 | <copy todir="jettylib"> |
---|
71 | <fileset dir="${jetty.base}/lib"> |
---|
72 | <include name="*.jar" /> |
---|
73 | </fileset> |
---|
74 | </copy> |
---|
75 | <copy todir="jettylib"> |
---|
76 | <fileset dir="${jetty.base}/ext"> |
---|
77 | <include name="ant.jar" /> |
---|
78 | <include name="commons-el.jar" /> |
---|
79 | <include name="commons-logging.jar" /> |
---|
80 | <include name="jasper-compiler.jar" /> |
---|
81 | <include name="jasper-runtime.jar" /> |
---|
82 | <include name="javax.servlet.jar" /> |
---|
83 | <include name="org.mortbay.jetty.jar" /> |
---|
84 | </fileset> |
---|
85 | </copy> |
---|
86 | <delete file="jetty.tar" /> |
---|
87 | <delete dir="${jetty.base}" /> |
---|
88 | </target> |
---|
89 | |
---|
90 | <target name="build" depends="jar" /> |
---|
91 | <target name="builddep" /> |
---|
92 | <target name="compile" depends="builddep, ensureJettylib" > |
---|
93 | <mkdir dir="./build" /> |
---|
94 | <mkdir dir="./build/obj" /> |
---|
95 | <javac |
---|
96 | srcdir="./java/src" |
---|
97 | debug="true" source="1.5" target="1.5" |
---|
98 | destdir="./build/obj" |
---|
99 | classpath="./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar" > |
---|
100 | <compilerarg line="${javac.compilerargs}" /> |
---|
101 | </javac> |
---|
102 | </target> |
---|
103 | <target name="jar" depends="compile"> |
---|
104 | <jar destfile="./jettylib/org.mortbay.jetty.jar" basedir="./build/obj" includes="**/*.class" update="true" > |
---|
105 | </jar> |
---|
106 | </target> |
---|
107 | <target name="clean" > |
---|
108 | <delete dir="./build" /> |
---|
109 | <delete file="${verified.filename}" /> |
---|
110 | </target> |
---|
111 | <target name="cleandep" depends="clean" /> |
---|
112 | <target name="distclean" depends="clean"> |
---|
113 | <delete dir="./jettylib" /> |
---|
114 | <echo message="Not actually deleting the jetty libs (since they're so large)" /> |
---|
115 | </target> |
---|
116 | <target name="reallyclean" depends="distclean"> |
---|
117 | </target> |
---|
118 | <target name="totallyclean" depends="clean"> |
---|
119 | <delete dir="./jettylib" /> |
---|
120 | <delete file="${jetty.filename}" /> |
---|
121 | </target> |
---|
122 | <target name="javadoc" > |
---|
123 | <available property="jetty.zip.available" file="${jetty.filename}" type="file" /> |
---|
124 | <available property="jetty.zip.javadocExtracted" file="build/javadoc" type="dir" /> |
---|
125 | <ant target="fetchJettylib" /> |
---|
126 | <ant target="verifyJettylib" /> |
---|
127 | <ant target="extractJavadoc" /> |
---|
128 | </target> |
---|
129 | <target name="extractJavadoc" unless="jetty.zip.javadocExtracted" > |
---|
130 | <mkdir dir="./build" /> |
---|
131 | <mkdir dir="./build/javadoc" /> |
---|
132 | <unzip src="${jetty.filename}" dest="./build/javadoc" > |
---|
133 | <patternset> |
---|
134 | <include name="${jetty.base}/javadoc/" /> |
---|
135 | </patternset> |
---|
136 | <mapper type="glob" from="${jetty.base}/javadoc/*" to="javadoc/*" /> |
---|
137 | </unzip> |
---|
138 | </target> |
---|
139 | |
---|
140 | </project> |
---|