| <!-- ============================================================ --> |
| <!-- Initialization target --> |
| <!-- ============================================================ --> |
| <target name="init"> |
| <tstamp> |
| <format property="SNAPSHOT_STAMP" pattern="yyyyMMddhhmmss"/> |
| </tstamp> |
| |
| <property name="fullname" value="Apache Lenya CMS"/> |
| <property name="Name" value="Apache Lenya"/> |
| <property name="name" value="lenya:cms"/> |
| <property name="version" value="1.2"/> |
| <property name="short.version" value="1.2"/> |
| <property name="release" value="1th"/> |
| <property name="year" value="1999-2004"/> |
| |
| <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="modern"/> |
| <property name="target.vm" value="1.4"/> |
| |
| <property name="packages" value="*.*"/> |
| <property name="resource.dir" value="${src.webapp.dir}/resources/css"/> |
| |
| <property name="today" value="${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> |
| |
| <target name="build-custom-tasks" depends="init"> |
| <echo>INFO: Building Custom Tasks</echo> |
| |
| <mkdir dir="build/tools/anttasks"/> |
| <javac srcdir="src/java" |
| destdir="build/tools/anttasks" |
| debug="${debug}" |
| optimize="{optimize}" |
| deprecation="${deprecation}" |
| target="${target.vm}" |
| nowarn="${nowarn}" |
| includes="org/apache/lenya/cms/ant/**" |
| classpathref="classpath" |
| source="1.4"/> |
| |
| <taskdef name="copyJavaSources" classpath="build/tools/anttasks" classname="org.apache.lenya.cms.ant.CopyJavaSourcesTask"/> |
| <taskdef name="copyPubs" classpath="build/tools/anttasks" classname="org.apache.lenya.cms.ant.CopyTask"/> |
| <taskdef name="xpatch" classname="XConfToolTask" classpath="${tools.tasks.dest}"/> |
| </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/logkit.xconf</echo> |
| <echo>INFO: exclude: WEB-INF/web.xml</echo> |
| <echo>INFO: exclude: WEB-INF/lib/lucene**.jar</echo> |
| <echo>INFO: exclude: **/javac.jar</echo> |
| <copy todir="${build.webapp}" filtering="off"> |
| <fileset dir="${cocoon.webapp.dir}"> |
| <exclude name="sitemap.xmap"/> |
| <exclude name="WEB-INF/cocoon.xconf"/> |
| <exclude name="WEB-INF/logkit.xconf"/> |
| <exclude name="WEB-INF/web.xml"/> |
| <exclude name="WEB-INF/lib/lucene**.jar"/> |
| <exclude name="**/javac.jar"/> |
| </fileset> |
| </copy> |
| <!-- FIXME: 2.1.2 does not include jing-20030619.jar --> |
| <!-- |
| <copy todir="${build.webapp}/WEB-INF/lib"> |
| <fileset dir="../cocoon-2.1/tools/lib"> |
| <include name="jing-20030619.jar"/> |
| </fileset> |
| </copy> |
| --> |
| |
| <!-- copy forrest and default libraries --> |
| <!-- FIXME: shouldn't be publication specific --> |
| <echo>Copy forrest libraries</echo> |
| <copy todir="${build.webapp}/WEB-INF/lib" filtering="off"> |
| <fileset dir="src/webapp/lenya/pubs/docs-new/WEB-INF/lib"/> |
| </copy> |
| |
| <!-- patch cocoon.xconf --> |
| <echo>INFO: patching cocoon.xconf with XSLT stylesheet</echo> |
| <xslt |
| in="${cocoon.webapp.dir}/WEB-INF/cocoon.xconf" |
| out="${build.webapp}/WEB-INF/cocoon.xconf" |
| style="${src.webapp.dir}/WEB-INF/cocoon-xconf.xsl" |
| > |
| <param name="forrest-publication" expression="/lenya/pubs/docs-new"/> |
| <param name="hsqldb-server-port" expression="${hsqldb-server.port}"/> |
| <outputproperty name="indent" value="yes"/> |
| </xslt> |
| |
| <!-- patch logkit.xconf --> |
| <echo>INFO: patching logkit.xconf with XSLT stylesheet</echo> |
| <xslt |
| in="${cocoon.webapp.dir}/WEB-INF/logkit.xconf" |
| out="${build.webapp}/WEB-INF/logkit.xconf" |
| style="${src.webapp.dir}/WEB-INF/logkit-xconf.xsl" |
| > |
| <outputproperty name="indent" value="yes"/> |
| </xslt> |
| |
| <!-- patch web.xml --> |
| <echo>INFO: patching web.xml with XSLT stylesheet</echo> |
| <xslt |
| in="${cocoon.webapp.dir}/WEB-INF/web.xml" |
| out="${build.webapp}/WEB-INF/web.xml" |
| style="${src.webapp.dir}/WEB-INF/web-xml.xsl" |
| force="false" |
| > |
| <param name="enableUploads" expression="${enable.uploads}"/> |
| <xmlcatalog> |
| <dtd |
| publicId="-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" |
| location="${src.webapp.dir}/WEB-INF/entities/web-app_2_2.dtd"/> |
| </xmlcatalog> |
| <outputproperty name="indent" value="yes"/> |
| </xslt> |
| |
| <!-- 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.jar"/> |
| </fileset> |
| </copy> |
| |
| <!-- Copy Entities |
| <echo>INFO: Copy publication-specific entities to Cocoon catalog</echo> |
| <copyJavaSources pubsrootdirs="${pubs.root.dirs}" javadir="${src.entities.dir}" builddir="${build.webapp}/${build.entities.dir}" /> |
| --> |
| </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, build-custom-tasks"> |
| |
| <echo>INFO: Create log4j.properties (${build.src}/log4j.properties)</echo> |
| <!-- using stylesheet as input file so we don't need a dummy xml --> |
| <xslt |
| in="${java.dir}/log4j-properties.xsl" |
| out="${build.src}/log4j.properties" |
| style="${java.dir}/log4j-properties.xsl" |
| force="false" |
| > |
| <param name="log4j-rollingFileAppender" expression="${enable.log4j}"/> |
| <param name="webapp-directory" expression="${tomcat.home.dir}/${tomcat.webapps.dir}"/> |
| <outputproperty name="indent" value="yes"/> |
| </xslt> |
| |
| <echo>INFO: Copy java source files from ${java.dir} to ${build.src}</echo> |
| <copy todir="${build.src}" filtering="on"> |
| <fileset dir="${java.dir}"> |
| <exclude name="log4j-properties.xsl"/> |
| </fileset> |
| </copy> |
| |
| <echo>INFO: Copy java source files from ${pubs.root.dirs} to ${build.src}</echo> |
| <copyJavaSources pubsrootdirs="${pubs.root.dirs}" javadir="java/src" builddir="${build.src}" /> |
| </target> |