1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/make/netbeans/langtools/build.xml Fri Jan 23 11:23:10 2009 -0800 1.3 @@ -0,0 +1,279 @@ 1.4 +<?xml version="1.0" encoding="UTF-8"?> 1.5 +<!-- 1.6 + Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. 1.7 + 1.8 + Redistribution and use in source and binary forms, with or without 1.9 + modification, are permitted provided that the following conditions 1.10 + are met: 1.11 + 1.12 + - Redistributions of source code must retain the above copyright 1.13 + notice, this list of conditions and the following disclaimer. 1.14 + 1.15 + - Redistributions in binary form must reproduce the above copyright 1.16 + notice, this list of conditions and the following disclaimer in the 1.17 + documentation and/or other materials provided with the distribution. 1.18 + 1.19 + - Neither the name of Sun Microsystems nor the names of its 1.20 + contributors may be used to endorse or promote products derived 1.21 + from this software without specific prior written permission. 1.22 + 1.23 + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 1.24 + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 1.25 + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1.26 + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 1.27 + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 1.28 + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 1.29 + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 1.30 + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 1.31 + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 1.32 + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 1.33 + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.34 +--> 1.35 + 1.36 +<project name="langtools-netbeans" default="build" basedir="../../.."> 1.37 + 1.38 + <property name="langtools.properties" 1.39 + location="make/netbeans/langtools/nbproject/private/langtools.properties"/> 1.40 + 1.41 + <!-- 1.42 + Instead of importing the main build file, we could call it when needed. 1.43 + That would reduce the list of Ant targets that get displayed for this 1.44 + file, but it also complicates the interface between the project build 1.45 + file and the main build file. For example, some imported targets 1.46 + would have to be reclared, properties would have to be restructured, 1.47 + and it would be harder to run results (e.g. in properties) from nested 1.48 + targets. 1.49 + --> 1.50 + <import file="../../build.xml"/> 1.51 + 1.52 + <!-- Build project. (action: build; F11) 1.53 + If langtools.tool.name is set, then just build that tool; otherwise 1.54 + build all tools. 1.55 + --> 1.56 + 1.57 + <target name="build" depends="-get-tool-if-set,-build-tool,-build-all" 1.58 + description="Build one or all langtools tools" 1.59 + /> 1.60 + 1.61 + <target name="-build-tool" if="langtools.tool.name"> 1.62 + <echo level="info" message="Building ${langtools.tool.name}"/> 1.63 + <echo level="verbose" message="(Unset langtools.tool.name to build all tools)"/> 1.64 + <antcall target="build-${langtools.tool.name}"/> 1.65 + </target> 1.66 + 1.67 + <target name="-build-all" unless="langtools.tool.name"> 1.68 + <echo level="info" message="Building all tools"/> 1.69 + <echo level="verbose" message="(Set langtools.tool.name to build a single tool)"/> 1.70 + <antcall target="build-all-tools"/> 1.71 + </target> 1.72 + 1.73 + <!-- Compile a single file. (action: compile.single; F9) --> 1.74 + 1.75 + <target name="compile-single" depends="build-bootstrap-javac"> 1.76 + <fail unless="includes">Must set property 'includes'</fail> 1.77 + <javac fork="true" executable="${build.bootstrap.dir}/bin/javac" 1.78 + srcdir="${src.classes.dir}" 1.79 + destdir="${build.classes.dir}" 1.80 + includes="${includes}" 1.81 + sourcepath="" 1.82 + includeAntRuntime="no" 1.83 + target="${javac.target}" 1.84 + debug="${javac.debug}" 1.85 + debuglevel="${javac.debuglevel}"/> 1.86 + </target> 1.87 + 1.88 + <!-- Run tool. (action: run; F6) 1.89 + Use langtools.tool.name and langtools.tool.args properties if set; otherwise prompt 1.90 + the user. 1.91 + --> 1.92 + 1.93 + <target name="run" depends="-check-target.java.home,build,-def-run,-get-tool-and-args" 1.94 + description="run tool"> 1.95 + <echo level="info" message="Run ${langtools.tool.name} with args ${langtools.tool.args}"/> 1.96 + <run mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}"/> 1.97 + </target> 1.98 + 1.99 + <!-- Run a selected class. (action: run.single; shift-F6) --> 1.100 + 1.101 + <target name="run-single" depends="-check-target.java.home,-def-run"> 1.102 + <fail unless="run.classname">Must set property 'run.classname' </fail> 1.103 + <echo level="info" message="run ${run.classname}"/> 1.104 + <run mainclass="${run.classname}" args=""/> 1.105 + </target> 1.106 + 1.107 + <!-- Test project, and display results if tests failed. (action: test; Alt-F6) 1.108 + If langtools.tool.name is set, then just test that tool; otherwise 1.109 + test all tools. 1.110 + --> 1.111 + 1.112 + <target name="jtreg" depends="-get-tool-if-set,-jtreg-tool,-jtreg-all" 1.113 + description="Test one or all langtools tools" 1.114 + /> 1.115 + 1.116 + <target name="-jtreg-tool" if="langtools.tool.name"> 1.117 + <echo level="info" message="Testing ${langtools.tool.name}"/> 1.118 + <echo level="verbose" message="(Unset langtools.tool.name to test all tools)"/> 1.119 + <antcall> 1.120 + <target name="jtreg-${langtools.tool.name}"/> 1.121 + <target name="-show-jtreg"/> 1.122 + </antcall> 1.123 + </target> 1.124 + 1.125 + <target name="-jtreg-all" unless="langtools.tool.name"> 1.126 + <echo level="info" message="Testing all tools"/> 1.127 + <echo level="verbose" message="(Set langtools.tool.name to test a single tool)"/> 1.128 + <antcall> 1.129 + <target name="langtools.jtreg"/> 1.130 + <target name="-show-jtreg"/> 1.131 + </antcall> 1.132 + </target> 1.133 + 1.134 + <target name="-show-jtreg" if="netbeans.home" unless="jtreg.passed"> 1.135 + <nbbrowse file="${jtreg.report}/report.html"/> 1.136 + <fail>Some tests failed; see report for details.</fail> 1.137 + </target> 1.138 + 1.139 + <!-- Debug tool in NetBeans. --> 1.140 + 1.141 + <target name="debug" depends="-check-target.java.home,-def-run,-def-start-debugger,-get-tool-and-args,build" if="netbeans.home"> 1.142 + <echo level="info" message="Debug ${langtools.tool.name} with args ${langtools.tool.args}"/> 1.143 + <start-debugger/> 1.144 + <run mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}" jpda.jvmargs="${jpda.jvmargs}"/> 1.145 + </target> 1.146 + 1.147 + <!-- Debug a selected class . --> 1.148 + <target name="debug-single" depends="-check-target.java.home,-def-start-debugger,-def-run"> 1.149 + <fail unless="debug.classname">Must set property 'debug.classname'</fail> 1.150 + <start-debugger/> 1.151 + <run mainclass="${debug.classname}" default.args="" jpda.jvmargs="${jpda.jvmargs}"/> 1.152 + </target> 1.153 + 1.154 + <!-- Debug a jtreg test. --> 1.155 + <target name="debug-jtreg" depends="-check-target.java.home,-def-start-debugger,-def-jtreg"> 1.156 + <fail unless="jtreg.tests">Must set property 'jtreg.tests'</fail> 1.157 + <start-debugger/> 1.158 + <jtreg-tool name="debug" samevm="false" tests="${jtreg.tests}" jpda.jvmargs="${jpda.jvmargs}"/> 1.159 + </target> 1.160 + 1.161 + <!-- Update a class being debugged. --> 1.162 + 1.163 + <target name="debug-fix" if="langtools.tool.name"> 1.164 + <fail unless="class">Must set property 'class' 1.165 + </fail> 1.166 + <antcall target="compile-single"> 1.167 + <param name="includes" value="${class}.java"/> 1.168 + </antcall> 1.169 + <nbjpdareload> 1.170 + <fileset dir="${build.classes.dir}"> 1.171 + <include name="${class}.class"/> 1.172 + </fileset> 1.173 + </nbjpdareload> 1.174 + </target> 1.175 + 1.176 + <!-- Generate javadoc for one or all tools. (action: javadoc; Alt-F6) 1.177 + If langtools.tool.name is set, then just test that tool; otherwise 1.178 + test all tools. 1.179 + --> 1.180 + 1.181 + <target name="javadoc" depends="-javadoc-tool,-javadoc-all" 1.182 + description="Generate javadoc for one or all langtools tools" 1.183 + /> 1.184 + 1.185 + <target name="-javadoc-tool" if="langtools.tool.name"> 1.186 + <echo level="info" message="Generate javadoc for ${langtools.tool.name}"/> 1.187 + <echo level="verbose" message="(Unset langtools.tool.name to generate javadoc for all tools)"/> 1.188 + <antcall> 1.189 + <target name="javadoc-${langtools.tool.name}"/> 1.190 + <target name="-show-javadoc"/> 1.191 + </antcall> 1.192 + </target> 1.193 + 1.194 + <target name="-javadoc-all" unless="langtools.tool.name"> 1.195 + <echo level="info" message="Generate javadoc for all tools"/> 1.196 + <echo level="verbose" message="(Set langtools.tool.name to generate javadoc for a single tool)"/> 1.197 + <antcall> 1.198 + <target name="langtools.javadoc"/> 1.199 + <target name="-show-javadoc"/> 1.200 + </antcall> 1.201 + </target> 1.202 + 1.203 + <target name="-show-javadoc" if="netbeans.home"> 1.204 + <!-- what if doing javadoc for all? --> 1.205 + <nbbrowse file="${build.javadoc.dir}/${langtools.tool.name}/index.html"/> 1.206 + </target> 1.207 + 1.208 + <!-- Prompt for values. --> 1.209 + 1.210 + <target name="-get-tool-if-set" depends="-def-select-tool"> 1.211 + <select-tool 1.212 + toolproperty="langtools.tool.name" 1.213 + propertyfile="${langtools.properties}" 1.214 + askIfUnset="false" 1.215 + /> 1.216 + </target> 1.217 + 1.218 + <target name="-get-tool-and-args" depends="-def-select-tool"> 1.219 + <select-tool 1.220 + toolproperty="langtools.tool.name" 1.221 + argsproperty="langtools.tool.args" 1.222 + propertyfile="${langtools.properties}" 1.223 + askIfUnset="true" 1.224 + /> 1.225 + </target> 1.226 + 1.227 + <!-- Macro to run a tool or selected class - used by run* and debug* tasks --> 1.228 + <target name="-def-run"> 1.229 + <macrodef name="run"> 1.230 + <attribute name="mainclass"/> 1.231 + <attribute name="args" default=""/> 1.232 + <attribute name="jpda.jvmargs" default=""/> 1.233 + <sequential> 1.234 + <java fork="true" jvm="${target.java}" classname="@{mainclass}"> 1.235 + <jvmarg line="-Xbootclasspath/p:${build.classes.dir}"/> 1.236 + <jvmarg line="@{jpda.jvmargs}"/> 1.237 + <arg line="@{args}"/> 1.238 + </java> 1.239 + </sequential> 1.240 + </macrodef> 1.241 + </target> 1.242 + 1.243 + <!-- Macro to start the debugger and set a property containg the args needed by the run task --> 1.244 + <target name="-def-start-debugger" if="netbeans.home"> 1.245 + <macrodef name="start-debugger"> 1.246 + <attribute name="jpda.jvmargs.property" default="jpda.jvmargs"/> 1.247 + <sequential> 1.248 + <nbjpdastart name="${ant.project.name}" addressproperty="jpda.address" transport="dt_socket"> 1.249 + <bootclasspath> 1.250 + <pathelement location="${build.classes.dir}"/> 1.251 + <pathelement location="${target.java.home}/jre/lib/rt.jar"/> 1.252 + </bootclasspath> 1.253 + <sourcepath> 1.254 + <pathelement location="${src.classes.dir}"/> 1.255 + </sourcepath> 1.256 + </nbjpdastart> 1.257 + <property 1.258 + name="@{jpda.jvmargs.property}" 1.259 + value="-Xdebug -Xnoagent -Djava.compiler=none -Xrunjdwp:transport=dt_socket,address=${jpda.address}" 1.260 + /> 1.261 + </sequential> 1.262 + </macrodef> 1.263 + </target> 1.264 + 1.265 + <target name="-def-select-tool"> 1.266 + <mkdir dir="${build.toolclasses.dir}"/> 1.267 + <javac srcdir="${make.tools.dir}/SelectTool" 1.268 + destdir="${build.toolclasses.dir}/" 1.269 + classpath="${ant.home}/lib/ant.jar" 1.270 + debug="${javac.debug}" 1.271 + debuglevel="${javac.debuglevel}"> 1.272 + <compilerarg line="-Xlint"/> 1.273 + </javac> 1.274 + <taskdef name="select-tool" 1.275 + classname="SelectToolTask" 1.276 + classpath="${build.toolclasses.dir}/"/> 1.277 + </target> 1.278 + 1.279 + <target name="select-tool" depends="-def-select-tool"> 1.280 + <select-tool propertyfile="${langtools.properties}"/> 1.281 + </target> 1.282 +</project>