changeset 44731:1038bd1a3338

Merge
author lana
date Fri, 21 Apr 2017 03:33:47 +0000
parents 0db2f6470755 6b9ded7dc4ab
children c43bf5c360d5
files
diffstat 18 files changed, 833 insertions(+), 1653 deletions(-) [+]
line wrap: on
line diff
--- a/common/autoconf/basics.m4	Thu Apr 20 18:14:03 2017 +0000
+++ b/common/autoconf/basics.m4	Fri Apr 21 03:33:47 2017 +0000
@@ -1095,6 +1095,7 @@
     OTOOL="true"
   fi
   BASIC_PATH_PROGS(READELF, [greadelf readelf])
+  BASIC_PATH_PROGS(DOT, dot)
   BASIC_PATH_PROGS(HG, hg)
   BASIC_PATH_PROGS(STAT, stat)
   BASIC_PATH_PROGS(TIME, time)
--- a/common/autoconf/generated-configure.sh	Thu Apr 20 18:14:03 2017 +0000
+++ b/common/autoconf/generated-configure.sh	Fri Apr 21 03:33:47 2017 +0000
@@ -918,6 +918,7 @@
 INCLUDE_SA
 UNLIMITED_CRYPTO
 CACERTS_FILE
+ENABLE_FULL_DOCS
 ENABLE_HEADLESS_ONLY
 DEFAULT_MAKE_TARGET
 OS_VERSION_MICRO
@@ -935,6 +936,7 @@
 TIME
 STAT
 HG
+DOT
 READELF
 OTOOL
 LDD
@@ -993,9 +995,8 @@
 OPENJDK_TARGET_CPU_ISADIR
 OPENJDK_TARGET_CPU_LEGACY_LIB
 OPENJDK_TARGET_CPU_LEGACY
-REQUIRED_OS_VERSION
-REQUIRED_OS_ARCH
-REQUIRED_OS_NAME
+OPENJDK_MODULE_TARGET_OS_ARCH
+OPENJDK_MODULE_TARGET_OS_NAME
 COMPILE_TYPE
 OPENJDK_TARGET_CPU_ENDIAN
 OPENJDK_TARGET_CPU_BITS
@@ -1138,6 +1139,7 @@
 with_output_sync
 with_default_make_target
 enable_headless_only
+enable_full_docs
 with_cacerts_file
 enable_unlimited_crypto
 with_copyright_year
@@ -1290,6 +1292,7 @@
 LDD
 OTOOL
 READELF
+DOT
 HG
 STAT
 TIME
@@ -1970,6 +1973,7 @@
   --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]
   --disable-unlimited-crypto
                           Disable unlimited crypto policy [enabled]
   --disable-keep-packaged-modules
@@ -2254,6 +2258,7 @@
   LDD         Override default value for LDD
   OTOOL       Override default value for OTOOL
   READELF     Override default value for READELF
+  DOT         Override default value for DOT
   HG          Override default value for HG
   STAT        Override default value for STAT
   TIME        Override default value for TIME
@@ -5174,7 +5179,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1490856742
+DATE_WHEN_GENERATED=1492700323
 
 ###############################################################################
 #
@@ -16022,32 +16027,17 @@
 $as_echo "$COMPILE_TYPE" >&6; }
 
 
-  if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
-    REQUIRED_OS_NAME=SunOS
-    REQUIRED_OS_VERSION=5.10
-  fi
-  if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
-    REQUIRED_OS_NAME=Linux
-    REQUIRED_OS_VERSION=2.6
-  fi
-  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
-    REQUIRED_OS_NAME=Windows
-    if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
-      REQUIRED_OS_VERSION=5.2
-    else
-      REQUIRED_OS_VERSION=5.1
-    fi
-  fi
-  if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
-    REQUIRED_OS_NAME="Mac OS X"
-    REQUIRED_OS_VERSION=11.2
-  fi
-  if test "x$OPENJDK_TARGET_OS" = "xaix"; then
-    REQUIRED_OS_NAME=AIX
-    REQUIRED_OS_VERSION=7.1
-  fi
-  REQUIRED_OS_ARCH=${OPENJDK_TARGET_CPU}
-
+  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+    OPENJDK_MODULE_TARGET_OS_NAME="macos"
+  else
+    OPENJDK_MODULE_TARGET_OS_NAME="$OPENJDK_TARGET_OS"
+  fi
+
+  if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
+    OPENJDK_MODULE_TARGET_OS_ARCH="amd64"
+  else
+    OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU"
+  fi
 
 
 
@@ -22473,6 +22463,203 @@
   # Publish this variable in the help.
 
 
+  if [ -z "${DOT+x}" ]; then
+    # The variable is not set by user, try to locate tool using the code snippet
+    for ac_prog in dot
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_DOT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DOT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DOT="$DOT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_DOT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DOT=$ac_cv_path_DOT
+if test -n "$DOT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOT" >&5
+$as_echo "$DOT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$DOT" && break
+done
+
+  else
+    # The variable is set, but is it from the command line or the environment?
+
+    # Try to remove the string !DOT! from our list.
+    try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!DOT!/}
+    if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
+      # If it failed, the variable was not from the command line. Ignore it,
+      # but warn the user (except for BASH, which is always set by the calling BASH).
+      if test "xDOT" != xBASH; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of DOT from the environment. Use command line variables instead." >&5
+$as_echo "$as_me: WARNING: Ignoring value of DOT from the environment. Use command line variables instead." >&2;}
+      fi
+      # Try to locate tool using the code snippet
+      for ac_prog in dot
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_DOT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DOT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DOT="$DOT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_DOT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DOT=$ac_cv_path_DOT
+if test -n "$DOT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOT" >&5
+$as_echo "$DOT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$DOT" && break
+done
+
+    else
+      # If it succeeded, then it was overridden by the user. We will use it
+      # for the tool.
+
+      # First remove it from the list of overridden variables, so we can test
+      # for unknown variables in the end.
+      CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
+
+      # Check if we try to supply an empty value
+      if test "x$DOT" = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool DOT= (no value)" >&5
+$as_echo "$as_me: Setting user supplied tool DOT= (no value)" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DOT" >&5
+$as_echo_n "checking for DOT... " >&6; }
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
+$as_echo "disabled" >&6; }
+      else
+        # Check if the provided tool contains a complete path.
+        tool_specified="$DOT"
+        tool_basename="${tool_specified##*/}"
+        if test "x$tool_basename" = "x$tool_specified"; then
+          # A command without a complete path is provided, search $PATH.
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool DOT=$tool_basename" >&5
+$as_echo "$as_me: Will search for user supplied tool DOT=$tool_basename" >&6;}
+          # Extract the first word of "$tool_basename", so it can be a program name with args.
+set dummy $tool_basename; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_DOT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DOT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DOT="$DOT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_DOT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DOT=$ac_cv_path_DOT
+if test -n "$DOT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOT" >&5
+$as_echo "$DOT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+          if test "x$DOT" = x; then
+            as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
+          fi
+        else
+          # Otherwise we believe it is a complete path. Use it as it is.
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool DOT=$tool_specified" >&5
+$as_echo "$as_me: Will use user supplied tool DOT=$tool_specified" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DOT" >&5
+$as_echo_n "checking for DOT... " >&6; }
+          if test ! -x "$tool_specified"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+            as_fn_error $? "User supplied tool DOT=$tool_specified does not exist or is not executable" "$LINENO" 5
+          fi
+          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
+$as_echo "$tool_specified" >&6; }
+        fi
+      fi
+    fi
+
+  fi
+
+
+
+
+  # Publish this variable in the help.
+
+
   if [ -z "${HG+x}" ]; then
     # The variable is not set by user, try to locate tool using the code snippet
     for ac_prog in hg
@@ -24523,6 +24710,83 @@
 
 
 
+  # Should we build the complete docs, or just a lightweight version?
+  # Check whether --enable-full-docs was given.
+if test "${enable_full_docs+set}" = set; then :
+  enableval=$enable_full_docs;
+fi
+
+
+  # Verify dependencies
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for graphviz dot" >&5
+$as_echo_n "checking for graphviz dot... " >&6; }
+  if test "x$DOT" != "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
+    if test "x$FULL_DOCS_DEP_MISSING" = "xtrue"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, missing dependencies" >&5
+$as_echo "no, missing dependencies" >&6; }
+
+  # Print a helpful message on how to acquire the necessary build dependency.
+  # dot is the help tag: freetype, cups, alsa etc
+  MISSING_DEPENDENCY=dot
+
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    cygwin_help $MISSING_DEPENDENCY
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    msys_help $MISSING_DEPENDENCY
+  else
+    PKGHANDLER_COMMAND=
+
+    case $PKGHANDLER in
+      apt-get)
+        apt_help     $MISSING_DEPENDENCY ;;
+      yum)
+        yum_help     $MISSING_DEPENDENCY ;;
+      brew)
+        brew_help    $MISSING_DEPENDENCY ;;
+      port)
+        port_help    $MISSING_DEPENDENCY ;;
+      pkgutil)
+        pkgutil_help $MISSING_DEPENDENCY ;;
+      pkgadd)
+        pkgadd_help  $MISSING_DEPENDENCY ;;
+    esac
+
+    if test "x$PKGHANDLER_COMMAND" != x; then
+      HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+    fi
+  fi
+
+      as_fn_error $? "Cannot enable full docs with missing dependencies. See above. $HELP_MSG" "$LINENO" 5
+    else
+      ENABLE_FULL_DOCS=true
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, forced" >&5
+$as_echo "yes, forced" >&6; }
+    fi
+  elif test "x$enable_full_docs" = xno; then
+    ENABLE_FULL_DOCS=false
+    { $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; }
+  else
+    as_fn_error $? "--enable-full-docs can only take yes or no" "$LINENO" 5
+  fi
+
+
+
   # Choose cacerts source file
 
 # Check whether --with-cacerts-file was given.
--- a/common/autoconf/jdk-options.m4	Thu Apr 20 18:14:03 2017 +0000
+++ b/common/autoconf/jdk-options.m4	Fri Apr 21 03:33:47 2017 +0000
@@ -154,6 +154,41 @@
 
   AC_SUBST(ENABLE_HEADLESS_ONLY)
 
+  # 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@:>@])])
+
+  # Verify dependencies
+  AC_MSG_CHECKING([for graphviz dot])
+  if test "x$DOT" != "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
+      AC_MSG_RESULT([no, missing dependencies])
+      HELP_MSG_MISSING_DEPENDENCY([dot])
+      AC_MSG_ERROR([Cannot enable full docs with missing dependencies. See above. $HELP_MSG])
+    else
+      ENABLE_FULL_DOCS=true
+      AC_MSG_RESULT([yes, forced])
+    fi
+  elif test "x$enable_full_docs" = xno; then
+    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])
+  else
+    AC_MSG_ERROR([--enable-full-docs can only take yes or no])
+  fi
+
+  AC_SUBST(ENABLE_FULL_DOCS)
+
   # Choose cacerts source file
   AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file],
       [specify alternative cacerts file])])
--- a/common/autoconf/platform.m4	Thu Apr 20 18:14:03 2017 +0000
+++ b/common/autoconf/platform.m4	Fri Apr 21 03:33:47 2017 +0000
@@ -433,37 +433,22 @@
 
 ])
 
-AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
+AC_DEFUN([PLATFORM_SET_MODULE_TARGET_OS_VALUES],
 [
-  if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
-    REQUIRED_OS_NAME=SunOS
-    REQUIRED_OS_VERSION=5.10
+  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+    OPENJDK_MODULE_TARGET_OS_NAME="macos"
+  else
+    OPENJDK_MODULE_TARGET_OS_NAME="$OPENJDK_TARGET_OS"
   fi
-  if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
-    REQUIRED_OS_NAME=Linux
-    REQUIRED_OS_VERSION=2.6
+
+  if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
+    OPENJDK_MODULE_TARGET_OS_ARCH="amd64"
+  else
+    OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU"
   fi
-  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
-    REQUIRED_OS_NAME=Windows
-    if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
-      REQUIRED_OS_VERSION=5.2
-    else
-      REQUIRED_OS_VERSION=5.1
-    fi
-  fi
-  if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
-    REQUIRED_OS_NAME="Mac OS X"
-    REQUIRED_OS_VERSION=11.2
-  fi
-  if test "x$OPENJDK_TARGET_OS" = "xaix"; then
-    REQUIRED_OS_NAME=AIX
-    REQUIRED_OS_VERSION=7.1
-  fi
-  REQUIRED_OS_ARCH=${OPENJDK_TARGET_CPU}
 
-  AC_SUBST(REQUIRED_OS_NAME)
-  AC_SUBST(REQUIRED_OS_ARCH)
-  AC_SUBST(REQUIRED_OS_VERSION)
+  AC_SUBST(OPENJDK_MODULE_TARGET_OS_NAME)
+  AC_SUBST(OPENJDK_MODULE_TARGET_OS_ARCH)
 ])
 
 #%%% Build and target systems %%%
