<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project [<!ENTITY buildfile SYSTEM "file:./build-user.xml">]>
<!-- WARNING: Eclipse autogenerated file. 
              Any modifications will be overwritten.
              Please edit build-user.xml instead.
-->

<!-- This file has been heavily modified by
     Peter Deschere
     Jason Fillo
-->

<!-- Many of the additional files (the lib directory and *.*.xml files) are required for hibernate to work -->
     
<project basedir="." default="menu" name="BB">
    &buildfile;

    <property name="JUNIT_HOME" value="/usr/local/software/apps/eclipse/plugins/org.junit_3.8.1"/>
    <property file="global.properties" />
    <property environment="env"/>

    <path id="project.classpath">
        <pathelement location="."/>
        <pathelement location="${JUNIT_HOME}/junit.jar"/>
        <pathelement location="${porsche.hibernate.dir}/antlr-2.7.6rc1.jar"/>
        <pathelement location="${porsche.hibernate.dir}/asm.jar"/>
        <pathelement location="${porsche.hibernate.dir}/asm-attrs.jar"/>
        <pathelement location="${porsche.hibernate.dir}/cglib-2.1.3.jar"/>
        <pathelement location="${porsche.hibernate.dir}/commons-collections-2.1.1.jar"/>
        <pathelement location="${porsche.hibernate.dir}/commons-logging-1.0.4.jar"/>
        <pathelement location="${porsche.hibernate.dir}/dom4j-1.6.1.jar"/>
        <pathelement location="${porsche.hibernate.dir}/hibernate3.jar"/>
        <pathelement location="${porsche.hibernate.dir}/jta.jar"/>
        <pathelement location="${porsche.hibernate.dir}/log4j-1.2.11.jar"/>
        <pathelement location="${porsche.mysql.jar}"/>

	<fileset dir="${tomcat.dir}/common/lib">
           <include name="*.jar" />
	</fileset>

	<fileset dir="${tomcat.dir}/common/endorsed">
           <include name="*.jar" />
	</fileset>
    </path>
    <target name="menu">
       <echo message="ant clean -- clear out everything but source files" />
       <echo message="ant compile -- compile the Java source" />
       <echo message="ant deploy-doc -- deploy the Javadocs" />
       <echo message="ant doc -- compile the Javadocs" />
       <echo message="ant create-war -- create a war file" />
       <echo message="ant deploy-war -- deploy the war file" />
    </target>

    <target name="init"/>
    
    <target name="clean">
       <echo message="Deleting and remaking the output directories." />

       <delete dir="${classes}" />
       <mkdir dir="${classes}" />

       <delete dir="${dist}" />
       <mkdir dir="${dist}" />

       <delete dir="${javadoc.build}" />
       <mkdir dir="${javadoc.build}" />
    </target>

    <target name="makeBuildDirectory">
       <mkdir dir="${classes}"/>
    </target>

    <target name="compile" depends="makeBuildDirectory">
        <echo message="${ant.project.name}: ${ant.file}"/>
        <javac srcdir="${src}" destdir="${classes}">
            <classpath refid="project.classpath"/>
        </javac>
        <copy todir="${classes}/src">
            <fileset dir="${src}">
                <include name="**/**/*.hbm.xml"/>
            </fileset>
        </copy>
        <copy todir="${classes}">
            <fileset dir=".">
                <include name="hibernate.cfg.xml"/>
            </fileset>
        </copy>
    </target>

    <target name="doc">
       <javadoc
          packagenames="hibernatebb.*"
	  sourcepath="${src}"
	  destdir="${javadoc.build}"
	  author="true" version="true" use="true">
          <classpath refid="project.classpath" />
       </javadoc>
    </target>

    <target name="deploy-doc" depends="doc">
       <delete dir="${javadoc.destination}" />

       <!-- copy the generated javadoc to where it should go on the web -->

       <copy todir="${javadoc.destination}">
          <fileset dir="${javadoc.build}"/>
       </copy>

       <!-- Change permissions on destination directory, and
	    all files and subdirectories under it. -->

       <chmod  perm="a+rx" >
          <dirset dir="${javadoc.destination}" />
          <fileset dir="${javadoc.destination}" />
       </chmod>
    </target>

    <target name="create-war" description="creates war file" depends="clean, compile">
       <echo message="Creating ${web-app-name}.war" />

       <war destfile="${dist}/${web-app-name}.war" webxml="${etc}/web.xml">
          <classes dir="${classes}" />
      	  <lib dir="${lib}" />
	  <fileset dir="${web}" />
          </war>
    </target>

    <target name="deploy-war" depends="create-war">
       <copy todir="${war.destination}">
          <fileset dir="${dist}">
             <include name="${web-app-name}.war" />
          </fileset>
       </copy>
    </target>

    <target name="AllTests">
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="plain"/>
            <test name="src.hibernate.unittests.AllTests"/>
            <classpath refid="project.classpath"/>
        </junit>
    </target>

    <target name="PostTest">
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="plain"/>
            <test name="src.hibernate.unittests.PostTest"/>
            <classpath refid="project.classpath"/>
        </junit>
    </target>

    <target name="TopicTest">
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="plain"/>
            <test name="src.hibernate.unittests.TopicTest"/>
            <classpath refid="project.classpath"/>
        </junit>
    </target>

    <target name="UserTest">
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="plain"/>
            <test name="src.hibernate.unittests.UserTest"/>
            <classpath refid="project.classpath"/>
        </junit>
    </target>

</project>
