[ Heml ] / trunk /

/trunk/build.xml (rHEAD)

<!-- $Date: 2006-02-08 22:05:03 -0400 (Wed, 08 Feb 2006) $
$Id: build.xml 1707 2006-02-09 02:05:03Z brucerob $
 
A "project" describes a set of targets that may be requested
when Ant is executed.  The "default" attribute defines the
target which is executed if no specific target is requested,
and the "basedir" attribute defines the current working directory
from which Ant executes the requested task.  This is normally
set to the current working directory.
-->
 
 
<project name="HEML" default="all" basedir=".">
 
 
<!-- Property Definitions
 
Each of the following properties are used by convention in this
build file.  The values specified can be overridden at run time by
adding a "-Dname=value" argument to the command line that invokes Ant.
This technique is normally used to copy the values of the ANT_HOME
and TOMCAT_HOME environment variables into the "ant.home" and
     "tomcat.home" properties, which are normally not defined explicitly.
 
     app.name          Base name of this application, used to
		       construct filenames and directories.
 
     deploy.home       The name of the directory into which the
		       deployment hierarchy will be created.
 
 
     dist.home         The name of the base directory in which
		       distribution files are created.
 
     dist.src          The name of the distribution JAR file
		       containing the application source code,
		       to be stored in the "dist.home" directory.
		       This filename should end with ".jar".
 
     dist.war          The name of the Web ARchive (WAR) file
		       containing our deployable application.
		       This filename should end with ".war".
 
     javadoc.home      The name of the base directory in which
		       the JavaDoc documentation for this application
	       is generated.
 
 
-->
 
<!-- To use in ant 1.5 -->
<!--xmlproperty file="properties.xml"
	 keeproot="false"
	 collapseAttributes="true" /-->
<!-- metadata about this project -->
<property name="release.number" value="0_7.2"/>
<property name="schema.number"  value="2003-09-17"/>
<property name="app.name"       value="heml"/>
<property name="war.name"      value="cocoon-with-heml"/>
<property name="cocoon.version" value="2.1.7"/>
<!-- locations -->
<property name="sitemap.home"   value="${cocoon.home}/src/webapp"/>
<property name="webapp.dir"    value="${cocoon.home}/src/blocks"/>
<property name="deploy.home"    value="${webapp.dir}/${app.name}"/>
<property name="cocoon.ant.tasks" value="${cocoon.home}/tools/anttasks"/>
<!--property name="dist.dir"      value="/var/www/html/releases/v${release.number}"/-->
<property name="dist.dir" value="/var/www/html/releases/v${release.number}"/>
<property name="tar.file" value="${dist.dir}/${DSTAMP}/heml-${release.number}-${DSTAMP}.tar.gz" />
<!--property name="dist.home"      value="${build.dir}/${app.name}"/-->
<!--property name="dist.src"       value="${app.name}.jar"/>

<property name="dist.war"       value="${app.name}.war"/-->
<property name="javadoc.home"   value="${heml.home}/BUILD/web/javadoc"/>
<property name="jar.dir"        value="${cocoon.home}/lib"/>
<property name="classes.dir"    value="${webapp.dir}/WEB-INF/classes"/>
<!-- Absolute paths get broken by a nutty parser;
this is equivalent to having the docbook directory
at the same level as the heml directory
-->
 
<property name="stylesheet"     value="../../docbook/xhtml/docbook.xsl"/>
<property name="xmlschema.stylesheet" value="${heml.home}/web/xslt/schema/xs3p.xsl"/>
 
 
<!-- The "all" target rebuilds everything by executing the "clean"
target first, which forces the "compile" target to compile all
source code instead of just the files that have been changed.
-->
 
<target name="all" depends="prepare_exist,xpatch,inject_block,minimal_cocoon_build"/>
<target name="rebuild" depends="xpatch,prepare,minimal_cocoon_build"/>
 
