Blame SOURCES/jdk8154313-generated_javadoc_scattered_all_over_the_place.patch

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