| <?xml version="1.0" encoding="UTF-8"?> |
| |
| <!-- |
| |
| build.xml |
| ========= |
| |
| Jakarta Ant build file for the wyona content management system |
| |
| |
| History |
| ======= |
| |
| when Who What |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 2001-01-06 Marc Liyanage Initial version |
| |
| |
| License |
| ======= |
| |
| Copyright (c) 2002 wyona.org |
| |
| @version CVS $Id: build.xml,v 1.30 2003/01/09 01:11:44 michicms Exp $ |
| |
| --> |
| |
| |
| <project default="webapp" name="wyona-cms" basedir="."> |
| |
| <!-- ============================================================ --> |
| <!-- Set up some global properties --> |
| <!-- ============================================================ --> |
| |
| <!-- |
| Give user a chance to override without editing this file |
| (and without typing -D each time he compiles it) |
| --> |
| <property file=".ant.properties"/> |
| <property file="${user.home}/.ant.properties"/> |
| <property file="build.properties"/> |
| |
| <!-- Project version and name --> |
| <property name="version" value="2.1-dev"/> |
| <property name="fullname" value="${ant.project.name}-${version}"/> |
| |
| |
| <!-- The libraries we use and which are not already included in the cocoon package --> |
| <property name="lib.dir" value="lib"/> |
| |
| |
| <!-- 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}"/> |
| |
| <!-- Destination for the filtered source files --> |
| <property name="build.src" value="${build.dir}/src"/> |
| |
| <!-- Destination for the class files of the "compile" target --> |
| <property name="build.dest" value="${build.dir}/classes"/> |
| |
| <!-- This is where we assemble the webapp directory in the "webapp" task --> |
| <property name="build.webapp" value="${build.dir}/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.javadocs" value="${build.webapp}/wyona/cms/pubs/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.dir" value="${dist.root}/${fullname}-bin"/> |
| |
| <!-- The toplevel directory for the final developer source distribution --> |
| <property name="dist.src.dir" value="${dist.root}/${fullname}-src"/> |
| |
| <!-- The original, unmodified and expanded cocoon.war file upon which we base our package --> |
| <property name="src.cocoon.dir" value="./src/cocoon"/> |
| |
| <!-- |
| 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.java.dir" value="./src/java"/> |
| <property name="java.dir" value="src/java"/> |
| |
| <!-- |
| The unit testing source code |
| (See http://www-106.ibm.com/developerworks/java/library/j-ant/) |
| --> |
| <property name="src.test.dir" value="./src/test"/> |
| |
| <!-- |
| Our own webapp resources to be merged with the |
| contents of the cocoon webapp are here |
| --> |
| <property name="src.webapp.dir" value="./src/webapp"/> |
| |
| <property name="tools.jar" value="${java.home}/../lib/tools.jar"/> |
| |
| <!-- |
| these are here only for those who use jikes compiler. For other |
| developers this part makes no difference. |
| --> |
| <property name="build.compiler.emacs" value="on"/> |
| <property name="build.compiler.pedantic" value="false"/> |
| <property name="build.compiler.depend" value="true"/> |
| <property name="build.compiler.fulldepend" value="true"/> |
| |
| |
| <!-- ============================================================ --> |
| <!-- Set up classpath --> |
| <!-- ============================================================ --> |
| |
| <path id="classpath"> |
| <fileset dir="${lib.dir}"> |
| <include name="*.jar"/> |
| </fileset> |
| <fileset dir="${build.webapp}/WEB-INF/lib"> |
| <include name="*.jar"/> |
| </fileset> |
| <!--<pathelement path="${java.class.path}/"/>--> |
| </path> |
| |
| |
| <!-- ============================================================ --> |
| <!-- Targets --> |
| <!-- ============================================================ --> |
| |
| <!-- ============================================================ --> |
| <!-- Initialization target --> |
| <!-- ============================================================ --> |
| <target name="init"> |
| <tstamp> |
| <format property="SNAPSHOT_STAMP" pattern="yyyyMMddhhmmss"/> |
| </tstamp> |
| |
| <property name="fullname" value="Wyona CMS"/> |
| <property name="Name" value="Wyona:CMS"/> |
| <property name="name" value="wyona:cms"/> |
| <property name="version" value="2.1-dev"/> |
| <property name="short.version" value="2.1"/> |
| <property name="release" value="1th"/> |
| <property name="year" value="1999-2002"/> |
| |
| <echo message="------------------- ${fullname} ${version} [${year}] ----------------"/> |
| <echo>Building with ${ant.version} using build file ${ant.file}</echo> |
| |
| <property name="debug" value="on"/> |
| <property name="optimize" value="off"/> |
| <property name="deprecation" value="off"/> |
| <property name="nowarn" value="on"/> |
| <property name="build.compiler" value="classic"/> |
| <property name="target.vm" value="1.2"/> |
| |
| <property name="packages" value="org.wyona.*,org.w3c.*,ch.ethz.*,ch.unizh.*"/> |
| <property name="resource.dir" value="${src.webapp.dir}/resources/css"/> |
| |
| <property name="today" value="${TODAY}"/> |
| <echo message="Today is ${today}"/> |
| <property name="snapshot.bin.dir" value="${dist.root}/${fullname}-bin-${SNAPSHOT_STAMP}"/> |
| <property name="snapshot.src.dir" value="${dist.root}/${fullname}-src-${SNAPSHOT_STAMP}"/> |
| |
| <available file="${tools.jar}" property="tools.jar.present"/> |
| </target> |
| |
| <!-- ============================================================ --> |
| <!-- Check the tools.jar existance --> |
| <!-- =============================================================--> |
| <target name="check-tools-lib" unless="tools.jar.present" depends="init"> |
| <!-- NOTE: java.home is normally set by the JVM to the /jre directory --> |
| <echo message="-------------------------------------------------------------"/> |
| <echo message="Couldn't find the tools.jar."/> |
| <echo message=" Make sure to copy the tools.jar from your"/> |
| <echo message=" $$JAVA_HOME/lib directory to the"/> |
| <echo message=" ${build.webapp}/WEB-INF/lib/javac.jar"/> |
| <echo message=" directory prior to build/install the webapp/war file(s)"/> |
| <echo message="-------------------------------------------------------------"/> |
| </target> |
| |
| <!-- ============================================================ --> |
| <!-- Copies the tools.jar to javac.jar in web-inf/lib --> |
| <!-- =============================================================--> |
| <target name="prepare-tools-lib" if="tools.jar.present" depends="init"> |
| <!-- NOTE: java.home is normally set by the JVM to the /jre directory --> |
| <copy file="${tools.jar}" tofile="${build.webapp}/WEB-INF/lib/javac.jar"/> |
| </target> |
| |
| <!-- ============================================================ --> |
| <!-- Prepares the build webapp directory --> |
| <!-- ============================================================ --> |
| <target name="prepare-cocoon" depends="init,check-tools-lib,prepare-tools-lib"> |
| <echo>INFO: exclude: sitemap.xmap</echo> |
| <echo>INFO: exclude: WEB-INF/cocoon.xconf</echo> |
| <echo>INFO: exclude: WEB-INF/lib/lucene-1.2-rc2.jar</echo> |
| <echo>INFO: exclude: **/javac.jar</echo> |
| <copy todir="${build.webapp}" filtering="off"> |
| <fileset dir="${src.cocoon.dir}"> |
| <exclude name="sitemap.xmap"/> |
| <exclude name="WEB-INF/cocoon.xconf"/> |
| <exclude name="WEB-INF/lib/lucene-1.2-rc2.jar"/> |
| <!--<exclude name="**/logkit.xconf"/>--> |
| <exclude name="**/javac.jar"/> |
| </fileset> |
| </copy> |
| <!-- patch lucene --> |
| <echo message="INFO: Patch Lucene"/> |
| <copy todir="${build.webapp}" filtering="off"> |
| <fileset dir="${src.webapp.dir}"> |
| <include name="WEB-INF/lib/lucene-1.3-dev1.jar"/> |
| </fileset> |
| </copy> |
| </target> |
| |
| <!-- ============================================================ --> |
| <!-- copy the bulk of the cocoon webapp to our destination --> |
| <!-- ============================================================ --> |
| <target name="prepare" depends="prepare-cocoon"> |
| <mkdir dir="${build.dir}"/> |
| <mkdir dir="${build.webapp}"/> |
| </target> |
| |
| <!-- ============================================================ --> |
| <!-- Prepares the source code --> |
| <!-- ============================================================ --> |
| <target name="prepare-src" depends="prepare"> |
| <copy todir="${build.src}" filtering="on"> |
| <fileset dir="${java.dir}"> |
| </fileset> |
| </copy> |
| </target> |
| |
| <!-- ============================================================ --> |
| <!-- The main compilation target --> |
| <!-- ============================================================ --> |
| <target name="compile" depends="prepare-src" |
| description="Compile the sources"> |
| <mkdir dir="${build.dest}"/> |
| <javac srcdir="${build.src}" |
| destdir="${build.dest}" |
| debug="${debug}" |
| optimize="${optimize}" |
| deprecation="${deprecation}" |
| target="${target.vm}" |
| nowarn="${nowarn}"> |
| <classpath refid="classpath"/> |
| </javac> |
| </target> |
| |
| <!-- ============================================================ --> |
| <!-- Set a variable if javadoc is already up-to-date. --> |
| <!-- ============================================================ --> |
| <target name="javadocs_check"> |
| <uptodate property="javadocs.notrequired" targetfile="${dist.bin.javadocs}/packages.html" > |
| <srcfiles dir="${build.src}" includes="**/*.java"/> |
| </uptodate> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- If javadoc is already up-to-date, print a message saying so. --> |
| <!-- =================================================================== --> |
| <target name="javadocs_done" if="javadocs.notrequired"> |
| <echo message="-------------------------------------------------------------"/> |
| <echo message=" Not rebuilding Javadocs, as they are up-to-date:"/> |
| <echo message=" ${dist.bin.javadocs}/packages.html is more recent than"/> |
| <echo message=" ${build.src}/**/*.java"/> |
| <echo message="-------------------------------------------------------------"/> |
| </target> |
| |
| <!-- ============================================================ --> |
| <!-- Creates the API documentation --> |
| <!-- ============================================================ --> |
| <target name="javadocs" depends="prepare-src, javadocs_check, javadocs_done" |
| unless="javadocs.notrequired" |
| description="Generates the API documentation"> |
| <mkdir dir="${dist.bin.javadocs}"/> |
| <javadoc packagenames="${packages}" |
| sourcepath="${build.src}" |
| destdir="${dist.bin.javadocs}" |
| author="true" |
| version="true" |
| use="false" |
| noindex="true" |
| windowtitle="${Name} API - Version ${version}" |
| doctitle="${Name}" |
| bottom="Copyright © ${year} Wyona. All Rights Reserved." |
| stylesheetfile="${resource.dir}/javadoc.css"> |
| <classpath refid="classpath"/> |
| </javadoc> |
| </target> |
| |
| <!-- ============================================================ --> |
| <!-- Produce the webapp --> |
| <!-- ============================================================ --> |
| |
| <!-- |
| 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,javadocs" --> |
| <!-- description="Builds the webapp directory ready to be linked into a servlet engines context directory"> --> |
| <target name="webapp" depends="compile,javadocs" |
| description="Builds the webapp directory ready to be linked into a servlet engines context directory"> |
| |
| <!-- |
| overwrite some parts of the previously unpacked |
| cocoon webapp package with our customized files |
| --> |
| <copy todir="${build.webapp}"> |
| <fileset dir="${src.webapp.dir}"> |
| <include name="**/*"/> |
| </fileset> |
| </copy> |
| <echo>INFO: src.webapp.dir=${src.webapp.dir}</echo> |
| <echo>INFO: build.src=${build.src}</echo> |
| <echo>INFO: build.webapp=${build.webapp}</echo> |
| <echo>INFO: build.dest=${build.dest}</echo> |
| |
| <!-- create directory classes within webapp --> |
| <mkdir dir="${build.webapp}/WEB-INF/classes"/> |
| |
| <!-- now copy our compiled classes --> |
| <copy todir="${build.webapp}/WEB-INF/classes"> |
| <fileset dir="${build.dest}"> |
| <include name="**/*"/> |
| </fileset> |
| </copy> |
| |
| <!-- now copy our logicsheets --> |
| <copy todir="${build.webapp}/WEB-INF/classes"> |
| <fileset dir="${build.src}"> |
| <include name="**/*.xsl"/> |
| </fileset> |
| </copy> |
| |
| <!-- now copy our properties --> |
| <copy todir="${build.webapp}/WEB-INF/classes"> |
| <fileset dir="${build.src}"> |
| <include name="**/*.properties"/> |
| </fileset> |
| </copy> |
| |
| <!-- now copy any additional libraries in ./lib --> |
| <mkdir dir="${build.webapp}/WEB-INF/lib"/> |
| |
| <echo>INFO: exclude: servlet.jar</echo> |
| <copy todir="${build.webapp}/WEB-INF/lib"> |
| <fileset dir="${lib.dir}"> |
| <include name="**/*"/> |
| <!-- servlet.jar is used to build Wyona, but for deployment the servlet.jar from the servlet engine will be taken --> |
| <exclude name="servlet.jar"/> |
| </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, javadocs" description="Builds the deployable war file"> |
| <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="prepare-dist" depends="distclean,war"> |
| |
| <copy todir="${dist.root}/${fullname}"> |
| <fileset dir="${basedir}"> |
| <include name="INSTALL*"/> |
| <include name="README"/> |
| </fileset> |
| </copy> |
| |
| </target> |
| |
| <target name="dist" depends="prepare-dist" description="Build a regular binary distribution tar ball"> |
| |
| <tar tarfile="${dist.bin.dir}.tar" basedir="${dist.root}" includes="${fullname}/**"/> |
| |
| <gzip zipfile="${dist.bin.dir}.tar.gz" src="${dist.bin.dir}.tar"/> |
| <delete file="${dist.bin.dir}.tar"/> |
| |
| </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="snapshot" depends="prepare-dist" description="Build a snapshot binary distribution tar ball"> |
| |
| <copy todir="${snapshot.bin.dir}"> |
| <fileset dir="${dist.root}/${fullname}"/> |
| </copy> |
| |
| <tar tarfile="${snapshot.bin.dir}.tar" basedir="${dist.root}" includes="${fullname}-bin-${SNAPSHOT_STAMP}/**"/> |
| |
| <gzip zipfile="${snapshot.bin.dir}.tar.gz" src="${snapshot.bin.dir}.tar"/> |
| <delete file="${snapshot.bin.dir}.tar"/> |
| |
| <zip zipfile="${snapshot.bin.dir}.zip" basedir="${dist.root}/${fullname}-bin-${SNAPSHOT_STAMP}"/> |
| |
| </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="prepare-dist-src" depends="distclean"> |
| |
| <mkdir dir="${dist.src.dir}"/> |
| |
| <copy todir="${dist.src.dir}"> |
| <fileset dir="."> |
| <include name="README"/> |
| <include name="INSTALL*"/> |
| <include name="build.properties.sample"/> |
| <include name="src/**"/> |
| <include name="${lib.dir}/**"/> |
| <include name="build.xml"/> |
| </fileset> |
| </copy> |
| |
| </target> |
| |
| <target name="dist-src" depends="prepare-dist-src" description="Builds a regular tar ball containing the sources for developers"> |
| |
| <tar tarfile="${dist.src.dir}.tar" basedir="${dist.root}" includes="${fullname}-src/**"/> |
| |
| <gzip zipfile="${dist.src.dir}.tar.gz" src="${dist.src.dir}.tar"/> |
| <delete file="${dist.src.dir}.tar"/> |
| |
| </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="snapshot-src" depends="prepare-dist-src" description="Builds a snapshot tar ball containing the sources for developers"> |
| |
| <copy todir="${snapshot.src.dir}"> |
| <fileset dir="${dist.src.dir}"/> |
| </copy> |
| |
| <tar tarfile="${snapshot.src.dir}.tar" basedir="${dist.root}" includes="${fullname}-src-${SNAPSHOT_STAMP}/**"/> |
| |
| <gzip zipfile="${snapshot.src.dir}.tar.gz" src="${snapshot.src.dir}.tar"/> |
| <delete file="${snapshot.src.dir}.tar"/> |
| |
| </target> |
| |
| <!-- ============================================================ --> |
| <!-- Install webapp --> |
| <!-- ============================================================ --> |
| <target name="install" depends="webapp" description="Install the webapp into servlet engine context"> |
| <copy todir="${install.dir}" filtering="off"> |
| <fileset dir="${build.webapp}" excludes="${target.install.excludes}"> |
| <!-- |
| <exclude name="**/authoring/**"/> |
| <exclude name="**/live/**"/> |
| --> |
| </fileset> |
| </copy> |
| <echo>INFO: Copy From build.webapp=${build.webapp} To install.dir=${install.dir}</echo> |
| </target> |
| |
| <!-- ============================================================ --> |
| <!-- Clean targets --> |
| <!-- ============================================================ --> |
| <target name="clean" depends="init" description="Cleans the build directories"> |
| <delete dir="${build.dir}"/> |
| </target> |
| |
| <target name="distclean" depends="clean" description="Cleans everything to the original state"> |
| <delete dir="${build.root}"/> |
| <delete dir="${dist.root}"/> |
| </target> |
| |
| <target name="reset" depends="clean" description="Resets the deployment by also cleaning the servlet engine context"> |
| <!-- Empty server cache - this directory is set in the "build.properties" file --> |
| <delete dir="${cache.dir}"/> |
| <delete includeEmptyDirs="true"> |
| <fileset dir="${install.dir}" excludes="${target.reset.excludes}"> |
| <!-- |
| <fileset dir="${install.dir}" excludes="**/authoring/**,**/live/**"> |
| --> |
| <!-- |
| <exclude name="**/authoring/**"/> |
| <exclude name="**/live/**"/> |
| --> |
| </fileset> |
| </delete> |
| </target> |
| |
| </project> |