8003844: build-infra: docs target isn't working properly
authorerikj
Wed, 28 Nov 2012 13:40:17 +0100
changeset 14466 2f85b948660b
parent 14465 d529faf5e36a
child 14467 a973c0a1bd5d
8003844: build-infra: docs target isn't working properly Summary: Fixed docs and docs-clean target. Added compare support for docs. Reviewed-by: ohair, jjg, ohrstrom
common/bin/compare.sh
common/makefiles/Main.gmk
common/makefiles/javadoc/Javadoc.gmk
--- a/common/bin/compare.sh	Wed Nov 28 13:15:56 2012 +0100
+++ b/common/bin/compare.sh	Wed Nov 28 13:40:17 2012 +0100
@@ -290,6 +290,7 @@
     for f in $GENERAL_FILES
     do
         if [ -e $OTHER_DIR/$f ]; then
+            SUFFIX="${f##*.}"
             if [ "$(basename $f)" = "release" ]; then
                 # Ignore differences in change numbers in release file.
                 OTHER_FILE=$WORK_DIR/$f.other
@@ -298,6 +299,22 @@
                 $MKDIR -p $(dirname $THIS_FILE)
                 $CAT $OTHER_DIR/$f | $SED 's/\:[0-9a-f]\{12,12\}/:CHANGE/g' > $OTHER_FILE
                 $CAT $THIS_DIR/$f  | $SED 's/\:[0-9a-f]\{12,12\}/:CHANGE/g' > $THIS_FILE
+            elif [ "x$SUFFIX" = "xhtml" ]; then
+                # Ignore time stamps in docs files
+                OTHER_FILE=$WORK_DIR/$f.other
+                THIS_FILE=$WORK_DIR/$f.this
+                $MKDIR -p $(dirname $OTHER_FILE)
+                $MKDIR -p $(dirname $THIS_FILE)
+                $CAT $OTHER_DIR/$f | $SED -e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \
+                                          -e 's/\(<meta name="date" content="\).*\(">\)/\1(removed)\2/' \
+                                          -e 's/\(Monday\|Tuesday\|Wednesday\|Thursday\|Friday\|Saturday\|Sunday\), [A-Z][a-z]* [0-9][0-9]*, [12][0-9]* [0-9][0-9:]* \(AM\|PM\) [A-Z][A-Z]*/(removed)/' \
+                                          -e 's/^\( from \).*\(\.idl\)$/\1(removed)\2/' \
+                    > $OTHER_FILE
+                $CAT $THIS_DIR/$f  | $SED -e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \
+                                          -e 's/\(<meta name="date" content="\).*\(">\)/\1(removed)\2/' \
+                                          -e 's/\(Monday\|Tuesday\|Wednesday\|Thursday\|Friday\|Saturday\|Sunday\), [A-Z][a-z]* [0-9][0-9]*, [12][0-9]* [0-9][0-9:]* \(AM\|PM\) [A-Z][A-Z]*/(removed)/' \
+                                          -e 's/^\( from \).*\(\.idl\)$/\1(removed)\2/' \
+                    > $THIS_FILE
             else
                 OTHER_FILE=$OTHER_DIR/$f
                 THIS_FILE=$THIS_DIR/$f
@@ -1111,6 +1128,22 @@
     echo "Skipping bundle compare!"
 fi
 
+if [ -d "$THIS/docs" ]; then
+    THIS_DOCS="$THIS/docs"
+fi
+
+if [ -d "$OTHER/docs" ]; then
+    OTHER_DOCS="$OTHER/docs"
+fi
+
+if [ -z "$THIS_DOCS" ]; then
+    echo "WARNING! Docs haven't been built and won't be compared."
+fi
+
+if [ -z "$OTHER_DOCS" ]; then
+    echo "WARNING! Other build doesn't contain docs, skipping doc compare."
+fi
+
 ##########################################################################################
 # Do the work
 
@@ -1148,6 +1181,12 @@
         echo -n "J2RE  Bundle "
         compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
     fi
