ciform/ant-jsunit-hieatt/trunk/build.xml
2008-09-21 11:07:21 +00:00

159 lines
5.2 KiB
XML

<!--
Build script for the project "ant-jsunit-hieatt".
This script is an Ant script using Ivy extension to resolve dependencies.
You will need both Ant (http://ant.apache.org/) and Ivy (http://ant.apache.org/ivy) to use it.
TODO ? organise build files in /tests/, /bin/, ... so we can package easily ?
-->
<project name="ant-jsunit-hieatt" default="verify"
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors">
<!-- ==================== -->
<!-- Settings -->
<!-- ==================== -->
<!-- custom, user specific, properties -->
<property file="local.properties"/>
<!-- default properties -->
<property file="build.properties"/>
<!-- Source path : sources and resources -->
<path id="srcpath">
<dirset dir="${src.dir}">
<include name="java"/>
<include name="resources"/>
</dirset>
<dirset dir="${tests.dir}">
<include name="java"/>
<include name="javascript"/>
</dirset>
</path>
<!-- Resources only -->
<path id="rc.files">
<fileset dir="${src.dir}/java" excludes="**/*.java"/>
<fileset dir="${src.dir}/resources" excludes="**/*.java"/>
<fileset dir="${tests.dir}/java" excludes="**/*.java"/>
<fileset dir="${tests.dir}/javascript" excludes="**/*.java"/>
</path>
<!-- Classpath for Java operations -->
<path id="lib.files">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<exclude name="jsunit/java/lib/ant.jar"/>
<exclude name="jsunit/java/lib/junit.jar"/>
</fileset>
</path>
<!-- ==================== -->
<!-- Public targets : they are greatly inspired from the Maven build lifecycle -->
<!-- ==================== -->
<target name="clean" description="Restores the initial state of the project, deleting any generated file.">
<delete includeemptydirs="true" dir="${target.dir}"/>
<delete includeemptydirs="true" dir="${build.dir}"/>
</target>
<target name="validate" description="Validates the project is correct and all necessary information is available.">
<!-- Retreives dependencies with ivy -->
<ivy:retrieve/>
<!-- Creates necessary directories -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${tests.logs}"/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${target.dir}" />
</target>
<target name="compile" depends="validate" description="Compiles the source code of the project.">
<javac destdir="${classes.dir}" classpathref="lib.files" source="1.4" debug="true">
<src refid="srcpath" />
</javac>
<!-- Copies all remaining files (= all files under the source tree, except Java sources) to the build dir. -->
<copy todir="${classes.dir}">
<path refid="rc.files"/>
</copy>
</target>
<!-- NOTE : These tests should not require the code be packaged or deployed. -->
<target name="test" depends="compile" description="Tests the compiled source code using a suitable unit testing framework.">
<junit fork="false" haltonerror="true" haltonfailure="true">
<sysproperty key="jsunit.testRunner" value="${jsunit.testRunner}" />
<sysproperty key="jsunit.coreJs" value="${jsunit.coreJs}" />
<sysproperty key="logsDirectory" value="${tests.logs}" />
<sysproperty key="browserFileNames" value="${jsunit.browsers}" />
<classpath>
<path refid="lib.files" />
<pathelement path="${classes.dir}"/>
<!-- TODO : make the following a parameter -->
<dirset dir="${jsunit.dir}/java/config"/>
</classpath>
<test name="net.jsunit.TestLibRunnerTest" todir="${tests.logs}">
<formatter type="brief" usefile="false" />
<formatter type="xml" />
</test>
</junit>
</target>
<target name="package" depends="test, doc" description="Takes the compiled code and package it in its distributable format.">
<jar destfile="${target.dir}/${ant.project.name}-${ivy.revision}.jar"
basedir="${classes.dir}">
<include name="**/*"/>
</jar>
</target>
<target name="integration-test" depends="package" description="Processes and deploys the package if necessary into an environment where integration tests can be run.">
<!-- nothing to do -->
</target>
<target name="verify" depends="integration-test" description="Runs any checks to verify the package is valid and meets quality criteria.">
<!-- nothing to do -->
</target>
<target name="install" depends="verify" description="Installs the package into the local repository, for use as a dependency in other projects locally.">
<!-- nothing to do -->
</target>
<target name="deploy" depends="verify" description="Done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.">
<!-- nothing to do -->
</target>
<!-- ==================== -->
<!-- Internal targets -->
<!-- ==================== -->
<!-- Generates developer documentation. -->
<target name="doc" depends="validate">
</target>
</project>