blob: 36ef2aec09701612fe58cd8fe047bc034d2e51cb [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="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}/log4j-core.jar"/>
<pathelement location="${lib.ext.dir}/javax.xml.jaxp.jar"/>
<pathelement location="${lib.ext.dir}/org.apache.crimson.jar"/>
<pathelement location="${lib.ext.dir}/org.mortbay.jetty.jar"/>
<pathelement location="${lib.ext.dir}/ejb.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>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
<include name="*.war"/>
<include name="*.ear"/>
</fileset>
</delete>
<delete dir="doc/Tutorial"/>
<delete dir="doc/DevelopersGuide"/>
<delete dir="doc/ContributorsGuide"/>
<delete dir="doc/api"/>
</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"/>
</target>
<target name="junit"
description="Run the JUnit test suite for Tapestry.">
<ant dir="junit" target="run" inheritAll="false"/>
</target>
<target name="dist"
description="Builds the Tapestry distribution from scratch."
depends="clean-all,install,junit,documentation,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"/>
<!-- 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"/>
<!-- 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"/>
<!-- 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"/>
<copy todir="${web.dir}" includeEmptyDirs="false">
<fileset dir=".">
<include name="doc/**"/>
<exclude name="doc/src/**"/>
</fileset>
</copy>
<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="dist.tar" value="${dist.dir}.tar"/>
<property name="dist.tar.gz" value="${dist.tar}.gz"/>
<tar basedir="${dist.root.dir}"
tarfile="${dist.tar}"
includes="${dist.base}/**"
longfile="gnu"/>
<!-- Zip up the TAR file -->
<gzip src="${dist.tar}" zipfile="${dist.tar.gz}"/>
<!-- Remove the distribution directory and the TAR file, leaving only the
final .tar.gz file. -->
<delete file="${dist.tar}"/>
<!-- Create the web distribution (to be put up at SourceForge) -->
<property name="web.tar" value="${dist.root.dir}/Tapestry-Web-${framework.version}.tar"/>
<property name="web.tar.gz" value="${web.tar}.gz"/>
<tar basedir="${web.dir}" tarfile="${web.tar}" longfile="gnu"/>
<gzip src="${web.tar}" zipfile="${web.tar.gz}"/>
<delete file="${web.tar}"/>
</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/"/>
<link href="http://java.sun.com/j2ee/sdk_1.2.1/techdocs/api/"/>
<link href="http://jakarta.apache.org/log4j/docs/api/"/>
<link href="http://www.junit.org/junit/javadoc/3.7/"/>
<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.client.dir}/jboss-client.jar"/>
<pathelement location="${jboss.client.dir}/jboss-j2ee.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}"/>
<copy todir="${tapestry.lib.dir}" flatten="true">
<fileset dir="${lib.dir}">
<include name="*-${framework.version}.jar"/>
<include name="ext/mckoidb.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. Need to see if ClassPathExtension still
exists and is useable as well (in which case, we could just point
to the server/default/conf/lib dir). -->
<include name="*.jar"/>
</fileset>
</copy>
<!-- Delete old version of the frameworks. -->
<delete quiet="true">
<fileset dir="${tapestry.lib.dir}">
<include name="*tapestry*.jar"/>
<exclude name="*-${framework.version}.jar"/>
</fileset>
</delete>
<!-- 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>
</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 vlib 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>
</project>