10
|
1 |
<!--
|
|
2 |
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
3 |
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
|
|
5 |
This code is free software; you can redistribute it and/or modify it
|
|
6 |
under the terms of the GNU General Public License version 2 only, as
|
|
7 |
published by the Free Software Foundation. Sun designates this
|
|
8 |
particular file as subject to the "Classpath" exception as provided
|
|
9 |
by Sun in the LICENSE file that accompanied this code.
|
|
10 |
|
|
11 |
This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
accompanied this code).
|
|
16 |
|
|
17 |
You should have received a copy of the GNU General Public License version
|
|
18 |
2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
|
|
21 |
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
22 |
CA 95054 USA or visit www.sun.com if you need additional information or
|
|
23 |
have any questions.
|
|
24 |
-->
|
|
25 |
|
|
26 |
<project name="os-javac" default="build" basedir=".">
|
|
27 |
<property name="src" value="src"/>
|
|
28 |
<property name="src.bin" value="${src}/bin"/>
|
|
29 |
<property name="src.classes" value="${src}/share/classes"/>
|
|
30 |
<property name="build" value ="build"/>
|
|
31 |
<property name="build.bootclasses" value="${build}/bootclasses"/>
|
|
32 |
<property name="build.classes" value="${build}/classes"/>
|
|
33 |
<property name="build.jtreg" value="${build}/jtreg"/>
|
|
34 |
<property name="dist" value="dist"/>
|
|
35 |
<property name="dist.javac" value="${dist}"/>
|
|
36 |
|
|
37 |
<patternset id="src.javac">
|
|
38 |
<include name="javax/annotation/processing/**/*.java"/>
|
|
39 |
<include name="javax/lang/model/**/*.java"/>
|
|
40 |
<include name="javax/tools/**/*.java"/>
|
|
41 |
<include name="com/sun/source/**/*.java"/>
|
|
42 |
<include name="com/sun/tools/javac/**/*.java"/>
|
|
43 |
</patternset>
|
|
44 |
|
|
45 |
<fileset id="javac.resources" dir="${src.classes}">
|
|
46 |
<include name="com/sun/tools/javac/resources/*.properties"/>
|
|
47 |
<exclude name="**/*-template.*"/>
|
|
48 |
</fileset>
|
|
49 |
|
|
50 |
<target name="prep">
|
|
51 |
<mkdir dir="${build.bootclasses}"/>
|
|
52 |
<mkdir dir="${build.classes}"/>
|
|
53 |
<mkdir dir="${dist.javac}/bin"/>
|
|
54 |
<mkdir dir="${dist.javac}/lib"/>
|
|
55 |
<tstamp>
|
|
56 |
<format property="build.time" pattern="MM/dd/yyyy hh:mm aa"/>
|
|
57 |
<format property="build.fullversion.time" pattern="MM/dd/yyyy_HH_mm"/>
|
|
58 |
</tstamp>
|
|
59 |
<property file="build.properties"/>
|
|
60 |
</target>
|
|
61 |
|
|
62 |
<target name="check-javac.isuptodate">
|
|
63 |
<uptodate targetfile="${dist.javac}/lib/javac.jar" property="javac.is.uptodate">
|
|
64 |
<srcfiles dir="${src.classes}">
|
|
65 |
<patternset refid="src.javac"/>
|
|
66 |
<include name="${src.classes}/com/sun/tools/javac/resources/*.properties"/>
|
|
67 |
</srcfiles>
|
|
68 |
</uptodate>
|
|
69 |
</target>
|
|
70 |
|
|
71 |
<target name="build" depends="prep,build-lib.javac.jar,build-bin.javac"/>
|
|
72 |
|
|
73 |
<target name="build-lib.javac.jar" depends="check-javac.isuptodate" unless="javac.is.uptodate">
|
|
74 |
<!-- to compile javac, set includeAntRuntime=no to prevent javac's
|
|
75 |
own tools.jar incorrectly appearing on the classpath -->
|
|
76 |
<javac srcdir="${src.classes}" destdir="${build.bootclasses}"
|
|
77 |
source="${compiler.source.level}" debug="true" debuglevel="source,lines"
|
|
78 |
includeAntRuntime="no">
|
|
79 |
<patternset refid="src.javac"/>
|
|
80 |
</javac>
|
|
81 |
<copy todir="${build.bootclasses}">
|
|
82 |
<fileset refid="javac.resources"/>
|
|
83 |
</copy>
|
|
84 |
<echo message="recompiling compiler with itself"/>
|
|
85 |
<pathconvert pathsep=" " property="src.javac.files">
|
|
86 |
<path>
|
|
87 |
<fileset dir="${src.classes}">
|
|
88 |
<patternset refid="src.javac"/>
|
|
89 |
</fileset>
|
|
90 |
</path>
|
|
91 |
</pathconvert>
|
|
92 |
<java fork="true" classpath="${build.bootclasses}" classname="com.sun.tools.javac.Main">
|
|
93 |
<arg value="-sourcepath"/>
|
|
94 |
<arg value=""/>
|
|
95 |
<arg value="-d"/>
|
|
96 |
<arg file="${build.classes}"/>
|
|
97 |
<arg value="-g:source,lines"/>
|
|
98 |
<arg line="${src.javac.files}"/>
|
|
99 |
</java>
|
|
100 |
<copy todir="${build.classes}">
|
|
101 |
<fileset refid="javac.resources"/>
|
|
102 |
</copy>
|
|
103 |
<copy file="${src.classes}/com/sun/tools/javac/resources/version-template.properties"
|
|
104 |
tofile="${build.classes}/com/sun/tools/javac/resources/version.properties">
|
|
105 |
<filterset begintoken="$(" endtoken=")">
|
|
106 |
<filter token="JDK_VERSION" value="${build.jdk.version}"/>
|
|
107 |
<filter token="RELEASE" value="${build.release}"/>
|
|
108 |
<filter token="FULL_VERSION" value="${build.full.version}"/>
|
|
109 |
</filterset>
|
|
110 |
</copy>
|
|
111 |
<jar destfile="${dist.javac}/lib/javac.jar" basedir="${build.classes}">
|
|
112 |
<manifest>
|
|
113 |
<attribute name="Built-By" value="${user.name}"/>
|
|
114 |
<attribute name="Built-At" value="${build.time}"/>
|
|
115 |
<attribute name="Main-Class" value="com.sun.tools.javac.Main"/>
|
|
116 |
</manifest>
|
|
117 |
</jar>
|
|
118 |
</target>
|
|
119 |
|
|
120 |
<target name="build-bin.javac">
|
|
121 |
<copy tofile="${dist.javac}/bin/javac" file="${src.bin}/javac.sh"/>
|
|
122 |
<chmod file="${dist.javac}/bin/javac" perm="+x"/>
|
|
123 |
</target>
|
|
124 |
|
|
125 |
<property name="javadoc.jls3.url" value="http://java.sun.com/docs/books/jls/"/>
|
|
126 |
<property name="javadoc.jls3.cite" value="<a href="${javadoc.jls3.url}">The Java Language Specification, Third Edition</a>"/>
|
|
127 |
|
|
128 |
<target name="docs" depends="prep">
|
|
129 |
<javadoc sourcepath="${src.classes}" destdir="${dist}/doc/api"
|
|
130 |
bootclasspath="${java.home}/lib/rt.jar" classpath="">
|
|
131 |
<package name="javax.annotation.processing.*"/>
|
|
132 |
<package name="javax.lang.model.*"/>
|
|
133 |
<package name="javax.tools.*"/>
|
|
134 |
<package name="com.sun.source.*"/>
|
|
135 |
<package name="com.sun.tools.javac.*"/>
|
|
136 |
<arg value="-tag"/>
|
|
137 |
<arg value="jls3:a:See <cite>${javadoc.jls3.cite}</cite>:"/>
|
|
138 |
</javadoc>
|
|
139 |
</target>
|
|
140 |
|
|
141 |
<target name="test" depends="xtest" />
|
|
142 |
|
|
143 |
<!-- can't call it test, because NetBeans associates that with JUnit -->
|
|
144 |
<target name="xtest" depends="build">
|
|
145 |
<fail unless="jtreg.home" message="Property 'jtreg.home' needs to be set to the jtreg installation directory."/>
|
|
146 |
<taskdef name="jtreg" classpath="${jtreg.home}/lib/jtreg.jar" classname="com.sun.javatest.regtest.Main$$Ant"/>
|
|
147 |
<fail unless="test.jdk.home" message="Property 'test.jdk.home' needs to be set to the baseline JDK to be used to run the tests"/>
|
|
148 |
<jtreg dir="test" samevm="true" verbose="summary"
|
|
149 |
jdk="${test.jdk.home}"
|
|
150 |
workDir="${build.jtreg}/work"
|
|
151 |
reportDir="${build.jtreg}/report">
|
|
152 |
<arg value="-noshell"/>
|
|
153 |
<arg value="-Xbootclasspath/p:${dist.javac}/lib/javac.jar"/>
|
|
154 |
<include name="tools/javac"/>
|
|
155 |
</jtreg>
|
|
156 |
</target>
|
|
157 |
|
|
158 |
<target name="clean">
|
|
159 |
<delete dir="${build}"/>
|
|
160 |
<delete dir="${dist}"/>
|
|
161 |
</target>
|
|
162 |
|
|
163 |
</project>
|