8179022: Add serialization spec as markdown
authorihse
Sun, 23 Apr 2017 21:34:02 +0200
changeset 44734 70bbd6884287
parent 44733 6505f00be6f2
child 44735 b4105c697f51
child 44825 a88f0959a4bf
child 44826 7a887996ee84
child 44985 54f298f9766a
8179022: Add serialization spec as markdown Reviewed-by: erikj, mchung, rriggs
common/autoconf/generated-configure.sh
common/autoconf/jdk-options.m4
common/conf/jib-profiles.js
make/Javadoc.gmk
make/devkit/createGraphvizBundle.sh
make/devkit/createPandocBundle.sh
--- a/common/autoconf/generated-configure.sh	Sun Apr 23 21:10:32 2017 +0200
+++ b/common/autoconf/generated-configure.sh	Sun Apr 23 21:34:02 2017 +0200
@@ -1973,7 +1973,8 @@
   --enable-debug          set the debug level to fastdebug (shorthand for
                           --with-debug-level=fastdebug) [disabled]
   --enable-headless-only  only build headless (no GUI) support [disabled]
-  --enable-full-docs      build complete documentation [disabled]
+  --enable-full-docs      build complete documentation [enabled if all tools
+                          found]
   --disable-unlimited-crypto
                           Disable unlimited crypto policy [enabled]
   --disable-keep-packaged-modules
@@ -5179,7 +5180,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1492700323
+DATE_WHEN_GENERATED=1492975963
 
 ###############################################################################
 #
@@ -24729,6 +24730,17 @@
     FULL_DOCS_DEP_MISSING=true
   fi
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pandoc" >&5
+$as_echo_n "checking for pandoc... " >&6; }
+  if test "x$PANDOC" != "x"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, cannot generate full docs" >&5
+$as_echo "no, cannot generate full docs" >&6; }
+    FULL_DOCS_DEP_MISSING=true
+  fi
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking full docs" >&5
 $as_echo_n "checking full docs... " >&6; }
   if test "x$enable_full_docs" = xyes; then
@@ -24778,9 +24790,16 @@
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, forced" >&5
 $as_echo "no, forced" >&6; }
   elif test "x$enable_full_docs" = x; then
-    ENABLE_FULL_DOCS=false
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, default" >&5
-$as_echo "no, default" >&6; }
+    # Check for prerequisites
+    if test "x$FULL_DOCS_DEP_MISSING" = xtrue; then
+      ENABLE_FULL_DOCS=false
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, missing dependencies" >&5
+$as_echo "no, missing dependencies" >&6; }
+    else
+      ENABLE_FULL_DOCS=true
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, dependencies present" >&5
+$as_echo "yes, dependencies present" >&6; }
+    fi
   else
     as_fn_error $? "--enable-full-docs can only take yes or no" "$LINENO" 5
   fi
--- a/common/autoconf/jdk-options.m4	Sun Apr 23 21:10:32 2017 +0200
+++ b/common/autoconf/jdk-options.m4	Sun Apr 23 21:34:02 2017 +0200
@@ -156,7 +156,7 @@
 
   # Should we build the complete docs, or just a lightweight version?
   AC_ARG_ENABLE([full-docs], [AS_HELP_STRING([--enable-full-docs],
-      [build complete documentation @<:@disabled@:>@])])
+      [build complete documentation @<:@enabled if all tools found@:>@])])
 
   # Verify dependencies
   AC_MSG_CHECKING([for graphviz dot])
@@ -167,6 +167,14 @@
     FULL_DOCS_DEP_MISSING=true
   fi
 
+  AC_MSG_CHECKING([for pandoc])
+  if test "x$PANDOC" != "x"; then
+    AC_MSG_RESULT([yes])
+  else
+    AC_MSG_RESULT([no, cannot generate full docs])
+    FULL_DOCS_DEP_MISSING=true
+  fi
+
   AC_MSG_CHECKING([full docs])
   if test "x$enable_full_docs" = xyes; then
     if test "x$FULL_DOCS_DEP_MISSING" = "xtrue"; then
@@ -181,8 +189,14 @@
     ENABLE_FULL_DOCS=false
     AC_MSG_RESULT([no, forced])
   elif test "x$enable_full_docs" = x; then
-    ENABLE_FULL_DOCS=false
-    AC_MSG_RESULT([no, default])
+    # Check for prerequisites
+    if test "x$FULL_DOCS_DEP_MISSING" = xtrue; then
+      ENABLE_FULL_DOCS=false
+      AC_MSG_RESULT([no, missing dependencies])
+    else
+      ENABLE_FULL_DOCS=true
+      AC_MSG_RESULT([yes, dependencies present])
+    fi
   else
     AC_MSG_ERROR([--enable-full-docs can only take yes or no])
   fi
--- a/common/conf/jib-profiles.js	Sun Apr 23 21:10:32 2017 +0200
+++ b/common/conf/jib-profiles.js	Sun Apr 23 21:34:02 2017 +0200
@@ -422,7 +422,7 @@
         "linux-x64": {
             target_os: "linux",
             target_cpu: "x64",
-            dependencies: ["devkit", "graphviz"],
+            dependencies: ["devkit", "graphviz", "pandoc"],
             configure_args: concat(common.configure_args_64bit,
                 "--enable-full-docs", "--with-zlib=system"),
             default_make_targets: ["docs-bundles"],
@@ -974,6 +974,14 @@
             module: "graphviz-" + input.target_platform,
             configure_args: "DOT=" + input.get("graphviz", "install_path") + "/dot"
         },