@@ -480,7 +465,7 @@
 
   PLATFORM_EXTRACT_TARGET_AND_BUILD
   PLATFORM_SETUP_TARGET_CPU_BITS
-  PLATFORM_SET_RELEASE_FILE_OS_VALUES
+  PLATFORM_SET_MODULE_TARGET_OS_VALUES
   PLATFORM_SETUP_LEGACY_VARS
 ])
 
--- a/common/autoconf/spec.gmk.in	Thu Apr 20 18:14:03 2017 +0000
+++ b/common/autoconf/spec.gmk.in	Fri Apr 21 03:33:47 2017 +0000
@@ -101,10 +101,9 @@
 OPENJDK_BUILD_CPU_BITS:=@OPENJDK_BUILD_CPU_BITS@
 OPENJDK_BUILD_CPU_ENDIAN:=@OPENJDK_BUILD_CPU_ENDIAN@
 
-# OS values for use in release file.
-REQUIRED_OS_NAME:=@REQUIRED_OS_NAME@
-REQUIRED_OS_ARCH:=@REQUIRED_OS_ARCH@
-REQUIRED_OS_VERSION:=@REQUIRED_OS_VERSION@
+# OS values for use in ModuleTarget class file attribute.
+OPENJDK_MODULE_TARGET_OS_NAME:=@OPENJDK_MODULE_TARGET_OS_NAME@
+OPENJDK_MODULE_TARGET_OS_ARCH:=@OPENJDK_MODULE_TARGET_OS_ARCH@
 
 LIBM:=@LIBM@
 LIBDL:=@LIBDL@
@@ -245,6 +244,8 @@
 # Only build headless support or not
 ENABLE_HEADLESS_ONLY := @ENABLE_HEADLESS_ONLY@
 
+ENABLE_FULL_DOCS := @ENABLE_FULL_DOCS@
+
 # JDK_OUTPUTDIR specifies where a working jvm is built.
 # You can run $(JDK_OUTPUTDIR)/bin/java
 # Though the layout of the contents of $(JDK_OUTPUTDIR) is not
@@ -678,6 +679,7 @@
 READELF:=@READELF@
 EXPR:=@EXPR@
 FILE:=@FILE@
+DOT:=@DOT@
 HG:=@HG@
 OBJCOPY:=@OBJCOPY@
 SETFILE:=@SETFILE@
@@ -841,11 +843,6 @@
     jre-$(VERSION_SHORT)+$(VERSION_BUILD)-compact3_$(OPENJDK_TARGET_BUNDLE_PLATFORM)_bin$(DEBUG_PART).tar.gz
 JDK_SYMBOLS_BUNDLE_NAME := jdk-$(BASE_NAME)_bin$(DEBUG_PART)-symbols.tar.gz
 JRE_SYMBOLS_BUNDLE_NAME := jre-$(BASE_NAME)_bin$(DEBUG_PART)-symbols.tar.gz
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  DEMOS_BUNDLE_NAME := jdk-$(BASE_NAME)_demo$(DEBUG_PART).zip
-else
-  DEMOS_BUNDLE_NAME := jdk-$(BASE_NAME)_demo$(DEBUG_PART).tar.gz
-endif
 TEST_BUNDLE_NAME := jdk-$(BASE_NAME)_bin-tests$(DEBUG_PART).tar.gz
 DOCS_BUNDLE_NAME := jdk-$(BASE_NAME)_doc-api-spec$(DEBUG_PART).tar.gz
 
@@ -853,7 +850,6 @@
 JRE_BUNDLE :=  $(BUNDLES_OUTPUTDIR)/$(JRE_BUNDLE_NAME)
 JDK_SYMBOLS_BUNDLE :=  $(BUNDLES_OUTPUTDIR)/$(JDK_SYMBOLS_BUNDLE_NAME)
 JRE_SYMBOLS_BUNDLE :=  $(BUNDLES_OUTPUTDIR)/$(JRE_SYMBOLS_BUNDLE_NAME)
-DEMOS_BUNDLE :=  $(BUNDLES_OUTPUTDIR)/$(DEMOS_BUNDLE_NAME)
 TEST_BUNDLE :=  $(BUNDLES_OUTPUTDIR)/$(TEST_BUNDLE_NAME)
 DOCS_BUNDLE :=  $(BUNDLES_OUTPUTDIR)/$(DOCS_BUNDLE_NAME)
 
--- a/common/bin/compare_exceptions.sh.incl	Thu Apr 20 18:14:03 2017 +0000
+++ b/common/bin/compare_exceptions.sh.incl	Fri Apr 21 03:33:47 2017 +0000
@@ -38,25 +38,9 @@
 if [ "$OPENJDK_TARGET_OS" = "linux" ]; then
 
   STRIP_BEFORE_COMPARE="
-      ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
-      ./demo/jvmti/gctest/lib/libgctest.so
-      ./demo/jvmti/heapTracker/lib/libheapTracker.so
-      ./demo/jvmti/heapViewer/lib/libheapViewer.so
-      ./demo/jvmti/minst/lib/libminst.so
-      ./demo/jvmti/mtrace/lib/libmtrace.so
-      ./demo/jvmti/versionCheck/lib/libversionCheck.so
-      ./demo/jvmti/waiters/lib/libwaiters.so
       "
 
   ACCEPTED_BIN_DIFF="
-      ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
-      ./demo/jvmti/gctest/lib/libgctest.so
-      ./demo/jvmti/heapTracker/lib/libheapTracker.so
-      ./demo/jvmti/heapViewer/lib/libheapViewer.so
-      ./demo/jvmti/minst/lib/libminst.so
-      ./demo/jvmti/mtrace/lib/libmtrace.so
-      ./demo/jvmti/versionCheck/lib/libversionCheck.so
-      ./demo/jvmti/waiters/lib/libwaiters.so
       ./lib/client/libjsig.so
       ./lib/client/libjvm.so
       ./lib/libattach.so
@@ -151,15 +135,6 @@
 if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
 
   STRIP_BEFORE_COMPARE="
-      ./demo/jni/Poller/lib/libPoller.so
-      ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
-      ./demo/jvmti/gctest/lib/libgctest.so
-      ./demo/jvmti/heapTracker/lib/libheapTracker.so
-      ./demo/jvmti/heapViewer/lib/libheapViewer.so
-      ./demo/jvmti/minst/lib/libminst.so
-      ./demo/jvmti/mtrace/lib/libmtrace.so
-      ./demo/jvmti/versionCheck/lib/libversionCheck.so
-      ./demo/jvmti/waiters/lib/libwaiters.so
       "
 
   SORT_SYMBOLS="
@@ -174,15 +149,6 @@
   SKIP_BIN_DIFF="true"
 
   ACCEPTED_SMALL_SIZE_DIFF="
-      ./demo/jni/Poller/lib/libPoller.so
-      ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
-      ./demo/jvmti/gctest/lib/libgctest.so
-      ./demo/jvmti/heapTracker/lib/libheapTracker.so
-      ./demo/jvmti/heapViewer/lib/libheapViewer.so
-      ./demo/jvmti/minst/lib/libminst.so
-      ./demo/jvmti/mtrace/lib/libmtrace.so
-      ./demo/jvmti/versionCheck/lib/libversionCheck.so
-      ./demo/jvmti/waiters/lib/libwaiters.so
       ./lib/jli/libjli.so
       ./lib/jspawnhelper
       ./lib/libJdbcOdbc.so
@@ -279,19 +245,9 @@
 if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "sparcv9" ]; then
 
   STRIP_BEFORE_COMPARE="
-      ./demo/jni/Poller/lib/libPoller.so
-      ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
-      ./demo/jvmti/gctest/lib/libgctest.so
-      ./demo/jvmti/heapTracker/lib/libheapTracker.so
-      ./demo/jvmti/heapViewer/lib/libheapViewer.so
-      ./demo/jvmti/minst/lib/libminst.so
-      ./demo/jvmti/mtrace/lib/libmtrace.so
-      ./demo/jvmti/versionCheck/lib/libversionCheck.so
-      ./demo/jvmti/waiters/lib/libwaiters.so
       "
 
   SORT_SYMBOLS="
-      ./demo/jvmti/waiters/lib/libwaiters.so
       ./lib/libjsig.so
       ./lib/libfontmanager.so
       ./lib/libjimage.so
@@ -305,15 +261,6 @@
   SKIP_BIN_DIFF="true"
 
   ACCEPTED_SMALL_SIZE_DIFF="
-      ./demo/jni/Poller/lib/libPoller.so
-      ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
-      ./demo/jvmti/gctest/lib/libgctest.so
-      ./demo/jvmti/heapTracker/lib/libheapTracker.so
-      ./demo/jvmti/heapViewer/lib/libheapViewer.so
-      ./demo/jvmti/minst/lib/libminst.so
-      ./demo/jvmti/mtrace/lib/libmtrace.so
-      ./demo/jvmti/versionCheck/lib/libversionCheck.so
-      ./demo/jvmti/waiters/lib/libwaiters.so
       ./lib/client/libjvm.so
       ./lib/jli/libjli.so
       ./lib/jspawnhelper
@@ -438,9 +385,6 @@
 
   # Probably should add all libs here
   ACCEPTED_SMALL_SIZE_DIFF="
-      ./demo/jvmti/gctest/lib/gctest.dll
-      ./demo/jvmti/heapTracker/lib/heapTracker.dll
-      ./demo/jvmti/minst/lib/minst.dll
       ./bin/attach.dll
       ./bin/jsoundds.dll
       ./bin/client/jvm.dll
@@ -579,14 +523,6 @@
       ./bin/wsgen
       ./bin/wsimport
       ./bin/xjc
-      ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.dylib
-      ./demo/jvmti/gctest/lib/libgctest.dylib
-      ./demo/jvmti/heapTracker/lib/libheapTracker.dylib
-      ./demo/jvmti/heapViewer/lib/libheapViewer.dylib
-      ./demo/jvmti/minst/lib/libminst.dylib
-      ./demo/jvmti/mtrace/lib/libmtrace.dylib
-      ./demo/jvmti/versionCheck/lib/libversionCheck.dylib
-      ./demo/jvmti/waiters/lib/libwaiters.dylib
       ./Contents/Home/bin/_javaws
       ./Contents/Home/bin/javaws
       ./Contents/Home/bin/idlj
--- a/common/conf/jib-profiles.js	Thu Apr 20 18:14:03 2017 +0000
+++ b/common/conf/jib-profiles.js	Fri Apr 21 03:33:47 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -422,8 +422,9 @@
         "linux-x64": {
             target_os: "linux",
             target_cpu: "x64",
-            dependencies: ["devkit"],
-            configure_args: concat(common.configure_args_64bit, "--with-zlib=system"),
+            dependencies: ["devkit", "graphviz"],
+            configure_args: concat(common.configure_args_64bit,
+                "--enable-full-docs", "--with-zlib=system"),
             default_make_targets: ["docs-bundles"],
         },
 
@@ -964,7 +965,15 @@
             ext: "tar.gz",
             revision: "2.7.1-v120+1.0",
             module: "freetype-" + input.target_platform
-        }
+        },
+
+        graphviz: {
+            organization: common.organization,
+            ext: "tar.gz",
+            revision: "2.38.0-1+1.1",
+            module: "graphviz-" + input.target_platform,
+            configure_args: "DOT=" + input.get("graphviz", "install_path") + "/dot"
+        },
     };
 
     return dependencies;
--- a/common/nb_native/nbproject/configurations.xml	Thu Apr 20 18:14:03 2017 +0000
+++ b/common/nb_native/nbproject/configurations.xml	Fri Apr 21 03:33:47 2017 +0000
@@ -982,52 +982,6 @@
           </df>
         </df>
         <df name="src">
-          <df name="demo">
-            <df name="share">
-              <df name="jvmti">
-                <df name="agent_util">
-                  <in>agent_util.c</in>
-                </df>
-                <df name="compiledMethodLoad">
-                  <in>compiledMethodLoad.c</in>
-                </df>
-                <df name="gctest">
-                  <in>gctest.c</in>
-                </df>
-                <df name="heapTracker">
-                  <in>heapTracker.c</in>
-                </df>
-                <df name="heapViewer">
-                  <in>heapViewer.c</in>
-                </df>
-                <df name="java_crw_demo">
-                  <in>java_crw_demo.c</in>
-                </df>
-                <df name="minst">
-                  <in>minst.c</in>
-                </df>
-                <df name="mtrace">
-                  <in>mtrace.c</in>
-                </df>
-                <df name="versionCheck">
-                  <in>versionCheck.c</in>
-                </df>
-                <df name="waiters">
-                  <in>Agent.cpp</in>
-                  <in>Monitor.cpp</in>
-                  <in>Thread.cpp</in>
-                  <in>waiters.cpp</in>
-                </df>
-              </df>
-            </df>
-            <df name="solaris">
-              <df name="jni">
-                <df name="Poller">
-                  <in>Poller.c</in>
-                </df>
-              </df>
-            </df>
-          </df>
           <df name="java.base">
             <df name="linux">
               <df name="native">
