Wed, 06 Apr 2011 20:33:44 -0700
7033660: Update copyright year to 2011 on any files changed in 2011
Reviewed-by: dholmes
jjg@201 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
jjg@201 | 2 | <!-- |
ohair@962 | 3 | Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. |
jjg@201 | 4 | |
jjg@201 | 5 | Redistribution and use in source and binary forms, with or without |
jjg@201 | 6 | modification, are permitted provided that the following conditions |
jjg@201 | 7 | are met: |
jjg@201 | 8 | |
jjg@201 | 9 | - Redistributions of source code must retain the above copyright |
jjg@201 | 10 | notice, this list of conditions and the following disclaimer. |
jjg@201 | 11 | |
jjg@201 | 12 | - Redistributions in binary form must reproduce the above copyright |
jjg@201 | 13 | notice, this list of conditions and the following disclaimer in the |
jjg@201 | 14 | documentation and/or other materials provided with the distribution. |
jjg@201 | 15 | |
ohair@554 | 16 | - Neither the name of Oracle nor the names of its |
jjg@201 | 17 | contributors may be used to endorse or promote products derived |
jjg@201 | 18 | from this software without specific prior written permission. |
jjg@201 | 19 | |
jjg@201 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
jjg@201 | 21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
jjg@201 | 22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
jjg@201 | 23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
jjg@201 | 24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
jjg@201 | 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
jjg@201 | 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
jjg@201 | 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
jjg@201 | 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
jjg@201 | 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
jjg@201 | 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
jjg@201 | 31 | --> |
jjg@201 | 32 | |
jjg@201 | 33 | <project name="langtools-netbeans" default="build" basedir="../../.."> |
jjg@692 | 34 | |
jjg@692 | 35 | <property name="langtools.properties" |
jjg@201 | 36 | location="make/netbeans/langtools/nbproject/private/langtools.properties"/> |
jjg@692 | 37 | |
jjg@692 | 38 | <!-- |
jjg@201 | 39 | Instead of importing the main build file, we could call it when needed. |
jjg@201 | 40 | That would reduce the list of Ant targets that get displayed for this |
jjg@692 | 41 | file, but it also complicates the interface between the project build |
jjg@201 | 42 | file and the main build file. For example, some imported targets |
jjg@201 | 43 | would have to be reclared, properties would have to be restructured, |
jjg@692 | 44 | and it would be harder to run results (e.g. in properties) from nested |
jjg@201 | 45 | targets. |
jjg@201 | 46 | --> |
jjg@692 | 47 | <import file="../../build.xml"/> |
jjg@692 | 48 | |
jjg@201 | 49 | <!-- Build project. (action: build; F11) |
jjg@201 | 50 | If langtools.tool.name is set, then just build that tool; otherwise |
jjg@201 | 51 | build all tools. |
jjg@201 | 52 | --> |
jjg@692 | 53 | |
jjg@692 | 54 | <target name="build" depends="-get-tool-if-set,-build-tool,-build-all" |
jjg@201 | 55 | description="Build one or all langtools tools" |
jjg@201 | 56 | /> |
jjg@692 | 57 | |
jjg@201 | 58 | <target name="-build-tool" if="langtools.tool.name"> |
jjg@201 | 59 | <echo level="info" message="Building ${langtools.tool.name}"/> |
jjg@201 | 60 | <echo level="verbose" message="(Unset langtools.tool.name to build all tools)"/> |
jjg@201 | 61 | <antcall target="build-${langtools.tool.name}"/> |
jjg@201 | 62 | </target> |
jjg@692 | 63 | |
jjg@201 | 64 | <target name="-build-all" unless="langtools.tool.name"> |
jjg@201 | 65 | <echo level="info" message="Building all tools"/> |
jjg@201 | 66 | <echo level="verbose" message="(Set langtools.tool.name to build a single tool)"/> |
jjg@201 | 67 | <antcall target="build-all-tools"/> |
jjg@201 | 68 | </target> |
jjg@692 | 69 | |
jjg@201 | 70 | <!-- Compile a single file. (action: compile.single; F9) --> |
jjg@692 | 71 | |
jjg@201 | 72 | <target name="compile-single" depends="build-bootstrap-javac"> |
jjg@201 | 73 | <fail unless="includes">Must set property 'includes'</fail> |
jjg@201 | 74 | <javac fork="true" executable="${build.bootstrap.dir}/bin/javac" |
jjg@201 | 75 | srcdir="${src.classes.dir}" |
jjg@201 | 76 | destdir="${build.classes.dir}" |
jjg@201 | 77 | includes="${includes}" |
jjg@201 | 78 | sourcepath="" |
jjg@201 | 79 | includeAntRuntime="no" |
jjg@201 | 80 | target="${javac.target}" |
jjg@692 | 81 | debug="${javac.debug}" |
jjg@201 | 82 | debuglevel="${javac.debuglevel}"/> |
jjg@201 | 83 | </target> |
jjg@692 | 84 | |
jjg@692 | 85 | <!-- Run tool. (action: run; F6) |
jjg@201 | 86 | Use langtools.tool.name and langtools.tool.args properties if set; otherwise prompt |
jjg@201 | 87 | the user. |
jjg@201 | 88 | --> |
jjg@692 | 89 | |
jjg@692 | 90 | <target name="run" depends="-check-target.java.home,build,-def-run,-get-tool-and-args" |
jjg@201 | 91 | description="run tool"> |
jjg@201 | 92 | <echo level="info" message="Run ${langtools.tool.name} with args ${langtools.tool.args}"/> |
jjg@201 | 93 | <run mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}"/> |
jjg@201 | 94 | </target> |
jjg@692 | 95 | |
jjg@201 | 96 | <!-- Run a selected class. (action: run.single; shift-F6) --> |
jjg@692 | 97 | |
jjg@201 | 98 | <target name="run-single" depends="-check-target.java.home,-def-run"> |
jjg@201 | 99 | <fail unless="run.classname">Must set property 'run.classname' </fail> |
jjg@201 | 100 | <echo level="info" message="run ${run.classname}"/> |
jjg@201 | 101 | <run mainclass="${run.classname}" args=""/> |
jjg@201 | 102 | </target> |
jjg@692 | 103 | |
jjg@201 | 104 | <!-- Test project, and display results if tests failed. (action: test; Alt-F6) |
jjg@201 | 105 | If langtools.tool.name is set, then just test that tool; otherwise |
jjg@201 | 106 | test all tools. |
jjg@201 | 107 | --> |
jjg@692 | 108 | |
jjg@692 | 109 | <target name="jtreg" depends="-get-tool-if-set,-jtreg-tool,-jtreg-all" |
jjg@201 | 110 | description="Test one or all langtools tools" |
jjg@201 | 111 | /> |
jjg@692 | 112 | |
jjg@201 | 113 | <target name="-jtreg-tool" if="langtools.tool.name"> |
jjg@201 | 114 | <echo level="info" message="Testing ${langtools.tool.name}"/> |
jjg@201 | 115 | <echo level="verbose" message="(Unset langtools.tool.name to test all tools)"/> |
jjg@201 | 116 | <antcall> |
jjg@201 | 117 | <target name="jtreg-${langtools.tool.name}"/> |
jjg@201 | 118 | <target name="-show-jtreg"/> |
jjg@201 | 119 | </antcall> |
jjg@201 | 120 | </target> |
jjg@692 | 121 | |
jjg@201 | 122 | <target name="-jtreg-all" unless="langtools.tool.name"> |
jjg@201 | 123 | <echo level="info" message="Testing all tools"/> |
jjg@201 | 124 | <echo level="verbose" message="(Set langtools.tool.name to test a single tool)"/> |
jjg@201 | 125 | <antcall> |
jjg@201 | 126 | <target name="langtools.jtreg"/> |
jjg@201 | 127 | <target name="-show-jtreg"/> |
jjg@201 | 128 | </antcall> |
jjg@201 | 129 | </target> |
jjg@692 | 130 | |
jjg@201 | 131 | <target name="-show-jtreg" if="netbeans.home" unless="jtreg.passed"> |
jjg@201 | 132 | <nbbrowse file="${jtreg.report}/report.html"/> |
jjg@201 | 133 | <fail>Some tests failed; see report for details.</fail> |
jjg@201 | 134 | </target> |
jjg@692 | 135 | |
jjg@201 | 136 | <!-- Debug tool in NetBeans. --> |
jjg@692 | 137 | |
jjg@201 | 138 | <target name="debug" depends="-check-target.java.home,-def-run,-def-start-debugger,-get-tool-and-args,build" if="netbeans.home"> |
jjg@201 | 139 | <echo level="info" message="Debug ${langtools.tool.name} with args ${langtools.tool.args}"/> |
jjg@201 | 140 | <start-debugger/> |
jjg@201 | 141 | <run mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}" jpda.jvmargs="${jpda.jvmargs}"/> |
jjg@201 | 142 | </target> |
jjg@692 | 143 | |
jjg@201 | 144 | <!-- Debug a selected class . --> |
jjg@201 | 145 | <target name="debug-single" depends="-check-target.java.home,-def-start-debugger,-def-run"> |
jjg@201 | 146 | <fail unless="debug.classname">Must set property 'debug.classname'</fail> |
jjg@201 | 147 | <start-debugger/> |
jjg@201 | 148 | <run mainclass="${debug.classname}" default.args="" jpda.jvmargs="${jpda.jvmargs}"/> |
jjg@201 | 149 | </target> |
jjg@692 | 150 | |
jjg@201 | 151 | <!-- Debug a jtreg test. --> |
jjg@201 | 152 | <target name="debug-jtreg" depends="-check-target.java.home,-def-start-debugger,-def-jtreg"> |
jjg@201 | 153 | <fail unless="jtreg.tests">Must set property 'jtreg.tests'</fail> |
jjg@201 | 154 | <start-debugger/> |
jjg@201 | 155 | <jtreg-tool name="debug" samevm="false" tests="${jtreg.tests}" jpda.jvmargs="${jpda.jvmargs}"/> |
jjg@201 | 156 | </target> |
jjg@692 | 157 | |
jjg@201 | 158 | <!-- Update a class being debugged. --> |
jjg@692 | 159 | |
jjg@201 | 160 | <target name="debug-fix" if="langtools.tool.name"> |
jjg@201 | 161 | <fail unless="class">Must set property 'class' |
jjg@201 | 162 | </fail> |
jjg@201 | 163 | <antcall target="compile-single"> |
jjg@201 | 164 | <param name="includes" value="${class}.java"/> |
jjg@201 | 165 | </antcall> |
jjg@201 | 166 | <nbjpdareload> |
jjg@201 | 167 | <fileset dir="${build.classes.dir}"> |
jjg@201 | 168 | <include name="${class}.class"/> |
jjg@201 | 169 | </fileset> |
jjg@201 | 170 | </nbjpdareload> |
jjg@201 | 171 | </target> |
jjg@692 | 172 | |
jjg@201 | 173 | <!-- Generate javadoc for one or all tools. (action: javadoc; Alt-F6) |
jjg@201 | 174 | If langtools.tool.name is set, then just test that tool; otherwise |
jjg@201 | 175 | test all tools. |
jjg@201 | 176 | --> |
jjg@692 | 177 | |
jjg@692 | 178 | <target name="javadoc" depends="-javadoc-tool,-javadoc-all" |
jjg@201 | 179 | description="Generate javadoc for one or all langtools tools" |
jjg@201 | 180 | /> |
jjg@692 | 181 | |
jjg@201 | 182 | <target name="-javadoc-tool" if="langtools.tool.name"> |
jjg@201 | 183 | <echo level="info" message="Generate javadoc for ${langtools.tool.name}"/> |
jjg@201 | 184 | <echo level="verbose" message="(Unset langtools.tool.name to generate javadoc for all tools)"/> |
jjg@201 | 185 | <antcall> |
jjg@201 | 186 | <target name="javadoc-${langtools.tool.name}"/> |
jjg@201 | 187 | <target name="-show-javadoc"/> |
jjg@201 | 188 | </antcall> |
jjg@201 | 189 | </target> |
jjg@692 | 190 | |
jjg@201 | 191 | <target name="-javadoc-all" unless="langtools.tool.name"> |
jjg@201 | 192 | <echo level="info" message="Generate javadoc for all tools"/> |
jjg@201 | 193 | <echo level="verbose" message="(Set langtools.tool.name to generate javadoc for a single tool)"/> |
jjg@201 | 194 | <antcall> |
jjg@201 | 195 | <target name="langtools.javadoc"/> |
jjg@201 | 196 | <target name="-show-javadoc"/> |
jjg@201 | 197 | </antcall> |
jjg@201 | 198 | </target> |
jjg@692 | 199 | |
jjg@201 | 200 | <target name="-show-javadoc" if="netbeans.home"> |
jjg@201 | 201 | <!-- what if doing javadoc for all? --> |
jjg@201 | 202 | <nbbrowse file="${build.javadoc.dir}/${langtools.tool.name}/index.html"/> |
jjg@201 | 203 | </target> |
jjg@692 | 204 | |
jjg@201 | 205 | <!-- Prompt for values. --> |
jjg@692 | 206 | |
jjg@201 | 207 | <target name="-get-tool-if-set" depends="-def-select-tool"> |
jjg@692 | 208 | <select-tool |
jjg@692 | 209 | toolproperty="langtools.tool.name" |
jjg@201 | 210 | propertyfile="${langtools.properties}" |
jjg@201 | 211 | askIfUnset="false" |
jjg@201 | 212 | /> |
jjg@201 | 213 | </target> |
jjg@692 | 214 | |
jjg@201 | 215 | <target name="-get-tool-and-args" depends="-def-select-tool"> |
jjg@692 | 216 | <select-tool |
jjg@692 | 217 | toolproperty="langtools.tool.name" |
jjg@692 | 218 | argsproperty="langtools.tool.args" |
jjg@201 | 219 | propertyfile="${langtools.properties}" |
jjg@201 | 220 | askIfUnset="true" |
jjg@201 | 221 | /> |
jjg@201 | 222 | </target> |
jjg@201 | 223 | |
jjg@201 | 224 | <!-- Macro to run a tool or selected class - used by run* and debug* tasks --> |
jjg@201 | 225 | <target name="-def-run"> |
jjg@201 | 226 | <macrodef name="run"> |
jjg@201 | 227 | <attribute name="mainclass"/> |
jjg@201 | 228 | <attribute name="args" default=""/> |
jjg@201 | 229 | <attribute name="jpda.jvmargs" default=""/> |
jjg@201 | 230 | <sequential> |
jjg@201 | 231 | <java fork="true" jvm="${target.java}" classname="@{mainclass}"> |
jjg@201 | 232 | <jvmarg line="-Xbootclasspath/p:${build.classes.dir}"/> |
jjg@201 | 233 | <jvmarg line="@{jpda.jvmargs}"/> |
jjg@201 | 234 | <arg line="@{args}"/> |
jjg@201 | 235 | </java> |
jjg@201 | 236 | </sequential> |
jjg@201 | 237 | </macrodef> |
jjg@201 | 238 | </target> |
jjg@692 | 239 | |
jjg@201 | 240 | <!-- Macro to start the debugger and set a property containg the args needed by the run task --> |
jjg@201 | 241 | <target name="-def-start-debugger" if="netbeans.home"> |
jjg@201 | 242 | <macrodef name="start-debugger"> |
jjg@201 | 243 | <attribute name="jpda.jvmargs.property" default="jpda.jvmargs"/> |
jjg@201 | 244 | <sequential> |
jjg@201 | 245 | <nbjpdastart name="${ant.project.name}" addressproperty="jpda.address" transport="dt_socket"> |
jjg@201 | 246 | <bootclasspath> |
jjg@201 | 247 | <pathelement location="${build.classes.dir}"/> |
jjg@201 | 248 | <pathelement location="${target.java.home}/jre/lib/rt.jar"/> |
jjg@201 | 249 | </bootclasspath> |
jjg@201 | 250 | <sourcepath> |
jjg@201 | 251 | <pathelement location="${src.classes.dir}"/> |
jjg@201 | 252 | </sourcepath> |
jjg@201 | 253 | </nbjpdastart> |
jjg@692 | 254 | <property |
jjg@692 | 255 | name="@{jpda.jvmargs.property}" |
jjg@201 | 256 | value="-Xdebug -Xnoagent -Djava.compiler=none -Xrunjdwp:transport=dt_socket,address=${jpda.address}" |
jjg@201 | 257 | /> |
jjg@201 | 258 | </sequential> |
jjg@201 | 259 | </macrodef> |
jjg@201 | 260 | </target> |
jjg@692 | 261 | |
jjg@201 | 262 | <target name="-def-select-tool"> |
jjg@201 | 263 | <mkdir dir="${build.toolclasses.dir}"/> |
jjg@201 | 264 | <javac srcdir="${make.tools.dir}/SelectTool" |
jjg@201 | 265 | destdir="${build.toolclasses.dir}/" |
jjg@692 | 266 | classpath="${ant.core.lib}" |
jjg@692 | 267 | includeantruntime="false" |
jjg@692 | 268 | debug="${javac.debug}" |
jjg@201 | 269 | debuglevel="${javac.debuglevel}"> |
jjg@201 | 270 | <compilerarg line="-Xlint"/> |
jjg@201 | 271 | </javac> |
jjg@201 | 272 | <taskdef name="select-tool" |
jjg@692 | 273 | classname="SelectToolTask" |
jjg@201 | 274 | classpath="${build.toolclasses.dir}/"/> |
jjg@201 | 275 | </target> |
jjg@692 | 276 | |
jjg@201 | 277 | <target name="select-tool" depends="-def-select-tool"> |
jjg@201 | 278 | <select-tool propertyfile="${langtools.properties}"/> |
jjg@201 | 279 | </target> |
jjg@201 | 280 | </project> |