Blame SOURCES/jdk8154313-generated_javadoc_scattered_all_over_the_place.patch

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