jstrachan 01/05/05 06:52:58
Added: . common.properties common.xml
Log:
Added Tim's common build file and properties. I've patched it a little to remove
${classpath} from the javadoc task (this caused javadoc to fail on Ant 1.3 on win32
for some reason). I've also added the gen-docs target to allow the creation of the TLD
and HTML documentation for a single XML document for a taglib
Revision Changes Path
1.1 jakarta-taglibs/common.properties
Index: common.properties
===================================================================
#
# TAGLIB NAME
#
# The taglib name defaults to the subproject's ant.project.name.
taglib.name = ${ant.project.name}
#
# PROJECT STANDARD PROPERTIES
#
# The following property values reflect the standard directory organization
# for the jakarta-taglibs project, and should not be changed or overridden.
#
# build.dir Base directory for build targets
# dist.dir Base directory for distribution targets
# taglibs.xsl Taglibs stylesheet
build.dir = ${basedir}/../../build/taglibs
dist.dir = ${basedir}/../../dist/taglibs
taglibs.xsl = ../../../src/doc/stylesheets/taglibs.xsl
#
# TAGLIB DOC KIT
#
# These properties support the generation of the HTML and TLD using a single
# XML document
#
#
taglib-doc-kit.dir = ../taglib-doc-kit/xml
tld.xsl = ../../taglib-doc-kit/xml/tld.xsl
taglib-doc.xsl = ../../taglib-doc-kit/xml/taglib-doc.xsl
#
# PROJECT STRUCTURE PROPERTIES
#
# The following property values reflect the recommended directory structure
# for each custom tag library subproject. You should only need to adjust or
# override them if you use a different organization.
#
# conf.src Library configuration source directory
# doc.src Documentation app source directory
# examples.src Examples app source directory
# library.src Library Java source directory
conf.src = conf
doc.src = doc
examples.src = examples
library.src = src
xml.src = xml
#
# DERIVED PROPERTIES
#
# These property values are derived from the previously defined values, and
# should not normally be overridden from the command line.
#
# build.doc Target directory for documentation app
# build.examples Target directory for examples app
# build.library Target directory for tag library
# dist.doc Destination WAR for documentation app
# dist.examples Destination WAR for examples app
# dist.library Destination JAR for tag library
# dist.tld Destination TLD file for tag library
build.doc = ${build.dir}/${taglib.name}-doc
build.examples = ${build.dir}/${taglib.name}-examples
build.library = ${build.dir}/${taglib.name}
dist.doc = ${dist.dir}/${taglib.name}/${taglib.name}-doc.war
dist.examples = ${dist.dir}/${taglib.name}/${taglib.name}-examples.war
dist.library = ${dist.dir}/${taglib.name}
dist.tld = ${dist.dir}/${taglib.name}/${taglib.name}.tld
source.tld = ${conf.src}/${taglib.name}.tld
examples.tld = ${build.examples}/WEB-INF/${taglib.name}.tld
library.tld = ${build.library}/META-INF/taglib.tld
#
# DEFAULT PRE & POST ACTIONS - ALLOWS SUBPROJECTS TO OVERRIDE
#
checkRequirements.pre=default.pre
checkRequirements.post=default.post
prepare.pre=default.pre
prepare.post=default.post
documentation.pre=default.pre
documentation.post=default.post
examples.pre=default.pre
examples.post=default.post
compile-examples.pre=default.pre
compile-examples.post=default.post
library.pre=default.pre
library.post=default.post
main.pre=default.pre
main.post=default.post
documentation-dist.pre=default.pre
documentation-dist.post=default.post
examples-dist.pre=default.pre
examples-dist.post=default.post
library-dist.pre=default.pre
library-dist.post=default.post
dist.pre=default.pre
dist.post=default.post
clean.pre=default.pre
clean.post=default.post
1.1 jakarta-taglibs/common.xml
Index: common.xml
===================================================================
<!-- ===================================================================== -->
<!-- standard Ant targets for custom tag libraries -->
<!-- note: this is not a proper xml file (there is no root element) -->
<!-- it is intended to be imported from the taglib build.xml -->
<!-- ===================================================================== -->
<!-- =================================================================== -->
<!-- Properties setup -->
<!-- =================================================================== -->
<property environment="env"/>
<property file="../common.properties"/>
<property name="classpath" value="${env.SERVLET_JAR}" />
<!-- =================================================================== -->
<!-- Compile the library as well as the associated applications -->
<!-- =================================================================== -->
<target name="main" depends="library,documentation,examples">
<antcall target="${main.pre}"/>
<antcall target="${main.post}"/>
</target>
<!-- =================================================================== -->
<!-- Create the entire set of distribution files -->
<!-- =================================================================== -->
<target name="dist" depends="library-dist,documentation-dist,examples-dist">
<antcall target="${dist.pre}"/>
<antcall target="${dist.post}"/>
</target>
<!-- =================================================================== -->
<!-- Default pre & post actions -->
<!-- =================================================================== -->
<target name="default.pre"/>
<target name="default.post"/>
<!-- =================================================================== -->
<!-- Check required components (xerces and xalan) -->
<!-- =================================================================== -->
<target name="checkRequirements">
<antcall target="${checkRequirements.pre}"/>
<!--
<antcall target="checkRequiredFile">
<param name="file" value="${env.SERVLET_JAR}"/>
<param name="fail.message" value="a jar file containing the servlet
specification classes is required to compile jakarta taglibs. please define the
environment variable SERVLET_JAR and ensure that the file exists"/>
</antcall>
<antcall target="checkRequiredClass">
<param name="class" value="org.apache.xerces.framework.XMLParser"/>
<param name="fail.message" value="xerces is required for the <style>
task in the "documentation" target. please install xerces.jar in
ANT_HOME/lib"/>
</antcall>
<antcall target="checkRequiredClass">
<param name="class" value="org.apache.xalan.xslt.Stylesheet"/>
<param name="fail.message" value="xalan is required for the <style>
task in the "documentation" target. please install xalan.jar in
ANT_HOME/lib"/>
</antcall>
-->
<antcall target="${checkRequirements.post}"/>
</target>
<!-- =================================================================== -->
<!-- Prepare the build and dist directories -->
<!-- =================================================================== -->
<target name="prepare" depends="checkRequirements">
<antcall target="${prepare.pre}"/>
<!-- Set up build directories -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.doc}"/>
<mkdir dir="${build.doc}/javadoc"/>
<mkdir dir="${build.doc}/WEB-INF"/>
<mkdir dir="${build.doc}/WEB-INF/classes"/>
<mkdir dir="${build.doc}/WEB-INF/lib"/>
<mkdir dir="${build.examples}"/>
<mkdir dir="${build.examples}/WEB-INF"/>
<mkdir dir="${build.examples}/WEB-INF/classes"/>
<mkdir dir="${build.examples}/WEB-INF/lib"/>
<mkdir dir="${build.library}"/>
<mkdir dir="${build.library}/META-INF"/>
<!-- Set up distribution directory -->
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.library}"/>
<!-- See if the examples dir has any source to compile -->
<available file="${examples.src}/src" property="examples.src.present"/>
<antcall target="${prepare.post}"/>
</target>
<!-- =================================================================== -->
<!-- Assemble the documentation application -->
<!-- =================================================================== -->
<target name="documentation" depends="prepare">
<antcall target="${documentation.pre}"/>
<copy todir="${build.doc}/WEB-INF">
<fileset dir="${doc.src}/conf"/>
</copy>
<style basedir="${doc.src}/web" destdir="${build.doc}"
extension=".html" style="${taglibs.xsl}" includes="*.xml"/>
<copy todir="${build.doc}">
<fileset dir="${doc.src}/web" includes="**/*.html"/>
</copy>
<javadoc packagenames="org.apache.taglibs.*"
sourcepath="src"
destdir="${build.doc}/javadoc"
author="true"
version="true"
use="true"
windowtitle="Jakarta '${taglib.name}' custom tag library API"
doctitle="Jakarta '${taglib.name}' custom tag library"
bottom="Copyright © 2000 Apache Software Foundation. All Rights
Reserved.">
<link href="http://java.sun.com/products/jdk/1.3/docs/api"/>
<link href="http://java.sun.com/products/servlet/2.2/javadoc"/>
</javadoc>
<antcall target="${documentation.post}"/>
</target>
<!-- =================================================================== -->
<!-- Assemble the examples application -->
<!-- =================================================================== -->
<target name="examples" depends="compile-examples,library-dist">
<antcall target="${examples.pre}"/>
<copy toDir="${build.examples}/WEB-INF">
<fileset dir="${examples.src}/conf"/>
</copy>
<copy toDir="${build.examples}">
<fileset dir="${examples.src}/web"/>
</copy>
<copy file="${source.tld}" toFile="${examples.tld}"/>
<copy file="${dist.library}/${taglib.name}.jar"
toFile="${build.examples}/WEB-INF/lib/${taglib.name}.jar"/>
<copy todir="${build.examples}" >
<fileset dir="${examples.src}/web" includes="*.jsp"/>
<mapper type="glob" from="*.jsp" to="*.txt"/>
</copy>
<antcall target="${examples.post}"/>
</target>
<!-- =================================================================== -->
<!-- Compile the examples application -->
<!-- =================================================================== -->
<target name="compile-examples" depends="prepare" if="examples.src.present">
<antcall target="${compile-examples.pre}"/>
<javac srcdir="${examples.src}/src"
destdir="${build.examples}/WEB-INF/classes"
classpath="${classpath}" debug="on"/>
<copy todir="${build.examples}/WEB-INF/classes">
<fileset dir="${examples.src}/src">
<include name="**/*.properties"/>
</fileset>
</copy>
<antcall target="${compile-examples.post}"/>
</target>
<!-- =================================================================== -->
<!-- Compile the tag library itself -->
<!-- =================================================================== -->
<target name="library" depends="prepare">
<antcall target="${library.pre}"/>
<copy file="${source.tld}" toFile="${library.tld}"/>
<javac srcdir="${library.src}" destdir="${build.library}"
classpath="${classpath}" debug="on"/>
<antcall target="${library.post}"/>
</target>
<!-- =================================================================== -->
<!-- Create the documentation WAR file -->
<!-- =================================================================== -->
<target name="documentation-dist" depends="documentation">
<antcall target="${documentation-dist.pre}"/>
<jar jarfile="${dist.doc}" basedir="${build.doc}"/>
<antcall target="${documentation-dist.pre}"/>
</target>
<!-- =================================================================== -->
<!-- Create the examples WAR file -->
<!-- =================================================================== -->
<target name="examples-dist" depends="examples">
<antcall target="${examples-dist.pre}"/>
<jar jarfile="${dist.examples}" basedir="${build.examples}"/>
<antcall target="${examples-dist.post}"/>
</target>
<!-- =================================================================== -->
<!-- Create the library JAR file -->
<!-- =================================================================== -->
<target name="library-dist" depends="library">
<antcall target="${library-dist.pre}"/>
<jar jarfile="${dist.library}/${taglib.name}.jar"
basedir="${build.library}"/>
<copy file="${source.tld}" toFile="${dist.tld}"/>
<antcall target="${library-dist.post}"/>
</target>
<!-- =================================================================== -->
<!-- Delete output directories and files so we can build from scratch -->
<!-- =================================================================== -->
<target name="clean">
<antcall target="${clean.pre}"/>
<delete dir="${build.doc}"/>
<delete dir="${build.examples}"/>
<delete dir="${build.library}"/>
<delete dir="${dist.dir}/${taglib.name}"/>
<antcall target="${clean.post}"/>
</target>
<!-- =================================================================== -->
<!-- Scripts used with antcall for checking for required classes or jars -->
<!-- Must provide "class" or "file" and "fail.message" parameters -->
<!-- =================================================================== -->
<target name="checkRequiredClass">
<available classname="${class}" property="requirement.satisfied"/>
<antcall target="checkRequired.fail"/>
</target>
<target name="checkRequiredFile">
<available file="${file}" property="requirement.satisfied"/>
<antcall target="checkRequired.fail"/>
</target>
<target name="checkRequired.fail" unless="requirement.satisfied">
<fail message="${fail.message}"/>
</target>
<!-- =================================================================== -->
<!-- Generate TLD and HTML docs from XML files in ${xml.src} -->
<!-- =================================================================== -->
<!--
Someday these tasks may be integrated into the build proper, but for now
they are a separate utility target.
-->
<target name="gen-docs">
<style basedir="${xml.src}"
destdir="${conf.src}"
style="${tld.xsl}"
extension=".tld">
<include name="*.xml" />
</style>
<style basedir="${xml.src}"
destdir="${doc.src}/web"
style="${taglib-doc.xsl}"
extension=".html">
<include name="*.xml" />
<exclude name="**/*.css" />
</style>
<copy file="${taglib-doc-kit.dir}/taglib.css" todir="${doc.src}/web"/>
</target>