@@ -21533,89 +21487,6 @@
           </incDir>
         </ccTool>
       </item>
-      <item path="../../jdk/src/demo/share/jvmti/agent_util/agent_util.c"
-            ex="false"
-            tool="0"
-            flavor2="3">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c"
-            ex="false"
-            tool="0"
-            flavor2="3">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/gctest/gctest.c"
-            ex="false"
-            tool="0"
-            flavor2="3">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/heapTracker/heapTracker.c"
-            ex="false"
-            tool="0"
-            flavor2="3">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/heapViewer/heapViewer.c"
-            ex="false"
-            tool="0"
-            flavor2="3">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/java_crw_demo/java_crw_demo.c"
-            ex="false"
-            tool="0"
-            flavor2="3">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/minst/minst.c"
-            ex="false"
-            tool="0"
-            flavor2="3">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/mtrace/mtrace.c"
-            ex="false"
-            tool="0"
-            flavor2="3">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/versionCheck/versionCheck.c"
-            ex="false"
-            tool="0"
-            flavor2="3">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/waiters/Agent.cpp"
-            ex="false"
-            tool="1"
-            flavor2="4">
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/waiters/Monitor.cpp"
-            ex="false"
-            tool="1"
-            flavor2="4">
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/waiters/Thread.cpp"
-            ex="false"
-            tool="1"
-            flavor2="4">
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/waiters/waiters.cpp"
-            ex="false"
-            tool="1"
-            flavor2="4">
-      </item>
       <item path="../../jdk/src/java.base/macosx/native/libjava/HostLocaleProviderAdapter_md.c"
             ex="false"
             tool="0"
@@ -30509,113 +30380,6 @@
           </incDir>
         </cTool>
       </folder>
-      <folder path="0/jdk/src/demo">
-        <cTool>
-          <preprocessorList>
-            <Elem>DEBUG</Elem>
-          </preprocessorList>
-        </cTool>
-        <ccTool>
-          <incDir>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/waiters</pElem>
-            <pElem>../../jdk/src/java.base/macosx/native/include</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>DEBUG</Elem>
-          </preprocessorList>
-        </ccTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/agent_util">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/java.base/macosx/native/include</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/compiledMethodLoad">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/compiledMethodLoad</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/macosx/native/include</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/gctest">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/macosx/native/include</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/gctest</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/heapTracker">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/macosx/native/include</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/heapTracker</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/heapViewer">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/heapViewer</pElem>
-            <pElem>../../jdk/src/java.base/macosx/native/include</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/java_crw_demo">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/minst">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/macosx/native/include</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/minst</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/mtrace">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/macosx/native/include</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/mtrace</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/versionCheck">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/versionCheck</pElem>
-            <pElem>../../jdk/src/java.base/macosx/native/include</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-        </cTool>
-      </folder>
       <folder path="0/jdk/src/java.base">
         <cTool>
           <incDir>
@@ -36906,106 +36670,6 @@
         <cTool flags="3">
         </cTool>
       </item>
-      <item path="../../jdk/src/demo/share/jvmti/agent_util/agent_util.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/gctest/gctest.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/heapTracker/heapTracker.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/heapViewer/heapViewer.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/java_crw_demo/java_crw_demo.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/minst/minst.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/mtrace/mtrace.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/versionCheck/versionCheck.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="5">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/waiters/Agent.cpp"
-            ex="false"
-            tool="1"
-            flavor2="0">
-        <ccTool flags="2">
-        </ccTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/waiters/Monitor.cpp"
-            ex="false"
-            tool="1"
-            flavor2="0">
-        <ccTool flags="2">
-          <preprocessorList>
-            <Elem>THIS_FILE="Monitor.cpp"</Elem>
-          </preprocessorList>
-        </ccTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/waiters/Thread.cpp"
-            ex="false"
-            tool="1"
-            flavor2="0">
-        <ccTool flags="2">
-          <preprocessorList>
-            <Elem>THIS_FILE="Thread.cpp"</Elem>
-          </preprocessorList>
-        </ccTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/waiters/waiters.cpp"
-            ex="false"
-            tool="1"
-            flavor2="0">
-        <ccTool flags="2">
-          <preprocessorList>
-            <Elem>THIS_FILE="waiters.cpp"</Elem>
-          </preprocessorList>
-        </ccTool>
-      </item>
       <item path="../../jdk/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c"
             ex="false"
             tool="0"
@@ -46197,183 +45861,6 @@
           </preprocessorList>
         </cTool>
       </folder>
-      <folder path="0/jdk/src/demo">
-        <cTool>
-          <preprocessorList>
-            <Elem>DEBUG</Elem>
-          </preprocessorList>
-        </cTool>
-        <ccTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/waiters</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/linux/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>DEBUG</Elem>
-          </preprocessorList>
-        </ccTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/agent_util">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/heapTracker</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/linux/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/compiledMethodLoad">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/compiledMethodLoad</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/linux/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="compiledMethodLoad.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/gctest">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/gctest</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/linux/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="gctest.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/heapTracker">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/heapTracker</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/linux/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="heapTracker.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/heapViewer">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/heapViewer</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/linux/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="heapViewer.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/java_crw_demo">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/heapTracker</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/linux/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="java_crw_demo.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/minst">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/minst</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/linux/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="minst.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/mtrace">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/mtrace</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/linux/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="mtrace.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/versionCheck">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/versionCheck</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/linux/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="versionCheck.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
       <folder path="0/jdk/src/java.base">
         <cTool>
           <preprocessorList>
@@ -55235,113 +54722,6 @@
         <ccTool flags="0">
         </ccTool>
       </item>
-      <item path="../../jdk/src/demo/share/jvmti/agent_util/agent_util.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="3">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="3">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/gctest/gctest.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="3">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/heapTracker/heapTracker.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="3">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/heapViewer/heapViewer.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="3">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/java_crw_demo/java_crw_demo.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="3">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/minst/minst.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="3">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/mtrace/mtrace.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="3">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/versionCheck/versionCheck.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="3">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/waiters/Agent.cpp"
-            ex="false"
-            tool="1"
-            flavor2="0">
-        <ccTool flags="0">
-        </ccTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/waiters/Monitor.cpp"
-            ex="false"
-            tool="1"
-            flavor2="0">
-        <ccTool flags="0">
-          <preprocessorList>
-            <Elem>THIS_FILE="Monitor.cpp"</Elem>
-          </preprocessorList>
-        </ccTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/waiters/Thread.cpp"
-            ex="false"
-            tool="1"
-            flavor2="0">
-        <ccTool flags="0">
-          <preprocessorList>
-            <Elem>THIS_FILE="Thread.cpp"</Elem>
-          </preprocessorList>
-        </ccTool>
-      </item>
-      <item path="../../jdk/src/demo/share/jvmti/waiters/waiters.cpp"
-            ex="false"
-            tool="1"
-            flavor2="0">
-        <ccTool flags="0">
-          <preprocessorList>
-            <Elem>THIS_FILE="waiters.cpp"</Elem>
-          </preprocessorList>
-        </ccTool>
-      </item>
-      <item path="../../jdk/src/demo/solaris/jni/Poller/Poller.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="2">
-        </cTool>
-      </item>
       <item path="../../jdk/src/java.base/share/native/launcher/main.c"
             ex="false"
             tool="0"
@@ -64674,8 +64054,6 @@
         </cTool>
         <ccTool>
           <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/waiters</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
             <pElem>../../jdk/src/java.base/share/native/include</pElem>
             <pElem>../../jdk/src/java.base/solaris/native/include</pElem>
             <pElem>../../jdk/src/java.base/unix/native/include</pElem>
@@ -64699,189 +64077,6 @@
           </preprocessorList>
         </ccTool>
       </folder>
-      <folder path="0/jdk/src/demo">
-        <cTool>
-          <preprocessorList>
-            <Elem>DEBUG</Elem>
-          </preprocessorList>
-        </cTool>
-        <ccTool>
-          <preprocessorList>
-            <Elem>DEBUG</Elem>
-          </preprocessorList>
-        </ccTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/agent_util">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/heapTracker</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/solaris/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/compiledMethodLoad">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/compiledMethodLoad</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/solaris/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="compiledMethodLoad.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/gctest">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/gctest</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/solaris/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="gctest.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/heapTracker">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/heapTracker</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/solaris/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="heapTracker.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/heapViewer">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/heapViewer</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/solaris/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="heapViewer.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/java_crw_demo">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/heapTracker</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/solaris/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="java_crw_demo.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/minst">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/minst</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/solaris/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="minst.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/mtrace">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/mtrace</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/solaris/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="mtrace.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/share/jvmti/versionCheck">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/demo/share/jvmti/versionCheck</pElem>
-            <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/solaris/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="versionCheck.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="0/jdk/src/demo/solaris">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/java.base/share/native/include</pElem>
-            <pElem>../../jdk/src/java.base/solaris/native/include</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/include</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../build/support/demos/classes/jni/Poller</pElem>
-            <pElem>../../jdk/make</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>THIS_FILE="Poller.c"</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
       <folder path="0/jdk/src/java.base">
         <cTool>
           <incDir>
--- a/make/Bundles.gmk	Thu Apr 20 18:14:03 2017 +0000
+++ b/make/Bundles.gmk	Fri Apr 21 03:33:47 2017 +0000
@@ -183,29 +183,16 @@
           $(JDK_SYMBOLS_EXCLUDE_PATTERN) \
           $(JDK_EXTRA_EXCLUDES) \
           $(SYMBOLS_EXCLUDE_PATTERN) \
-          $(JDK_IMAGE_HOMEDIR)/demo/% $(JDK_IMAGE_HOMEDIR)/sample/% \
           , \
           $(ALL_JDK_FILES) \
       )
