| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<project name="JDBM" default="all" basedir=".."> |
| 3 |
|
| 4 |
<target name="init"> |
| 5 |
<property name="project" value="jdbm" /> |
| 6 |
<property name="source" value="./src" /> |
| 7 |
<property name="main" value="${source}/main" /> |
| 8 |
<property name="etc" value="${source}/etc" /> |
| 9 |
<property name="build" value="build" /> |
| 10 |
<property name="classes" value="${build}/classes" /> |
| 11 |
<property name="test-classes" value="${build}/test-classes" /> |
| 12 |
<property name="dist" value="dist" /> |
| 13 |
<property name="lib" value="lib" /> |
| 14 |
<property name="doc" value="${source}/doc" /> |
| 15 |
<property name="schema" value="${source}/schema" /> |
| 16 |
<property name="test" value="${build}/test" /> |
| 17 |
|
| 18 |
<property name="classpath" value="${classpath}:${classes}" /> |
| 19 |
<property name="build.compiler" value="modern" /> |
| 20 |
<property name="deprecation" value="true" /> |
| 21 |
<property file="VERSION" /> |
| 22 |
<property name="version" value="unspecified" description="default value; should never happen"/> |
| 23 |
<property name="archive" value="${project}-${version}" /> |
| 24 |
</target> |
| 25 |
|
| 26 |
|
| 27 |
<!-- Display all the targets --> |
| 28 |
<target name="targets"> |
| 29 |
<echo message=""/> |
| 30 |
<echo message="ANT build for ${project} ${version}"/> |
| 31 |
<echo message=""/> |
| 32 |
<echo message="The following targets are available:"/> |
| 33 |
<echo message=" targets Lists the build targets"/> |
| 34 |
<echo message=" clean Cleans the build and distribution directories"/> |
| 35 |
<echo message=" all Cleans and builds all the packages and examples"/> |
| 36 |
<echo message=" release Cleans and builds all the release packages"/> |
| 37 |
<echo message=" (JAR, source, doc, tarball) in the dist directory"/> |
| 38 |
<echo message=" main Builds the main packages (including debugging info)"/> |
| 39 |
<echo message=" examples Builds the example packages (including debugging info)"/> |
| 40 |
<echo message=" tests Builds the test packages (including debugging info)"/> |
| 41 |
<echo message=" tests.run Runs unit tests" /> |
| 42 |
<echo message=" jar Builds the binary JAR in the dist directory"/> |
| 43 |
<echo message=" doc Builds the documentation"/> |
| 44 |
<echo message=" api Builds the API JavaDocs"/> |
| 45 |
<echo message=" javadoc Builds the full JavaDocs"/> |
| 46 |
<echo message=" source Builds the source tarball in the dist directory"/> |
| 47 |
<echo message=" tarball Builds the binary distribution in the dist directory"/> |
| 48 |
<echo message=" cvs Update the sources from the CVS"/> |
| 49 |
<echo message=""/> |
| 50 |
</target> |
| 51 |
|
| 52 |
|
| 53 |
<!-- Prepare target directories --> |
| 54 |
<target name="prepare" depends="init"> |
| 55 |
<mkdir dir="${build}"/> |
| 56 |
<mkdir dir="${classes}"/> |
| 57 |
<mkdir dir="${dist}"/> |
| 58 |
<mkdir dir="${test}"/> |
| 59 |
</target> |
| 60 |
|
| 61 |
<!-- Kill all the directories created in prepare --> |
| 62 |
<target name="clean" depends="init"> |
| 63 |
<delete dir="${test}"/> |
| 64 |
<delete dir="${build}"/> |
| 65 |
<delete dir="${dist}"/> |
| 66 |
</target> |
| 67 |
|
| 68 |
|
| 69 |
<!-- Build all the sources with debug and deprecation --> |
| 70 |
<target name="main" depends="prepare"> |
| 71 |
<javac srcdir="${main}" destdir="${classes}" excludes="**/package.html" |
| 72 |
classpath="${classpath}" debug="on" deprecation="${deprecation}" source="1.3" target="1.3"/> |
| 73 |
</target> |
| 74 |
|
| 75 |
<!-- Same as main, but also cleans and additional targets --> |
| 76 |
<target name="all" depends="clean,main,examples,jar"/> |
| 77 |
|
| 78 |
<!-- Run the unit tests --> |
| 79 |
<target name="tests.run" depends="tests"> |
| 80 |
<!-- showoutput 'yes' to allow outputting debug msgs... --> |
| 81 |
<junit fork="no" printsummary="yes" haltonfailure="no" |
| 82 |
showoutput="yes"> |
| 83 |
<batchtest fork="no" todir="${test}"> |
| 84 |
<fileset dir="${test-classes}"> |
| 85 |
<include name="**/Test*.class"/> |
| 86 |
</fileset> |
| 87 |
</batchtest> |
| 88 |
<formatter type="xml" /> |
| 89 |
<classpath> |
| 90 |
<pathelement path="${classes}" /> |
| 91 |
<pathelement path="${test-classes}" /> |
| 92 |
</classpath> |
| 93 |
</junit> |
| 94 |
|
| 95 |
<junitreport todir="${build}/test"> |
| 96 |
<fileset dir="${build}/test"> |
| 97 |
<include name="TEST-*.xml" /> |
| 98 |
</fileset> |
| 99 |
<report todir="${build}/test" /> |
| 100 |
</junitreport> |
| 101 |
</target> |
| 102 |
|
| 103 |
<!-- Build the example packages --> |
| 104 |
<target name="examples" depends="main"> |
| 105 |
<mkdir dir="${build}/examples" /> |
| 106 |
<javac srcdir="${source}/examples" destdir="${build}/examples" |
| 107 |
classpath="${classpath}" debug="on" deprecation="${deprecation}" /> |
| 108 |
</target> |
| 109 |
|
| 110 |
<!-- Build the test packages --> |
| 111 |
<target name="tests" depends="main"> |
| 112 |
<mkdir dir="${test-classes}" /> |
| 113 |
<javac srcdir="${source}/tests" destdir="${test-classes}" |
| 114 |
classpath="${classpath}" debug="on" deprecation="${deprecation}" /> |
| 115 |
</target> |
| 116 |
|
| 117 |
<!-- Build the JAR file using main --> |
| 118 |
<target name="jar" depends="main"> |
| 119 |
<delete file="${dist}/${archive}.jar" /> |
| 120 |
|
| 121 |
<copy file="${etc}/MANIFEST.MF" tofile="${classes}/MANIFEST.MF" /> |
| 122 |
<replace file="${classes}/MANIFEST.MF" token="$$VERSION$$" value="${version}" /> |
| 123 |
<copy todir="${classes}"> |
| 124 |
<fileset dir="." includes="LICENSE.txt,CHANGES.txt,README.txt" /> |
| 125 |
</copy> |
| 126 |
|
| 127 |
<jar jarfile="${dist}/${archive}.jar" basedir="${classes}" |
| 128 |
manifest="${classes}/MANIFEST.MF" includes="LICENSE.txt,README.txt,CHANGES.txt,jdbm/**" /> |
| 129 |
</target> |
| 130 |
|
| 131 |
|
| 132 |
<!-- Build the full JavaDocs --> |
| 133 |
<target name="javadoc" depends="prepare"> |
| 134 |
<mkdir dir="${build}/doc" /> |
| 135 |
<mkdir dir="${build}/doc/javadoc" /> |
| 136 |
<property name="copyright" |
| 137 |
value="Cees de Groot (C) 2000-2001. All rights reserved http://jdbm.sourceforge.net" /> |
| 138 |
<javadoc sourcepath="${main}" destdir="${build}/doc/javadoc" |
| 139 |
doctitle="JDBM JavaDoc" windowtitle="JDBM JavaDoc" bottom="${copyright}" |
| 140 |
package="true" author="true" version="true" noindex="true" |
| 141 |
packagenames="jdbm.*"> |
| 142 |
<link href="http://java.sun.com/products/jdk/1.2/docs/api"/> |
| 143 |
<link href="http://www.junit.org/junit/javadoc/3.8"/> |
| 144 |
</javadoc> |
| 145 |
</target> |
| 146 |
|
| 147 |
<!-- Build the API JavaDocs --> |
| 148 |
<target name="api" depends="prepare"> |
| 149 |
<mkdir dir="${build}/doc" /> |
| 150 |
<mkdir dir="${build}/doc/api" /> |
| 151 |
<property name="copyright" |
| 152 |
value="Cees de Groot (C) 2000. All rights reserved http://jdbm.sourceforge.net" /> |
| 153 |
<javadoc sourcepath="${main}" destdir="${build}/doc/api" |
| 154 |
doctitle="JDBM JavaDoc" windowtitle="JDBM JavaDoc" bottom="${copyright}" |
| 155 |
public="true" author="true" |
| 156 |
packagenames="jdbm.*"> |
| 157 |
<link href="http://java.sun.com/products/jdk/1.2/docs/api"/> |
| 158 |
</javadoc> |
| 159 |
</target> |
| 160 |
|
| 161 |
<!-- Build the docs, API and full JavaDocs, doc archives --> |
| 162 |
<!-- Note CdG: Removed doc dependency, we don't have it yet... --> |
| 163 |
<target name="docs" depends="api,javadoc"> |
| 164 |
<zip zipfile="${dist}/${archive}-doc.zip" basedir="${build}" includes="doc/**" /> |
| 165 |
<tar tarfile="${dist}/${archive}-doc.tar" basedir="${build}" includes="doc/**" /> |
| 166 |
<gzip src="${dist}/${archive}-doc.tar" zipfile="${dist}/${archive}-doc.tgz" /> |
| 167 |
<delete file="${dist}/${archive}-doc.tar" /> |
| 168 |
</target> |
| 169 |
|
| 170 |
|
| 171 |
<!-- Build the source distribution --> |
| 172 |
<target name="source" depends="prepare"> |
| 173 |
<delete file="${dist}/${archive}-src.tgz" /> |
| 174 |
<delete file="${dist}/${archive}-src.zip" /> |
| 175 |
<delete dir="${build}/${archive}" /> |
| 176 |
|
| 177 |
<mkdir dir="${build}/${archive}" /> |
| 178 |
<mkdir dir="${build}/${archive}/src" /> |
| 179 |
<copy todir="${build}/${archive}/src"> |
| 180 |
<fileset dir="${source}"/> |
| 181 |
</copy> |
| 182 |
<mkdir dir="${build}/${archive}/lib" /> |
| 183 |
<copy todir="${build}/${archive}/lib"> |
| 184 |
<fileset dir="${lib}"/> |
| 185 |
</copy> |
| 186 |
<copy todir="${build}/${archive}"> |
| 187 |
<fileset dir="${source}" includes="*.sh,*.bat"/> |
| 188 |
</copy> |
| 189 |
|
| 190 |
<tar includes="${archive}/**" basedir="${build}" |
| 191 |
tarfile="${dist}/${archive}-src.tar" /> |
| 192 |
<gzip src="${dist}/${archive}-src.tar" zipfile="${dist}/${archive}-src.tgz"/> |
| 193 |
<delete file="${dist}/${archive}-src.tar" /> |
| 194 |
<zip zipfile="${dist}/${archive}-src.zip" basedir="${build}" |
| 195 |
includes="${archive}/**" /> |
| 196 |
|
| 197 |
</target> |
| 198 |
|
| 199 |
|
| 200 |
<!-- Build a full release including JAR, zip/tarball, source and documentation --> |
| 201 |
<target name="release" depends="clean,jar,source,docs,tarball"> |
| 202 |
</target> |
| 203 |
|
| 204 |
<!-- Build the tarball including JAR and all dependent packages --> |
| 205 |
<target name="tarball" depends="prepare,jar,docs"> |
| 206 |
<delete file="${dist}/${archive}.tgz" /> |
| 207 |
<delete file="${dist}/${archive}.zip" /> |
| 208 |
<delete dir="${build}/${archive}" /> |
| 209 |
|
| 210 |
<mkdir dir="${build}/${archive}" /> |
| 211 |
<copy todir="${build}/${archive}"> |
| 212 |
<fileset dir="." includes="README.txt,LICENSE.txt,CHANGES.txt" /> |
| 213 |
</copy> |
| 214 |
<copy todir="${build}/${archive}/lib"> |
| 215 |
<fileset dir="${dist}" includes="${archive}.jar" /> |
| 216 |
</copy> |
| 217 |
<copy todir="${build}/${archive}/doc"> |
| 218 |
<fileset dir="${build}/doc/api" includes="**"/> |
| 219 |
</copy> |
| 220 |
|
| 221 |
<copy todir="${build}/${archive}"> |
| 222 |
<fileset dir="${source}" includes="examples/**"/> |
| 223 |
</copy> |
| 224 |
|
| 225 |
<tar tarfile="${dist}/${archive}.tar" basedir="${build}" |
| 226 |
includes="${archive}/**" excludes="${archive}/*.tar,${archive}/*.zip" /> |
| 227 |
<gzip src="${dist}/${archive}.tar" zipfile="${dist}/${archive}.tgz" /> |
| 228 |
<delete file="${dist}/${archive}.tar" /> |
| 229 |
|
| 230 |
<zip zipfile="${dist}/${archive}.zip" basedir="${build}" |
| 231 |
includes="${archive}/**" excludes="${archive}/*.tar,${archive}/*.tgz" /> |
| 232 |
</target> |
| 233 |
|
| 234 |
|
| 235 |
<!-- Update the sources from the CVS --> |
| 236 |
<target name="cvs" depends="clean"> |
| 237 |
<cvs cvsRoot=":pserver:[email protected]:/cvs/${project}" |
| 238 |
dest="." package="${project}" /> |
| 239 |
</target> |
| 240 |
|
| 241 |
|
| 242 |
</project> |
| 243 |
|