<project name="c3p0" default="dist">

	<!-- ignore the CLASSPATH environment variable. force builds to specify classpaths -->
	<property name="build.sysclasspath" value="ignore" />

	<property file="private/build.properties" />
	<property file="build.properties" />
	<property file="version.properties" />

	<property name="c3p0.name" value="c3p0-${c3p0.version}" />
	<property name="bindist.name" value="${c3p0.name}.bin" />
	<property name="srcdist.name" value="${c3p0.name}.src" />
	<property name="src.dir" value="src" />
	<property name="empty.src.dir" value="${src.dir}/empty" />
	<property name="java.src.dir" value="${src.dir}/classes" />
	<property name="rsrc.src.dir" value="${src.dir}/resources" />
	<property name="codegen.src.dir" value="${src.dir}/codegen" />
	<property name="doc.src.dir" value="${src.dir}/doc" />
	<property name="docwebapp.src.dir" value="${src.dir}/docweb/docwebapp" />
	<property name="docwebear.src.dir" value="${src.dir}/docweb/docwebear" />
	<property name="static.dist.src" value="${src.dir}/dist-static" />
	<property name="relproj.dir" value="relproj" />
	<property name="relproj.dist.dir" value="${relproj.dir}/dist" />
	<property name="test.props.dir" value="test-properties" />
	<property name="test.logging.props.file" location="${test.props.dir}/logging.properties" />
	<property name="build.dir" value="build" />
	<property name="build.codegen.dir"     value="${build.dir}/codegen" />
	<property name="build.classes.dir"     value="${build.dir}/classes" />
	<property name="build.apidocs.dir"     value="${build.dir}/apidocs" />
	<property name="build.docwebapp.dir"   value="${build.dir}/docweb/docwebapp" />
	<property name="build.docwebear.dir"   value="${build.dir}/docweb/docwebear" />
	<property name="build.testresults.dir" value="${build.dir}/testresults" />
	<property name="dbms.dir" value="dbms" />
	<property name="dbms.oracle.thin.antproj.dir" value="${dbms.dir}/oracle-thin" />
	<property name="dbms.oracle.thin.antproj.dist.dir" value="${dbms.oracle.thin.antproj.dir}/dist" />
	<property name="test.classes.dir" value="${build.dir}/testclasses" />
	<property name="dist.dir" value="dist" />
	<property name="license.header.file" value="src/legal.prepend" />
	<property name="build.jar.file" value="build/${c3p0.name}.jar" />
	<property name="open.dist" value="${dist.dir}/${bindist.name}" />
	<property name="open.dist.doc.dir" value="${open.dist}/doc" />
	<property name="open.dist.lib.dir" value="${open.dist}/lib" />
	<property name="docwebapp.war.file.name" value="docweb.war" />
	<property name="docwebapp.war.file" value="${build.docwebear.dir}/${docwebapp.war.file.name}" />
	<property name="docwebear.file" value="${build.dir}/c3p0-docweb.ear" />

	<!-- these properties should be set externally if desired  -->
	<!-- we set them here only to keep classpaths valid -->
	<!-- when users do not set the path                         -->
	<property name="j2ee.jar.base.dir" value="${empty.src.dir}" />
	<property name="j2ee.jar.dir"      value="${empty.src.dir}" />

	<!--
   <property name="log4j.jar.file" value="" />
   <property name="junit.jar.file" value="" />
  -->

	<!-- these properties should often be preempted in build.properties -->
	<property name="c3p0-build.debug" value="false" />
	<property name="c3p0-build.trace" value="5" />

	<property name="c3p0.target.version" value="1.3" />

	<path id="codegen-classpath">
		<pathelement location="${build.classes.dir}" />
		<pathelement path="${j2ee.classpath}" />
		<fileset dir="${j2ee.jar.base.dir}" includes="**/*.jar" />
		<fileset dir="${j2ee.jar.dir}" includes="*.jar" />
	</path>

	<property name="codegen.classpath" refid="codegen-classpath" />

	<path id="build-classpath">
		<pathelement location="${build.classes.dir}" />
		<pathelement path="${j2ee.classpath}" />
		<fileset dir="${j2ee.jar.base.dir}" includes="**/*.jar" />
		<fileset dir="${j2ee.jar.dir}" includes="*.jar" />
	</path>

	<patternset id="init-codegen-classes">
		<include name="com/mchange/v2/c3p0/codegen/**/*.java" />
		<include name="com/mchange/v2/codegen/**/*.java" />
		<include name="com/mchange/v2/log/*.java" />
		<include name="com/mchange/v2/cfg/*.java" />
		<include name="com/mchange/v2/io/IndentedWriter.java" />
		<include name="com/mchange/v1/util/StringTokenizerUtils.java" />
		<exclude name="**/bad/**" />
		<exclude name="**/old/**" />
	</patternset>

	<patternset id="dist-jar-classes">
		<!-- excludes stuff only used by the code generator and by tests-->
		<exclude name="com/mchange/v2/codegen/bean/*.java" />
		<exclude name="com/mchange/v2/codegen/*.java" />
		<exclude name="com/mchange/v2/debug/DebugGen.java" />
		<exclude name="com/mchange/v1/lang/ClassUtils.java" />
		<exclude name="com/mchange/v1/lang/GentleThread.java" />
		<exclude name="com/mchange/v1/lang/NullUtils.java" />
		<exclude name="com/mchange/v1/lang/Synchronizer.java" />
		<exclude name="com/mchange/v1/lang/TVLUtils.java" />
		<exclude name="com/mchange/v1/jvm/**" />
		<exclude name="com/mchange/v1/lang/holders/**" />
		<exclude name="com/mchange/v2/c3p0/codegen/**" />
		<exclude name="com/mchange/v2/c3p0/test/**" />
		<exclude name="**/junit/**" />
		<exclude name="**/*JUnitTestCase.*" />
		<exclude name="**/bad/**" />
		<exclude name="**/old/**" />
	</patternset>

	<patternset id="test-only-classes">
		<include name="com/mchange/v2/c3p0/test/**" />
		<include name="**/junit/**" />
		<include name="**/*JUnitTestCase.class" />
	</patternset>

	<path id="test-classpath">
		<pathelement location="${test.props.dir}" />
		<pathelement location="${build.jar.file}" />
		<pathelement location="${test.classes.dir}" />
		<pathelement path="${j2ee.classpath}" />
		<fileset dir="${j2ee.jar.base.dir}" includes="**/*.jar" />
		<fileset dir="${j2ee.jar.dir}" includes="*.jar" />
		<pathelement location="${test.jdbc.driver.jar.file}" />
		<pathelement location="${log4j.jar.file}" />
	</path>

	<target name="init">
		<tstamp>
			<!-- <format property="c3p0.timestamp" pattern="dd-MMMM-yyyy HH:mm:ss Z"/> -->
			<format property="c3p0.timestamp" pattern="dd-MMMM-yyyy HH:mm:ss"/>
			<!-- jdk 1.3 compatible -->
		</tstamp>

		<mkdir dir="${build.dir}" />
		<mkdir dir="${build.codegen.dir}" />
		<mkdir dir="${build.classes.dir}" />
		<mkdir dir="${build.apidocs.dir}" />
		<mkdir dir="${dist.dir}" />
	</target>

	<target name="clean" depends="dbms-oracle-thin-clean">
		<delete dir="${build.dir}" />
		<delete dir="${dist.dir}" />
	</target>

	<target name="relproj" depends="init">
		<ant dir="${relproj.dir}" target="dist" inheritAll="false" />
	</target>

	<target name="init-debuggen" depends="relproj">
		<uptodate property="up-to-date-debugs" 
                srcfile="build.properties"
                targetfile="${build.codegen.dir}/com/mchange/Debug.java" />
	</target>

	<target name="debuggen" depends="init-debuggen" unless="up-to-date-debugs">
		<java classname="com.mchange.v2.debug.DebugGen" fork="true" dir=".">
			<sysproperty key="com.mchange.v2.log.MLog" value="com.mchange.v2.log.FallbackMLog" />
			<classpath>
				<fileset dir="${relproj.dist.dir}">
					<include name="*.jar" />
				</fileset>
			</classpath>
			<arg value="--packages=com.mchange" />
			<arg value="--codebase=src/classes" />
			<arg value="--outputbase=${build.codegen.dir}" />
			<arg value="--recursive" />
			<arg value="--debug=${c3p0-build.debug}" />
			<arg value="--trace=${c3p0-build.trace}" />
		</java>
	</target>

	<target name="subst">
		<copy todir="${build.codegen.dir}">
			<fileset dir="${java.src.dir}">
				<include name="**/subst/**" />
			</fileset>
			<filterchain>
				<replacetokens>
					<token key="c3p0.version"     value="${c3p0.version}"/>
					<token key="c3p0.debug"     value="${c3p0-build.debug}"/>
					<token key="c3p0.trace"     value="${c3p0-build.trace}"/>
					<token key="c3p0.timestamp" value="${c3p0.timestamp}"/>

					<!-- NO LONGER USED THIS WAY junit test stuff only 
	     <token key="test.jdbc.drivers" value="${test.jdbc.drivers}" />
	     <token key="test.jdbc.url" value="${test.jdbc.url}" />
	     <token key="test.jdbc.user" value="${test.jdbc.user}" />
	     <token key="test.jdbc.password" value="${test.jdbc.password}" />
	     -->
				</replacetokens>
			</filterchain>
		</copy>
	</target>

	<target name="init-codegen" depends="debuggen,subst">
		<javac destdir="${build.classes.dir}" 
	     source="${c3p0.target.version}"
	     target="${c3p0.target.version}"
             classpathref="codegen-classpath"
             debug="true">
			<src>
				<pathelement location="${build.codegen.dir}" />
				<pathelement location="${java.src.dir}" />
			</src>
			<patternset refid="init-codegen-classes" />
		</javac>

		<uptodate property="up-to-date-proxies" 
                srcfile="${java.src.dir}/com/mchange/v2/c3p0/codegen/JdbcProxyGenerator.java"
                targetfile="${build.codegen.dir}/com/mchange/v2/c3p0/impl/NewProxyConnection.java" />
	</target>


	<target name="beangen" depends="init-codegen">
		<apply executable="java" dest="${build.codegen.dir}">
			<arg value="-Dcom.mchange.v2.log.MLog=com.mchange.v2.log.FallbackMLog" />
			<arg value="-classpath" />
			<arg path="${codegen.classpath}" />
			<arg value="com.mchange.v2.c3p0.codegen.BeangenDataSourceGenerator" />
			<srcfile />
			<targetfile />
			<fileset dir="${codegen.src.dir}" includes="**/*.beangen-xml">
				<exclude name="**/bad/**" />
				<exclude name="**/old/**" />
				<exclude name="private/**" />
			</fileset>
			<mapper type="glob" from="*.beangen-xml" to="*.java" />
		</apply>
	</target>

	<target name="newproxygen" depends="init-codegen" unless="up-to-date-proxies">
		<java classname="com.mchange.v2.c3p0.codegen.JdbcProxyGenerator" fork="true" dir=".">
			<sysproperty key="com.mchange.v2.log.MLog" value="com.mchange.v2.log.FallbackMLog" />
			<classpath refid="codegen-classpath" />
			<arg value="${build.codegen.dir}" />
		</java>
	</target>

	<target name="codegen" depends="beangen,newproxygen" />

	<target name="compile-common" depends="codegen">
		<javac destdir="${build.classes.dir}" 
	     source="${c3p0.target.version}"
	     target="${c3p0.target.version}"
             classpathref="build-classpath" 
             debug="on">
			<sourcepath>
				<pathelement location="${build.codegen.dir}" />
				<pathelement location="${java.src.dir}" />
			</sourcepath>
			<src>
				<pathelement location="${build.codegen.dir}" />
				<pathelement location="${java.src.dir}" />
			</src>
			<exclude name="**/junit/**" />
			<exclude name="**/*JUnitTestCase.*" />
			<exclude name="**/subst/**" />
			<exclude name="com/mchange/v2/log/log4j/**" />
		</javac>
	</target>

	<target name="compile-subst" depends="codegen">
		<javac destdir="${build.classes.dir}" 
	     source="${c3p0.target.version}"
	     target="${c3p0.target.version}"
             classpathref="build-classpath" 
             debug="on">
			<sourcepath>
				<pathelement location="${build.codegen.dir}" />
			</sourcepath>
			<src>
				<pathelement location="${build.codegen.dir}" />
			</src>
			<include name="**/subst/**" />
		</javac>
	</target>

	<target name="compile-log4j" depends="init" if="log4j.jar.file">
		<javac destdir="${build.classes.dir}" 
	     source="${c3p0.target.version}"
	     target="${c3p0.target.version}"
             debug="on">
			<classpath>
				<path refid="build-classpath" />
				<pathelement location="${log4j.jar.file}" />
			</classpath>
			<sourcepath>
				<pathelement location="${build.codegen.dir}" />
				<pathelement location="${java.src.dir}" />
			</sourcepath>
			<src>
				<pathelement location="${build.codegen.dir}" />
				<pathelement location="${java.src.dir}" />
			</src>
			<include name="com/mchange/v2/log/log4j/**" />
		</javac>
	</target>

	<target name="compile-junit" depends="init" if="junit.jar.file">
		<javac destdir="${build.classes.dir}" 
	     source="${c3p0.target.version}"
	     target="${c3p0.target.version}"
             debug="on">
			<classpath>
				<path refid="build-classpath" />
				<pathelement path="${junit.jar.file}" />
			</classpath>
			<sourcepath>
				<pathelement location="${build.codegen.dir}" />
				<pathelement location="${java.src.dir}" />
			</sourcepath>
			<src>
				<pathelement location="${build.codegen.dir}" />
				<pathelement location="${java.src.dir}" />
			</src>
			<include name="**/junit/**" />
			<include name="**/*JUnitTestCase.*" />
		</javac>
	</target>

	<target name="compile" depends="codegen,compile-common,compile-subst,compile-log4j,compile-junit">
	</target>

	<target name="jar" depends="compile">
		<jar destfile="${build.jar.file}">
			<manifest>
				<attribute name="Extension-Name" value="com.mchange.v2.c3p0" />
				<attribute name="Specification-Vendor" value="Machinery For Change, Inc." />
				<attribute name="Specification-Version" value="1.0" />
				<attribute name="Implementation-Vendor-Id" value="com.mchange" />
				<attribute name="Implementation-Vendor" value="Machinery For Change, Inc." />
				<attribute name="Implementation-Version" value="${c3p0.version}" />
			</manifest>
			<fileset dir="${build.classes.dir}">
				<patternset refid="dist-jar-classes"/>
			</fileset>
			<fileset dir="${rsrc.src.dir}" />
		</jar>
	</target>

	<target name="dbms-oracle-thin-ant">
		<ant dir="${dbms.oracle.thin.antproj.dir}" target="${subproject.target}" inheritAll="false">
			<property name="c3p0.version" value="${c3p0.version}" />
			<property name="c3p0.jar.file" location="${build.jar.file}" />
			<property name="oracle-thin.jdbc.jar.file" value="${oracle-thin.jdbc.jar.file}" />
		</ant>
	</target>

	<target name="dbms-oracle-thin-clean">
		<antcall target="dbms-oracle-thin-ant">
			<param name="subproject.target" value="clean" />
		</antcall>
	</target>

	<target name="dbms-oracle-thin" depends="jar" if="oracle-thin.jdbc.jar.file">
		<echo message="oracle-thin.jdbc.jar.file: ${oracle-thin.jdbc.jar.file}" />
		<antcall target="dbms-oracle-thin-ant">
			<param name="subproject.target" value="dist" />
		</antcall>
	</target>

	<target name="test-init" depends="jar">
		<mkdir dir="${test.classes.dir}" />
		<copy toDir="${test.classes.dir}">
			<fileset dir="${build.classes.dir}">
				<patternset refid="test-only-classes"/>
			</fileset>
		</copy>
		<property name="testcp" refid="test-classpath" />
		<echo message="test-classpath: ${testcp}" />
	</target>

	<target name="stats-test" depends="test-init">
		<java 
         classname="com.mchange.v2.c3p0.test.StatsTest" 
         classpathref="test-classpath" 
	 fork="true">
			<sysproperty key="jdbc.drivers" value="${test.jdbc.drivers}" />
			<sysproperty key="java.util.logging.config.file" value="${test.logging.props.file}" />
			<syspropertyset>
				<propertyref builtin="commandline" />
			</syspropertyset>

			<!--
           <jvmarg value="-ea" />
	   <sysproperty key="com.sun.management.jmxremote.port" value="38383" />
	   <sysproperty key="com.sun.management.jmxremote.authenticate" value="false" />
	   <sysproperty key="com.sun.management.jmxremote.ssl" value="false" />
	   -->

			<!-- <jvmarg value="-Xrunhprof:file=/tmp/java.hprof,doe=y,format=b" /> -->
			<!-- <jvmarg value="-verbose:class" /> -->
			<arg value="${test.jdbc.url}" />
			<arg value="${test.jdbc.user}" />
			<arg value="${test.jdbc.password}" />
		</java>
	</target>

	<target name="proxywrapper-test" depends="test-init">
		<java 
         classname="com.mchange.v2.c3p0.test.ProxyWrappersTest" 
         classpathref="test-classpath" 
	 	 fork="true">
			<sysproperty key="jdbc.drivers" value="${test.jdbc.drivers}" />
			<sysproperty key="java.util.logging.config.file" value="${test.logging.props.file}" />
			<syspropertyset>
				<propertyref builtin="commandline" />
			</syspropertyset>
			<!-- <jvmarg value="-Xrunhprof:file=/tmp/java.hprof,doe=y,format=b" /> -->
			<!-- <jvmarg value="-verbose:class" /> -->
			<arg value="${test.jdbc.url}" />
			<arg value="${test.jdbc.user}" />
			<arg value="${test.jdbc.password}" />
		</java>
	</target>

	<target name="benchmark-test" depends="test-init">
		<java 
         classname="com.mchange.v2.c3p0.test.C3P0BenchmarkApp" 
         classpathref="test-classpath" 
	 	 fork="true">
			<!-- <jvmarg value="-Xrunhprof:cpu=times,file=/tmp/java.hprof,doe=y,format=a" /> -->
			<!-- <jvmarg value="-server" /> -->
			<!-- <jvmarg value="-Xprof" /> -->
			<!-- <jvmarg value="-verbose:class" /> -->

			<sysproperty key="java.util.logging.config.file" value="${test.logging.props.file}" />

			<jvmarg value="-ea" />
			<sysproperty key="com.sun.management.jmxremote.port" value="38383" />
			<sysproperty key="com.sun.management.jmxremote.authenticate" value="false" />
			<sysproperty key="com.sun.management.jmxremote.ssl" value="false" />

			<syspropertyset>
				<propertyref builtin="commandline" />
			</syspropertyset>
