blob: 1844e6d5047dc093d4465fc8408278275733a739 [file] [log] [blame]
<?xml version="1.0"?>
<project name="webapp">
<description>
Webapp targets
</description>
<target name="prepare-webapp" depends="blocks, package">
<mkdir dir="${build.webapp}"/>
<copy file="${webapp}/welcome.xml" tofile="${build.webapp}/welcome.xml" filtering="on"/>
<copy file="${webapp}/not-found.xml" tofile="${build.webapp}/not-found.xml" filtering="on"/>
<copy file="${webapp}/welcome.xslt" tofile="${build.webapp}/welcome.xslt" filtering="on"/>
<copy file="${webapp}/sitemap.xmap" tofile="${build.webapp}/sitemap.xmap"/>
<copy todir="${build.webapp}/stylesheets" filtering="on">
<fileset dir="${webapp}/stylesheets">
<include name="**/*.xslt"/>
</fileset>
</copy>
<copy todir="${build.webapp}/resources" filtering="off">
<fileset dir="${webapp}/resources"/>
</copy>
<copy todir="${build.webapp}/WEB-INF" filtering="on">
<fileset dir="${webapp}/WEB-INF">
<include name="entities/**"/>
<include name="classes/**"/>
<include name="*.x*"/>
</fileset>
</copy>
<copy file="${build}/${name}.jar" tofile="${build.webapp.lib}/${name}-${version}.jar"/>
<copy todir="${build.webapp.lib}">
<fileset dir="${lib}/endorsed">
<include name="*.jar"/>
<exclude name="servlet*.jar"/>
</fileset>
<fileset dir="${lib.core}">
<include name="*.jar"/>
<exclude name="servlet*.jar"/>
</fileset>
<!-- Currently, we have no JVM dependent libraries
<fileset dir="${lib.core}/jvm${target.vm}">
<include name="*.jar"/>
</fileset>
-->
<fileset dir="${lib.optional}">
<include name="*.jar"/>
<exclude name="servlet*.jar"/>
</fileset>
<fileset dir="${lib.local}">
<include name="*.jar"/>
<exclude name="servlet*.jar"/>
</fileset>
</copy>
<copy todir="${build.webapp.lib}">
<fileset dir="${build.blocks}">
<include name="*-block.jar"/>
</fileset>
<mapper type="glob" from="*-block.jar" to="cocoon-*-block.jar"/>
</copy>
<ant antfile="${build.temp}/blocks-build.xml"
inheritAll="true"
inheritRefs="false"
target="lib"/>
<ant antfile="${build.temp}/blocks-build.xml"
inheritAll="true"
inheritRefs="false"
target="patch-conf"/>
</target>
<target name="prepare-webapp-samples" depends="prepare-webapp, samples, block-samples" unless="unless.exclude.webapp.samples"/>
<target name="prepare-webapp-deprecated" depends="prepare-webapp" unless="unless.exclude.deprecated">
<copy file="${build}/${name}-deprecated.jar" tofile="${build.webapp.lib}/${name}-${version}-deprecated.jar"/>
<xpatch file="${build.webapp}/WEB-INF/cocoon.xconf"
srcdir="${deprecated.conf}"
includes="**/*.xconf"
addComments="true"/>
</target>
<target name="prepare-webapp-javadocs" depends="javadocs" unless="unless.exclude.webapp.javadocs">
<mkdir dir="${build.webapp.javadocs}"/>
<copy todir="${build.webapp.javadocs}" filtering="off">
<fileset dir="${build.javadocs}"/>
</copy>
<!-- patch the welcome page to tell we have javadocs to show -->
<xpatch file="${build.webapp}/welcome.xml"
srcdir="${resources.javadoc}"
includes="**/*.xwelcome"/>
</target>
<target name="prepare-webapp-docs" depends="validate-xdocs,validate-jars" unless="unless.exclude.webapp.documentation">
<mkdir dir="${build.webapp.docs}"/>
<copy todir="${build.webapp.docs}" filtering="on">
<fileset dir="${documentation}">
<exclude name="**/*.jpg"/>
<exclude name="**/*.gif"/>
<exclude name="**/*.png"/>
<exclude name="*.xwelcome"/>
</fileset>
</copy>
<!-- Add some other documents -->
<copy file="status.xml"
tofile="${build.webapp.docs}/xdocs/status.xml" filtering="on"/>
<!-- Copy the docs about all jar files (this requires a dependency to validate-jars) -->
<copy file="${build.temp}/jars.xml"
tofile="${build.webapp.docs}/xdocs/installing/jars.xml"
filtering="off" failonerror="false" overwrite="true"/>
<!-- Forrest needs its own file at src/documentation/sitemap.xmap, so we
overwrite it with the old Cocoon-specific sitemap here -->
<copy file="${documentation}/sitemap-localdocs.xmap"
tofile="${build.webapp.docs}/sitemap.xmap" overwrite="true"/>
<copy todir="${build.webapp.docs}" filtering="off">
<fileset dir="${documentation}">
<include name="**/*.jpg"/>
<include name="**/*.gif"/>
<include name="**/*.png"/>
</fileset>
</copy>
<!-- patch the welcome page to tell we have documentation to show -->
<xpatch file="${build.webapp}/welcome.xml"
srcdir="${documentation}"
includes="**/*.xwelcome"/>
</target>
<target name="webapp" depends="prepare-webapp,prepare-webapp-samples,prepare-webapp-docs,prepare-webapp-javadocs,prepare-webapp-deprecated,validate-jars,validate-config,custom-conf" description="Builds web application folder">
</target>
<target name="war" depends="webapp" description="Builds web application archive">
<!-- A task to create manifest for webapp. -->
<taskdef name="manifest" classname="ManifestToolTask" classpath="${tools.tasks.dest}"/>
<!-- Create WAR manifest -->
<manifest directory="${build.webapp.lib}" manifest="${build.webapp}/WEB-INF/Manifest.mf"/>
<!-- Package WAR file -->
<jar jarfile="${build.war}" manifest="${build.webapp}/WEB-INF/Manifest.mf" index="true">
<fileset dir="${build.webapp}"/>
</jar>
</target>
<target name="custom-conf" depends="init-tasks" description="Uses Cocoon's xpatch task to customize runtime configuration">
<xpatch file="${build.webapp}/sitemap.xmap" srcdir="">
<include name="${customconf}/*.xmap" />
<include name="${customconf}/*.xpipe" />
</xpatch>
<xpatch file="${build.webapp}/WEB-INF/cocoon.xconf" srcdir="" addComments="true">
<include name="${customconf}/*.xconf" />
</xpatch>
<xpatch file="${build.webapp}/WEB-INF/logkit.xconf" srcdir="">
<include name="${customconf}/*.xlog" />
</xpatch>
<xpatch file="${build.webapp}/WEB-INF/web.xml" srcdir="">
<include name="${customconf}/*.xweb" />
</xpatch>
</target>
</project>