You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ba...@locus.apache.org on 2000/09/01 08:35:31 UTC
cvs commit: xml-cocoon/contrib/src Manifest.mf
balld 00/08/31 23:35:31
Added: contrib build.sh build.xml
contrib/src Manifest.mf
Log:
added miniature build system for cocoon-contrib
Revision Changes Path
1.1 xml-cocoon/contrib/build.sh
Index: build.sh
===================================================================
#!/bin/sh
echo
echo "Cocoon Build System"
echo "-------------------"
if [ "$JAVA_HOME" = "" ] ; then
echo "ERROR: JAVA_HOME not found in your environment."
echo
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
fi
ANT_HOME=./lib
LOCALCLASSPATH=`echo lib/*.jar | tr ' ' ':'`:$JAVA_HOME/lib/tools.jar:$CLASSPATH
echo
echo Building with classpath $LOCALCLASSPATH
echo
echo Starting Ant...
$JAVA_HOME/bin/java -Dant.home=$ANT_HOME -classpath $LOCALCLASSPATH org.apache.tools.ant.Main $*
1.1 xml-cocoon/contrib/build.xml
Index: build.xml
===================================================================
<!-- ===========================================================================
* ==================== *
| How to build Cocoon |
* ==================== *
by
Stefano Mazzocchi <st...@apache.org>
Introduction
============
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
"http://jakarta.apache.org/ant/".
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
./build.sh (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 (http://www.jclark.com/)
org.apache.cocoon.processor.ldap.LdapProcessor ===>
Sun JNDI API 1.2.1+ (http://java.sun.com/products/jndi/index.html)
org.apache.cocoon.processor.dcp.DCPProcessor ===>
FESI 1.21+ (http://home.worldcom.ch/jmlugrin/fesi/download.html)
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">
<tstamp/>
<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"/>
</target>
<!-- =================================================================== -->
<!-- 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=""/>
</target>
<!-- =================================================================== -->
<!-- Prepares the build directory -->
<!-- =================================================================== -->
<target name="prepare" depends="init">
<mkdir dir="${build.dir}"/>
</target>
<!-- =================================================================== -->
<!-- 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}"
dest="${build.src}"
excludes="**/parser/Sun*, **/XT*, **/ldap/**, **/ecmascript/**, **/doclet/**"
filtering="on"/>
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory -->
<!-- =================================================================== -->
<target name="compile" depends="prepare-src">
<javac srcdir="${build.src}"
destdir="${build.dest}"
debug="${debug}"
optimize="${optimize}"/>
</target>
<!-- =================================================================== -->
<!-- Creates the class package -->
<!-- =================================================================== -->
<target name="package" depends="compile">
<jar jarfile="${build.dir}/${name}.jar"
basedir="${build.dest}"
manifest="${build.src}/Manifest.mf"
includes="org/**"/>
</target>
<!-- =================================================================== -->
<!-- Creates the API documentation -->
<!-- =================================================================== -->
<target name="javadocs" depends="prepare-src">
<mkdir dir="${build.javadocs}"/>
<javadoc packagenames="${packages}"
sourcepath="${build.src}"
destdir="${build.javadocs}"
author="true"
version="true"
use="false"
noindex="true"
windowtitle="${Name} API"
doctitle="${Name}"
bottom="Copyright © ${year} Apache Software Foundation. All Rights Reserved."
stylesheetfile="${skins.dir}/javadoc.css"
/>
</target>
<!-- =================================================================== -->
<!-- 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="cocoon.properties"/>
<copyfile src="${src.dir}/org/apache/cocoon/cocoon.properties" dest="${dist.dir}/conf/cocoon.properties"/>
<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" filtering="on"/>
<chmod perm="+x" file="${dist.dir}/build.sh"/>
<fixcrlf srcdir="${dist.dir}" includes="build.sh" cr="remove"/>
<fixcrlf srcdir="${dist.dir}" includes="build.bat" cr="add"/>
</target>
<!-- =================================================================== -->
<!-- Packages the distribution as .zip -->
<!-- =================================================================== -->
<target name="dist-zip" depends="dist">
<zip zipfile="${Name}-${version}.zip" basedir="${dist.root}" includes="**"/>
</target>
<!-- =================================================================== -->
<!-- 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"/>
</target>
<!-- =================================================================== -->
<!-- Clean targets -->
<!-- =================================================================== -->
<target name="clean" depends="init">
<deltree dir="${build.dir}"/>
</target>
<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"/>
</target>
</project>
<!-- End of file -->
1.1 xml-cocoon/contrib/src/Manifest.mf
Index: Manifest.mf
===================================================================
Manifest-Version: 1.0