Parent Directory
|
Revision Log
Revision 1.12 - (view) (download) (as text)
| 1 : | tim | 1.1 | <project name="jsr166" default="jar"> |
| 2 : | |||
| 3 : | <description> | ||
| 4 : | tim | 1.11 | |
| 5 : | tim | 1.1 | Build file for JSR-166 |
| 6 : | tim | 1.3 | |
| 7 : | Note that junit.jar must be in ${ant.home}/lib for the | ||
| 8 : | test target to work. [FIXME: This should be automatically | ||
| 9 : | enforced by this build file by failing with a message if | ||
| 10 : | junit.jar is not in the right place.] | ||
| 11 : | tim | 1.11 | |
| 12 : | tim | 1.1 | </description> |
| 13 : | |||
| 14 : | <!-- Compilation options --> | ||
| 15 : | tim | 1.11 | <property name="build.sourcelevel" value="1.5"/> |
| 16 : | tim | 1.1 | <property name="build.debug" value="true"/> |
| 17 : | <property name="build.debuglevel" value="source,lines,vars"/> | ||
| 18 : | tim | 1.11 | <property name="build.deprecation" value="true"/> |
| 19 : | <property name="build.warnings" value="true"/> | ||
| 20 : | tim | 1.1 | |
| 21 : | <!-- Build locations --> | ||
| 22 : | <property name="build.dir" location="build"/> | ||
| 23 : | <property name="build.classes.dir" location="${build.dir}/classes"/> | ||
| 24 : | <property name="build.testcases.dir" location="${build.dir}/testcases"/> | ||
| 25 : | <property name="build.lib.dir" location="${build.dir}/lib"/> | ||
| 26 : | <property name="build.ant.dir" location="${build.dir}/ant"/> | ||
| 27 : | tim | 1.9 | <property name="build.javadocs.dir" location="${build.dir}/javadocs"/> |
| 28 : | tim | 1.1 | <property name="build.reports.dir" location="${build.dir}/reports"/> |
| 29 : | <property name="build.filter.src.dir" location="${build.dir}/filtersrc"/> | ||
| 30 : | |||
| 31 : | <!-- Source locations --> | ||
| 32 : | <property name="src.dir" location="${basedir}"/> | ||
| 33 : | <property name="test.src.dir" location="${basedir}/etc/testcases"/> | ||
| 34 : | <property name="ant.src.dir" location="${basedir}/etc/ant"/> | ||
| 35 : | <property name="stylesheet.dir" location="${basedir}/etc/xsl"/> | ||
| 36 : | <property name="lib.dir" location="${basedir}/lib"/> | ||
| 37 : | tim | 1.9 | <property name="dist.dir" location="${basedir}/dist"/> |
| 38 : | |||
| 39 : | <!-- Distribution locations --> | ||
| 40 : | <property name="dist.javadocs.dir" location="${dist.dir}/docs"/> | ||
| 41 : | tim | 1.1 | |
| 42 : | <!-- Jar locations --> | ||
| 43 : | <property name="product.jar" location="${build.lib.dir}/jsr166.jar"/> | ||
| 44 : | <property name="javac.jar" location="${lib.dir}/javac.jar"/> | ||
| 45 : | <property name="collect.jar" location="${lib.dir}/collect.jar"/> | ||
| 46 : | <property name="junit.jar" location="${lib.dir}/junit.jar"/> | ||
| 47 : | <property name="rt.jar" location="${java.home}/lib/rt.jar"/> | ||
| 48 : | |||
| 49 : | tim | 1.11 | <property name="javac.args" value='-J-Xbootclasspath/p:${javac.jar}'/> |
| 50 : | tim | 1.1 | |
| 51 : | tim | 1.11 | <path id="javac.bootclasspath"> |
| 52 : | tim | 1.2 | <pathelement location="${collect.jar}"/> |
| 53 : | <pathelement location="${rt.jar}"/> | ||
| 54 : | </path> | ||
| 55 : | |||
| 56 : | <path id="test.classpath"> | ||
| 57 : | <pathelement location="${product.jar}"/> | ||
| 58 : | </path> | ||
| 59 : | |||
| 60 : | tim | 1.1 | |
| 61 : | tim | 1.11 | <!-- Main targets --> |
| 62 : | |||
| 63 : | <target name="compile" depends="init" | ||
| 64 : | description="Compiles all sources to build folder"> | ||
| 65 : | tim | 1.1 | <mkdir dir="${build.classes.dir}"/> |
| 66 : | <javac srcdir="${src.dir}" | ||
| 67 : | destdir="${build.classes.dir}" | ||
| 68 : | debug="${build.debug}" | ||
| 69 : | debuglevel="${build.debuglevel}" | ||
| 70 : | deprecation="${build.deprecation}" | ||
| 71 : | source="${build.sourcelevel}" | ||
| 72 : | fork="true"> | ||
| 73 : | |||
| 74 : | tim | 1.11 | <bootclasspath refid="javac.bootclasspath"/> |
| 75 : | <compilerarg line="${javac.args} ${build.warnings.option}"/> | ||
| 76 : | tim | 1.1 | |
| 77 : | <!-- need this because srcdir is basedir! --> | ||
| 78 : | <include name="java/**/*.java"/> | ||
| 79 : | |||
| 80 : | </javac> | ||
| 81 : | </target> | ||
| 82 : | |||
| 83 : | |||
| 84 : | tim | 1.11 | <target name="jar" depends="compile" |
| 85 : | description="Builds library jar from compiled sources"> | ||
| 86 : | tim | 1.1 | <mkdir dir="${build.lib.dir}"/> |
| 87 : | <jar basedir="${build.classes.dir}" | ||
| 88 : | destfile="${product.jar}" | ||
| 89 : | /> | ||
| 90 : | </target> | ||
| 91 : | |||
| 92 : | |||
| 93 : | tim | 1.11 | <target name="test" depends="init, report-tests" |
| 94 : | description="Runs all tests"/> | ||
| 95 : | tim | 1.1 | |
| 96 : | |||
| 97 : | tim | 1.11 | <target name="docs" depends="init, clean-filtered-src, filter-src" |
| 98 : | tim | 1.9 | description="Builds javadocs with custom tags to build folder"> |
| 99 : | <delete dir="${build.javadocs.dir}"/> | ||
| 100 : | <mkdir dir="${build.javadocs.dir}"/> | ||
| 101 : | <javadoc destdir="${build.javadocs.dir}" | ||
| 102 : | tim | 1.8 | link="http://java.sun.com/j2se/1.4.1/docs/api" |
| 103 : | overview="${src.dir}/intro.html" | ||
| 104 : | source="${build.sourcelevel}"> | ||
| 105 : | |||
| 106 : | tim | 1.9 | <tag name="revised" description="Last revised:"/> |
| 107 : | <tag name="spec" description="Specified by:"/> | ||
| 108 : | <tag name="editor" description="Last edited by:"/> | ||
| 109 : | <tag name="fixme" description="FIX ME:"/> | ||
| 110 : | tim | 1.8 | <packageset dir="${build.filter.src.dir}"> |
| 111 : | <include name="java/**"/> | ||
| 112 : | </packageset> | ||
| 113 : | |||
| 114 : | </javadoc> | ||
| 115 : | </target> | ||
| 116 : | |||
| 117 : | |||
| 118 : | tim | 1.11 | <target name="dist" depends="init, dist-clean, dist-jar, dist-docs"/> |
| 119 : | tim | 1.1 | |
| 120 : | |||
| 121 : | tim | 1.11 | <target name="clean" |
| 122 : | description="Removes all build products"> | ||
| 123 : | <delete dir="${build.dir}"/> | ||
| 124 : | <delete dir="${build.classes.dir}"/> | ||
| 125 : | <delete dir="${build.lib.dir}"/> | ||
| 126 : | tim | 1.1 | </target> |
| 127 : | |||
| 128 : | |||
| 129 : | tim | 1.11 | <target name="dist-clean" |
| 130 : | description="Removes all build and distribution products"> | ||
| 131 : | <delete dir="${dist.dir}"/> | ||
| 132 : | tim | 1.9 | </target> |
| 133 : | tim | 1.10 | |
| 134 : | |||
| 135 : | tim | 1.11 | <!-- Internal targets --> |
| 136 : | tim | 1.9 | |
| 137 : | tim | 1.11 | <target name="set-warnings-if" if="build.warnings"> |
| 138 : | <property name="build.warnings.option" value="-warnunchecked"/> | ||
| 139 : | </target> | ||
| 140 : | tim | 1.9 | |
| 141 : | tim | 1.11 | <target name="set-warnings-unless" unless="build.warnings"> |
| 142 : | <property name="build.warnings.option" value=""/> | ||
| 143 : | tim | 1.6 | </target> |
| 144 : | |||
| 145 : | tim | 1.11 | <target name="init" depends="set-warnings-if, set-warnings-unless"> |
| 146 : | <!-- Version is kept in a separate file --> | ||
| 147 : | <loadfile property="version" srcFile="version.properties"/> | ||
| 148 : | <echo>Building JSR-166 version ${version}</echo> | ||
| 149 : | tim | 1.9 | </target> |
| 150 : | |||
| 151 : | |||
| 152 : | <target name="clean-filtered-src"> | ||
| 153 : | tim | 1.7 | <delete dir="${build.filter.src.dir}"/> |
| 154 : | tim | 1.1 | </target> |
| 155 : | |||
| 156 : | |||
| 157 : | tim | 1.11 | <target name="dist-jar" depends="clean, jar"> |
| 158 : | <copy file="${product.jar}" todir="${dist.dir}"/> | ||
| 159 : | </target> | ||
| 160 : | |||
| 161 : | |||
| 162 : | <target name="dist-docs" depends="clean-filtered-src, filter-src" | ||
| 163 : | description="Builds javadocs without custom tags to dist folder"> | ||
| 164 : | <delete dir="${dist.javadocs.dir}"/> | ||
| 165 : | <mkdir dir="${dist.javadocs.dir}"/> | ||
| 166 : | <javadoc destdir="${dist.javadocs.dir}" | ||
| 167 : | link="http://java.sun.com/j2se/1.4.1/docs/api" | ||
| 168 : | overview="${src.dir}/intro.html" | ||
| 169 : | source="${build.sourcelevel}"> | ||
| 170 : | |||
| 171 : | <packageset dir="${build.filter.src.dir}"> | ||
| 172 : | <include name="java/**"/> | ||
| 173 : | </packageset> | ||
| 174 : | |||
| 175 : | </javadoc> | ||
| 176 : | </target> | ||
| 177 : | |||
| 178 : | tim | 1.1 | |
| 179 : | tim | 1.11 | <target name="compile-ant-filter"> |
| 180 : | tim | 1.1 | <mkdir dir="${build.ant.dir}"/> |
| 181 : | <javac srcdir="${ant.src.dir}" | ||
| 182 : | destdir="${build.ant.dir}" | ||
| 183 : | source="1.4" | ||
| 184 : | /> | ||
| 185 : | </target> | ||
| 186 : | |||
| 187 : | |||
| 188 : | tim | 1.11 | <target name="filter-src" depends="compile-ant-filter"> |
| 189 : | tim | 1.1 | <mkdir dir="${build.filter.src.dir}"/> |
| 190 : | <copy todir="${build.filter.src.dir}"> | ||
| 191 : | <fileset dir="${src.dir}"> | ||
| 192 : | <include name="**/*.java"/> | ||
| 193 : | </fileset> | ||
| 194 : | <filterchain> | ||
| 195 : | <filterreader classname="jsr166.ant.filters.ReplaceFilter" | ||
| 196 : | classpath="${build.ant.dir}"> | ||
| 197 : | <!-- | ||
| 198 : | # These arguments are to get rid of angle-bracketed type | ||
| 199 : | # parameters so that javadoc can run on the result. The | ||
| 200 : | # following heuristic that seems to work: | ||
| 201 : | # | ||
| 202 : | # For all lines not starting with space(s)-asterisk-space(s), | ||
| 203 : | # replace <something> with a space, where there may be more | ||
| 204 : | # than one right angle bracket at the end, and "something" | ||
| 205 : | # must not contain parens or pipes. (This may need some | ||
| 206 : | # tweaking.) | ||
| 207 : | --> | ||
| 208 : | <param name="notmatching" value="^\s+\*\s.*$"/> | ||
| 209 : | <param name="pattern" value="<[^|>()]+?>+"/> | ||
| 210 : | <param name="replacement" value=" "/> | ||
| 211 : | </filterreader> | ||
| 212 : | <filterreader classname="jsr166.ant.filters.ReplaceFilter" | ||
| 213 : | classpath="${build.ant.dir}"> | ||
| 214 : | <!-- | ||
| 215 : | # These arguments are to uncomment lines beginning with | ||
| 216 : | # "//@" so that javadoc can see imports that are needed | ||
| 217 : | # to resolve links but that shouldn't be in the compiled | ||
| 218 : | # code. | ||
| 219 : | --> | ||
| 220 : | <param name="matching" value="^//@.*$"/> | ||
| 221 : | <param name="pattern" value="^//@"/> | ||
| 222 : | <param name="replacement" value=""/> | ||
| 223 : | </filterreader> | ||
| 224 : | </filterchain> | ||
| 225 : | </copy> | ||
| 226 : | </target> | ||
| 227 : | |||
| 228 : | |||
| 229 : | <target name="compile-tests" depends="jar"> | ||
| 230 : | <mkdir dir="${build.testcases.dir}"/> | ||
| 231 : | <javac srcdir="${test.src.dir}" | ||
| 232 : | destdir="${build.testcases.dir}" | ||
| 233 : | debug="${build.debug}" | ||
| 234 : | debuglevel="${build.debuglevel}" | ||
| 235 : | deprecation="${build.deprecation}" | ||
| 236 : | source="${build.sourcelevel}" | ||
| 237 : | fork="true"> | ||
| 238 : | |||
| 239 : | tim | 1.11 | <bootclasspath refid="javac.bootclasspath"/> |
| 240 : | <compilerarg line="${javac.args} ${build.warnings.option}"/> | ||
| 241 : | tim | 1.2 | <classpath refid="test.classpath"/> |
| 242 : | tim | 1.1 | <include name="**/*Test.java"/> |
| 243 : | |||
| 244 : | </javac> | ||
| 245 : | </target> | ||
| 246 : | tim | 1.11 | |
| 247 : | tim | 1.1 | |
| 248 : | <target name="run-tests" depends="compile-tests"> | ||
| 249 : | <mkdir dir="${build.reports.dir}"/> | ||
| 250 : | <junit printsummary="true" | ||
| 251 : | showoutput="true" | ||
| 252 : | errorProperty="junit.failed" | ||
| 253 : | failureProperty="junit.failed" | ||
| 254 : | tim | 1.12 | dir="${build.reports.dir}" |
| 255 : | fork="true"> | ||
| 256 : | |||
| 257 : | <jvmarg value="-Xbootclasspath/p:${product.jar}"/> | ||
| 258 : | tim | 1.1 | |
| 259 : | <classpath> | ||
| 260 : | tim | 1.12 | <!-- <path refid="test.classpath"/> --> |
| 261 : | tim | 1.1 | <pathelement location="${build.testcases.dir}"/> |
| 262 : | </classpath> | ||
| 263 : | |||
| 264 : | <formatter type="xml"/> | ||
| 265 : | |||
| 266 : | <batchtest todir="${build.reports.dir}"> | ||
| 267 : | <fileset dir="${test.src.dir}"> | ||
| 268 : | <include name="**/*Test.java"/> | ||
| 269 : | </fileset> | ||
| 270 : | </batchtest> | ||
| 271 : | |||
| 272 : | </junit> | ||
| 273 : | </target> | ||
| 274 : | |||
| 275 : | |||
| 276 : | <target name="report-tests" depends="run-tests"> | ||
| 277 : | <!-- Sets junit.report.format to frames if Xalan is present, | ||
| 278 : | otherwise sets it to noframes. --> | ||
| 279 : | <available property="junit.report.format" | ||
| 280 : | value="frames" | ||
| 281 : | classname="org.apache.xalan.lib.Redirect" | ||
| 282 : | /> | ||
| 283 : | <property name="junit.report.format" value="noframes"/> | ||
| 284 : | |||
| 285 : | <junitreport todir="${build.reports.dir}"> | ||
| 286 : | <fileset dir="${build.reports.dir}"> | ||
| 287 : | <include name="TEST-*.xml"/> | ||
| 288 : | </fileset> | ||
| 289 : | <report styledir="${stylesheet.dir}" | ||
| 290 : | format="${junit.report.format}" | ||
| 291 : | todir="${build.reports.dir}" | ||
| 292 : | /> | ||
| 293 : | </junitreport> | ||
| 294 : | |||
| 295 : | <fail message="Test Cases Failed" if="junit.failed"/> | ||
| 296 : | </target> | ||
| 297 : | |||
| 298 : | |||
| 299 : | </project> |
| Doug Lea | ViewVC Help |
| Powered by ViewVC 1.0.8 |