source: apps/jetty/build.xml @ 9a089b7

Last change on this file since 9a089b7 was 9a089b7, checked in by zzz <zzz@…>, 12 years ago
  • Build files:
    • Don't bundle unneeded XML parser xercesImpl.jar for Jetty (1MB)
    • Don't include unneeded stuff in Copy, Delete, Exec.jar (300KB)
  • Property mode set to 100644
File size: 5.6 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
10    <target name="all" depends="build" />
11
12    <target name="ensureJettylib" >
13        <available property="jetty.zip.available" file="${jetty.filename}" type="file" />
14        <available property="jetty.zip.extracted" file="jettylib" type="dir" />
15        <ant target="fetchJettylib" />
16        <ant target="verifyJettylib" />
17        <ant target="extractJettylib" />
18    </target>
19
20    <target name="fetchJettylib" unless="jetty.zip.available" >
21        <echo message="It seems that you don't have '${jetty.filename}' deployed." />
22        <echo message="The build script can download this file for you automatically," />
23        <echo message="or alternatively you can obtain it manually from:" />
24        <echo message="${jetty.url}" />
25        <echo message="" />
26        <echo message="The libraries contained in the fetched file provide the Jetty web server" />
27        <echo message="(http://jetty.mortbay.org/). They are not absolutely necessary" />
28        <echo message="but strongly recommended, since they are used by some applications" />
29        <echo message="on top of I2P, like the router console." />
30        <echo message="" />
31        <echo message="Even if you deploy the Jetty archive manually, the build script will" />
32        <echo message="still attempt to verify its checksums, which must be:" />
33        <echo message="SHA1 ${jetty.sha1}" />
34        <echo message="MD5 ${jetty.md5}" />
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    <uptodate property="verified.already" srcfile="${jetty.filename}" targetfile="${verified.filename}" />
46
47    <target name="verifyJettylib" unless="verified.already" >
48        <condition property="jetty.zip.verified" >
49            <and>
50                <checksum file="${jetty.filename}" algorithm="SHA" property="${jetty.sha1}" />
51                <checksum file="${jetty.filename}" algorithm="MD5" property="${jetty.md5}" />
52            </and>
53        </condition>
54        <fail message="Jetty archive does not match its checksums!" >
55            <condition>
56                <not>
57                    <istrue value="${jetty.zip.verified}" />
58                </not>
59            </condition>
60        </fail>
61        <touch file="${verified.filename}" />
62    </target>
63
64    <target name="extractJettylib" unless="jetty.zip.extracted" >
65        <unzip src="${jetty.filename}" dest="." />
66        <mkdir dir="jettylib" />
67        <copy todir="jettylib">
68            <fileset dir="jetty-5.1.12/lib">
69                <include name="*.jar" />
70            </fileset>
71        </copy>
72        <copy todir="jettylib">
73            <fileset dir="jetty-5.1.12/ext">
74                <include name="ant.jar" />
75                <include name="commons-el.jar" />
76                <include name="commons-logging.jar" />
77                <include name="jasper-compiler.jar" />
78                <include name="jasper-runtime.jar" />
79                <include name="javax.servlet.jar" />
80                <include name="org.mortbay.jetty.jar" />
81            </fileset>
82        </copy>
83        <delete dir="jetty-5.1.12" />
84    </target>
85
86    <target name="build" depends="jar" />
87    <target name="builddep" />
88    <target name="compile" depends="builddep, ensureJettylib" >
89        <mkdir dir="./build" />
90        <mkdir dir="./build/obj" />
91        <javac 
92            srcdir="./java/src" 
93            debug="true" deprecation="on" source="1.5" target="1.5" 
94            destdir="./build/obj" 
95            classpath="./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar" />
96    </target>
97    <target name="jar" depends="compile">
98        <jar destfile="./jettylib/org.mortbay.jetty.jar" basedir="./build/obj" includes="**/*.class" update="true" >
99        </jar>
100    </target>   
101    <target name="clean" >
102        <delete dir="./build" />
103        <delete file="${verified.filename}" />
104    </target>   
105    <target name="cleandep" depends="clean" />
106    <target name="distclean" depends="clean">
107        <echo message="Not actually deleting the jetty libs (since they're so large)" />
108    </target>
109    <target name="javadoc" >
110        <available property="jetty.zip.available" file="${jetty.filename}" type="file" />
111        <available property="jetty.zip.javadocExtracted" file="build/javadoc" type="dir" />
112        <ant target="fetchJettylib" />
113        <ant target="verifyJettylib" />
114        <ant target="extractJavadoc" />
115    </target>
116    <target name="extractJavadoc" unless="jetty.zip.javadocExtracted" >
117        <mkdir dir="./build" />
118        <mkdir dir="./build/javadoc" />
119        <unzip src="${jetty.filename}" dest="./build/javadoc" >
120            <patternset>
121                <include name="jetty-5.1.12/javadoc/" />
122            </patternset>
123            <mapper type="glob" from="jetty-5.1.12/javadoc/*" to="javadoc/*" />
124        </unzip>
125    </target>
126
127</project>
Note: See TracBrowser for help on using the repository browser.