+<!-- PROPERTIES -->
+
+<target name="echoUserPropertiesFileFound" if="user.properties.found">
+ <echo>Using properties file ${user.property.file}</echo>
+</target>
+
+<target name="echoUserPropertiesFileNotFound" unless="user.properties.found">
+ <echo>Properties file ${user.property.file} not found, reverting to defaults</echo>
+</target>
+
+
+
+<target name="download.dep">
+ <if>
+ <isset property="artifact"/>
+ <then>
+ <echo>Getting dependence ${group}/${artifact}/${version}</echo>
+ <dependencies verbose="true" fileSetId="my.deps">
+ <dependency group="${group}" artifact="${artifact}" version="${version}"/>
+ </dependencies>
+ <copy todir="${download.dir}" flatten="yes">
+ <fileset refid="my.deps"/>
+ </copy>
+ </then>
+ <else>
+ <echo>Getting dependence ${group}/${version}</echo>
+ <dependencies verbose="true" fileSetId="my.deps">
+ <dependency group="${group}" version="${version}"/>
+ </dependencies>
+ <copy todir="${download.dir}" flatten="yes">
+ <fileset refid="my.deps"/>
+ </copy>
+ </else>
+ </if>
+</target>
+
+<!-- LOG4j -->
+<target name="log4j.d">
+ <antcall target="download.dep">
+ <param name="group" value="log4j"/>
+ <param name="version" value="1.2.9"/>
+ </antcall>
+</target>
+
+<target name="commons-logging.d">
+ <antcall target="download.dep">
+ <param name="group" value="commons-logging"/>
+ <param name="artifact" value="commons-logging"/>
+ <param name="version" value="1.0.2"/>
+ </antcall>
+</target>
+
+<target name="logging.d" depends="log4j.d,commons-logging.d">
+</target>
+
+<target name="dom4j.d">
+ <antcall target="download.dep">
+ <param name="group" value="dom4j"/>
+ <param name="version" value="1.6"/>
+ </antcall>
+</target>
+
+<target name="xerces.d">
+ <antcall target="download.dep">
+ <param name="group" value="ehcache"/>
+ <param name="version" value="1.1"/>
+ </antcall>
+</target>
+
+<target name="ehcache.d">
+ <antcall target="download.dep">
+ <param name="group" value="xerces"/>
+ <param name="version" value="2.4.0"/>
+ </antcall>
+</target>
+
+<target name="oro.d">
+ <antcall target="download.dep">
+ <param name="group" value="oro"/>
+ <param name="version" value="2.0.6"/>
+ </antcall>
+</target>
+
+<target name="cglib.d">
+ <antcall target="download.dep">
+ <param name="group" value="cglib"/>
+ <param name="version" value="2.1"/>
+ </antcall>
+</target>
+
+<target name="hibernate.d" depends="cglib.d,oro.d">
+ <antcall target="download.dep">
+ <param name="group" value="hibernate"/>
+ <param name="version" value="3.0.5"/>
+ </antcall>
+</target>
+
+<target name="hibernate.standalone.d" depends="hibernate.d">
+ <copy todir="${download.dir}">
+ <fileset dir="${special.lib.dir}/hibernate">
+ <include name="*.jar"/>
+ </fileset>
+ </copy>
+</target>
+
+<target name="spring.d">
+ <antcall target="download.dep">
+ <param name="group" value="springframework"/>
+ <param name="artifact" value="spring"/>
+ <param name="version" value="1.2.5"/>
+ </antcall>
+</target>
+
+<target name="junit.d">
+ <antcall target="download.dep">
+ <param name="group" value="junit"/>
+ <param name="version" value="3.8.1"/>
+ </antcall>
+ <copy todir="${download.dir}">
+ <fileset dir="${special.lib.dir}/test">
+ <include name="*.jar"/>
+ </fileset>
+ </copy>
+</target>
+
+<target name="emma.d">
+ <antcall target="download.dep">
+ <param name="group" value="emma"/>
+ <param name="artifact" value="emma"/>
+ <param name="version" value="2.0.5312"/>
+ </antcall>
+ <antcall target="download.dep">
+ <param name="group" value="emma"/>
+ <param name="artifact" value="emma_ant"/>
+ <param name="version" value="2.0.5312"/>
+ </antcall>
+</target>
+
+<target name="jmock.d">
+ <antcall target="download.dep">
+ <param name="group" value="jmock"/>
+ <param name="artifact" value="jmock"/>
+ <param name="version" value="1.0.1"/>
+ </antcall>
+ <antcall target="download.dep">
+ <param name="group" value="jmock"/>
+ <param name="artifact" value="jmock-cglib"/>
+ <param name="version" value="1.0.1"/>
+ </antcall>
+</target>
+
+<target name="dbunit.d">
+ <antcall target="download.dep">
+ <param name="group" value="dbunit"/>
+ <param name="version" value="2.1"/>
+ </antcall>
+</target>
+
+<!-- common test dependencies for all test code -->
+<target name="test.d" depends="junit.d,jmock.d,dbunit.d,emma.d">
+</target>
+
+
+
+ <target name="import_header" unless="build_header_included">
+
+ <!-- ========================================================================================
+ Locate user properties to (optionally) override defaults
+ ======================================================================================== -->
+
+ <!--
+ Give user a chance to override without editing this file
+ (and without typing -D each time they run it).
+
+ The following properties must be defined in this file:
+ - jcoverage.home: root of the jcoverage installation.
+ - jalopy.home: root of the jalopy installation.
+ -->
+ <property name="user.property.file" value="${user.home}/wamblee.properties"/>
+ <available file="${user.property.file}" property="user.properties.found"/>
+ <property file="${user.property.file}"/>
+
+ <antcall target="echoUserPropertiesFileFound"/>
+ <antcall target="echoUserPropertiesFileNotFound"/>
+
+ <!-- project properties defaults, can be overriden in the user's properties file -->
+
+ <!-- The project.home property can also be overriden in a build.xml
+ in case the source is in a subdirectory and not necessarily
+ in the top-level directory -->
+ <property name="project.home" value=".."/>
+ <property name="build.dir" value="${project.home}/build"/>
+ <property name="lib.dir" value="${project.home}/lib/wamblee"/>
+ <property name="ant.lib.dir" value="${project.home}/lib/ant"/>
+ <property name="external.lib.dir" value="lib/external"/>
+ <property name="test.lib.dir" value="lib/test"/>
+ <property name="special.lib.dir" value="${project.home}/lib/special"/>
+ <property name="forrest.xdocs.dir" value="${project.home}/site/xdocs"/>
+ <property name="forrest.build.dir" value="${project.home}/site/build"/>
+ <property name="forrest.build.site.dir" value="${forrest.build.dir}/site"/>
+ <property name="build.properties.dir" value="${project.home}" />
+ <property name="build.properties.name" value="build.properties" />
+
+ <mkdir dir="${external.lib.dir}"/>
+ <mkdir dir="${test.lib.dir}"/>
+
+ <property name="conf.dir" value="conf"/>
+ <property name="log4j.properties.dir" value="${conf.dir}/properties"/>
+
+ <!-- Compilation properties -->
+ <property name="javac.debug" value="true"/>
+ <property name="javac.debug.level" value="lines,vars,source"/>
+ <property name="javac.source" value="1.5"/>
+
+ <!-- ========================================================================================
+ Standard path definitions to be used with all projects
+ ======================================================================================= -->
+ <property name="xmlschemas.dir" value="${conf.dir}/schemas"/>
+ <path id="xmlschemas.path">
+ <pathelement location="${xmlschemas.dir}"/>
+ </path>
+
+ <!-- ========================================================================================
+ Path definitions for external libraries.
+ ======================================================================================== -->
+
+ <!-- Ignore system classpath! -->
+ <property name="build.sysclasspath" value="ignore" />
+
+ <!-- JUnit -->
+ <property name="junit.halt.on.failure" value="false"/>
+ <property name="unitreport" value="cl-unit.xml"/>
+
+ <!-- Hibernate paths -->
+ <!-- name of the file in the source directory containing
+ the names of hibernate files to look at in the correct order -->
+ <property name="hibernate.home" value="${lib.dir}/hibernate-3.0"/>
+ <path id="hibernate.basic.path">
+ <fileset dir="${hibernate.home}">
+ <include name="*.jar"/>
+ </fileset>
+ <path refid="xerces.path"/>
+ <path refid="dom4j.path"/>
+ </path>
+ <path id="hibernate.appserver.path">
+ <path refid="hibernate.basic.path"/>
+ <fileset dir="${hibernate.home}/appserver">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+ <path id="hibernate.standalone.path">
+ <path refid="hibernate.basic.path"/>
+ <fileset dir="${hibernate.home}/standalone">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+ <!-- Commented the inclusion of a system-wide path in the user's environment into a
+ classpath. System wide classpaths should not be used. -->
+ <!-- property name="classpath_id" value="build.path" / -->
+ <!-- property name="classpath" refid="${classpath_id}"/ -->
+ <property name="classpath" value=""/>
+
+
+ <!-- ========================================================================================
+ Database settings
+ ======================================================================================== -->
+ <property name="database" value="Derby"/>
+
+ <!-- ========================================================================================
+ Ant task defs
+ ======================================================================================== -->
+
+ <!-- ant-contrib integration -->
+ <property name="ant.contrib.home" value="${ant.lib.dir}/ant-contrib-1.0b2"/>
+ <taskdef resource="net/sf/antcontrib/antlib.xml">
+ <classpath>
+ <pathelement location="${ant.contrib.home}/ant-contrib.jar" />
+ </classpath>
+ </taskdef>
+
+ <!-- taskdef for ant-dependencies task -->
+ <taskdef name="dependencies" classpath="${ant.lib.dir}/ant-dependencies.jar"
+ classname="org.apache.tools.ant.taskdefs.optional.dependencies.Dependencies"/>
+
+ <!-- Emma integration -->
+ <path id="emma.lib">
+ <fileset dir="${test.lib.dir}" includes="emma*.jar"/>
+ </path>
+ <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
+ <property name="emma.enabled" value="false"/>
+
+ <!-- checkstyle -->
+ <!-- TMP download this dependence as well
+ <property name="checkstyle.home" value="${lib.dir}/checkstyle-3.5"/>
+ <taskdef resource="checkstyletask.properties"
+ classpath="${checkstyle.home}/checkstyle-all-3.5.jar"/>
+ <property name="checkstyle.rules" value="coding-rules.xml"/>
+ <property name="checkstyle.test.rules" value="coding-rules-test.xml"/>
+ -->
+
+ <!-- jalopy -->
+ <!-- TMP download this dependence as well
+ <property name="jalopy.home" value="${lib.dir}/jalopy-ant-0.6.2"/>
+ <property name="jalopy.rules" value="${build.dir}/formatting-rules.xml"/>
+ <taskdef name="jalopy"
+ classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
+ <classpath>
+ <fileset dir="${jalopy.home}">
+ <include name="*.jar" />
+ </fileset>
+ </classpath>
+ </taskdef>
+ -->
+
+ <!-- simian integration -->
+ <!-- TMP download this dependence as well
+ <property name="simian.home" value="${lib.dir}/simian"/>
+ <taskdef resource="simiantask.properties" classpath="${simian.home}/simian.jar"/>
+ -->
+
+ <!-- macker integration -->
+ <!-- TMP download this dependence as well
+ <property name="macker.home" value="${lib.dir}/macker-0.4.2"/>
+ <path id="macker.path">
+ <fileset dir="${macker.home}">
+ <include name="**/*.jar"/>
+ </fileset>
+ </path>
+ <taskdef name="macker"
+ classname="net.innig.macker.ant.MackerAntTask"
+ classpathref="macker.path"/>
+
+ -->
+
+ <!-- ========================================================================================
+ Information
+ ======================================================================================== -->
+ <echo level="debug" message="project.home=${project.home}"/>
+ <echo level="debug" message="project.libs=${project.libs}"/>
+ <echo level="debug" message="classpath=${classpath}"/>
+
+
+ <!-- ========================================================================================
+ Included marker
+ ======================================================================================== -->
+ <property name="build_header_included" value="true" />
+</target>
+
+<!-- =================================================================
+ Sets up the directory definitions for the module
+ ================================================================= -->
+<target name="init_directory_properties" depends="import_header">
+ <!-- Set module properties for this build -->
+
+ <property name="module.home" value="." />
+
+ <!-- Replace the dash by a / to create a relative directory
+ from a module name -->
+ <propertyregex property="module.reldir"
+ input="${module.name}"
+ regexp="-"
+ replace="/"
+ global="true"
+ defaultValue="${module.name}"/>
+ <property name="module.build.dir"
+ value="${build.dir}/${module.reldir}" />
+
+ <property name="module.api.forrest.dir" value="${forrest.build.site.dir}/api/${module.name}" />
+ <!-- property name="module.classes.dir" value="${module.build.dir}/bin"/ -->
+ <!-- property name="module.testclasses.dir" value="${module.build.dir}/testbin"/ -->
+ <property name="module.classes.dir" value="bin" />
+ <property name="module.testclasses.dir" value="testbin" />
+ <!-- Directory where generated SQL will be put by the schema export-->
+ <property name="module.sql.dir" value="${module.build.dir}/sql" />
+
+
+ <property name="module.jcovclasses.dir"
+ value="${module.build.dir}/testjcov" />
+ <property name="module.jars.dir" value="${module.build.dir}/jars" />
+ <property name="module.jar.file"
+ value="${module.jars.dir}/${module.jar.name}" />
+ <property name="module.source.dir" value="${module.home}/src" />
+ <property name="module.forrest.src.dir" value="${module.home}/xdocs" />
+ <property name="module.ejbsource.dir" value="${module.home}/ejbsrc" />
+ <property name="module.test.dir" value="${module.home}/test" />
+ <property name="module.testjar.name"
+ value="${module.name}-test.jar" />
+ <property name="module.testresourcesjar.name"
+ value="${module.name}-test-resources.jar" />
+ <property name="module.resource.dir"
+ value="${module.home}/resources" />
+ <property name="module.testresource.dir"
+ value="${module.resource.dir}/test" />
+ <property name="module.testoutput.dir"
+ value="${module.resource.dir}/testoutput"/>
+ <property name="module.report.dir"
+ value="${module.build.dir}/testresults" />
+ <property name="module.emmareport.dir"
+ value="${module.report.dir}/html/emma"/>
+ <property name="module.docbase.dir"
+ value="${module.build.dir}/javadoc" />
+ <property name="module.javadoc.dir"
+ value="${module.docbase.dir}/api" />
+ <property name="module.javadocjar.name"
+ value="${module.name}-doc.jar" />
+ <property name="module.testjavadocjar.name"
+ value="${module.name}-test-doc.jar" />
+ <property name="module.testjavadoc.dir"
+ value="${module.docbase.dir}/testapi" />
+ <property name="module.pdfdoc.dir"
+ value="${module.docbase.dir}/pdf" />
+ <property name="module.doccheck.dir"
+ value="${module.docbase.dir}/doccheck" />
+ <property name="module.jar.name" value="${module.name}.jar" />
+
+ <!-- Replace the dash by a / to create a relative directory
+ from a module name -->
+ <property name="module.dist.dir" value="${lib.dir}/${module.reldir}" />
+</target>
+
+<!-- ============================================================================
+ Initialize the environment for other tasks. Normally, every task which
+ does not depend on any other task should at least depend on init.
+ ============================================================================ -->
+
+ <target name="help" depends="import_header">
+ <antcall target="help-within-module"/>
+ <antcall target="help-outside-module"/>
+ </target>
+
+ <target name="help-within-module" depends="init_directory_properties" if="module.name">
+ <antcall target="help-impl"/>
+ </target>
+
+ <target name="help-outside-module" unless="module.name">
+ <antcall target="help-outside-module-2">
+ <param name="module.name" value="MODULE_NAME"/>
+ </antcall>
+ </target>
+
+ <target name="help-outside-module-2" depends="init_directory_properties">
+ <antcall target="help-impl"/>
+ </target>
+
+
+ <target name="help-impl">
+ <echo>
+ General build targets:
+
+ clean: Cleans up all build results (excluding the dist location).
+ compile: Compiles all java clasess. Target dir ${module.classes.dir}
+ jar: Creates a jar file. Target: ${module.jar.file}
+ dist: Makes the build results available for other modules Target: ${module.dist.dir}.
+ dist-lite: Similar to dist but only creates the jars for code and test code. Useful
+ during development because it takes much less time than the dist
+ target
+ clean-dist: Cleans up the dist directories.
+
+ Test:
+
+ test: Compile and run tests.
+ junit-reports: As test but generates a test report. Target: ${module.report.dir}(/html/unit)
+ reports: As junit-reports but also generates an emma test coverage
+ report
+
+ Note: By specifying -Dtest=TestCaseName on the ant command line,
+ only the specified testcase will be run.
+
+ Emma can also be executed manually:
+
+ emma: Overwrites the production classes by their instrumented versions.
+ emma-reports: Generates emma code coverage reports after running the
+ testcases with instrumented classes.
+
+ Javadoc targets:
+
+ javadoc: Generates javadoc. Target: ${module.javadoc.dir}
+ doccheck: Checks documentation. Target: ${module.doccheck.dir}
+
+ Code analysis:
+
+ checkstyle: Checks the style of the code.
+ format: Formats to the code in accordance with the checkstyle rules.
+ simian: Analyse similarities in the code.
+
+ Database targets:
+
+ For all targets below the database is configured using
+ hibernate.properties (hibernate.dialect property) and
+ the JDBC connection properties in database.properties.
+
+ The schemaexport and schemaupdate targets require the
+ setting of a property named hibernate.filelist. The value
+ of the property must be the fully qualified class name of
+ a concrete subclass of ConfigFileList which has a default
+ public constructor and defines the Hibernate mapping files that
+ can be used.
+
+ schemaexport: Generate SQL code to create the required database structures.
+
+ startdb: Startup a lightweight database. The database
+ type to start is obtained from the currently
+ configured database.
+
+ schemaupdate: Populate the database with a schema by running
+ Hibernate schemaupdate against the currently
+ configured database.
+ </echo>
+ </target>
+
+