blob: fec3cd11726bf0d2a6677c5ca4ba4c221d48b997 [file] [log] [blame]
<project name="admin" default="build-main" basedir=".">
<!-- ===================== Initialize Property Values =================== -->
<!-- See "build.properties.sample" in the top level directory for all -->
<!-- property values you must customize for successful building!!! -->
<property file="build.properties"/>
<property file="../build.properties"/>
<property file="../../build.properties"/>
<property file="${user.home}/build.properties"/>
<!-- Build Defaults -->
<property name="build.compiler" value="modern"/>
<property name="webapps.build" value="${basedir}/../build"/>
<property name="webapps.dist" value="${basedir}/../dist"/>
<property name="webapp.name" value="admin"/>
<!-- Dependent JARs and files -->
<property name="servlet-api.jar" value="${api.home}/jsr154/dist/lib/servlet-api.jar"/>
<property name="jsp-api.jar" value="${api.home}/jsr152/dist/lib/jsp-api.jar"/>
<!-- Construct Admin classpath -->
<path id="admin.classpath">
<pathelement location="${commons-modeler.jar}"/>
<pathelement location="${jmx.jar}"/>
<pathelement location="${servlet-api.jar}"/>
<pathelement location="${jsp-api.jar}"/>
<pathelement location="${struts.jar}"/>
<pathelement location="${commons-beanutils.jar}"/>
<pathelement location="${commons-digester.jar}"/>
<pathelement location="${regexp.jar}"/>
</path>
<!-- =================== BUILD: Set compile flags ======================= -->
<target name="flags">
<!-- JDK flags -->
<available property="jdk.1.2.present" classname="java.util.HashMap" />
<available property="jdk.1.3.present"
classname="java.lang.reflect.Proxy" />
<available property="jdk.1.4.present" classname="java.nio.Buffer" />
<!-- Ant flags -->
<available property="style.available"
classname="org.apache.tools.ant.taskdefs.optional.TraXLiaison" />
<!-- Class availability flags -->
<condition property="jaxp.present">
<and>
<available classname="javax.xml.parsers.SAXParser"
classpath="${xerces.jar}" />
<available classname="org.xml.sax.ContentHandler"
classpath="${xerces.jar}" />
</and>
</condition>
<available property="jmx.present"
classname="javax.management.MBeanServer"
classpath="${jmx.jar}" />
<available property="modeler.present"
classname="org.apache.commons.modeler.Registry"
classpath="${commons-modeler.jar}:${jmx.jar}"/>
<available property="servlet.present"
classname="javax.servlet.Servlet"
classpath="${servlet-api.jar}" />
<available property="jsp.present"
classname="javax.servlet.jsp.JspPage"
classpath="${jsp-api.jar}" />
<available property="struts.present"
classname="org.apache.struts.action.ActionForm"
classpath="${struts.jar}" />
<available property="beanutils.present"
classname="org.apache.commons.beanutils.PropertyUtils"
classpath="${commons-beanutils.jar}" />
<available property="regexp.present"
classname="org.apache.regexp.RE"
classpath="${regexp.jar}" />
<!-- JAR files availability flags -->
<available property="jmx.jar.present" file="${jmx.jar}" />
<available property="modeler.jar.present" file="${commons-modeler.jar}" />
<available property="servlet-api.jar.present" file="${servlet-api.jar}" />
<available property="jsp-api.jar.present" file="${jsp-api.jar}" />
<available property="struts.jar.present" file="${struts.jar}" />
<available property="beanutils.jar.present" file="${commons-beanutils.jar}" />
<available property="regexp.jar.present" file="${regexp.jar}" />
<!-- Conditional compilation flags (determined from the flags above) -->
<condition property="compile.admin">
<or>
<equals arg1="${full.dist}" arg2="on" />
<and>
<equals arg1="${struts.present}" arg2="true" />
<equals arg1="${jmx.present}" arg2="true" />
<equals arg1="${modeler.present}" arg2="true" />
<equals arg1="${regexp.present}" arg2="true" />
<available file="${struts.lib}/struts-bean.tld" />
<available file="${struts.lib}/struts-html.tld" />
<available file="${struts.lib}/struts-logic.tld" />
</and>
</or>
</condition>
<!-- Conditional copy flags (determined from the flags above) -->
<condition property="copy.struts.jar">
<or>
<equals arg1="${full.dist}" arg2="on" />
<equals arg1="${struts.jar.present}" arg2="true" />
</or>
</condition>
</target>
<!-- =================== BUILD: Set compile flags ======================= -->
<target name="flags.display" depends="flags" unless="flags.hide">
<echo message="--- Build environment for Tomcat Server Configuration Application ---" />
<echo message="If ${property_name} is displayed, then the property is not set)" />
<echo message="--- Build options ---" />
<echo message="full.dist=${full.dist}" />
<echo message="build.sysclasspath=${build.sysclasspath}" />
<echo message="compile.debug=${compile.debug}" />
<echo message="compile.deprecation=${compile.deprecation}" />
<echo message="compile.optimize=${compile.optimize}" />
<echo message="--- Ant Flags ---" />
<echo message="&lt;style&gt; task available (required)=${style.available}" />
<echo message="--- JDK ---" />
<echo message="jdk.1.2.present=${jdk.1.2.present}" />
<echo message="jdk.1.3.present=${jdk.1.3.present}" />
<echo message="jdk.1.4.present=${jdk.1.4.present}" />
<echo message="--- Required Libraries ---" />
<echo message="jaxp.present=${jaxp.present}" />
<echo message="jmx.present=${jmx.present}" />
<echo message="modeler.present=${modeler.present}" />
<echo message="servlet.present=${servlet.present}" />
<echo message="jsp.present=${jsp.present}" />
<echo message="regexp.present=${regexp.present}" />
<echo message="--- Required JARs ---" />
<echo message="jmx.jar.present=${jmx.jar.present}" />
<echo message="modeler.jar.present=${modeler.jar.present}" />
<echo message="servlet-api.jar.present=${servlet-api.jar.present}" />
<echo message="jsp-api.jar.present=${jsp-api.jar.present}" />
<echo message="struts.jar.present=${struts.jar.present}" />
<echo message="beanutils.jar.present=${beanutils.jar.present}" />
<echo message="regexp.jar.present=${regexp.jar.present}" />
<echo message="--- Optional JARs ---" />
<echo message="--- Conditional compilation flags ---" />
<echo message="compile.admin=${compile.admin}" />
<echo message="--- Distribution flags ---" />
<echo message="copy.struts.jar=${copy.struts.jar}" />
</target>
<!-- ======================== BUILD: Copy JARs ========================== -->
<target name="copy-struts.jar" if="struts.present">
<copy todir="${webapps.build}/${webapp.name}/WEB-INF/lib" file="${struts.jar}"/>
<copy todir="${webapps.build}/${webapp.name}/WEB-INF" file="${struts.lib}/struts-bean.tld"/>
<copy todir="${webapps.build}/${webapp.name}/WEB-INF" file="${struts.lib}/struts-html.tld"/>
<copy todir="${webapps.build}/${webapp.name}/WEB-INF" file="${struts.lib}/struts-logic.tld"/>
</target>
<!-- =================== BUILD: Create Directories ====================== -->
<target name="build-prepare">
<mkdir dir="${webapps.build}"/>
<mkdir dir="${webapps.build}/${webapp.name}"/>
<mkdir dir="${webapps.build}/${webapp.name}/WEB-INF"/>
<mkdir dir="${webapps.build}/${webapp.name}/WEB-INF/classes"/>
<mkdir dir="${webapps.build}/${webapp.name}/WEB-INF/lib"/>
</target>
<!-- ================ BUILD: Copy Static Files ========================== -->
<target name="build-static" depends="flags,flags.display,build-prepare,copy-struts.jar">
<copy todir="${webapps.build}/${webapp.name}/WEB-INF/lib" file="${commons-beanutils.jar}"/>
<copy tofile="${webapps.build}/${webapp.name}/WEB-INF/lib/commons-collections.jar"
file="${commons-collections.jar}"/>
<copy todir="${webapps.build}/${webapp.name}/WEB-INF/lib" file="${commons-digester.jar}"/>
<copy todir="${webapps.build}/${webapp.name}">
<fileset dir=".">
<exclude name="build.*"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<!-- ================= BUILD: Compile Server Components ================= -->
<target name="build-main" depends="build-static" if="compile.admin">
<javac srcdir="WEB-INF/classes"
destdir="${webapps.build}/${webapp.name}/WEB-INF/classes"
debug="${compile.debug}" deprecation="${compile.deprecation}"
optimize="${compile.optimize}"
excludes="**/CVS/**">
<classpath refid="admin.classpath" />
</javac>
</target>
<!-- ==================== BUILD: Rebuild Everything ===================== -->
<target name="all" depends="build-clean,build-main"
description="Clean and build admin webapp"/>
<!-- ======================= BUILD: Clean Directory ===================== -->
<target name="build-clean">
<delete dir="${webapps.build}"/>
</target>
<!-- ======================= DIST: Create Directories =================== -->
<target name="dist-prepare">
<mkdir dir="${webapps.dist}"/>
</target>
<!-- ======================= DIST: Create Distribution Files ============ -->
<target name="dist" depends="build-main,dist-prepare"
description="Create admin webapp binary distribution">
<jar jarfile="${webapps.dist}/${webapp.name}.war"
basedir="${webapps.build}/${webapp.name}" includes="**"/>
</target>
<!-- ======================= DIST: Clean Directory ====================== -->
<target name="dist-clean">
<deltree dir="${dist.dir}"/>
</target>
<!-- ====================== Convenient Synonyms ========================= -->
<target name="clean" depends="build-clean,dist-clean"
description="Clean build and dist directories"/>
</project>