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