-  DEMOS_BUNDLE_FILES := \
-      $(filter-out \
-          $(JDK_SYMBOLS_EXCLUDE_PATTERN) \
-          $(SYMBOLS_EXCLUDE_PATTERN) \
-          , \
-          $(filter \
-               $(JDK_IMAGE_HOMEDIR)/demo/% $(JDK_IMAGE_HOMEDIR)/sample/% \
-               $(JDK_IMAGE_HOMEDIR)/release \
-               , \
-               $(ALL_JDK_FILES) \
-          ) \
-      )
   JDK_SYMBOLS_BUNDLE_FILES := \
       $(filter \
           $(JDK_SYMBOLS_EXCLUDE_PATTERN) \
           $(SYMBOLS_EXCLUDE_PATTERN) \
           , \
           $(filter-out \
-              $(JDK_IMAGE_HOMEDIR)/demo/% $(JDK_IMAGE_HOMEDIR)/sample/% \
+              $(JDK_IMAGE_HOMEDIR)/demo/% \
               , \
               $(ALL_JDK_FILES) \
           ) \
@@ -271,14 +258,6 @@
 
   PRODUCT_TARGETS += $(BUILD_JRE_SYMBOLS_BUNDLE)
 
-  $(eval $(call SetupBundleFile, BUILD_DEMOS_BUNDLE, \
-      BUNDLE_NAME := $(DEMOS_BUNDLE_NAME), \
-      FILES := $(DEMOS_BUNDLE_FILES), \
-      BASE_DIRS := $(JDK_IMAGE_DIR), \
-      SUBDIR := $(JDK_BUNDLE_SUBDIR), \
-  ))
-
-  PRODUCT_TARGETS += $(BUILD_DEMOS_BUNDLE)
 endif
 
 ################################################################################
--- a/make/CreateJmods.gmk	Thu Apr 20 18:14:03 2017 +0000
+++ b/make/CreateJmods.gmk	Fri Apr 21 03:33:47 2017 +0000
@@ -135,8 +135,8 @@
 	$(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@)
 	$(JMOD) create \
             --module-version $(VERSION_SHORT) \
-            --os-name '$(REQUIRED_OS_NAME)' \
-            --os-arch '$(REQUIRED_OS_ARCH)' \
+            --os-name '$(OPENJDK_MODULE_TARGET_OS_NAME)' \
+            --os-arch '$(OPENJDK_MODULE_TARGET_OS_ARCH)' \
             --module-path $(JMODS_DIR) \
 	    --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \
 	    $(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@)
--- a/make/Help.gmk	Thu Apr 20 18:14:03 2017 +0000
+++ b/make/Help.gmk	Fri Apr 21 03:33:47 2017 +0000
@@ -47,7 +47,7 @@
 	$(info $(_)                        # dependencies for the target. This is faster but may)
 	$(info $(_)                        # result in incorrect build results!)
 	$(info $(_) make docs              # Create all docs)
-	$(info $(_) make docs-javadoc      # Create just javadocs, depends on less than full docs)
+	$(info $(_) make docs-jdk-api      # Create just JDK javadocs)
 	$(info $(_) make profiles          # Create complete jre compact profile images)
 	$(info $(_) make bootcycle-images  # Build images twice, second time with newly built JDK)
 	$(info $(_) make install           # Install the generated images locally)
--- a/make/Images.gmk	Thu Apr 20 18:14:03 2017 +0000
+++ b/make/Images.gmk	Fri Apr 21 03:33:47 2017 +0000
@@ -119,7 +119,6 @@
     --module-path $(IMAGES_OUTPUTDIR)/jmods \
     --endian $(OPENJDK_BUILD_CPU_ENDIAN) \
     --release-info $(BASE_RELEASE_FILE) \
-    --release-info add:OS_VERSION=\"$(REQUIRED_OS_VERSION)\" \
     --order-resources=$(call CommaList, $(JLINK_ORDER_RESOURCES)) \
     --dedup-legal-notices=error-if-not-same-content \
     $(JLINK_JLI_CLASSES) \
@@ -349,17 +348,6 @@
 endif
 
 ################################################################################
-# /sample dir
-
-$(eval $(call SetupCopyFiles, COPY_SAMPLES, \
-    SRC := $(SUPPORT_OUTPUTDIR)/sample/image, \
-    DEST := $(JDK_IMAGE_DIR)/sample, \
-    FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample/image), \
-        $(call CacheFind,$(SUPPORT_OUTPUTDIR)/sample/image))))
-
-JDK_TARGETS += $(COPY_SAMPLES)
-
-################################################################################
 # Code coverage data files
 
 ifeq ($(GCOV_ENABLED), true)
--- a/make/Javadoc.gmk	Thu Apr 20 18:14:03 2017 +0000
+++ b/make/Javadoc.gmk	Fri Apr 21 03:33:47 2017 +0000
@@ -26,28 +26,21 @@
 
 include $(SPEC)
 include MakeBase.gmk
+include Modules.gmk
+include ZipArchive.gmk
 include $(JDK_TOPDIR)/make/Tools.gmk
 include $(JDK_TOPDIR)/make/ModuleTools.gmk
 
+# This is needed to properly setup DOCS_MODULES.
+$(eval $(call ReadImportMetaData))
+
 ################################################################################
+# Javadoc settings
 
-# List of all possible directories for javadoc to look for sources
-# Allow custom to overwrite.
-JAVADOC_SOURCE_DIRS = \
-      $(SUPPORT_OUTPUTDIR)/gensrc/* \
-      $(addsuffix /*, $(IMPORT_MODULES_SRC)) \
-      $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \
-      $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_TYPE)/classes \
-      $(JDK_TOPDIR)/src/*/share/classes \
-      $(HOTSPOT_TOPDIR)/src/*/share/classes \
-      $(LANGTOOLS_TOPDIR)/src/*/share/classes \
-      $(NASHORN_TOPDIR)/src/*/share/classes \
-      $(CORBA_TOPDIR)/src/*/share/classes \
-      $(JAXP_TOPDIR)/src/*/share/classes \
-      $(JAXWS_TOPDIR)/src/*/share/classes \
-      $(SUPPORT_OUTPUTDIR)/rmic/* \
-      $(JDK_TOPDIR)/src/*/share/doc/stub \
-      #
+# On top of the sources that was used to compile the JDK, we need some
+# extra java.rmi sources that are used just for javadoc.
+MODULES_SOURCE_PATH := $(call PathList, $(call GetModuleSrcPath) \
+    $(SUPPORT_OUTPUTDIR)/rmic/* $(JDK_TOPDIR)/src/*/share/doc/stub)
 
 # Should we use -Xdocrootparent? Allow custom to overwrite.
 DOCROOTPARENT_FLAG = TRUE
@@ -55,113 +48,11 @@
 # URLs
 JAVADOC_BASE_URL := http://docs.oracle.com/javase/$(VERSION_SPECIFICATION)/docs
 BUG_SUBMIT_URL := http://bugreport.java.com/bugreport/
-
-################################################################################
-# Text snippets
-
-FULL_COMPANY_NAME := Oracle and/or its affiliates
-COMPANY_ADDRESS := 500 Oracle Parkway<br>Redwood Shores, CA 94065 USA
-BUG_SUBMIT_LINE := <a href="$(BUG_SUBMIT_URL)">Submit a bug or feature</a>
-
-COMMON_BOTTOM_TEXT := $(BUG_SUBMIT_LINE)<br> Java is a trademark or registered \
-    trademark of $(FULL_COMPANY_NAME) in the US and other countries.
-
-CORE_BOTTOM_COPYRIGHT_URL := {@docroot}/../legal/cpyr.html
-CORE_BOTTOM_TEXT := \
-    $(BUG_SUBMIT_LINE) \
-    <br>For further API reference and developer documentation, see \
-    <a href="$(JAVADOC_BASE_URL)/index.html" target="_blank">Java SE \
-    Documentation</a>. That documentation contains more detailed, \
-    developer-targeted descriptions, with conceptual overviews, definitions of \
-    terms, workarounds, and working code examples.
-
-ifeq ($(VERSION_IS_GA), true)
-  DRAFT_MARKER :=
-  DRAFT_WINDOW_TITLE_MARKER :=
-  EARLYACCESS_TOP :=
-else
-  # We need a draft format when not building the GA version.
-  DRAFT_MARKER := <br><strong>DRAFT&nbsp;$(VERSION_STRING)</strong>
-  ifeq ($(VERSION_BUILD), 0)
-    DRAFT_WINDOW_TITLE_MARKER := $(SPACE)[ad-hoc build]
-  else
-    DRAFT_WINDOW_TITLE_MARKER := $(SPACE)[build $(VERSION_BUILD)]
-  endif
-  EARLYACCESS_TOP := \
-      <div style="background-color: $(HASH)EEEEEE"><div style="padding: 6px; \
-      margin-top: 2px; margin-bottom: 6px; margin-left: 6px; margin-right: \
-      6px; text-align: justify; font-size: 80%; font-family: Helvetica, Arial, \
-      sans-serif; font-weight: normal;">Please note that the specifications \
-      and other information contained herein are not final and are subject to \
-      change. The information is being made available to you solely for \
-      purpose of evaluation.</div></div>
-endif
-
-################################################################################
-# Special treatment for the core package list. All separate "small" javadoc
-# invocation needs to be able to see the core package list.
-
-ALL_PKG_DIRS := $(dir $(filter %.java, $(call CacheFind, \
-    $(wildcard $(JAVADOC_SOURCE_DIRS)))))
-ALL_SRC_PREFIXES := $(addsuffix /%, $(wildcard $(JAVADOC_SOURCE_DIRS)))
-ALL_PKG_DIRNAMES := $(foreach prefix, $(ALL_SRC_PREFIXES), \
-    $(patsubst $(prefix),%, $(filter $(prefix), $(ALL_PKG_DIRS))))
-ALL_PACKAGES := $(sort $(subst /,., $(patsubst %/, %, $(ALL_PKG_DIRNAMES))))
-
-# Core packages are all packages beginning with java, javax or org, except a few
-# excludes.
-JAVA_PACKAGES := $(filter java.%, $(ALL_PACKAGES))
-JAVAX_PACKAGES := $(filter javax.%, $(ALL_PACKAGES))
-ORG_PACKAGES := $(filter org.%, $(ALL_PACKAGES))
-
-# Allow custom makefile to add more excluded packages
-CORE_EXCLUDED_PACKAGES += \
-    java.awt.dnd.peer \
-    java.awt.peer \
-    javax.smartcardio \
-    org.jcp.xml.dsig.internal% \
-    org.w3c.dom.css \
-    org.w3c.dom.html \
-    org.w3c.dom.stylesheets \
-    org.w3c.dom.xpath \
-    org.graalvm.compiler.% \
-    #
-
-CORE_PACKAGES := $(filter-out $(CORE_EXCLUDED_PACKAGES), \
-    $(JAVA_PACKAGES) $(JAVAX_PACKAGES) $(ORG_PACKAGES))
-
-CORE_PACKAGES_LIST_DIR := $(SUPPORT_OUTPUTDIR)/docs/core-packages
-CORE_PACKAGES_LIST_FILE := $(CORE_PACKAGES_LIST_DIR)/package-list
-
-CORE_PACKAGES_VARDEPS_FILE := $(call DependOnVariable, CORE_PACKAGES, \
-    $(CORE_PACKAGES_LIST_FILE).vardeps)
-
-$(CORE_PACKAGES_LIST_FILE): $(CORE_PACKAGES_VARDEPS_FILE)
-	$(call MakeDir, $(@D))
-	$(eval $(call ListPathsSafely, CORE_PACKAGES, $@))
-
-################################################################################
-# Support functions for SetupJavadocGeneration
-
-# Generate the text used in the -bottom argument.
-# Note that COPYRIGHT_YEAR is the current year (from spec.gmk)
-# Arguments:
-# arg 1: first copyright year
-# arg 2: copyright url (optional)
-# arg 3: free-form text snippet (optional)
-define GenerateBottom
-  <span style="font-size:smaller">$(if $(strip $3), $(strip $3))<br> $(if \
-      $(strip $2),<a href="$(strip $2)">Copyright</a>,Copyright) \
-      &copy; $(strip $1), $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME). \
-      $(COMPANY_ADDRESS). All rights reserved.</span>
-endef
-
-# Speed up finding by filling cache
-$(eval $(call FillCacheFind, $(wildcard $(JAVADOC_SOURCE_DIRS))))
+COPYRIGHT_URL := {@docroot}/../legal/cpyr.html
 
 # In order to get a specific ordering it's necessary to specify the total
 # ordering of tags as the tags are otherwise ordered in order of definition.
-DEFAULT_JAVADOC_TAGS := \
+JAVADOC_TAGS := \
     -tag beaninfo:X \
     -tag revised:X \
     -tag since.unbundled:X \
@@ -187,514 +78,272 @@
     -tagletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     #
 
-DEFAULT_JAVADOC_OPTIONS := -XDignore.symbol.file=true -use -keywords -notimestamp \
-    -serialwarn -encoding ISO-8859-1 -breakiterator --system none
+# Which doclint checks to ignore
+JAVADOC_DISABLED_DOCLINT := accessibility html missing syntax reference
 
-#
-# TODO: this should be set by the configure option.
-#
-ifndef ENABLE_MODULE_GRAPH
-   ENABLE_MODULE_GRAPH=false
+# The initial set of options for javadoc
+JAVADOC_OPTIONS := -XDignore.symbol.file=true -use -keywords -notimestamp \
+    -serialwarn -encoding ISO-8859-1 -breakiterator -splitIndex --system none \
+    --expand-requires transitive
+
+# Should we add DRAFT stamps to the generated javadoc?
+ifeq ($(VERSION_IS_GA), true)
+  IS_DRAFT := false
+else
+  IS_DRAFT := true
 endif
 
 ################################################################################
-# Setup make rules for running javadoc.
+# General text snippets
+
+FULL_COMPANY_NAME := Oracle and/or its affiliates
+COMPANY_ADDRESS := 500 Oracle Parkway<br>Redwood Shores, CA 94065 USA
+
+ifeq ($(IS_DRAFT), true)
+  DRAFT_MARKER_STR := <br><strong>DRAFT $(VERSION_STRING)</strong>
+  ifeq ($(VERSION_BUILD), 0)
+    DRAFT_MARKER_TITLE := [ad-hoc build]
+  else
+    DRAFT_MARKER_TITLE := [build $(VERSION_BUILD)]
+  endif
+endif
+
+JAVADOC_WINDOW_TITLE := Java Platform SE $(VERSION_SPECIFICATION) \
+    $(DRAFT_MARKER_TITLE)
+
+JAVADOC_HEADER_TITLE := $(subst $(SPACE),&nbsp;,$(strip \
+    <strong>Java&trade; Platform<br>Standard Ed. \
+    $(VERSION_SPECIFICATION)</strong>$(DRAFT_MARKER_STR)))
+
+JAVADOC_BOTTOM := \
+    <span style="font-size:smaller"> \
+    <a href="$(BUG_SUBMIT_URL)">Submit a bug or feature</a><br> \
+    For further API reference and developer documentation, see \
+    <a href="$(JAVADOC_BASE_URL)/index.html" target="_blank">Java SE \
+    Documentation</a>. That documentation contains more detailed, \
+    developer-targeted descriptions, with conceptual overviews, definitions \
+    of terms, workarounds, and working code examples.<br> \
+    Java is a trademark or registered trademark of $(FULL_COMPANY_NAME) in \
+    the US and other countries.<br> \
+    <a href="$(COPYRIGHT_URL)">Copyright</a> \
+    &copy; 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME). \
+    $(COMPANY_ADDRESS). All rights reserved.$(DRAFT_MARKER_STR)</span>
+
+JAVADOC_TOP := \
+    <div style="background-color: $(HASH)EEEEEE"><div style="padding: 6px; \
+    margin-top: 2px; margin-bottom: 6px; margin-left: 6px; margin-right: \
+    6px; text-align: justify; font-size: 80%; font-family: Helvetica, Arial, \
+    sans-serif; font-weight: normal;">Please note that the specifications \
+    and other information contained herein are not final and are subject to \
+    change. The information is being made available to you solely for \
+    purpose of evaluation.</div></div>
+
+################################################################################
+# JDK javadoc titles/text snippets
+
+JDK_JAVADOC_DOC_TITLE := Java&trade; Platform, Standard Edition Development Kit \
+    (JDK&trade;) $(VERSION_SPECIFICATION)<br>API Specification
+
+################################################################################
+# Java SE javadoc titles/text snippets
+
+JAVASE_JAVADOC_DOC_TITLE := Java&trade; Platform, Standard Edition \
+    $(VERSION_SPECIFICATION)<br>API Specification
+
+################################################################################
+# Functions
+
+# Helper function for creating a png file from a dot file generated by the
+# GenGraphs tool.
+# param 1: SetupJavadocGeneration namespace ($1)
+# param 2: module name
 #
-# Parameter 1 is the name of the rule. This name is used as variable prefix,
-# and the targets generated are listed in a variable by that name. Note that
-# the index.html file will work as a "touch file" for all the magnitude of
-# files that are generated by javadoc.
+define setup_gengraph_dot_to_png
+  $1_$2_DOT_SRC :=  $$($1_GENGRAPHS_DIR)/$2.dot
+  $1_$2_PNG_TARGET := $$($1_TARGET_DIR)/$2-graph.png
+
+    # For each module needing a graph, create a png file from the dot file
+    # generated by the GenGraphs tool and store it in the target dir.
+    $$($1_$2_PNG_TARGET): $$($1_GENGRAPHS_MARKER)
+	$$(call MakeDir, $$(@D))
+	$$(call ExecuteWithLog, $$($1_$2_DOT_SRC), \
+	    $$(DOT) -Tpng -o $$($1_$2_PNG_TARGET) $$($1_$2_DOT_SRC))
+
+  $1_MODULEGRAPH_TARGETS += $$($1_$2_PNG_TARGET)
+endef
+
+################################################################################
+# Setup make rules for creating the API documentation, using javadoc and other
+# tools if needed.
+#
+# Parameter 1 is the name of the rule. This name is used as variable prefix.
+# Targets generated are returned as $1_JAVADOC_TARGETS and
+# $1_MODULEGRAPH_TARGETS. Note that the index.html file will work as a "touch
+# file" for all the magnitude of files that are generated by javadoc.
 #
 # Remaining parameters are named arguments. These include:
-#   MODULES - Modules to include
-#   PACKAGES - Packages to include
-#   IS_CORE - Set to TRUE for the Core API package which needs special treatment
-#   API_ROOT - Where to base the documentation (jre or jdk)
-#   DEST_DIR - A directory relative to the API root
-#   OVERVIEW - Path to a html overview file
-#   TITLE - Default title to use for the more specific versions below
-#   WINDOW_TITLE - Title to use in -windowtitle. Computed from TITLE if empty.
-#   HEADER_TITLE - Title to use in -header. Computed from TITLE if empty.
-#   DOC_TITLE - Title to use in -doctitle. Computed from TITLE if empty.
-#   FIRST_COPYRIGHT_YEAR - First year this bundle was introduced
-#   DISABLED_DOCLINT - Doclint warnings to exclude.
-#   DOCLINT_PACKAGES - Optional -Xdoclint/package value
-#   SPLIT_INDEX - Enable -splitIndex (split index-all.html if it is too large)
-#   BOTTOM_COPYRIGHT_URL - Copyright URL to use in -bottom
-#   BOTTOM_TEXT - Extra text to use in -bottom
-#   EXTRA_TOP - Additional -top data
+#   MODULES - Modules to generate javadoc for
+#   NAME - The name of the javadoc compilation, to be presented to the user
+#   TARGET_DIR - Where to store the output
+#   OVERVIEW - Path to an html overview file
+#   DOC_TITLE - Title to use in -doctitle.
+#   WINDOW_TITLE - Title to use in -windowtitle.
+#   HEADER_TITLE - Title to use in -header.
+#   BOTTOM_TEXT - Text to use in -bottom.
+#   TOP_TEXT - Text to use in -top.
 #
-SetupJavadocGeneration = $(NamedParamsMacroTemplate)
-define SetupJavadocGenerationBody
-  ifeq ($$($1_IS_CORE), TRUE)
-    $1_JAVA := $$(JAVA)
-    $1_OUTPUT_DIRNAME := api
-  else
-    $1_JAVA := $$(JAVA_SMALL)
-    $1_OUTPUT_DIRNAME := $$($1_API_ROOT)/api/$$($1_DEST_DIR)
+SetupApiDocsGeneration = $(NamedParamsMacroTemplate)
+define SetupApiDocsGenerationBody
 
-    # Compute a relative path to core root.
-    # The non-core api javadocs need to be able to access the root of the core
-    # api directory, so for jdk/api or jre/api to get to the core api/
-    # directory we would use this
-    $1_RELATIVE_CORE_DIR := $$(call DirToDotDot, $$($1_OUTPUT_DIRNAME))/api
+  # Figure out all modules, both specified and transitive, that will be processed
+  # by javadoc.
+  $1_TRANSITIVE_MODULES := $$(call FindTransitiveDepsForModules, $$($1_MODULES))
+  $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_TRANSITIVE_MODULES))
 
-    # We need to tell javadoc the directory in which to find the core package-list
-    $1_OPTIONS += -linkoffline $$($1_RELATIVE_CORE_DIR) $$(CORE_PACKAGES_LIST_DIR)
-
-    $1_DEPS += $(CORE_PACKAGES_LIST_FILE)
+  ifeq ($$(ENABLE_FULL_DOCS), true)
+    # Tell the ModuleGraph taglet to generate html links to soon-to-be-created
+    # png files with module graphs.
+    $1_JAVA_ARGS += -DenableModuleGraph=true
   endif
 
-  $1_OPTIONS += --add-modules $$(call CommaList, $$($1_MODULES))
+  # Always include tags and basic options
+  $1_OPTIONS := $$(JAVADOC_TAGS) $$(JAVADOC_OPTIONS)
 
-  ifneq ($$($1_DISABLED_DOCLINT), )
-    # Create a string like ",-syntax,-html"
-    $1_DOCLINT_EXCEPTIONS := ,$$(call CommaList, $$(addprefix -, $$($1_DISABLED_DOCLINT)))
-  endif
-  $1_OPTIONS += -Xdoclint:all$$($1_DOCLINT_EXCEPTIONS)
+  $1_OPTIONS += -overview $$($1_OVERVIEW)
+  $1_OPTIONS += --module-source-path $$(MODULES_SOURCE_PATH)
+  $1_OPTIONS += --module $$(call CommaList, $$($1_MODULES))
 
-  ifneq ($$($1_DOCLINT_PACKAGES), )
-    $1_OPTIONS += -Xdoclint/package:$$(call CommaList, $$($1_DOCLINT_PACKAGES))
+  # Create a string like "-Xdoclint:all,-syntax,-html,..."
+  $1_OPTIONS += -Xdoclint:all,$$(call CommaList, $$(addprefix -, \
+      $$(JAVADOC_DISABLED_DOCLINT)))
+
+  ifneq ($$($$DOCROOTPARENT_FLAG), )
+    $1_OPTIONS += -Xdocrootparent $$(JAVADOC_BASE_URL)
   endif
 
-  ifeq ($$($1_DOC_TITLE), )
-    $1_DOC_TITLE := $$($1_TITLE)
+  $1_OPTIONS += -doctitle '$$($1_DOC_TITLE)'
+  $1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)'
+  $1_OPTIONS += -header '$$($1_HEADER_TITLE)'
+  $1_OPTIONS += -bottom '$$($1_BOTTOM_TEXT)'
+  ifeq ($$(IS_DRAFT), true)
+    $1_OPTIONS += -top '$$($1_TOP_TEXT)'
   endif
-  $1_OPTIONS += -doctitle '$$($1_DOC_TITLE)'
-
-  ifeq ($$($1_WINDOW_TITLE), )
-    $1_WINDOW_TITLE := $$(strip $$(subst &trade;,, $$($1_TITLE)))
-  endif
-  $1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)$$(DRAFT_WINDOW_TITLE_MARKER)'
-
-  ifeq ($$($1_HEADER_TITLE), )
-    $1_HEADER_TITLE := $$(strip $$(subst &trade;,, $$($1_TITLE)))
-  endif
-  $1_OPTIONS += -header '<strong>$$($1_HEADER_TITLE)</strong>$$(DRAFT_MARKER)'
-
-  ifneq ($$($1_EXTRA_TOP), )
-    $1_OPTIONS += -top '$$($1_EXTRA_TOP)'
-  endif
-
-  ifeq ($$($1_BOTTOM_TEXT), )
-    $1_BOTTOM_TEXT := $(COMMON_BOTTOM_TEXT)
-  endif
-  $1_BOTTOM := $$(call GenerateBottom, $$($1_FIRST_COPYRIGHT_YEAR), \
-      $$($1_BOTTOM_COPYRIGHT_URL), $$($1_BOTTOM_TEXT))
-  $1_OPTIONS += -bottom '$$($1_BOTTOM)$$(DRAFT_MARKER)'
-
-  ifneq ($$($1_OVERVIEW), )
-    $1_OPTIONS += -overview $$($1_OVERVIEW)
-    $1_DEPS +=  $$($1_OVERVIEW)
-  endif
-
-  ifneq ($$($1_SPLIT_INDEX), )
-    $1_OPTIONS += -splitIndex
-  endif
-
-  ifneq ($$($DOCROOTPARENT_FLAG), )
-    $1_OPTIONS += -Xdocrootparent $(JAVADOC_BASE_URL)
-  endif
-
-  $1_VARDEPS := $$($1_OPTIONS) $$($1_PACKAGES)
-  $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
-       $$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps)
 
   # Do not store debug level options in VARDEPS.
   ifneq ($$(LOG_LEVEL), trace)
