changeset 2483:741aff26fe61

8154313: Generated javadoc scattered all over the place Summary: Added new top level target zip-docs which scans all generated javadocs and prepare zip-archive in way understandable to most IDEs Reviewed-by: sgehwolf, andrew
author jvanek
date Thu, 06 Aug 2020 06:35:39 +0100
parents 834c6a13c8c8
children 1059e4b7426a
files make/Javadoc.gmk make/Main.gmk
diffstat 2 files changed, 48 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/make/Javadoc.gmk	Wed Jul 29 09:43:12 2020 +0200
+++ b/make/Javadoc.gmk	Thu Aug 06 06:35:39 2020 +0100
@@ -221,6 +221,11 @@
 JRE_API_DOCSDIR = $(DOCSDIR)/jre/api
 PLATFORM_DOCSDIR = $(DOCSDIR)/platform
 
+JAVADOC_ARCHIVE_NAME := jdk-$(FULL_VERSION)-docs.zip
+JAVADOC_ARCHIVE_ASSEMBLY_DIR :=  $(DOCSTMPDIR)/docs-zip
+JAVADOC_ARCHIVE_DIR := $(OUTPUT_ROOT)/bundles
+JAVADOC_ARCHIVE := $(JAVADOC_ARCHIVE_DIR)/$(JAVADOC_ARCHIVE_NAME)
+
 # The non-core api javadocs need to be able to access the root of the core
 # api directory, so for jdk/api or jre/api to get to the core api/
 # directory we would use this:
@@ -329,6 +334,37 @@
 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. Incremental 
+# building of docs is currently broken so if you invoke docs-zip after 
+# docs, the docs are always rebuilt.
+#
+
+docs-zip: $(JAVADOC_ARCHIVE)
+
+#
+# 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)
+	@$(ECHO) $(LOG_INFO) "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 ;
+
 #################################################################
 # Production Targets -- USE THESE TARGETS WHEN:
 # a) You're generating docs outside of release engineering's
@@ -1372,4 +1408,4 @@
 
 #############################################################
 .PHONY: all docs coredocs rel-docs otherdocs rel-coredocs \
-    sanitycheckcoredocs $(ALL_OTHER_TARGETS)
+    sanitycheckcoredocs $(ALL_OTHER_TARGETS) docs-zip
--- a/make/Main.gmk	Wed Jul 29 09:43:12 2020 +0200
+++ b/make/Main.gmk	Thu Aug 06 06:35:39 2020 +0100
@@ -161,6 +161,12 @@
 	@($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
 	@$(call TargetExit)
 
+docs-zip: docs docs-zip-only
+docs-zip-only: start-make
+	@$(call TargetEnter)
+	@($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-zip)
+	@$(call TargetExit)
+
 sign-jars: jdk sign-jars-only
 sign-jars-only: start-make
 	@$(call TargetEnter)
@@ -235,6 +241,8 @@
 clean-docs:
 	$(call CleanComponent,docs)
 	$(call CleanComponent,docstemp)
+clean-docs-zip:
+	$(call CleanComponent,bundles/jdk-*-docs.zip)
 clean-test:
 	$(call CleanComponent,testoutput)
 	
@@ -246,10 +254,10 @@
         endif
 	@( cd $(OUTPUT_ROOT) && $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
 
-.PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install test docs
-.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only nashorn-only images-only overlay-images-only install-only test-only docs-only
+.PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install test docs docs-zip
+.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only nashorn-only images-only overlay-images-only install-only test-only docs-only docs-zip-only
 .PHONY: default all clean dist-clean bootcycle-images start-make
-.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-docs clean-test clean-overlay-images clean-bootcycle-build
+.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-docs clean-docs-zip clean-test clean-overlay-images clean-bootcycle-build
 .PHONY: profiles profiles-only
 
 include $(root_dir)/make/Jprt.gmk