/[cvs]/jsr166/build.xml
ViewVC logotype

Contents of /jsr166/build.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (show annotations)
Fri Dec 13 06:34:04 2002 UTC (16 years, 9 months ago) by tim
Branch: MAIN
Changes since 1.15: +47 -10 lines
File MIME type: text/xml
Added doccheck target, not working yet.
Added strip target to produce "angle-bracket free" code

1 <project name="jsr166" default="jar">
2
3 <description>
4
5 Build file for JSR-166
6
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
12 </description>
13
14 <!-- Compilation options -->
15 <property name="build.sourcelevel" value="1.5"/>
16 <property name="build.debug" value="true"/>
17 <property name="build.debuglevel" value="source,lines,vars"/>
18 <property name="build.deprecation" value="false"/>
19 <!--
20 <property name="build.warnings" value="true"/>
21 -->
22
23 <!-- Build locations -->
24 <property name="build.dir" location="build"/>
25 <property name="build.classes.dir" location="${build.dir}/classes"/>
26 <property name="build.testcases.dir" location="${build.dir}/testcases"/>
27 <property name="build.lib.dir" location="${build.dir}/lib"/>
28 <property name="build.ant.dir" location="${build.dir}/ant"/>
29 <property name="build.javadocs.dir" location="${build.dir}/javadocs"/>
30 <property name="build.stripped.dir" location="${build.dir}/stripped"/>
31 <property name="build.reports.dir" location="${build.dir}/reports"/>
32 <property name="build.doccheck.dir" location="${build.dir}/doccheck"/>
33 <property name="build.filter.src.dir" location="${build.dir}/filtersrc"/>
34
35 <!-- Source locations -->
36 <property name="src.dir" location="${basedir}"/>
37 <property name="test.src.dir" location="${basedir}/etc/testcases"/>
38 <property name="ant.src.dir" location="${basedir}/etc/ant"/>
39 <property name="stylesheet.dir" location="${basedir}/etc/xsl"/>
40 <property name="lib.dir" location="${basedir}/lib"/>
41 <property name="dist.dir" location="${basedir}/dist"/>
42
43 <!-- Distribution locations -->
44 <property name="dist.javadocs.dir" location="${dist.dir}/docs"/>
45
46 <!-- Jar locations -->
47 <property name="product.jar" location="${build.lib.dir}/jsr166.jar"/>
48 <property name="javac.jar" location="${lib.dir}/javac.jar"/>
49 <property name="collect.jar" location="${lib.dir}/collect.jar"/>
50 <property name="junit.jar" location="${lib.dir}/junit.jar"/>
51 <property name="rt.jar" location="${java.home}/lib/rt.jar"/>
52
53 <property name="javac.args" value='-J-Xbootclasspath/p:${javac.jar}'/>
54
55 <path id="javac.bootclasspath">
56 <pathelement location="${collect.jar}"/>
57 <pathelement location="${rt.jar}"/>
58 </path>
59
60 <path id="test.classpath">
61 <pathelement location="${product.jar}"/>
62 </path>
63
64
65 <!-- Main targets -->
66
67 <target name="compile" depends="init"
68 description="Compiles all sources to build folder">
69 <mkdir dir="${build.classes.dir}"/>
70 <javac srcdir="${src.dir}"
71 destdir="${build.classes.dir}"
72 debug="${build.debug}"
73 debuglevel="${build.debuglevel}"
74 deprecation="${build.deprecation}"
75 source="${build.sourcelevel}"
76 fork="true">
77
78 <bootclasspath refid="javac.bootclasspath"/>
79 <compilerarg line="${javac.args} ${build.warnings.option}"/>
80
81 <!-- need this because srcdir is basedir! -->
82 <include name="java/**/*.java"/>
83
84 </javac>
85 </target>
86
87
88 <target name="jar" depends="compile"
89 description="Builds library jar from compiled sources">
90 <mkdir dir="${build.lib.dir}"/>
91 <jar basedir="${build.classes.dir}"
92 destfile="${product.jar}"
93 />
94 </target>
95
96
97 <target name="test" depends="init, report-tests"
98 description="Runs all tests"/>
99
100
101 <target name="checkstyle" depends="filter-src"
102 description="Reports on style errors in Java source">
103 <taskdef resource="checkstyletask.properties"
104 classpath="${lib.dir}/checkstyle-all-2.4.jar"/>
105
106 <checkstyle>
107 <formatter type="plain"/> <!-- also available: type="xml" -->
108 <fileset dir="${build.filter.src.dir}" includes="**/*.java"/>
109 </checkstyle>
110 </target>
111
112
113 <target name="doccheck" depends="filter-src"
114 description="Reports on javadoc style errors">
115 <delete dir="${build.doccheck.dir}"/>
116 <mkdir dir="${build.doccheck.dir}"/>
117 <javadoc doclet="com.sun.tools.doclets.doccheck.DocCheck"
118 docletpath="${lib.dir}/doccheck.jar"
119 destdir="${build.doccheck.dir}">
120 <packageset dir="${build.filter.src.dir}">
121 <include name="java/**"/>
122 </packageset>
123 </javadoc>
124 </target>
125
126
127 <target name="docs" depends="filter-src"
128 description="Builds javadocs with custom tags to build folder">
129 <delete dir="${build.javadocs.dir}"/>
130 <mkdir dir="${build.javadocs.dir}"/>
131 <javadoc destdir="${build.javadocs.dir}"
132 link="http://java.sun.com/j2se/1.4.1/docs/api"
133 overview="${src.dir}/intro.html"
134 source="${build.sourcelevel}">
135
136 <tag name="revised" description="Last revised:"/>
137 <tag name="spec" description="Specified by:"/>
138 <tag name="editor" description="Last edited by:"/>
139 <tag name="fixme" description="FIX ME:"/>
140 <packageset dir="${build.filter.src.dir}">
141 <include name="java/**"/>
142 </packageset>
143
144 </javadoc>
145 </target>
146
147
148 <target name="strip" depends="init">
149 <mkdir dir="${build.stripped.dir}"/>
150 <javac srcdir="${src.dir}"
151 destdir="${build.stripped.dir}"
152 debug="${build.debug}"
153 debuglevel="${build.debuglevel}"
154 deprecation="${build.deprecation}"
155 source="${build.sourcelevel}"
156 fork="true">
157
158 <bootclasspath refid="javac.bootclasspath"/>
159 <compilerarg line="${javac.args} ${build.warnings.option} -s"/>
160
161 <!-- need this because srcdir is basedir! -->
162 <include name="java/**/*.java"/>
163
164 </javac>
165 </target>
166
167
168 <target name="dist" depends="init, dist-clean, dist-jar, dist-docs"
169 description="Puts all distributable products in single hierarchy"/>
170
171
172 <target name="clean"
173 description="Removes all build products">
174 <delete dir="${build.dir}"/>
175 <delete dir="${build.classes.dir}"/>
176 <delete dir="${build.lib.dir}"/>
177 </target>
178
179
180 <target name="dist-clean"
181 description="Removes all build and distribution products">
182 <delete dir="${dist.dir}"/>
183 </target>
184
185
186 <!-- Anthill targets -->
187
188 <!-- Should really run the tests instead of just the jar target -->
189 <target name="anthill-build" depends="jar, docs, dist-docs"
190 description="Build the jar and both the external and internal docs"/>
191
192 <target name="anthill-publish">
193 <copy todir="${deployDir}/docs/private">
194 <fileset dir="${build.javadocs.dir}"/>
195 </copy>
196 <copy todir="${deployDir}/docs/public">
197 <fileset dir="${dist.javadocs.dir}"/>
198 </copy>
199 </target>
200
201
202 <!-- Internal targets -->
203
204 <target name="set-warnings-if" if="build.warnings">
205 <property name="build.warnings.option" value="-warnunchecked"/>
206 </target>
207
208
209 <target name="set-warnings-unless" unless="build.warnings">
210 <property name="build.warnings.option" value=""/>
211 </target>
212
213
214 <target name="init" depends="set-warnings-if, set-warnings-unless">
215 <!-- Version is kept in a separate file -->
216 <loadfile property="version" srcFile="version.properties"/>
217 <echo>Building JSR-166 version ${version}</echo>
218 </target>
219
220
221 <target name="dist-jar" depends="clean, jar">
222 <copy file="${product.jar}" todir="${dist.dir}"/>
223 </target>
224
225
226 <target name="dist-docs" depends="filter-src"
227 description="Builds javadocs without custom tags to dist folder">
228 <delete dir="${dist.javadocs.dir}"/>
229 <mkdir dir="${dist.javadocs.dir}"/>
230 <javadoc destdir="${dist.javadocs.dir}"
231 link="http://java.sun.com/j2se/1.4.1/docs/api"
232 overview="${src.dir}/intro.html"
233 source="${build.sourcelevel}">
234
235 <packageset dir="${build.filter.src.dir}">
236 <include name="java/**"/>
237 </packageset>
238
239 </javadoc>
240 </target>
241
242
243 <target name="compile-ant-filter" depends="init">
244 <mkdir dir="${build.ant.dir}"/>
245 <javac srcdir="${ant.src.dir}"
246 destdir="${build.ant.dir}"
247 source="1.4"
248 />
249 </target>
250
251
252 <target name="filter-src" depends="compile-ant-filter">
253 <mkdir dir="${build.filter.src.dir}"/>
254 <copy todir="${build.filter.src.dir}">
255 <fileset dir="${src.dir}">
256 <include name="java/**/*.java"/>
257 </fileset>
258 <filterchain>
259 <filterreader classname="jsr166.ant.filters.ReplaceFilter"
260 classpath="${build.ant.dir}">
261 <!--
262 # These arguments are to get rid of angle-bracketed type
263 # parameters so that javadoc can run on the result. The
264 # following heuristic that seems to work:
265 #
266 # For all lines not starting with space(s)-asterisk-space(s),
267 # replace <something> with a space, where there may be more
268 # than one right angle bracket at the end, and "something"
269 # must not contain parens or pipes. (This may need some
270 # tweaking.)
271 -->
272 <param name="notmatching" value="^\s+\*\s.*$"/>
273 <param name="pattern" value="&lt;[^|>()]+?>+"/>
274 <param name="replacement" value=" "/>
275 </filterreader>
276 <filterreader classname="jsr166.ant.filters.ReplaceFilter"
277 classpath="${build.ant.dir}">
278 <!--
279 # These arguments are to uncomment lines beginning with
280 # "//@" so that javadoc can see imports that are needed
281 # to resolve links but that shouldn't be in the compiled
282 # code.
283 -->
284 <param name="matching" value="^//@.*$"/>
285 <param name="pattern" value="^//@"/>
286 <param name="replacement" value=""/>
287 </filterreader>
288 </filterchain>
289 </copy>
290 </target>
291
292
293 <target name="compile-tests" depends="jar">
294 <mkdir dir="${build.testcases.dir}"/>
295 <javac srcdir="${test.src.dir}"
296 destdir="${build.testcases.dir}"
297 debug="${build.debug}"
298 debuglevel="${build.debuglevel}"
299 deprecation="${build.deprecation}"
300 source="${build.sourcelevel}"
301 fork="true">
302
303 <bootclasspath refid="javac.bootclasspath"/>
304 <compilerarg line="${javac.args} ${build.warnings.option}"/>
305 <classpath refid="test.classpath"/>
306 <include name="**/*Test.java"/>
307
308 </javac>
309 </target>
310
311
312 <target name="run-tests" depends="compile-tests">
313 <mkdir dir="${build.reports.dir}"/>
314 <junit printsummary="true"
315 showoutput="true"
316 errorProperty="junit.failed"
317 failureProperty="junit.failed"
318 dir="${build.reports.dir}"
319 fork="true">
320
321 <jvmarg value="-Xbootclasspath/p:${product.jar}"/>
322
323 <classpath>
324 <!-- <path refid="test.classpath"/> -->
325 <pathelement location="${build.testcases.dir}"/>
326 </classpath>
327
328 <formatter type="xml"/>
329
330 <batchtest todir="${build.reports.dir}">
331 <fileset dir="${test.src.dir}">
332 <include name="**/*Test.java"/>
333 </fileset>
334 </batchtest>
335
336 </junit>
337 </target>
338
339
340 <target name="report-tests" depends="run-tests">
341 <!-- Sets junit.report.format to frames if Xalan is present,
342 otherwise sets it to noframes. -->
343 <available property="junit.report.format"
344 value="frames"
345 classname="org.apache.xalan.lib.Redirect"
346 />
347 <property name="junit.report.format" value="noframes"/>
348
349 <junitreport todir="${build.reports.dir}">
350 <fileset dir="${build.reports.dir}">
351 <include name="TEST-*.xml"/>
352 </fileset>
353 <report styledir="${stylesheet.dir}"
354 format="${junit.report.format}"
355 todir="${build.reports.dir}"
356 />
357 </junitreport>
358
359 <fail message="Test Cases Failed" if="junit.failed"/>
360 </target>
361
362
363 </project>

dl@cs.oswego.edu
ViewVC Help
Powered by ViewVC 1.1.27