ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/build.xml
Revision: 1.17
Committed: Fri Dec 13 07:09:11 2002 UTC (21 years, 4 months ago) by tim
Content type: text/xml
Branch: MAIN
Changes since 1.16: +2 -0 lines
Log Message:
Prettier front page for build results than a directory listing.

File Contents

# User Rev Content
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.13 <property name="build.deprecation" value="false"/>
19     <!--
20 tim 1.11 <property name="build.warnings" value="true"/>
21 tim 1.13 -->
22 tim 1.1
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 tim 1.9 <property name="build.javadocs.dir" location="${build.dir}/javadocs"/>
30 tim 1.16 <property name="build.stripped.dir" location="${build.dir}/stripped"/>
31 tim 1.1 <property name="build.reports.dir" location="${build.dir}/reports"/>
32 tim 1.16 <property name="build.doccheck.dir" location="${build.dir}/doccheck"/>
33 tim 1.1 <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 tim 1.9 <property name="dist.dir" location="${basedir}/dist"/>
42    
43     <!-- Distribution locations -->
44     <property name="dist.javadocs.dir" location="${dist.dir}/docs"/>
45 tim 1.1
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 tim 1.11 <property name="javac.args" value='-J-Xbootclasspath/p:${javac.jar}'/>
54 tim 1.1
55 tim 1.11 <path id="javac.bootclasspath">
56 tim 1.2 <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 tim 1.1
65 tim 1.11 <!-- Main targets -->
66    
67     <target name="compile" depends="init"
68     description="Compiles all sources to build folder">
69 tim 1.1 <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 tim 1.11 <bootclasspath refid="javac.bootclasspath"/>
79     <compilerarg line="${javac.args} ${build.warnings.option}"/>
80 tim 1.1
81     <!-- need this because srcdir is basedir! -->
82     <include name="java/**/*.java"/>
83    
84     </javac>
85     </target>
86    
87    
88 tim 1.11 <target name="jar" depends="compile"
89     description="Builds library jar from compiled sources">
90 tim 1.1 <mkdir dir="${build.lib.dir}"/>
91     <jar basedir="${build.classes.dir}"
92     destfile="${product.jar}"
93     />
94     </target>
95    
96    
97 tim 1.11 <target name="test" depends="init, report-tests"
98     description="Runs all tests"/>
99 tim 1.1
100    
101 tim 1.16 <target name="checkstyle" depends="filter-src"
102     description="Reports on style errors in Java source">
103 tim 1.15 <taskdef resource="checkstyletask.properties"
104     classpath="${lib.dir}/checkstyle-all-2.4.jar"/>
105    
106     <checkstyle>
107 tim 1.16 <formatter type="plain"/> <!-- also available: type="xml" -->
108 tim 1.15 <fileset dir="${build.filter.src.dir}" includes="**/*.java"/>
109     </checkstyle>
110     </target>
111    
112 tim 1.16
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 tim 1.9 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 tim 1.8 link="http://java.sun.com/j2se/1.4.1/docs/api"
133     overview="${src.dir}/intro.html"
134     source="${build.sourcelevel}">
135    
136 tim 1.9 <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 tim 1.8 <packageset dir="${build.filter.src.dir}">
141     <include name="java/**"/>
142     </packageset>
143    
144     </javadoc>
145     </target>
146    
147    
148 tim 1.16 <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 tim 1.1
171    
172 tim 1.11 <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 tim 1.1 </target>
178    
179    
180 tim 1.11 <target name="dist-clean"
181     description="Removes all build and distribution products">
182     <delete dir="${dist.dir}"/>
183 tim 1.9 </target>
184 tim 1.10
185    
186 tim 1.14 <!-- 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 tim 1.17 <copy tofile="${deployDir}/index.html"
200     file="${basedir}/etc/anthill-index.html"/>
201 tim 1.14 </target>
202    
203    
204 tim 1.11 <!-- Internal targets -->
205 tim 1.9
206 tim 1.11 <target name="set-warnings-if" if="build.warnings">
207     <property name="build.warnings.option" value="-warnunchecked"/>
208     </target>
209 tim 1.9
210 tim 1.16
211 tim 1.11 <target name="set-warnings-unless" unless="build.warnings">
212     <property name="build.warnings.option" value=""/>
213 tim 1.6 </target>
214    
215 tim 1.16
216 tim 1.11 <target name="init" depends="set-warnings-if, set-warnings-unless">
217     <!-- Version is kept in a separate file -->
218     <loadfile property="version" srcFile="version.properties"/>
219     <echo>Building JSR-166 version ${version}</echo>
220 tim 1.9 </target>
221    
222    
223 tim 1.11 <target name="dist-jar" depends="clean, jar">
224     <copy file="${product.jar}" todir="${dist.dir}"/>
225     </target>
226    
227    
228 tim 1.16 <target name="dist-docs" depends="filter-src"
229 tim 1.11 description="Builds javadocs without custom tags to dist folder">
230     <delete dir="${dist.javadocs.dir}"/>
231     <mkdir dir="${dist.javadocs.dir}"/>
232     <javadoc destdir="${dist.javadocs.dir}"
233     link="http://java.sun.com/j2se/1.4.1/docs/api"
234     overview="${src.dir}/intro.html"
235     source="${build.sourcelevel}">
236    
237     <packageset dir="${build.filter.src.dir}">
238     <include name="java/**"/>
239     </packageset>
240    
241     </javadoc>
242     </target>
243    
244 tim 1.1
245 tim 1.16 <target name="compile-ant-filter" depends="init">
246 tim 1.1 <mkdir dir="${build.ant.dir}"/>
247     <javac srcdir="${ant.src.dir}"
248     destdir="${build.ant.dir}"
249     source="1.4"
250     />
251     </target>
252    
253    
254 tim 1.11 <target name="filter-src" depends="compile-ant-filter">
255 tim 1.1 <mkdir dir="${build.filter.src.dir}"/>
256     <copy todir="${build.filter.src.dir}">
257     <fileset dir="${src.dir}">
258 tim 1.15 <include name="java/**/*.java"/>
259 tim 1.1 </fileset>
260     <filterchain>
261     <filterreader classname="jsr166.ant.filters.ReplaceFilter"
262     classpath="${build.ant.dir}">
263     <!--
264     # These arguments are to get rid of angle-bracketed type
265     # parameters so that javadoc can run on the result. The
266     # following heuristic that seems to work:
267     #
268     # For all lines not starting with space(s)-asterisk-space(s),
269     # replace <something> with a space, where there may be more
270     # than one right angle bracket at the end, and "something"
271     # must not contain parens or pipes. (This may need some
272     # tweaking.)
273     -->
274     <param name="notmatching" value="^\s+\*\s.*$"/>
275     <param name="pattern" value="&lt;[^|>()]+?>+"/>
276     <param name="replacement" value=" "/>
277     </filterreader>
278     <filterreader classname="jsr166.ant.filters.ReplaceFilter"
279     classpath="${build.ant.dir}">
280     <!--
281     # These arguments are to uncomment lines beginning with
282     # "//@" so that javadoc can see imports that are needed
283     # to resolve links but that shouldn't be in the compiled
284     # code.
285     -->
286     <param name="matching" value="^//@.*$"/>
287     <param name="pattern" value="^//@"/>
288     <param name="replacement" value=""/>
289     </filterreader>
290     </filterchain>
291     </copy>
292     </target>
293    
294    
295     <target name="compile-tests" depends="jar">
296     <mkdir dir="${build.testcases.dir}"/>
297     <javac srcdir="${test.src.dir}"
298     destdir="${build.testcases.dir}"
299     debug="${build.debug}"
300     debuglevel="${build.debuglevel}"
301     deprecation="${build.deprecation}"
302     source="${build.sourcelevel}"
303     fork="true">
304    
305 tim 1.11 <bootclasspath refid="javac.bootclasspath"/>
306     <compilerarg line="${javac.args} ${build.warnings.option}"/>
307 tim 1.2 <classpath refid="test.classpath"/>
308 tim 1.1 <include name="**/*Test.java"/>
309    
310     </javac>
311     </target>
312 tim 1.11
313 tim 1.1
314     <target name="run-tests" depends="compile-tests">
315     <mkdir dir="${build.reports.dir}"/>
316     <junit printsummary="true"
317     showoutput="true"
318     errorProperty="junit.failed"
319     failureProperty="junit.failed"
320 tim 1.12 dir="${build.reports.dir}"
321     fork="true">
322    
323     <jvmarg value="-Xbootclasspath/p:${product.jar}"/>
324 tim 1.1
325     <classpath>
326 tim 1.12 <!-- <path refid="test.classpath"/> -->
327 tim 1.1 <pathelement location="${build.testcases.dir}"/>
328     </classpath>
329    
330     <formatter type="xml"/>
331    
332     <batchtest todir="${build.reports.dir}">
333     <fileset dir="${test.src.dir}">
334     <include name="**/*Test.java"/>
335     </fileset>
336     </batchtest>
337    
338     </junit>
339     </target>
340    
341    
342     <target name="report-tests" depends="run-tests">
343     <!-- Sets junit.report.format to frames if Xalan is present,
344     otherwise sets it to noframes. -->
345     <available property="junit.report.format"
346     value="frames"
347     classname="org.apache.xalan.lib.Redirect"
348     />
349     <property name="junit.report.format" value="noframes"/>
350    
351     <junitreport todir="${build.reports.dir}">
352     <fileset dir="${build.reports.dir}">
353     <include name="TEST-*.xml"/>
354     </fileset>
355     <report styledir="${stylesheet.dir}"
356     format="${junit.report.format}"
357     todir="${build.reports.dir}"
358     />
359     </junitreport>
360    
361     <fail message="Test Cases Failed" if="junit.failed"/>
362     </target>
363    
364    
365     </project>