|
| 1 | +<!-- |
| 2 | +/* |
| 3 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 4 | + * or more contributor license agreements. See the NOTICE file |
| 5 | + * distributed with this work for additional information |
| 6 | + * regarding copyright ownership. The ASF licenses this file |
| 7 | + * to you under the Apache License, Version 2.0 (the |
| 8 | + * "License"); you may not use this file except in compliance |
| 9 | + * with the License. You may obtain a copy of the License at |
| 10 | + * |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | + * |
| 13 | + * Unless required by applicable law or agreed to in writing, |
| 14 | + * software distributed under the License is distributed on an |
| 15 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | + * KIND, either express or implied. See the License for the |
| 17 | + * specific language governing permissions and limitations |
| 18 | + * under the License. |
| 19 | + */ |
| 20 | + --> |
| 21 | + |
| 22 | +<!-- $Id: build.xml 887831 2009-12-07 03:56:29Z psteitz $ --> |
| 23 | +<project name="commons-dbcp" default="test" basedir="."> |
| 24 | + |
| 25 | + <target name="init"> |
| 26 | + <tstamp/> |
| 27 | + |
| 28 | + <!-- read properties from the build.properties, if any --> |
| 29 | + <property name="component-propfile" value="${basedir}/build.properties"/> |
| 30 | + <property file="${component-propfile}"/> |
| 31 | + |
| 32 | + <!-- read properties from the commons build.properties, if any --> |
| 33 | + <property name="commons-propfile" value="${basedir}/../build.properties"/> |
| 34 | + <property file="${commons-propfile}"/> |
| 35 | + |
| 36 | + <!-- read properties from the ${user.home}/propfile, if any --> |
| 37 | + <property name="user-propfile" value="${user.home}/build.properties"/> |
| 38 | + <property file="${user-propfile}"/> |
| 39 | + |
| 40 | + <property name="commons-pool.jar" value="${basedir}/../pool/dist/commons-pool.jar"/> |
| 41 | + |
| 42 | + <!-- command line classpath, if any --> |
| 43 | + <property name="cp" value=""/> |
| 44 | + |
| 45 | + <!-- now combine the classpaths --> |
| 46 | + <property name="classpath" |
| 47 | + value="${cp}:${commons-pool.jar}:${junit.jar}: |
| 48 | + ${naming-common.jar}:${naming-java.jar}:${commons-logging.jar}: |
| 49 | + ${xerces.jar}:${jta-spec.jar}:${jta-impl.jar}: |
| 50 | + ${backport-util-concurrent.jar}:${ejb-spec.jar}"/> |
| 51 | + |
| 52 | + <property name="name" value="commons-dbcp"/> |
| 53 | + <property name="title" value="Apache Commons Database Pooling Package"/> |
| 54 | + <property name="version" value="1.3"/> |
| 55 | + <property name="package" value="org.apache.commons.dbcp.*"/> |
| 56 | + |
| 57 | + <property name="build.dir" value="${basedir}/build"/> |
| 58 | + <property name="build.classes.dir" value="${build.dir}/classes"/> |
| 59 | + <property name="build.test-classes.dir" value="${build.dir}/test-classes"/> |
| 60 | + <property name="dist.dir" value="${basedir}/dist"/> |
| 61 | + <property name="dist.jar" value="${dist.dir}/${name}.jar"/> |
| 62 | + |
| 63 | + <property name="test.entry" value="org.apache.commons.dbcp.TestAll"/> |
| 64 | + <property name="test.failonerror" value="true" /> |
| 65 | + <property name="test.runner" value="junit.textui.TestRunner" /> |
| 66 | + |
| 67 | + <property name="javadoc.dir" value="${dist.dir}/docs/api"/> |
| 68 | + <property name="javadoc.bottom" value="<small>Copyright &copy; 2001-2009 Apache Software Foundation. Documenation generated ${TODAY}</small>."/> |
| 69 | + <property name="javadoc.overview" value="${basedir}/src/java/org/apache/commons/dbcp/overview.html"/> |
| 70 | + |
| 71 | + <property name="javac.optimize" value="false"/> |
| 72 | + <property name="javac.debug" value="true"/> |
| 73 | + <property name="javac.deprecation" value="false"/> |
| 74 | + <property name="javac.source" value="1.4" /> |
| 75 | + |
| 76 | + <available property="jndi.present" classname="javax.naming.Context"/> |
| 77 | + </target> |
| 78 | + |
| 79 | + <target name="check_jar"> |
| 80 | + <available file="${file}" property="found"/> |
| 81 | + <antcall target="check_message"/> |
| 82 | + </target> |
| 83 | + |
| 84 | + <target name="check_message" unless="found"> |
| 85 | + <!-- echo could be replaced with fail if required --> |
| 86 | + <echo message="Could not find ${file}"/> |
| 87 | + </target> |
| 88 | + |
| 89 | + <!-- Check that all the dependencies exist --> |
| 90 | + <target name="check_depends" depends="init"> |
| 91 | + <echo>Checking dependencies</echo> |
| 92 | + <antcall target="check_jar"> |
| 93 | + <param name="file" value="${commons-pool.jar}"/> |
| 94 | + </antcall> |
| 95 | + <antcall target="check_jar"> |
| 96 | + <param name="file" value="${junit.jar}"/> |
| 97 | + </antcall> |
| 98 | + <antcall target="check_jar"> |
| 99 | + <param name="file" value="${naming-common.jar}"/> |
| 100 | + </antcall> |
| 101 | + <antcall target="check_jar"> |
| 102 | + <param name="file" value="${naming-java.jar}"/> |
| 103 | + </antcall> |
| 104 | + <antcall target="check_jar"> |
| 105 | + <param name="file" value="${commons-logging.jar}"/> |
| 106 | + </antcall> |
| 107 | + <antcall target="check_jar"> |
| 108 | + <param name="file" value="${xerces.jar}"/> |
| 109 | + </antcall> |
| 110 | + <antcall target="check_jar"> |
| 111 | + <param name="file" value="${jta-spec.jar}"/> |
| 112 | + </antcall> |
| 113 | + <antcall target="check_jar"> |
| 114 | + <param name="file" value="${jta-impl.jar}"/> |
| 115 | + </antcall> |
| 116 | + <antcall target="check_jar"> |
| 117 | + <param name="file" value="${backport-util-concurrent.jar}"/> |
| 118 | + </antcall> |
| 119 | + <antcall target="check_jar"> |
| 120 | + <param name="file" value="${ejb-spec.jar}"/> |
| 121 | + </antcall> |
| 122 | + </target> |
| 123 | + |
| 124 | + <!-- ######################################################### --> |
| 125 | + |
| 126 | + <target name="clean" depends="init" description="removes generated files"> |
| 127 | + <delete dir="${build.dir}"/> |
| 128 | + <delete dir="${dist.dir}"/> |
| 129 | + </target> |
| 130 | + |
| 131 | + <target name="filter-sources"> |
| 132 | + <echo message="Comment out the jdbc4 additional methods."/> |
| 133 | + <property name="src.dir" value="${basedir}/src"/> |
| 134 | + <property name="src.java.dir" value="${src.dir}/java"/> |
| 135 | + <property name="src.test.dir" value="${src.dir}/test"/> |
| 136 | + |
| 137 | + <replace dir="${src.java.dir}" token="/* JDBC_4_ANT_KEY_BEGIN */" value="/*"/> |
| 138 | + <replace dir="${src.java.dir}" token="/* JDBC_4_ANT_KEY_END */" value="*/"/> |
| 139 | + |
| 140 | + <replace dir="${src.test.dir}" token="/* JDBC_4_ANT_KEY_BEGIN */" value="/*"/> |
| 141 | + <replace dir="${src.test.dir}" token="/* JDBC_4_ANT_KEY_END */" value="*/"/> |
| 142 | + </target> |
| 143 | + |
| 144 | + <target name="prepare" depends="init,filter-sources"/> |
| 145 | + |
| 146 | + <target name="javadoc" depends="prepare" description="generates javadocs"> |
| 147 | + <mkdir dir="${javadoc.dir}"/> |
| 148 | + <javadoc packagenames="org.*" |
| 149 | + sourcepath="${src.java.dir}" |
| 150 | + classpath="${classpath}" |
| 151 | + destdir="${javadoc.dir}" |
| 152 | + windowtitle="${title}" |
| 153 | + doctitle="${title}" |
| 154 | + bottom="${javadoc.bottom}" |
| 155 | + overview="${javadoc.overview}" |
| 156 | + public="true" |
| 157 | + version="true" |
| 158 | + author="true" |
| 159 | + splitindex="false" |
| 160 | + nodeprecated="true" |
| 161 | + nodeprecatedlist="true" |
| 162 | + notree="true" |
| 163 | + noindex="false" |
| 164 | + nohelp="true" |
| 165 | + nonavbar="false" |
| 166 | + serialwarn="false"> |
| 167 | + <link href="http://java.sun.com/j2se/1.5.0/docs/api"/> |
| 168 | + <link href="http://commons.apache.org/pool/apidocs"/> |
| 169 | + </javadoc> |
| 170 | + </target> |
| 171 | + |
| 172 | + <!-- ######################################################### --> |
| 173 | + |
| 174 | + <target name="compile" depends="check_depends,prepare" description="compiles source files"> |
| 175 | + <mkdir dir="${build.classes.dir}"/> |
| 176 | + <javac destdir="${build.classes.dir}" |
| 177 | + srcdir="${src.java.dir}" |
| 178 | + classpath="${classpath}" |
| 179 | + debug="${javac.debug}" |
| 180 | + deprecation="${javac.deprecation}" |
| 181 | + optimize="${javac.optimize}" |
| 182 | + source="${javac.source}"> |
| 183 | + <exclude name="org/apache/commons/dbcp/BasicDataSourceFactory.java" |
| 184 | + unless="jndi.present"/> |
| 185 | + <exclude name="org/apache/commons/dbcp/datasources/**" |
| 186 | + unless="jndi.present"/> |
| 187 | + <exclude name="org/apache/commons/dbcp/cpdsadapter/**" |
| 188 | + unless="jndi.present"/> |
| 189 | + </javac> |
| 190 | + </target> |
| 191 | + |
| 192 | + <target name="compile-test" depends="compile"> |
| 193 | + <mkdir dir="${build.test-classes.dir}"/> |
| 194 | + <javac destdir="${build.test-classes.dir}" |
| 195 | + srcdir="${src.test.dir}" |
| 196 | + debug="${javac.debug}" |
| 197 | + deprecation="${javac.deprecation}" |
| 198 | + optimize="${javac.optimize}" |
| 199 | + source="${javac.source}"> |
| 200 | + <classpath> |
| 201 | + <pathelement location="${build.classes.dir}" /> |
| 202 | + <pathelement location="${build.test-classes.dir}" /> |
| 203 | + <pathelement path="${classpath}" /> |
| 204 | + </classpath> |
| 205 | + </javac> |
| 206 | + <copy todir="${build.test-classes.dir}" file="${src.test.dir}/testpool.jocl"/> |
| 207 | + </target> |
| 208 | + |
| 209 | + <target name="test" depends="compile-test" description="runs (junit) unit tests"> |
| 210 | + <echo message="${classpath}"/> |
| 211 | + <junit printsummary="true" showoutput="true" fork="yes" haltonfailure="${test.failonerror}"> |
| 212 | + <classpath> |
| 213 | + <pathelement location="${build.classes.dir}" /> |
| 214 | + <pathelement location="${build.test-classes.dir}" /> |
| 215 | + <pathelement path="${classpath}" /> |
| 216 | + </classpath> |
| 217 | + <formatter type="plain" usefile="false" /> |
| 218 | + <test name="${test.entry}"/> |
| 219 | + </junit> |
| 220 | + </target> |
| 221 | + |
| 222 | + <target name="build-jar" depends="compile"> |
| 223 | + <mkdir dir="${dist.dir}"/> |
| 224 | + <jar jarfile="${dist.jar}"> |
| 225 | + <fileset dir="${build.classes.dir}"/> |
| 226 | + <metainf dir="${basedir}" includes="LICENSE.txt,NOTICE.txt"/> |
| 227 | + <manifest> |
| 228 | + <attribute name="Built-By" value="${user.name}"/> |
| 229 | + <attribute name="Package" value="${package}"/> |
| 230 | + <attribute name="Extension-Name" value="${name}"/> |
| 231 | + <attribute name="Specification-Vendor" value="Apache Software Foundation"/> |
| 232 | + <attribute name="Specification-Title" value="${title}"/> |
| 233 | + <attribute name="Implementation-Version" value="${version}"/> |
| 234 | + <attribute name="Implementation-Vendor" value="Apache Software Foundation"/> |
| 235 | + </manifest> |
| 236 | + </jar> |
| 237 | + </target> |
| 238 | + |
| 239 | + <target name="build" depends="clean,build-jar,javadoc"> |
| 240 | + <copy todir="${dist.dir}" file="${basedir}/LICENSE.txt"/> |
| 241 | + <copy todir="${dist.dir}" file="${basedir}/NOTICE.txt"/> |
| 242 | + <copy todir="${dist.dir}" file="${basedir}/README.txt"/> |
| 243 | + </target> |
| 244 | + |
| 245 | + <target name="dist" depends="build" description="gump target"/> |
| 246 | + |
| 247 | +</project> |
0 commit comments