blob: 8498dcb98faed7a100fc3d6ccff0307a156ecebc [file] [log] [blame]
<?xml version="1.0"?>
<!-- $Id$ -->
<!-- Top-level buildfile for the Tapestry module. -->
<project name="Tapestry Module" default="install">
<property name="root.dir" value="./"/>
<property file="${root.dir}/config/Version.properties"/>
<property file="${root.dir}/config/build.properties"/>
<property file="${root.dir}/config/common.properties"/>
<property name="javadoc.dir" value="web/doc/api"/>
<property name="private.dir" value="private"/>
<!-- Names of distribution files. Have to create the tar, then gzip it
afterwards. tar + gzip results in a smaller distribution than
zip. -->
<path id="tutorial.classpath">
<pathelement location="${framework.jar}"/>
<pathelement location="${contrib.jar}"/>
<pathelement location="${lib.ext.dir}/javax.servlet.jar"/>
<pathelement location="${lib.ext.dir}/${commons-logging.jar}"/>
<pathelement location="${lib.ext.dir}/${commons-lang.jar}"/>
<pathelement location="${lib.ext.dir}/${log4j.jar}"/>
<pathelement location="${lib.ext.dir}/javax.xml.jaxp.jar"/>
<pathelement location="${lib.ext.dir}/org.apache.crimson.jar"/>
<pathelement location="${lib.ext.dir}/${jetty.jar}"/>
<pathelement location="${lib.ext.dir}/ejb.jar"/>
<pathelement location="${lib.ext.dir}/${jakarta-oro.jar}"/>
<pathelement location="${lib.ext.dir}/${ognl.jar}"/>
<pathelement location="config"/>
</path>
<path id="full.classpath">
<pathelement location="${vlibbeans.jar}"/>
<pathelement location="examples/VlibBeans/jboss"/>
<pathelement location="${jboss.client.dir}/jboss-j2ee.jar"/>
<pathelement location="${jboss.client.dir}/jboss-client.jar"/>
<pathelement location="${jboss.client.dir}/jnp-client.jar"/>
<path refid="tutorial.classpath"/>
</path>
<target name="clean"
description="Cleans all sub-projects.">
<ant dir="framework" target="clean"/>
<ant dir="contrib" target="clean"/>
<ant dir="junit" target="clean"/>
<ant dir="examples/wap" target="clean"/>
<ant dir="examples/Tutorial" target="clean"/>
<ant dir="examples/VlibBeans" target="clean"/>
<ant dir="examples/Vlib" target="clean"/>
<ant dir="doc/src/Tutorial" target="clean"/>
<ant dir="doc/src/DevelopersGuide" target="clean"/>
<ant dir="doc/src/ContributorsGuide" target="clean"/>
<delete dir="${private.dir}" quiet="true"/>
</target>
<target name="clean-all" depends="clean"
description="Cleans all subprojects and deletes installed frameworks and WARs.">
<delete quiet="true">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
<include name="*.war"/>
<include name="*.ear"/>
</fileset>
</delete>
<delete dir="web/doc" quiet="true"/>
</target>
<target name="install"
description="Builds all frameworks and examples.">
<!-- Each project has its own definitions for many properties.
inheritAll="false" ensures that definitions in this buildfile
doesn't override definitions in each project's buildfile. -->
<ant dir="framework" target="install" inheritAll="false"/>
<ant dir="contrib" target="install" inheritAll="false"/>
<ant dir="examples/wap" target="install" inheritAll="false"/>
<ant dir="examples/Tutorial" target="install" inheritAll="false"/>
<ant dir="examples/VlibBeans" target="install" inheritAll="false"/>
<ant dir="examples/Vlib" target="install" inheritAll="false"/>
<ant dir="examples/VlibEAR" target="install" inheritAll="false"/>
</target>
<target name="documentation"
description="Builds the Tapestry documentation.">
<ant dir="doc/src/Tutorial" target="install" inheritAll="false"/>
<ant dir="doc/src/DevelopersGuide" target="install" inheritAll="false"/>
<ant dir="doc/src/ContributorsGuide" target="install" inheritAll="false"/>
<ant dir="doc/src/ComponentReference" target="install" inheritAll="false"/>
</target>
<target name="junit"
description="Run the JUnit test suite for Tapestry.">
<ant dir="junit" target="run" inheritAll="false"/>
</target>
<target name="clover"
description="Execute the JUnit tests and generate Code Coverage report.">
<ant dir="junit" target="clover" inheritAll="false"/>
</target>
<target name="dist"
description="Builds the Tapestry distribution from scratch."
depends="clean-all,install,junit,documentation,clover,javadoc">
<!-- After building, clean all the subprojects. -->
<antcall target="clean"/>
<!-- Now, build that actual distribution. -->
<antcall target="build-dist"/>
</target>
<property name="dist.root.dir" value="dist"/>
<property name="dist.base" value="Tapestry-${framework.version}"/>
<property name="dist.dir" value="${dist.root.dir}/${dist.base}"/>
<target name="build-dist" description="Builds the Tapestry distribution files.">
<!-- Delete the base directory. -->
<delete dir="${dist.root.dir}" quiet="true"/>
<antcall target="build-dist-tarball"/>
</target>
<target name="build-dist-copy">
<mkdir dir="${dist.dir}"/>
<!-- Copy all the relevant files to the base directory. -->
<copy todir="${dist.dir}" includeEmptyDirs="false">
<fileset dir=".">
<include name="*.xml"/>
<include name="*.html"/>
<include name="LICENSE.*"/>
<!-- Skip HTML files in web, since those need
a seperate path, to provide filtering. -->
<exclude name="Readme.html"/>
<exclude name="web/*.html"/>
<include name="web/**"/>
<include name="config/**"/>
<include name="lib/**"/>
<!-- We just ship the EAR built from
these two. -->
<exclude name="lib/VlibBeans.jar"/>
<exclude name="lib/Vlib.war"/>
<!-- This is not needed at runtime. -->
<exclude name="lib/ext/junit.jar"/>
<!-- Exclude class files left around by IDEs. -->
<exclude name="**/*.class"/>
<!-- Exclude Paint Shop Pro files (used to generate images
in various places) -->
<exclude name="**/*.psp"/>
<exclude name="**/*.jbf"/>
<!-- Don't include build.properties; that's specific to this build
environment. We ship a sample file instead. -->
<exclude name="config/build.properties"/>
<!-- This is where Eclipse puts classes. -->
<exclude name="bin/**"/>
<!-- It isn't a good idea to generate a distribution from a normal working
directory, since the <copy> will include things like backup files created
while editting. Better to check out the Tapestry module via anon CVS to
a temporary directory, configure build.properties, and build the
release there. -->
</fileset>
</copy>
<!-- The Readme.html file and several of the web pages
include a version number; copy w/ filtering. -->
<copy todir="${dist.dir}" includeEmptyDirs="false">
<fileset dir=".">
<include name="Readme.html"/>
<include name="web/*.html"/>
</fileset>
<filterset>
<filter token="VERSION" value="${framework.version}"/>
<filter token="OS_NAME" value="${os.name}"/>
<filter token="OS_VERSION" value="${os.version}"/>
<filter token="JAVA_VENDOR" value="${java.vendor}"/>
<filter token="JAVA_VM_VERSION" value="${java.vm.version}"/>
</filterset>
</copy>
<property name="web.dir" value="${dist.dir}/web"/>
<property name="dtd.dir" value="${web.dir}/dtd"/>
<mkdir dir="${dtd.dir}"/>
<copy todir="${dtd.dir}" flatten="true">
<fileset dir="framework/src">
<include name="**/*.dtd"/>
</fileset>
</copy>
</target>
<target name="build-dist-jars"
description="Builds the source JARs."
depends="build-dist-copy">
<!-- Jar up the source code for the frameworks. -->
<property name="dist.src.dir" value="${dist.dir}/src"/>
<mkdir dir="${dist.src.dir}"/>
<jar jarfile="${dist.src.dir}/net.sf.tapestry-src.jar"
basedir="framework"/>
<jar jarfile="${dist.src.dir}/net.sf.tapestry.contrib-src.jar"
basedir="contrib"/>
<jar jarfile="${dist.src.dir}/examples-src.jar" basedir="examples"/>
</target>
<target name="build-dist-tarball"
description="Builds the tarball distributions."
depends="build-dist-jars">
<!-- Pack the directory (relative to ${dist.dir}), into a TAR file. We go to the extra work
of building a .tar.gz because the distro is smaller than an equivalent .zip file.
-->
<property name="core.tar.gz" value="${dist.dir}-core.tar.gz"/>
<property name="doc.tar.gz" value="${dist.dir}-doc.tar.gz"/>
<tar tarfile="${core.tar.gz}"
longfile="gnu"
compression="gzip">
<tarfileset dir="${dist.root.dir}">
<exclude name="${dist.base}/web/**"/>
<exclude name="*.gz"/>
<include name="**"/>
</tarfileset>
<!-- These web assets are referrenced from Readme.html -->
<tarfileset dir="${dist.root.dir}">
<include name="${dist.base}/web/images/*.gif"/>
<include name="${dist.base}/web/scripts/*.css"/>
</tarfileset>
</tar>
<tar tarfile="${doc.tar.gz}"
longfile="gnu"
compression="gzip">
<tarfileset dir="${dist.root.dir}">
<!-- Don't ship the code coverage report; it's huge. -->
<exclude name="${dist.base}/web/doc/clover/**"/>
<include name="${dist.base}/web/**"/>
</tarfileset>
</tar>
<!-- Create the web distribution (to be put up at SourceForge). This *does*
include the code coverage report. -->
<property name="web.tar.gz" value="${dist.root.dir}/Tapestry-Web-${framework.version}.tar.gz"/>
<tar basedir="${web.dir}"
tarfile="${web.tar.gz}"
longfile="gnu"
compression="gzip"/>
</target>
<target name="javadoc" description="Generate API documentation for the framework and examples.">
<mkdir dir="${javadoc.dir}"/>
<javadoc
author="true"
version="true"
destdir="${javadoc.dir}"
splitindex="true"
windowtitle="Tapestry API ${framework.version}">
<doctitle>Tapestry API (Release ${framework.version})</doctitle>
<package name="net.sf.tapestry.*"/>
<package name="tutorial.*"/>
<link
href="http://java.sun.com/products/jdk/1.2/docs/api/"
offline="true"
packageListLoc="package-lists/jdk"/>
<link
href="http://java.sun.com/j2ee/sdk_1.2.1/techdocs/api/"
offline="true"
packageListLoc="package-lists/j2ee"/>
<link
href="http://jakarta.apache.org/log4j/docs/api/"
offline="true"
packageListLoc="package-lists/log4j"/>
<link
href="http://www.junit.org/junit/javadoc/3.7/"
offline="true"
packageListLoc="package-lists/junit"/>
<link
href="http://www.object-refinery.com/jcommon/javadoc/"
offline="true"
packageListLoc="package-lists/jcommon"/>
<link
href="http://www.object-refinery.com/jfreechart/javadoc/"
offline="true"
packageListLoc="package-lists/jfreechart"/>
<link
href="http://jakarta.apache.org/oro/api/"
offline="true"
packageListLoc="package-lists/jakarta-oro"/>
<group title="Tapestry Framework" packages="net.sf.tapestry:net.sf.tapestry.*"/>
<group title="Tapestry Contributions Framework" packages="net.sf.tapestry.contrib.*"/>
<group title="Tapestry Tutorials" packages="tutorial.*"/>
<group title="Virtual Library" packages="net.sf.tapestry.vlib:net.sf.tapestry.vlib.*"/>
<group title="JUnit Tests" packages="net.sf.tapestry.junit,net.sf.tapestry.junit.*"/>
<sourcepath>
<pathelement location="framework/src"/>
<pathelement location="contrib/src"/>
<pathelement location="examples/Tutorial/src"/>
<pathelement location="examples/Vlib/src"/>
<pathelement location="examples/VlibBeans/src"/>
<pathelement location="junit/src"/>
</sourcepath>
<classpath>
<path refid="full.classpath"/>
<pathelement location="${lib.ext.dir}/mckoidb.jar"/>
<pathelement location="${lib.ext.dir}/junit.jar"/>
<pathelement location="${jboss.lib.dir}/jboss-jmx.jar"/>
<pathelement location="${jboss.lib.dir}/jboss-system.jar"/>
<pathelement location="${jboss.lib.dir}/jboss-common.jar"/>
<pathelement location="${jboss.server.all.lib.dir}/mail.jar"/>
</classpath>
</javadoc>
</target>
<target name="run-tutorial"
description="Runs the Tapestry Tutorial.">
<delete dir="${private.dir}" quiet="true"/>
<mkdir dir="${private.dir}"/>
<echo>Running Tapestry Tutorial on port 8080 ...</echo>
<java
classname="org.mortbay.jetty.Server"
classpathref="tutorial.classpath"
fork="true"
maxmemory="128MB">
<arg value="config/jetty-tutorial.xml"/>
<!-- Enable debugging when running the tutorial -->
<jvmarg line="-showversion -Xdebug -Xnoagent"/>
<jvmarg line="-Xrunjdwp:transport=dt_socket,suspend=n,server=y,address=20150"/>
<!-- Jetty can get easily confused (under NT) unless this is turned off. -->
<sysproperty key="org.mortbay.util.FileResource.checkAliases" value="false"/>
<sysproperty key="net.sf.tapestry.asset.dir" value="${private.dir}"/>
<sysproperty key="net.sf.tapestry.asset.URL" value="/private"/>
</java>
</target>
<!-- ===================================================================================
JBoss 3.0.0 auto configuration
Configures a JBoss 3.0.0 with a new configuration, tapestry. Part of the configuration
comes with the Tapestry distribution; part is copied from the JBoss default server
configuration.
==================================================================================== -->
<property name="tapestry.dir" value="${jboss.dir}/server/tapestry"/>
<property name="tapestry.conf.dir" value="${tapestry.dir}/conf"/>
<property name="tapestry.lib.dir" value="${tapestry.dir}/lib"/>
<property name="tapestry.db.dir" value="${tapestry.dir}/db"/>
<property name="tapestry.deploy.dir" value="${tapestry.dir}/deploy"/>
<property name="tapestry.private.dir" value="${tapestry.dir}/tmp/${private.dir}"/>
<property name="jboss.server.default.dir" value="${jboss.dir}/server/default"/>
<target name="configure"
description="Configure the JBoss 3.0.0 server and setup the Vlib database.">
<property name="temp.dir" value=".temp"/>
<mkdir dir="${tapestry.lib.dir}"/>
<!-- Delete old version of the frameworks. -->
<delete quiet="true">
<fileset dir="${tapestry.lib.dir}">
<!-- Match and exclude current versions -->
<exclude name="*tapestry*${framework.version}.jar"/>
<exclude name="${jakarta-oro.jar}"/>
<exclude name="${ognl.jar}"/>
<!-- Match and include out-of-date versions -->
<include name="*tapestry*.jar"/>
<include name="jakarta-oro-*.jar"/>
<include name="ognl-*.jar"/>
<include name="commons-logging*.jar"/>
<include name="commons-lang*.jar"/>
</fileset>
</delete>
<copy todir="${tapestry.lib.dir}" flatten="true">
<fileset dir="${lib.ext.dir}">
<include name="mckoidb.jar"/>
<include name="${jakarta-oro.jar}"/>
<include name="${ognl.jar}"/>
<include name="${commons-logging.jar}"/>
<include name="${commons-lang.jar}"/>
</fileset>
<fileset dir="${jboss.server.default.dir}/lib">
<!-- Could do a careful analysis of just what we need and copy only that,
but this is good for now. -->
<include name="*.jar"/>
</fileset>
</copy>
<!-- Delete, recreate and copy -->
<delete dir="${tapestry.conf.dir}" quiet="true"/>
<mkdir dir="${tapestry.conf.dir}"/>
<copy todir="${tapestry.conf.dir}" filtering="true">
<fileset dir="config/jboss/conf"/>
<filterset>
<filter token="jboss.dir" value="${jboss.dir}"/>
<filter token="user.dir" value="${user.dir}"/>
</filterset>
</copy>
<mkdir dir="${tapestry.deploy.dir}"/>
<copy todir="${tapestry.deploy.dir}">
<fileset dir="${jboss.server.default.dir}/deploy">
<include name="*.jar"/>
<include name="jmx-ejb-connector-server.sar"/>
<include name="jmx-html-adaptor.sar"/>
<include name="jmx-rmi-adaptor.sar"/>
<include name="jboss-local-jdbc.rar"/>
<include name="jboss-xa.rar"/>
<include name="jca-service.xml"/>
<include name="properties-service.xml"/>
</fileset>
</copy>
<!-- We explode the Jetty plugin and copy its individual JARs to lib, plus
a custom service XML. -->
<mkdir dir="${temp.dir}"/>
<unjar src="${jboss.server.default.dir}/deploy/jetty-plugin.sar"
dest="${temp.dir}"/>
<copy todir="${tapestry.lib.dir}">
<fileset dir="${temp.dir}">
<include name="*.jar"/>
</fileset>
</copy>
<delete dir="${temp.dir}" quiet="true"/>
<!-- Technically, this isn't necessary any longer (the filtering part),
but it does no harm, and may be needed again in the future. -->
<copy todir="${tapestry.deploy.dir}" filtering="true">
<fileset dir="config/jboss/deploy">
<include name="*.xml"/>
</fileset>
<filterset>
<filter token="user.dir" value="${user.dir}"/>
<filter token="jboss.dir" value="${jboss.dir}"/>
</filterset>
</copy>
<!-- Set a flag if the vlib already exists, then extract it if necessary. -->
<mkdir dir="${tapestry.db.dir}"/>
<available file="${tapestry.db.dir}/vlib.conf" property="vlib.db.exists"/>
<antcall target="unpack-vlib-database"/>
</target>
<target name="unpack-vlib-database"
description="Unpacks the Virtual Library database."
unless="vlib.db.exists">
<unzip src="config/jboss/vlib-db.zip" dest="${tapestry.db.dir}"/>
</target>
<target name="deploy-vlib" description="Deploys the Virtual Library demo into JBoss.">
<copy todir="${tapestry.deploy.dir}">
<fileset dir="${lib.dir}">
<include name="Vlib.ear"/>
<include name="tutorial.war"/>
</fileset>
</copy>
<copy todir="${tapestry.lib.dir}" flatten="true">
<fileset dir="${lib.dir}">
<include name="*-${framework.version}.jar"/>
</fileset>
</copy>
</target>
<target name="run-jboss"
depends="deploy-vlib"
description="Launch the JBoss application server.">
<delete dir="${tapestry.private.dir}" quiet="true"/>
<mkdir dir="${tapestry.private.dir}"/>
<java fork="true"
dir="${jboss.dir}/bin"
classname="org.jboss.Main">
<!-- Launch using the tapestry configuration, not the default. -->
<arg line="--configuration=tapestry"/>
<classpath>
<pathelement location="${jboss.dir}/bin/run.jar"/>
</classpath>
<!-- Enable debugging -->
<jvmarg line="-showversion -Xdebug -Xnoagent"/>
<jvmarg line="-Xrunjdwp:transport=dt_socket,suspend=n,server=y,address=20500"/>
<sysproperty key="net.sf.tapestry.enable-reset-service" value="true"/>
<sysproperty key="net.sf.tapestry.vlib.debug-enabled" value="true"/>
<!-- These allow private assets to be exported as static
files. This coordinates with portions of
config/deploy/jetty-service.xml -->
<sysproperty key="net.sf.tapestry.asset.dir" value="${tapestry.private.dir}"/>
<sysproperty key="net.sf.tapestry.asset.URL" value="/private"/>
<!-- The following is probably only necessary under Windows. Jetty gets
tripped up by the fact that pathnames are case-insensitive. -->
<sysproperty key="org.mortbay.util.FileResource.checkAliases" value="false"/>
</java>
</target>
<target name="unpack-src" description="Unpacks the source JARS.">
<unjar src="src/net.sf.tapestry-src.jar" dest="framework"/>
<unjar src="src/net.sf.tapestry.contrib-src.jar" dest="contrib"/>
<unjar src="src/examples-src.jar" dest="examples"/>
</target>
<target name="deploy-tomcat" description="Deploys the tutorial application into Tomcat.">
<unjar src="${tutorial.war}" dest="${tomcat.dir}/webapps/tutorial"/>
<property name="web.lib" value="${tomcat.dir}/webapps/tutorial/WEB-INF/lib"/>
<copy file="${framework.jar}" todir="${web.lib}"/>
<copy file="${contrib.jar}" todir="${web.lib}"/>
<copy todir="${web.lib}">
<fileset dir="${lib.ext.dir}">
<include name="${commons-lang.jar}"/>
<include name="${commons-logging.jar}"/>
<include name="${jakarta-oro.jar}"/>
<include name="${log4j.jar}"/>
<include name="${ognl.jar}"/>
<include name="ejb.jar"/>
</fileset>
</copy>
<copy file="config/log4j.properties" todir="${tomcat.dir}/webapps/tutorial/WEB-INF/classes"/>
</target>
</project>