ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/build.xml
Revision: 1.14
Committed: Thu Dec 12 20:23:16 2002 UTC (21 years, 4 months ago) by tim
Content type: text/xml
Branch: MAIN
Changes since 1.13: +16 -0 lines
Log Message:
Add Anthill targets

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