source: apps/jetty/build.xml @ c7bb2e8

Last change on this file since c7bb2e8 was c7bb2e8, checked in by zzz <zzz@…>, 12 years ago
  • build files:
    • Don't die if depend not available
    • Only verify Jetty hash once
    • Add streaming lib tests to depends task
  • Property mode set to 100644
File size: 5.7 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                <include name="xercesImpl.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" deprecation="on" 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    </target>
98    <target name="jar" depends="compile">
99        <jar destfile="./jettylib/org.mortbay.jetty.jar" basedir="./build/obj" includes="**/*.class" update="true" >
100        </jar>
101    </target>   
102    <target name="clean" >
103        <delete dir="./build" />
104        <delete file="${verified.filename}" />
105    </target>   
106    <target name="cleandep" depends="clean" />
107    <target name="distclean" depends="clean">
108        <echo message="Not actually deleting the jetty libs (since they're so large)" />
109    </target>
110    <target name="javadoc" >
111        <available property="jetty.zip.available" file="${jetty.filename}" type="file" />
112        <available property="jetty.zip.javadocExtracted" file="build/javadoc" type="dir" />
113        <ant target="fetchJettylib" />
114        <ant target="verifyJettylib" />
115        <ant target="extractJavadoc" />
116    </target>
117    <target name="extractJavadoc" unless="jetty.zip.javadocExtracted" >
118        <mkdir dir="./build" />
119        <mkdir dir="./build/javadoc" />
120        <unzip src="${jetty.filename}" dest="./build/javadoc" >
121            <patternset>
122                <include name="jetty-5.1.12/javadoc/" />
123            </patternset>
124            <mapper type="glob" from="jetty-5.1.12/javadoc/*" to="javadoc/*" />
125        </unzip>
126    </target>
127
128</project>
Note: See TracBrowser for help on using the repository browser.