<!--=====================================================================-->
<!-- Various deletion routines                                           -->
<!--=====================================================================-->
 
 
<!-- The "clean" target removes the deployment home directory structure,
so that the next time the "compile" target is requested, it will need
to compile everything from scratch.
-->
<target name="clean" depends="local_clean,cocoon_clean"/>
<target name="local_clean" depends="heml_clean"/>
<!-- only clean step 2 below, leaving the cocoon environment intact -->
<target name="heml_clean">
<delete dir="${deploy.home}"/>
</target>
 
<!-- clean the entire cocoon project -->
<target name="cocoon_clean">
<ant antfile="${cocoon.home}/build.xml" dir="${cocoon.home}" target="clean"/>
</target>
 
<!--=====================================================================-->
<!-- Inject eXist                                                        -->
<!--=====================================================================-->
<target name="prepare_exist">
  <ant antfile="${exist.home}/build.xml" dir="${exist.home}"
       target="inject_exist_block"
       inheritAll="false"/>
</target>
 
<!-- three parts to the build process:
1. (optional) build the cocoon project into which we will inject ourselves
2. Inject the heml-cocoon directory. Options include if we want javadocs
or documents built.
3. Package as binary distro.
-->
 
<!--====================================================================-->
<!--  Step 1: Build cocoon                                              -->
<!--          either minimally or according to the properties files     -->
<!--	      already there                                             -->
<!--====================================================================-->
 
<target name="minimal_cocoon_build"
depends="set_minimal_cocoon_build_config,cocoon_build"/>
 
<target name="set_minimal_cocoon_build_config">
<copy todir="${cocoon.home}">
<fileset dir="${heml.home}/cocoon-properties" includes="local.build.properties,local.blocks.properties"/>
</copy>
</target>
 
<!-- The "build_cocoon" target runs the 'prepare-webapp' target in the
build.xml file under $COCOON_HOME.
-->
 
<target name="cocoon_build">
<!--antcall target="update_cocoon_from_cvs"/-->
<!-- first, install our own local.build.properties
    and local.blocks.properties files
-->
<ant antfile="${cocoon.home}/build.xml" dir="${cocoon.home}" target="webapp">
</ant>
</target>
 
<target name="update_cocoon_from_cvs">
<cvspass cvsroot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic"
password="anoncvs"/>
<cvs command="-z3 update -d -P" dest="${cocoon.home}"/>
</target>
 
<!--====================================================================-->
<!--  Step 2: Inject heml-cocoon directory into existing cocoon build   -->
<!--====================================================================-->
 
<!-- top-level targets of this sort -->
<target name="local_build" depends="full_heml_build"/>
<target name="heml_build" depends="prepare,compile"/>
<target name="inject_block" depends="prepare,xpatch"/>
<target name="full_heml_build"
depends="heml_build,project_documentation_build"/>
<target name="project_documentation_build"
depends="docs,schemadoc,javadoc"/>
 
 
<!-- The "prepare" target is used to construct the deployment home
directory structure (if necessary), and to copy in static files
as required.  In the example below, Ant is instructed to create
the deployment directory, copy the contents of the "web/" source
hierarchy, and set up the WEB-INF subdirectory appropriately.
-->
<target name="copy_web_dir">
<mkdir dir="${deploy.home}/samples"/>
<copy todir="${deploy.home}/samples">
<fileset dir="web"/>
</copy>
</target>
 
<target name="prepare" depends="copy_web_dir">
<tstamp/>
<mkdir  dir="${deploy.home}/conf"/>
<mkdir dir="${deploy.home}/java"/>
<mkdir dir="${deploy.home}/lib"/>
<copy todir="${deploy.home}/conf">
<fileset dir="${heml.home}/block-conf" includes="heml.xsamples"/>
</copy>
<copy todir="${deploy.home}/java">
<fileset dir="src"/>
</copy>
 
