|
| 1 | +<?xml version="1.0" ?> |
| 2 | + |
| 3 | + <project name="jug" basedir="." default="readme"> |
| 4 | + <property name="ProjectName" value="JUG" /> |
| 5 | + <!-- Source directories --> |
| 6 | + <property name="SrcDir" location="${basedir}/src" /> |
| 7 | + <property name="LibDir" location="${basedir}/lib" /> |
| 8 | + <property name="JavaSrcDir" location="${SrcDir}/java" /> |
| 9 | + <property name="NativeSrcDir" location="${SrcDir}/c" /> |
| 10 | + <property name="TestSrcDir" location="${SrcDir}/test" /> |
| 11 | + <property name="RelNotesDir" location="${basedir}/release-notes" /> |
| 12 | + <!-- Pre-compiled native code --> |
| 13 | + <property name="NativeLibDir" location="${basedir}/jug-native" /> |
| 14 | + <!-- Build-related --> |
| 15 | + <property name="BuildDir" location="${basedir}/build" /> |
| 16 | + <property name="BuildClassesDir" location="${BuildDir}/classes" /> |
| 17 | + <property name="BuildNativeDir" location="${BuildDir}/jug-native" /> |
| 18 | + <!-- Documentation --> |
| 19 | + <property name="DocDir" location="${basedir}/doc" /> |
| 20 | + <property name="JavaDocDir" location="${basedir}/javadoc" /> |
| 21 | + <!-- Test suite --> |
| 22 | + <property name="TestDir" location="${basedir}/test" /> |
| 23 | + <property name="TestBuildDir" location="${TestDir}/build" /> |
| 24 | + <property name="TestResultsDir" location="${TestDir}/results" /> |
| 25 | + <property name="TestXmlResultsDir" location="${TestResultsDir}/xml" /> |
| 26 | + <!-- Distribution --> |
| 27 | + <property name="DistDir" location="${basedir}/dist" /> |
| 28 | + |
| 29 | + <!-- Version information --> |
| 30 | + |
| 31 | + <!-- spec version --> |
| 32 | + <property name="UUID_TITLE" value="UUID specification" /> |
| 33 | + <property name="UUID_VERSION" value="1.0" /> |
| 34 | + <property name="UUID_VENDOR" value="http://hegel.ittc.ku.edu/topics/internet/internet-drafts/draft-l/draft-leach-uuids-guids-01.txt" /> |
| 35 | + <!-- JUG version --> |
| 36 | + <property name="IMPL_TITLE" value="Java Uuid/guid Generator" /> |
| 37 | + <property name="IMPL_VERSION" value="2.0.1" /> |
| 38 | + <property name="IMPL_VENDOR" value="www.safehaus.org" /> |
| 39 | + |
| 40 | + <!-- jars needed for compilation --> |
| 41 | + <path id="classpath"> |
| 42 | + <!-- log4j needed for compilation optional logger interface --> |
| 43 | + <fileset dir="${LibDir}" includes="log4j*.jar" /> |
| 44 | + </path> |
| 45 | + |
| 46 | + <!-- Source files to include in source packages (tar, zip) --> |
| 47 | + <patternset id="dist-src-files"> |
| 48 | + <include name="build.xml" /> |
| 49 | + <include name="src/**/*.java" /> |
| 50 | + <include name="src/java/**/*.html" /> |
| 51 | + <include name="src/c/*.c" /> |
| 52 | + <include name="src/c/makefile" /> |
| 53 | + <include name="src/maven/*.pom" /> |
| 54 | + <include name="src/**/README*" /> |
| 55 | + <include name="release-notes/*" /> |
| 56 | + <include name="release-notes/asl/*" /> |
| 57 | + <include name="release-notes/lgpl/*" /> |
| 58 | + </patternset> |
| 59 | + |
| 60 | + <!--*********************************************************************--> |
| 61 | + <!-- The readme target shows a brief description of all targets --> |
| 62 | + <!-- supported by this ant build file --> |
| 63 | + <!--*********************************************************************--> |
| 64 | + <target name="readme"> |
| 65 | + <echo message = "${ProjectName}'s Available Targets" /> |
| 66 | + <echo message = "---------------------------------------------------" /> |
| 67 | + <echo message = "1) readme - Displays this information (default target)." /> |
| 68 | + <echo message = "2) clean - Remove any generated files/directories." /> |
| 69 | + <echo message = "3) compile - Compile all non-test JUG code." /> |
| 70 | + <echo message = "4) jars - Compile and create jars for non-test JUG code." /> |
| 71 | + <echo message = "5) javadoc - Generate JUG code documentation." /> |
| 72 | + <echo message = "6) dist - Create all jars and generate javadocs (calls jars and javadoc)" /> |
| 73 | + <echo message = "7) compile_test - Compile JUG code and test code" /> |
| 74 | + <echo message = " for JUnit tests." /> |
| 75 | + <echo message = "8) test - Run JUnit tests." /> |
| 76 | + <echo message = " Reports results and generates html output." /> |
| 77 | + <echo message = "9) all - Run the clean, dist and test targets." /> |
| 78 | + </target> |
| 79 | + |
| 80 | + <target name="prepare"> |
| 81 | + <!-- make build directories --> |
| 82 | + <mkdir dir="${BuildDir}" /> |
| 83 | + <mkdir dir="${BuildClassesDir}" /> |
| 84 | + <mkdir dir="${BuildNativeDir}" /> |
| 85 | + |
| 86 | + <!-- make docs directories --> |
| 87 | + <mkdir dir="${DocDir}" /> |
| 88 | + <mkdir dir="${JavaDocDir}" /> |
| 89 | + |
| 90 | + <!-- make test output directories --> |
| 91 | + <mkdir dir="${TestDir}" /> |
| 92 | + <mkdir dir="${TestBuildDir}" /> |
| 93 | + <mkdir dir="${TestResultsDir}" /> |
| 94 | + <mkdir dir="${TestXmlResultsDir}" /> |
| 95 | + |
| 96 | + <!-- and finally distribution dir --> |
| 97 | + <mkdir dir="${DistDir}" /> |
| 98 | + </target> |
| 99 | + |
| 100 | + <!--*********************************************************************--> |
| 101 | + <!-- clean - Removes all generated files/directories. --> |
| 102 | + <!--*********************************************************************--> |
| 103 | + <target name="clean"> |
| 104 | + <delete dir="${BuildDir}"/> |
| 105 | + <delete dir="${DocDir}"/> |
| 106 | + <delete dir="${TestDir}"/> |
| 107 | + <delete dir="${DistDir}"/> |
| 108 | + </target> |
| 109 | + |
| 110 | + <target name="compile_java" depends="prepare"> |
| 111 | + <javac SrcDir="${JavaSrcDir}" destdir="${BuildClassesDir}" |
| 112 | + source="1.2" target="1.1" |
| 113 | + debug="true"> |
| 114 | + <include name="com/ccg/net/ethernet/BadAddressException.java" /> |
| 115 | + <include name="com/ccg/net/ethernet/EthernetAddress.java" /> |
| 116 | + <include name="org/safehaus/uuid/*.java" /> |
| 117 | + <include name="org/safehaus/uuid/ext/*.java" /> |
| 118 | + <include name="test/*.java" /> |
| 119 | + <classpath refid="classpath" /> |
| 120 | + </javac> |
| 121 | + </target> |
| 122 | + |
| 123 | + <!-- Convenience target for easier invocation... --> |
| 124 | + <target name="compile" depends="compile_java"> |
| 125 | + </target> |
| 126 | + |
| 127 | + <target name="compile_c" depends="prepare"> |
| 128 | + <!-- To be able to test native code, let's copy JNI code --> |
| 129 | + <copy todir="${BuildNativeDir}"> |
| 130 | + <fileset dir="${NativeLibDir}"> |
| 131 | + <include name="*.dll"/> |
| 132 | + <include name="*.jnilib"/> |
| 133 | + <include name="*.so"/> |
| 134 | + </fileset> |
| 135 | + </copy> |
| 136 | + </target> |
| 137 | + |
| 138 | + <target name="jars" depends="jar.asl, jar.lgpl, jar.native" |
| 139 | + /> |
| 140 | + |
| 141 | + <target name="jar.asl" depends="compile_java"> |
| 142 | + <jar jarfile="${BuildDir}/jug-asl-${IMPL_VERSION}.jar" filesonly="true"> |
| 143 | + <manifest> |
| 144 | + <attribute name="Main-class" value="org.safehaus.uuid.Jug" /> |
| 145 | + <attribute name="Built-By" value="${user.name}"/> |
| 146 | + <attribute name="Specification-Title" value="${UUID_TITLE}"/> |
| 147 | + <attribute name="Specification-Version" value="${UUID_VERSION}"/> |
| 148 | + <attribute name="Specification-Vendor" value="${UUID_VENDOR}"/> |
| 149 | + <attribute name="Implementation-Title" value="${IMPL_TITLE}"/> |
| 150 | + <attribute name="Implementation-Version" value="${IMPL_VERSION}"/> |
| 151 | + <attribute name="Implementation-Vendor" value="${IMPL_VENDOR}"/> |
| 152 | + </manifest> |
| 153 | + <fileset dir="${BuildClassesDir}"> |
| 154 | + <include name="org/safehaus/uuid/*.class" /> |
| 155 | + <include name="org/safehaus/uuid/ext/*.class" /> |
| 156 | + <include name="com/ccg/net/ethernet/**" /> |
| 157 | + </fileset> |
| 158 | + <fileset dir="${RelNotesDir}/asl"> |
| 159 | + <include name="LICENSE" /> |
| 160 | + <include name="NOTICE" /> |
| 161 | + <include name="ASL2.0" /> |
| 162 | + </fileset> |
| 163 | + </jar> |
| 164 | + </target> |
| 165 | + |
| 166 | + <target name="jar.lgpl" depends="compile_java"> |
| 167 | + <jar jarfile="${BuildDir}/jug-lgpl-${IMPL_VERSION}.jar" filesonly="true"> |
| 168 | + <manifest> |
| 169 | + <attribute name="Main-class" value="org.safehaus.uuid.Jug" /> |
| 170 | + <attribute name="Built-By" value="${user.name}"/> |
| 171 | + <attribute name="Specification-Title" value="${UUID_TITLE}"/> |
| 172 | + <attribute name="Specification-Version" value="${UUID_VERSION}"/> |
| 173 | + <attribute name="Specification-Vendor" value="${UUID_VENDOR}"/> |
| 174 | + <attribute name="Implementation-Title" value="${IMPL_TITLE}"/> |
| 175 | + <attribute name="Implementation-Version" value="${IMPL_VERSION}"/> |
| 176 | + <attribute name="Implementation-Vendor" value="${IMPL_VENDOR}"/> |
| 177 | + </manifest> |
| 178 | + <fileset dir="${BuildClassesDir}"> |
| 179 | + <include name="org/safehaus/uuid/*.class" /> |
| 180 | + <include name="org/safehaus/uuid/ext/*.class" /> |
| 181 | + <include name="com/ccg/net/ethernet/**" /> |
| 182 | + </fileset> |
| 183 | + <fileset dir="${RelNotesDir}/lgpl"> |
| 184 | + <include name="LICENSE" /> |
| 185 | + <include name="NOTICE" /> |
| 186 | + <include name="LGPL2.1" /> |
| 187 | + </fileset> |
| 188 | + </jar> |
| 189 | + </target> |
| 190 | + |
| 191 | + <!-- Need to copy native code libs --> |
| 192 | + <target name="jar.native" depends="compile_c"> |
| 193 | + <zip zipfile="${BuildDir}/jug-native.zip" filesonly="true"> |
| 194 | + <zipfileset dir="." filemode="755"> |
| 195 | + <include name="jug-native/*.dll"/> |
| 196 | + <include name="jug-native/*.jnilib"/> |
| 197 | + <include name="jug-native/*.so"/> |
| 198 | + </zipfileset> |
| 199 | + </zip> |
| 200 | + </target> |
| 201 | + |
| 202 | + <target name="javadoc" depends="compile_java"> |
| 203 | + <!-- Build a dirpath that contains just the "source" tree --> |
| 204 | + <javadoc windowtitle="${ProjectName}" |
| 205 | + destdir="${JavaDocDir}" author="true" version="true"> |
| 206 | + <classpath refid="classpath" /> |
| 207 | + <packageset dir="${JavaSrcDir}" defaultexcludes="yes"> |
| 208 | + <include name="com/ccg/net/ethernet/**" /> |
| 209 | + <include name="org/safehaus/uuid/**" /> |
| 210 | + </packageset> |
| 211 | + </javadoc> |
| 212 | + </target> |
| 213 | + |
| 214 | + <target name="dist" depends="jars,javadoc"> |
| 215 | + <!-- First, let's copy the binary jars to dist --> |
| 216 | + <copy todir="${DistDir}"> |
| 217 | + <fileset dir="${BuildDir}"> |
| 218 | + <include name="jug*.jar" /> |
| 219 | + <include name="jug-native.zip" /> |
| 220 | + </fileset> |
| 221 | + </copy> |
| 222 | + <!-- Then let's create the source distribution tar package --> |
| 223 | + <tar basedir="${basedir}" destfile="${DistDir}/jug-src.tar" |
| 224 | + includes="build.xml" > |
| 225 | + <patternset refid="dist-src-files" /> |
| 226 | + </tar> |
| 227 | + <gzip zipfile="${DistDir}/jug-src.tar.gz" src="${DistDir}/jug-src.tar" /> |
| 228 | + <!-- as well as zip |
| 229 | + --> |
| 230 | + <zip basedir="${basedir}" destfile="${DistDir}/jug-src.zip"> |
| 231 | + <patternset refid="dist-src-files" /> |
| 232 | + </zip> |
| 233 | + |
| 234 | + <!-- Then copy javadocs --> |
| 235 | + <copy todir="${DistDir}"> |
| 236 | + <fileset dir="${JavaDocDir}/.." includes="javadoc/**/*" /> |
| 237 | + </copy> |
| 238 | + <!-- Plus, let's also just copy README and compatibility files, in |
| 239 | + addition to being included in source package |
| 240 | + --> |
| 241 | + <copy todir="${DistDir}" > |
| 242 | + <fileset dir="." includes="release-notes/**" /> |
| 243 | + </copy> |
| 244 | + <!-- And also additional Maven stuff --> |
| 245 | + <copy todir="${DistDir}"> |
| 246 | + <fileset dir="${SrcDir}/maven" includes="*.pom" /> |
| 247 | + <globmapper from="*.pom" to="*-${IMPL_VERSION}.pom" /> |
| 248 | + <filterset> |
| 249 | + <filter token="VERSION" value="${IMPL_VERSION}" /> |
| 250 | + </filterset> |
| 251 | + </copy> |
| 252 | + </target> |
| 253 | + |
| 254 | + <target name="all" depends="clean,dist,test"> |
| 255 | + <!-- This target simply depends on others to do it's job --> |
| 256 | + </target> |
| 257 | + |
| 258 | + <!--*********************************************************************--> |
| 259 | + <!-- Tasks from here down are in support of junit tests. --> |
| 260 | + <!--*********************************************************************--> |
| 261 | + <target name="junit"> |
| 262 | + <available property="junit.present" classname="junit.framework.TestCase" /> |
| 263 | + </target> |
| 264 | + |
| 265 | + <target name="compile_test" depends="junit, jars" if="junit.present"> |
| 266 | + <javac SrcDir="${TestSrcDir}" destdir="${TestBuildDir}" debug="true"> |
| 267 | + <include name="**/*.java" /> |
| 268 | + <classpath> |
| 269 | + <pathelement location="${BuildClassesDir}" /> |
| 270 | + </classpath> |
| 271 | + </javac> |
| 272 | + </target> |
| 273 | + |
| 274 | + <target name="test" depends="compile_test" if="junit.present"> |
| 275 | + <junit fork="yes" printsummary="yes" haltonfailure="no"> |
| 276 | + <batchtest fork="yes" todir="${TestXmlResultsDir}"> |
| 277 | + <fileset dir="${TestBuildDir}"> |
| 278 | + <include name="**/*Test.class"/> |
| 279 | + </fileset> |
| 280 | + </batchtest> |
| 281 | + <formatter type="xml" /> |
| 282 | + <classpath> |
| 283 | + <pathelement location="${BuildClassesDir}" /> |
| 284 | + <pathelement location="${TestBuildDir}" /> |
| 285 | + </classpath> |
| 286 | + </junit> |
| 287 | + |
| 288 | + <junitreport todir="${TestResultsDir}"> |
| 289 | + <fileset dir="${TestXmlResultsDir}"> |
| 290 | + <include name="TEST-*.xml" /> |
| 291 | + </fileset> |
| 292 | + <report todir="${TestResultsDir}" /> |
| 293 | + </junitreport> |
| 294 | + </target> |
| 295 | + |
| 296 | +</project> |
0 commit comments