-    $1_OPTIONS += -quiet
+    $1_LOG_OPTION += -quiet
   else
-    $1_OPTIONS += -verbose
+    $1_LOG_OPTION += -verbose
   endif
 
-  $1_PACKAGE_DEPS := $$(call CacheFind, $$(wildcard $$(foreach p, \
-      $$(subst .,/,$$(strip $$($1_PACKAGES))), \
-      $$(addsuffix /$$p, $$(wildcard $$(JAVADOC_SOURCE_DIRS))))))
+  $1_VARDEPS := $$($1_JAVA_ARGS) $$($1_OPTIONS) $$(MODULES_SOURCE_PATH) \
+      $$($1_ALL_MODULES)
+  $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
+      $$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps)
 
-  # If there are many packages, use an @-file...
-  ifneq ($$(word 17, $$($1_PACKAGES)), )
-    $1_PACKAGES_FILE := $$(SUPPORT_OUTPUTDIR)/docs/$1.packages
-    $1_PACKAGES_ARG := @$$($1_PACKAGES_FILE)
-  else
-    $1_PACKAGES_ARG := $$($1_PACKAGES)
+  # Get a list of all files in all the source dirs for all included modules
+  $1_SOURCE_DEPS := $$(call CacheFind, $$(wildcard $$(foreach module, \
+      $$($1_ALL_MODULES), $$(call FindModuleSrcDirs, $$(module)))))
+
+  # Javadoc creates a lot of files but use index.html as a marker
+  $$($1_TARGET_DIR)/index.html: $$(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) \
+      $$($1_SOURCE_DEPS) $$($1_OVERVIEW)
+	$$(call LogWarn, Generating $$($1_NAME) API javadoc for \
+	    $$(words $$($1_ALL_MODULES)) modules)
+	$$(call LogInfo, Javadoc modules: $$($1_ALL_MODULES))
+	$$(call MakeDir, $$($1_TARGET_DIR))
+	$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/docs/$1, \
+	    $$(JAVA) -Djava.awt.headless=true $$($1_JAVA_ARGS) \
+	        $$(NEW_JAVADOC) -d $$($1_TARGET_DIR) \
+	        $$(JAVADOC_TAGS) $$($1_OPTIONS) $$($1_LOG_OPTION))
+
+  $1_JAVADOC_TARGETS := $$($1_TARGET_DIR)/index.html
+
+  ifeq ($$(ENABLE_FULL_DOCS), true)
+    # We have asked ModuleGraph to generate links to png files. Now we must
+    # produce the png files.
+
+    # Locate which modules has the @moduleGraph tag in their module-info.java
+    $1_MODULES_NEEDING_GRAPH := $$(strip $$(foreach m, $$($1_ALL_MODULES), \
+      $$(if $$(shell $$(GREP) -e @moduleGraph \
+          $$(wildcard $$(addsuffix /module-info.java, \
+          $$(call FindModuleSrcDirs, $$m)))), \
+        $$m) \
+    ))
+
+    # First we run the GenGraph tool. It will query the module structure of the
+    # running JVM and output .dot files for all existing modules.
+    GENGRAPHS_PROPS := \
+        $$(JDK_TOPDIR)/make/src/classes/build/tools/jigsaw/javadoc-graphs.properties
+
+    $1_GENGRAPHS_DIR := $$(SUPPORT_OUTPUTDIR)/docs/$1-gengraphs
+    $1_GENGRAPHS_MARKER := $$($1_GENGRAPHS_DIR)/_gengraphs_run.marker
+
+    $$($1_GENGRAPHS_MARKER): $$(BUILD_JIGSAW_TOOLS) $$(GENGRAPHS_PROPS)
+	$$(call LogInfo, Running gengraphs for $$($1_NAME) API documentation)
+	$$(call MakeDir, $$($1_GENGRAPHS_DIR))
+	$$(call ExecuteWithLog, $$($1_GENGRAPHS_DIR)/gengraphs, \
+	    $$(TOOL_GENGRAPHS) --spec --output $$($1_GENGRAPHS_DIR) \
+	    --dot-attributes $$(GENGRAPHS_PROPS) && \
+	    $$(TOUCH) $$($1_GENGRAPHS_MARKER))
+
+    # For each module needing a graph, create a png file from the dot file
+    # generated by the GenGraphs tool and store it in the target dir.
+    # They will depend on $1_GENGRAPHS_MARKER, and will be added to $1.
+    $$(foreach m, $$($1_MODULES_NEEDING_GRAPH), \
+      $$(eval $$(call setup_gengraph_dot_to_png,$1,$$m)) \
+    )
   endif
