blob: ea6ddeb7db8f16fc305a3388bd04462ae5d341f8 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
build.xml
=========
Jakarta Ant build file for the wyona:cms content management system
History
=======
When Who What
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2001-01-06 Marc Liyanage Initial version
License
=======
Copyright (c) 2002 wyona.org
-->
<project default="webapp" name="wyona-cms" basedir=".">
<!-- ============================================================ -->
<!-- Set up some global properties -->
<!-- ============================================================ -->
<!-- Project version and name -->
<property name="version" value="2.0"/>
<property name="fullname" value="${ant.project.name}-${version}"/>
<!-- All compilation and preparation takes place in build.root -->
<property name="build.root" value="build"/>
<!-- Destination for the compliation of our own classes in the "compile" target -->
<property name="build.dir" value="${build.root}/${ant.project.name}"/>
<!-- The libraries we use and which are not already included in the cocoon package -->
<property name="build.lib.dir" value="lib"/>
<!-- This is where we assemble the webapp directory in the "webapp" task -->
<property name="build.webapp" value="${build.root}/webapp"/>
<!-- All packaging for distribution takes place in dist.root -->
<property name="dist.root" value="dist"/>
<!-- The toplevel directory for the final end-user distribution -->
<property name="dist.bin.dir" value="${dist.root}/${fullname}"/>
<!-- The javadoc destination directory -->
<property name="dist.bin.javadoc" value="${build.webapp}/wyona/cms/docs/resources/html/javadoc"/>
<!-- The filename of the final end-user war package -->
<property name="dist.bin.warfile" value="${dist.bin.dir}/${ant.project.name}.war"/>
<!-- The filename of the final end-user tar file -->
<property name="dist.bin.tarfile" value="${dist.root}/${fullname}.tar"/>
<!-- The toplevel directory for the final developer source distribution -->
<property name="dist.src.dir" value="${dist.root}/${fullname}-src"/>
<!-- The filename of the final developer source tar file -->
<property name="dist.src.tarfile" value="${dist.root}/${fullname}-src.tar"/>
<!-- The original, unmodified cocoon.war file upon which we base our package -->
<property name="src.cocoon-war" value="cocoon.war"/>
<!--
The files that should be copied into the dist
directory and packed up as tar.gz file, along with the .war file
-->
<property name="src.dist.dir" value="./src/dist"/>
<!--
The files that should be copied into the source dist
directory and packed up as tar.gz file, along with the sources etc.
-->
<property name="src.dist-src.dir" value="./src/dist-src"/>
<!-- Our own source code tree is here -->
<property name="src.main.dir" value="./src/main"/>
<!--
The unit testing source code
(See http://www-106.ibm.com/developerworks/java/library/j-ant/)
-->
<property name="src.main.dir" value="./src/main"/>
<!--
Our own webapp resources to be merged with the
contents of the cocoon webapp are here
-->
<property name="src.webapp.dir" value="./src/webapp"/>
<!-- ============================================================ -->
<!-- Set up classpath -->
<!-- ============================================================ -->
<path id="classpath">
<fileset dir="${build.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${build.webapp}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<!--<pathelement path="${java.class.path}/"/>-->
</path>
<!-- ============================================================ -->
<!-- Targets -->
<!-- ============================================================ -->
<!--
This target is only used internally through dependencies.
It unpacks the cocoon.war file so the other targets have
access to the libraries in it.
It also forms the base of our own web-application.
-->
<target name="_unpack-cocoon">
<mkdir dir="${build.webapp}"/>
<!-- copy the bulk of the cocoon webapp to our destination -->
<unzip src="${src.cocoon-war}" overwrite="false" dest="${build.webapp}" />
</target>
<!-- The main compilation target -->
<target name="compile" depends="_unpack-cocoon">
<mkdir dir="${build.dir}"/>
<javac srcdir="${src.main.dir}"
destdir="${build.dir}"
classpathref="classpath"
debug="on"
/>
</target>
<!-- The javadoc target is only invoked when the war file is built -->
<target name="javadoc" depends="_unpack-cocoon">
<mkdir dir="${dist.bin.javadoc}"/>
<javadoc
sourcepath="${src.main.dir}"
destdir="${dist.bin.javadoc}"
packagenames="org.wyona.*"
classpathref="classpath"
windowtitle="wyona:cms - Version ${version}"
/>
<!-- overview="src/ch/futurelab/jsptags/overview.html" -->
</target>
<!--
This target creates a webapp directory which exactly mirrors how
the war file will look. It is used to create the war file for
the "war" target but it can also be used by developers
directly.
This is useful if the reloadable attribute of the context
in the server.xml configuration is set to true so changes in the classes
are reflected immediately.
-->
<target name="webapp" depends="compile">
<!--
overwrite some parts of the previously unpacked
cocoon webapp package with our customized files
-->
<copy todir="${build.webapp}" overwrite="yes">
<fileset dir="${src.webapp.dir}">
<include name="**/*"/>
</fileset>
</copy>
<!-- now copy our compiled classes -->
<mkdir dir="${build.webapp}/WEB-INF/classes"/>
<copy todir="${build.webapp}/WEB-INF/classes">
<fileset dir="${build.dir}">
<include name="**/*"/>
</fileset>
</copy>
<!-- now copy any additional libraries in ./lib -->
<mkdir dir="${build.webapp}/WEB-INF/lib"/>
<copy todir="${build.webapp}/WEB-INF/lib">
<fileset dir="${build.lib.dir}">
<include name="**/*"/>
</fileset>
</copy>
</target>
<!--
The war target just packs up what was created in the webapp target
(and triggers the javadoc target with the dependency)
-->
<target name="war" depends="webapp, javadoc">
<mkdir dir="${dist.bin.dir}"/>
<jar jarfile="${dist.bin.warfile}"
basedir="${build.webapp}"
excludes="META-INF/MANIFEST.MF"
/>
</target>
<!--
The dist target prepares the binary distribution tarball for
end users. It forces a complete rebuild of everything through its
dependency on the "clean" target in order to prevent garbage
like the cocoon logfiles from ending up in the distribution tarball.
-->
<target name="dist" depends="clean, war">
<copy todir="${dist.bin.dir}">
<fileset dir="${src.dist.dir}">
<include name="**/*"/>
</fileset>
</copy>
<tar tarfile="${dist.bin.tarfile}" basedir="${dist.root}" includes="${fullname}/**"/>
<gzip zipfile="${dist.bin.tarfile}.gz" src="${dist.bin.tarfile}"/>
<delete file="${dist.bin.tarfile}"/>
</target>
<!--
The dist-src target prepares the source distribution tarball for
developers. It also depends on the clean target to remove all build stuff.
-->
<target name="dist-src" depends="clean">
<mkdir dir="${dist.src.dir}"/>
<copy todir="${dist.src.dir}">
<fileset dir="${src.dist-src.dir}">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${dist.src.dir}">
<fileset dir=".">
<include name="src/**"/>
<include name="${build.lib.dir}/**"/>
<include name="build.xml"/>
<include name="${src.cocoon-war}"/>
</fileset>
</copy>
<tar tarfile="${dist.src.tarfile}" basedir="${dist.root}" includes="${fullname}-src/**"/>
<gzip zipfile="${dist.src.tarfile}.gz" src="${dist.src.tarfile}"/>
<delete file="${dist.src.tarfile}"/>
</target>
<!--
The clean target removes any generated stuff,
which should bring us back to a pristine source package dir
-->
<target name="clean">
<delete dir="${build.root}"/>
<delete dir="${dist.root}"/>
</target>
</project>