8058489: More adjustments of langtools/make/build.xml to modularized layout

Re-structuring the langtools/make/build.xml to reflect the modular layout, cleanup of the build script

Reviewed-by: jjg, mcimadamore, ksrini
This commit is contained in:
Jan Lahoda 2014-11-07 18:22:36 +01:00
parent ab1b9a9cf1
commit 3f3f44af47
6 changed files with 420 additions and 974 deletions

View File

@ -23,25 +23,46 @@
# questions.
#
# This is the JDK used to build and run the bootstrap version of javac.
# The bootstrap javac is used to compile both boostrap versions of the
# other tools, and product versions of all the tools.
# Override this path as needed, either on the command line or in
# one of the standard user build.properties files (see build.xml)
#javac configuration for "normal build" (these will be passed to the bootstrap compiler):
javac.debug = true
javac.debuglevel = source,lines,vars
javac.extra.opts=-XDignore.symbol.file=true
javac.includes=
javac.lint.opts = -Xlint:all,-deprecation -Werror
javac.source = 8
javac.target = 8
# boot.java.home = /opt/jdk/1.7.0
boot.java = ${boot.java.home}/bin/java
boot.javac = ${boot.java.home}/bin/javac
#javac configuration for bootstrap build (these will be passed to the compiler from the given boot JDK):
boot.javac.extra.opts=-XDignore.symbol.file=true
boot.javac.includes = \
javax/annotation/processing/ \
javax/lang/model/ \
javax/tools/ \
jdk/ \
com/sun/source/ \
com/sun/tools/javac/ \
com/sun/tools/doclint/
boot.javac.lint.opts=
boot.javac.source = 8
boot.javac.target = 8
# This is the JDK used to run the product version of the tools,
# for example, for testing. If you're building a complete JDK, specify that.
# Override this path as needed, either on the command line or in
# one of the standard user build.properties files (see build.xml)
#configuration of submodules (share by both the bootstrap and normal compilation):
langtools.modules=java.base:java.compiler:jdk.compiler:jdk.dev:jdk.javadoc
java.base.dependencies=
java.compiler.dependencies=java.base
jdk.compiler.dependencies=java.base:java.compiler
jdk.javadoc.dependencies=java.base:java.compiler:jdk.compiler
jdk.dev.dependencies=java.base:java.compiler:jdk.compiler
# target.java.home = /opt/jdk/1.8.0
target.java = ${target.java.home}/bin/java
#test configuration:
jtreg.tests=
boot.javac.tests = tools/javac
crules.tests = ../make/test/crules
#javadoc configuration
javadoc.jls.cite=The Java™ Language Specification
javadoc.jls.option=-tag "jls:a:See <cite>${javadoc.jls.cite}</cite>:" \
-tag "implNote:a:Implementation Note:"
# Version info -- override as needed
jdk.version = 1.9.0
@ -55,146 +76,4 @@ milestone = internal
# timestamps
# FIXME -- need to include openjdk as needed
release = ${jdk.version}-${milestone}
bootstrap.release = ${release}_bootstrap
full.version = ${release}-${build.number}
bootstrap.full.version = ${bootstrap.release}-${build.number}
# options for the <javac> tasks used to compile the tools
javac.source = 8
javac.target = 8
javac.debug = true
javac.debuglevel = source,lines
javac.no.jdk.warnings = -XDignore.symbol.file=true
# set the following to -version to verify the versions of javac being used
javac.version.opt =
# in time, there should be no exceptions to -Xlint:all
javac.lint.opts = -Xlint:all,-deprecation -Werror
# options for the <javadoc> task for javac
#javadoc.jls3.url=http://java.sun.com/docs/books/jls/
#javadoc.jls3.cite=&lt;a href=&quot;${javadoc.jls3.url}&quot;&gt;The Java Language Specification, Third Edition&lt;/a&gt;
#javadoc.jls3.option=-tag "jls3:a:See &lt;cite&gt;${javadoc.jls3.cite}&lt;/cite&gt;:"
javadoc.jls.cite=The Java&trade; Language Specification
javadoc.jls.option=-tag "jls:a:See &lt;cite&gt;${javadoc.jls.cite}&lt;/cite&gt;:"
# jtreg, used to run the JDK regression tests
# See http://openjdk.java.net/jtreg/
# Override this path as needed, either on the command line or in
# one of the standard user build.properties files (see build.xml)
# jtreg.home = /opt/jtreg/4.1
# findbugs
# See http://findbugs.sourceforge.net/
# Override this path as needed, either on the command line or in
# one of the standard user build.properties files (see build.xml)
# findbugs.home = /opt/findbugs/1.2.1
# vizant (graph visualization tool for Ant)
# See http://vizant.sourceforge.net/
# Override this path as needed, either on the command line or in
# one of the standard user build.properties files (see build.xml)
# vizant.jar = /opt/vizant/0.1.2/vizant-0.1.2.jar
# dot = dot
#------------------------------------------------------------
# The following properties define the packages for each of the tools.
# Syntactically, they should be suitable as arguments for the "includes"
# parameter of Ant filesets. In particular, note the trailing '/'.
javac.includes = \
javax/annotation/processing/ \
javax/lang/model/ \
javax/tools/ \
jdk/ \
com/sun/source/ \
com/sun/tools/javac/ \
com/sun/tools/doclint/
javac.tests = \
tools/javac
#
javadoc.includes = \
com/sun/javadoc/ \
com/sun/tools/javadoc/ \
com/sun/tools/doclets/
javadoc.tests = \
tools/javadoc/ \
com/sun/javadoc/
#
javah.includes = \
com/sun/tools/javah/
javah.tests = \
tools/javah/
#
javap.includes = \
com/sun/tools/classfile/ \
com/sun/tools/javap/ \
com/sun/tools/jdeps/ \
sun/tools/javap/
javap.tests = \
tools/javap/
#
sjavac.includes = \
com/sun/tools/sjavac/
sjavac.tests = \
tools/sjavac
crules.tests = ../make/test/crules
#
# The following files require the latest JDK to be available.
# The API can be provided by using a suitable boot.java.home
# or by setting import.jdk
require.latest.jdk.files = \
com/sun/tools/javac/nio/*.java
# The following files in the import jdk source directory are required
# in order to compile the files defined in ${require.latest.jdk.files}
#
# For NIO, the list of stub files is defined by the contents of the primary
# API packages, together with such types that may be required in order to
# compile the stubs. Some of these dependencies would go away if the stub
# generator were to be improved -- e.g. by removing unnecessary imports.
#
import.jdk.stub.files = \
java/io/File.java \
java/nio/file/**.java \
java/nio/file/attribute/**.java \
java/nio/file/spi/**.java \
java/nio/channels/AsynchronousChannel.java \
java/nio/channels/AsynchronousFileChannel.java \
java/nio/channels/CompletionHandler.java \
java/nio/channels/SeekableByteChannel.java
# The following value is used by the main jtreg target.
# An empty value means all tests
# Override as desired to run a specific set of tests
jtreg.tests =
# Check style configuration
# overridable name and version
checkstyle.name.version = checkstyle-5.4

File diff suppressed because it is too large Load Diff

View File

@ -43,10 +43,9 @@ mylib="$mydir/../lib"
# dependent jar files for additional dependencies.
if [ "$LANGTOOLS_USE_BOOTCLASSPATH" != "no" ]; then
cp=`unzip -c "$mylib/#PROGRAM#.jar" META-INF/MANIFEST.MF |
grep "Class-Path:" |
sed -e 's|Class-Path: *||' -e 's|\([a-z]*\.jar\) *|'"$mylib"'/\1#PS#|g'`
bcp="$mylib/#PROGRAM#.jar#PS#$cp"
cp=`echo "$mylib"/*.jar |
sed -e 's|\([a-z.]*\.jar\) *|\1#PS#|g'`
bcp=$cp
fi
# tools currently assumes that assertions are enabled in the launcher
@ -72,4 +71,4 @@ done
unset DUALCASE
IFS=$nl
"#TARGET_JAVA#" "${bcp:+-Xbootclasspath/p:"$bcp"}" ${ea} ${javaOpts} -jar "${mylib}/#PROGRAM#.jar" ${toolOpts}
"#TARGET_JAVA#" "${bcp:+-Xbootclasspath/p:"$bcp"}" ${ea} ${javaOpts} com.sun.tools.#PROGRAM#.Main ${toolOpts}

View File

@ -46,48 +46,34 @@
-->
<import file="../../build.xml"/>
<!-- Build project. (action: build; F11)
If langtools.tool.name is set, then just build that tool; otherwise
build all tools.
-->
<!-- Build project. (action: build; F11) -->
<target name="build" depends="-get-tool-if-set,-build-tool,-build-all"
description="Build one or all langtools tools"
/>
<condition property="use_bootstrap" value="bootstrap-" else="">
<isset property="langtools.tool.bootstrap"/>
</condition>
<condition property="with_bootclasspath" value="${build.bootstrap.dir}/classes" else="${build.classes.dir}">
<isset property="langtools.tool.bootstrap"/>
</condition>
<target name="-build-tool" if="langtools.tool.name">
<echo level="info" message="Building ${use_bootstrap}${langtools.tool.name}"/>
<echo level="verbose" message="(Unset langtools.tool.name to build all tools)"/>
<antcall target="build-${use_bootstrap}${langtools.tool.name}"/>
<target name="build" depends="-get-tool-if-set,-build-bootstrap-javac,-build-all" />
<target name="-build-bootstrap-javac" if="langtools.tool.bootstrap">
<antcall target="build-bootstrap-javac"/>
</target>
<target name="-build-all" unless="langtools.tool.name">
<echo level="info" message="Building all tools"/>
<echo level="verbose" message="(Set langtools.tool.name to build a single tool)"/>
<target name="-build-all" unless="langtools.tool.bootstrap">
<antcall target="build-all-tools"/>
</target>
<!-- Compile a single file. (action: compile.single; F9) -->
<target name="compile-single" depends="build-bootstrap-javac">
<target name="compile-single" depends="-get-tool-if-set,build-bootstrap-javac-classes" unless="langtools.tool.bootstrap">
<fail unless="includes">Must set property 'includes'</fail>
<javac fork="true" executable="${build.bootstrap.dir}/bin/javac"
srcdir="${srcdir}"
destdir="${build.classes.dir}"
<mkdir dir="${build.dir}/${module.name}/classes" />
<javac fork="true" executable="${boot.java.home}/bin/javac"
srcdir="${basedir}/src/${module.name}/share/classes"
destdir="${build.dir}/${module.name}/classes"
includes="${includes}"
sourcepath=""
classpath="${langtools.classes}"
includeAntRuntime="no"
source="${javac.source}"
target="${javac.target}"
debug="${javac.debug}"
debuglevel="${javac.debuglevel}"/>
debuglevel="${javac.debuglevel}">
<compilerarg value="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
</javac>
</target>
<!-- Run tool. (action: run; F6)
@ -95,16 +81,24 @@
the user.
-->
<target name="run" depends="-check-target.java.home,build,-def-run,-get-tool-and-args"
<target name="run" depends="-check-target.java.home,-build-classes,-def-run,-get-tool-and-args,-setup-bootclasspath"
description="run tool">
<echo level="info" message="${with_bootclasspath}"/>
<echo level="info" message="Run ${use_bootstrap}${langtools.tool.name} with args ${langtools.tool.args}"/>
<run bcp="${with_bootclasspath}" mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}"/>
</target>
<target name="-build-classes" depends="-get-tool-if-set,-build-classes-bootstrap-javac,-build-classes-all" />
<target name="-build-classes-bootstrap-javac" if="langtools.tool.bootstrap">
<antcall target="build-bootstrap-javac-classes"/>
</target>
<target name="-build-classes-all" unless="langtools.tool.bootstrap">
<antcall target="build-all-classes"/>
</target>
<!-- Run a selected class. (action: run.single; shift-F6) -->
<target name="run-single" depends="-check-target.java.home,-def-run">
<target name="run-single" depends="-check-target.java.home,-setup-bootclasspath,-def-run">
<fail unless="run.classname">Must set property 'run.classname' </fail>
<echo level="info" message="run ${run.classname}"/>
<run mainclass="${run.classname}" args=""/>
@ -115,22 +109,22 @@
test all tools.
-->
<target name="jtreg" depends="-get-tool-if-set,-jtreg-tool,-jtreg-all"
description="Test one or all langtools tools"
<target name="jtreg" depends="-get-tool-if-set,-jtreg-bootstrap-javac,-jtreg-all"
description="Test langtools tools or bootstrap javac"
/>
<target name="-jtreg-tool" if="langtools.tool.name">
<echo level="info" message="Testing ${langtools.tool.name}"/>
<echo level="verbose" message="(Unset langtools.tool.name to test all tools)"/>
<target name="-jtreg-bootstrap-javac" if="langtools.tool.bootstrap">
<echo level="info" message="Testing bootstrap javac"/>
<echo level="verbose" message="(Unset langtools.tool.bootstrap to test all tools)"/>
<antcall>
<target name="jtreg-${langtools.tool.name}"/>
<target name="jtreg-bootstrap-javac"/>
<target name="-show-jtreg"/>
</antcall>
</target>
<target name="-jtreg-all" unless="langtools.tool.name">
<target name="-jtreg-all" unless="langtools.tool.bootstrap">
<echo level="info" message="Testing all tools"/>
<echo level="verbose" message="(Set langtools.tool.name to test a single tool)"/>
<echo level="verbose" message="(Set langtools.tool.bootstrap to test bootstrap javac)"/>
<antcall>
<target name="langtools.jtreg"/>
<target name="-show-jtreg"/>
@ -165,7 +159,7 @@
<!-- Debug tool in NetBeans. -->
<target name="debug" depends="-check-target.java.home,-def-run,-def-start-debugger,-get-tool-and-args,build" if="netbeans.home">
<target name="debug" depends="-check-target.java.home,-def-run,-def-start-debugger,-get-tool-and-args,-setup-bootclasspath,-build-classes" if="netbeans.home">
<echo level="info" message="Debug ${use_bootstrap}${langtools.tool.name} with args ${langtools.tool.args}"/>
<start-debugger/>
<run bcp="${with_bootclasspath}" mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}" jpda.jvmargs="${jpda.jvmargs}"/>
@ -179,20 +173,29 @@
</target>
<!-- Debug a jtreg test. -->
<target name="debug-jtreg" depends="-check-target.java.home,-def-start-debugger,-def-jtreg">
<target name="debug-jtreg" depends="-check-target.java.home,-def-start-debugger,-def-jtreg,-get-tool-if-set,-setup-bootclasspath">
<fail unless="jtreg.tests">Must set property 'jtreg.tests'</fail>
<start-debugger/>
<jtreg-tool name="debug" samevm="false" tests="${jtreg.tests}" jpda.jvmargs="${jpda.jvmargs}"/>
<jtreg-tool name="debug"
samevm="false"
tests="${jtreg.tests}"
jpda.jvmargs="${jpda.jvmargs}"
langtools.classes="${with_bootclasspath}"/>
</target>
<!-- Update a class being debugged. -->
<target name="debug-fix">
<target name="debug-fix" depends="-get-tool-if-set">
<fail unless="class">Must set property 'class'
</fail>
<antcall target="compile-single">
<param name="includes" value="${class}.java"/>
</antcall>
<condition property="build.classes.dir"
value="${build.dir}/${module.name}/classes"
else="${boot.build.dir}/${module.name}/classes">
<isset property="use_bootstrap"/>
</condition>
<nbjpdareload>
<fileset dir="${build.classes.dir}">
<include name="${class}.class"/>
@ -205,31 +208,10 @@
test all tools.
-->
<target name="javadoc" depends="-javadoc-tool,-javadoc-all"
description="Generate javadoc for one or all langtools tools"
/>
<target name="-javadoc-tool" if="langtools.tool.name">
<echo level="info" message="Generate javadoc for ${langtools.tool.name}"/>
<echo level="verbose" message="(Unset langtools.tool.name to generate javadoc for all tools)"/>
<antcall>
<target name="javadoc-${langtools.tool.name}"/>
<target name="-show-javadoc"/>
</antcall>
</target>
<target name="-javadoc-all" unless="langtools.tool.name">
<echo level="info" message="Generate javadoc for all tools"/>
<echo level="verbose" message="(Set langtools.tool.name to generate javadoc for a single tool)"/>
<antcall>
<target name="langtools.javadoc"/>
<target name="-show-javadoc"/>
</antcall>
</target>
<target name="javadoc" depends="langtools.javadoc,-show-javadoc" />
<target name="-show-javadoc" if="netbeans.home">
<!-- what if doing javadoc for all? -->
<nbbrowse file="${build.javadoc.dir}/${langtools.tool.name}/index.html"/>
<nbbrowse file="${build.javadoc.dir}/index.html"/>
</target>
<!-- Prompt for values. -->
@ -253,6 +235,15 @@
/>
</target>
<target name="-setup-bootclasspath">
<condition property="use_bootstrap" value="bootstrap-" else="">
<isset property="langtools.tool.bootstrap"/>
</condition>
<condition property="with_bootclasspath" value="${langtools.boot.classes}" else="${langtools.classes}">
<isset property="langtools.tool.bootstrap"/>
</condition>
</target>
<!-- Macro to run a tool or selected class - used by run* and debug* tasks -->
<target name="-def-run">
<macrodef name="run">
@ -262,7 +253,7 @@
<attribute name="jpda.jvmargs" default=""/>
<sequential>
<java fork="true" jvm="${target.java}" classname="@{mainclass}">
<java fork="true" jvm="${target.java.home}/bin/java" classname="@{mainclass}">
<jvmarg line="-Xbootclasspath/p:@{bcp}"/>
<jvmarg line="@{jpda.jvmargs}"/>
<arg line="@{args}"/>
@ -278,11 +269,11 @@
<sequential>
<nbjpdastart name="${ant.project.name}" addressproperty="jpda.address" transport="dt_socket">
<bootclasspath>
<pathelement location="${build.classes.dir}"/>
<pathelement path="${langtools.classes}"/>
<pathelement location="${target.java.home}/jre/lib/rt.jar"/>
</bootclasspath>
<sourcepath>
<path refid="src.dirs"/>
<pathelement path="${langtools.sources}"/>
</sourcepath>
</nbjpdastart>
<property

View File

@ -107,7 +107,7 @@
</action>
<action name="compile.single">
<target>compile-single</target>
<property name="srcdir">src/java.base/share/classes</property>
<property name="module.name">java.base</property>
<context>
<property>includes</property>
<folder>${root}/src/java.base/share/classes</folder>
@ -120,7 +120,7 @@
</action>
<action name="compile.single">
<target>compile-single</target>
<property name="srcdir">src/java.compiler/share/classes</property>
<property name="module.name">java.compiler</property>
<context>
<property>includes</property>
<folder>${root}/src/java.compiler/share/classes</folder>
@ -133,7 +133,7 @@
</action>
<action name="compile.single">
<target>compile-single</target>
<property name="srcdir">src/jdk.compiler/share/classes</property>
<property name="module.name">jdk.compiler</property>
<context>
<property>includes</property>
<folder>${root}/src/jdk.compiler/share/classes</folder>
@ -146,7 +146,7 @@
</action>
<action name="compile.single">
<target>compile-single</target>
<property name="srcdir">src/jdk.dev/share/classes</property>
<property name="module.name">jdk.dev</property>
<context>
<property>includes</property>
<folder>${root}/src/jdk.dev/share/classes</folder>
@ -159,7 +159,7 @@
</action>
<action name="compile.single">
<target>compile-single</target>
<property name="srcdir">src/jdk.javadoc/share/classes</property>
<property name="module.name">jdk.javadoc</property>
<context>
<property>includes</property>
<folder>${root}/src/jdk.javadoc/share/classes</folder>
@ -333,7 +333,7 @@
</action>
<action name="debug.fix">
<target>debug-fix</target>
<property name="srcdir">src/java.base/share/classes</property>
<property name="module.name">java.base</property>
<context>
<property>class</property>
<folder>${root}/src/java.base/share/classes</folder>
@ -346,7 +346,7 @@
</action>
<action name="debug.fix">
<target>debug-fix</target>
<property name="srcdir">src/java.compiler/share/classes</property>
<property name="module.name">java.compiler</property>
<context>
<property>class</property>
<folder>${root}/src/java.compiler/share/classes</folder>
@ -359,7 +359,7 @@
</action>
<action name="debug.fix">
<target>debug-fix</target>
<property name="srcdir">src/jdk.compiler/share/classes</property>
<property name="module.name">jdk.compiler</property>
<context>
<property>class</property>
<folder>${root}/src/jdk.compiler/share/classes</folder>
@ -372,7 +372,7 @@
</action>
<action name="debug.fix">
<target>debug-fix</target>
<property name="srcdir">src/jdk.dev/share/classes</property>
<property name="module.name">jdk.dev</property>
<context>
<property>class</property>
<folder>${root}/src/jdk.dev/share/classes</folder>
@ -385,7 +385,7 @@
</action>
<action name="debug.fix">
<target>debug-fix</target>
<property name="srcdir">src/jdk.dev/share/classes</property>
<property name="module.name">jdk.javadoc</property>
<context>
<property>class</property>
<folder>${root}/src/jdk.javadoc/share/classes</folder>
@ -478,11 +478,31 @@
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/4">
<compilation-unit>
<package-root>${root}/src/java.base/share/classes</package-root>
<built-to>${root}/build/java.base/classes</built-to>
<source-level>1.8</source-level>
</compilation-unit>
<compilation-unit>
<package-root>${root}/src/java.compiler/share/classes</package-root>
<classpath mode="compile">${root}/build/java.base/classes</classpath>
<built-to>${root}/build/java.compiler/classes</built-to>
<source-level>1.8</source-level>
</compilation-unit>
<compilation-unit>
<package-root>${root}/src/jdk.compiler/share/classes</package-root>
<classpath mode="compile">${root}/build/java.base/classes:${root}/build/java.compiler/classes</classpath>
<built-to>${root}/build/jdk.compiler/classes</built-to>
<source-level>1.8</source-level>
</compilation-unit>
<compilation-unit>
<package-root>${root}/src/jdk.dev/share/classes</package-root>
<classpath mode="compile">${root}/build/java.base/classes:${root}/build/java.compiler/classes:${root}/build/jdk.compiler/classes</classpath>
<built-to>${root}/build/jdk.dev/classes</built-to>
<source-level>1.8</source-level>
</compilation-unit>
<compilation-unit>
<package-root>${root}/src/jdk.javadoc/share/classes</package-root>
<built-to>${root}/build/classes</built-to>
<classpath mode="compile">${root}/build/java.base/classes:${root}/build/java.compiler/classes:${root}/build/jdk.compiler/classes</classpath>
<built-to>${root}/build/jdk.javadoc/classes</built-to>
<source-level>1.8</source-level>
</compilation-unit>
</java-data>

View File

@ -74,7 +74,18 @@ public class SelectToolTask extends Task {
enum ToolChoices {
NONE(""),
JAVAC("javac"),
BOOSTRAP_JAVAC("bootstrap-javac", true) {
@Override
public ToolChoices baseTool() {
return JAVAC;
}
},
JAVAC("javac") {
@Override
public ToolChoices asBootstrap() {
return BOOSTRAP_JAVAC;
}
},
JAVADOC("javadoc"),
JAVAH("javah"),
JAVAP("javap");
@ -91,6 +102,14 @@ public class SelectToolTask extends Task {
this.bootstrap = bootstrap;
}
public ToolChoices asBootstrap() {
return this;
}
public ToolChoices baseTool() {
return this;
}
@Override
public String toString() {
return toolName;
@ -176,9 +195,11 @@ public class SelectToolTask extends Task {
JOptionPane p = createPane(guiProps);
p.createDialog("Select Tool").setVisible(true);
toolName = ((ToolChoices)toolChoice.getSelectedItem()).toolName;
ToolChoices tool = (ToolChoices)toolChoice.getSelectedItem();
toolName = tool.baseTool().toolName;
toolBootstrap = tool.bootstrap;
toolArgs = argsField.getText();
toolBootstrap = bootstrapCheckbox.isSelected();
if (defaultCheck.isSelected()) {
if (toolName.equals("")) {
fileProps.remove("tool.name");
@ -213,30 +234,31 @@ public class SelectToolTask extends Task {
EnumSet<ToolChoices> toolChoices = toolProperty == null ?
EnumSet.allOf(ToolChoices.class) : EnumSet.range(ToolChoices.JAVAC, ToolChoices.JAVAP);
toolChoice = new JComboBox<>(toolChoices.toArray());
if (toolName != null)
toolChoice.setSelectedItem(ToolChoices.valueOf(toolName.toUpperCase()));
ToolChoices tool = toolName != null ? ToolChoices.valueOf(toolName.toUpperCase()) : null;
if (toolName != null) {
if (toolBootstrap)
tool = tool.asBootstrap();
toolChoice.setSelectedItem(tool);
}
toolChoice.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
String tn = ((ToolChoices)e.getItem()).toolName;
argsField.setText(getDefaultArgsForTool(props, tn));
ToolChoices tool = (ToolChoices)e.getItem();
argsField.setText(getDefaultArgsForTool(props, tool));
if (toolProperty != null)
okButton.setEnabled(!tn.equals(""));
okButton.setEnabled(tool != ToolChoices.NONE);
}
});
GridBagConstraints checkConstraint = new GridBagConstraints();
fc.anchor = GridBagConstraints.EAST;
GridBagConstraints toolConstraint = new GridBagConstraints();
fc.anchor = GridBagConstraints.WEST;
toolPane.add(toolChoice, toolConstraint);
bootstrapCheckbox = new JCheckBox("bootstrap", toolBootstrap);
toolPane.add(bootstrapCheckbox, checkConstraint);
body.add(toolPane, fc);
argsField = new JTextField(getDefaultArgsForTool(props, toolName), 40);
argsField = new JTextField(getDefaultArgsForTool(props, tool), 40);
if (toolProperty == null || argsProperty != null) {
JLabel argsLabel = new JLabel("Args:");
body.add(argsLabel, lc);
@ -322,8 +344,11 @@ public class SelectToolTask extends Task {
}
}
String getDefaultArgsForTool(Properties props, String tn) {
return (tn == null || tn.equals("")) ? "" : props.getProperty(tn + ".args", "");
String getDefaultArgsForTool(Properties props, ToolChoices tool) {
if (tool == null)
return "";
String toolName = tool.baseTool().toolName;
return toolName.equals("") ? "" : props.getProperty(toolName + ".args", "");
}
// Ant task parameters
@ -335,7 +360,6 @@ public class SelectToolTask extends Task {
// GUI components
private JComboBox<?> toolChoice;
private JCheckBox bootstrapCheckbox;
private JTextField argsField;
private JCheckBox defaultCheck;
private JButton okButton;