<?xml version="1.0"?>

<!-- <!DOCTYPE project SYSTEM "project.dtd"> -->

<!-- 
  =======================================================================
    WebDAV projector build file                                          
  ======================================================================= 
-->
<project name="commons-contract" default="jar" basedir=".">

	<!-- Give user a chance to override without editing this file 
  (and without typing -D each time it compiles it) -->
    <property file="build.properties"/>
	<property file=".ant.properties" />

	<property name="debug" value="true" />
	<property name="deprecation" value="true" />
	<property name="optimize" value="true" />

	<property name="version" value="20050525" />
	<property name="name" value="commons-contract" />
	<!-- 
  ===================================================================
  Set the properties related to the source tree
  =================================================================== 
  -->
	<property name="src.dir" value="src" />
	<property name="java.dir" value="${src.dir}/java" />
	<property name="examples.dir" value="${src.dir}/examples" />
	<property name="lib.dir" value="lib" />
	<property name="docs.dir" value="doc" />
	<property name="dist.dir" value="dist" />
	<property name="conf.dir" value="${src.dir}/config" />

	<!-- 
  ===================================================================
  Set the properties for the build area
  =================================================================== 
  -->
	<property name="build.dir" value="build" />
	<property name="build.classes" value="${build.dir}/classes" />
	<property name="build.lib" value="${build.dir}/lib" />
	<property name="build.javadocs" value="${docs.dir}/javadoc" />

	<path id="classpath">
		<pathelement location="${build.classes}" />
		<fileset dir="${lib.dir}" includes="*.jar" />
	</path>
	<!-- 
  ===================================================================
  Prepare the build              
  =================================================================== 
  -->
	<target name="prepare">
		<tstamp />
		<mkdir dir="${build.dir}" />
		<mkdir dir="${build.classes}" />
		<mkdir dir="${build.lib}" />
	</target>
	<!-- 
  ===================================================================
  Build the code           
  =================================================================== 
  -->
	<target name="build" depends="prepare">
		<javac destdir="${build.classes}" debug="${debug}" deprecation="${deprecation}" optimize="${optimize}">
			<src path="${java.dir}" />
			<classpath refid="classpath" />
		</javac>
		<javac destdir="${build.classes}" debug="${debug}" deprecation="${deprecation}" optimize="${optimize}">
			<src path="${examples.dir}" />
			<classpath refid="classpath" />
		</javac>
	</target>

	<!-- 
  =================================================================== 
  Create the jar
  =================================================================== 
  -->
	<target name="jar" depends="build">
		<jar jarfile="${build.lib}/${name}-${version}.jar" basedir="${build.classes}">
			<include name="org/apache/commons/contract/**" />
			<exclude name="org/apache/commons/contract/example/**" />
			<fileset dir="${conf.dir}">
				<include name="constraints.xml" />
				<include name="exceptions.xml" />
				<include name="util.xml" />
			</fileset>
		</jar>
		<jar jarfile="${build.lib}/${name}-examples-${version}.jar" basedir="${build.classes}">
			<include name="org/apache/commons/contract/example/**" />
			<fileset dir="${conf.dir}">
				<include name="example.xml" />
			</fileset>
            <manifest>
              <attribute name="Built-By" value="Daniel Florey"/>
              <attribute name="Main-Class" value="org/apache/commons/contract/example/TestSpeedCalculator"/>
              <attribute name="Class-Path" value="commons-contract-20050525.jar ../../lib/commons-i18n-20050525.jar"/>
            </manifest>
		</jar>
	</target>

	<!--
  ===================================================================
  Cleans up build directories
  ===================================================================
  -->
	<target name="clean">
		<delete dir="${build.dir}" />
	</target>

	<target name="clean-javadocs">
		<delete dir="${build.javadocs}" />
	</target>

	<target name="scrub" depends="clean, clean-javadocs">
	</target>

	<!-- 
  ===================================================================
  Creates the API documentation                             
  =================================================================== 
  -->
	<target name="javadocs" depends="build, clean-javadocs" description="Creates the API documentation">
		<mkdir dir="${build.javadocs}" />
		<mkdir dir="${build.javadocs}" />
		<javadoc sourcepath="${java.dir}" packagenames="org.apache.commons.contract.*" destdir="${build.javadocs}" author="true" windowtitle="WebDAV Projector" doctitle="WebDAV Projector" link="http://java.sun.com/j2se/1.4/docs/api/" bottom="Copyright &#169; 2002-2004 Apache Software Foundation. All Rights Reserved." classpathref="classpath" />
	</target>

	<target name="all" depends="jar, javadocs" />
</project>
