|
1 <?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
3 <!-- |
|
4 Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. |
|
5 |
|
6 Redistribution and use in source and binary forms, with or without |
|
7 modification, are permitted provided that the following conditions |
|
8 are met: |
|
9 |
|
10 - Redistributions of source code must retain the above copyright |
|
11 notice, this list of conditions and the following disclaimer. |
|
12 |
|
13 - Redistributions in binary form must reproduce the above copyright |
|
14 notice, this list of conditions and the following disclaimer in the |
|
15 documentation and/or other materials provided with the distribution. |
|
16 |
|
17 - Neither the name of Sun Microsystems nor the names of its |
|
18 contributors may be used to endorse or promote products derived |
|
19 from this software without specific prior written permission. |
|
20 |
|
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
|
22 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
|
23 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
24 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
|
25 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
|
26 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|
27 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
|
28 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
|
29 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
30 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
31 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
32 --> |
|
33 |
|
34 <project name="shared" basedir=".."> |
|
35 |
|
36 <import file="make.xml"/> |
|
37 |
|
38 <target name="-tstamp"> |
|
39 <tstamp> |
|
40 <format property="build.time" pattern="MM/dd/yyyy hh:mm aa"/> |
|
41 <format property="build.fullversion.time" pattern="MM/dd/yyyy_HH_mm"/> |
|
42 </tstamp> |
|
43 </target> |
|
44 |
|
45 <target name="-first-init" depends="-tstamp"> |
|
46 <mkdir dir="${user.home}/.openjdk"/> |
|
47 <property name="workspace-user-build.properties" location="nbproject/private/build.properties"/> |
|
48 <property file="${workspace-user-build.properties}"/> |
|
49 <property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/> |
|
50 <property name="user-build.properties" location="${user.home}/.openjdk/build.properties"/> |
|
51 <property file="${user-build.properties}"/> |
|
52 <property file="${basedir}/build.properties"/> |
|
53 <property environment="env."/> |
|
54 </target> |
|
55 <target name="-warn-about-bootstrap.jdk" depends="-first-init" unless="bootstrap.jdk"> |
|
56 <property name="fallback.jdk" location="${java.home}/.."/> |
|
57 <echo level="warning">Warning: falling back to building against ${fallback.jdk}</echo> |
|
58 <echo level="warning">Please define bootstrap.jdk=.../recent/jdk7/snapshot in ${user-build.properties} or ${workspace-user-build.properties}</echo> |
|
59 </target> |
|
60 <target name="-pre-init"> |
|
61 <!-- Invoked before -first-init. --> |
|
62 <!-- Empty placeholder for easier customization. --> |
|
63 <!-- You can override this target in the ../build.xml file. --> |
|
64 </target> |
|
65 <target name="-post-init"> |
|
66 <!-- Invoked after -project-init. --> |
|
67 <!-- Empty placeholder for easier customization. --> |
|
68 <!-- You can override this target in the ../build.xml file. --> |
|
69 </target> |
|
70 <target name="-init" description="Initial configuration used by everything else." depends="-pre-init,-first-init,-project-init,-post-init"/> |
|
71 <target name="-project-init" depends="-warn-about-bootstrap.jdk"> |
|
72 <property name="root" location="../../.."/> |
|
73 <property file="../common/architectures/name-${os.name}.properties"/> |
|
74 <property name="platform" value="windows"/> |
|
75 <property file="../common/architectures/arch-${os.arch}.properties"/> |
|
76 <property name="arch" value="${os.arch}"/> |
|
77 <echo level="verbose">System configuration claims architecture is ${platform}-${arch}</echo> |
|
78 <property name="build.dir" location="${root}/build/${platform}-${arch}"/> |
|
79 <property name="bin.dir" location="${build.dir}/bin"/> |
|
80 <property name="make.dir" location="${root}/make"/> |
|
81 <property name="gensrc.dir" location="${build.dir}/gensrc"/> |
|
82 <property name="classes.dir" location="${build.dir}/classes"/> |
|
83 <property name="jtreg.dir" location="${build.dir}/jtreg/${ant.project.name}"/> |
|
84 <property name="dist.dir" value="${root}/dist"/> |
|
85 <property name="includes" value="(nothing)"/> |
|
86 <property name="excludes" value=""/> |
|
87 <property name="javadoc.dir" location="${build.dir}/javadoc/${ant.project.name}"/> |
|
88 <condition property="os.linux"> |
|
89 <os name="linux"/> |
|
90 </condition> |
|
91 <condition property="os.solaris"> |
|
92 <os name="SunOS"/> |
|
93 </condition> |
|
94 <condition property="osfamily.unix"> |
|
95 <os family="unix"/> |
|
96 </condition> |
|
97 <condition property="os.windows"> |
|
98 <os family="windows"/> |
|
99 </condition> |
|
100 <condition property="platform.src.dir" value="${root}/src/solaris/classes"> |
|
101 <os family="unix"/> |
|
102 </condition> |
|
103 <condition property="platform.src.dir" value="${root}/src/windows/classes"> |
|
104 <os family="windows"/> |
|
105 </condition> |
|
106 <property name="share.src.dir" value="${root}/src/share/classes"/> |
|
107 <property name="bootstrap.jdk" location="${fallback.jdk}"/> |
|
108 <!-- XXX ensure that bootstrap.jdk meets some minimum version requirements (TBD) --> |
|
109 <condition property="bootstrap.javac" value="${bootstrap.jdk}/bin/javac"> |
|
110 <available file="${bootstrap.jdk}/bin/javac"/> |
|
111 </condition> |
|
112 <condition property="bootstrap.javac" value="${bootstrap.jdk}\bin\javac.exe"> |
|
113 <available file="${bootstrap.jdk}\bin\javac.exe"/> |
|
114 </condition> |
|
115 <fail unless="bootstrap.javac">${bootstrap.jdk} does not appear to be a functional JDK; no javac found.</fail> |
|
116 <property name="javac.options" value="-Xlint"/> <!-- default, can be overridden per user or per project --> |
|
117 <property name="javac.debug" value="true"/> <!-- default, can be overridden per user or per project --> |
|
118 <property name="javac.debuglevel" value="lines,vars,source"/> <!-- default, can be overridden per user or per project --> |
|
119 <macrodef name="jdk-javac"> |
|
120 <attribute name="srcdir"/> |
|
121 <attribute name="includes" default="${includes}"/> |
|
122 <attribute name="excludes" default="${excludes}"/> |
|
123 <attribute name="classesdir" default="${classes.dir}"/> |
|
124 <sequential> |
|
125 <mkdir dir="@{classesdir}"/> |
|
126 <javac srcdir="@{srcdir}" includes="@{includes}" excludes="@{excludes}" sourcepath="" |
|
127 destdir="@{classesdir}" fork="true" executable="${bootstrap.javac}" |
|
128 debug="${javac.debug}" debuglevel="${javac.debuglevel}"> |
|
129 <compilerarg value="-source"/> |
|
130 <compilerarg value="1.5"/> |
|
131 <compilerarg value="-target"/> |
|
132 <compilerarg value="1.6"/> <!-- for usability of JDK 6 as snapshot; change to 1.7 when JSR 294 put back --> |
|
133 <!-- Mandatory for compiling partial JDK sources against a snapshot; should NEVER be used for any other purpose: --> |
|
134 <compilerarg value="-XDignore.symbol.file=true"/> |
|
135 <compilerarg line="${javac.options}"/> |
|
136 </javac> |
|
137 </sequential> |
|
138 </macrodef> |
|
139 <available property="have.closed.src" file="${root}/src/closed/share/classes" type="dir"/> |
|
140 </target> |
|
141 |
|
142 <target name="-pre-compile"> |
|
143 <!-- Empty placeholder for easier customization. --> |
|
144 <!-- You can override this target in the ../build.xml file. --> |
|
145 </target> |
|
146 <target name="-post-compile"> |
|
147 <!-- Empty placeholder for easier customization. --> |
|
148 <!-- You can override this target in the ../build.xml file. --> |
|
149 </target> |
|
150 |
|
151 <target name="build" depends="-init,-pre-compile,-build-ant,-build-make,-post-compile" description="Build sources."/> |
|
152 <target name="-do-build-ant"> |
|
153 <depend srcdir="${share.src.dir}:${platform.src.dir}:${root}/src/closed/share/classes:${gensrc.dir}" destdir="${classes.dir}" cache="${build.dir}/depcache" includes="${includes}" excludes="${excludes}"/> |
|
154 <mkdir dir="${gensrc.dir}"/> |
|
155 <jdk-javac srcdir="${share.src.dir}:${platform.src.dir}:${gensrc.dir}"/> |
|
156 <property name="copy.excludes" value="**/*.java,**/package.html,**/doc-files/"/> |
|
157 <copy todir="${classes.dir}"> |
|
158 <fileset dir="${share.src.dir}" includes="${includes}" excludes="${excludes},${copy.excludes}"/> |
|
159 <fileset dir="${platform.src.dir}" includes="${includes}" excludes="${excludes},${copy.excludes}"/> |
|
160 </copy> |
|
161 <antcall target="-maybe-do-build-ant-closed"/> |
|
162 </target> |
|
163 <target name="-maybe-do-build-ant-closed" if="have.closed.src"> |
|
164 <jdk-javac srcdir="${root}/src/closed/share/classes"/> |
|
165 <copy todir="${classes.dir}"> |
|
166 <fileset dir="${root}/src/closed/share/classes" includes="${includes}" excludes="${excludes},${copy.excludes}"/> |
|
167 </copy> |
|
168 </target> |
|
169 <target name="-build-ant" depends="-init" unless="use.make"> |
|
170 <antcall target="-do-build-ant"/> |
|
171 </target> |
|
172 <target name="-build-make" depends="-init" if="use.make"> <!-- override me to call <make-run> --> |
|
173 <echo level="info">No make target defined for this project; falling back to simple Java build</echo> |
|
174 <antcall target="-do-build-ant"/> |
|
175 </target> |
|
176 |
|
177 <target name="clean" depends="-init,-clean-docs-tests,-clean-ant,-clean-make" description="Clean build products."/> |
|
178 <target name="-do-clean-ant"> |
|
179 <!-- XXX first s/\.java/.class/g in includes and excludes! --> |
|
180 <delete dir="${classes.dir}" includes="${includes}" excludes="${excludes}" includeemptydirs="true"/> |
|
181 <delete dir="${gensrc.dir}" includes="${includes}" excludes="${excludes}" includeemptydirs="true"/> |
|
182 <delete dir="${build.dir}/depcache"/> |
|
183 </target> |
|
184 <target name="-clean-docs-tests"> |
|
185 <delete dir="${javadoc.dir}" includeemptydirs="true"/> |
|
186 <delete dir="${jtreg.dir}" includeemptydirs="true"/> |
|
187 </target> |
|
188 <target name="-clean-ant" depends="-init" unless="use.make"> |
|
189 <antcall target="-do-clean-ant"/> |
|
190 </target> |
|
191 <target name="-clean-make" depends="-init" if="use.make"> <!-- override me to call <make-run> --> |
|
192 <echo level="info">No make clean target defined for this project; falling back to simple Java clean</echo> |
|
193 <antcall target="-do-clean-ant"/> |
|
194 </target> |
|
195 |
|
196 <target name="compile-single" depends="-init"> |
|
197 <fail unless="srcdir">Must set property 'srcdir'</fail> |
|
198 <fail unless="includes">Must set property 'includes'</fail> |
|
199 <jdk-javac srcdir="${srcdir}" includes="${includes}" excludes=""/> |
|
200 </target> |
|
201 <target name="debug-fix" depends="-init" if="netbeans.home"> |
|
202 <fail unless="class">Must set property 'class'</fail> |
|
203 <antcall target="compile-single"> |
|
204 <param name="includes" value="${class}.java"/> |
|
205 </antcall> |
|
206 <nbjpdareload> |
|
207 <fileset dir="${classes.dir}"> |
|
208 <include name="${class}.class"/> |
|
209 </fileset> |
|
210 </nbjpdareload> |
|
211 </target> |
|
212 |
|
213 <target name="-taskdef-jtreg" depends="-init" unless="jtreg.defined"> |
|
214 <fail message="Cannot locate jtreg: please set jtreg.home to its location"> |
|
215 <condition> |
|
216 <not> |
|
217 <isset property="jtreg.home"/> |
|
218 </not> |
|
219 </condition> |
|
220 </fail> |
|
221 <fail message="jtreg is not installed in ${jtreg.home}"> |
|
222 <condition> |
|
223 <not> |
|
224 <and> |
|
225 <available file="${jtreg.home}/lib/jtreg.jar"/> |
|
226 <available file="${jtreg.home}/lib/javatest.jar"/> |
|
227 </and> |
|
228 </not> |
|
229 </condition> |
|
230 </fail> |
|
231 <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant"> |
|
232 <classpath> |
|
233 <pathelement location="${jtreg.home}/lib/jtreg.jar"/> |
|
234 <pathelement location="${jtreg.home}/lib/javatest.jar"/> |
|
235 </classpath> |
|
236 </taskdef> |
|
237 <property name="jtreg.defined" value="true"/> |
|
238 </target> |
|
239 <target name="-check-tests-defined" unless="jtreg.tests"> |
|
240 <fail>You must define jtreg.tests to select some tests to run.</fail> |
|
241 </target> |
|
242 <target name="-jtreg-setup"> |
|
243 <property name="jtreg.vm.options" value=""/> <!-- default, can be overridden per user or per project --> |
|
244 <property name="jtreg.options" value=""/> <!-- default, can be overridden per user or per project --> |
|
245 <property name="jtreg.samevm" value="false"/> <!-- default, can be overridden per user or per project --> |
|
246 </target> |
|
247 <target name="-jtreg-ant" unless="use.make"> |
|
248 <jtreg dir="${root}/test" samevm="${jtreg.samevm}" verbose="summary" |
|
249 jdk="${bootstrap.jdk}" |
|
250 failonerror="false" resultproperty="jtreg.result" |
|
251 javacoptions="-g" |
|
252 vmoptions="-Xbootclasspath/p:${classes.dir} ${jtreg.vm.options}" |
|
253 reportDir="${jtreg.dir}/JTreport" |
|
254 workDir="${jtreg.dir}/JTwork" |
|
255 includes="${jtreg.tests}"> |
|
256 <arg line="${jtreg.options}"/> |
|
257 </jtreg> |
|
258 </target> |
|
259 <target name="-jtreg-make" if="use.make"> |
|
260 <jtreg dir="${root}/test" samevm="${jtreg.samevm}" verbose="summary" |
|
261 failonerror="false" resultproperty="jtreg.result" |
|
262 jdk="${build.dir}" |
|
263 vmoptions="${jtreg.vm.options}" |
|
264 javacoptions="-g" |
|
265 reportDir="${jtreg.dir}/JTreport" |
|
266 workDir="${jtreg.dir}/JTwork" |
|
267 includes="${jtreg.tests}"> |
|
268 <arg line="${jtreg.options}"/> |
|
269 </jtreg> |
|
270 </target> |
|
271 <target name="-pre-jtreg"> |
|
272 <!-- Empty placeholder for easier customization. --> |
|
273 <!-- You can override this target in the ../build.xml file. --> |
|
274 </target> |
|
275 <target name="-post-jtreg"> |
|
276 <!-- Empty placeholder for easier customization. --> |
|
277 <!-- You can override this target in the ../build.xml file. --> |
|
278 </target> |
|
279 <target name="-jtreg" depends="-init,-pre-jtreg,-taskdef-jtreg,-check-tests-defined,-jtreg-setup,-jtreg-make,-jtreg-ant,-post-jtreg"> |
|
280 <property name="jtreg.report" location="${jtreg.dir}/JTreport/report.html"/> |
|
281 <condition property="jtreg.passed"> |
|
282 <equals arg1="${jtreg.result}" arg2="0"/> |
|
283 </condition> |
|
284 </target> |
|
285 <target name="test" depends="jtreg"/> <!-- Allow use of existing finger muscle memory from command line. --> |
|
286 <target name="jtreg" depends="-jtreg" description="Run jtreg-based tests." unless="jtreg.passed"> |
|
287 <fail>${jtreg.report}: some tests failed.</fail> |
|
288 </target> |
|
289 <target name="jtreg-nb" depends="-jtreg" if="netbeans.home" unless="jtreg.passed"> |
|
290 <makeurl file="${jtreg.report}" property="jtreg.report.url"/> |
|
291 <nbbrowse url="${jtreg.report.url}#Results"/> |
|
292 <fail>Some tests failed; see report for details.</fail> |
|
293 </target> |
|
294 <target name="jtreg-debug-nb" depends="-init" if="netbeans.home"> |
|
295 <!-- No package decls -> "source root" is immediately containing dir --> |
|
296 <dirname file="${root}/test/${jtreg.tests}" property="test.dir"/> |
|
297 <nbjpdastart addressproperty="jpda.address" name="${ant.project.name}" transport="dt_socket"> |
|
298 <bootclasspath> |
|
299 <pathelement location="${classes.dir}"/> |
|
300 <pathelement location="${bootstrap.jdk}/jre/lib/rt.jar"/> |
|
301 </bootclasspath> |
|
302 <classpath> |
|
303 <pathelement location="${jtreg.dir}/JTwork/classes"/> |
|
304 </classpath> |
|
305 <sourcepath> |
|
306 <pathelement location="${share.src.dir}"/> |
|
307 <pathelement location="${platform.src.dir}"/> |
|
308 <pathelement location="${root}/src/closed/share/classes"/> |
|
309 <pathelement location="${test.dir}"/> |
|
310 </sourcepath> |
|
311 </nbjpdastart> |
|
312 <antcall target="-jtreg"> |
|
313 <param name="jtreg.vm.options" value="-Xdebug -Xrunjdwp:transport=dt_socket,address=${jpda.address}"/> |
|
314 </antcall> |
|
315 </target> |
|
316 |
|
317 <target name="debug" depends="-init" if="netbeans.home"> |
|
318 <!-- No package decls -> "source root" is immediately containing dir --> |
|
319 <dirname file="${root}/test/${jtreg.tests}" property="test.dir"/> |
|
320 <nbjpdastart addressproperty="jpda.address" name="${ant.project.name}" transport="dt_socket"> |
|
321 <bootclasspath> |
|
322 <pathelement location="${classes.dir}"/> |
|
323 <pathelement location="${bootstrap.jdk}/jre/lib/rt.jar"/> |
|
324 </bootclasspath> |
|
325 <sourcepath> |
|
326 <pathelement location="${share.src.dir}"/> |
|
327 <pathelement location="${platform.src.dir}"/> |
|
328 <pathelement location="${root}/src/closed/share/classes"/> |
|
329 <pathelement location="${test.dir}"/> |
|
330 </sourcepath> |
|
331 </nbjpdastart> |
|
332 <antcall target="run"> |
|
333 <param name="jvm.args" value="-Xdebug -Xrunjdwp:transport=dt_socket,address=${jpda.address}"/> |
|
334 </antcall> |
|
335 </target> |
|
336 |
|
337 <target name="javadoc" depends="-init" description="Build basic Javadoc for public packages."> |
|
338 <property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project --> |
|
339 <!-- Note: even with this default value, includes/excludes |
|
340 from share.src.dir get javadoc'd; see packageset below --> |
|
341 <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project --> |
|
342 <javadoc destdir="${javadoc.dir}" source="1.5" |
|
343 windowtitle="UNOFFICIAL" failonerror="true" use="true" |
|
344 author="false" version="false" |
|
345 packagenames="${javadoc.packagenames}"> |
|
346 <header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header> |
|
347 <arg line="${javadoc.options}"/> |
|
348 <bootclasspath> |
|
349 <path location="${bootstrap.jdk}/jre/lib/rt.jar"/> |
|
350 <path location="${classes.dir}"/> |
|
351 </bootclasspath> |
|
352 <sourcepath> |
|
353 <pathelement location="${share.src.dir}"/> |
|
354 <pathelement location="${platform.src.dir}"/> |
|
355 <pathelement location="${root}/src/closed/share/classes"/> |
|
356 <pathelement location="${root}/src/share/doc/stub"/> |
|
357 </sourcepath> |
|
358 <!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> --> |
|
359 <!-- means that {@link some.package} will not work, which is no good. --> |
|
360 <!-- (It correctly skips excluded single classes, but not if packageset is also included, --> |
|
361 <!-- which also causes duplicates in the class index for included files.) --> |
|
362 <packageset dir="${share.src.dir}" includes="${includes}" excludes="${excludes}"> |
|
363 <or> |
|
364 <filename name="java/"/> |
|
365 <filename name="javax/"/> |
|
366 <filename name="org/ietf/jgss/"/> |
|
367 <filename name="org/omg/"/> |
|
368 <filename name="org/w3c/"/> |
|
369 <filename name="org/xml/sax/"/> |
|
370 </or> |
|
371 </packageset> |
|
372 </javadoc> |
|
373 </target> |
|
374 <target name="javadoc-nb" depends="javadoc" if="netbeans.home"> |
|
375 <nbbrowse file="${javadoc.dir}/index.html"/> |
|
376 </target> |
|
377 |
|
378 </project> |