JdbcMapper/test/dist-test/files/testdist-buildWebapp.xml

101 lines
4.2 KiB
XML

<?xml version="1.0"?>
<!--
This is a build file that is used for Beehive distribution testing and is required
to bridge the gap between the applications in the Beehive SVN tree and the
structure of the distribution.
The "build" and "clean" targets below need to be provided so that the
NetUI and Controls webapps are able to be built using their existing
build files but with the tools / paths from the distribution.
In the end, this is a total HACK and needs to be reworked, but it's
a sufficient stopgap for now.
-->
<project name="Beehive/TestDist/WebappBuild" default="usage">
<property name="tmp.sourcegen.dir" value=".tmpbeansrc"/>
<import file="${dist.home}/beehive-imports.xml"/>
<import file="${dist.home}/ant/beehive-tools.xml"/>
<path id="appserver.build.classpath">
<fileset dir="${os.CATALINA_HOME}/common/lib">
<include name="*.jar"/>
</fileset>
</path>
<target name="build" description="Build a webapp given the webapp root as -Dwebapp.dir">
<available property="webapp.dir.available" file="${webapp.dir}" type="dir"/>
<fail unless="webapp.dir.available" message="Can't find the webapp directory ${webapp.dir}"/>
<!-- this is the classpath to include when building webapp sources -->
<path id="webapp.build.classpath">
<path refid="appserver.build.classpath"/>
<pathelement location="${webapp.dir}/WEB-INF/classes"/>
<fileset dir="${webapp.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
</path>
<!--
this directory needs to get whacked before every build so
that control interface repackagings don't cause stale
files to be compiled
-->
<delete dir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}" includeEmptyDirs="true"/>
<mkdir dir="${webapp.dir}/WEB-INF/classes"/>
<!-- compile XSDs if present -->
<path id="test-xbean.dependency.path">
<pathelement location="../external/apache-xbean.jar"/>
<pathelement location="../external/jsr173_1.0_api.jar"/>
</path>
<taskdef name="xmlbeanbuild"
classname="org.apache.xmlbeans.impl.tool.XMLBean"
classpathref="test-xbean.dependency.path"
onerror="report"/>
<xmlbeanbuild classpathref="test-xbean.dependency.path"
schema="${webapp.dir}/WEB-INF/schemas"
classgendir="${webapp.dir}/WEB-INF/classes"
failonerror="true"/>
<!-- compile controls -->
<build-controls srcdir="${webapp.dir}/WEB-INF/src"
destdir="${webapp.dir}/WEB-INF/classes"
tempdir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}"
classpathref="webapp.build.classpath"/>
<!-- compile JPFs -->
<build-pageflows srcdir="${webapp.dir}"
tempdir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}"
classpathref="webapp.build.classpath"/>
<!-- copy META-INF reference to a Test ServletContainerAdapter
such as /WEB-INF/src/test/TestServletContainerAdapter.java
-->
<copy todir="${webapp.dir}/WEB-INF/classes">
<fileset dir="${webapp.dir}/WEB-INF/src" includes="META-INF/**"/>
</copy>
<!-- copy resources -->
<echo>Copy all .properties and .xml files</echo>
<copy todir="${webapp.dir}/WEB-INF/classes">
<fileset dir="${webapp.dir}/WEB-INF/src" includes="**/*.properties"/>
<fileset dir="${webapp.dir}/WEB-INF/src" includes="**/*.xml"/>
</copy>
</target>
<target name="clean" description="Clean a webapp given the webapp root as -Dwebapp.dir">
<available property="webapp.dir.available" file="${webapp.dir}" type="dir"/>
<fail unless="webapp.dir.available" message="Can't find the webapp directory ${webapp.dir}"/>
<delete dir="${webapp.dir}/WEB-INF/classes" includeEmptyDirs="true"/>
<delete dir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}" includeEmptyDirs="true"/>
</target>
</project>