make/common/Modules.gmk
changeset 45778 630bf135e7a6
parent 45612 3368f6d8b082
child 47217 72e3ae9a25eb
equal deleted inserted replaced
45777:7f0b83636e5f 45778:630bf135e7a6
    38 BOOT_MODULES :=
    38 BOOT_MODULES :=
    39 PLATFORM_MODULES :=
    39 PLATFORM_MODULES :=
    40 JRE_TOOL_MODULES :=
    40 JRE_TOOL_MODULES :=
    41 UPGRADEABLE_MODULES :=
    41 UPGRADEABLE_MODULES :=
    42 AGGREGATOR_MODULES :=
    42 AGGREGATOR_MODULES :=
       
    43 DOCS_MODULES :=
    43 
    44 
    44 # Hook to include the corresponding custom file, if present.
    45 # Hook to include the corresponding custom file, if present.
    45 $(eval $(call IncludeCustomExtension, , common/Modules.gmk))
    46 $(eval $(call IncludeCustomExtension, , common/Modules.gmk))
    46 
    47 
    47 BOOT_MODULES += \
    48 BOOT_MODULES += \
    56     java.prefs \
    57     java.prefs \
    57     java.rmi \
    58     java.rmi \
    58     java.security.sasl \
    59     java.security.sasl \
    59     java.xml \
    60     java.xml \
    60     jdk.httpserver \
    61     jdk.httpserver \
       
    62     jdk.internal.vm.ci \
    61     jdk.management \
    63     jdk.management \
    62     jdk.management.agent \
    64     jdk.management.agent \
    63     jdk.net \
    65     jdk.net \
    64     jdk.sctp \
    66     jdk.sctp \
    65     jdk.unsupported \
    67     jdk.unsupported \
    66     jdk.vm.ci \
       
    67     #
    68     #
    68 
    69 
    69 # to be deprivileged
    70 # to be deprivileged
    70 BOOT_MODULES += \
    71 BOOT_MODULES += \
    71     jdk.naming.rmi \
    72     jdk.naming.rmi \
    72     #
    73     #
    73 
    74 
       
    75 # Modules that directly or indirectly requiring upgradeable modules
       
    76 # should carefully be considered if it should be upgradeable or not.
    74 UPGRADEABLE_MODULES += \
    77 UPGRADEABLE_MODULES += \
    75     java.activation \
    78     java.activation \
       
    79     java.compiler \
    76     java.corba \
    80     java.corba \
    77     java.transaction \
    81     java.transaction \
    78     java.xml.bind \
    82     java.xml.bind \
    79     java.xml.ws \
    83     java.xml.ws \
    80     java.xml.ws.annotation \
    84     java.xml.ws.annotation \
    81     #
    85     jdk.internal.vm.compiler \
    82 
    86     #
    83 # Modules explicitly declared as not being upgradeable even though they require
    87 
    84 # an upgradeable module.
    88 UPGRADEABLE_TOOL_MODULES += \
    85 NON_UPGRADEABLE_MODULES +=
    89     jdk.xml.bind \
       
    90     jdk.xml.ws \
       
    91     #
    86 
    92 
    87 AGGREGATOR_MODULES += \
    93 AGGREGATOR_MODULES += \
    88     java.se \
    94     java.se \
    89     java.se.ee \
    95     java.se.ee \
    90     #
    96     #
    93     $(UPGRADEABLE_MODULES) \
    99     $(UPGRADEABLE_MODULES) \
    94     $(AGGREGATOR_MODULES)
   100     $(AGGREGATOR_MODULES)
    95     #
   101     #
    96 
   102 
    97 PLATFORM_MODULES += \
   103 PLATFORM_MODULES += \
    98     java.compiler \
       
    99     jdk.incubator.httpclient \
       
   100     java.scripting \
   104     java.scripting \
   101     java.security.jgss \
   105     java.security.jgss \
   102     java.smartcardio \
   106     java.smartcardio \
   103     java.sql \
   107     java.sql \
   104     java.sql.rowset \
   108     java.sql.rowset \
   105     java.xml.crypto \
   109     java.xml.crypto \
   106     jdk.accessibility \
   110     jdk.accessibility \
   107     jdk.charsets \
   111     jdk.charsets \
       
   112     jdk.crypto.cryptoki \
   108     jdk.crypto.ec \
   113     jdk.crypto.ec \
   109     jdk.crypto.cryptoki \
       
   110     jdk.desktop \
       
   111     jdk.dynalink \
   114     jdk.dynalink \
       
   115     jdk.incubator.httpclient \
   112     jdk.jsobject \
   116     jdk.jsobject \
   113     jdk.localedata \
   117     jdk.localedata \
   114     jdk.naming.dns \
   118     jdk.naming.dns \
   115     jdk.scripting.nashorn \
   119     jdk.scripting.nashorn \
   116     jdk.security.auth \
   120     jdk.security.auth \
   117     jdk.security.jgss \
   121     jdk.security.jgss \
   118     jdk.xml.dom \
   122     jdk.xml.dom \
   119     jdk.zipfs \
   123     jdk.zipfs \
   120     #
   124     #
   121 
   125 
       
   126 ifeq ($(OPENJDK_TARGET_OS), windows)
       
   127   PLATFORM_MODULES += jdk.crypto.mscapi
       
   128 endif
       
   129 
       
   130 ifeq ($(OPENJDK_TARGET_OS), solaris)
       
   131   PLATFORM_MODULES += jdk.crypto.ucrypto
       
   132 endif
       
   133 
   122 JRE_TOOL_MODULES += \
   134 JRE_TOOL_MODULES += \
   123     jdk.jdwp.agent \
   135     jdk.jdwp.agent \
   124     jdk.pack \
   136     jdk.pack \
   125     jdk.scripting.nashorn.shell \
   137     jdk.scripting.nashorn.shell \
   126     #
   138     #
   127 
   139 
   128 ifeq ($(OPENJDK_TARGET_OS), windows)
   140 ################################################################################
   129   PLATFORM_MODULES += jdk.crypto.mscapi
   141 
   130 endif
   142 # DOCS_MODULES defines the root modules for javadoc generation.
   131 ifeq ($(OPENJDK_TARGET_OS), solaris)
   143 # All of their `require transitive` modules directly and indirectly will be included.
   132   PLATFORM_MODULES += jdk.crypto.ucrypto
   144 DOCS_MODULES += \
   133 endif
   145     java.se.ee \
       
   146     java.smartcardio \
       
   147     jdk.accessibility \
       
   148     jdk.attach \
       
   149     jdk.charsets \
       
   150     jdk.compiler \
       
   151     jdk.crypto.cryptoki \
       
   152     jdk.crypto.ec \
       
   153     jdk.dynalink \
       
   154     jdk.editpad \
       
   155     jdk.hotspot.agent \
       
   156     jdk.httpserver \
       
   157     jdk.incubator.httpclient \
       
   158     jdk.jartool \
       
   159     jdk.javadoc \
       
   160     jdk.jcmd \
       
   161     jdk.jconsole \
       
   162     jdk.jdeps \
       
   163     jdk.jdi \
       
   164     jdk.jdwp.agent \
       
   165     jdk.jlink \
       
   166     jdk.jsobject \
       
   167     jdk.jshell \
       
   168     jdk.jstatd \
       
   169     jdk.localedata \
       
   170     jdk.management \
       
   171     jdk.management.agent \
       
   172     jdk.naming.dns \
       
   173     jdk.naming.rmi \
       
   174     jdk.net \
       
   175     jdk.pack \
       
   176     jdk.policytool \
       
   177     jdk.rmic \
       
   178     jdk.scripting.nashorn \
       
   179     jdk.sctp \
       
   180     jdk.security.auth \
       
   181     jdk.security.jgss \
       
   182     jdk.xml.dom \
       
   183     jdk.zipfs \
       
   184     #
   134 
   185 
   135 # These modules are included in the interim image which is used to run profiling
   186 # These modules are included in the interim image which is used to run profiling
   136 # before building the real images.
   187 # before building the real images.
   137 INTERIM_IMAGE_MODULES := java.base java.logging
   188 INTERIM_IMAGE_MODULES := java.base java.logging
   138 
   189 
   145 
   196 
   146 ################################################################################
   197 ################################################################################
   147 # Filter out Graal specific modules if Graal build is disabled
   198 # Filter out Graal specific modules if Graal build is disabled
   148 
   199 
   149 ifeq ($(INCLUDE_GRAAL), false)
   200 ifeq ($(INCLUDE_GRAAL), false)
   150   MODULES_FILTER += jdk.vm.compiler
   201   MODULES_FILTER += jdk.internal.vm.compiler
   151 endif
   202 endif
   152 
   203 
   153 ################################################################################
   204 ################################################################################
   154 # Filter out aot specific modules if aot is disabled
   205 # Filter out aot specific modules if aot is disabled
   155 
   206 
   179 SRC_SUBDIRS += $(OPENJDK_TARGET_OS)/classes
   230 SRC_SUBDIRS += $(OPENJDK_TARGET_OS)/classes
   180 ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
   231 ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
   181   SRC_SUBDIRS += $(OPENJDK_TARGET_OS_TYPE)/classes
   232   SRC_SUBDIRS += $(OPENJDK_TARGET_OS_TYPE)/classes
   182 endif
   233 endif
   183 SRC_SUBDIRS += share/classes
   234 SRC_SUBDIRS += share/classes
       
   235 
       
   236 SPEC_SUBDIRS += share/specs
   184 
   237 
   185 # Find all module-info.java files for the current build target platform and
   238 # Find all module-info.java files for the current build target platform and
   186 # configuration.
   239 # configuration.
   187 # Param 1 - Module to find for, set to * for finding all
   240 # Param 1 - Module to find for, set to * for finding all
   188 FindAllModuleInfos = \
   241 FindAllModuleInfos = \
   232 FindModuleSrcDirs = \
   285 FindModuleSrcDirs = \
   233     $(strip $(wildcard \
   286     $(strip $(wildcard \
   234         $(addsuffix /$(strip $1), $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \
   287         $(addsuffix /$(strip $1), $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \
   235         $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS)))))
   288         $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS)))))
   236 
   289 
       
   290 # Find all specs dirs for a particular module
       
   291 # $1 - Module to find specs dirs for
       
   292 FindModuleSpecsDirs = \
       
   293     $(strip $(wildcard \
       
   294         $(foreach sub, $(SPEC_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS)))))
       
   295 
   237 # Construct the complete module source path
   296 # Construct the complete module source path
   238 GetModuleSrcPath = \
   297 GetModuleSrcPath = \
   239     $(call PathList, \
   298     $(call PathList, \
   240         $(addsuffix /*, $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \
   299         $(addsuffix /*, $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \
   241         $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /*/$(sub), $(TOP_SRC_DIRS))))
   300         $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /*/$(sub), $(TOP_SRC_DIRS))))
   242 
   301 
   243 ################################################################################
   302 ################################################################################
   244 # Extract module dependencies from module-info.java files.
   303 # Extract module dependencies from module-info.java files, both normal
       
   304 # dependencies ("requires"), and indirect exports ("requires transitive").
   245 
   305 
   246 MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
   306 MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
   247 
   307 
   248 MODULE_INFOS := $(call FindAllModuleInfos, *)
   308 MODULE_INFOS := $(call FindAllModuleInfos, *)
   249 
   309 
   253 	$(RM) $@
   313 	$(RM) $@
   254 	$(foreach m, $(MODULE_INFOS), \
   314 	$(foreach m, $(MODULE_INFOS), \
   255 	    ( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \
   315 	    ( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \
   256 	      $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
   316 	      $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
   257 	          BEGIN      { if (MODULE != "java.base") printf(" java.base"); } \
   317 	          BEGIN      { if (MODULE != "java.base") printf(" java.base"); } \
   258 	          /requires/ { sub(/;/, ""); \
   318 	          /^ *requires/ { sub(/;/, ""); \
   259 	                       sub(/requires/, ""); \
   319 	                          sub(/requires/, ""); \
   260 	                       sub(/transitive/, ""); \
   320 	                          sub(/transitive/, ""); \
   261 	                       sub(/\/\/.*/, ""); \
   321 	                          sub(/\/\/.*/, ""); \
   262 	                       sub(/\/\*.*\*\//, ""); \
   322 	                          sub(/\/\*.*\*\//, ""); \
   263 	                       gsub(/^ +\*.*/, ""); \
   323 	                          gsub(/^ +\*.*/, ""); \
   264 	                       gsub(/ /, ""); \
   324 	                          gsub(/ /, ""); \
   265 	                       printf(" %s", $$0) } \
   325 	                          printf(" %s", $$0) } \
   266 	          END        { printf("\n") }' $m \
   326 	          END           { printf("\n") }' $m && \
       
   327 	      $(PRINTF) "TRANSITIVE_MODULES_$(call GetModuleNameFromModuleInfo, $m) :=" && \
       
   328 	      $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
       
   329 	          BEGIN      { if (MODULE != "java.base") printf(" java.base"); } \
       
   330 	          /^ *requires  *transitive/ { \
       
   331 	                          sub(/;/, ""); \
       
   332 	                          sub(/requires/, ""); \
       
   333 	                          sub(/transitive/, ""); \
       
   334 	                          sub(/\/\/.*/, ""); \
       
   335 	                          sub(/\/\*.*\*\//, ""); \
       
   336 	                          gsub(/^ +\*.*/, ""); \
       
   337 	                          gsub(/ /, ""); \
       
   338 	                          printf(" %s", $$0) } \
       
   339 	          END           { printf("\n") }' $m \
   267 	    ) >> $@ $(NEWLINE))
   340 	    ) >> $@ $(NEWLINE))
   268 
   341 
   269 -include $(MODULE_DEPS_MAKEFILE)
   342 -include $(MODULE_DEPS_MAKEFILE)
   270 
   343 
   271 # Param 1: Module to find deps for
   344 # Find dependencies ("requires") for a given module.
       
   345 # Param 1: Module to find dependencies for.
   272 FindDepsForModule = \
   346 FindDepsForModule = \
   273   $(DEPS_$(strip $1))
   347   $(DEPS_$(strip $1))
   274 
   348 
   275 # Finds transitive dependencies in 3 levels.
   349 # Find dependencies ("requires") transitively in 3 levels for a given module.
   276 # Param 1: Module to find transitive deps for
   350 # Param 1: Module to find dependencies for.
   277 FindTransitiveDepsForModule = \
   351 FindTransitiveDepsForModule = \
   278     $(sort $(call FindDepsForModule, $1) \
   352     $(sort $(call FindDepsForModule, $1) \
   279         $(foreach m, $(call FindDepsForModule, $1), \
   353         $(foreach m, $(call FindDepsForModule, $1), \
   280             $(call FindDepsForModule, $m) \
   354             $(call FindDepsForModule, $m) \
   281             $(foreach n, $(call FindDepsForModule, $m), \
   355             $(foreach n, $(call FindDepsForModule, $m), \
   282                  $(call FindDepsForModule, $n))))
   356                  $(call FindDepsForModule, $n))))
   283 
   357 
       
   358 # Find dependencies ("requires") transitively in 3 levels for a set of modules.
       
   359 # Param 1: List of modules to find dependencies for.
       
   360 FindTransitiveDepsForModules = \
       
   361     $(sort $(foreach m, $1, $(call FindTransitiveDepsForModule, $m)))
       
   362 
       
   363 # Find indirect exported modules ("requires transitive") for a given module .
       
   364 # Param 1: Module to find indirect exported modules for.
       
   365 FindIndirectExportsForModule = \
       
   366   $(TRANSITIVE_MODULES_$(strip $1))
       
   367 
       
   368 # Finds indirect exported modules transitively in 3 levels for a given module.
       
   369 # Param 1: Module to find indirect exported modules for.
       
   370 FindTransitiveIndirectDepsForModule = \
       
   371     $(sort $(call FindIndirectExportsForModule, $1) \
       
   372         $(foreach m, $(call FindIndirectExportsForModule, $1), \
       
   373             $(call FindIndirectExportsForModule, $m) \
       
   374             $(foreach n, $(call FindIndirectExportsForModule, $m), \
       
   375                  $(call FindIndirectExportsForModule, $n))))
       
   376 
       
   377 # Finds indirect exported modules transitively in 3 levels for a set of modules.
       
   378 # Param 1: List of modules to find indirect exported modules for.
       
   379 FindTransitiveIndirectDepsForModules = \
       
   380     $(sort $(foreach m, $1, $(call FindTransitiveIndirectDepsForModule, $m)))
       
   381 
   284 # Upgradeable modules are those that are either defined as upgradeable or that
   382 # Upgradeable modules are those that are either defined as upgradeable or that
   285 # require an upradeable module.
   383 # require an upradeable module.
   286 FindAllUpgradeableModules = \
   384 FindAllUpgradeableModules = \
   287     $(filter-out $(MODULES_FILTER) $(NON_UPGRADEABLE_MODULES), \
   385     $(sort $(filter-out $(MODULES_FILTER), $(UPGRADEABLE_MODULES) $(UPGRADEABLE_TOOL_MODULES)))
   288         $(sort $(UPGRADEABLE_MODULES) $(foreach m, \
   386 
   289             $(filter-out $(UPGRADEABLE_MODULES), $(call FindAllModules)), \
       
   290           $(if $(filter $(UPGRADEABLE_MODULES), \
       
   291               $(call FindTransitiveDepsForModule, $m)), \
       
   292             $m \
       
   293           ) \
       
   294         )) \
       
   295     )
       
   296 
   387 
   297 ################################################################################
   388 ################################################################################
   298 
   389 
   299 LEGAL_SUBDIRS += $(OPENJDK_TARGET_OS)/legal
   390 LEGAL_SUBDIRS += $(OPENJDK_TARGET_OS)/legal
   300 ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
   391 ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
   327       ifeq ($$(classloader), boot)
   418       ifeq ($$(classloader), boot)
   328         BOOT_MODULES += $1
   419         BOOT_MODULES += $1
   329       else ifeq ($$(classloader), ext)
   420       else ifeq ($$(classloader), ext)
   330         PLATFORM_MODULES += $1
   421         PLATFORM_MODULES += $1
   331       endif
   422       endif
       
   423       ifneq ($$(include_in_docs), false)
       
   424         # defaults to true if unspecified
       
   425         DOCS_MODULES += $1
       
   426       endif
   332     else
   427     else
   333       # Default to include in all
   428       # Default to include in all
   334       JRE_MODULES += $1
   429       JRE_MODULES += $1
   335       JDK_MODULES += $1
   430       JDK_MODULES += $1
   336     endif
   431     endif