-
-  # The index.html which is a marker for all the output from javadoc.
-  $1_INDEX_FILE := $$(JAVADOC_OUTPUTDIR)/$$($1_OUTPUT_DIRNAME)/index.html
-
-  # Rule for actually running javadoc
-  $$($1_INDEX_FILE): $$(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) $$($1_PACKAGE_DEPS) $$($1_DEPS)
-	$$(call LogWarn, Generating Javadoc from $$(words $$($1_PACKAGES)) package(s) for $$($1_OUTPUT_DIRNAME))
-	$$(call MakeDir, $$(@D))
-        ifneq ($$($1_PACKAGES_FILE), )
-	  $$(eval $$(call ListPathsSafely, $1_PACKAGES, $$($1_PACKAGES_FILE)))
-        endif
-	$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/docs/$1.javadoc, \
-	    $$($1_JAVA) -Djava.awt.headless=true -DenableModuleGraph=$(ENABLE_MODULE_GRAPH) \
-		$(NEW_JAVADOC) -d $$(@D) \
-	        $$(DEFAULT_JAVADOC_TAGS) $$(DEFAULT_JAVADOC_OPTIONS) \
-	        --module-source-path $$(call PathList, $$(JAVADOC_SOURCE_DIRS)) \
-	        $$($1_OPTIONS) $$($1_PACKAGES_ARG))
-
-  # The output returned will be the index.html file
-  $1 := $$($1_INDEX_FILE)
 endef
 
 ################################################################################
+# Setup generation of the JDK API documentation (javadoc + modulegraph)
 
-$(eval $(call SetupJavadocGeneration, coredocs, \
-    MODULES := java.se.ee, \
-    PACKAGES := $(CORE_PACKAGES), \
-    IS_CORE := TRUE, \
-    OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html, \
-    WINDOW_TITLE := Java Platform SE $(VERSION_SPECIFICATION), \
-    HEADER_TITLE := Java&trade;&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;$(VERSION_SPECIFICATION), \
-    DOC_TITLE := Java&trade; Platform$(COMMA) Standard Edition \
-      $(VERSION_SPECIFICATION)<br>API Specification, \
-    FIRST_COPYRIGHT_YEAR := 1993, \
-    DISABLED_DOCLINT := accessibility html missing syntax, \
-    DOCLINT_PACKAGES := -org.omg.* jdk.internal.logging.*, \
-    SPLIT_INDEX := TRUE, \
-    BOTTOM_COPYRIGHT_URL := $(CORE_BOTTOM_COPYRIGHT_URL), \
-    BOTTOM_TEXT := $(CORE_BOTTOM_TEXT), \
-    EXTRA_TOP := $(EARLYACCESS_TOP), \
+# All modules to have docs generated by docs-jdk-api target
+JDK_JAVADOC_MODULES := $(sort $(DOCS_MODULES))
+
+JDK_JAVADOC_OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html
+
+$(eval $(call SetupApiDocsGeneration, JDK_API, \
+    MODULES := $(JDK_JAVADOC_MODULES), \
+    NAME := JDK, \
+    TARGET_DIR := $(JAVADOC_OUTPUTDIR)/api, \
+    OVERVIEW := $(JDK_JAVADOC_OVERVIEW), \
+    DOC_TITLE := $(JDK_JAVADOC_DOC_TITLE), \
+    WINDOW_TITLE := $(JAVADOC_WINDOW_TITLE), \
+    HEADER_TITLE := $(JAVADOC_HEADER_TITLE), \
+    BOTTOM_TEXT := $(JAVADOC_BOTTOM), \
+    TOP_TEXT := $(JAVADOC_TOP), \
 ))
 
-TARGETS += $(coredocs)
+# Targets generated are returned in JDK_API_JAVADOC_TARGETS and
+# JDK_API_MODULEGRAPH_TARGETS.
 
 ################################################################################
+# Setup generation of the Java SE API documentation (javadoc + modulegraph)
 
-$(eval $(call SetupJavadocGeneration, docletapi, \
-    MODULES := jdk.javadoc, \
-    PACKAGES := \
-        jdk.javadoc.doclet, \
-    API_ROOT := jdk, \
-    DEST_DIR := javadoc/doclet, \
-    TITLE := Doclet API, \
-    FIRST_COPYRIGHT_YEAR := 1993, \
+# The Java SE module scope is just java.se.ee and it's transitive modules.
+JAVASE_JAVADOC_MODULES := java.se.ee
+
+JAVASE_JAVADOC_OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html
+
+$(eval $(call SetupApiDocsGeneration, JAVASE_API, \
+    MODULES := $(JAVASE_JAVADOC_MODULES), \
+    NAME := Java SE, \
+    TARGET_DIR := $(IMAGES_OUTPUTDIR)/javase-docs/api, \
+    OVERVIEW := $(JAVASE_JAVADOC_OVERVIEW), \
+    DOC_TITLE := $(JAVASE_JAVADOC_DOC_TITLE), \
+    WINDOW_TITLE := $(JAVADOC_WINDOW_TITLE), \
+    HEADER_TITLE := $(JAVADOC_HEADER_TITLE), \
+    BOTTOM_TEXT := $(JAVADOC_BOTTOM), \
+    TOP_TEXT := $(JAVADOC_TOP), \
 ))
 
-TARGETS += $(docletapi)
+# Targets generated are returned in JAVASE_API_JAVADOC_TARGETS and
+# JAVASE_API_MODULEGRAPH_TARGETS.
 
 ################################################################################
-
-$(eval $(call SetupJavadocGeneration, old-docletapi, \
-    MODULES := jdk.javadoc, \
-    PACKAGES := com.sun.javadoc, \
-    API_ROOT := jdk, \
-    DEST_DIR := javadoc/old/doclet, \
-    TITLE := Doclet API, \
-    FIRST_COPYRIGHT_YEAR := 1993, \
-))
-
-TARGETS += $(old-docletapi)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, tagletapi, \
-    MODULES := jdk.javadoc, \
-    PACKAGES := com.sun.tools.doclets, \
-    API_ROOT := jdk, \
-    DEST_DIR := javadoc/old/taglet, \
-    TITLE := Taglet API, \
-    FIRST_COPYRIGHT_YEAR := 1993, \
-))
-
-TARGETS += $(tagletapi)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, domapi, \
-    MODULES := \
-        java.xml \
-        jdk.xml.dom, \
-    PACKAGES := \
-        org.w3c.dom \
-        org.w3c.dom.bootstrap \
-        org.w3c.dom.ls \
-        org.w3c.dom.ranges \
-        org.w3c.dom.traversal \
-        org.w3c.dom.html \
-        org.w3c.dom.stylesheets \
-        org.w3c.dom.css \
-        org.w3c.dom.events \
-        org.w3c.dom.views, \
-    API_ROOT := jre, \
-    DEST_DIR := plugin/dom, \
-    TITLE := Common DOM API, \
-    FIRST_COPYRIGHT_YEAR := 2005, \
-    DISABLED_DOCLINT := accessibility html missing, \
-    SPLIT_INDEX := TRUE, \
-))
-
-TARGETS += $(domapi)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, jdi, \
-    MODULES := jdk.jdi, \
-    PACKAGES := \
-        com.sun.jdi \
-        com.sun.jdi.event \
-        com.sun.jdi.request \
-        com.sun.jdi.connect \
-        com.sun.jdi.connect.spi, \
-    API_ROOT := jdk, \
-    DEST_DIR := jpda/jdi, \
-    OVERVIEW := $(JDK_TOPDIR)/src/jdk.jdi/share/classes/jdi-overview.html, \
-    TITLE := Java&trade; Debug Interface, \
-    FIRST_COPYRIGHT_YEAR := 1999, \
-    DISABLED_DOCLINT := accessibility missing syntax, \
-    SPLIT_INDEX := TRUE, \
-))
-
-TARGETS += $(jdi)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, jaas, \
-    MODULES := jdk.security.auth, \
-    PACKAGES := \
-        com.sun.security.auth \
-        com.sun.security.auth.callback \
-        com.sun.security.auth.login \
-        com.sun.security.auth.module, \
-    API_ROOT := jre, \
-    DEST_DIR := security/jaas/spec, \
-    OVERVIEW := $(JDK_TOPDIR)/src/jdk.security.auth/share/classes/jaas-overview.html, \
-    TITLE := Java&trade; Authentication and Authorization Service, \
-    FIRST_COPYRIGHT_YEAR := 1998, \
-    DISABLED_DOCLINT := missing, \
-))
-
-TARGETS += $(jaas)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, jgss, \
-    MODULES := jdk.security.jgss, \
-    PACKAGES := com.sun.security.jgss, \
-    API_ROOT := jre, \
-    DEST_DIR := security/jgss/spec, \
-    OVERVIEW := $(JDK_TOPDIR)/src/java.security.jgss/share/classes/jgss-overview.html, \
-    TITLE := Java&trade; GSS-API Utilities, \
-    FIRST_COPYRIGHT_YEAR := 2000, \
-))
-
-TARGETS += $(jgss)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, smartcardio, \
-    MODULES := java.smartcardio, \
-    PACKAGES := javax.smartcardio, \
-    API_ROOT := jre, \
-    DEST_DIR := security/smartcardio/spec, \
-    TITLE := Java&trade; Smart Card I/O, \
-    FIRST_COPYRIGHT_YEAR := 2005, \
-))
-
-TARGETS += $(smartcardio)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, httpserver, \
-    MODULES := jdk.httpserver, \
-    PACKAGES := \
-        com.sun.net.httpserver \
-        com.sun.net.httpserver.spi, \
-    API_ROOT := jre, \
-    DEST_DIR := net/httpserver/spec, \
-    TITLE := Java&trade; HTTP Server, \
-    FIRST_COPYRIGHT_YEAR := 2005, \
-    DISABLED_DOCLINT := accessibility missing syntax, \
-))
-
-TARGETS += $(httpserver)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, httpclient, \
-    MODULES := jdk.incubator.httpclient, \
-    PACKAGES := \
-        jdk.incubator.http, \
-    API_ROOT := jre, \
-    DEST_DIR := incubator/httpclient/spec, \
-    TITLE := Java&trade; HTTP Client API (incubator module), \
-    FIRST_COPYRIGHT_YEAR := 2015, \
-    DISABLED_DOCLINT := accessibility missing syntax, \
-))
-
-TARGETS += $(httpclient)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, jsobject, \
-    MODULES := jdk.jsobject, \
-    PACKAGES := netscape.javascript, \
-    API_ROOT := jre, \
-    DEST_DIR := plugin/jsobject, \
-    FIRST_COPYRIGHT_YEAR := 1993, \
-    TITLE := Java&trade; JSObject Doc, \
-))
-
-TARGETS += $(jsobject)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, mgmt, \
-    MODULES := jdk.management, \
-    PACKAGES := com.sun.management, \
-    API_ROOT := jre, \
-    DEST_DIR := management/extension, \
-    OVERVIEW := $(JDK_TOPDIR)/src/java.management/share/classes/mgmt-overview.html, \
-    TITLE := Monitoring and Management Interface for the Java&trade; Platform, \
-    FIRST_COPYRIGHT_YEAR := 2003, \
-    DISABLED_DOCLINT := accessibility missing reference, \
-))
-
-TARGETS += $(mgmt)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, attach, \
-    MODULES := jdk.attach, \
-    PACKAGES := \
-        com.sun.tools.attach \
-        com.sun.tools.attach.spi, \
-    API_ROOT := jdk, \
-    DEST_DIR := attach/spec, \
-    TITLE := Attach API, \
-    FIRST_COPYRIGHT_YEAR := 2005, \
-    DISABLED_DOCLINT := reference, \
-))
-
-TARGETS += $(attach)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, jconsole, \
-    MODULES := jdk.jconsole, \
-    PACKAGES := com.sun.tools.jconsole, \
-    API_ROOT := jdk, \
-    DEST_DIR := jconsole/spec, \
-    TITLE := JConsole API, \
-    FIRST_COPYRIGHT_YEAR := 2006, \
-))
-
-TARGETS += $(jconsole)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, jshellapi, \
-    MODULES := jdk.jshell, \
-    PACKAGES := \
-        jdk.jshell \
-        jdk.jshell.spi \
-        jdk.jshell.execution \
-        jdk.jshell.tool, \
-    API_ROOT := jdk, \
-    DEST_DIR := jshell, \
-    TITLE := JShell API, \
-    FIRST_COPYRIGHT_YEAR := 2015, \
-    SPLIT_INDEX := TRUE, \
-))
-
-TARGETS += $(jshellapi)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, treeapi, \
-    MODULES := jdk.compiler, \
-    PACKAGES := \
-        com.sun.source.doctree \
-        com.sun.source.tree \
-        com.sun.source.util, \
-    API_ROOT := jdk, \
-    DEST_DIR := javac/tree, \
-    TITLE := Compiler Tree API, \
-    FIRST_COPYRIGHT_YEAR := 2005, \
-    SPLIT_INDEX := TRUE, \
-))
-
-TARGETS += $(treeapi)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, nashornapi, \
-    MODULES := jdk.scripting.nashorn, \
-    PACKAGES := \
-        jdk.nashorn.api.scripting \
-        jdk.nashorn.api.tree, \
-    API_ROOT := jdk, \
-    DEST_DIR := nashorn, \
-    TITLE := Nashorn API, \
-    FIRST_COPYRIGHT_YEAR := 2014, \
-    SPLIT_INDEX := TRUE, \
-))
-
-TARGETS += $(nashornapi)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, dynalinkapi, \
-    MODULES := jdk.dynalink, \
-    PACKAGES := \
-        jdk.dynalink \
-        jdk.dynalink.beans \
-        jdk.dynalink.linker \
-        jdk.dynalink.linker.support \
-        jdk.dynalink.support, \
-    API_ROOT := jdk, \
-    DEST_DIR := dynalink, \
-    TITLE := Dynalink API, \
-    FIRST_COPYRIGHT_YEAR := 2015, \
-))
-
-TARGETS += $(dynalinkapi)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, sctp, \
-    MODULES := jdk.sctp, \
-    PACKAGES := com.sun.nio.sctp, \
-    API_ROOT := jre, \
-    DEST_DIR := nio/sctp/spec, \
-    TITLE := SCTP API, \
-    FIRST_COPYRIGHT_YEAR := 2009, \
-))
-
-TARGETS += $(sctp)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, jaccess, \
-    MODULES := jdk.accessibility, \
-    PACKAGES := com.sun.java.accessibility.util, \
-    API_ROOT := jre, \
-    DEST_DIR := accessibility/jaccess/spec, \
-    TITLE := JACCESS API, \
-    FIRST_COPYRIGHT_YEAR := 2002, \
-))
-
-TARGETS += $(jaccess)
-
-################################################################################
-
-$(eval $(call SetupJavadocGeneration, jdknet, \
-    MODULES := jdk.net, \
-    PACKAGES := jdk.net, \
-    API_ROOT := jre, \
-    DEST_DIR := net/socketoptions/spec, \
-    TITLE := jdk.net API, \
-    FIRST_COPYRIGHT_YEAR := 2014, \
-    DISABLED_DOCLINT := missing, \
-))
-
-TARGETS += $(jdknet)
-
-################################################################################
-# Copy JDWP html file
+# Copy targets
 
 JDWP_HTML := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
 
