Need reviewers: update langtools/build.xml

Jonathan Gibbons Jonathan.Gibbons at Sun.COM
Fri Nov 6 19:27:02 UTC 2009


1. Simplify build macros

Currently, the langtools build.xml builds a number of components (javac,
javadoc, javah, etc) using a number of macros (build-tool, build-jar,
build-classes, etc). Currently the macros are such that build-tool invokes
build-jar which in turn builds build-classes.. This is convenient for
the use site, since each top level target only needs to invoke a single
macro to perform its work. However, it is very inconvenient for the
macro declarations since build-tool has to support all the possible
parameters for build-jar, and both have to support all the possible
parameters for build-classes.

Change it so that the macros do not invoke each other but each presumes
the necessary predecessors have been called. This greatly simplifies
the macro declarations, and easily compensates for the slightly more
verbose invocations at the top level targets.  Going forward, it makes
it much simpler to add new attributes as needed to the various macros.

As a side effect, it also reduces the complexity of any error messages
reported by Ant, which does not handle errors from nested macro
invocations particularly gracefully.

2. Reduce javac invocations in build-classes

The current build-classes macro invokes javac twice, once for the
generated source, and once for the main source for the tool.  Despite
its name, the <javac> srcdir attribute defines a "path-like structure",
meaning that you can provide multiple root directories in which to locate
the source to be compiled. Using this feature, you can reduce the two
compilations into a single compilation.

3. Reduce javac-invocations in build-all-classes

Originally, the rules for building the various langtools tools were
set up to allow different options (-Xlint, -Werror, etc) for different
tools. Over time, the tools have been cleaned up to allow uniform
compilation. While it is still appropriate for the developer targets
to compile the tools individually, the target invoked by the full JDK
build can simply compile all the tools together in a single compilation.



More information about the build-dev mailing list