diff --git a/make/CreateJmods.gmk b/make/CreateJmods.gmk index 394888c4970..40900ff91a9 100644 --- a/make/CreateJmods.gmk +++ b/make/CreateJmods.gmk @@ -69,21 +69,13 @@ endif # Add dependencies on other jmod files. Only java.base needs access to other # jmods. ifeq ($(MODULE), java.base) + ALL_UPGRADEABLE_MODULES = $(call FindAllUpgradeableModules) # When creating a BUILDJDK, we don't need to add hashes to java.base ifneq ($(CREATING_BUILDJDK), true) DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \ - $(filter-out java.base, $(call FindAllModules))) + $(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules))) - # TODO: find modules that directly and indirectly depend on upgradeable - # modules - EXCLUDE_HASH_MODULES := $(UPGRADEABLE_MODULES) \ - java.se.ee \ - jdk.rmic \ - jdk.xml.bind \ - jdk.xml.ws \ - # - - EXCLUDE_PATTERN := $(strip $(subst $(SPACE),|,$(strip $(EXCLUDE_HASH_MODULES)))) + EXCLUDE_PATTERN := $(strip $(subst $(SPACE),|,$(strip $(ALL_UPGRADEABLE_MODULES)))) JMOD_FLAGS += --modulepath $(JMODS_DIR) \ --hash-modules '^(?!$(EXCLUDE_PATTERN))' diff --git a/make/Main.gmk b/make/Main.gmk index 29a9de44b2d..b0361fb83c3 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -596,7 +596,8 @@ else # When creating a BUILDJDK, we don't need to add hashes to java.base, thus # we don't need to depend on all other jmods ifneq ($(CREATING_BUILDJDK), true) - java.base-jmod: $(filter-out java.base-jmod, $(JMOD_TARGETS)) + java.base-jmod: $(filter-out java.base-jmod \ + $(addsuffix -jmod, $(call FindAllUpgradeableModules)), $(JMOD_TARGETS)) endif # Declare dependencies from -jmod to all other module targets diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk index fa5aa54e6fc..90469d073fd 100644 --- a/make/common/Modules.gmk +++ b/make/common/Modules.gmk @@ -86,6 +86,10 @@ UPGRADEABLE_MODULES += \ java.xml.ws \ # +# Modules explicitly declared as not being upgradeable even though they require +# an upgradeable module. +NON_UPGRADEABLE_MODULES += + AGGREGATOR_MODULES += \ java.compact1 \ java.compact2 \ @@ -245,6 +249,19 @@ FindTransitiveDepsForModule = \ $(foreach n, $(call FindDepsForModule, $m), \ $(call FindDepsForModule, $n)))) +# Upgradeable modules are those that are either defined as upgradeable or that +# require an upradeable module. +FindAllUpgradeableModules = \ + $(filter-out $(MODULES_FILTER) $(NON_UPGRADEABLE_MODULES), \ + $(sort $(UPGRADEABLE_MODULES) $(foreach m, \ + $(filter-out $(UPGRADEABLE_MODULES), $(call FindAllModules)), \ + $(if $(filter $(UPGRADEABLE_MODULES), \ + $(call FindTransitiveDepsForModule, $m)), \ + $m \ + ) \ + )) \ + ) + ################################################################################ # Param 1 - Name of module