8180480: Use "requires transitive" relationship when determining modules for javadoc

Reviewed-by: mchung, erikj
This commit is contained in:
Magnus Ihse Bursie 2017-05-22 09:47:31 +02:00
parent 8ff6b30d28
commit 1d389cce1c
2 changed files with 46 additions and 12 deletions

View File

@ -55,7 +55,6 @@ COPYRIGHT_URL := {@docroot}/../legal/cpyr.html
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 @@ endef
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 @@ $(eval $(call SetupApiDocsGeneration, JDK_API, \
################################################################################
# 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

View File

@ -299,7 +299,8 @@ GetModuleSrcPath = \
$(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 @@ $(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
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 @@ FindTransitiveDepsForModule = \
$(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 = \