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

Annotation of /jsr166/build.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (view) (download) (as text)

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

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8