Blame SOURCES/jdk8154313-generated_javadoc_scattered_all_over_the_place.patch

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