cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject cvs commit: xml-cocoon/contrib/src
Date Fri, 01 Sep 2000 06:35:31 GMT
balld       00/08/31 23:35:31

  Added:       contrib build.xml
  added miniature build system for cocoon-contrib
  Revision  Changes    Path
  1.1                  xml-cocoon/contrib/
  echo "Cocoon Build System"
  echo "-------------------"
  if [ "$JAVA_HOME" = "" ] ; then
    echo "ERROR: JAVA_HOME not found in your environment."
    echo "Please, set the JAVA_HOME variable in your environment to match the"
    echo "location of the Java Virtual Machine you want to use."
    exit 1
  LOCALCLASSPATH=`echo lib/*.jar | tr ' ' ':'`:$JAVA_HOME/lib/tools.jar:$CLASSPATH
  echo Building with classpath $LOCALCLASSPATH
  echo Starting Ant...
  $JAVA_HOME/bin/java -Dant.home=$ANT_HOME -classpath $LOCALCLASSPATH
  1.1                  xml-cocoon/contrib/build.xml
  Index: build.xml
  <!-- ===========================================================================
                             * ==================== *
                             |  How to build Cocoon |
                             * ==================== *
                       Stefano Mazzocchi <>
  Cocoon is an highly componentized software. This means: we are lazy and reuse
  whatever possible. But also means: we avoid duplication of efforts and Cocoon
  development can go on concurrently with the other used projects without
  interference. At the end: Cocoon evolves much faster :)
  Anyway, any componentized software is based on "contracts" between the core
  and the modules used. Normally, these "contracts" are standard APIs (such as
  Java API or externally standardized API) but since Cocoon is a pioneer in many
  fields, these APIs do not (yet) exist.
  For this reason, Cocoon itself provides some "glue" classes (decorators) that
  wrap around existing packages (for example, the different XSLT processors) and
  come up with a simple interface for Cocoon to use them.
  Unfortunately, this requires the "glued" classes to be present at compile time,
  that is: you have to download the packages to compile the glue classes.
  This is the main reason why the distribution includes a precompiled version
  that should be handy for most users, but power users willing to further tune
  the software or developers willing to play around with it, must be able
  to compile it and test it.
  Note, however, that Cocoon comes with all the packages required to build a
  fully functional distribution. You'll have to download external packages
  only if you have special requirements. See the build-FAQ section below for more
  info on this.
  Installing the build tools
  The Cocoon build system is based on Jakarta Ant, which is a Java building tool
  originally developed for the Jakarta Tomcat project but now used in many other
  Apache projects and extended by many developers.
  Ant is a little but very handy tool that uses a build file written in XML
  (this file) as building instructions. For more information refer to
  To make things easier for you, the Cocoon distribution contains a precompiled
  version of Ant and the build scripts take care of all the classpath issues.
  The only thing that you have to make sure, is the "JAVA_HOME" environment
  property should be set to match the JVM you want to use. That's it.
  Building instructions
  Ok, let's build the baby. First, make sure your current working directory is
  where this very file is located. Then type
    ./ (unix)
    .\build.bat (win32)
  if everything is right and all the required packages are visible, this action
  will generate a file called "cocoon.jar" in the "./build" directory. Note, that
  if you do further development, compilation time is reduced since Ant is able
  to detect which files have changed an to recompile them at need.
  If something went wrong, go to the FAQ section below.
  Also, you'll note that reusing a single JVM instance for each task, increases
  tremendously the performance of the whole build system, compared to other
  tools (i.e. make or shell scripts) where a new JVM is started for each task.
  Build targets
  The build system is not only responsible of compiling Cocoon into a jar file,
  but is also responsible for creating the HTML documentation, javadocs,
  distributions and web site. In fact, the file you have here is _exactly_ what
  is used by cocoon maintainers to take care of everything in the Cocoon
  project, no less and no more.
  These are the meaningful targets for this build file:
   - package [default] -> creates ./build/cocoon.jar
   - docs -> generates the HTML documentation in ./build/docs
   - printer-docs -> generates printer friendly HTML documentation in ./build/printer-docs
   - javadocs -> generates the API documentation in ./build/javadocs
   - dist-zip -> generates the Cocoon distribution
   - dist-tgz -> generates the Cocoon distribution
   - clean -> restores the distribution to its original and clean state
   - site -> generates the web site in ../xml-site/targets/cocoon
  ====================================== FAQ =====================================
  1) Why some of the classes present in the original jar are not built anymore?
  The cocoon build system is very flexible: if a module requires a package that
  is not present in the classpath at build time, the module is skipped but
  the built process is not stopped.
  Here is a list of such modules and what you have to download to build them:
   org.apache.cocoon.transformer.XTTransformer ===>
         James Clark's XT (
   org.apache.cocoon.processor.ldap.LdapProcessor ===>
         Sun JNDI API 1.2.1+ (
   org.apache.cocoon.processor.dcp.DCPProcessor ===>
         FESI 1.21+ (
  2) The "docs" target doesn't work. What's wrong?
  You are probably using a Java 1.1.x environment. Since Stylebook renders also
  the page images from the XML documents, it needs extended image rendering
  and graphic capabilities that were included in Java 1.2. For this reason,
  a Java 1.2 compatible JVM is required for this target.
  ============================================================================ -->
  <project default="package" basedir=".">
    <!-- =================================================================== -->
    <!-- Initialization target                                               -->
    <!-- =================================================================== -->
    <target name="init">
      <property name="Name" value="Cocoon-contrib"/>
      <property name="name" value="cocoon-contrib"/>
      <property name="version" value="1.0"/>
      <property name="year" value="2000"/>
      <echo message="      ------------------- ${Name} ${version} [${year}] ---------"/>
      <property name="build.compiler" value="classic"/>
      <property name="debug" value="on"/>
      <property name="optimize" value="on"/>
      <property name="deprecation" value="off"/>
      <property name="src.dir" value="./src"/>
      <property name="lib.dir" value="./lib"/>
      <property name="samples.dir" value="./samples"/>
      <property name="packages" value="org.apache.cocoon.contrib.*"/>
      <property name="build.dir" value="./build"/>
      <property name="build.src" value="./build/src"/>
      <property name="build.dest" value="./build/classes"/>
      <property name="build.javadocs" value="./build/javadocs"/>
      <property name="dist.root" value="./dist"/>
      <property name="dist.dir" value="${dist.root}/${name}-${version}"/>
      <filter token="year" value="${year}"/>
      <filter token="version" value="${version}"/>
      <filter token="date" value="${TODAY}"/>
      <filter token="log" value="true"/>
      <filter token="verbose" value="false"/>
    <!-- =================================================================== -->
    <!-- Help on usage                                                       -->
    <!-- =================================================================== -->
    <target name="usage">
      <echo message=""/>
      <echo message=""/>
      <echo message="Cocoon Build file"/>
      <echo message="-------------------------------------------------------------"/>
      <echo message=""/>
      <echo message=" available targets are:"/>
      <echo message=""/>
      <echo message="   package      --> generates the cocoon.jar file (default)"/>
      <echo message="   compile      --> compiles the source code"/>
      <echo message="   docs         --> generates the HTML documentation"/>
      <echo message="   printer-docs --> generates printer-friendly HTML documentation"/>
      <echo message="   javadocs     --> generates the API documentation (java 1.2 only)"/>
      <echo message="   dist-zip     --> generates the Cocoon distribution as .zip"/>
      <echo message="   dist-tgz     --> generates the Cocoon distribution as .tar.gz"/>
      <echo message="   clean        --> cleans up the directory"/>
      <echo message="   site         --> generates the Cocoon web site"/>
      <echo message=""/>
      <echo message=" See the comments inside the build.xml file for more details."/>
      <echo message="-------------------------------------------------------------"/>
      <echo message=""/>
      <echo message=""/>
    <!-- =================================================================== -->
    <!-- Prepares the build directory                                        -->
    <!-- =================================================================== -->
    <target name="prepare" depends="init">
      <mkdir dir="${build.dir}"/>
    <!-- =================================================================== -->
    <!-- Prepares the source code                                            -->
    <!-- =================================================================== -->
    <target name="prepare-src" depends="prepare">
      <!-- create directories -->
      <mkdir dir="${build.src}"/>
      <mkdir dir="${build.dest}"/>
      <!-- copy src files -->
      <copydir src="${src.dir}"
               excludes="**/parser/Sun*, **/XT*, **/ldap/**, **/ecmascript/**, **/doclet/**"
    <!-- =================================================================== -->
    <!-- Compiles the source directory                                       -->
    <!-- =================================================================== -->
    <target name="compile" depends="prepare-src">
      <javac srcdir="${build.src}"
    <!-- =================================================================== -->
    <!-- Creates the class package                                           -->
    <!-- =================================================================== -->
    <target name="package" depends="compile">
      <jar jarfile="${build.dir}/${name}.jar"
    <!-- =================================================================== -->
    <!-- Creates the API documentation                                       -->
    <!-- =================================================================== -->
    <target name="javadocs" depends="prepare-src">
      <mkdir dir="${build.javadocs}"/>
      <javadoc packagenames="${packages}"
               windowtitle="${Name} API"
               bottom="Copyright &#169; ${year} Apache Software Foundation. All Rights
    <!-- =================================================================== -->
    <!-- Creates the distribution                                            -->
    <!-- =================================================================== -->
    <target name="dist" depends="package, javadocs">
      <mkdir dir="${dist.dir}"/>
      <mkdir dir="${dist.dir}/bin"/>
      <mkdir dir="${dist.dir}/lib"/>
      <mkdir dir="${dist.dir}/src"/>
      <mkdir dir="${dist.dir}/docs"/>
      <mkdir dir="${dist.dir}/docs/api"/>
      <mkdir dir="${dist.dir}/samples"/>
      <copydir src="${build.src}" dest="${dist.dir}/src" excludes=""/>
      <copyfile src="${src.dir}/org/apache/cocoon/" dest="${dist.dir}/conf/"/>
      <copyfile src="${build.dir}/${name}.jar" dest="${dist.dir}/bin/${name}.jar"/>
      <copydir src="${build.javadocs}" dest="${dist.dir}/docs/api"/>
      <copydir src="${samples.dir}" dest="${dist.dir}/samples"/>
      <copydir src="${lib.dir}" dest="${dist.dir}/lib"/>
      <copydir src="." dest="${dist.dir}" includes="README, LICENSE, build.*, index.html"
      <chmod perm="+x" file="${dist.dir}/"/>
      <fixcrlf srcdir="${dist.dir}" includes="" cr="remove"/>
      <fixcrlf srcdir="${dist.dir}" includes="build.bat" cr="add"/>
    <!-- =================================================================== -->
    <!-- Packages the distribution as .zip                                   -->
    <!-- =================================================================== -->
    <target name="dist-zip" depends="dist">
      <zip zipfile="${Name}-${version}.zip" basedir="${dist.root}" includes="**"/>
    <!-- =================================================================== -->
    <!-- Packages the distribution with .tar.gzip                            -->
    <!-- =================================================================== -->
    <target name="dist-tgz" depends="dist">
      <tar tarfile="${Name}-${version}.tar" basedir="${dist.root}" includes="**"/>
      <gzip zipfile="${Name}-${version}.tar.gz" src="${Name}-${version}.tar"/>
    <!-- =================================================================== -->
    <!-- Clean targets                                                       -->
    <!-- =================================================================== -->
    <target name="clean" depends="init">
      <deltree dir="${build.dir}"/>
    <target name="distclean" depends="clean">
      <deltree dir="${dist.root}"/>
      <delete file="${Name}-${version}.tar.gz"/>
      <delete file="${Name}-${version}.tar"/>
      <delete file="${Name}-${version}.zip"/>
  <!-- End of file -->
  1.1                  xml-cocoon/contrib/src/
  Manifest-Version: 1.0

View raw message