8074726: Update source and target version used when compiling hotspot class files
Summary: Use BOOT_JDK_SOURCETARGET from top level, or fall back to -source 8 -target 8
Reviewed-by: dholmes, sla
--- a/hotspot/make/aix/makefiles/rules.make Tue Mar 10 04:53:58 2015 -0700
+++ b/hotspot/make/aix/makefiles/rules.make Tue Mar 10 09:42:23 2015 -0700
@@ -126,10 +126,17 @@
RUN.JAR$(MAKE_VERBOSE) += >/dev/null
# Settings for javac
-BOOT_SOURCE_LANGUAGE_VERSION = 6
-BOOT_TARGET_CLASS_VERSION = 6
JAVAC_FLAGS = -g -encoding ascii
-BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION)
+
+# Prefer BOOT_JDK_SOURCETARGET if it's set (typically by the top build system)
+# Fall back to the values here if it's not set (hotspot only builds)
+ifeq ($(BOOT_JDK_SOURCETARGET),)
+BOOTSTRAP_SOURCETARGET := -source 8 -target 8
+else
+BOOTSTRAP_SOURCETARGET := $(BOOT_JDK_SOURCETARGET)
+endif
+
+BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) $(BOOTSTRAP_SOURCETARGET)
# With parallel makes, print a message at the end of compilation.
ifeq ($(findstring j,$(MFLAGS)),j)
--- a/hotspot/make/bsd/makefiles/rules.make Tue Mar 10 04:53:58 2015 -0700
+++ b/hotspot/make/bsd/makefiles/rules.make Tue Mar 10 09:42:23 2015 -0700
@@ -126,10 +126,17 @@
RUN.JAR$(MAKE_VERBOSE) += >/dev/null
# Settings for javac
-BOOT_SOURCE_LANGUAGE_VERSION = 6
-BOOT_TARGET_CLASS_VERSION = 6
JAVAC_FLAGS = -g -encoding ascii
-BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION)
+
+# Prefer BOOT_JDK_SOURCETARGET if it's set (typically by the top build system)
+# Fall back to the values here if it's not set (hotspot only builds)
+ifeq ($(BOOT_JDK_SOURCETARGET),)
+BOOTSTRAP_SOURCETARGET := -source 8 -target 8
+else
+BOOTSTRAP_SOURCETARGET := $(BOOT_JDK_SOURCETARGET)
+endif
+
+BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) $(BOOTSTRAP_SOURCETARGET)
# With parallel makes, print a message at the end of compilation.
ifeq ($(findstring j,$(MFLAGS)),j)
--- a/hotspot/make/defs.make Tue Mar 10 04:53:58 2015 -0700
+++ b/hotspot/make/defs.make Tue Mar 10 09:42:23 2015 -0700
@@ -347,6 +347,8 @@
# includes this make/defs.make file.
MAKE_ARGS += HOTSPOT_BUILD_VERSION=$(HOTSPOT_BUILD_VERSION)
+MAKE_ARGS += BOOT_JDK_SOURCETARGET="$(BOOT_JDK_SOURCETARGET)"
+
# Various export sub directories
EXPORT_INCLUDE_DIR = $(EXPORT_PATH)/include
EXPORT_DOCS_DIR = $(EXPORT_PATH)/docs
--- a/hotspot/make/linux/makefiles/rules.make Tue Mar 10 04:53:58 2015 -0700
+++ b/hotspot/make/linux/makefiles/rules.make Tue Mar 10 09:42:23 2015 -0700
@@ -126,10 +126,17 @@
RUN.JAR$(MAKE_VERBOSE) += >/dev/null
# Settings for javac
-BOOT_SOURCE_LANGUAGE_VERSION = 6
-BOOT_TARGET_CLASS_VERSION = 6
JAVAC_FLAGS = -g -encoding ascii
-BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION)
+
+# Prefer BOOT_JDK_SOURCETARGET if it's set (typically by the top build system)
+# Fall back to the values here if it's not set (hotspot only builds)
+ifeq ($(BOOT_JDK_SOURCETARGET),)
+BOOTSTRAP_SOURCETARGET := -source 8 -target 8
+else
+BOOTSTRAP_SOURCETARGET := $(BOOT_JDK_SOURCETARGET)
+endif
+
+BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) $(BOOTSTRAP_SOURCETARGET)
# With parallel makes, print a message at the end of compilation.
ifeq ($(findstring j,$(MFLAGS)),j)
--- a/hotspot/make/solaris/makefiles/rules.make Tue Mar 10 04:53:58 2015 -0700
+++ b/hotspot/make/solaris/makefiles/rules.make Tue Mar 10 09:42:23 2015 -0700
@@ -118,10 +118,17 @@
RUN.JAR$(MAKE_VERBOSE) += >/dev/null
# Settings for javac
-BOOT_SOURCE_LANGUAGE_VERSION = 6
-BOOT_TARGET_CLASS_VERSION = 6
JAVAC_FLAGS = -g -encoding ascii
-BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION)
+
+# Prefer BOOT_JDK_SOURCETARGET if it's set (typically by the top build system)
+# Fall back to the values here if it's not set (hotspot only builds)
+ifeq ($(BOOT_JDK_SOURCETARGET),)
+BOOTSTRAP_SOURCETARGET := -source 8 -target 8
+else
+BOOTSTRAP_SOURCETARGET := $(BOOT_JDK_SOURCETARGET)
+endif
+
+BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) $(BOOTSTRAP_SOURCETARGET)
# With parallel makes, print a message at the end of compilation.
ifeq ($(findstring j,$(MFLAGS)),j)
--- a/hotspot/make/windows/makefiles/rules.make Tue Mar 10 04:53:58 2015 -0700
+++ b/hotspot/make/windows/makefiles/rules.make Tue Mar 10 09:42:23 2015 -0700
@@ -44,10 +44,17 @@
!endif
# Settings for javac
-BOOT_SOURCE_LANGUAGE_VERSION=6
-BOOT_TARGET_CLASS_VERSION=6
JAVAC_FLAGS=-g -encoding ascii
-BOOTSTRAP_JAVAC_FLAGS=$(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION)
+
+# Prefer BOOT_JDK_SOURCETARGET if it's set (typically by the top build system)
+# Fall back to the values here if it's not set (hotspot only builds)
+!ifndef BOOT_JDK_SOURCETARGET
+BOOTSTRAP_SOURCETARGET=-source 8 -target 8
+!else
+BOOTSTRAP_SOURCETARGET=$(BOOT_JDK_SOURCETARGET)
+!endif
+
+BOOTSTRAP_JAVAC_FLAGS=$(JAVAC_FLAGS) $(BOOTSTRAP_SOURCETARGET)
# VS2012 and VS2013 loads VS10 projects just fine (and will
# upgrade them automatically to VS2012 format).