8155786: Determine modules depending on upgradeable modules directly and indirectly
authorerikj
Thu, 19 May 2016 17:24:50 +0200
changeset 37975 551c5d86de79
parent 37974 05e1a65c1d56
child 37976 9cc5debe0f47
8155786: Determine modules depending on upgradeable modules directly and indirectly Reviewed-by: alanb, mchung
make/CreateJmods.gmk
make/Main.gmk
make/common/Modules.gmk
--- a/make/CreateJmods.gmk	Mon May 16 12:33:22 2016 +0200
+++ b/make/CreateJmods.gmk	Thu May 19 17:24:50 2016 +0200
@@ -69,21 +69,13 @@
 # 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))'
--- a/make/Main.gmk	Mon May 16 12:33:22 2016 +0200
+++ b/make/Main.gmk	Thu May 19 17:24:50 2016 +0200
@@ -596,7 +596,8 @@
   # 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 <module>-jmod to all other module targets
--- a/make/common/Modules.gmk	Mon May 16 12:33:22 2016 +0200
+++ b/make/common/Modules.gmk	Thu May 19 17:24:50 2016 +0200
@@ -86,6 +86,10 @@
     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 @@
             $(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