make/netbeans/langtools/build.xml

Mon, 16 Sep 2019 18:07:10 +0100

author
andrew
date
Mon, 16 Sep 2019 18:07:10 +0100
changeset 3841
3b3a43588afb
parent 2064
13eba2e322e6
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Added tag jdk8u232-b06 for changeset dd568d0e5e10

jjg@201 1 <?xml version="1.0" encoding="UTF-8"?>
jjg@201 2 <!--
mcimadamore@2021 3 Copyright (c) 2007, 2013, 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
vromero@2064 58 <condition property="use_bootstrap" value="bootstrap-" else="">
mcimadamore@2021 59 <isset property="langtools.tool.bootstrap"/>
mcimadamore@2021 60 </condition>
vromero@2064 61 <condition property="with_bootclasspath" value="${build.bootstrap.dir}/classes" else="${build.classes.dir}">
mcimadamore@2021 62 <isset property="langtools.tool.bootstrap"/>
mcimadamore@2021 63 </condition>
mcimadamore@2021 64
jjg@201 65 <target name="-build-tool" if="langtools.tool.name">
vromero@2064 66 <echo level="info" message="Building ${use_bootstrap}${langtools.tool.name}"/>
jjg@201 67 <echo level="verbose" message="(Unset langtools.tool.name to build all tools)"/>
vromero@2064 68 <antcall target="build-${use_bootstrap}${langtools.tool.name}"/>
jjg@201 69 </target>
jjg@692 70
jjg@201 71 <target name="-build-all" unless="langtools.tool.name">
jjg@201 72 <echo level="info" message="Building all tools"/>
jjg@201 73 <echo level="verbose" message="(Set langtools.tool.name to build a single tool)"/>
jjg@201 74 <antcall target="build-all-tools"/>
jjg@201 75 </target>
jjg@692 76
jjg@201 77 <!-- Compile a single file. (action: compile.single; F9) -->
jjg@692 78
jjg@201 79 <target name="compile-single" depends="build-bootstrap-javac">
jjg@201 80 <fail unless="includes">Must set property 'includes'</fail>
jjg@201 81 <javac fork="true" executable="${build.bootstrap.dir}/bin/javac"
jjg@201 82 srcdir="${src.classes.dir}"
jjg@201 83 destdir="${build.classes.dir}"
jjg@201 84 includes="${includes}"
jjg@201 85 sourcepath=""
jjg@201 86 includeAntRuntime="no"
jjg@201 87 target="${javac.target}"
jjg@692 88 debug="${javac.debug}"
jjg@201 89 debuglevel="${javac.debuglevel}"/>
jjg@201 90 </target>
jjg@692 91
jjg@692 92 <!-- Run tool. (action: run; F6)
jjg@201 93 Use langtools.tool.name and langtools.tool.args properties if set; otherwise prompt
jjg@201 94 the user.
jjg@201 95 -->
jjg@692 96
jjg@692 97 <target name="run" depends="-check-target.java.home,build,-def-run,-get-tool-and-args"
jjg@201 98 description="run tool">
vromero@2064 99 <echo level="info" message="${with_bootclasspath}"/>
vromero@2064 100 <echo level="info" message="Run ${use_bootstrap}${langtools.tool.name} with args ${langtools.tool.args}"/>
vromero@2064 101 <run bcp="${with_bootclasspath}" mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}"/>
jjg@201 102 </target>
jjg@692 103
jjg@201 104 <!-- Run a selected class. (action: run.single; shift-F6) -->
jjg@692 105
jjg@201 106 <target name="run-single" depends="-check-target.java.home,-def-run">
jjg@201 107 <fail unless="run.classname">Must set property 'run.classname' </fail>
jjg@201 108 <echo level="info" message="run ${run.classname}"/>
jjg@201 109 <run mainclass="${run.classname}" args=""/>
jjg@201 110 </target>
jjg@692 111
jjg@201 112 <!-- Test project, and display results if tests failed. (action: test; Alt-F6)
jjg@201 113 If langtools.tool.name is set, then just test that tool; otherwise
jjg@201 114 test all tools.
jjg@201 115 -->
jjg@692 116
jjg@692 117 <target name="jtreg" depends="-get-tool-if-set,-jtreg-tool,-jtreg-all"
jjg@201 118 description="Test one or all langtools tools"
jjg@201 119 />
jjg@692 120
jjg@201 121 <target name="-jtreg-tool" if="langtools.tool.name">
jjg@201 122 <echo level="info" message="Testing ${langtools.tool.name}"/>
jjg@201 123 <echo level="verbose" message="(Unset langtools.tool.name to test all tools)"/>
jjg@201 124 <antcall>
jjg@201 125 <target name="jtreg-${langtools.tool.name}"/>
jjg@201 126 <target name="-show-jtreg"/>
jjg@201 127 </antcall>
jjg@201 128 </target>
jjg@692 129
jjg@201 130 <target name="-jtreg-all" unless="langtools.tool.name">
jjg@201 131 <echo level="info" message="Testing all tools"/>
jjg@201 132 <echo level="verbose" message="(Set langtools.tool.name to test a single tool)"/>
jjg@201 133 <antcall>
jjg@201 134 <target name="langtools.jtreg"/>
jjg@201 135 <target name="-show-jtreg"/>
jjg@201 136 </antcall>
jjg@201 137 </target>
jjg@692 138
jjg@201 139 <target name="-show-jtreg" if="netbeans.home" unless="jtreg.passed">
jjg@201 140 <nbbrowse file="${jtreg.report}/report.html"/>
jjg@201 141 <fail>Some tests failed; see report for details.</fail>
jjg@201 142 </target>
jjg@692 143
jjg@201 144 <!-- Debug tool in NetBeans. -->
jjg@692 145
jjg@201 146 <target name="debug" depends="-check-target.java.home,-def-run,-def-start-debugger,-get-tool-and-args,build" if="netbeans.home">
vromero@2064 147 <echo level="info" message="Debug ${use_bootstrap}${langtools.tool.name} with args ${langtools.tool.args}"/>
jjg@201 148 <start-debugger/>
vromero@2064 149 <run bcp="${with_bootclasspath}" mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}" jpda.jvmargs="${jpda.jvmargs}"/>
jjg@201 150 </target>
jjg@692 151
jjg@201 152 <!-- Debug a selected class . -->
jjg@201 153 <target name="debug-single" depends="-check-target.java.home,-def-start-debugger,-def-run">
jjg@201 154 <fail unless="debug.classname">Must set property 'debug.classname'</fail>
jjg@201 155 <start-debugger/>
jjg@201 156 <run mainclass="${debug.classname}" default.args="" jpda.jvmargs="${jpda.jvmargs}"/>
jjg@201 157 </target>
jjg@692 158
jjg@201 159 <!-- Debug a jtreg test. -->
jjg@201 160 <target name="debug-jtreg" depends="-check-target.java.home,-def-start-debugger,-def-jtreg">
jjg@201 161 <fail unless="jtreg.tests">Must set property 'jtreg.tests'</fail>
jjg@201 162 <start-debugger/>
jjg@201 163 <jtreg-tool name="debug" samevm="false" tests="${jtreg.tests}" jpda.jvmargs="${jpda.jvmargs}"/>
jjg@201 164 </target>
jjg@692 165
jjg@201 166 <!-- Update a class being debugged. -->
jjg@692 167
jjg@201 168 <target name="debug-fix" if="langtools.tool.name">
jjg@201 169 <fail unless="class">Must set property 'class'
jjg@201 170 </fail>
jjg@201 171 <antcall target="compile-single">
jjg@201 172 <param name="includes" value="${class}.java"/>
jjg@201 173 </antcall>
jjg@201 174 <nbjpdareload>
jjg@201 175 <fileset dir="${build.classes.dir}">
jjg@201 176 <include name="${class}.class"/>
jjg@201 177 </fileset>
jjg@201 178 </nbjpdareload>
jjg@201 179 </target>
jjg@692 180
jjg@201 181 <!-- Generate javadoc for one or all tools. (action: javadoc; Alt-F6)
jjg@201 182 If langtools.tool.name is set, then just test that tool; otherwise
jjg@201 183 test all tools.
jjg@201 184 -->
jjg@692 185
jjg@692 186 <target name="javadoc" depends="-javadoc-tool,-javadoc-all"
jjg@201 187 description="Generate javadoc for one or all langtools tools"
jjg@201 188 />
jjg@692 189
jjg@201 190 <target name="-javadoc-tool" if="langtools.tool.name">
jjg@201 191 <echo level="info" message="Generate javadoc for ${langtools.tool.name}"/>
jjg@201 192 <echo level="verbose" message="(Unset langtools.tool.name to generate javadoc for all tools)"/>
jjg@201 193 <antcall>
jjg@201 194 <target name="javadoc-${langtools.tool.name}"/>
jjg@201 195 <target name="-show-javadoc"/>
jjg@201 196 </antcall>
jjg@201 197 </target>
jjg@692 198
jjg@201 199 <target name="-javadoc-all" unless="langtools.tool.name">
jjg@201 200 <echo level="info" message="Generate javadoc for all tools"/>
jjg@201 201 <echo level="verbose" message="(Set langtools.tool.name to generate javadoc for a single tool)"/>
jjg@201 202 <antcall>
jjg@201 203 <target name="langtools.javadoc"/>
jjg@201 204 <target name="-show-javadoc"/>
jjg@201 205 </antcall>
jjg@201 206 </target>
jjg@692 207
jjg@201 208 <target name="-show-javadoc" if="netbeans.home">
jjg@201 209 <!-- what if doing javadoc for all? -->
jjg@201 210 <nbbrowse file="${build.javadoc.dir}/${langtools.tool.name}/index.html"/>
jjg@201 211 </target>
jjg@692 212
jjg@201 213 <!-- Prompt for values. -->
jjg@692 214
jjg@201 215 <target name="-get-tool-if-set" depends="-def-select-tool">
jjg@692 216 <select-tool
jjg@692 217 toolproperty="langtools.tool.name"
mcimadamore@2021 218 bootstrapproperty="langtools.tool.bootstrap"
jjg@201 219 propertyfile="${langtools.properties}"
jjg@201 220 askIfUnset="false"
jjg@201 221 />
jjg@201 222 </target>
jjg@692 223
jjg@201 224 <target name="-get-tool-and-args" depends="-def-select-tool">
jjg@692 225 <select-tool
jjg@692 226 toolproperty="langtools.tool.name"
jjg@692 227 argsproperty="langtools.tool.args"
mcimadamore@2021 228 bootstrapproperty="langtools.tool.bootstrap"
jjg@201 229 propertyfile="${langtools.properties}"
jjg@201 230 askIfUnset="true"
jjg@201 231 />
jjg@201 232 </target>
jjg@201 233
jjg@201 234 <!-- Macro to run a tool or selected class - used by run* and debug* tasks -->
jjg@201 235 <target name="-def-run">
jjg@201 236 <macrodef name="run">
jjg@201 237 <attribute name="mainclass"/>
jjg@201 238 <attribute name="args" default=""/>
vromero@2064 239 <attribute name="bcp" default="${with_bootclasspath}"/>
jjg@201 240 <attribute name="jpda.jvmargs" default=""/>
mcimadamore@2021 241
jjg@201 242 <sequential>
jjg@201 243 <java fork="true" jvm="${target.java}" classname="@{mainclass}">
vromero@2064 244 <jvmarg line="-Xbootclasspath/p:@{bcp}"/>
jjg@201 245 <jvmarg line="@{jpda.jvmargs}"/>
jjg@201 246 <arg line="@{args}"/>
jjg@201 247 </java>
jjg@201 248 </sequential>
jjg@201 249 </macrodef>
jjg@201 250 </target>
jjg@692 251
jjg@201 252 <!-- Macro to start the debugger and set a property containg the args needed by the run task -->
jjg@201 253 <target name="-def-start-debugger" if="netbeans.home">
jjg@201 254 <macrodef name="start-debugger">
jjg@201 255 <attribute name="jpda.jvmargs.property" default="jpda.jvmargs"/>
jjg@201 256 <sequential>
jjg@201 257 <nbjpdastart name="${ant.project.name}" addressproperty="jpda.address" transport="dt_socket">
jjg@201 258 <bootclasspath>
jjg@201 259 <pathelement location="${build.classes.dir}"/>
jjg@201 260 <pathelement location="${target.java.home}/jre/lib/rt.jar"/>
jjg@201 261 </bootclasspath>
jjg@201 262 <sourcepath>
jjg@201 263 <pathelement location="${src.classes.dir}"/>
jjg@201 264 </sourcepath>
jjg@201 265 </nbjpdastart>
jjg@692 266 <property
jjg@692 267 name="@{jpda.jvmargs.property}"
jjg@201 268 value="-Xdebug -Xnoagent -Djava.compiler=none -Xrunjdwp:transport=dt_socket,address=${jpda.address}"
jjg@201 269 />
jjg@201 270 </sequential>
jjg@201 271 </macrodef>
jjg@201 272 </target>
jjg@692 273
jjg@201 274 <target name="-def-select-tool">
jjg@201 275 <mkdir dir="${build.toolclasses.dir}"/>
ohrstrom@1224 276 <javac srcdir="${make.tools.dir}"
ohrstrom@1224 277 includes="anttasks/SelectTool*"
jjg@201 278 destdir="${build.toolclasses.dir}/"
jjg@692 279 classpath="${ant.core.lib}"
jjg@692 280 includeantruntime="false"
jjg@692 281 debug="${javac.debug}"
jjg@201 282 debuglevel="${javac.debuglevel}">
jjg@201 283 <compilerarg line="-Xlint"/>
jjg@201 284 </javac>
jjg@201 285 <taskdef name="select-tool"
ohrstrom@1224 286 classname="anttasks.SelectToolTask"
jjg@201 287 classpath="${build.toolclasses.dir}/"/>
jjg@201 288 </target>
jjg@692 289
jjg@201 290 <target name="select-tool" depends="-def-select-tool">
jjg@201 291 <select-tool propertyfile="${langtools.properties}"/>
jjg@201 292 </target>
jjg@201 293 </project>

mercurial