changeset 2357:e850a15d3ac6

8152197: Single place to specify module-specific information for images build Reviewed-by: alanb, erikj
author mchung
date Wed, 23 Mar 2016 09:20:41 -0700
parents f7b181bd0dc2
children 6da9e0c79eac
files make/Images.gmk make/common/Modules.gmk
diffstat 2 files changed, 150 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/make/Images.gmk	Tue Mar 22 17:02:40 2016 +0000
+++ b/make/Images.gmk	Wed Mar 23 09:20:41 2016 -0700
@@ -38,61 +38,23 @@
 
 ############################################################################
 
-MAIN_MODULES += java.se.ee java.smartcardio jdk.httpserver jdk.sctp \
-               jdk.security.auth jdk.security.jgss jdk.pack200 jdk.xml.dom \
-               jdk.accessibility jdk.internal.le jdk.dynalink \
-               jdk.scripting.nashorn jdk.scripting.nashorn.shell \
-               jdk.vm.ci jdk.management jdk.jsobject
+# All modules for the current target platform.
+ALL_MODULES := $(call FindAllModules)
 
-# providers
-PROVIDER_MODULES += jdk.charsets jdk.crypto.ec jdk.crypto.pkcs11 jdk.jvmstat jdk.jvmstat.rmi \
-               jdk.localedata jdk.naming.dns jdk.naming.rmi jdk.zipfs
+$(eval $(call ReadImportMetaData))
 
-# tools
-TOOLS_MODULES += jdk.attach jdk.compiler \
-               jdk.javadoc jdk.jcmd jdk.jconsole jdk.hotspot.agent jdk.jartool \
-               jdk.jdeps jdk.jdi jdk.jdwp.agent jdk.jlink jdk.jshell \
-               jdk.policytool jdk.rmic jdk.xml.bind jdk.xml.ws jdk.internal.opt
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  PROVIDER_MODULES += jdk.crypto.mscapi
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-  PROVIDER_MODULES += jdk.crypto.ucrypto
-endif
-
-JRE_MODULES := $(filter-out $(MODULES_FILTER), $(MAIN_MODULES) $(PROVIDER_MODULES))
-JDK_MODULES := $(filter-out $(MODULES_FILTER), $(JRE_MODULES) $(TOOLS_MODULES))
-
-# Param 1 - Name of module
-define ReadImportMetaData
-  ifneq ($$(wildcard $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties), )
-    include_in_jre :=
-    include_in_jdk :=
-    include $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties
-    ifeq ($$(include_in_jre), true)
-      JRE_MODULES += $1
-    endif
-    ifeq ($$(include_in_jdk), true)
-      JDK_MODULES += $1
-    endif
-  else
-    # Default to include in all
-    JRE_MODULES += $1
-    JDK_MODULES += $1
-  endif
-endef
-
-IMPORTED_MODULES := $(call FindImportedModules)
-$(foreach m, $(IMPORTED_MODULES), $(eval $(call ReadImportMetaData, $m)))
+JRE_MODULES += $(filter-out $(MODULES_FILTER), $(BOOT_MODULES) $(PLATFORM_MODULES) $(JRE_TOOL_MODULES))
+JDK_MODULES += $(filter-out $(MODULES_FILTER), $(ALL_MODULES))
 
 # Compact builds have additional modules
-COMPACT_EXTRA_MODULES := jdk.localedata jdk.crypto.pkcs11 jdk.crypto.ec
-JRE_COMPACT1_MODULES := $(COMPACT_EXTRA_MODULES) java.compact1
-JRE_COMPACT2_MODULES := $(JRE_COMPACT1_MODULES) java.compact2 jdk.xml.dom jdk.httpserver
-JRE_COMPACT3_MODULES := $(JRE_COMPACT2_MODULES) java.compact3 java.smartcardio jdk.management \
-                        jdk.naming.dns jdk.naming.rmi jdk.sctp jdk.security.auth
+COMPACT1_EXTRA_MODULES := jdk.localedata jdk.crypto.pkcs11 jdk.crypto.ec
+COMPACT2_EXTRA_MODULES := jdk.xml.dom jdk.httpserver
+COMPACT3_EXTRA_MODULES := java.smartcardio jdk.management \
+    jdk.naming.dns jdk.naming.rmi jdk.sctp jdk.security.auth
+
+JRE_COMPACT1_MODULES := java.compact1 $(COMPACT1_EXTRA_MODULES)
+JRE_COMPACT2_MODULES := $(JRE_COMPACT1_MODULES) java.compact2 $(COMPACT2_EXTRA_MODULES)
+JRE_COMPACT3_MODULES := $(JRE_COMPACT2_MODULES) java.compact3 $(COMPACT3_EXTRA_MODULES)
 
 # Replacing double-comma with a single comma is to workaround the issue
 # with some version of make on windows that doesn't substitute spaces
