<project name="MyProject" default="init" basedir=".">
        <property name="projectname" value="projectcddb"/>
        <property name="teamname" value="thegroup"/>
	<property name="src" value="src"/>
	<property name="class" value="class"/>
        <property name="doc" value="doc"/>
        <property name="test" value="test"/>
        <property name="ejb" value="lib/ejb-2_1-api.jar"/>
        <property name="junit" value="tools/junit3.8.1/junit.jar"/>
	
        <target name="clean" description="deletes the build directory for a clean compile">
                <!-- Deletes the class directory for a clean build -->
                <delete dir="${class}"/>
        </target>
               
	<target name="init" description="create the build directory used for compile">
		<!-- Create the build directory used for compile -->
		<mkdir dir="${class}"/>
	</target>

	<target name="build" depends="init" description="compile the source">
		<!-- Compile the java code from ${src} into ${class} -->
		<javac srcdir="${src}" destdir="${class}">
                        <classpath>
                                <pathelement path="openejb/lib/ejb-2.0.jar"/>
                                <pathelement path="openejb/lib/jndi_1.2.1.jar"/>
                                <pathelement path="openejb/dist/openejb_server-0.9.2.jar"/>
                                <pathelement path="openejb/dist/openejb_client-0.9.2.jar"/>
                                <pathelement path="openejb/dist/openejb-0.9.2.jar"/>
                                <pathelement path="${ejb}"/>
                                <pathelement path="${class}"/>
                        </classpath>
                </javac>
	</target>

	<target name="run" depends="build" description="run the project">
		<!-- Run the project -->
		<java classname="thegroup.projectcddb.server.MultiServer">
                        <classpath>
                                <pathelement path="openejb/lib/ejb-2.0.jar"/>
                                <pathelement path="openejb/lib/jndi_1.2.1.jar"/>
                                <pathelement path="openejb/dist/openejb_server-0.9.2.jar"/>
                                <pathelement path="openejb/dist/openejb_client-0.9.2.jar"/>
                                <pathelement path="openejb/dist/openejb-0.9.2.jar"/>
                                <pathelement path="${ejb}"/>
                                <pathelement path="${class}"/>
                        </classpath>
                </java>
	</target>
        
        <target name="javadoc" description="create javadocs for the project">
                <!-- Javadoc the project -->
                <javadoc destdir="doc/javadoc" sourcepath="src" classpath="${class}:${ejb}" packagenames="${teamname}.${projectname}.*"/>
        </target>
        
        <target name="jarExecutable" depends="build" description="jar the executable files">
                <!-- Jar the executable files only -->
                <jar jarfile="${projectname}.jar" basedir="${class}"/>
        </target>
        
        <target name="jarTurnin" depends="build,jarExecutable,javadoc" description="jars all files that will be turned in">
                <!-- Jar all files that will be turned in with project -->
                <jar jarfile="${teamname}.jar" basedir=".">
                        <include name="doc/**"/>
                        <include name="src/**"/>
                        <include name="class/**"/>
                        <include name="test/**"/>
                        <include name="lib/**"/>
			<include name="./**"/>
                        
                </jar>
        </target>
        
        <target name="test" depends="build" description="run all the junit tests">
                <!-- Run all the junit tests, but compile first -->
			<javac srcdir="${test}" destdir="${test}" source="1.4">
                        <classpath>
                                <pathelement path="openejb/lib/ejb-2.0.jar"/>
                                <pathelement path="openejb/lib/jndi_1.2.1.jar"/>
                                <pathelement path="openejb/dist/openejb_server-0.9.2.jar"/>
                                <pathelement path="openejb/dist/openejb_client-0.9.2.jar"/>
                                <pathelement path="openejb/dist/openejb-0.9.2.jar"/>
                                <pathelement path="${ejb}"/>
                                <pathelement path="${test}"/>
					  			<pathelement path="${junit}"/>
                                <pathelement path="${class}"/>
                        </classpath>
                </javac>
		<java classname="thegroup.projectcddb.AllTests" fork="true">
                        <classpath>
                                <pathelement path="openejb/lib/ejb-2.0.jar"/>
                                <pathelement path="openejb/lib/jndi_1.2.1.jar"/>
                                <pathelement path="openejb/dist/openejb_server-0.9.2.jar"/>
                                <pathelement path="openejb/dist/openejb_client-0.9.2.jar"/>
                                <pathelement path="openejb/dist/openejb-0.9.2.jar"/>
                                <pathelement path="${ejb}"/>
                                <pathelement path="${test}"/>
					  			<pathelement path="${junit}"/>
                                <pathelement path="${class}"/>
                        </classpath>
				<arg value="-g -ea"/>
                </java>
        </target>
</project>