build target versions
Kelly.Ohair at Sun.COM
Wed May 6 01:12:00 UTC 2009
Jonathan Gibbons wrote:
> We're trying to change the default values for the -source and -target
> options in javac.
> I'm trying to understand two settings in the jdk build:
> This file sets TARGET_CLASS_VERSION to 5, without having a matching
> setting of LANGUAGE_VERSION.
I think this Defs-control.gmk file is only used by closed repositories.
This setting can probably be deleted.
I don't think those closed repositories need or use this setting.
> This file sets TARGET_CLASS_VERSION to 5, and correctly has a matching
> setting of LANGUAGE_VERSION.
That should be the primary place where these are set.
> What is the difference between the settings in those two files? In
> other words,
> who uses each one?
> Also, I note the following:
> This file passes on the value of TARGET_CLASS_VERSION but does not pass
> on a corresponding version of LANGUAGE_VERSION.
It should pass both. Most makefiles should have got the settings
in Defs-java.gmk, but some Makefiles may not include Defs-java.gmk.
Passing the values in on the command line forces them in and also
overrides any private setting the makefiles might have.
Although with LANGUAGE_VERSION being a string with spaces "-source 1.5"
you'll need to be careful crafting it, using appropriate quotes.
Or could we change LANGUAGE_VERSION to just a number? ;^)
> As a general rule, anyone setting javac's -target flag should normally
> always be
> setting a corresponding -source flag as well. The target value can be
> bigger (newer)
> than the source value, but it is an error for the target to be less than
> the source value.
> Setting one but not the other opens oneself up to the possibility of
> errors when the
> default values change.
Agreed, this is an oversight. I'm the one that created Defs-java.gmk to
try and corral all these java settings, I missed this.
(the corba/make/common/shared one is an unfortunate copy).
I did a bit of an inventory...
On TARGET_CLASS_VERSION I see:
./langtools/make/Makefile: ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
./jaxws/make/Makefile: ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
./jaxp/make/Makefile: ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
./make/Defs-internal.gmk: TARGET_CLASS_VERSION=$(TARGET_CLASS_VERSION) \
./jdk/make/com/sun/crypto/provider/Makefile:TARGET_CLASS_VERSION = 5
./jdk/make/common/shared/Defs-java.gmk:TARGET_CLASS_VERSION = 5
./jdk/make/common/shared/Defs-java.gmk:CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
./jdk/make/javax/crypto/Makefile:TARGET_CLASS_VERSION = 5
./corba/make/common/shared/Defs-java.gmk:TARGET_CLASS_VERSION = 5
./corba/make/common/shared/Defs-java.gmk:CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
On LANGUAGE_VERSION I see:
./langtools/make/Makefile:# Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
./jaxws/make/Makefile:# Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
./jaxp/make/Makefile:# Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
./jdk/make/common/shared/Defs-java.gmk:LANGUAGE_VERSION = -source 1.5
./jdk/make/common/shared/Defs-java.gmk:JAVACFLAGS += $(LANGUAGE_VERSION)
./jdk/make/javax/swing/beaninfo/SwingBeans.gmk:JAVADOCFLAGS = $(NO_PROPRIETARY_API_WARNINGS) $(LANGUAGE_VERSION)
./corba/make/common/shared/Defs-java.gmk:LANGUAGE_VERSION = -source 1.5
./corba/make/common/shared/Defs-java.gmk:JAVACFLAGS += $(LANGUAGE_VERSION)
Just to clarify.
> -- Jon
More information about the build-dev