ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/build.xml
Revision: 1.1
Committed: Mon Oct 7 04:07:37 2002 UTC (21 years, 6 months ago) by tim
Content type: text/xml
Branch: MAIN
Log Message:
Added Ant build file and support files to allow compilation of source
with -gj and javadoc generation from the same source.
Also added a sample JUnit test case.

File Contents

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