@@ -705,9 +354,6 @@
 
 COPY_TARGETS += $(COPY_JDWP_HTML)
 
-################################################################################
-# Copy JVMTI html file
-
 # Pick jvmti.html from any jvm variant, they are all the same.
 JVMTI_HTML := $(firstword \
     $(wildcard $(HOTSPOT_OUTPUTDIR)/variant-*/gensrc/jvmtifiles/jvmti.html))
@@ -722,41 +368,17 @@
 ################################################################################
 # Optional target which bundles all generated javadocs into a zip archive.
 
-JAVADOC_ARCHIVE_NAME := jdk-$(VERSION_STRING)-docs.zip
-JAVADOC_ARCHIVE_ASSEMBLY_DIR := $(SUPPORT_OUTPUTDIR)/docs/zip-docs
-JAVADOC_ARCHIVE_DIR := $(OUTPUT_ROOT)/bundles
-JAVADOC_ARCHIVE := $(JAVADOC_ARCHIVE_DIR)/$(JAVADOC_ARCHIVE_NAME)
+JAVADOC_ZIP_NAME := jdk-$(VERSION_STRING)-docs.zip
+JAVADOC_ZIP_FILE := $(OUTPUT_ROOT)/bundles/$(JAVADOC_ZIP_NAME)
 
-$(JAVADOC_ARCHIVE): $(TARGETS) $(COPY_TARGETS)
-	$(call LogInfo, Compressing javadoc to single $(JAVADOC_ARCHIVE_NAME))
-	$(MKDIR) -p $(JAVADOC_ARCHIVE_DIR)
-	$(RM) -r $(JAVADOC_ARCHIVE_ASSEMBLY_DIR)
-	$(MKDIR) -p $(JAVADOC_ARCHIVE_ASSEMBLY_DIR)
-	all_roots=`$(FIND) $(JAVADOC_OUTPUTDIR) | $(GREP) index.html | grep -v old/doclet`; \
-	pushd $(JAVADOC_ARCHIVE_ASSEMBLY_DIR); \
-	for index_file in $${all_roots} ; do \
-	  target_dir=`dirname $${index_file}`; \
-	  name=`$(ECHO) $${target_dir} | $(SED) "s;/spec;;" | $(SED) "s;.*/;;"`; \
-	  $(LN) -s $${target_dir}  $${name}; \
-	done; \
-	$(ZIPEXE) -q -r $(JAVADOC_ARCHIVE) * ; \
-	popd ;
+$(eval $(call SetupZipArchive, BUILD_JAVADOC_ZIP, \
+  SRC := $(JAVADOC_OUTPUTDIR), \
+  ZIP := $(JAVADOC_ZIP_FILE), \
+  EXTRA_DEPS := $(JDK_API_JAVADOC_TARGETS) $(JDK_API_MODULEGRAPH_TARGETS) \
+      $(COPY_TARGETS), \
+))
 
-ZIP_TARGETS += $(JAVADOC_ARCHIVE)
-
-################################################################################
-# generate .dot files for module graphs
-
-JAVADOC_MODULE_GRAPHS_DIR := $(SUPPORT_OUTPUTDIR)/docs/module-graphs
-JAVADOC_MODULE_GRAPHS := $(JAVADOC_MODULE_GRAPHS_DIR)/java.se.dot
-JAVADOC_MODULE_GRAPHS_PROPS := $(JDK_TOPDIR)/make/src/classes/build/tools/jigsaw/javadoc-graphs.properties
-
-$(JAVADOC_MODULE_GRAPHS): $(BUILD_JIGSAW_TOOLS) $(JAVADOC_MODULE_GRAPHS_PROPS)
-	$(MKDIR) -p $(@D)
-	$(TOOL_GENGRAPHS) --spec --output $(JAVADOC_MODULE_GRAPHS_DIR) \
-	    --dot-attributes $(JAVADOC_MODULE_GRAPHS_PROPS)
-
-MODULE_GRAPH_TARGETS += $(JAVADOC_MODULE_GRAPHS)
+ZIP_TARGETS += $(BUILD_JAVADOC_ZIP)
 
 ################################################################################
 
@@ -765,14 +387,20 @@
 
 ################################################################################
 
-docs-module-graphs: $(MODULE_GRAPH_TARGETS) 
+docs-jdk-api-javadoc: $(JDK_API_JAVADOC_TARGETS)
 
-docs-javadoc: $(TARGETS)
+docs-jdk-api-modulegraph: $(JDK_API_MODULEGRAPH_TARGETS)
+
+docs-javase-api-javadoc: $(JAVASE_API_JAVADOC_TARGETS)
+
+docs-javase-api-modulegraph: $(JAVASE_API_MODULEGRAPH_TARGETS)
 
 docs-copy: $(COPY_TARGETS)
 
 docs-zip: $(ZIP_TARGETS)
 
-all: docs-module-graphs docs-javadoc docs-copy docs-zip
+all: docs-jdk-api-javadoc docs-jdk-api-modulegraph docs-javase-api-javadoc \
+    docs-javase-api-modulegraph docs-copy docs-zip
 
-.PHONY: default all docs-module-graphs docs-javadoc docs-copy docs-zip
+.PHONY: default all docs-jdk-api-javadoc docs-jdk-api-modulegraph \
+    docs-javase-api-javadoc docs-javase-api-modulegraph docs-copy docs-zip
--- a/make/Main.gmk	Thu Apr 20 18:14:03 2017 +0000
+++ b/make/Main.gmk	Fri Apr 21 03:33:47 2017 +0000
@@ -272,15 +272,12 @@
     $(HOTSPOT_VARIANT_LIBS_TARGETS) hotspot-jsig hotspot-ide-project
 
 ################################################################################
-# Build demos and samples targets
+# Build demos targets
 
 demos-jdk:
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
 
-samples-jdk:
-	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
-
-ALL_TARGETS += demos-jdk samples-jdk
+ALL_TARGETS += demos-jdk
 
 ################################################################################
 # Jigsaw specific data and analysis targets.
@@ -363,11 +360,19 @@
 ################################################################################
 # Docs targets
 
-docs-module-graphs:
-	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-module-graphs)
+# If building full docs, to complete docs-*-api we need both the javadoc and
+# modulegraph targets.
+docs-jdk-api-javadoc:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-jdk-api-javadoc)
 
-docs-javadoc:
-	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-javadoc)
+docs-jdk-api-modulegraph:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-jdk-api-modulegraph)
+
+docs-javase-api-javadoc:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-javase-api-javadoc)
+
+docs-javase-api-modulegraph:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-javase-api-modulegraph)
 
 docs-copy:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-copy)
@@ -378,7 +383,9 @@
 update-build-docs:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f UpdateBuildDocs.gmk)
 
-ALL_TARGETS += docs-module-graphs docs-javadoc docs-copy docs-zip update-build-docs
+ALL_TARGETS += docs-jdk-api-javadoc docs-jdk-api-modulegraph \
+    docs-javase-api-javadoc docs-javase-api-modulegraph docs-copy docs-zip \
+    update-build-docs
 
 ################################################################################
 # Cross compilation support
@@ -759,7 +766,7 @@
 
   release-file: create-source-revision-tracker
 
-  jdk-image: jmods zip-source demos samples release-file
+  jdk-image: jmods zip-source demos release-file
   jre-image: jmods release-file
   symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS)
 
@@ -775,14 +782,18 @@
 
   bootcycle-images: jdk-image
 
-  docs-module-graphs: exploded-image buildtools-modules 
+  docs-jdk-api-javadoc: $(GENSRC_TARGETS) rmic
 
-  docs-javadoc: $(GENSRC_TARGETS) rmic
+  docs-javase-api-javadoc: $(GENSRC_TARGETS) rmic
+
+  docs-jdk-api-modulegraph: exploded-image buildtools-modules
+
+  docs-javase-api-modulegraph: exploded-image buildtools-modules
 
   # The gensrc step for jdk.jdi creates an html file that is used by docs-copy.
   docs-copy: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc
 
-  docs-zip: docs-javadoc docs-copy
+  docs-zip: docs-jdk docs-copy
 
   test: jdk-image test-image
 
@@ -890,8 +901,6 @@
 
 demos: demos-jdk
 
-samples: samples-jdk
-
 # The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
 exploded-image-base: $(ALL_MODULES)
 exploded-image: exploded-image-base release-file
