Skip to content

Commit

Permalink
8189094: Change required boot jdk to JDK 9
Browse files Browse the repository at this point in the history
Reviewed-by: ihse, mchung
  • Loading branch information
erikj committed Oct 19, 2017
1 parent 3978bff commit cf887f0
Show file tree
Hide file tree
Showing 19 changed files with 287 additions and 264 deletions.
17 changes: 6 additions & 11 deletions make/BuildNashorn.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,12 @@ $(eval $(call SetupJavaCompilation, BUILD_NASGEN, \
NASHORN_CLASSES_DIR := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn
NASGEN_RUN_FILE := $(NASHORN_CLASSES_DIR)/_the.nasgen.run

ifeq ($(BOOT_JDK_MODULAR), true)
NASGEN_OPTIONS := \
-cp $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm.util=ALL-UNNAMED \
#
else
NASGEN_OPTIONS := \
-Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes
endif
NASGEN_OPTIONS := \
-cp $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm.util=ALL-UNNAMED \
#

# Copy classes to final classes dir and run nasgen to modify classes in jdk.nashorn.internal.objects package
$(NASGEN_RUN_FILE): $(BUILD_NASGEN) $(jdk.scripting.nashorn)
Expand Down
64 changes: 44 additions & 20 deletions make/CompileInterimLangtools.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,63 @@ include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include SetupJavaCompilers.gmk
include Modules.gmk

################################################################################
# Generate interim versions of the module-info.java files for the interim
# langtools modules. Each interim module has ".interim" added as suffix to the
# original module name.

INTERIM_MODULEINFO_PATTERN := \
$(foreach m, $(INTERIM_LANGTOOLS_BASE_MODULES), -e 's/$m\([,; ]\)/$m.interim\1/g')

$(BUILDTOOLS_OUTPUTDIR)/gensrc/%.interim/module-info.java: \
$(TOPDIR)/src/%/share/classes/module-info.java
$(call LogInfo, Generating module-info.java for $*.interim)
$(call MakeDir, $(@D))
$(SED) $(INTERIM_MODULEINFO_PATTERN) $< > $@

TARGETS += $(patsubst %, $(BUILDTOOLS_OUTPUTDIR)/gensrc/%/module-info.java, \
$(INTERIM_LANGTOOLS_MODULES))

################################################################################
# Setup the rules to build interim langtools, which is compiled by the boot
# javac and can be run on the boot jdk. This will be used to compile
# the rest of the product. Each module is compiled separately to allow a modular
# boot jdk to override system classes using -Xoverride:.
# javac and can be run on the boot jdk. This will be used to compile the rest of
# the product. Each module is compiled separately because a multi module setup
# would require the source files to be copied into directories named after the
# actual interim modules.

# Param 1 - Name of module to compile
# Param 2 - Name of modules to depend on
define SetupInterimModule
$$(eval $$(call SetupJavaCompilation,BUILD_INTERIM_$(strip $1), \
$$(eval $$(call SetupJavaCompilation, BUILD_$1.interim, \
SETUP := BOOT_JAVAC, \
DISABLE_SJAVAC := true, \
SRC := $(TOPDIR)/src/$(strip $1)/share/classes \
$$(wildcard $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)), \
EXCLUDES := sun com/sun/tools/jdeps com/sun/tools/javap \
com/sun/tools/jdeprscan, \
EXCLUDE_FILES := module-info.java JavacToolProvider.java \
JavadocToolProvider.java Standard.java, \
SRC := $(BUILDTOOLS_OUTPUTDIR)/gensrc/$1.interim \
$$(wildcard $(SUPPORT_OUTPUTDIR)/gensrc/$1) \
$(TOPDIR)/src/$1/share/classes, \
EXCLUDES := sun, \
EXCLUDE_FILES := $(TOPDIR)/src/$1/share/classes/module-info.java \
Standard.java, \
EXTRA_FILES := $(BUILDTOOLS_OUTPUTDIR)/gensrc/$1.interim/module-info.java, \
COPY := .gif .png .xml .css .js javax.tools.JavaCompilerTool, \
BIN := $(BUILDTOOLS_OUTPUTDIR)/override_modules/$(strip $1), \
ADD_JAVAC_FLAGS := -Xbootclasspath/p:$$(call PathList, \
$$(foreach m, $2, $(BUILDTOOLS_OUTPUTDIR)/override_modules/$$m)), \
BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_modules/$1.interim, \
ADD_JAVAC_FLAGS := --module-path $(BUILDTOOLS_OUTPUTDIR)/interim_modules \
$$(INTERIM_LANGTOOLS_ADD_EXPORTS) \
-Xlint:-module, \
))

$$(BUILD_INTERIM_$(strip $1)): $$(foreach m, $2, $$(BUILD_INTERIM_$(strip $$m)))
$1_DEPS_INTERIM := $$(addsuffix .interim, $$(filter \
$$(INTERIM_LANGTOOLS_BASE_MODULES), $$(call FindTransitiveDepsForModule, $1)))

$$(BUILD_$1.interim): $$(foreach d, $$($1_DEPS_INTERIM), $$(BUILD_$$d))

TARGETS += $$(BUILD_INTERIM_$(strip $1))
TARGETS += $$(BUILD_$1.interim)
endef

$(eval $(call SetupInterimModule, java.compiler))
$(eval $(call SetupInterimModule, jdk.compiler, java.compiler))
$(eval $(call SetupInterimModule, jdk.jdeps, jdk.compiler java.compiler))
$(eval $(call SetupInterimModule, jdk.javadoc, java.compiler jdk.compiler))
$(foreach m, $(INTERIM_LANGTOOLS_BASE_MODULES), \
$(eval $(call SetupInterimModule,$m)) \
)

################################################################################

all: $(TARGETS)
41 changes: 34 additions & 7 deletions make/CompileInterimRmic.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -30,7 +30,25 @@ include MakeBase.gmk
include JavaCompilation.gmk
include SetupJavaCompilers.gmk

##########################################################################################
################################################################################
# Generate interim versions of the module-info.java files for the interim
# langtools modules. Each interim module has ".interim" added as suffix to the
# original module name.

INTERIM_MODULEINFO_PATTERN := \
$(foreach m, $(INTERIM_RMIC_BASE_MODULES), -e 's/$m\([,; ]\)/$m.interim\1/g') \
-e '/ToolProvider[,; ]/d'

$(BUILDTOOLS_OUTPUTDIR)/gensrc/%.interim/module-info.java: \
$(TOPDIR)/src/%/share/classes/module-info.java
$(call LogInfo, Generating module-info.java for $*.interim)
$(call MakeDir, $(@D))
$(SED) $(INTERIM_MODULEINFO_PATTERN) $< > $@

TARGETS += $(patsubst %, $(BUILDTOOLS_OUTPUTDIR)/gensrc/%/module-info.java, \
$(INTERIM_RMIC_MODULES))

################################################################################

RMIC_PKGS := \
sun/rmi/rmic \
Expand All @@ -41,14 +59,23 @@ RMIC_PKGS := \
sun/tools/util \
#

$(eval $(call SetupJavaCompilation,BUILD_INTERIM_RMIC, \
$(eval $(call SetupJavaCompilation, BUILD_jdk.rmic.interim, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(TOPDIR)/src/jdk.rmic/share/classes, \
EXCLUDE_FILES := module-info.java, \
EXCLUDE_FILES := $(TOPDIR)/src/jdk.rmic/share/classes/module-info.java, \
EXTRA_FILES := $(BUILDTOOLS_OUTPUTDIR)/gensrc/jdk.rmic.interim/module-info.java, \
INCLUDES := $(RMIC_PKGS), \
BIN := $(BUILDTOOLS_OUTPUTDIR)/override_modules/jdk.rmic, \
COPY := .properties))
BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_modules/jdk.rmic.interim, \
COPY := .properties, \
ADD_JAVAC_FLAGS := \
--module-path $(BUILDTOOLS_OUTPUTDIR)/interim_modules \
--add-modules java.corba \
--add-exports java.corba/com.sun.corba.se.impl.util=jdk.rmic.interim \
$(INTERIM_RMIC_ADD_EXPORTS), \
))

TARGETS += $(BUILD_jdk.rmic.interim)

##########################################################################################

all: $(BUILD_INTERIM_RMIC)
all: $(TARGETS)
19 changes: 14 additions & 5 deletions make/CompileToolsJdk.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,22 @@ BUILD_TOOLS_SRC_DIRS += \
$(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes \
#

$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
$(eval $(call SetupJavaCompilation, BUILD_TOOLS_JDK, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(BUILD_TOOLS_SRC_DIRS), \
EXCLUDES := build/tools/deps \
build/tools/docs \
build/tools/jigsaw, \
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes))
EXCLUDES := \
build/tools/deps \
build/tools/docs \
build/tools/jigsaw \
, \
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
ADD_JAVAC_FLAGS := \
--add-modules java.xml.bind \
--add-exports java.desktop/sun.awt=ALL-UNNAMED \
--add-exports java.xml.bind/javax.xml.bind.annotation=ALL-UNNAMED \
--add-exports java.base/sun.text=ALL-UNNAMED \
, \
))

TARGETS += $(BUILD_TOOLS_JDK)

Expand Down
4 changes: 2 additions & 2 deletions make/JrtfsJar.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -47,7 +47,7 @@ JIMAGE_PKGS := \
#

$(eval $(call SetupJavaCompilation, BUILD_JRTFS, \
SETUP := GENERATE_OLDBYTECODE, \
SETUP := GENERATE_8_BYTECODE, \
SRC := $(TOPDIR)/src/java.base/share/classes, \
EXCLUDE_FILES := module-info.java, \
INCLUDES := $(JIMAGE_PKGS), \
Expand Down
4 changes: 3 additions & 1 deletion make/Main.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ ifneq ($(CREATING_BUILDJDK), true)
$(foreach m, $(GENSRC_MODULES), $(eval $m-gensrc: $m-gensrc-src))

LANGTOOLS_GENSRC_TARGETS := $(filter $(addsuffix -%, $(LANGTOOLS_MODULES)), $(GENSRC_TARGETS))
INTERIM_LANGTOOLS_GENSRC_TARGETS := $(filter $(addsuffix -%, \
$(INTERIM_LANGTOOLS_BASE_MODULES)), $(GENSRC_TARGETS))
CORBA_GENSRC_TARGETS := $(filter $(addsuffix -%, $(CORBA_MODULES)), $(GENSRC_TARGETS))
HOTSPOT_GENSRC_TARGETS := $(filter $(addsuffix -%, $(HOTSPOT_MODULES)), $(GENSRC_TARGETS))
JDK_GENSRC_TARGETS := $(filter-out $(LANGTOOLS_GENSRC_TARGETS) \
Expand Down Expand Up @@ -602,7 +604,7 @@ ifneq ($(findstring -only, $(MAKECMDGOALS)), )
else
$(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools

interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
interim-langtools: $(INTERIM_LANGTOOLS_GENSRC_TARGETS)

buildtools-jdk: interim-langtools interim-cldrconverter

Expand Down
13 changes: 2 additions & 11 deletions make/ToolsJdk.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ BUILD_TOOLS_JDK := $(call SetupJavaCompilationCompileTarget, \

################################################################################

ifeq ($(BOOT_JDK_MODULAR), true)
COMPILEFONTCONFIG_ADD_EXPORTS := --add-exports java.desktop/sun.awt=ALL-UNNAMED
endif

TOOL_COMPILEFONTCONFIG = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
$(COMPILEFONTCONFIG_ADD_EXPORTS) \
--add-exports java.desktop/sun.awt=ALL-UNNAMED \
build.tools.compilefontconfig.CompileFontConfig

TOOL_COMPILEPROPERTIES = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
Expand Down Expand Up @@ -95,13 +91,8 @@ TOOL_CHARSETMAPPING = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classe
TOOL_SPP = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.spp.Spp

# Nimbus is used somewhere in the swing build.

ifeq ($(BOOT_JDK_MODULAR), true)
COMPILENIMBUS_ADD_MODS := --add-modules java.xml.bind
endif

TOOL_GENERATENIMBUS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
$(COMPILENIMBUS_ADD_MODS) \
--add-modules java.xml.bind \
build.tools.generatenimbus.Generator

TOOL_WRAPPERGENERATOR = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
Expand Down
19 changes: 5 additions & 14 deletions make/autoconf/boot-jdk.m4
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
[FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`]
[FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`]
if test "x$FOUND_CORRECT_VERSION" = x; then
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
AC_MSG_NOTICE([(Your Boot JDK must be version 8, 9 or 10)])
AC_MSG_NOTICE([(Your Boot JDK must be version 9 or 10)])
BOOT_JDK_FOUND=no
else
# We're done! :-)
Expand Down Expand Up @@ -301,20 +301,11 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
# Finally, set some other options...
# When compiling code to be executed by the Boot JDK, force jdk8 compatibility.
BOOT_JDK_SOURCETARGET="-source 8 -target 8"
# When compiling code to be executed by the Boot JDK, force compatibility with the
# oldest supported bootjdk.
BOOT_JDK_SOURCETARGET="-source 9 -target 9"
AC_SUBST(BOOT_JDK_SOURCETARGET)
AC_MSG_CHECKING([if Boot JDK supports modules])
if "$JAVA" --list-modules > /dev/null 2>&1; then
AC_MSG_RESULT([yes])
BOOT_JDK_MODULAR="true"
else
AC_MSG_RESULT([no])
BOOT_JDK_MODULAR="false"
fi
AC_SUBST(BOOT_JDK_MODULAR)
AC_SUBST(JAVAC_FLAGS)
# Check if the boot jdk is 32 or 64 bit
Expand Down
2 changes: 0 additions & 2 deletions make/autoconf/bootcycle-spec.gmk.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

# Support for building boot cycle builds

BOOT_JDK_MODULAR := true

# First include the real base spec.gmk file
include @SPEC@

Expand Down
Loading

0 comments on commit cf887f0

Please sign in to comment.