blob: 5e39bed82abea0cfd5c4c795ec925d4ef2f7686c [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.
-->
<!--
Precompilation of JSPs is strongly recommended.
This build file demonstrates how to precompile JSPs using jasper, but
since precompilation is inherently non-portable, it is not enabled
by default. To precompile using the jasper compiler (available with
Tomcat) search for the string JASPER-HOWTO in this build file
and carry out the necessary modifications.
If you're not using Tomcat, you will have to author similar targets
for the JSP compiler in the servlet container you are using.
-->
<!-- Define and use the common.xml ant build file for building
your taglib -->
<!DOCTYPE project [
<!ENTITY common SYSTEM "../common.xml">
]>
<!-- Your main ant build declaration -->
<project name="rdc" default="main">
<!-- load custom properties that minimally define:
servlet24.jar jsp-api.jar
jstl.jar standard.jar struts12.jar
commons-digester.jar commons-beanutils.jar
commons-el.jar commons-logging.jar commons-scxml.jar
-->
<property file="../build.properties"/>
<property name="classpath"
value="${servlet24.jar}:${jsp-api.jar}:${jstl.jar}:${standard.jar}:
${commons-digester.jar}:${commons-el.jar}:${commons-beanutils.jar}:
${commons-logging.jar}:${commons-scxml.jar}:${struts12.jar}" />
<property name="checkRequirements.pre" value="checkRequirements.pre"/>
<target name="checkRequirements.pre">
<antcall target="checkRequiredFile">
<param name="file" value="${servlet24.jar}"/>
<param name="fail.message" value="I could not find servlet24.jar"/>
</antcall>
<antcall target="checkRequiredFile">
<param name="file" value="${jsp-api.jar}"/>
<param name="fail.message" value="I could not find jsp-api.jar"/>
</antcall>
<antcall target="checkRequiredFile">
<param name="file" value="${standard.jar}"/>
<param name="fail.message" value="I could not find standard.jar"/>
</antcall>
<antcall target="checkRequiredFile">
<param name="file" value="${jstl.jar}"/>
<param name="fail.message" value="I could not find jstl.jar"/>
</antcall>
<antcall target="checkRequiredFile">
<param name="file" value="${commons-beanutils.jar}"/>
<param name="fail.message" value="I could not find commons-beanutils.jar"/>
</antcall>
<antcall target="checkRequiredFile">
<param name="file" value="${commons-el.jar}"/>
<param name="fail.message" value="I could not find commons-el.jar"/>
</antcall>
<antcall target="checkRequiredFile">
<param name="file" value="${commons-digester.jar}"/>
<param name="fail.message" value="I could not find commons-digester.jar"/>
</antcall>
<antcall target="checkRequiredFile">
<param name="file" value="${commons-scxml.jar}"/>
<param name="fail.message" value="I could not find commons-scxml.jar"/>
</antcall>
<antcall target="checkRequiredFile">
<param name="file" value="${struts12.jar}"/>
<param name="fail.message" value="I could not find struts12.jar"/>
</antcall>
<antcall target="checkRequiredFile">
<param name="file" value="${commons-logging.jar}"/>
<param name="fail.message" value="I could not find commons-logging.jar"/>
</antcall>
<!-- JASPER-HOWTO : Uncomment the jasper library checks -->
<!--
<antcall target="checkRequiredFile">
<param name="file" value="${jasper-compiler.jar}"/>
<param name="fail.message" value="I could not find jasper-compiler.jar"/>
</antcall>
<antcall target="checkRequiredFile">
<param name="file" value="${jasper-runtime.jar}"/>
<param name="fail.message" value="I could not find jasper-runtime.jar"/>
</antcall>
-->
</target>
<!-- we exclude the sampleapps packages from the taglib jar -->
<property name="library.src.excludes"
value="org/apache/taglibs/rdc/sampleapps/**"/>
<!-- then follow it up by building a sampleapps jar
to be included in the examples war file, using the
library-dist.post hook for building the sampleapps jar -->
<property name="build.sampleapps"
value="${build.dir}/rdc/rdc-sampleapps"/>
<!-- since our examples produce vxml
we reconfigure the examples->html generation with a custom pre-->
<!-- first turn off the default target -->
<property name="disable.examples.html" value="true"/>
<property name="examples.web" value="../rdc/examples/web"/>
<property name="examples.pre" value="examples.pre"/>
<target name="examples.pre">
<mkdir dir="${build.examples}/config"/>
<copy toDir="${build.examples}/config">
<fileset dir="${examples.web}/config"/>
</copy>
</target>
<property name="examples.post" value="examples.post"/>
<!-- In the post hook we generate the wrapper tags needed by the
xslt transform taglibs/examples.xsl
before calling the transformation.
We also copy over the necessary jars.-->
<!--
JASPER-HOWTO : Add depends attribute to the examples.post
target. Subsequently, the start tag should look like this:
<target name="examples.post" depends="compile-jsps">
-->
<target name="examples.post">
<!-- now format the .txt files as an xml file -->
<replace dir="${build.examples}">
<include name="**/*.txt"/>
<replacetoken><![CDATA[&lt;!--Example:Start--&gt;]]></replacetoken>
<replacevalue><![CDATA[<?xml version="1.0" ?>
<document>
]]></replacevalue>
</replace>
<replace dir="${build.examples}">
<include name="**/*.txt"/>
<replacetoken><![CDATA[&lt;!--Example:End--&gt;]]></replacetoken>
<replacevalue><![CDATA[</document>]]></replacevalue>
</replace>
<!-- now style the .txt files as .html files -->
<style basedir="${build.examples}"
destdir="${build.examples}"
includes="**/*.txt"
style="${taglib-doc.dir}/examples.xsl"/>
<!-- delete the temporary text files -->
<delete>
<fileset dir="${build.examples}" includes="**/*.txt"/>
</delete>
<!-- copy the jars required -->
<copy todir="${build.examples}/WEB-INF/lib" file="${standard.jar}"/>
<copy todir="${build.examples}/WEB-INF/lib" file="${jstl.jar}"/>
<copy todir="${build.examples}/WEB-INF/lib" file="${struts12.jar}"/>
<copy todir="${build.examples}/WEB-INF/lib" file="${commons-beanutils.jar}"/>
<copy todir="${build.examples}/WEB-INF/lib" file="${commons-digester.jar}"/>
<copy todir="${build.examples}/WEB-INF/lib" file="${commons-logging.jar}"/>
<copy todir="${build.examples}/WEB-INF/lib" file="${commons-scxml.jar}"/>
<copy todir="${build.examples}/WEB-INF/lib" file="${dist.dir}/rdc/taglibs-rdc-sampleapps.jar"/>
</target>
<target name="jspc">
<taskdef classname="org.apache.jasper.JspC" name="jasper2" >
<classpath id="jspc.classpath">
<pathelement location="${jasper-compiler.jar}"/>
<pathelement location="${jasper-runtime.jar}"/>
<pathelement location="${servlet24.jar}"/>
<pathelement location="${jsp-api.jar}"/>
<pathelement location="${commons-el.jar}"/>
<pathelement location="${commons-logging.jar}"/>
<pathelement location="${standard.jar}"/>
<pathelement location="${jstl.jar}"/>
<pathelement location="${struts12.jar}"/>
</classpath>
</taskdef>
<jasper2 validateXml="false" trimSpaces="true" uriroot="${build.examples}"
webXmlFragment="${build.examples}/WEB-INF/generated_web.xml"
outputDir="${build.examples}/WEB-INF/src" />
<loadfile property="file" srcFile="${build.examples}/WEB-INF/generated_web.xml"/>
<copy file="examples/web/WEB-INF/web.xml"
toFile="${build.examples}/WEB-INF/web.xml" filtering="on" overwrite="yes">
<filterset begintoken="&lt;!-- @" endtoken="@ --&gt;">
<filter token="generated" value="${file}" />
</filterset>
</copy>
</target>
<!--
JASPER-HOWTO : Uncomment the compile-jsps target below.
-->
<!--
<target name="compile-jsps" depends="jspc">
<mkdir dir="${build.examples}/WEB-INF/classes"/>
<mkdir dir="${build.examples}/WEB-INF/lib"/>
<javac destdir="${build.examples}/WEB-INF/classes" optimize="off"
debug="on" failonerror="false" srcdir="${build.examples}/WEB-INF/src"
excludes="**/*.smap">
<classpath>
<pathelement location="${build.examples}/WEB-INF/classes"/>
<fileset dir="${build.examples}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<pathelement location="${jasper-runtime.jar}"/>
<pathelement location="${servlet24.jar}"/>
<pathelement location="${jsp-api.jar}"/>
<pathelement location="${standard.jar}"/>
<pathelement location="${jstl.jar}"/>
</classpath>
<include name="**" />
<exclude name="tags/**" />
</javac>
</target>
-->
<property name="rdc.src" value="../rdc/src"/>
<property name="tld11.xsl" value="${rdc.src}/util/tld20.xsl"/>
<property name="taglib-doc.xsl" value="${rdc.src}/util/taglibs20-doc.xsl"/>
<!-- hook library-dist to copy over jsp2.0 tag files from src/META-files-->
<property name="library-dist.pre" value="library-dist.pre"/>
<target name="library-dist.pre">
<mkdir dir="${build.library}/.grammar"/>
<copy todir="${build.library}/META-INF">
<fileset dir="${rdc.src}/META-INF" />
</copy>
<copy todir="${build.library}/.grammar">
<fileset dir="${rdc.src}/.grammar" />
</copy>
<copy todir="${build.library}/org/apache/taglibs/rdc/resources">
<fileset dir="${rdc.src}/org/apache/taglibs/rdc/resources" />
</copy>
</target>
<!-- build the sampleapps jar, hardcoding taglib.name to rdc -->
<property name="library-dist.post" value="library-dist.post"/>
<target name="library-dist.post">
<mkdir dir="${build.sampleapps}"/>
<mkdir dir="${build.sampleapps}/META-INF"/>
<copy file="../LICENSE"
toFile="${build.sampleapps}/META-INF/LICENSE"/>
<copy file="../NOTICE"
toFile="${build.sampleapps}/META-INF/NOTICE"/>
<!-- We include the excludes from the library (sampleapps) here -->
<javac srcdir="${library.src}" destdir="${build.sampleapps}"
classpath="${classpath}:${dist.library}/taglibs-rdc.jar"
includes="${library.src.excludes}" debug="on" deprecation="on"/>
<mkdir dir="${build.sampleapps}/org/apache/taglibs/rdc/sampleapps/musicstore/resources"/>
<copy todir="${build.sampleapps}/org/apache/taglibs/rdc/sampleapps/musicstore/resources">
<fileset dir="${rdc.src}/org/apache/taglibs/rdc/sampleapps/musicstore/resources" />
</copy>
<jar jarfile="${dist.library}/taglibs-rdc-sampleapps.jar" basedir="${build.sampleapps}"
manifest="${build.dir}/rdc/rdc.mf" />
</target>
<!-- Include the common.xml ant build declarations -->
&common;
<property name="jsp12.present" value="true"/>
<property name="jsp12.tld" value="../rdc/src/util/tld20.xsl"/>
</project>