Files
i2p.i2p/apps/jetty/build.xml

175 lines
7.5 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all" name="jetty">
<property name="jetty.base" value="jetty-5.1.15" />
<property name="jetty.sha1" value="3a7a3de50f86f0cdb23c33aec632ea7f44132c5e" />
<property name="jetty.filename" value="${jetty.base}.tgz" />
<property name="jetty.url" value="http://dist.codehaus.org/jetty/jetty-5.1.x/${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" >
<gunzip src="${jetty.filename}" dest="jetty.tar" />
<untar src="jetty.tar" dest="." />
<mkdir dir="jettylib" />
<copy todir="jettylib" preservelastmodified="true" >
<fileset dir="${jetty.base}/lib">
<include name="*.jar" />
</fileset>
<fileset dir="${jetty.base}/ext">
<include name="ant.jar" />
<include name="commons-el.jar" />
<include name="commons-logging.jar" />
<include name="jasper-compiler.jar" />
<include name="jasper-runtime.jar" />
</fileset>
</copy>
<delete file="jetty.tar" />
<delete dir="${jetty.base}" />
</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="./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.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>
<target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
<!-- set if unset -->
<property name="workspace.changes.tr" value="" />
<jar destfile="./jettylib/org.mortbay.jetty.jar" basedir="./build/obj" includes="**/*.class" update="true" >
<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/org.mortbay.jetty.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>