Files
i2p.i2p/apps/jetty/build.xml
2011-12-30 21:58:16 +00:00

200 lines
9.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all" name="jetty">
<property name="jetty.ver" value="6.1.26" />
<property name="jetty.base" value="jetty-${jetty.ver}" />
<property name="jetty.sha1" value="9485913f1a1945a849a90f1a34853d22350bc524" />
<property name="jetty.filename" value="${jetty.base}.zip" />
<property name="jetty.url" value="http://dist.codehaus.org/jetty/${jetty.base}/${jetty.filename}" />
<property name="verified.filename" value="verified.txt" />
<property name="javac.compilerargs" value="" />
<target name="all" depends="build" />
<target name="ensureJettylib" >
<available property="jetty.zip.available" file="${jetty.filename}" type="file" />
<available property="jetty.zip.extracted" file="jettylib" type="dir" />
<ant target="fetchJettylib" />
<ant target="verifyJettylib" />
<ant target="extractJettylib" />
</target>
<target name="fetchJettylib" unless="jetty.zip.available" >
<echo message="It seems that you don't have '${jetty.filename}' deployed." />
<echo message="The build script can download this file for you automatically," />
<echo message="or alternatively you can obtain it manually from:" />
<echo message="${jetty.url}" />
<echo message="" />
<echo message="The libraries contained in the fetched file provide the Jetty web server" />
<echo message="(http://jetty.mortbay.org/). They are not absolutely necessary" />
<echo message="but strongly recommended, since they are used by some applications" />
<echo message="on top of I2P, like the router console." />
<echo message="" />
<echo message="Even if you deploy the Jetty archive manually into directory apps/jetty/," />
<echo message="the build script will still attempt to verify its checksums, which must be:" />
<echo message="SHA1 ${jetty.sha1}" />
<echo message="" />
<input message="Download Jetty archive automatically?" validargs="y,n" addproperty="jetty.download" />
<fail message="Aborting as requested. Please deploy the Jetty archive manually." >
<condition>
<equals arg1="${jetty.download}" arg2="n"/>
</condition>
</fail>
<get src="${jetty.url}" verbose="true" dest="${jetty.filename}" />
</target>
<condition property="verified.already" >
<and>
<available file="${jetty.filename}" />
<uptodate property="foo.bar.baz" srcfile="${jetty.filename}" targetfile="${verified.filename}" />
</and>
</condition>
<target name="verifyJettylib" unless="verified.already" >
<condition property="jetty.zip.verified" >
<checksum file="${jetty.filename}" algorithm="SHA" property="${jetty.sha1}" />
</condition>
<fail message="Jetty archive does not match its checksum!" >
<condition>
<not>
<istrue value="${jetty.zip.verified}" />
</not>
</condition>
</fail>
<touch file="${verified.filename}" />
</target>
<target name="extractJettylib" unless="jetty.zip.extracted" >
<!-- for .tgz -->
<!--
<gunzip src="${jetty.filename}" dest="jetty.tar" />
<untar src="jetty.tar" dest="." />
-->
<!-- for .zip -->
<unzip src="${jetty.filename}" dest="." />
<mkdir dir="jettylib" />
<!-- We copy everything to names without the version numbers so we
can update them later. Where there was something similar in Jetty 5,
we use the same names.
Reasons for inclusion:
start.jar: Needed for clients.config startup of eepsites
jetty-util-xxx.jar: LifeCycle (base class for stuff), URIUtil (used in i2psnark)
jetty-sslengine-xxx.jar: SSL NIO Connector for console
jetty-java5-threadpool-xxx.jar: Concurrent thread pool for eepsite
commons-logging.jar: JspC compiler
TODO which of these are available in the Ubuntu packages?
-->
<copy preservelastmodified="true" file="${jetty.base}/lib/${jetty.base}.jar" tofile="jettylib/org.mortbay.jetty.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-util-${jetty.ver}.jar" tofile="jettylib/jetty-util.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/servlet-api-2.5-20081211.jar" tofile="jettylib/javax.servlet.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/ext/jetty-sslengine-${jetty.ver}.jar" tofile="jettylib/jetty-sslengine.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/ext/jetty-java5-threadpool-${jetty.ver}.jar" tofile="jettylib/jetty-threadpool.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/ant-1.6.5.jar" tofile="jettylib/ant.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/commons-el-1.0.jar" tofile="jettylib/commons-el.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/jasper-compiler-5.5.15.jar" tofile="jettylib/jasper-compiler.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/jasper-runtime-5.5.15.jar" tofile="jettylib/jasper-runtime.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/jsp-api-2.0.jar" tofile="jettylib/jsp-api.jar" />
<copy preservelastmodified="true" file="${jetty.base}/start.jar" tofile="jettylib/jetty-start.jar" />
<delete file="jetty.tar" />
<delete dir="${jetty.base}" />
<!-- commons-logging.jar not in Jetty 6 but we have it in launch4j so copy it over, we need it
for org.apache.jasper.JspC compiler
-->
<copy preservelastmodified="true" file="../../installer/lib/launch4j/lib/commons-logging.jar" todir="jettylib/" />
</target>
<target name="build" depends="jar" />
<target name="builddep" />
<target name="compile" depends="builddep, ensureJettylib" >
<mkdir dir="./build" />
<mkdir dir="./build/obj" />
<javac
srcdir="./java/src"
debug="true" source="1.5" target="1.5"
destdir="./build/obj"
includeAntRuntime="false"
classpath="../../core/java/build/i2p.jar:./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar:./jettylib/jetty-util.jar" >
<compilerarg line="${javac.compilerargs}" />
</javac>
</target>
<target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" >
<exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
<arg value="list" />
<arg value="changed" />
<arg value="." />
</exec>
<!-- \n in an attribute value generates an invalid manifest -->
<exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
<arg value="-s" />
<arg value="[:space:]" />
<arg value="," />
</exec>
</target>
<!-- With Jetty 5 we replaced classes in the jar, but with Jetty 6 we
put our stuff in its own jar so we can work with standard Jetty 6 packages
-->
<target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
<!-- set if unset -->
<property name="workspace.changes.tr" value="" />
<copy todir="build/obj" file="resources/log4j.properties" />
<jar destfile="./jettylib/jetty-i2p.jar" basedir="./build/obj" includes="**/*.class log4j.properties" >
<manifest>
<attribute name="Build-Date" value="${build.timestamp}" />
<attribute name="Base-Revision" value="${workspace.version}" />
<attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
</manifest>
</jar>
</target>
<target name="jarUpToDate">
<uptodate property="jar.uptodate" targetfile="jettylib/jetty-i2p.jar" >
<srcfiles dir= "build/obj" includes="**/*.class" />
</uptodate>
<condition property="shouldListChanges" >
<and>
<not>
<isset property="jar.uptodate" />
</not>
<isset property="mtn.available" />
</and>
</condition>
</target>
<target name="clean" >
<delete dir="./build" />
<delete file="${verified.filename}" />
</target>
<target name="cleandep" depends="clean" />
<target name="distclean" depends="clean">
<delete dir="./jettylib" />
<echo message="Not actually deleting the jetty libs (since they're so large)" />
</target>
<target name="reallyclean" depends="distclean">
</target>
<target name="totallyclean" depends="clean">
<delete dir="./jettylib" />
<delete file="${jetty.filename}" />
</target>
<target name="javadoc" >
<available property="jetty.zip.available" file="${jetty.filename}" type="file" />
<available property="jetty.zip.javadocExtracted" file="build/javadoc" type="dir" />
<ant target="fetchJettylib" />
<ant target="verifyJettylib" />
<ant target="extractJavadoc" />
</target>
<target name="extractJavadoc" unless="jetty.zip.javadocExtracted" >
<mkdir dir="./build" />
<mkdir dir="./build/javadoc" />
<unzip src="${jetty.filename}" dest="./build/javadoc" >
<patternset>
<include name="${jetty.base}/javadoc/" />
</patternset>
<mapper type="glob" from="${jetty.base}/javadoc/*" to="javadoc/*" />
</unzip>
</target>
</project>