--- a/make/common/Modules.gmk	Tue Mar 22 17:02:40 2016 +0000
+++ b/make/common/Modules.gmk	Wed Mar 23 09:20:41 2016 -0700
@@ -26,11 +26,108 @@
 ifndef _MODULES_GMK
 _MODULES_GMK := 1
 
+################################################################################
+#
+# BOOT_MODULES are modules defined by the boot loader
+# PLATFORM_MODULES are modules defined by the platform loader
+# JRE_TOOL_MODULES are tools included in JRE and defined by the application loader
+#
+# All other modules not declared below are defined by the application loader
+# and are not included in JRE.
+
+BOOT_MODULES :=
+PLATFORM_MODULES :=
+JRE_TOOL_MODULES :=
+
 # Hook to include the corresponding custom file, if present.
 $(eval $(call IncludeCustomExtension, , common/Modules.gmk))
 
+UPGRADEABLE_MDOULES :=
+AGGREGATOR_MDOULES :=
+
+BOOT_MODULES += \
+    java.base \
+    java.datatransfer \
+    java.desktop \
+    java.httpclient \
+    java.instrument \
+    java.logging \
+    java.management \
+    java.naming \
+    java.prefs \
+    java.rmi \
+    java.security.jgss \
+    java.security.sasl \
+    java.sql \
+    java.xml \
+    java.xml.crypto \
+    jdk.httpserver \
+    jdk.management \
+    jdk.sctp \
+    jdk.security.auth \
+    jdk.security.jgss \
+    #
+
+# to be deprivileged
+BOOT_MODULES += \
+    java.compiler \
+    java.scripting \
+    java.sql.rowset \
+    java.smartcardio \
+    jdk.charsets \
+    jdk.naming.rmi \
+    #
+
+UPGRADEABLE_MODULES += \
+    java.activation \
+    java.annotations.common \
+    java.corba \
+    java.transaction \
+    java.xml.bind \
+    java.xml.ws \
+    #
+
+AGGREGATOR_MODULES += \
+    java.compact1 \
+    java.compact2 \
+    java.compact3 \
+    java.se \
+    java.se.ee \
+    #
+
+PLATFORM_MODULES += \
+    $(UPGRADEABLE_MODULES) \
+    $(AGGREGATOR_MODULES)
+    #
+
+PLATFORM_MODULES += \
+    jdk.accessibility \
+    jdk.crypto.ec \
+    jdk.crypto.pkcs11 \
+    jdk.dynalink \
+    jdk.jsobject \
+    jdk.xml.dom \
+    jdk.localedata \
+    jdk.naming.dns \
+    jdk.scripting.nashorn \
+    jdk.zipfs \
+    #
+
+JRE_TOOL_MODULES += \
+    jdk.pack200 \
+    jdk.scripting.nashorn.shell \
+    #
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  PLATFORM_MODULES += jdk.crypto.mscapi
+endif
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+  PLATFORM_MODULES += jdk.crypto.ucrypto
+endif
+
 ################################################################################
 # Some platforms don't have the serviceability agent
+
 ifeq ($(INCLUDE_SA), false)
   MODULES_FILTER += jdk.hotspot.agent
 endif
@@ -120,4 +217,44 @@
 
 ################################################################################
 
+# Param 1 - Name of module
+define ReadSingleImportMetaData
+    ifneq ($$(wildcard $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties), )
+      classloader :=
+      include_in_jre :=
+      include_in_jdk :=
+      include $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties
+      ifeq ($$(include_in_jre), true)
+        JRE_MODULES += $1
+      endif
+      ifeq ($$(include_in_jdk), true)
+        JDK_MODULES += $1
+      endif
+      ifeq ($$(classloader), boot)
+        BOOT_MODULES += $1
+      else ifeq ($$(classloader), ext)
+        PLATFORM_MODULES += $1
+      endif
+    else
+      # Default to include in all
+      JRE_MODULES += $1
+      JDK_MODULES += $1
+    endif
+endef
+
+# Reading the imported modules metadata has a cost, so to make it available,
+# a makefile needs to eval-call this macro first. After calling this, the
+# following variables are populated with data from the imported modules:
+# * JRE_MODULES
+# * JDK_MODULES
+# * BOOT_MODULES
+# * PLATFORM_MODULES
+# * JRE_TOOL_MODULES
+define ReadImportMetaData
+    IMPORTED_MODULES := $(call FindImportedModules)
+    $(foreach m, $(IMPORTED_MODULES), $(eval $(call ReadImportMetaData, $m)))
+endef
+
+################################################################################
+
 endif # _MODULES_GMK