view j2se/make/netbeans/compiler/build.xml @ 2:16f2b6c91171 trunk

[svn] Load openjdk/jdk7/b14 into jdk/trunk.
author xiomara
date Fri, 22 Jun 2007 00:46:43 +0000
parents a4ed3fb96592
children 5937f8212f93
line wrap: on
line source

<!--
 Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
 are met:

   - Redistributions of source code must retain the above copyright
     notice, this list of conditions and the following disclaimer.

   - Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.

   - Neither the name of Sun Microsystems nor the names of its
     contributors may be used to endorse or promote products derived
     from this software without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->

<project name="compiler" default="build" basedir=".">
    <import file="../common/shared.xml"/>

    <patternset id="src.javac">
        <include name="javax/annotation/processing/**/*.java"/>
        <include name="javax/lang/model/**/*.java"/>
        <include name="javax/tools/**/*.java"/>
        <include name="com/sun/source/**/*.java"/>
        <include name="com/sun/tools/javac/**/*.java"/>
    </patternset>

    <fileset id="javac.resources" dir="${src.classes}">
        <include name="com/sun/tools/javac/resources/*.properties"/>
        <exclude name="**/*-template.*"/>
    </fileset>
    
    <target name="-prep" depends="-init">
        <property name="src.bin" value="${root}/src/share/opensource/javac/src/bin"/>
        <property name="src.classes" value="${root}/src/share/classes"/>
        <property name="build.bootclasses" value="${build.dir}/bootclasses"/>
    </target>
    
    <target name="check-javac.isuptodate">
        <uptodate targetfile="${dist.dir}/lib/javac.jar" property="javac.is.uptodate">
            <srcfiles dir="${src.classes}">
                <patternset refid="src.javac"/>
                <include name="${src.classes}/com/sun/tools/javac/resources/*.properties"/>
            </srcfiles>
        </uptodate>
    </target>
    
    <target name="build" depends="shared.build"/>
    
    <target name="-do-build-ant" depends="-prep,build-lib.javac.jar,build-bin.javac"/>

    <target name="build-lib.javac.jar" depends="check-javac.isuptodate" unless="javac.is.uptodate">
        <!-- to compile javac, set includeAntRuntime=no to prevent javac's 
        own tools.jar incorrectly appearing on the classpath -->
        <mkdir dir="${build.bootclasses}"/>
        <javac srcdir="${src.classes}" destdir="${build.bootclasses}"
            sourcepath=""
            source="${compiler.source.level}"  debug="true" debuglevel="source,lines"
            includeAntRuntime="no">
            <patternset refid="src.javac"/>
        </javac>
        <copy todir="${build.bootclasses}">
            <fileset refid="javac.resources"/>
        </copy>
        <echo message="recompiling compiler with itself"/>
        <pathconvert pathsep=" " property="src.javac.files">
            <path>
                <fileset dir="${src.classes}">
                    <patternset refid="src.javac"/>
                </fileset>
            </path>
        </pathconvert>
        <mkdir dir="${classes.dir}"/>
        <java fork="true" classpath="${build.bootclasses}" classname="com.sun.tools.javac.Main">
            <arg value="-sourcepath"/>
            <arg value=""/>
            <arg value="-d"/>
            <arg file="${classes.dir}"/>
            <arg value="-g:source,lines"/>
            <arg line="${src.javac.files}"/>
        </java>
	<copy todir="${classes.dir}">
            <fileset refid="javac.resources"/>
	</copy>
	<copy file="${src.classes}/com/sun/tools/javac/resources/version-template.properties"
	    tofile="${classes.dir}/com/sun/tools/javac/resources/version.properties">
	    <filterset begintoken="$(" endtoken=")">
		<filter token="JDK_VERSION"  value="${build.jdk.version}"/>
		<filter token="RELEASE"      value="${build.release}"/>
		<filter token="FULL_VERSION" value="${build.full.version}"/>
	    </filterset>
	</copy>
        <mkdir dir="${dist.dir}/lib"/>
        <jar destfile="${dist.dir}/lib/javac.jar" basedir="${classes.dir}" 
               includes="${includes}" excludes="${excludes}" >
            <manifest>
                <attribute name="Built-By" value="${user.name}"/>
                <attribute name="Built-At" value="${build.time}"/>
                <attribute name="Main-Class" value="com.sun.tools.javac.Main"/>
            </manifest>
        </jar>
    </target>
    
    <target name="build-bin.javac">
        <mkdir dir="${dist.dir}/bin"/>
        <copy tofile="${dist.dir}/bin/javac" file="${src.bin}/javac.sh"/>
        <chmod file="${dist.dir}/bin/javac" perm="+x"/>
    </target>

    <target name="clean" depends="-prep,shared.clean">
        <delete dir="${build.bootclasses}" includeemptydirs="true"/>
        <delete file="${dist.dir}/bin/javac"/>
        <delete file="${dist.dir}/lib/javac.jar"/>
    </target>
</project>