langtools/make/netbeans/common/shared.xml
author tbell
Thu, 14 Aug 2008 22:17:02 -0700
changeset 1049 1f47a876c043
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
<?xml version="1.0" encoding="UTF-8"?>
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
<!--
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 Redistribution and use in source and binary forms, with or without
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 modification, are permitted provided that the following conditions
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 are met:
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
   - Redistributions of source code must retain the above copyright
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
     notice, this list of conditions and the following disclaimer.
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
   - Redistributions in binary form must reproduce the above copyright
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
     notice, this list of conditions and the following disclaimer in the
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
     documentation and/or other materials provided with the distribution.
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
   - Neither the name of Sun Microsystems nor the names of its
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
     contributors may be used to endorse or promote products derived
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
     from this software without specific prior written permission.
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
 PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
-->
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
<!--
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 The file contains targets for NetBeans action that are shared across
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 all langtools projects.
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
-->
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
<project name="shared" default="build" basedir="../../..">
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
    <!-- 
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
       Instead of importing the main build file, we could call it when needed.
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
       That would reduce the list of Ant targets that get displayed for this
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
       file, but it also complicates the interface between the project build 
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
       file and the main build file. For example, some imported targets
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
       would have to be reclared, properties would have to be restructured,
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
       and it would be harder to run results (e.g. in properties) from nested 
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
       targets.
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
     -->
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
    <import file="../../build.xml"/> 
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
    
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
    <property name="tool.mainclass" value="com.sun.tools.${tool.name}.Main"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
    <property name="tool.default.args" value="-version"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
    
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
    <!-- compile a single file -->
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
 
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
    <!-- for compile-single, etc, we might want different targets for 
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
         javac and not javac, because of bootstrap issues -->
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
    <target name="compile-single" depends="build-bootstrap-javac">
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
        <fail unless="includes">Must set property 'includes'</fail>
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
        <javac fork="true" executable="${build.bootstrap.dir}/bin/javac"
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
               srcdir="${src.classes.dir}"
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
               destdir="${build.classes.dir}"
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
               includes="${includes}"
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
               sourcepath=""
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
               includeAntRuntime="no"
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
               target="${target}"
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
               debug="${javac.debug}" 
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
               debuglevel="${javac.debuglevel}"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    </target>
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
    
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
    <!-- run tool -->
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
    
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
    <target name="run" depends="build,-def-run" description="run ${tool.description}">
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
        <run/>
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    </target>
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
    
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
    <!-- run a selected class -->
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
    
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
    <target name="run-single" depends="-def-run">
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
        <fail unless="run.classname">Must set property 'run.classname'</fail>
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
        <run name="${run.classname}" mainclass="${run.classname}" default.args=""/>
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
    </target>
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
    
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    <!-- run jtreg tests, and display results in NetBeans -->
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
    
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
    <target name="-jtreg-nb" depends="-jtreg" if="netbeans.home" unless="jtreg.passed">
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
        <nbbrowse file="${jtreg.report}/report.html"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
        <fail>Some tests failed; see report for details.</fail>
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
    </target>
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
    
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
    <!-- debug tool in NetBeans -->
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
    <target name="-debug-nb" depends="build,-def-run,-def-start-debugger" if="netbeans.home">
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
        <start-debugger/>
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
        <run jpda.jvmargs="${jpda.jvmargs}"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    </target>
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
    
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
    <!-- debug a selected class -->
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
    
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
    <target name="debug-single-nb" depends="-def-start-debugger,-def-run">
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
        <fail unless="debug.classname">Must set property 'debug.classname'</fail>
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
        <start-debugger/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
        <run name="${debug.classname}" mainclass="${debug.classname}" default.args=""
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
             jpda.jvmargs="${jpda.jvmargs}"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    </target>
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
    
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
    <!-- debug a jtreg test -->
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
    <target name="debug-jtreg-nb" depends="-def-start-debugger,-def-jtreg"> 
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
        <fail unless="jtreg.tests">Must set property 'jtreg.tests'</fail>
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
        <start-debugger/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
        <jtreg-tool name="${tool.name}" samevm="false" tests="${jtreg.tests}" 
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
                    jpda.jvmargs="${jpda.jvmargs}"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    </target>
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
    
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    <!-- update a class being debugged -->
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
    
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
    <target name="debug-fix">
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
        <fail unless="class">Must set property 'class'</fail>
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
        <antcall target="compile-single">
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
            <param name="includes" value="${class}.java"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
        </antcall>
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
        <nbjpdareload>
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
            <fileset dir="${build.classes.dir}">
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
                <include name="${class}.class"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
            </fileset>
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
        </nbjpdareload>
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
    </target>
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
    
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
    
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
    <!-- create javadoc documentation -->
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
    
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
    <target name="-javadoc-nb" depends="-javadoc" if="netbeans.home">
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
        <nbbrowse file="${build.javadoc.dir}/${tool.name}/index.html"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
    </target>
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
    <!-- default target for those projects that don't have public API docs;
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
         override as needed for projects with public API docs.-->
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
    <target name="-javadoc"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
    
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
    <!-- macro to run a tool or selected class - used by run* and debug* tasks -->
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
    <target name="-def-run">
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
        <macrodef name="run">
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
            <attribute name="name" default="${tool.name}"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
            <attribute name="mainclass" default="${tool.mainclass}"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
            <attribute name="default.args" default="${tool.default.args}"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
            <attribute name="jpda.jvmargs" default=""/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
            <sequential>
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
                <input addproperty="run.args" message="Run @{name} with options" defaultvalue="@{default.args}"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
                <java fork="true" jvm="${target.java}" classname="@{mainclass}">
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
                    <bootclasspath>
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
                        <pathelement location="${build.classes.dir}"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
                        <pathelement location="${target.java.home}/jre/lib/rt.jar"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
                    </bootclasspath>
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
                    <jvmarg line="@{jpda.jvmargs}"/> 
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
                    <arg line="${run.args}"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
                </java>
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
            </sequential>
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
        </macrodef>
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
    </target>
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
    
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
    <!-- macro to start the debugger and set a property containg the args needed by the run task -->
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
    
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
    <target name="-def-start-debugger" if="netbeans.home">
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
        <macrodef name="start-debugger">
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
            <attribute name="jpda.jvmargs.property" default="jpda.jvmargs"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
            <sequential>
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
                <nbjpdastart name="${ant.project.name}" addressproperty="jpda.address" transport="dt_socket">
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
                    <bootclasspath>
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
                        <pathelement location="${build.classes.dir}"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
                        <pathelement location="${target.java.home}/jre/lib/rt.jar"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
                    </bootclasspath>
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
                    <sourcepath>
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
                        <pathelement location="${src.classes.dir}"/>
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
                    </sourcepath>
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
                </nbjpdastart>
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
                <property 
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
                    name="@{jpda.jvmargs.property}" 
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
                    value="-Xdebug -Xnoagent -Djava.compiler=none -Xrunjdwp:transport=dt_socket,address=${jpda.address}"
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
                />
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
            </sequential>
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
        </macrodef>
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
    </target>
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
    
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
    
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
</project>