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