8154313: Generated javadoc scattered all over the place

Added new top level target zip-docs which scans all generated javadocs and prepare zip-archive in way understandable to most IDEs

Reviewed-by: erikj
This commit is contained in:
Jiri Vanek 2016-04-15 14:57:53 +02:00 committed by Mario Torre
parent 77c73b083c
commit caf4001a70
3 changed files with 41 additions and 3 deletions

View File

@ -235,6 +235,11 @@ JDK_API_DOCSDIR = $(DOCSDIR)/jdk/api
JRE_API_DOCSDIR = $(DOCSDIR)/jre/api
PLATFORM_DOCSDIR = $(DOCSDIR)/platform
JAVADOC_ARCHIVE_NAME := jdk-$(VERSION_STRING)-docs.zip
JAVADOC_ARCHIVE_ASSEMBLY_DIR := $(DOCSTMPDIR)/zip-docs
JAVADOC_ARCHIVE_DIR := $(OUTPUT_ROOT)/bundles
JAVADOC_ARCHIVE := $(JAVADOC_ARCHIVE_DIR)/$(JAVADOC_ARCHIVE_NAME)
# The core api index file is the target for the core api javadocs rule
# and needs to be defined early so that all other javadoc rules may
# depend on it.
@ -378,6 +383,13 @@ $(eval $(call IncludeCustomExtension, , Javadoc.gmk))
all: docs
docs: coredocs otherdocs
#
# Optional target which bundles all generated javadocs into a zip archive.
# The dependency on docs is handled in Main.gmk.
#
zip-docs: $(JAVADOC_ARCHIVE)
#############################################################
#
# coredocs
@ -1671,6 +1683,28 @@ $(JLINK_PLUGIN_PACKAGES_FILE): $(call PackageDependencies,$(JLINK_PLUGIN_PKGS))
otherdocs: $(ALL_OTHER_TARGETS)
#
# Add the core docs as prerequisite to the archive to trigger a rebuild
# if the core docs were rebuilt. Ideally any doc rebuild should trigger
# this, but the way prerequisites are currently setup in this file, that
# is hard to achieve.
#
$(JAVADOC_ARCHIVE): $(COREAPI_INDEX_FILE)
$(call LogInfo, Compressing javadoc to single $(JAVADOC_ARCHIVE_NAME))
$(MKDIR) -p $(JAVADOC_ARCHIVE_DIR)
$(RM) -r $(JAVADOC_ARCHIVE_ASSEMBLY_DIR)
$(MKDIR) -p $(JAVADOC_ARCHIVE_ASSEMBLY_DIR)
all_roots=`$(FIND) $(DOCSDIR) | $(GREP) index.html | grep -v old/doclet`; \
pushd $(JAVADOC_ARCHIVE_ASSEMBLY_DIR); \
for index_file in $${all_roots} ; do \
target_dir=`dirname $${index_file}`; \
name=`$(ECHO) $${target_dir} | $(SED) "s;/spec;;" | $(SED) "s;.*/;;"`; \
$(LN) -s $${target_dir} $${name}; \
done; \
$(ZIP) -q -r $(JAVADOC_ARCHIVE) * ; \
popd ;
#############################################################
.PHONY: all docs coredocs otherdocs \
$(ALL_OTHER_TARGETS)
$(ALL_OTHER_TARGETS) zip-docs

View File

@ -333,6 +333,9 @@ docs-javadoc:
docs-jvmtidoc:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)
zip-docs: docs-javadoc docs-jvmtidoc
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk zip-docs)
ALL_TARGETS += docs-javadoc docs-jvmtidoc
################################################################################
@ -689,7 +692,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
endif
# This target builds the documentation image
docs-image: docs-javadoc docs-jvmtidoc
docs-image: zip-docs
# This target builds the test image
test-image: prepare-test-image test-image-hotspot-jtreg-native \
@ -713,7 +716,7 @@ images: product-images
docs: docs-image
all: all-images
ALL_TARGETS += default jdk images docs all
ALL_TARGETS += default jdk images docs all zip-docs
################################################################################
################################################################################

View File

@ -104,6 +104,7 @@ define Clean-docs
@$(PRINTF) "\n" $(LOG_DEBUG)
$(RM) -r $(SUPPORT_OUTPUTDIR)/docs
$(RM) -r $(IMAGES_OUTPUTDIR)/docs
$(RM) $(OUTPUT_ROOT)/bundles/jdk-*-docs.zip
@$(PRINTF) " done\n"
endef