<copy todir="${deploy.home}/lib">
<fileset dir="lib"/>
</copy>
 
<replace file="${deploy.home}/samples/docs/site/index.html"
     token="@release_number@"
     value="${release.number}-${DSTAMP}"/>
 
<replace file="${deploy.home}/samples/resources/images/svg/title.svg"
     token="@release_number@"
     value="${release.number}-${DSTAMP}"/>
</target>
 
<!-- =================================================================== -->
<!-- Indentify Classpath                                                 -->
<!-- =================================================================== -->
<path id="classpath">
<fileset dir="${webapp.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${jar.dir}">
<include name="*.jar"/>
</fileset>
<pathelement path="${classes.dir}"/>
<fileset dir="${cocoon.home}/lib/optional">
<include name="*.jar"/>
</fileset>
<fileset dir="${cocoon.home}/lib/endorsed">
<include name="*.jar"/>
</fileset>
<fileset dir="${cocoon.home}/src/blocks/batik/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${heml.home}/lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${deploy.home}/WEB-INF/classes"/>
<pathelement path="${cocoon.home}/build/cocoon-2.1.1/classes"/>
</path>
 
<target name="compile" depends="prepare">
<javac srcdir="src" destdir="${classes.dir}"
   classpathref="classpath"
   debug="on" optimize="off" deprecation="off"/>
<copy   todir="${classes.dir}">
<fileset dir="src" includes="**/*.properties"/>
</copy>
</target>
 
<!-- The "javadoc" target is used to create the Javadoc API documentation
for the Java classes in this web application.  It is assumed that
this documentation is included in the deployed application, so the
example below generates the Javadoc HTML files in a subdirectory under
the deployment home directory.  Feel free to customize the options for
the JavaDoc task, after consulting the Ant documentation.
-->
 
<target name="javadoc" depends="prepare">
<javadoc packagenames="org.heml.*"
   sourcepath="src"
   destdir="${build.dir}/web/javadoc"
   author="true"
   verbose="true"
   version="true"
   protected="true"
   use="true"
   windowtitle="Heml "
 
   doctitle="&lt;h1>Heml&lt;/h1>"
   bottom="&lt;i>Copyright &#169; 2003 Bruce Robertson All Rights Reserved.&lt;/i>">
<link href="http://java.sun.com/j2se/1.3/docs/api"/>
<link href="http://www.jdom.org/docs/apidocs"/>
<link href="http://xml.apache.org/xerces2-j/javadocs/api"/>
</javadoc>
</target>
<!-- The docs target transforms our docbook documents into
html and pdf representations, and puts them in the right places.
It assumes there is a norm walsh docbook xslt package in the same
directory as the heml_cvs/ directory. I alter the nw dist. to make the
html/docbook.xsl produce xml (i.e. xhtml) because the xhtml directory
generates errors.
 
-->
<target name="docs">
<echo message="*** Converting the docbook documents \nInto xhtml using the stylesheet  ${stylesheet}"/>
  <style basedir="xdocs/docbook-docs"
   destdir="${build.dir}/web/docs/site"
   defaultexcludes="no"
   includes="heml-developers-guide.xml,heml-description.xml,faq.xml"
   style="${stylesheet}"
   extension=".html" />
</target>
 
 
<target name="schemadocs_xsltproc" depends="prepare">
<echo message="*** Converting the schema documents \nInto xhtml using the stylesheet  ${xmlschema.stylesheet}"/>
<mkdir dir="${build.dir}/web/docs/site/schemadoc/${schema.number}"/>
 
 
<apply executable="/usr/bin/xsltproc"
   dest="${build.dir}/web/docs/site/schemadoc/${schema.number}"
   failonerror="true"
   skipemptyfilesets="true">
     <arg value="-o"/>
     <targetfile/>
     <arg value="${xmlschema.stylesheet}"/>
     <srcfile/>
     <fileset dir="web/schemas/${schema.number}"/>
     <mapper type="glob" from="*.xsd" to="*.html"/>
