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