changeset 2597:d273234a040d

8180480: Use "requires transitive" relationship when determining modules for javadoc Reviewed-by: mchung, erikj
author ihse
date Mon, 22 May 2017 09:47:31 +0200
parents 440c40aa07c7
children 4c12464a907d
files make/Docs.gmk make/common/Modules.gmk
diffstat 2 files changed, 46 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/make/Docs.gmk	Fri May 19 15:27:25 2017 +0530
+++ b/make/Docs.gmk	Mon May 22 09:47:31 2017 +0200
@@ -55,7 +55,6 @@
 LICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java9speclicense.html
 REDISTRIBUTION_URL := http://www.oracle.com/technetwork/java/redist-137594.html
 
-
 # In order to get a specific ordering it's necessary to specify the total
 # ordering of tags as the tags are otherwise ordered in order of definition.
 JAVADOC_TAGS := \
@@ -211,10 +210,10 @@
 SetupApiDocsGeneration = $(NamedParamsMacroTemplate)
 define SetupApiDocsGenerationBody
 
-  # Figure out all modules, both specified and transitive, that will be processed
-  # by javadoc.
-  $1_TRANSITIVE_MODULES := $$(call FindTransitiveDepsForModules, $$($1_MODULES))
-  $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_TRANSITIVE_MODULES))
+  # Figure out all modules, both specified and transitive indirect exports, that
+  # will be processed by javadoc.
+  $1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES))
+  $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS))
 
   ifeq ($$(ENABLE_FULL_DOCS), true)
     # Tell the ModuleGraph taglet to generate html links to soon-to-be-created
@@ -334,7 +333,8 @@
 ################################################################################
 # Setup generation of the Java SE API documentation (javadoc + modulegraph)
 
-# The Java SE module scope is just java.se.ee and it's transitive modules.
+# The Java SE module scope is just java.se.ee and it's transitive indirect
+# exports.
 JAVASE_JAVADOC_MODULES := java.se.ee
 
 JAVASE_JAVADOC_OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html
--- a/make/common/Modules.gmk	Fri May 19 15:27:25 2017 +0530
+++ b/make/common/Modules.gmk	Mon May 22 09:47:31 2017 +0200
@@ -299,7 +299,8 @@
         $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /*/$(sub), $(TOP_SRC_DIRS))))
 
 ################################################################################
-# Extract module dependencies from module-info.java files.
+# Extract module dependencies from module-info.java files, both normal
+# dependencies ("requires"), and indirect exports ("requires transitive").
 
 MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
 
@@ -321,17 +322,31 @@
 	                          gsub(/^ +\*.*/, ""); \
 	                          gsub(/ /, ""); \
 	                          printf(" %s", $$0) } \
+	          END           { printf("\n") }' $m && \
+	      $(PRINTF) "TRANSITIVE_MODULES_$(call GetModuleNameFromModuleInfo, $m) :=" && \
+	      $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
+	          BEGIN      { if (MODULE != "java.base") printf(" java.base"); } \
+	          /^ *requires  *transitive/ { \
+	                          sub(/;/, ""); \
+	                          sub(/requires/, ""); \
+	                          sub(/transitive/, ""); \
+	                          sub(/\/\/.*/, ""); \
+	                          sub(/\/\*.*\*\//, ""); \
+	                          gsub(/^ +\*.*/, ""); \
+	                          gsub(/ /, ""); \
+	                          printf(" %s", $$0) } \
 	          END           { printf("\n") }' $m \
 	    ) >> $@ $(NEWLINE))
 
 -include $(MODULE_DEPS_MAKEFILE)
 
-# Param 1: Module to find deps for
+# Find dependencies ("requires") for a given module.
+# Param 1: Module to find dependencies for.
 FindDepsForModule = \
   $(DEPS_$(strip $1))
 
-# Finds transitive dependencies in 3 levels.
-# Param 1: Module to find transitive deps for
+# Find dependencies ("requires") transitively in 3 levels for a given module.
+# Param 1: Module to find dependencies for.
 FindTransitiveDepsForModule = \
     $(sort $(call FindDepsForModule, $1) \
         $(foreach m, $(call FindDepsForModule, $1), \
@@ -339,11 +354,30 @@
             $(foreach n, $(call FindDepsForModule, $m), \
                  $(call FindDepsForModule, $n))))
 
-# Finds transitive dependencies in 3 levels for a set of modules.
-# Param 1: List of modules to find transitive deps for
+# Find dependencies ("requires") transitively in 3 levels for a set of modules.
+# Param 1: List of modules to find dependencies for.
 FindTransitiveDepsForModules = \
     $(sort $(foreach m, $1, $(call FindTransitiveDepsForModule, $m)))
 
+# Find indirect exported modules ("requires transitive") for a given module .
+# Param 1: Module to find indirect exported modules for.
+FindIndirectExportsForModule = \
+  $(TRANSITIVE_MODULES_$(strip $1))
+
+# Finds indirect exported modules transitively in 3 levels for a given module.
+# Param 1: Module to find indirect exported modules for.
+FindTransitiveIndirectDepsForModule = \
+    $(sort $(call FindIndirectExportsForModule, $1) \
+        $(foreach m, $(call FindIndirectExportsForModule, $1), \
+            $(call FindIndirectExportsForModule, $m) \
+            $(foreach n, $(call FindIndirectExportsForModule, $m), \
+                 $(call FindIndirectExportsForModule, $n))))
+
+# Finds indirect exported modules transitively in 3 levels for a set of modules.
+# Param 1: List of modules to find indirect exported modules for.
+FindTransitiveIndirectDepsForModules = \
+    $(sort $(foreach m, $1, $(call FindTransitiveIndirectDepsForModule, $m)))
+
 # Upgradeable modules are those that are either defined as upgradeable or that
 # require an upradeable module.
 FindAllUpgradeableModules = \