blob: 524f465dacf9d836a079f6abb09f6f707840032c [file] [log] [blame]
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-->
<!-- $Id$ -->
<project name="commons-dbcp" default="test" basedir=".">
<target name="init">
<tstamp/>
<!-- read properties from the build.properties, if any -->
<property name="component-propfile" value="${basedir}/build.properties"/>
<property file="${component-propfile}"/>
<!-- read properties from the commons build.properties, if any -->
<property name="commons-propfile" value="${basedir}/../build.properties"/>
<property file="${commons-propfile}"/>
<!-- read properties from the ${user.home}/propfile, if any -->
<property name="user-propfile" value="${user.home}/build.properties"/>
<property file="${user-propfile}"/>
<property name="commons-pool.jar" value="${basedir}/../pool/dist/commons-pool.jar"/>
<!-- command line classpath, if any -->
<property name="cp" value=""/>
<!-- now combine the classpaths -->
<property name="classpath"
value="${cp}:${commons-pool.jar}:${jdbc20ext.jar}:${junit.jar}:
${naming-common.jar}:${naming-java.jar}:${commons-logging.jar}:
${xerces.jar}:${xml-apis.jar}"/>
<property name="name" value="commons-dbcp"/>
<property name="title" value="Jakarta Commons Database Pooling Package"/>
<property name="version" value="Nightly-${DSTAMP}${TSTAMP}"/>
<property name="package" value="org.apache.commons.dbcp.*"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="build.test-classes.dir" value="${build.dir}/test-classes"/>
<property name="dist.dir" value="${basedir}/dist"/>
<property name="dist.jar" value="${dist.dir}/${name}.jar"/>
<property name="test.entry" value="org.apache.commons.dbcp.TestAll"/>
<property name="test.failonerror" value="true" />
<property name="test.runner" value="junit.textui.TestRunner" />
<property name="javadoc.dir" value="${dist.dir}/docs/api"/>
<property name="javadoc.bottom" value="&lt;small&gt;Copyright &amp;copy; 2001-2004 Apache Software Foundation. Documenation generated ${TODAY}&lt;/small&gt;."/>
<property name="javadoc.overview" value="${basedir}/src/java/org/apache/commons/dbcp/overview.html"/>
<property name="javac.optimize" value="false"/>
<property name="javac.debug" value="true"/>
<property name="javac.deprecation" value="false"/>
<property name="javac.source" value="1.4" />
<available property="jndi.present" classname="javax.naming.Context"/>
<available property="jdbc3.present" classname="java.sql.Savepoint"/>
</target>
<!-- ######################################################### -->
<target name="clean" depends="init" description="removes generated files">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="prepare-nojdbc3" depends="init" unless="jdbc3.present">
<echo message="Commenting out the jdbc3 additional methods since JDBC 3 was not detected."/>
<property name="src.dir" value="${build.dir}/src"/>
<property name="src.java.dir" value="${src.dir}/java"/>
<property name="src.test.dir" value="${src.dir}/test"/>
<mkdir dir="${src.dir}"/>
<copy todir="${src.dir}" filtering="yes">
<fileset dir="${basedir}/src" defaultexcludes="no">
<include name="**/*.java"/>
<include name="**/*.xml"/>
<include name="**/*.properties"/>
<include name="**/*.jocl"/>
<include name="**/package.html"/>
</fileset>
</copy>
<replace dir="${src.dir}" token="/* JDBC_3_ANT_KEY_BEGIN */" value="/*"/>
<replace dir="${src.dir}" token="/* JDBC_3_ANT_KEY_END */" value="*/"/>
</target>
<target name="prepare-jdbc3" depends="init" if="jdbc3.present">
<echo message="JDBC 3 was detected."/>
<property name="src.dir" value="${basedir}/src"/>
<property name="src.java.dir" value="${src.dir}/java"/>
<property name="src.test.dir" value="${src.dir}/test"/>
</target>
<target name="prepare" depends="init,prepare-nojdbc3,prepare-jdbc3"/>
<target name="javadoc" depends="prepare" description="generates javadocs">
<mkdir dir="${javadoc.dir}"/>
<javadoc packagenames="org.*"
sourcepath="${src.java.dir}"
classpath="${classpath}"
destdir="${javadoc.dir}"
windowtitle="${title}"
doctitle="${title}"
bottom="${javadoc.bottom}"
overview="${javadoc.overview}"
public="true"
version="true"
author="true"
splitindex="false"
nodeprecated="true"
nodeprecatedlist="true"
notree="true"
noindex="false"
nohelp="true"
nonavbar="false"
serialwarn="false">
<link href="http://java.sun.com/j2se/1.5.0/docs/api"/>
<link href="http://jakarta.apache.org/commons/pool/apidocs"/>
</javadoc>
</target>
<!-- ######################################################### -->
<target name="compile" depends="prepare" description="compiles source files">
<mkdir dir="${build.classes.dir}"/>
<javac destdir="${build.classes.dir}"
srcdir="${src.java.dir}"
classpath="${classpath}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
optimize="${javac.optimize}"
source="${javac.source}">
<exclude name="org/apache/commons/dbcp/BasicDataSourceFactory.java"
unless="jndi.present"/>
<exclude name="org/apache/commons/dbcp/datasources/**"
unless="jndi.present"/>
<exclude name="org/apache/commons/dbcp/cpdsadapter/**"
unless="jndi.present"/>
</javac>
</target>
<target name="compile-test" depends="compile">
<mkdir dir="${build.test-classes.dir}"/>
<javac destdir="${build.test-classes.dir}"
srcdir="${src.test.dir}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
optimize="${javac.optimize}"
source="${javac.source}">
<classpath>
<pathelement location="${build.classes.dir}" />
<pathelement location="${build.test-classes.dir}" />
<pathelement path="${classpath}" />
</classpath>
</javac>
<copy todir="${build.test-classes.dir}" file="${src.test.dir}/testpool.jocl"/>
</target>
<target name="test" depends="compile-test" description="runs (junit) unit tests">
<java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
<arg value="${test.entry}"/>
<classpath>
<pathelement location="${build.classes.dir}" />
<pathelement location="${build.test-classes.dir}" />
<pathelement path="${classpath}" />
</classpath>
</java>
</target>
<target name="build-jar" depends="compile">
<mkdir dir="${dist.dir}"/>
<jar jarfile="${dist.jar}">
<fileset dir="${build.classes.dir}"/>
<metainf dir="${basedir}" includes="LICENSE.txt,NOTICE.txt"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Package" value="${package}"/>
<attribute name="Extension-Name" value="${name}"/>
<attribute name="Specification-Vendor" value="Apache Software Foundation"/>
<attribute name="Specification-Title" value="${title}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
</manifest>
</jar>
</target>
<target name="build" depends="clean,build-jar,javadoc">
<copy todir="${dist.dir}" file="${basedir}/LICENSE.txt"/>
<copy todir="${dist.dir}" file="${basedir}/NOTICE.txt"/>
<copy todir="${dist.dir}" file="${basedir}/README.txt"/>
</target>
<target name="dist" depends="build" description="gump target"/>
</project>