+
+        pandoc: {
+            organization: common.organization,
+            ext: "tar.gz",
+            revision: "1.17.2+1.0",
+            module: "pandoc-" + input.target_platform,
+            configure_args: "PANDOC=" + input.get("pandoc", "install_path") + "/pandoc/pandoc"
+        },
     };
 
     return dependencies;
--- a/make/Javadoc.gmk	Sun Apr 23 21:10:32 2017 +0200
+++ b/make/Javadoc.gmk	Sun Apr 23 21:34:02 2017 +0200
@@ -363,6 +363,38 @@
   ) \
 )
 
+ifeq ($(ENABLE_FULL_DOCS), true)
+  # For all markdown files in $module/share/specs directories, convert them to
+  # html.
+  MARKDOWN_SPEC_FILTER := %.md
+
+  # Macro for SetupCopyFiles that converts from markdown to html using pandoc.
+  define markdown-to-html
+	$(call MakeDir, $(@D))
+	$(RM) $@
+	$(PANDOC) -t html -s -o $@ $<
+  endef
+
+  rename-md-to-html = \
+      $(patsubst %.md,%.html,$1)
+
+  $(foreach m, $(ALL_MODULES), \
+    $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
+    $(if $(SPECS_$m), \
+      $(eval $(call SetupCopyFiles, CONVERT_MARKDOWN_$m, \
+          SRC := $(SPECS_$m), \
+          FILES := $(filter $(MARKDOWN_SPEC_FILTER), $(call CacheFind, $(SPECS_$m))), \
+          DEST := $(JAVADOC_OUTPUTDIR)/specs/, \
+          MACRO := markdown-to-html, \
+          NAME_MACRO := rename-md-to-html, \
+          LOG_ACTION := Converting from markdown, \
+      )) \
+      $(eval JDK_SPECS_TARGETS += $(CONVERT_MARKDOWN_$m)) \
+    ) \
+  )
+
+endif
+
 # Special treatment for generated documentation
 
 JDWP_PROTOCOL := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
--- a/make/devkit/createGraphvizBundle.sh	Sun Apr 23 21:10:32 2017 +0200
+++ b/make/devkit/createGraphvizBundle.sh	Sun Apr 23 21:34:02 2017 +0200
@@ -1,4 +1,28 @@
 #!/bin/bash -e
+#
+# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
 # Create a bundle in the current directory, containing what's needed to run
 # the 'dot' program from the graphviz suite by the OpenJDK build.
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/devkit/createPandocBundle.sh	Sun Apr 23 21:34:02 2017 +0200
@@ -0,0 +1,73 @@
+#!/bin/bash -e
+#
+# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+# Create a bundle in the current directory, containing what's needed to run
+# the 'pandoc' program by the OpenJDK build.
+
+TMPDIR=`mktemp -d -t pandocbundle-XXXX`
+trap "rm -rf \"$TMPDIR\"" EXIT
+
+ORIG_DIR=`pwd`
+cd "$TMPDIR"
+PANDOC_VERSION=1.17.2
+FULL_PANDOC_VERSION=1.17.2-1
+PACKAGE_VERSION=1.0
+TARGET_PLATFORM=linux_x64
+BUNDLE_NAME=pandoc-$TARGET_PLATFORM-$PANDOC_VERSION+$PACKAGE_VERSION.tar.gz
+
+wget https://github.com/jgm/pandoc/releases/download/$PANDOC_VERSION/pandoc-$FULL_PANDOC_VERSION-amd64.deb
+
+mkdir pandoc
+cd pandoc
+ar p ../pandoc-$FULL_PANDOC_VERSION-amd64.deb data.tar.gz | tar xz
+cd ..
+
+# Pandoc depends on libgmp.so.10, which in turn depends on libc. No readily
+# available precompiled binaries exists which match the requirement of
+# support for older linuxes (glibc 2.12), so we'll compile it ourselves.
+
+LIBGMP_VERSION=6.1.2
+
+wget https://gmplib.org/download/gmp/gmp-$LIBGMP_VERSION.tar.xz
+mkdir gmp
+cd gmp
+tar xf ../gmp-$LIBGMP_VERSION.tar.xz
+cd gmp-$LIBGMP_VERSION
+./configure --prefix=$TMPDIR/pandoc/usr
+make
+make install
+cd ../..
+
+cat > pandoc/pandoc << EOF
+#!/bin/bash
+# Get an absolute path to this script
+this_script_dir=\`dirname \$0\`
+this_script_dir=\`cd \$this_script_dir > /dev/null && pwd\`
+export LD_LIBRARY_PATH="\$this_script_dir/usr/lib:\$LD_LIBRARY_PATH"
+exec \$this_script_dir/usr/bin/pandoc "\$@"
+EOF
+chmod +x pandoc/pandoc
+tar -cvzf ../$BUNDLE_NAME pandoc
+cp ../$BUNDLE_NAME "$ORIG_DIR"