187 lines
7.6 KiB
XML
187 lines
7.6 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
|
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.
|
|
-->
|
|
|
|
<!--
|
|
The file contains targets for NetBeans action that are shared across
|
|
all langtools projects.
|
|
-->
|
|
|
|
<project name="shared" default="build" basedir="../../..">
|
|
<!--
|
|
Instead of importing the main build file, we could call it when needed.
|
|
That would reduce the list of Ant targets that get displayed for this
|
|
file, but it also complicates the interface between the project build
|
|
file and the main build file. For example, some imported targets
|
|
would have to be reclared, properties would have to be restructured,
|
|
and it would be harder to run results (e.g. in properties) from nested
|
|
targets.
|
|
-->
|
|
<import file="../../build.xml"/>
|
|
|
|
<property name="tool.mainclass" value="com.sun.tools.${tool.name}.Main"/>
|
|
<property name="tool.default.args" value="-version"/>
|
|
|
|
<!-- compile a single file -->
|
|
|
|
<!-- for compile-single, etc, we might want different targets for
|
|
javac and not javac, because of bootstrap issues -->
|
|
<target name="compile-single" depends="build-bootstrap-javac">
|
|
<fail unless="includes">Must set property 'includes'</fail>
|
|
<javac fork="true" executable="${build.bootstrap.dir}/bin/javac"
|
|
srcdir="${src.classes.dir}"
|
|
destdir="${build.classes.dir}"
|
|
includes="${includes}"
|
|
sourcepath=""
|
|
includeAntRuntime="no"
|
|
target="${target}"
|
|
debug="${javac.debug}"
|
|
debuglevel="${javac.debuglevel}"/>
|
|
</target>
|
|
|
|
<!-- run tool -->
|
|
|
|
<target name="run" depends="build,-def-run" description="run ${tool.description}">
|
|
<run/>
|
|
</target>
|
|
|
|
<!-- run a selected class -->
|
|
|
|
<target name="run-single" depends="-def-run">
|
|
<fail unless="run.classname">Must set property 'run.classname'</fail>
|
|
<run name="${run.classname}" mainclass="${run.classname}" default.args=""/>
|
|
</target>
|
|
|
|
<!-- run jtreg tests, and display results in NetBeans -->
|
|
|
|
<target name="-jtreg-nb" depends="-jtreg" if="netbeans.home" unless="jtreg.passed">
|
|
<nbbrowse file="${jtreg.report}/report.html"/>
|
|
<fail>Some tests failed; see report for details.</fail>
|
|
</target>
|
|
|
|
<!-- debug tool in NetBeans -->
|
|
|
|
<target name="-debug-nb" depends="build,-def-run,-def-start-debugger" if="netbeans.home">
|
|
<start-debugger/>
|
|
<run jpda.jvmargs="${jpda.jvmargs}"/>
|
|
</target>
|
|
|
|
<!-- debug a selected class -->
|
|
|
|
<target name="debug-single-nb" depends="-def-start-debugger,-def-run">
|
|
<fail unless="debug.classname">Must set property 'debug.classname'</fail>
|
|
<start-debugger/>
|
|
<run name="${debug.classname}" mainclass="${debug.classname}" default.args=""
|
|
jpda.jvmargs="${jpda.jvmargs}"/>
|
|
</target>
|
|
|
|
<!-- debug a jtreg test -->
|
|
|
|
<target name="debug-jtreg-nb" depends="-def-start-debugger,-def-jtreg">
|
|
<fail unless="jtreg.tests">Must set property 'jtreg.tests'</fail>
|
|
<start-debugger/>
|
|
<jtreg-tool name="${tool.name}" samevm="false" tests="${jtreg.tests}"
|
|
jpda.jvmargs="${jpda.jvmargs}"/>
|
|
</target>
|
|
|
|
<!-- update a class being debugged -->
|
|
|
|
<target name="debug-fix">
|
|
<fail unless="class">Must set property 'class'</fail>
|
|
<antcall target="compile-single">
|
|
<param name="includes" value="${class}.java"/>
|
|
</antcall>
|
|
<nbjpdareload>
|
|
<fileset dir="${build.classes.dir}">
|
|
<include name="${class}.class"/>
|
|
</fileset>
|
|
</nbjpdareload>
|
|
</target>
|
|
|
|
|
|
<!-- create javadoc documentation -->
|
|
|
|
<target name="-javadoc-nb" depends="-javadoc" if="netbeans.home">
|
|
<nbbrowse file="${build.javadoc.dir}/${tool.name}/index.html"/>
|
|
</target>
|
|
|
|
<!-- default target for those projects that don't have public API docs;
|
|
override as needed for projects with public API docs.-->
|
|
<target name="-javadoc"/>
|
|
|
|
<!-- macro to run a tool or selected class - used by run* and debug* tasks -->
|
|
|
|
<target name="-def-run">
|
|
<macrodef name="run">
|
|
<attribute name="name" default="${tool.name}"/>
|
|
<attribute name="mainclass" default="${tool.mainclass}"/>
|
|
<attribute name="default.args" default="${tool.default.args}"/>
|
|
<attribute name="jpda.jvmargs" default=""/>
|
|
<sequential>
|
|
<input addproperty="run.args" message="Run @{name} with options" defaultvalue="@{default.args}"/>
|
|
<java fork="true" jvm="${target.java}" classname="@{mainclass}">
|
|
<bootclasspath>
|
|
<pathelement location="${build.classes.dir}"/>
|
|
<pathelement location="${target.java.home}/jre/lib/rt.jar"/>
|
|
</bootclasspath>
|
|
<jvmarg line="@{jpda.jvmargs}"/>
|
|
<arg line="${run.args}"/>
|
|
</java>
|
|
</sequential>
|
|
</macrodef>
|
|
</target>
|
|
|
|
<!-- macro to start the debugger and set a property containg the args needed by the run task -->
|
|
|
|
<target name="-def-start-debugger" if="netbeans.home">
|
|
<macrodef name="start-debugger">
|
|
<attribute name="jpda.jvmargs.property" default="jpda.jvmargs"/>
|
|
<sequential>
|
|
<nbjpdastart name="${ant.project.name}" addressproperty="jpda.address" transport="dt_socket">
|
|
<bootclasspath>
|
|
<pathelement location="${build.classes.dir}"/>
|
|
<pathelement location="${target.java.home}/jre/lib/rt.jar"/>
|
|
</bootclasspath>
|
|
<sourcepath>
|
|
<pathelement location="${src.classes.dir}"/>
|
|
</sourcepath>
|
|
</nbjpdastart>
|
|
<property
|
|
name="@{jpda.jvmargs.property}"
|
|
value="-Xdebug -Xnoagent -Djava.compiler=none -Xrunjdwp:transport=dt_socket,address=${jpda.address}"
|
|
/>
|
|
</sequential>
|
|
</macrodef>
|
|
</target>
|
|
|
|
|
|
</project>
|