24.2. Build (local.build.xml)

A file named local.build.xml in the top-level of a module directory defines the Ant tasks and properties necessary to integrate this module into the Hackystat build system. This extension point requires the file to be named "local.build.xml" in order to be recognized by the build system. Unlike other extension point definition files, the build system does not relocate this file during the build process, which is why all modules can use the same name for this file.

Example 24.1, “local.build.xml” illustrates an example build definition file for the hackySdt_DevEvent module.

Example 24.1. local.build.xml

<project name="hackySdt_DevEvent.local" default="hackySdt_DevEvent.default">
  <description>
  Provides the DevEvent sensor data type, which records development events.
  </description>

  <dirname property="hackySdt_DevEvent.local.basedir" file="${ant.file.hackySdt_DevEvent.local}" />
  <property name="hackySdt_DevEvent.src.dir" location="${hackySdt_DevEvent.local.basedir}/src" />
  <property name="hackySdt_DevEvent.required.modules"  value="hackyCore_Telemetry"/>

  <!-- Classpath used for javac,javadoc. -->
  <path id="hackySdt_DevEvent.classpath">
    <pathelement location="${install.war.web-inf.classes.dir}" />
    <pathelement location="${tomcat.servlet.jar}" />
    <fileset dir="${install.war.web-inf.lib.dir}">
      <include name="*.jar" />
    </fileset>
  </path>

  <target name="hackySdt_DevEvent.compile" if="hackySdt_DevEvent.available" 
    description="Compiles changed classes to WEB-INF/classes directory.">
    <hackyCore_Build.javac srcdir="${hackySdt_DevEvent.src.dir}">
      <classpath refid="hackySdt_DevEvent.classpath" />
    </hackyCore_Build.javac>
  </target>

  <target name="hackySdt_DevEvent.install.pre-sensorshell" if="hackySdt_DevEvent.available" 
    description="Copy over web app definitions and the test data sets.">
    <!-- Install SDT, sensor, docbook, jsp, html, files to webapp. -->
    <makeUpdateWebAppContent module.src.dir="${hackySdt_DevEvent.src.dir}" />

    <!-- If this module contains telemetry code, use this to install it. -->
    <hackyCore_Telemetry.installXmlDefinitions module.src.dir="${hackySdt_DevEvent.src.dir}" />

    <!-- If this module contains test data, use code like the following to copy it over. -->
    <copy todir="${install.testdataset.dir}" preservelastmodified="true">
      <fileset dir="${hackySdt_DevEvent.src.dir}/org/hackystat/sdt/devevent/testdataset" />
    </copy>
  </target>

  <target name="hackySdt_DevEvent.junit" if="hackySdt_DevEvent.available" description="Runs JUnit.">
    <makeJUnit module.name="hackySdt_DevEvent" module.package.prefix="org.hackystat.sdt.devevent"/>
    <makeEcho message="Completed hackySdt_DevEvent.junit." prefix="hackySdt_DevEvent.junit" />
  </target>

  <target name="hackySdt_DevEvent.default" description="Does nothing. Required by Ant." />
</project>

The local.build.xml file specifies a number of targets and properties necessary for the DevEvent sensor data type to be built and installed properly.