Blame SOURCES/jdk8154313-generated_javadoc_scattered_all_over_the_place.patch

03c558
--- jdk8/make/Javadoc.gmk	2016-04-01 16:53:41.069477682 +0200
03c558
+++ jdk8/make/Javadoc.gmk	2016-04-01 16:53:41.014477059 +0200
03c558
@@ -220,6 +220,12 @@
03c558
 JRE_API_DOCSDIR = $(DOCSDIR)/jre/api
03c558
 PLATFORM_DOCSDIR = $(DOCSDIR)/platform
03c558
 
03c558
+
03c558
+JAVADOC_ARCHIVE_NAME := jdk-$(FULL_VERSION)-docs.zip
03c558
+JAVADOC_ARCHIVE_ASSEMBLY_DIR :=  $(DOCSTMPDIR)/zip-docs
03c558
+JAVADOC_ARCHIVE_DIR := $(OUTPUT_ROOT)/bundles
03c558
+JAVADOC_ARCHIVE := $(JAVADOC_ARCHIVE_DIR)/$(JAVADOC_ARCHIVE_NAME)
03c558
+
03c558
 # The non-core api javadocs need to be able to access the root of the core
03c558
 # api directory, so for jdk/api or jre/api to get to the core api/
03c558
 # directory we would use this:
03c558
@@ -319,6 +325,37 @@
03c558
 all: docs
03c558
 docs: coredocs otherdocs
03c558
 
03c558
+#
03c558
+# Optional target which bundles all generated javadocs into a zip 
03c558
+# archive. The dependency on docs is handled in Main.gmk. Incremental 
03c558
+# building of docs is currently broken so if you invoke zip-docs after 
03c558
+# docs, the docs are always rebuilt.
03c558
+#
03c558
+
03c558
+zip-docs: $(JAVADOC_ARCHIVE)
03c558
+
03c558
+#
03c558
+# Add the core docs as prerequisite to the archive to trigger a rebuild
03c558
+# if the core docs were rebuilt. Ideally any doc rebuild should trigger
03c558
+# this, but the way prerequisites are currently setup in this file, that
03c558
+# is hard to achieve.
03c558
+#
03c558
+
03c558
+$(JAVADOC_ARCHIVE): $(COREAPI_INDEX_FILE)
03c558
+	@$(ECHO) "Compressing javadoc to single $(JAVADOC_ARCHIVE_NAME)" ; 
03c558
+	$(MKDIR) -p $(JAVADOC_ARCHIVE_DIR) ;
03c558
+	$(RM) -r $(JAVADOC_ARCHIVE_ASSEMBLY_DIR) ;
03c558
+	$(MKDIR) -p $(JAVADOC_ARCHIVE_ASSEMBLY_DIR);
03c558
+	all_roots=`$(FIND) $(DOCSDIR) | $(GREP) index.html `; \
03c558
+	pushd $(JAVADOC_ARCHIVE_ASSEMBLY_DIR); \
03c558
+	for index_file in $${all_roots} ; do \
03c558
+	  target_dir=`dirname $${index_file}`; \
03c558
+	  name=`$(ECHO) $${target_dir} | $(SED) "s;/spec;;" | $(SED) "s;.*/;;"`; \
03c558
+	  $(LN) -s $${target_dir}  $${name}; \
03c558
+	done; \
03c558
+	$(ZIP) -q -r $(JAVADOC_ARCHIVE) * ; \
03c558
+	popd ;
03c558
+
03c558
 #################################################################
03c558
 # Production Targets -- USE THESE TARGETS WHEN:
03c558
 # a) You're generating docs outside of release engineering's
03c558
--- jdk8/make/Main.gmk	2016-04-01 16:53:41.311480424 +0200
03c558
+++ jdk8/make/Main.gmk	2016-04-01 16:53:41.266479914 +0200
03c558
@@ -165,6 +165,12 @@
03c558
 	@($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
03c558
 	@$(call TargetExit)
03c558
 
03c558
+zip-docs: docs zip-docs-only
03c558
+zip-docs-only: start-make
03c558
+	@$(call TargetEnter)
03c558
+	@($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk zip-docs)
03c558
+	@$(call TargetExit)
03c558
+
03c558
 sign-jars: jdk sign-jars-only
03c558
 sign-jars-only: start-make
03c558
 	@$(call TargetEnter)