@@ -903,6 +912,22 @@
 
 create-buildjdk: create-buildjdk-copy create-buildjdk-interim-image
 
+docs-jdk-api: docs-jdk-api-javadoc
+docs-javase-api: docs-javase-api-javadoc
+
+# If we're building full docs, we must also generate the module graphs to
+# get non-broken api documentation.
+ifeq ($(ENABLE_FULL_DOCS), true)
+  docs-jdk-api: docs-jdk-api-modulegraph
+  docs-javase-api: docs-javase-api-modulegraph
+endif
+
+docs-jdk: docs-jdk-api
+docs-javase: docs-javase-api
+
+# alias for backwards compatibility
+docs-javadoc: docs-jdk-api
+
 mac-bundles: mac-bundles-jdk
 
 # The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
@@ -934,7 +959,7 @@
 endif
 
 # This target builds the documentation image
-docs-image: docs-module-graphs docs-javadoc docs-copy
+docs-image: docs-jdk docs-copy
 
 # This target builds the test image
 test-image: prepare-test-image test-image-hotspot-jtreg-native \
@@ -948,9 +973,10 @@
 
 ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-gensrc gensrc gendata \
     copy java rmic libs launchers jmods \
-    jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples \
+    jdk.jdwp.agent-gensrc $(ALL_MODULES) demos \
     exploded-image-base exploded-image \
-    create-buildjdk mac-bundles product-images \
+    create-buildjdk docs-jdk-api docs-javase-api docs-jdk docs-javase \
+    docs-javadoc mac-bundles product-images \
     profiles profiles-images \
     docs-image test-image all-images \
     all-bundles
--- a/make/common/MakeBase.gmk	Thu Apr 20 18:14:03 2017 +0000
+++ b/make/common/MakeBase.gmk	Fri Apr 21 03:33:47 2017 +0000
@@ -672,9 +672,9 @@
   # Param 1 - Dirs to find in
   # Param 2 - (optional) specialization. Normally "-a \( ... \)" expression.
   define CacheFind
-      $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \
-    $(shell $(FIND) $1 \( -type f -o -type l \) $2), \
-        $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE)))
+    $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \
+      $(if $(wildcard $1), $(shell $(FIND) $1 \( -type f -o -type l \) $2)), \
+      $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE)))
   endef
 
 else
--- a/make/common/Modules.gmk	Thu Apr 20 18:14:03 2017 +0000
+++ b/make/common/Modules.gmk	Fri Apr 21 03:33:47 2017 +0000
@@ -40,6 +40,7 @@
 JRE_TOOL_MODULES :=
 UPGRADEABLE_MODULES :=
 AGGREGATOR_MODULES :=
+DOCS_MODULES :=
 
 # Hook to include the corresponding custom file, if present.
 $(eval $(call IncludeCustomExtension, , common/Modules.gmk))
@@ -58,12 +59,12 @@
     java.security.sasl \
     java.xml \
     jdk.httpserver \
+    jdk.internal.vm.ci \
     jdk.management \
     jdk.management.agent \
     jdk.net \
     jdk.sctp \
     jdk.unsupported \
-    jdk.internal.vm.ci \
     #
 
 # to be deprivileged
@@ -96,7 +97,6 @@
 
 PLATFORM_MODULES += \
     java.compiler \
-    jdk.incubator.httpclient \
     java.scripting \
     java.security.jgss \
     java.smartcardio \
@@ -105,32 +105,79 @@
     java.xml.crypto \
     jdk.accessibility \
     jdk.charsets \
+    jdk.crypto.cryptoki \
     jdk.crypto.ec \
-    jdk.crypto.cryptoki \
     jdk.dynalink \
+    jdk.incubator.httpclient \
+    jdk.internal.vm.compiler \
     jdk.jsobject \
     jdk.localedata \
     jdk.naming.dns \
     jdk.scripting.nashorn \
     jdk.security.auth \
     jdk.security.jgss \
-    jdk.internal.vm.compiler \
     jdk.xml.dom \
     jdk.zipfs \
     #
 
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  PLATFORM_MODULES += jdk.crypto.mscapi
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+  PLATFORM_MODULES += jdk.crypto.ucrypto
+endif
+
 JRE_TOOL_MODULES += \
     jdk.jdwp.agent \
     jdk.pack \
     jdk.scripting.nashorn.shell \
     #
 
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  PLATFORM_MODULES += jdk.crypto.mscapi
-endif
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-  PLATFORM_MODULES += jdk.crypto.ucrypto
-endif
+################################################################################
+
+# DOCS_MODULES defines the root modules for javadoc generation.
+# All of their `require transitive` modules directly and indirectly will be included.
+DOCS_MODULES += \
+    java.se.ee \
+    java.smartcardio \
+    jdk.accessibility \
+    jdk.attach \
+    jdk.charsets \
+    jdk.compiler \
+    jdk.crypto.cryptoki \
+    jdk.crypto.ec \
+    jdk.dynalink \
+    jdk.editpad \
+    jdk.httpserver \
+    jdk.incubator.httpclient \
+    jdk.jartool \
+    jdk.javadoc \
+    jdk.jcmd \
+    jdk.jconsole \
+    jdk.jdeps \
+    jdk.jdi \
+    jdk.jdwp.agent \
+    jdk.jlink \
+    jdk.jsobject \
+    jdk.jshell \
+    jdk.jstatd \
+    jdk.localedata \
+    jdk.management \
+    jdk.management.agent \
+    jdk.naming.dns \
+    jdk.naming.rmi \
+    jdk.net \
+    jdk.pack \
+    jdk.policytool \
+    jdk.rmic \
+    jdk.scripting.nashorn \
+    jdk.sctp \
+    jdk.security.auth \
+    jdk.security.jgss \
+    jdk.xml.dom \
+    jdk.zipfs \
+    #
 
 # These modules are included in the interim image which is used to run profiling
 # before building the real images.
@@ -255,15 +302,15 @@
 	    ( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \
 	      $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
 	          BEGIN      { if (MODULE != "java.base") printf(" java.base"); } \
-	          /requires/ { sub(/;/, ""); \
-	                       sub(/requires/, ""); \
-	                       sub(/transitive/, ""); \
-	                       sub(/\/\/.*/, ""); \
-	                       sub(/\/\*.*\*\//, ""); \
-	                       gsub(/^ +\*.*/, ""); \
-	                       gsub(/ /, ""); \
-	                       printf(" %s", $$0) } \
-	          END        { printf("\n") }' $m \
+	          /^ *requires/ { sub(/;/, ""); \
+	                          sub(/requires/, ""); \
+	                          sub(/transitive/, ""); \
+	                          sub(/\/\/.*/, ""); \
+	                          sub(/\/\*.*\*\//, ""); \
+	                          gsub(/^ +\*.*/, ""); \
+	                          gsub(/ /, ""); \
+	                          printf(" %s", $$0) } \
+	          END           { printf("\n") }' $m \
 	    ) >> $@ $(NEWLINE))
 
 -include $(MODULE_DEPS_MAKEFILE)
@@ -281,6 +328,11 @@
             $(foreach n, $(call FindDepsForModule, $m), \
                  $(call FindDepsForModule, $n))))
 
+# Finds transitive dependencies in 3 levels for a set of modules.
+# Param 1: List of modules to find transitive deps for
+FindTransitiveDepsForModules = \
+    $(sort $(foreach m, $1, $(call FindTransitiveDepsForModule, $m)))
+
 # Upgradeable modules are those that are either defined as upgradeable or that
 # require an upradeable module.
 FindAllUpgradeableModules = \
@@ -329,6 +381,7 @@
       else ifeq ($$(classloader), ext)
         PLATFORM_MODULES += $1
       endif
+      DOCS_MODULES += $1
     else
       # Default to include in all
       JRE_MODULES += $1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/devkit/createGraphvizBundle.sh	Fri Apr 21 03:33:47 2017 +0000
@@ -0,0 +1,38 @@
+#!/bin/bash -e
+# Create a bundle in the current directory, containing what's needed to run
+# the 'dot' program from the graphviz suite by the OpenJDK build.
+
+TMPDIR=`mktemp -d -t graphvizbundle-XXXX`
+trap "rm -rf \"$TMPDIR\"" EXIT
+
+ORIG_DIR=`pwd`
+cd "$TMPDIR"
+GRAPHVIZ_VERSION=2.38.0-1
+PACKAGE_VERSION=1.1
+TARGET_PLATFORM=linux_x64
+BUNDLE_NAME=graphviz-$TARGET_PLATFORM-$GRAPHVIZ_VERSION+$PACKAGE_VERSION.tar.gz
+wget http://www.graphviz.org/pub/graphviz/stable/redhat/el6/x86_64/os/graphviz-$GRAPHVIZ_VERSION.el6.x86_64.rpm
+wget http://www.graphviz.org/pub/graphviz/stable/redhat/el6/x86_64/os/graphviz-libs-$GRAPHVIZ_VERSION.el6.x86_64.rpm
+wget http://www.graphviz.org/pub/graphviz/stable/redhat/el6/x86_64/os/graphviz-plugins-core-$GRAPHVIZ_VERSION.el6.x86_64.rpm
+wget http://www.graphviz.org/pub/graphviz/stable/redhat/el6/x86_64/os/graphviz-plugins-x-$GRAPHVIZ_VERSION.el6.x86_64.rpm
+
+mkdir graphviz
+cd graphviz
+for rpm in ../*.rpm; do
+  rpm2cpio $rpm | cpio --extract --make-directories
+done
+
+cat > dot << 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/lib64:\$LD_LIBRARY_PATH"
+exec \$this_script_dir/usr/bin/dot "\$@"
+EOF
+chmod +x dot
+export LD_LIBRARY_PATH="$TMPDIR/graphviz/usr/lib64:$LD_LIBRARY_PATH"
+# create config file
+./dot -c
+tar -cvzf ../$BUNDLE_NAME *
+cp ../$BUNDLE_NAME "$ORIG_DIR"
--- a/test/lib/jdk/test/lib/InMemoryJavaCompiler.java	Thu Apr 20 18:14:03 2017 +0000
+++ b/test/lib/jdk/test/lib/InMemoryJavaCompiler.java	Fri Apr 21 03:33:47 2017 +0000
@@ -28,7 +28,9 @@
 import java.io.OutputStream;
 
 import java.net.URI;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 
 import javax.tools.ForwardingJavaFileManager;
 import javax.tools.FileObject;
@@ -37,6 +39,7 @@
 import javax.tools.JavaFileObject;
 import javax.tools.JavaFileObject.Kind;
 import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardLocation;
 import javax.tools.ToolProvider;
 
 /**
@@ -104,11 +107,24 @@
     }
 
     private static class FileManagerWrapper extends ForwardingJavaFileManager {
-        private MemoryJavaFileObject file;
+        private static final Location PATCH_LOCATION = new Location() {
+            @Override
+            public String getName() {
+                return "patch module location";
+            }
 
-        public FileManagerWrapper(MemoryJavaFileObject file) {
+            @Override
+            public boolean isOutputLocation() {
+                return false;
+            }
+        };
+        private final MemoryJavaFileObject file;
+        private final String moduleOverride;
+
+        public FileManagerWrapper(MemoryJavaFileObject file, String moduleOverride) {
             super(getCompiler().getStandardFileManager(null, null, null));
             this.file = file;
+            this.moduleOverride = moduleOverride;
         }
 
         @Override
@@ -121,6 +137,28 @@
             }
             return file;
         }
+
+        @Override
+        public Location getLocationForModule(Location location, JavaFileObject fo) throws IOException {
+            if (fo == file && moduleOverride != null) {
+                return PATCH_LOCATION;
+            }
+            return super.getLocationForModule(location, fo);
+        }
+
+        @Override
+        public String inferModuleName(Location location) throws IOException {
+            if (location == PATCH_LOCATION) {
+                return moduleOverride;
+            }
+            return super.inferModuleName(location);
+        }
+
+        @Override
+        public boolean hasLocation(Location location) {
+            return super.hasLocation(location) || location == StandardLocation.PATCH_MODULE_PATH;
+        }
+
     }
 
     /**
@@ -148,6 +186,15 @@
     }
 
     private static CompilationTask getCompilationTask(MemoryJavaFileObject file, String... options) {
-        return getCompiler().getTask(null, new FileManagerWrapper(file), null, Arrays.asList(options), null, Arrays.asList(file));
+        List<String> opts = new ArrayList<>();
+        String moduleOverride = null;
+        for (String opt : options) {
+            if (opt.startsWith("-Xmodule:")) {
+                moduleOverride = opt.substring("-Xmodule:".length());
+            } else {
+                opts.add(opt);
+            }
+        }
+        return getCompiler().getTask(null, new FileManagerWrapper(file, moduleOverride), null, opts, null, Arrays.asList(file));
     }
 }