<!--
			<sysproperty key="jdbc.drivers" value="${test.jdbc.drivers}" />
			<arg value="${test.jdbc.url}" />
			<arg value="${test.jdbc.user}" />
			<arg value="${test.jdbc.password}" />
-->
		</java>
	</target>

	<target name="rco-test" depends="test-init">
		<java 
         classname="com.mchange.v2.c3p0.test.RawConnectionOpTest" 
         classpathref="test-classpath" 
	 	 fork="true">
			<!-- <jvmarg value="-Xrunhprof:cpu=times,file=/tmp/java.hprof,doe=y,format=a" /> -->
			<!-- <jvmarg value="-Xprof" /> -->
			<sysproperty key="jdbc.drivers" value="${test.jdbc.drivers}" />
			<sysproperty key="java.util.logging.config.file" value="${test.logging.props.file}" />
			<syspropertyset>
				<propertyref builtin="commandline" />
			</syspropertyset>

			<!--
           <jvmarg value="-ea" />
	   <sysproperty key="com.sun.management.jmxremote.port" value="38383" />
	   <sysproperty key="com.sun.management.jmxremote.authenticate" value="false" />
	   <sysproperty key="com.sun.management.jmxremote.ssl" value="false" />
	   -->

			<arg value="${test.jdbc.url}" />
			<arg value="${test.jdbc.user}" />
			<arg value="${test.jdbc.password}" />
		</java>
	</target>

	<target name="load-test" depends="test-init">
		<java 
         classname="com.mchange.v2.c3p0.test.LoadPoolBackedDataSource" 
         classpathref="test-classpath" 
	 fork="true">
			<sysproperty key="jdbc.drivers" value="${test.jdbc.drivers}" />
			<sysproperty key="java.util.logging.config.file" value="${test.logging.props.file}" />
			<syspropertyset>
				<propertyref builtin="commandline" />
			</syspropertyset>

			<!--
           <jvmarg value="-ea" />
	   <sysproperty key="com.sun.management.jmxremote.port" value="38383" />
	   <sysproperty key="com.sun.management.jmxremote.authenticate" value="false" />
	   <sysproperty key="com.sun.management.jmxremote.ssl" value="false" />
	   -->

			<arg value="${test.jdbc.url}" />
			<arg value="${test.jdbc.user}" />
			<arg value="${test.jdbc.password}" />
		</java>
	</target>

	<target name="psload-test" depends="test-init">
		<java 
         classname="com.mchange.v2.c3p0.test.PSLoadPoolBackedDataSource" 
         classpathref="test-classpath" 
	 fork="true">
			<sysproperty key="jdbc.drivers" value="${test.jdbc.drivers}" />
			<sysproperty key="java.util.logging.config.file" value="${test.logging.props.file}" />
			<syspropertyset>
				<propertyref builtin="commandline" />
			</syspropertyset>

			<!--
           <jvmarg value="-ea" />
	   <sysproperty key="com.sun.management.jmxremote.port" value="38383" />
	   <sysproperty key="com.sun.management.jmxremote.authenticate" value="false" />
	   <sysproperty key="com.sun.management.jmxremote.ssl" value="false" />
	   -->

			<arg value="${test.jdbc.url}" />
			<arg value="${test.jdbc.user}" />
			<arg value="${test.jdbc.password}" />
		</java>
	</target>

	<target name="dispersion-test" depends="test-init">
		<java 
         classname="com.mchange.v2.c3p0.test.ConnectionDispersionTest" 
         classpathref="test-classpath" 
	 fork="true">
			<sysproperty key="jdbc.drivers" value="${test.jdbc.drivers}" />
			<sysproperty key="java.util.logging.config.file" value="${test.logging.props.file}" />
			<syspropertyset>
				<propertyref builtin="commandline" />
			</syspropertyset>
			<arg value="${test.jdbc.url}" />
			<arg value="${test.jdbc.user}" />
			<arg value="${test.jdbc.password}" />
		</java>
	</target>

	<target name="onethreadrepeat-test" depends="test-init">
		<java 
         classname="com.mchange.v2.c3p0.test.OneThreadRepeatedInsertOrQueryTest" 
         classpathref="test-classpath" 
	 fork="true">
			<sysproperty key="jdbc.drivers" value="${test.jdbc.drivers}" />
			<sysproperty key="java.util.logging.config.file" value="${test.logging.props.file}" />
			<syspropertyset>
				<propertyref builtin="commandline" />
			</syspropertyset>
			<arg value="${test.jdbc.url}" />
			<arg value="${test.jdbc.user}" />
			<arg value="${test.jdbc.password}" />
		</java>
	</target>

	<target name="refser-test" depends="test-init">
		<java 
         classname="com.mchange.v2.c3p0.test.TestRefSerStuff" 
         classpathref="test-classpath" 
	 fork="true">
			<sysproperty key="jdbc.drivers" value="${test.jdbc.drivers}" />
			<sysproperty key="java.util.logging.config.file" value="${test.logging.props.file}" />
			<syspropertyset>
				<propertyref builtin="commandline" />
			</syspropertyset>
			<arg value="${test.jdbc.url}" />
			<arg value="${test.jdbc.user}" />
			<arg value="${test.jdbc.password}" />
		</java>
	</target>

	<target name="junit-tests" depends="test-init" if="junit.jar.file">
		<mkdir dir="${build.testresults.dir}" />
		<junit printsummary="true" showoutput="true" haltonfailure="true">
			<classpath refid="test-classpath" />
			<formatter type="plain"/>
			<sysproperty key="jdbc.drivers" value="${test.jdbc.drivers}" />
			<sysproperty key="c3p0.test.jdbc.url" value="${test.jdbc.url}" />
			<sysproperty key="c3p0.test.jdbc.user" value="${test.jdbc.user}" />
			<sysproperty key="c3p0.test.jdbc.password" value="${test.jdbc.password}" />
			<syspropertyset>
				<propertyref builtin="commandline" />
			</syspropertyset>
			<batchtest fork="yes" toDir="${build.testresults.dir}">
				<fileset dir="${build.classes.dir}">
					<include name="**/*JUnitTestCase.class"/>
				</fileset>
			</batchtest>
		</junit>

		<!--
	 <junit printsummary="withOutAndErr" >
	   <test name="com.mchange.v2.c3p0.test.junit.MiscellaneousTopLevelJUnitTestCase"/>
	   <classpath refid="test-classpath" />
	   <formatter type="plain"/>
	 </junit>
	-->
	</target>

	<target name="javadocs" depends="init">
		<javadoc packagenames="com.mchange.v2.c3p0"
               sourcepath="${java.src.dir}"
               destdir="${build.apidocs.dir}" 
               classpathref="build-classpath" 
               windowtitle="${c3p0.name} API Documentation"
      />
	</target>

	<target name="basic-open-dist" depends="jar, javadocs">
		<copy toDir="${open.dist}">
			<fileset dir="${static.dist.src}">
				<exclude name="*~" />
				<exclude name="examples/*.class" />
				<exclude name="**/old/**" />
				<exclude name="**/bad/**" />
				<exclude name="**/private/**" />
			</fileset>
		</copy>
		<mkdir dir="${open.dist.doc.dir}/apidocs" />
		<copy toDir="${open.dist.doc.dir}">
			<fileset dir="${doc.src.dir}" excludes="*.png"/>
			<filterchain>
				<replacetokens>
					<token key="c3p0.version" value="${c3p0.version}"/>
				</replacetokens>
			</filterchain>
		</copy>
		<copy toDir="${open.dist.doc.dir}">
			<fileset dir="${doc.src.dir}" includes="*.png"/>
		</copy>
		<copy toDir="${open.dist.doc.dir}/apidocs">
			<fileset dir="${build.apidocs.dir}" />
		</copy>
		<copy file="${build.jar.file}" toDir="${open.dist.lib.dir}" />
	</target>

	<target name="docwebapp" depends="basic-open-dist">
		<mkdir dir="${build.docwebapp.dir}" />
		<copy toDir="${build.docwebapp.dir}">
			<fileset dir="${docwebapp.src.dir}"/>
			<filterchain>
				<replacetokens>
					<token key="virtual.host" value="${docwebapp.virtual.host}"/>
				</replacetokens>
			</filterchain>
		</copy>
	</target>

	<target name="docwebear" depends="docwebapp">
		<mkdir dir="${build.docwebear.dir}" />
		<copy toDir="${build.docwebear.dir}">
			<fileset dir="${docwebear.src.dir}"/>
			<filterchain>
				<replacetokens>
					<token key="web.uri" value="${docwebapp.war.file.name}"/>
					<token key="context.root" value="${docwebapp.context.root}"/>
				</replacetokens>
			</filterchain>
		</copy>
		<jar destfile="${docwebapp.war.file}">
			<zipfileset dir="${build.docwebapp.dir}" />
			<zipfileset dir="${open.dist.doc.dir}" />
		</jar>
		<jar destfile="${docwebear.file}">
			<zipfileset dir="${build.docwebear.dir}" />
		</jar>
	</target>

	<target name="docwebear-deploy" depends="docwebear">
		<exec executable="scp">
			<arg line="${docwebear.file} ${docwebear.deploy.user}@${docwebear.deploy.host}:${docwebear.deploy.path}" />
		</exec>
	</target>

	<target name="oracle-thin-open-dist" depends="basic-open-dist, dbms-oracle-thin"  if="oracle-thin.jdbc.jar.file">
		<copy toDir="${open.dist}">
			<fileset dir="${dbms.oracle.thin.antproj.dist.dir}" />
		</copy>
	</target>

	<target name="open-dist" depends="basic-open-dist, oracle-thin-open-dist" />

	<target name="zip-dist" depends="open-dist">
		<zip destfile="${dist.dir}/${bindist.name}.zip">
			<zipfileset dir="${open.dist}" prefix="${c3p0.name}"/>
		</zip>
	</target>

	<target name="tar-dist" depends="open-dist">
		<tar destfile="${dist.dir}/${bindist.name}.tar">
			<tarfileset dir="${open.dist}" prefix="${c3p0.name}"/>
		</tar>
	</target>

	<target name="tgz-dist" depends="tar-dist">
		<gzip zipfile="${dist.dir}/${bindist.name}.tgz" src="${dist.dir}/${bindist.name}.tar" />
	</target>

	<target name="bindist" depends="tgz-dist, zip-dist" />

	<target name="dist" depends="bindist" />

	<target name="srcdist" depends="init">
		<zip destfile="${dist.dir}/${srcdist.name}.zip">
			<zipfileset dir="." prefix="${srcdist.name}">
				<exclude name="${build.dir}/**"/>
				<exclude name="${dist.dir}/**"/>
				<exclude name="**/*.class"/>
				<exclude name="**/old/**"/>
				<exclude name="**/bad/**"/>
				<exclude name="**/private/**"/>
			</zipfileset>
		</zip>
		<tar destfile="${dist.dir}/${srcdist.name}.tar">
			<tarfileset dir="." prefix="${srcdist.name}">
				<exclude name="${build.dir}/**"/>
				<exclude name="${dist.dir}/**"/>
				<exclude name="**/*.class"/>
				<exclude name="**/old/**"/>
				<exclude name="**/bad/**"/>
				<exclude name="**/private/**"/>
			</tarfileset>
		</tar>
		<gzip zipfile="${dist.dir}/${srcdist.name}.tgz" src="${dist.dir}/${srcdist.name}.tar" />
	</target>

	<target name="all" depends="dist,srcdist" />

</project>

