blob: d36212fa15983fa55aaf0cbec44449ea162121ef [file] [log] [blame]
<project name="jk" default="build-main" basedir=".">
<!-- We'll build jk for 3.3 or 4.0 ( depending on what you have installed ).
You need to set tomcat5.home, tomcat40.home, and/or tomcat33.home in
build.properties ( either the path to 'official' distribution or the
development dirs )
-->
<!-- ===================== Initialize Property Values ================ -->
<property file="build.properties"/>
<property file="../build.properties"/>
<property file="../build.properties.default"/>
<property file="${user.home}/build.properties"/>
<property file="${user.home}/.build.properties"/>
<property name="jk.build" location="${basedir}/build"/>
<property name="build.docs" location="${basedir}/build/docs"/>
<property name="source.docs" location="./xdocs"/>
<property name="gen.dev.doc" value="false"/>
<!-- Compile options -->
<property name="optimize" value="off" />
<property name="compile.debug" value="true" />
<property name="compile.deprecation" value="false" />
<!-- default locations, overrident by properties -->
<property name="base.path" location="/usr/share/java"/>
<property name="tomcat33.home"
location="../../jakarta-tomcat/build/tomcat/lib/common/tomcat_core.jar" />
<property name="tomcat40.home"
location="../../jakarta-tomcat-4.0/build" />
<property name="tomcat41.home"
location="../../jakarta-tomcat-4.1/build" />
<property name="tomcat5.home"
location="../../jakarta-tomcat-catalina/build" />
<property name="coyote.home"
location="../coyote/build" />
<property name="tomcat-coyote.jar" location="${coyote.home}/lib/tomcat-coyote.jar" />
<property name="servlet-api.jar" location="${tomcat5.home}/common/lib/servlet-api.jar" />
<property name="tomcat-util.jar" location="../util/build/lib/tomcat-util.jar" />
<property name="commons-modeler.jar" location="../../jakarta-commons/modeler/dist/commons-modeler.jar" />
<!-- Fix build via ECLIPSE which didn't export ant's jars -->
<path id="xml-apis.classpath">
<pathelement path="${jaxp.home}/jaxp.jar"/>
<pathelement path="${jaxp.home}/crimson.jar"/>
<pathelement path="${xerces2.home}/xml-apis.jar"/>
<pathelement path="${xml-parser-apis.jar}"/>
</path>
<path id="build-main.classpath">
<pathelement location="../util/build/classes"/>
<pathelement location="${tomcat5.home}/server/lib/catalina.jar"/>
<pathelement location="${tomcat41.home}/server/lib/catalina.jar"/>
<pathelement location="${tomcat40.home}/server/lib/catalina.jar"/>
<pathelement location="${tomcat33.home}/lib/common/tomcat_core.jar"/>
<pathelement location="${tomcat33.home}/lib/common/core_util.jar"/>
<pathelement location="${servlet-api.jar}"/>
<pathelement location="${tomcat-util.jar}" />
<pathelement location="${commons-logging.jar}"/>
<pathelement location="${commons-modeler.jar}"/>
<pathelement location="${jmx.jar}"/>
<pathelement location="${tomcat33.home}/lib/container/tomcat_modules.jar"/>
<!-- this is needed - otherwise tomcat33 connector will not compile.
Just change tomcat33.home in build.properties to point
to nowhere, and tomcat_util will no longer be visible, nor
3.3 classes. -->
<pathelement
location="${tomcat33.home}/lib/container/tomcat_util.jar"/>
<pathelement location="${tomcat-coyote.jar}"/>
</path>
<!-- ==================== Detection and reports ==================== -->
<target name="report" >
<echo message="Tomcat33: ${tomcat33.detect} ${tomcat33.home}" />
<echo message="Tomcat40: ${tomcat40.detect} ${tomcat40.home}" />
<echo message="Tomcat41: ${tomcat41.detect} ${tomcat41.home}" />
<echo message="Tomcat5: ${tomcat5.detect} ${tomcat5.home}" />
<echo message="Apache13: ${apache13.detect} ${apache13.home}" />
<echo message="Apache2: ${apache2.detect} ${apache2.home}" />
<echo message="iPlanet: ${iplanet.detect} ${iplanet.home}" />
<echo message="IIS: ${iis.detect} ${iis.home}" />
<echo message="AOLserver: ${aolserver.detect} ${aolserver.home}" />
<echo message="jmx: ${jmx.jar} ${jmx.detect} ${commons-modeler.jar} ${modeler.detect}" />
</target>
<target name="detect" >
<echo message="-------- jakarta-tomcat-connectors --------" />
<available property="tomcat33.detect"
file="${tomcat33.home}/lib/common/tomcat_core.jar" />
<available property="tomcat40.detect"
file="${tomcat40.home}/server/lib/catalina.jar" />
<available property="tomcat41.detect"
file="${tomcat41.home}/server/webapps" />
<condition property="tomcat5.detect">
<and>
<available
classname="javax.servlet.ServletRequestEvent"
classpath="${tomcat5.home}/common/lib/servlet-api.jar"
/>
</and>
</condition>
<available property="apache13.detect"
file="${apache13.home}" />
<available property="apache2.detect"
file="${apache2.home}" />
<available property="iis.detect"
file="${iis.home}" />
<available property="iplanet.detect"
file="${iplanet.home}" />
<available property="aolserver.detect"
file="${aolserver.home}" />
<available property="jmx.detect"
file="${jmx.jar}" />
<available property="jdk14.detect"
classname="java.nio.MappedByteBuffer" />
<available property="modeler.detect"
file="${commons-modeler.jar}" />
<!-- Check if we can find the XSLTProcessor class in the classpath -->
<available
property="avail.xalan"
classname="org.apache.xalan.xslt.Process">
<!--
<classpath refid="classpath"/>
-->
</available>
</target>
<target name="prepare" depends="detect" >
<mkdir dir="${jk.build}"/>
<mkdir dir="${jk.build}"/>
<mkdir dir="${jk.build}/conf"/>
<mkdir dir="${jk.build}/classes"/>
<mkdir dir="${jk.build}/classes/META-INF" />
<mkdir dir="${jk.build}/lib"/>
<copy todir="${jk.build}/conf" >
<fileset dir="conf" includes="*" />
</copy>
<!-- util and coyote must be build first -->
<copy tofile="${jk.build}/lib/tomcat-coyote.jar"
file="${tomcat-coyote.jar}" />
<!-- Fix build via ECLIPSE which didn't export ant's jars -->
<path id="xml-apis.classpath">
<pathelement path="${jaxp.home}/jaxp.jar"/>
<pathelement path="${jaxp.home}/crimson.jar"/>
<pathelement path="${xerces2.home}/xml-apis.jar"/>
<pathelement path="${xml-parser-apis.jar}"/>
</path>
</target>
<target name="build-main"
depends="prepare,report,jkjava" />
<!-- build all the stuff -->
<target name="all"
depends="prepare,report,coyote,jkjava,jkant" />
<!-- Build only jk, assume coyote and utils are built -->
<target name="build-jk"
depends="prepare,report,jkjava" />
<!-- ==================== Building ==================== -->
<target name="jkjava"
description="Build java side of the connector" >
<javac srcdir="java"
destdir="${jk.build}/classes"
deprecation="${compile.deprecation}"
debug="${compile.debug}"
optimize="${optimize}"
verbose="off" >
<exclude name="org/apache/ajp/**" if="tomcat5.detect"/>
<exclude name="org/apache/ajp/tomcat4/**" unless="tomcat40.detect"/>
<exclude name="org/apache/ajp/tomcat33/**" unless="tomcat33.detect"/>
<exclude name="org/apache/jk/common/JkMX.java" unless="jmx.detect"/>
<exclude name="org/apache/jk/common/ModJkMX.java" unless="jmx.detect"/>
<exclude name="org/apache/jk/common/Shm14.java" unless="jdk14.detect"/>
<exclude name="org/apache/jk/config/*Config.java" unless="tomcat5.detect" />
<classpath>
<path refid="xml-apis.classpath"/>
<path refid="build-main.classpath"/>
</classpath>
</javac>
<!-- Copy static resource files -->
<copy todir="${jk.build}/classes">
<fileset dir="java">
<include name="**/*.properties"/>
</fileset>
</copy>
<property name="tomcat-jk.jar" value="${jk.build}/lib/tomcat-jk.jar" />
<property name="tomcat-jkconfig.jar" value="${jk.build}/lib/jkconfig.jar" />
<property name="tomcat-jkshm.jar" value="${jk.build}/lib/jkshm.jar" />
<property name="tomcat-jk2.jar" value="${jk.build}/lib/tomcat-jk2.jar" />
<property name="tomcat-jni.jar" value="${jk.build}/lib/tomcat-jni.jar" />
<jar jarfile="${tomcat-jk.jar}"
index="true"
basedir="${jk.build}/classes">
<include name="org/apache/ajp/**" />
</jar>
<jar jarfile="${tomcat-jkconfig.jar}"
index="true"
basedir="${jk.build}/classes"
manifest="conf/jkconfig.manifest">
<include name="org/apache/jk/config/**" />
</jar>
<jar jarfile="${tomcat-jkshm.jar}"
index="true"
basedir="${jk.build}/classes"
manifest="conf/shm.manifest">
<include name="org/apache/ajp/common/Shm.class" />
</jar>
<copy todir="${jk.build}/classes" >
<fileset dir="java" includes="**/*.xml" />
</copy>
<jar jarfile="${tomcat-jk2.jar}"
index="true"
manifest="conf/tomcat-jk2.manifest"
basedir="${jk.build}/classes" >
<include name="org/apache/jk/**" />
<exclude name="org/apache/jk/ant/**" />
</jar>
<jar jarfile="${tomcat-jni.jar}"
index="true"
basedir="${jk.build}/classes"
manifest="conf/jk2.manifest" >
<include name="org/apache/jk/apr/**" />
<include name="org/apache/jk/core/**" />
</jar>
</target>
<target name="jkant" >
<mkdir dir="${jk.build}/classes"/>
<mkdir dir="${jk.build}/classes/META-INF" />
<mkdir dir="${jk.build}/lib"/>
<javac srcdir="jkant/java"
destdir="${jk.build}/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${optimize}"
verbose="off" >
</javac>
<copy todir="${jk.build}/classes/META-INF"
file="jkant/ant.tasks"/>
<jar jarfile="${jk.build}/lib/jkant.jar"
index="true"
basedir="${jk.build}/classes" >
<include name="org/apache/jk/ant/**" />
<include name="META-INF/ant.tasks" />
</jar>
</target>
<target name="coyote"
description="Build utils" >
<ant dir="../util" />
<ant dir="../coyote" />
</target>
<!-- ================ Experimental: Xdoclet =================== -->
<!-- Use Javadoc tags to generate auxiliary files.
-->
<target name="xdoclet" depends="prepare">
<path id="xdoclet.classpath">
<pathelement location="../lib/xdoclet.jar"/>
<pathelement location="../lib/log4j-core.jar"/>
<pathelement location="${ant.home}/lib/ant.jar"/>
<path refid="build-main.classpath" />
</path>
<taskdef name="webdoclet"
classname="xdoclet.web.WebDocletTask"
classpathref="xdoclet.classpath" />
<taskdef name="document"
classname="xdoclet.doc.DocumentDocletTask"
classpathref="xdoclet.classpath" />
<taskdef name="jmxdoclet"
classname="xdoclet.jmx.JMXDocletTask"
classpathref="xdoclet.classpath" />
<jmxdoclet sourcepath="java"
destdir="${jk.build}/jmx-java"
classpathref="xdoclet.classpath"
force="${xdoclet.force}">
<fileset dir="java">
<include name="**/*.java" />
</fileset>
<!-- Create the {0}MBean interface for the MBean -->
<mbeaninterface mergedir="java"/>
<!-- Create the OpenJMX specific description adaptor class for the MBean -->
<openjmxDescription />
<!--create the jbossmx xml descriptor for the mbean-->
<jbossxmbean/>
<!--create the jboss xml service template for the mbean-->
<jbossXmlServiceTemplate/>
</jmxdoclet>
<document sourcepath="java"
destdir="${jk.build}/todo"
classpathref="xdoclet.classpath" >
<fileset dir="java">
<include name="**/*.java" />
</fileset>
<info header="Todo list"
projectname="JK2"
tag="todo" />
</document>
</target>
<!-- ================ javadocs =================== -->
<target name="javadoc" unless="docs-uptodate">
<delete dir="${jk.build}/javadoc"/>
<mkdir dir="${jk.build}/javadoc"/>
<javadoc packagenames="org.apache.ajp,org.apache.ajp.tomcat4,org.apache.ajp,org.apache.ajp.tomcat5"
sourcepath="java"
classpath="${tomcat5.home}/server/lib/catalina.jar:${tomcat5.home}/common/lib/servlet-api.jar:${tomcat41.home}/server/lib/catalina.jar:${tomcat41.home}/common/lib/servlet.jar:${tomcat40.home}/server/lib/catalina.jar:${tomcat40.home}/common/lib/servlet.jar:${tomcat-util.jar}"
destdir="${jk.build}/javadoc"
author="true"
version="true"
windowtitle="Jk Connector Documentation"
doctitle="Jk Connector"
bottom="Copyright &#169; 2001-2003 Apache Software Foundation. All Rights Reserved."
/>
</target>
<target name="clean">
<delete dir="${jk.build}/classes"/>
<delete dir="${jk.build}/lib"/>
<delete dir="${jk.build}/javadoc"/>
<delete dir="${build.docs}"/>
<delete file="${source.docs}/style.css"/>
<delete file="${source.docs}/style.xsl"/>
<delete file="${source.docs}/menu.idx"/>
</target>
<!-- It's better to call it directly with individual tags -->
<target name="native" depends="jkant,detect,report" >
<ant dir="native" antfile="build.xml" />
<ant dir="native2" antfile="build.xml" />
</target>
<target name="clean-native">
<ant dir="native" antfile="build.xml" target="clean" />
<ant dir="native2" antfile="build.xml" target="clean" />
</target>
<!-- Check if we found Xalan in our classpath. We require Xalan because it has
some nifty functions that we use throughout the XSLT (and also because
we want people to eat our own food, right?)
-->
<target
name="docs.check"
depends="detect"
description="Fail if we don't find Xalan"
unless="avail.xalan">
<!-- Just jump out -->
<fail message="Cannot find the Apache Xalan XSLT processor"/>
</target>
<!-- builds the css and xls file from the css.in and xls.in -->
<target name="docs.init">
<property file="${source.docs}/build.properties"/>
<property name="body-bg" value="#ffffff"/>
<property name="body-fg" value="#000000"/>
<property name="body-link" value="#525D76"/>
<property name="banner-bg" value="#525D76"/>
<property name="banner-fg" value="#ffffff"/>
<property name="sub-banner-bg" value="#828DA6"/>
<property name="sub-banner-fg" value="#ffffff"/>
<property name="table-th-bg" value="#039acc"/>
<property name="table-td-bg" value="#a0ddf0"/>
<property name="source-color" value="#023264"/>
<antcall target="docs.color">
<param name="sourcefile" value="${source.docs}/style.css.in"/>
<param name="destfile" value="${source.docs}/style.css"/>
</antcall>
<antcall target="docs.color">
<param name="sourcefile" value="${source.docs}/style.xsl.in"/>
<param name="destfile" value="${source.docs}/style.xsl"/>
</antcall>
<condition property="jkmenu" value="&amp;JK;">
<not>
<isset property="nojkdoc"/>
</not>
</condition>
<condition property="jk2menu" value="&amp;JK2;">
<not>
<isset property="nojk2doc"/>
</not>
</condition>
<copy file="${source.docs}/menu.idx.in" tofile="${source.docs}/menu.idx"/>
<replace file="${source.docs}/menu.idx" token="@JK@" value="${jkmenu}"/>
<replace file="${source.docs}/menu.idx" token="@JK2@" value="${jk2menu}"/>
</target>
<target name="docs.color">
<copy file="${sourcefile}" tofile="${destfile}"/>
<replace file="${destfile}" token="@body-bg@" value="${body-bg}"/>
<replace file="${destfile}" token="@body-fg@" value="${body-fg}"/>
<replace file="${destfile}" token="@body-link@" value="${body-link}"/>
<replace file="${destfile}" token="@banner-bg@" value="${banner-bg}"/>
<replace file="${destfile}" token="@banner-fg@" value="${banner-fg}"/>
<replace file="${destfile}" token="@sub-banner-bg@" value="${sub-banner-bg}"/>
<replace file="${destfile}" token="@sub-banner-fg@" value="${sub-banner-fg}"/>
<replace file="${destfile}" token="@table-th-bg@" value="${table-th-bg}"/>
<replace file="${destfile}" token="@table-td-bg@" value="${table-td-bg}"/>
<replace file="${destfile}" token="@source-color@" value="${source-color}"/>
<replace file="${destfile}" token="@gen-dev-doc@" value="${gen.dev.doc}"/>
</target>
<!--
Generate documentation from the XML sources.
-->
<target name="docs"
depends="jkdocs,jkprinter,jk2printer" />
<target
name="jkdocs" unless="docs-uptodate"
depends="docs.check,docs.init"
description="Create Documentation">
<!-- Create the directory where we're going to store the docs -->
<mkdir dir="${build.docs}"/>
<mkdir dir="${build.docs}/printer"/>
<mkdir dir="${build.docs}/common/printer"/>
<!-- Add some style to our otherwise utterly ugly XML files -->
<style
basedir="${source.docs}"
destdir="${build.docs}"
style="${source.docs}/style.xsl" >
<include name="*/**.xml" />
<exclude name="*.xml" />
<exclude name="jk/**" if="nojkdoc"/>
<exclude name="jk2/**" if="nojk2doc"/>
<param name="styles" expression="../"/>
</style>
<style
basedir="${source.docs}"
destdir="${build.docs}"
style="${source.docs}/style.xsl" >
<include name="**.xml" />
<param name="images" expression="images"/>
<param name="styles" expression="."/>
<param name="homedoc" expression=""/>
</style>
<!-- Create the printer friendly pages -->
<style
basedir="${source.docs}"
destdir="${build.docs}/printer"
style="${source.docs}/style.xsl" >
<include name="**.xml" />
<param name="images" expression="images"/>
<param name="styles" expression="."/>
<param name="homedoc" expression=""/>
<param name="project-menu" expression="nomenu"/>
</style>
<style
basedir="${source.docs}/common"
destdir="${build.docs}/common/printer"
style="${source.docs}/style.xsl" >
<include name="**.xml" />
<param name="styles" expression="../"/>
<param name="project-menu" expression="nomenu"/>
</style>
<!-- Copy all relevant (non processed) files from the sources -->
<copy
todir="${build.docs}" >
<fileset dir="${source.docs}">
<exclude name="jk/**" if="nojkdoc"/>
<exclude name="jk2/**" if="nojk2doc"/>
<exclude name="**/*.xml"/>
<exclude name="**/*.css.in"/>
<exclude name="**/*.xsl.in"/>
<exclude name="**/*.samples"/>
<exclude name="**/*.xsl"/>
<exclude name="**/*.idx"/>
<exclude name="**/*.idx.in"/>
<exclude name="**/images/originals/**"/>
</fileset>
</copy>
</target>
<!-- build the printer friendly pages for jk -->
<target
name="jkprinter"
unless="docs-uptodate"
depends="docs.check,docs.init"
description="Create Printer Friendly Documentation for jk">
<mkdir dir="${build.docs}/jk/printer"/>
<style
basedir="${source.docs}/jk"
destdir="${build.docs}/jk/printer"
style="${source.docs}/style.xsl" >
<include name="**.xml" />
<param name="styles" expression="../"/>
<param name="project-menu" expression="nomenu"/>
</style>
</target>
<!-- build the printer friendly pages for jk2 -->
<target
name="jk2printer"
unless="docs-uptodate"
depends="docs.check,docs.init"
description="Create Printer Friendly Documentation for jk">
<mkdir dir="${build.docs}/jk2/printer"/>
<style
basedir="${source.docs}/jk2"
destdir="${build.docs}/jk2/printer"
style="${source.docs}/style.xsl" >
<include name="**.xml" />
<param name="styles" expression="../"/>
<param name="project-menu" expression="nomenu"/>
</style>
</target>
</project>