</apply>
 
</target>
 
 
 
<target name="schemadoc" depends="prepare">
<style basedir="web/schemas/${schema.number}"
   destdir="${build.dir}/docs/site"
   defaultexcludes="yes"
   includes="heml.xsd,xhtml+heml.xsd"
   style="${heml.home}/web/xslt/schema/xs3p.xsl"
   extension=".html" />
</target>
 
<!-- Old idea
<target name="aggregate_jackdaws" depends="prepare">
<style basedir="web/docs/source/jackdaw"
  destdir="${deploy.home}/docs/source/heml"
  defaultexcludes="yes"
  includes="*.jkdw"
  style="${heml.home}/web/xslt/heml/input/aggregate.xsl"
  extension=".xml"
/>
</target>
 
-->
<!-- Now that we use the reliable and fast xsltproc for
transforming docbook files, I think we should get the
docbook stuff out of cvs in its intermediate xhtml form.
This step, then is omitted -->
 
<!--target name="docs"
  depends="generate_documents">
<copy todir="${deploy.home}/docs/site/">
<fileset dir="web/docs/site" />
</copy>
</target-->
 
<target name="jar" depends="compile">
<jar basedir="${deploy.home}/WEB-INF/classes"
jarfile="${deploy.home}/WEB-INF/lib/heml.jar"/>
</target>
 
 
 
 
 
<!-- The 'cvs' target tags the current state of the project for
cvs
-->
<target name="cvs_release" depends="prepare">
<property name="tag.name" value="tag-${release.number}-${DSTAMP}"/>
<cvs command="rtag  ${tag.name} heml_cvs"/>
<!--echo message="VERSION ${tag.name}" file="${heml.home}/CHANGES"/-->
</target>
 
<!--====================================================================-->
<!--  Step 3: Wrap up the project as an application                     -->
<!--====================================================================-->
 
<!-- The "dist" target builds the distribution Web ARchive (WAR) file
for this application, suitable for distribution to sites that wish
to install your application.  It also creates a JAR file containing
the source code for this application, if you wish to distribute
that separately.
-->
<target name="war"  depends="prepare,minimal_cocoon_build">
<ant antfile="${cocoon.home}/build.xml" dir="${cocoon.home}" target="war"/>
</target>
 
<target name="build_source">
<tempfile destdir="/tmp/Heml-build-temp" property="build.dir"/>
 <mkdir dir="${build.dir}"/>
  <copy todir="${build.dir}">
    <fileset dir="${heml.home}">
    </fileset>
  </copy>
 </target>
<!-- add docs target sometime -->
<target name="dist"
depends="clean,build_source,project_documentation_build">
<property name="dist.src"       value="${app.name}-${release.number}-${DSTAMP}.jar"/>
<property name="dist.war"       value="${war.name}.war"/>
<mkdir  dir="${dist.dir}/${DSTAMP}"/>
<!--copy file="${cocoon.home}/build/webapp/WEB-INF/lib/cocoon-heml-block.jar"
 tofile="${dist.dir}/${DSTAMP}/${dist.src}"
 -->
 
