make/Javadoc.gmk

changeset 2556
76a0f827e163
parent 1859
8b0588603185
parent 2542
741aff26fe61
     1.1 --- a/make/Javadoc.gmk	Sat Oct 24 16:18:46 2020 +0800
     1.2 +++ b/make/Javadoc.gmk	Sat Oct 24 16:42:47 2020 +0800
     1.3 @@ -221,6 +221,11 @@
     1.4  JRE_API_DOCSDIR = $(DOCSDIR)/jre/api
     1.5  PLATFORM_DOCSDIR = $(DOCSDIR)/platform
     1.6  
     1.7 +JAVADOC_ARCHIVE_NAME := jdk-$(FULL_VERSION)-docs.zip
     1.8 +JAVADOC_ARCHIVE_ASSEMBLY_DIR :=  $(DOCSTMPDIR)/docs-zip
     1.9 +JAVADOC_ARCHIVE_DIR := $(OUTPUT_ROOT)/bundles
    1.10 +JAVADOC_ARCHIVE := $(JAVADOC_ARCHIVE_DIR)/$(JAVADOC_ARCHIVE_NAME)
    1.11 +
    1.12  # The non-core api javadocs need to be able to access the root of the core
    1.13  # api directory, so for jdk/api or jre/api to get to the core api/
    1.14  # directory we would use this:
    1.15 @@ -329,6 +334,37 @@
    1.16  all: docs
    1.17  docs: coredocs otherdocs
    1.18  
    1.19 +#
    1.20 +# Optional target which bundles all generated javadocs into a zip 
    1.21 +# archive. The dependency on docs is handled in Main.gmk. Incremental 
    1.22 +# building of docs is currently broken so if you invoke docs-zip after 
    1.23 +# docs, the docs are always rebuilt.
    1.24 +#
    1.25 +
    1.26 +docs-zip: $(JAVADOC_ARCHIVE)
    1.27 +
    1.28 +#
    1.29 +# Add the core docs as prerequisite to the archive to trigger a rebuild
    1.30 +# if the core docs were rebuilt. Ideally any doc rebuild should trigger
    1.31 +# this, but the way prerequisites are currently setup in this file, that
    1.32 +# is hard to achieve.
    1.33 +#
    1.34 +
    1.35 +$(JAVADOC_ARCHIVE): $(COREAPI_INDEX_FILE)
    1.36 +	@$(ECHO) $(LOG_INFO) "Compressing javadoc to single $(JAVADOC_ARCHIVE_NAME)"
    1.37 +	$(MKDIR) -p $(JAVADOC_ARCHIVE_DIR)
    1.38 +	$(RM) -r $(JAVADOC_ARCHIVE_ASSEMBLY_DIR)
    1.39 +	$(MKDIR) -p $(JAVADOC_ARCHIVE_ASSEMBLY_DIR)
    1.40 +	all_roots=`$(FIND) $(DOCSDIR) | $(GREP) index.html | grep -v old/doclet `; \
    1.41 +	pushd $(JAVADOC_ARCHIVE_ASSEMBLY_DIR); \
    1.42 +	for index_file in $${all_roots} ; do \
    1.43 +	  target_dir=`dirname $${index_file}`; \
    1.44 +	  name=`$(ECHO) $${target_dir} | $(SED) "s;/spec;;" | $(SED) "s;.*/;;"`; \
    1.45 +	  $(LN) -s $${target_dir}  $${name}; \
    1.46 +	done; \
    1.47 +	$(ZIP) -q -r $(JAVADOC_ARCHIVE) * ; \
    1.48 +	popd ;
    1.49 +
    1.50  #################################################################
    1.51  # Production Targets -- USE THESE TARGETS WHEN:
    1.52  # a) You're generating docs outside of release engineering's
    1.53 @@ -1372,4 +1408,4 @@
    1.54  
    1.55  #############################################################
    1.56  .PHONY: all docs coredocs rel-docs otherdocs rel-coredocs \
    1.57 -    sanitycheckcoredocs $(ALL_OTHER_TARGETS)
    1.58 +    sanitycheckcoredocs $(ALL_OTHER_TARGETS) docs-zip

mercurial