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