source: apps/jetty/build.xml @ 30628fb

Last change on this file since 30628fb was 30628fb, checked in by zzz <zzz@…>, 11 years ago

more clean targets

  • Property mode set to 100644
File size: 5.9 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project basedir="." default="all" name="jetty">
3
4    <property name="jetty.sha1" value="021164f84da7304bd1ff07c268b45aa3e0b13322" />
5    <property name="jetty.md5" value="a61adc832be6baf2678935506743cfc3" />
6    <property name="jetty.url" value="http://dist.codehaus.org/jetty/jetty-5.1.x/jetty-5.1.12.zip" />
7    <property name="jetty.filename" value="jetty-5.1.12.zip" />
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, the build script will" />
33        <echo message="still attempt to verify its checksums, which must be:" />
34        <echo message="SHA1 ${jetty.sha1}" />
35        <echo message="MD5 ${jetty.md5}" />
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    <uptodate property="verified.already" srcfile="${jetty.filename}" targetfile="${verified.filename}" />
47
48    <target name="verifyJettylib" unless="verified.already" >
49        <condition property="jetty.zip.verified" >
50            <and>
51                <checksum file="${jetty.filename}" algorithm="SHA" property="${jetty.sha1}" />
52                <checksum file="${jetty.filename}" algorithm="MD5" property="${jetty.md5}" />
53            </and>
54        </condition>
55        <fail message="Jetty archive does not match its checksums!" >
56            <condition>
57                <not>
58                    <istrue value="${jetty.zip.verified}" />
59                </not>
60            </condition>
61        </fail>
62        <touch file="${verified.filename}" />
63    </target>
64
65    <target name="extractJettylib" unless="jetty.zip.extracted" >
66        <unzip src="${jetty.filename}" dest="." />
67        <mkdir dir="jettylib" />
68        <copy todir="jettylib">
69            <fileset dir="jetty-5.1.12/lib">
70                <include name="*.jar" />
71            </fileset>
72        </copy>
73        <copy todir="jettylib">
74            <fileset dir="jetty-5.1.12/ext">
75                <include name="ant.jar" />
76                <include name="commons-el.jar" />
77                <include name="commons-logging.jar" />
78                <include name="jasper-compiler.jar" />
79                <include name="jasper-runtime.jar" />
80                <include name="javax.servlet.jar" />
81                <include name="org.mortbay.jetty.jar" />
82            </fileset>
83        </copy>
84        <delete dir="jetty-5.1.12" />
85    </target>
86
87    <target name="build" depends="jar" />
88    <target name="builddep" />
89    <target name="compile" depends="builddep, ensureJettylib" >
90        <mkdir dir="./build" />
91        <mkdir dir="./build/obj" />
92        <javac 
93            srcdir="./java/src" 
94            debug="true" source="1.5" target="1.5" 
95            destdir="./build/obj" 
96            classpath="./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar" >
97            <compilerarg line="${javac.compilerargs}" />
98        </javac>
99    </target>
100    <target name="jar" depends="compile">
101        <jar destfile="./jettylib/org.mortbay.jetty.jar" basedir="./build/obj" includes="**/*.class" update="true" >
102        </jar>
103    </target>   
104    <target name="clean" >
105        <delete dir="./build" />
106        <delete file="${verified.filename}" />
107    </target>   
108    <target name="cleandep" depends="clean" />
109    <target name="distclean" depends="clean">
110        <echo message="Not actually deleting the jetty libs (since they're so large)" />
111    </target>
112    <target name="reallyclean" depends="distclean">
113        <delete dir="./jettylib" />
114    </target>
115    <target name="totallyclean" depends="clean">
116        <delete dir="./jettylib" />
117        <delete file="${jetty.filename}" />
118    </target>
119    <target name="javadoc" >
120        <available property="jetty.zip.available" file="${jetty.filename}" type="file" />
121        <available property="jetty.zip.javadocExtracted" file="build/javadoc" type="dir" />
122        <ant target="fetchJettylib" />
123        <ant target="verifyJettylib" />
124        <ant target="extractJavadoc" />
125    </target>
126    <target name="extractJavadoc" unless="jetty.zip.javadocExtracted" >
127        <mkdir dir="./build" />
128        <mkdir dir="./build/javadoc" />
129        <unzip src="${jetty.filename}" dest="./build/javadoc" >
130            <patternset>
131                <include name="jetty-5.1.12/javadoc/" />
132            </patternset>
133            <mapper type="glob" from="jetty-5.1.12/javadoc/*" to="javadoc/*" />
134        </unzip>
135    </target>
136
137</project>
Note: See TracBrowser for help on using the repository browser.