<!-- Not providing war files any
more. Build it yourself, you lazy lo
<ant antfile="${cocoon.home}/build.xml" dir="${cocoon.home}" target="war"/>
<copy file="${cocoon.home}/build/cocoon-${cocoon.version}/cocoon.war" tofile="${dist.dir}/${DSTAMP}/${dist.war}"/>
-->
<copy file="README" tofile="${dist.dir}/${DSTAMP}/readme.txt"/>
<copy file="CHANGES"    tofile="${dist.dir}/${DSTAMP}/changes.txt"/>
<antcall target="md5sum"/>
<antcall target="distSchema"/>
<antcall target="tar"/>
<delete dir="${build.dir}"/>
</target>
<target name="distSchema">
<zip zipfile="${dist.dir}/${DSTAMP}/schemas.zip">
<zipfileset prefix="heml-schema-${schema.number}" dir="${deploy.home}/samples/schemas/${schema.number}"/>
<zipfileset prefix="heml-schema-${schema.number}/samples" dir="${deploy.home}/samples/docs/source" excludes="map"/>
</zip>
</target>
<target name="md5sum">
<exec dir="${dist.dir}/${DSTAMP}" executable="md5sum"  output="${dist.dir}/${DSTAMP}/md5sums.txt">
<arg line="${dist.dir}/${DSTAMP}/heml-${release.number}-${DSTAMP}.tar.gz"/>
</exec>
</target>
<target name="tar">
<tstamp/>
<tar destfile="${dist.dir}/${DSTAMP}/heml-${release.number}-${DSTAMP}.tar.gz" compression="gzip">
  <tarfileset dir="${build.dir}" prefix="heml-${release.number}-${DSTAMP}" />
</tar>
</target>
 
<target name="configure_cocoon_for_dist">
    <echo Message="Setting log-levels to 'INFO', not the far-too-beefy 'DEBUG'"/>
<!--replace file="${deploy.home}/WEB-INF/logkit.xconf" summary="yes">
  <replacetoken>log-level="DEBUG"</replacetoken>
  <replacevalue>log-level="INFO"</replacevalue>
</replace-->
</target>
 
<!-- =====================================================================-->
<!-- Miscellaneous Tasks                                                  -->
<!-- since these require jar files that aren't necessary for the main     -->
<!-- project, we keep them commented out until needed.                     -->
<!-- =====================================================================-->
 
<!--taskdef name="jalopy"
 classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
<classpath>
<fileset dir="../Jalopy/bin">
<include name="*.jar" />
</fileset>
</classpath>
</taskdef-->
 
<!-- the optional "format" target uses jalopy to beautify the java code -->
<target name="format_java">
<jalopy fileformat="unix"
    loglevel="info"
    threads="2"
    >
<fileset dir="src" >
<include name="**/*.java" />
</fileset>
</jalopy>
</target>
 
<!-- The "test_xml" target checks that validity of all xml files in the
project.
This isn't complete, but it's a heck of a good idea, espec. as a general
tool/target.
<target name="test_xml">
 
-->
 
 
<!-- The "info" target tells us what we're up to -->
 
<target name="info">
<echo message="cocoon.home ${cocoon.home}"/>
<echo message="heml.home:  ${heml.home}"/>
<echo message="deploy.home: ${deploy.home}"/>
</target>
 
<!-- the check_spelling target does a spell-check on various files using
the GNU aspell.
 
-->
 
<target name="check_spelling">
<execon executable="xterm"
os="Linux"
dir="xdocs/docbook-docs/"
>
<arg value="-e"/>
<arg value="aspell"/>
<arg value="-H"/>
<arg value="-c"/>
<arg line="-p ./misc/aspell_word_list"/>
<fileset dir="xdocs/docbook-docs">
  <include name="*.xml"/>
</fileset>
</execon>
</target>
 
<!-- XPatch Stuff  -->
<target name="xpatch" depends="xpatch_gump,xpatch_jars"/>
 
<target name="xpatch_init">
  <ant antfile="${cocoon.home}/tools/targets/init-build.xml" dir="${cocoon.home}" target="init-tasks"/>
 
<taskdef name="xpatch" classname="XConfToolTask" classpath="${cocoon.ant.tasks}"/>
</target>
 
<target name="xpatch_gump" depends="xpatch_init">
<xpatch file="${cocoon.home}/gump.xml"
     includes="xpatches/*.xgump"
/>
</target>
 
<target name="xpatch_jars" depends="xpatch_init">
<xpatch file="${cocoon.home}/lib/jars.xml"
        includes="xpatches/*.xjars"
/>
</target>
 
</project>
Generated by ViewSVN