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