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

Contents of /jsr166/build.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (show annotations)
Wed Dec 11 15:59:11 2002 UTC (16 years, 9 months ago) by tim
Branch: MAIN
Changes since 1.10: +63 -41 lines
File MIME type: text/xml
Ignore dist directory, control -warnunchecked setting from property,
add init target to print banner with version.

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="true"/>
19 <property name="build.warnings" value="true"/>
20
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 <property name="build.javadocs.dir" location="${build.dir}/javadocs"/>
28 <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 <property name="dist.dir" location="${basedir}/dist"/>
38
39 <!-- Distribution locations -->
40 <property name="dist.javadocs.dir" location="${dist.dir}/docs"/>
41
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 <property name="javac.args" value='-J-Xbootclasspath/p:${javac.jar}'/>
50
51 <path id="javac.bootclasspath">
52 <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
61 <!-- Main targets -->
62
63 <target name="compile" depends="init"
64 description="Compiles all sources to build folder">
65 <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 <bootclasspath refid="javac.bootclasspath"/>
75 <compilerarg line="${javac.args} ${build.warnings.option}"/>
76
77 <!-- need this because srcdir is basedir! -->
78 <include name="java/**/*.java"/>
79
80 </javac>
81 </target>
82
83
84 <target name="jar" depends="compile"
85 description="Builds library jar from compiled sources">
86 <mkdir dir="${build.lib.dir}"/>
87 <jar basedir="${build.classes.dir}"
88 destfile="${product.jar}"
89 />
90 </target>
91
92
93 <target name="test" depends="init, report-tests"
94 description="Runs all tests"/>
95
96
97 <target name="docs" depends="init, clean-filtered-src, filter-src"
98 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 link="http://java.sun.com/j2se/1.4.1/docs/api"
103 overview="${src.dir}/intro.html"
104 source="${build.sourcelevel}">
105
106 <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 <packageset dir="${build.filter.src.dir}">
111 <include name="java/**"/>
112 </packageset>
113
114 </javadoc>
115 </target>
116
117
118 <target name="dist" depends="init, dist-clean, dist-jar, dist-docs"/>
119
120
121 <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 </target>
127
128
129 <target name="dist-clean"
130 description="Removes all build and distribution products">
131 <delete dir="${dist.dir}"/>
132 </target>
133
134
135 <!-- Internal targets -->
136
137 <target name="set-warnings-if" if="build.warnings">
138 <property name="build.warnings.option" value="-warnunchecked"/>
139 </target>
140
141 <target name="set-warnings-unless" unless="build.warnings">
142 <property name="build.warnings.option" value=""/>
143 </target>
144
145 <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 </target>
150
151
152 <target name="clean-filtered-src">
153 <delete dir="${build.filter.src.dir}"/>
154 </target>
155
156
157 <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
179 <target name="compile-ant-filter">
180 <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 <target name="filter-src" depends="compile-ant-filter">
189 <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="&lt;[^|>()]+?>+"/>
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 <bootclasspath refid="javac.bootclasspath"/>
240 <compilerarg line="${javac.args} ${build.warnings.option}"/>
241 <classpath refid="test.classpath"/>
242 <include name="**/*Test.java"/>
243
244 </javac>
245 </target>
246
247
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 dir="${build.reports.dir}">
255
256 <classpath>
257 <path refid="test.classpath"/>
258 <pathelement location="${build.testcases.dir}"/>
259 </classpath>
260
261 <formatter type="xml"/>
262
263 <batchtest todir="${build.reports.dir}">
264 <fileset dir="${test.src.dir}">
265 <include name="**/*Test.java"/>
266 </fileset>
267 </batchtest>
268
269 </junit>
270 </target>
271
272
273 <target name="report-tests" depends="run-tests">
274 <!-- Sets junit.report.format to frames if Xalan is present,
275 otherwise sets it to noframes. -->
276 <available property="junit.report.format"
277 value="frames"
278 classname="org.apache.xalan.lib.Redirect"
279 />
280 <property name="junit.report.format" value="noframes"/>
281
282 <junitreport todir="${build.reports.dir}">
283 <fileset dir="${build.reports.dir}">
284 <include name="TEST-*.xml"/>
285 </fileset>
286 <report styledir="${stylesheet.dir}"
287 format="${junit.report.format}"
288 todir="${build.reports.dir}"
289 />
290 </junitreport>
291
292 <fail message="Test Cases Failed" if="junit.failed"/>
293 </target>
294
295
296 </project>

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