+    if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
+        echo -n "Docs "
+        compare_dirs $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
+        echo -n "Docs "
+        compare_files $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
+    fi
 fi
 
 if [ "$CMP_PERMS" = "true" ]; then
@@ -1211,6 +1250,10 @@
         echo -n "J2RE  Bundle "
         compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
     fi
+    if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
+        echo -n "Docs "
+        compare_general_files $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
+    fi
 fi
 
 if [ "$CMP_ZIPS" = "true" ]; then
--- a/common/makefiles/Main.gmk	Wed Nov 28 13:15:56 2012 +0100
+++ b/common/makefiles/Main.gmk	Wed Nov 28 13:40:17 2012 +0100
@@ -165,7 +165,7 @@
 
 
 # Remove everything, except the output from configure.
-clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build
+clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build clean-docs
 	@($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
 	@$(ECHO) Cleaned all build artifacts.
 
@@ -201,6 +201,9 @@
 	$(call CleanComponent,overlay-images)
 clean-bootcycle-build:
 	$(call CleanComponent,bootcycle-build)
+clean-docs:
+	$(call CleanComponent,docs)
+	$(call CleanComponent,docstemp)
 
 .PHONY: langtools corba jaxp jaxws hotspot jdk images overlay-images install
 .PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only
--- a/common/makefiles/javadoc/Javadoc.gmk	Wed Nov 28 13:15:56 2012 +0100
+++ b/common/makefiles/javadoc/Javadoc.gmk	Wed Nov 28 13:40:17 2012 +0100
@@ -50,17 +50,12 @@
 
 BOOT_JAVA_CMD=$(JAVA)
 
-# Langtools
-JAVAC_JAR   = $(LANGTOOLS_DIST)/bootstrap/lib/javac.jar
 JAVADOC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javadoc.jar
-DOCLETS_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/doclets.jar
 JAVADOC_CMD = $(BOOT_JAVA_CMD) \
               -Xmx1024m \
 	      -Djava.awt.headless=true \
-              "-Xbootclasspath/p:$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)$(CLASSPATH_SEPARATOR)$(DOCLETS_JAR)" \
-              -jar $(JAVADOC_JAR)
-
-JAVADOC_CMD = javadoc 
+              "-Xbootclasspath/p:$(JAVADOC_JAR)" \
+              -jar $(JAVADOC_JAR) -bootclasspath $(JDK_OUTPUTDIR)/classes
 
 # Copyright year for beginning of Java and some of the apis
 #   (Needed when creating the javadocs)
@@ -113,7 +108,8 @@
 
 # Url to copyright html file
 COPYRIGHT_URL-7 = $(DOCSDIR_URL)/legal/cpyr.html
-COPYRIGHT_URL-8 = $(DOCSDIR_URL)/legal/cpyr.html
+# This isn't added in old build yet.
+#COPYRIGHT_URL-8 = $(DOCSDIR_URL)/legal/cpyr.html
 COPYRIGHT_URL = $(COPYRIGHT_URL-$(JDK_MINOR_VERSION))
 
 # Url to bug filing site
@@ -125,7 +121,8 @@
 # Url to devdocs page
 #   Was: http://java.sun.com/javase/6/webnotes/devdocs-vs-specs.html
 DEV_DOCS_URL-7 = http://download.oracle.com/javase/7/docs/index.html
-DEV_DOCS_URL-8 = http://download.oracle.com/javase/7/docs/index.html
+# This isn't added in old build yet.
+#DEV_DOCS_URL-8 = http://download.oracle.com/javase/7/docs/index.html
 DEV_DOCS_URL = $(DEV_DOCS_URL-$(JDK_MINOR_VERSION))
 DOCS_BASE_URL = http://download.oracle.com/javase/7/docs
 
@@ -142,9 +139,10 @@
 #          Otherwise, you get "No packages or classes specified." due 
 #          to $(CLASSPATH_SEPARATOR) being interpreted as an end of 
 #          command (newline or shell ; character)
-ALL_SOURCE_DIRS = $(JDK_IMPSRC) \
+ALL_SOURCE_DIRS = $(JDK_SHARE_CLASSES) \
+                  $(JDK_IMPSRC) \
                   $(JDK_GENSRC) \
-                  $(JDK_SHARE_CLASSES) \
+		  $(JDK_OUTPUTDIR)/gendocsrc_rmic \
                   $(JDK_TOPDIR)/src/solaris/classes \
                   $(JDK_TOPDIR)/src/windows/classes \
 		  $(JDK_SHARE_SRC)/doc/stub
@@ -440,7 +438,7 @@
 $(DOCLETAPI_INDEX_FILE): GET2DOCSDIR=$(DOCLETAPI2COREAPI)/..
 
 # Run javadoc if the index file is out of date or missing
-$(DOCLETAPI_INDEX_FILE): $(DOCLETAPI_OPTIONS_FILE) $(DOCLETAPI_PACKAGES_FILE)
+$(DOCLETAPI_INDEX_FILE): $(DOCLETAPI_OPTIONS_FILE) $(DOCLETAPI_PACKAGES_FILE) coredocs
 	$(prep-javadoc)
 	$(call JavadocSummary,$(DOCLETAPI_OPTIONS_FILE),$(DOCLETAPI_PACKAGES_FILE))
 	$(JAVADOC_CMD) -d $(@D) \
@@ -481,7 +479,7 @@
 TAGLETAPI_TEMPDIR       = $(DOCSTMPDIR)/taglets_temp
 
 # The index.html, options, and packages files
-TAGLETAPI_INDEX_FILE    = $(TAGLETAPI_DOCDIR)/com/sun/tools/doclets/Taglet.html
+TAGLETAPI_INDEX_FILE    = $(TAGLETAPI_DOCDIR)/index.html
 TAGLETAPI_OPTIONS_FILE  = $(DOCSTMPDIR)/tagletapi.options
 TAGLETAPI_PACKAGES_FILE = $(DOCSTMPDIR)/tagletapi.packages
 
@@ -491,7 +489,7 @@
 $(TAGLETAPI_INDEX_FILE): GET2DOCSDIR=$(TAGLETAPI2COREAPI)/..
 
 # Run javadoc if the index file is out of date or missing
-$(TAGLETAPI_INDEX_FILE): $(TAGLETAPI_OPTIONS_FILE) $(TAGLETAPI_PACKAGES_FILE)
+$(TAGLETAPI_INDEX_FILE): $(TAGLETAPI_OPTIONS_FILE) $(TAGLETAPI_PACKAGES_FILE) coredocs
 	$(prep-javadoc)
 	$(RM) -r $(TAGLETAPI_TEMPDIR)
 	$(MKDIR) -p $(TAGLETAPI_TEMPDIR)
@@ -517,9 +515,7 @@
 # Create a file with the package names in it
 $(TAGLETAPI_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(TAGLETAPI_PKGS))
 	$(prep-target)
-	$(call PackageFilter,$(TAGLETAPI_PKGS))
-	$(GREP) "$(TAGLETAPI_FILE)" $@ > $@.tmp
-	$(MV) $@.tmp $@
+	@($(ECHO) "$(JDK_IMPSRC)/$(TAGLETAPI_FILE)" ) > $@
 
 #############################################################
 #
@@ -549,7 +545,7 @@
 $(DOMAPI_INDEX_FILE): GET2DOCSDIR=$(DOMAPI2COREAPI)/..
 
 # Run javadoc if the index file is out of date or missing
-$(DOMAPI_INDEX_FILE): $(DOMAPI_OPTIONS_FILE) $(DOMAPI_PACKAGES_FILE)
+$(DOMAPI_INDEX_FILE): $(DOMAPI_OPTIONS_FILE) $(DOMAPI_PACKAGES_FILE) coredocs
 	$(prep-javadoc)
 	$(call JavadocSummary,$(DOMAPI_OPTIONS_FILE),$(DOMAPI_PACKAGES_FILE))
 	$(JAVADOC_CMD) -d $(@D) \
@@ -611,7 +607,7 @@
 $(JDI_INDEX_FILE): GET2DOCSDIR=$(JDI2COREAPI)/..
 
 # Run javadoc if the index file is out of date or missing
-$(JDI_INDEX_FILE): $(JDI_OPTIONS_FILE) $(JDI_PACKAGES_FILE)
+$(JDI_INDEX_FILE): $(JDI_OPTIONS_FILE) $(JDI_PACKAGES_FILE) coredocs
 	$(prep-javadoc)
 	$(call JavadocSummary,$(JDI_OPTIONS_FILE),$(JDI_PACKAGES_FILE))
 	$(JAVADOC_CMD) -d $(@D) \
@@ -698,7 +694,7 @@
 $(JAAS_INDEX_FILE): GET2DOCSDIR=$(JAAS2COREAPI)/..
 
 # Run javadoc if the index file is out of date or missing
-$(JAAS_INDEX_FILE): $(JAAS_OPTIONS_FILE) $(JAAS_PACKAGES_FILE)
+$(JAAS_INDEX_FILE): $(JAAS_OPTIONS_FILE) $(JAAS_PACKAGES_FILE) coredocs
 	$(prep-javadoc)
 	$(call JavadocSummary,$(JAAS_OPTIONS_FILE),$(JAAS_PACKAGES_FILE))
 	$(JAVADOC_CMD) -d $(@D) \
@@ -750,7 +746,7 @@
 $(JGSS_INDEX_FILE): GET2DOCSDIR=$(JGSS2COREAPI)/..
 
 # Run javadoc if the index file is out of date or missing
-$(JGSS_INDEX_FILE): $(JGSS_OPTIONS_FILE) $(JGSS_PACKAGES_FILE)
+$(JGSS_INDEX_FILE): $(JGSS_OPTIONS_FILE) $(JGSS_PACKAGES_FILE) coredocs
 	$(prep-javadoc)
 	$(call JavadocSummary,$(JGSS_OPTIONS_FILE),$(JGSS_PACKAGES_FILE))
 	$(JAVADOC_CMD) -d $(@D) \
@@ -802,7 +798,7 @@
 $(SMARTCARDIO_INDEX_FILE): GET2DOCSDIR=$(SMARTCARDIO2COREAPI)/..
 
 # Run javadoc if the index file is out of date or missing
-$(SMARTCARDIO_INDEX_FILE): $(SMARTCARDIO_OPTIONS_FILE) $(SMARTCARDIO_PACKAGES_FILE)
+$(SMARTCARDIO_INDEX_FILE): $(SMARTCARDIO_OPTIONS_FILE) $(SMARTCARDIO_PACKAGES_FILE) coredocs
 	$(prep-javadoc)
 	$(call JavadocSummary,$(SMARTCARDIO_OPTIONS_FILE),$(SMARTCARDIO_PACKAGES_FILE))
 	$(JAVADOC_CMD) -d $(@D) \
@@ -852,7 +848,7 @@
 $(HTTPSERVER_INDEX_HTML): GET2DOCSDIR=$(HTTPSERVER2COREAPI)/..
 
 # Run javadoc if the index file is out of date or missing
-$(HTTPSERVER_INDEX_HTML): $(HTTPSERVER_OPTIONS_FILE) $(HTTPSERVER_PACKAGES_FILE)
+$(HTTPSERVER_INDEX_HTML): $(HTTPSERVER_OPTIONS_FILE) $(HTTPSERVER_PACKAGES_FILE) coredocs
 	$(prep-javadoc)
 	$(call JavadocSummary,$(HTTPSERVER_OPTIONS_FILE),$(HTTPSERVER_PACKAGES_FILE))
 	$(JAVADOC_CMD) -d $(@D) \
@@ -887,7 +883,7 @@
 MGMT_DOCDIR	 := $(JRE_API_DOCSDIR)/management/extension
 MGMT2COREAPI     := ../../$(JDKJRE2COREAPI)
 JVM_MIB_NAME     := JVM-MANAGEMENT-MIB.mib
-JVM_MIB_SRC      := $(CLOSED_SRC)/share/classes/sun/management/snmp/$(JVM_MIB_NAME)
+JVM_MIB_SRC      := $(JDK_TOPDIR)/src/closed/share/classes/sun/management/snmp/$(JVM_MIB_NAME)
 MGMT_DOCTITLE    := Monitoring and Management Interface for the Java$(TRADEMARK) Platform
 MGMT_WINDOWTITLE := Monitoring and Management Interface for the Java Platform
 MGMT_HEADER      := <strong>Monitoring and Management Interface for the Java Platform</strong>
@@ -906,7 +902,7 @@
 $(MGMT_INDEX_FILE): GET2DOCSDIR=$(MGMT2COREAPI)/..
 
 # Run javadoc if the index file is out of date or missing
-$(MGMT_INDEX_FILE): $(MGMT_OPTIONS_FILE) $(MGMT_PACKAGES_FILE)
+$(MGMT_INDEX_FILE): $(MGMT_OPTIONS_FILE) $(MGMT_PACKAGES_FILE) coredocs
 	$(prep-javadoc)
 	@if [ -f $(JVM_MIB_SRC) ] ; then 				\
 	  $(ECHO) "$(CP) $(JVM_MIB_SRC) $(@D)/.."; 			\
@@ -963,7 +959,7 @@
 $(ATTACH_INDEX_HTML): GET2DOCSDIR=$(ATTACH2COREAPI)/..
 
 # Run javadoc if the index file is out of date or missing
-$(ATTACH_INDEX_HTML): $(ATTACH_OPTIONS_FILE) $(ATTACH_PACKAGES_FILE)
+$(ATTACH_INDEX_HTML): $(ATTACH_OPTIONS_FILE) $(ATTACH_PACKAGES_FILE) coredocs
 	$(prep-javadoc)
 	$(call JavadocSummary,$(ATTACH_OPTIONS_FILE),$(ATTACH_PACKAGES_FILE))
 	$(JAVADOC_CMD) -d $(@D) \
@@ -1013,7 +1009,7 @@
 $(JCONSOLE_INDEX_HTML): GET2DOCSDIR=$(JCONSOLE2COREAPI)/..
 
 # Run javadoc if the index file is out of date or missing
-$(JCONSOLE_INDEX_HTML): $(JCONSOLE_OPTIONS_FILE) $(JCONSOLE_PACKAGES_FILE)
+$(JCONSOLE_INDEX_HTML): $(JCONSOLE_OPTIONS_FILE) $(JCONSOLE_PACKAGES_FILE) coredocs
 	$(prep-javadoc)
 	$(call JavadocSummary,$(JCONSOLE_OPTIONS_FILE),$(JCONSOLE_PACKAGES_FILE))
 	$(JAVADOC_CMD) -d $(@D) \
@@ -1065,7 +1061,7 @@
 $(TREEAPI_INDEX_HTML): GET2DOCSDIR=$(TREEAPI2COREAPI)/..
 
 # Run javadoc if the index file is out of date or missing
-$(TREEAPI_INDEX_HTML): $(TREEAPI_OPTIONS_FILE) $(TREEAPI_PACKAGES_FILE)
+$(TREEAPI_INDEX_HTML): $(TREEAPI_OPTIONS_FILE) $(TREEAPI_PACKAGES_FILE) coredocs
 	$(prep-javadoc)
 	$(call JavadocSummary,$(TREEAPI_OPTIONS_FILE),$(TREEAPI_PACKAGES_FILE))
 	$(JAVADOC_CMD) -d $(@D) \
@@ -1116,7 +1112,7 @@
 $(SCTPAPI_INDEX_HTML): GET2DOCSDIR=$(SCTPAPI2COREAPI)/..
 
 # Run javadoc if the index file is out of date or missing
-$(SCTPAPI_INDEX_HTML): $(SCTPAPI_OPTIONS_FILE) $(SCTPAPI_PACKAGES_FILE)
+$(SCTPAPI_INDEX_HTML): $(SCTPAPI_OPTIONS_FILE) $(SCTPAPI_PACKAGES_FILE) coredocs
 	$(prep-javadoc)
 	$(call JavadocSummary,$(SCTPAPI_OPTIONS_FILE),$(SCTPAPI_PACKAGES_FILE))
 	$(JAVADOC_CMD) -d $(@D) \