source: apps/jetty/build.xml @ fd91927c

Last change on this file since fd91927c was fd91927c, checked in by zzz <zzz@…>, 9 years ago
  • Build:
    • Add includeAntRuntime=false to all javac targets
    • Add build date, mtn rev, and changed file list to all manifests
    • Add unless=uptodate to all jar and war targets (bob and dtg still todo)
  • Property mode set to 100644
File size: 7.2 KB
Line 
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            includeAntRuntime="false"
100            classpath="./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar" >
101            <compilerarg line="${javac.compilerargs}" />
102        </javac>
103    </target>
104
105    <target name="jar" depends="compile, jarUpToDate" unless="jar.uptodate" >
106        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
107            <arg value="list" />
108            <arg value="changed" />
109            <arg value="." />
110        </exec>
111        <!-- \n in an attribute value generates an invalid manifest -->
112        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
113            <arg value="-s" />
114            <arg value="[:space:]" />
115            <arg value="," />
116        </exec>
117        <jar destfile="./jettylib/org.mortbay.jetty.jar" basedir="./build/obj" includes="**/*.class" update="true" >
118            <manifest>
119                <attribute name="Build-Date" value="${build.timestamp}" />
120                <attribute name="Base-Revision" value="${workspace.version}" />
121                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
122            </manifest>
123        </jar>
124    </target>   
125
126    <target name="jarUpToDate">
127        <uptodate property="jar.uptodate" targetfile="jettylib/org.mortbay.jetty.jar" >
128            <srcfiles dir= "build/obj" includes="**/*.class" />
129        </uptodate>
130    </target>   
131
132    <target name="clean" >
133        <delete dir="./build" />
134        <delete file="${verified.filename}" />
135    </target>   
136    <target name="cleandep" depends="clean" />
137    <target name="distclean" depends="clean">
138        <delete dir="./jettylib" />
139        <echo message="Not actually deleting the jetty libs (since they're so large)" />
140    </target>
141    <target name="reallyclean" depends="distclean">
142    </target>
143    <target name="totallyclean" depends="clean">
144        <delete dir="./jettylib" />
145        <delete file="${jetty.filename}" />
146    </target>
147    <target name="javadoc" >
148        <available property="jetty.zip.available" file="${jetty.filename}" type="file" />
149        <available property="jetty.zip.javadocExtracted" file="build/javadoc" type="dir" />
150        <ant target="fetchJettylib" />
151        <ant target="verifyJettylib" />
152        <ant target="extractJavadoc" />
153    </target>
154    <target name="extractJavadoc" unless="jetty.zip.javadocExtracted" >
155        <mkdir dir="./build" />
156        <mkdir dir="./build/javadoc" />
157        <unzip src="${jetty.filename}" dest="./build/javadoc" >
158            <patternset>
159                <include name="${jetty.base}/javadoc/" />
160            </patternset>
161            <mapper type="glob" from="${jetty.base}/javadoc/*" to="javadoc/*" />
162        </unzip>
163    </target>
164
165</project>
Note: See TracBrowser for help on using the repository browser.