blob: e93d4192d317b2a4fe4c2278f8b1ebd00dfedc03 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Id$ -->
<project name="lenya-init">
<description>
Initialization Targets
</description>
<!-- Initialization target -->
<target name="init" depends="init-tasks">
<tstamp>
<format property="SNAPSHOT_STAMP" pattern="yyyyMMddhhmmss"/>
</tstamp>
<echo message="------------------- ${Name} ${version} [${year}] ----------------"/>
<echo>Building with ${ant.version} and Java version ${ant.java.version}</echo>
<echo>Using build file ${ant.file}</echo>
<condition property="java.version.equal.target.vm">
<equals arg1="${target.vm}" arg2="${ant.java.version}"/>
</condition>
<antcall target="warning-re-java-version"/>
<property name="snapshot.bin.name" value="${fullname}-${SNAPSHOT_STAMP}-bin"/>
<property name="snapshot.src.name" value="${fullname}-${SNAPSHOT_STAMP}-src"/>
<property name="snapshot.bin.dir" value="${dist.root}/${snapshot.bin.name}"/>
<property name="snapshot.src.dir" value="${dist.root}/${snapshot.src.name}"/>
</target>
<target name="warning-re-java-version" unless="java.version.equal.target.vm">
<echo message="*****************************************************************"/>
<echo message="*"/>
<echo message="* WARNING: Apache Lenya ${version} is targeted for Java version ${target.vm}. Please refer to the public mailing list for other Java version."/>
<echo message="*"/>
<echo message="*****************************************************************"/>
<!--
<fail message="Build process will be aborted!"/>
-->
</target>
<!-- Prepare the build webapp directory -->
<target name="check-cocoon" depends="init" unless="gump.skipcocoonbuild">
<available file="${cocoon.src.dir}/build/webapp" type="dir" property="cocoon.build.webapp.dir.exists"/>
<antcall target="check-blocks-properties"/>
<antcall target="check-build-properties"/>
<antcall target="build-cocoon"/>
</target>
<!-- Build Cocoon with our properties -->
<target name="build-cocoon" unless="cocoon.build.webapp.dir.exists">
<copy todir="${cocoon.src.dir}" filtering="off">
<fileset dir="${src.cocoon.properties.dir}"/>
</copy>
<ant dir="${cocoon.src.dir}" inheritall="false"/>
</target>
<!-- Check local.blocks.properties -->
<target name="check-blocks-properties" if="cocoon.build.webapp.dir.exists">
<property file="${cocoon.src.dir}/local.blocks.properties"/>
<condition property="local.blocks.properties.in.sync">
<equals arg1="${lenya.blocks.properties.version}" arg2="426603"/>
</condition>
<fail unless="local.blocks.properties.in.sync" message="It seems that your ${cocoon.src.dir}/local.blocks.properties is NOT in sync with ${src.cocoon.properties.dir}/local.blocks.properties! The file ${src.cocoon.properties.dir}/local.blocks.properties has probably been modified by some Apache Lenya developer. Issue a 'build clean-all' and rebuild Lenya."/>
</target>
<!-- Check local.build.properties -->
<target name="check-build-properties" if="cocoon.build.webapp.dir.exists">
<property file="${cocoon.src.dir}/local.build.properties"/>
<condition property="local.build.properties.in.sync">
<equals arg1="${lenya.build.properties.version}" arg2="529161"/>
</condition>
<fail unless="local.build.properties.in.sync" message="It seems that your ${cocoon.src.dir}/local.build.properties is NOT in sync with ${src.cocoon.properties.dir}/local.build.properties! The file ${src.cocoon.properties.dir}/local.build.properties has probably been modified by some Apache Lenya developer. Issue a 'build clean-all' and rebuild Lenya."/>
</target>
<!-- Copy the bulk of the cocoon webapp to our destination -->
<target name="prepare-cocoon" depends="check-cocoon" unless="gump.skipcocoonbuild">
<copy todir="${build.webapp}" filtering="off">
<fileset dir="${cocoon.webapp.dir}">
<exclude name="resources/**"/>
<exclude name="stylesheets**"/>
<exclude name="*.xml"/>
<exclude name="*.xslt"/>
<exclude name="test-suite/**"/>
<exclude name="legal/**"/>
<exclude name="WEB-INF/db/**"/>
<exclude name="WEB-INF/xconf/**"/>
<!-- exclude the geronimo libraries, see http://issues.apache.org/bugzilla/show_bug.cgi?id=38587 -->
<exclude name="WEB-INF/lib/geronimo-*.jar"/>
<exclude name="**/javac.jar"/>
</fileset>
</copy>
<!-- patch logkit.xconf -->
<xpatch file="${build.webapp}/WEB-INF/logkit.xconf"
includes="src/confpatch/logkit-*.xconf"/>
<!-- patch log4j.xconf -->
<xpatch file="${build.webapp}/WEB-INF/log4j.xconf"
includes="src/confpatch/log4j-*.xconf"/>
<!-- patch web.xml -->
<echo>PATCH web.xml</echo>
<xpatch file="${build.webapp}/WEB-INF/web.xml"
includes="src/confpatch/*.xweb"/>
<!-- Copy Entities
<copyJavaSources pubsrootdirs="${pubs.root.dirs}" javadir="${src.entities.dir}" builddir="${build.webapp}/${build.entities.dir}" />
-->
</target>
<target name="prepare" depends="prepare-cocoon">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.webapp}"/>
</target>
<!-- Copy publication source code and libraries to ${build.java.src} -->
<target name="prepare-src" depends="prepare">
<!-- FIXME: Use bulkCopy task in the future; needs regexp mapper which is part of ant optional package. -->
<!-- Copy java source files from ${pubs.root.dirs} to ${build.java.src} -->
<copyJavaSources pubsrootdirs="${pubs.root.dirs}" javadir="java/src" builddir="${build.dir}/java/pubs" />
<mkdir dir="${build.dir}/lib"/>
<!-- Copy publication specific libraries from ${pubs.root.dirs} (java/lib) to ${build.webapp}/WEB-INF/lib -->
<bulkCopy
sourcedirs="${pubs.root.dirs}"
todir="${build.webapp}/WEB-INF/lib"
flatten="true">
<fileset includes="*/java/lib/*"/> <!-- if a directory with more than one publication is being specified, e.g. pubs -->
<fileset includes="java/lib/*"/> <!-- if only a specific publication is being specified, e.g. pubs/blog -->
</bulkCopy>
<bulkCopy
sourcedirs="${pubs.root.dirs}"
todir="${build.dir}/lib"
flatten="true">
<fileset includes="*/java/lib/*"/> <!-- if a directory with more than one publication is being specified, e.g. pubs -->
<fileset includes="java/lib/*"/> <!-- if only a specific publication is being specified, e.g. pubs/blog -->
</bulkCopy>
<bulkCopy
sourcedirs="${modules.root.dirs}"
todir="${build.webapp}/WEB-INF/lib"
flatten="true">
<fileset includes="*/java/lib/*"/> <!-- if a directory with more than one publication is being specified, e.g. pubs -->
<fileset includes="java/lib/*"/> <!-- if only a specific publication is being specified, e.g. pubs/blog -->
</bulkCopy>
<bulkCopy
sourcedirs="${modules.root.dirs}"
todir="${build.dir}/lib"
flatten="true">
<fileset includes="*/java/lib/*"/> <!-- if a directory with more than one publication is being specified, e.g. pubs -->
<fileset includes="java/lib/*"/> <!-- if only a specific publication is being specified, e.g. pubs/blog -->
</bulkCopy>
</target>
</project>