--- a/.hgtags-top-repo Tue Nov 18 15:25:16 2014 -0800
+++ b/.hgtags-top-repo Wed Jul 05 20:08:34 2017 +0200
@@ -282,3 +282,4 @@
723a67b0c442391447b1d8aad8b249d06d1032e8 jdk9-b37
d42c0a90afc3c66ca87543076ec9aafd4b4680de jdk9-b38
512dbbeb1730edcebfec873fc3f1455660b32000 jdk9-b39
+cf136458ee747e151a27aa9ea0c1492ea55ef3e7 jdk9-b40
--- a/Makefile Tue Nov 18 15:25:16 2014 -0800
+++ b/Makefile Wed Jul 05 20:08:34 2017 +0200
@@ -143,31 +143,37 @@
$(info . make [default] # Compile all modules in langtools, hotspot, jaxp, jaxws,)
$(info . # corba and jdk and create a runnable "exploded" image)
$(info . make all # Compile everything, all repos, docs and images)
- $(info . make images # Create complete j2sdk and j2re images)
+ $(info . make images # Create complete jdk and jre images)
+ $(info . make <phase> # Compile the specified phase and everything it depends on)
+ $(info . # (gensrc, java, copy, libs, launchers, gendata, rmic))
+ $(info . make *-only # Applies to most targets and disables compling the)
+ $(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 profiles # Create complete j2re compact profile images)
+ $(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)
$(info . make reconfigure # Rerun configure with the same arguments as last time)
- $(info . make clean # Remove all files generated by make, but not those)
- $(info . # generated by configure)
- $(info . make dist-clean # Remove all files, including configuration)
$(info . make help # Give some help on using make)
$(info . make test # Run tests, default is all tests (see TEST below))
$(info )
+ $(info Targets for cleaning)
+ $(info . make clean # Remove all files generated by make, but not those)
+ $(info . # generated by configure)
+ $(info . make dist-clean # Remove all files, including configuration)
+ $(info . make clean-<outputdir> # Remove the subdir in the output dir with the name)
+ $(info . make clean-<phase> # Remove all build results related to a certain build)
+ $(info . # phase (gensrc, java, libs, launchers))
+ $(info . make clean-<module> # Remove all build results related to a certain module)
+ $(info . make clean-<module>-<phase> # Remove all build results related to a certain)
+ $(info . # module and phase)
+ $(info )
$(info Targets for specific modules)
$(info . make <module> # Build <module> and everything it depends on. )
- $(info . make <module>-only # Build <module> only, without dependencies. This)
- $(info . # is faster but can result in incorrect build results!)
- $(info . make <module>-java # Compile java classes for <module> and everything it)
- $(info . # depends on)
- $(info . make <module>-libs # Build native libraries for <module> and everything it)
- $(info . # depends on)
- $(info . make <module>-launchers# Build native executables for <module> and everything it)
- $(info . # depends on)
- $(info . make <module>-gensrc # Execute the gensrc step for <module> and everything it)
- $(info . # depends on)
+ $(info . make <module>-<phase> # Compile the specified phase for the specified module)
+ $(info . # and everything it depends on)
+ $(info . # (gensrc, java, copy, libs, launchers, gendata, rmic))
$(info )
$(info Useful make variables)
$(info . make CONF= # Build all configurations (note, assignment is empty))
--- a/common/autoconf/boot-jdk.m4 Tue Nov 18 15:25:16 2014 -0800
+++ b/common/autoconf/boot-jdk.m4 Wed Jul 05 20:08:34 2017 +0200
@@ -305,20 +305,6 @@
AC_MSG_ERROR([Cannot continue])
fi
- # Setup proper paths for what we found
- BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
- if test ! -f "$BOOT_RTJAR"; then
- # On MacOSX it is called classes.jar
- BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
- if test -f "$BOOT_RTJAR"; then
- # Remove the ..
- BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
- fi
- fi
- BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
- BOOT_JDK="$BOOT_JDK"
- AC_SUBST(BOOT_RTJAR)
- AC_SUBST(BOOT_TOOLSJAR)
AC_SUBST(BOOT_JDK)
# Setup tools from the Boot JDK.
--- a/common/autoconf/bootcycle-spec.gmk.in Tue Nov 18 15:25:16 2014 -0800
+++ b/common/autoconf/bootcycle-spec.gmk.in Wed Jul 05 20:08:34 2017 +0200
@@ -42,13 +42,12 @@
# Override specific values to do a boot cycle build
+# Use a different Boot JDK
+BOOT_JDK := $(JDK_IMAGE_DIR)
+
# The bootcycle build has a different output directory
BUILD_OUTPUT:=@BUILD_OUTPUT@/bootcycle-build
-
-# Use a different Boot JDK
-OLD_BOOT_JDK:=$(BOOT_JDK)
-BOOT_JDK:=@BUILD_OUTPUT@/images/j2sdk-image
-BOOT_RTJAR:=$(BOOT_JDK)/jre/lib/rt.jar
+SJAVAC_SERVER_DIR:=$(subst @BUILD_OUTPUT@,$(BUILD_OUTPUT),$(SJAVAC_SERVER_DIR))
JAVA_CMD:=$(BOOT_JDK)/bin/java
JAVAC_CMD:=$(BOOT_JDK)/bin/javac
--- a/common/autoconf/compare.sh.in Tue Nov 18 15:25:16 2014 -0800
+++ b/common/autoconf/compare.sh.in Wed Jul 05 20:08:34 2017 +0200
@@ -46,6 +46,7 @@
FIND="@FIND@"
GREP="@GREP@"
JAVAP="@FIXPATH@ @BOOT_JDK@/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
+JIMAGE="@FIXPATH@ @BUILD_OUTPUT@/jdk/bin/jimage"
LDD="@LDD@"
MKDIR="@MKDIR@"
NAWK="@NAWK@"
--- a/common/autoconf/flags.m4 Tue Nov 18 15:25:16 2014 -0800
+++ b/common/autoconf/flags.m4 Wed Jul 05 20:08:34 2017 +0200
@@ -784,24 +784,24 @@
LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${JDK_OUTPUTDIR}/lib"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
LDFLAGS_JDKLIB_SUFFIX=""
else
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS} \
- -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
+ -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}"
# On some platforms (mac) the linker warns about non existing -L dirs.
# Add server first if available. Linking aginst client does not always produce the same results.
# Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
# Default to server for other variants.
if test "x$JVM_VARIANT_SERVER" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/client"
elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
else
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
fi
LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
--- a/common/autoconf/generated-configure.sh Tue Nov 18 15:25:16 2014 -0800
+++ b/common/autoconf/generated-configure.sh Wed Jul 05 20:08:34 2017 +0200
@@ -820,8 +820,6 @@
JAVAC
JAVA
BOOT_JDK
-BOOT_TOOLSJAR
-BOOT_RTJAR
JAVA_CHECK
JAVAC_CHECK
COOKED_BUILD_NUMBER
@@ -4328,7 +4326,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1415179461
+DATE_WHEN_GENERATED=1416999037
###############################################################################
#
@@ -25533,20 +25531,6 @@
as_fn_error $? "Cannot continue" "$LINENO" 5
fi
- # Setup proper paths for what we found
- BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
- if test ! -f "$BOOT_RTJAR"; then
- # On MacOSX it is called classes.jar
- BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
- if test -f "$BOOT_RTJAR"; then
- # Remove the ..
- BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
- fi
- fi
- BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
- BOOT_JDK="$BOOT_JDK"
-
-
# Setup tools from the Boot JDK.
@@ -42870,24 +42854,24 @@
LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${JDK_OUTPUTDIR}/lib"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
LDFLAGS_JDKLIB_SUFFIX=""
else
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS} \
- -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
+ -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}"
# On some platforms (mac) the linker warns about non existing -L dirs.
# Add server first if available. Linking aginst client does not always produce the same results.
# Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
# Default to server for other variants.
if test "x$JVM_VARIANT_SERVER" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/client"
elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
- else
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
+ else
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
fi
LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
--- a/common/autoconf/spec.gmk.in Tue Nov 18 15:25:16 2014 -0800
+++ b/common/autoconf/spec.gmk.in Wed Jul 05 20:08:34 2017 +0200
@@ -236,31 +236,23 @@
BUILD_OUTPUT:=@BUILD_OUTPUT@
# Colon left out to be able to override IMAGES_OUTPUTDIR for bootcycle-images
-LANGTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/langtools
-CORBA_OUTPUTDIR=$(BUILD_OUTPUT)/corba
-JAXP_OUTPUTDIR=$(BUILD_OUTPUT)/jaxp
-JAXWS_OUTPUTDIR=$(BUILD_OUTPUT)/jaxws
+SUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/support
+BUILDTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/buildtools
+MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/makesupport
+
HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
-NASHORN_OUTPUTDIR=$(BUILD_OUTPUT)/nashorn
IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/testmake
MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
-LANGTOOLS_DIST=$(LANGTOOLS_OUTPUTDIR)/dist
-CORBA_DIST=$(CORBA_OUTPUTDIR)/dist
-JAXP_DIST=$(JAXP_OUTPUTDIR)/dist
-JAXWS_DIST=$(JAXWS_OUTPUTDIR)/dist
HOTSPOT_DIST=@HOTSPOT_DIST@
-NASHORN_DIST=$(NASHORN_OUTPUTDIR)/dist
BUILD_HOTSPOT=@BUILD_HOTSPOT@
-# The boot jdk to use. These are overridden in bootcycle-spec.gmk. Make sure to keep
-# them in sync.
+# The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
+# it in sync.
BOOT_JDK:=@BOOT_JDK@
-BOOT_RTJAR:=@BOOT_RTJAR@
-BOOT_TOOLSJAR=$(BOOT_JDK)/lib/tools.jar
# When compiling Java source to be run by the boot jdk
# use these extra flags, eg -source 6 -target 6
@@ -484,13 +476,14 @@
JAVAC_FLAGS?=@JAVAC_FLAGS@
# You run the new javac using the boot jdk with $(BOOT_JDK)/bin/java $(NEW_JAVAC) ...
-INTERIM_LANGTOOLS_JAR := $(LANGTOOLS_OUTPUTDIR)/dist/interim_langtools.jar
-INTERIM_LANGTOOLS_ARGS := "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
+# Use = assignment to be able to override in bootcycle-spec.gmk
+INTERIM_LANGTOOLS_JAR = $(BUILDTOOLS_OUTPUTDIR)/interim_langtools.jar
+INTERIM_LANGTOOLS_ARGS = "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
NEW_JAVAC = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javac.Main
NEW_JAVADOC = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javadoc.Main
# The interim corba jar is needed for running rmic
-INTERIM_CORBA_JAR := $(CORBA_OUTPUTDIR)/dist/interim_corba.jar
+INTERIM_CORBA_JAR = $(BUILDTOOLS_OUTPUTDIR)/interim_corba.jar
# Base flags for RC
# Guarding this against resetting value. Legacy make files include spec multiple
@@ -695,19 +688,15 @@
OS_VERSION_MICRO:=@OS_VERSION_MICRO@
# Images directory definitions
-JDK_IMAGE_SUBDIR:=j2sdk-image
-JRE_IMAGE_SUBDIR:=j2re-image
-JDK_OVERLAY_IMAGE_SUBDIR:=j2sdk-overlay-image
-JRE_OVERLAY_IMAGE_SUBDIR:=j2re-overlay-image
+JDK_IMAGE_SUBDIR:=jdk
+JRE_IMAGE_SUBDIR:=jre
# Colon left out to be able to override output dir for bootcycle-images
JDK_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_IMAGE_SUBDIR)
JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_IMAGE_SUBDIR)
-JDK_OVERLAY_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_OVERLAY_IMAGE_SUBDIR)
-JRE_OVERLAY_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_OVERLAY_IMAGE_SUBDIR)
# Macosx bundles directory definitions
-JDK_BUNDLE_SUBDIR=j2sdk-bundle/jdk$(JDK_VERSION).jdk/Contents
-JRE_BUNDLE_SUBDIR=j2re-bundle/jre$(JDK_VERSION).jre/Contents
+JDK_BUNDLE_SUBDIR=jdk-bundle/jdk$(JDK_VERSION).jdk/Contents
+JRE_BUNDLE_SUBDIR=jre-bundle/jre$(JDK_VERSION).jre/Contents
JDK_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_BUNDLE_SUBDIR)
JRE_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_BUNDLE_SUBDIR)
--- a/common/bin/compare.sh Tue Nov 18 15:25:16 2014 -0800
+++ b/common/bin/compare.sh Wed Jul 05 20:08:34 2017 +0200
@@ -103,8 +103,8 @@
-e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \
-e thePoint -e aPoint -e setItemsPtr \
-e 'lambda\$[a-zA-Z0-9]*\$[0-9]' ${THIS_FILE} > /dev/null; then
- $JAVAP -c -constants -l -p ${OTHER_FILE} > ${OTHER_FILE}.javap
- $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
+ $JAVAP -c -constants -l -p "${OTHER_FILE}" > ${OTHER_FILE}.javap
+ $JAVAP -c -constants -l -p "${THIS_FILE}" > ${THIS_FILE}.javap
TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
$GREP '^[<>]' | \
$SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
@@ -298,7 +298,7 @@
WORK_DIR=$3
GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
- ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
+ ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" ! -name "*.jimage" \
! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \
@@ -395,8 +395,14 @@
$RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR
$MKDIR -p $THIS_UNZIPDIR
$MKDIR -p $OTHER_UNZIPDIR
- (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
- (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
+ if [ "$TYPE" = "jimage" ]
+ then
+ (cd $THIS_UNZIPDIR && $JIMAGE extract $THIS_ZIP)
+ (cd $OTHER_UNZIPDIR && $JIMAGE extract $OTHER_ZIP)
+ else
+ (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
+ (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
+ fi
# Find all archives inside and unzip them as well to compare the contents rather than
# the archives. pie.jar.pack.gz i app3.war is corrupt, skip it.
@@ -525,7 +531,7 @@
# TODO filter?
ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" \
- | $SORT | $FILTER)
+ -o -name "*.jimage" | $SORT | $FILTER)
if [ -n "$ZIPS" ]; then
echo Jar files...
@@ -633,7 +639,7 @@
if cmp $OTHER_FILE $THIS_FILE > /dev/null; then
# The files were bytewise identical.
if [ -n "$VERBOSE" ]; then
- echo " : : : : : $BIN_FILE"
+ echo " : : : : : : $BIN_FILE"
fi
return 0
fi
@@ -1136,17 +1142,8 @@
if [ "$SKIP_DEFAULT" != "true" ]; then
if [ -z "$OTHER" ]; then
- OTHER="$THIS/../$LEGACY_BUILD_DIR"
- if [ -d "$OTHER" ]; then
- OTHER="$( cd "$OTHER" && pwd )"
- else
- echo "Default old build directory does not exist:"
- echo "$OTHER"
- exit 1
- fi
- echo "Comparing to default old build:"
- echo "$OTHER"
- echo
+ echo "Nothing to compare to, set with -o"
+ exit 1
else
if [ ! -d "$OTHER" ]; then
echo "Other build directory does not exist:"
@@ -1160,90 +1157,36 @@
fi
- # Figure out the layout of the this build. Which kinds of images have been produced
- if [ -d "$THIS/install/j2sdk-image" ]; then
- THIS_J2SDK="$THIS/install/j2sdk-image"
- THIS_J2RE="$THIS/install/j2re-image"
- echo "Selecting install images in this build"
- elif [ -d "$THIS/deploy/j2sdk-image" ]; then
- THIS_J2SDK="$THIS/deploy/j2sdk-image"
- THIS_J2RE="$THIS/deploy/j2re-image"
- echo "Selecting deploy images in this build"
- elif [ -d "$THIS/images/j2sdk-image" ]; then
- THIS_J2SDK="$THIS/images/j2sdk-image"
- THIS_J2RE="$THIS/images/j2re-image"
- echo "Selecting jdk images in this build"
- fi
-
- if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
- if [ -d "$THIS/install/j2sdk-image" ]; then
- # If there is an install image, prefer that, it's also overlay
- THIS_J2SDK_OVERLAY="$THIS/install/j2sdk-image"
- THIS_J2RE_OVERLAY="$THIS/install/j2re-image"
- echo "Selecting install overlay images in this build"
- else
- THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
- THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
- echo "Selecting jdk overlay images in this build"
- fi
- fi
-
- if [ -d "$THIS/images/j2sdk-bundle" ]; then
- THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle"
- THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle"
- echo "Selecting bundles in this build"
+ # Find the common images to compare, prioritizing later build stages
+ if [ -d "$THIS/install/jdk" ] && [ -d "$OTHER/install/jdk" ]; then
+ THIS_J2SDK="$THIS/install/jdk"
+ THIS_J2RE="$THIS/install/jre"
+ OTHER_J2SDK="$OTHER/install/jdk"
+ OTHER_J2RE="$OTHER/install/jre"
+ echo "Selecting install images for compare"
+ elif [ -d "$THIS/deploy/jdk" ] && [ -d "$OTHER/deploy/jdk" ]; then
+ THIS_J2SDK="$THIS/deploy/jdk"
+ THIS_J2RE="$THIS/deploy/jre"
+ OTHER_J2SDK="$OTHER/deploy/jdk"
+ OTHER_J2RE="$OTHER/deploy/jre"
+ echo "Selecting deploy images for compare"
+ elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/images/jdk" ]; then
+ THIS_J2SDK="$THIS/images/jdk"
+ THIS_J2RE="$THIS/images/jre"
+ OTHER_J2SDK="$OTHER/images/jdk"
+ OTHER_J2RE="$OTHER/images/jre"
+ echo "Selecting jdk images for compare"
+ else
+ echo "No common images found."
+ exit 1
fi
- # Figure out the layout of the other build (old or new, normal or overlay image)
- if [ -d "$OTHER/j2sdk-image" ]; then
- if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then
- OTHER_J2SDK="$OTHER/j2sdk-image"
- OTHER_J2RE="$OTHER/j2re-image"
- echo "Selecting old-style images in other build"
- else
- OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
- OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
- echo "Selecting overlay images in other build"
- fi
- elif [ -d "$OTHER/install/j2sdk-image" ]; then
- OTHER_J2SDK="$OTHER/install/j2sdk-image"
- OTHER_J2RE="$OTHER/install/j2re-image"
- echo "Selecting install images in other build"
- elif [ -d "$OTHER/deploy/j2sdk-image" ]; then
- OTHER_J2SDK="$OTHER/deploy/j2sdk-image"
- OTHER_J2RE="$OTHER/deploy/j2re-image"
- echo "Selecting deploy images in other build"
- elif [ -d "$OTHER/images/j2sdk-image" ]; then
- OTHER_J2SDK="$OTHER/images/j2sdk-image"
- OTHER_J2RE="$OTHER/images/j2re-image"
- echo "Selecting jdk images in other build"
- fi
-
- if [ -d "$OTHER/j2sdk-bundle" ]; then
- OTHER_J2SDK_BUNDLE="$OTHER/j2sdk-bundle"
- OTHER_J2RE_BUNDLE="$OTHER/j2re-bundle"
- echo "Selecting bundles in other build"
- elif [ -d "$OTHER/images/j2sdk-bundle" ]; then
- OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle"
- OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle"
- echo "Selecting jdk bundles in other build"
- fi
-
- if [ -z "$THIS_J2SDK" ] || [ -z "$THIS_J2RE" ]; then
- if [ -z "$THIS_J2SDK_OVERLAY" ]; then
- echo "Cannot locate images for this build. Are you sure you have run 'make images'?"
- exit 1
- fi
- fi
-
- if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then
- echo "OTHER build only has an overlay image while this build does not. Nothing to compare!"
- exit 1
- fi
-
- if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
- echo "WARNING! OTHER build has bundles built while this build does not."
- echo "Skipping bundle compare!"
+ if [ -d "$THIS/images/jdk-bundle" ] && [ -d "$OTHER/images/jdk-bundle" ]; then
+ THIS_J2SDK_BUNDLE="$THIS/images/jdk-bundle"
+ THIS_J2RE_BUNDLE="$THIS/images/jre-bundle"
+ OTHER_J2SDK_BUNDLE="$OTHER/images/jdk-bundle"
+ OTHER_J2RE_BUNDLE="$OTHER/images/jre-bundle"
+ echo "Also comparing macosx bundles"
fi
if [ -d "$OTHER/images" ]; then
@@ -1266,22 +1209,13 @@
THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN"
fi
- if [ -d "$THIS/docs" ]; then
+ if [ -d "$THIS/docs" ] && [ -d "$OTHER/docs" ]; then
THIS_DOCS="$THIS/docs"
- fi
-
- if [ -d "$OTHER/docs" ]; then
OTHER_DOCS="$OTHER/docs"
- fi
-
- if [ -z "$THIS_DOCS" ]; then
+ echo "Also comparing docs"
+ else
echo "WARNING! Docs haven't been built and won't be compared."
fi
-
- if [ -z "$OTHER_DOCS" ]; then
- echo "WARNING! Other build doesn't contain docs, skipping doc compare."
- fi
-
fi
##########################################################################################
@@ -1299,27 +1233,16 @@
echo -n "J2RE "
compare_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
- if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
- echo -n "J2SDK Overlay "
- compare_dirs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
- echo -n "J2RE Overlay "
- compare_dirs $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
-
- echo -n "J2SDK Overlay "
- compare_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
- echo -n "J2RE Overlay "
- compare_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
- fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
- compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+ compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
- compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+ compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
echo -n "J2SDK Bundle "
- compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+ compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
- compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+ compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
echo -n "Docs "
@@ -1340,18 +1263,6 @@
echo -n "J2RE "
compare_permissions $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
- if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
- echo -n "J2SDK Overlay "
- compare_permissions $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
- echo -n "J2RE Overlay "
- compare_permissions $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
- fi
- if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
- echo -n "J2SDK Bundle "
- compare_permissions $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
- echo -n "J2RE Bundle "
- compare_permissions $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
- fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_permissions $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
@@ -1364,17 +1275,11 @@
echo -n "J2RE "
compare_file_types $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
- if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
- echo -n "J2SDK Overlay "
- compare_file_types $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
- echo -n "J2RE Overlay "
- compare_file_types $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
- fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
- compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+ compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
- compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+ compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_file_types $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
@@ -1388,17 +1293,11 @@
echo -n "J2RE "
compare_general_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
- if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
- echo -n "J2SDK Overlay "
- compare_general_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
- echo -n "J2RE Overlay "
- compare_general_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
- fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
- compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+ compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
- compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+ compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
echo -n "Docs "
@@ -1454,10 +1353,6 @@
compare_all_libs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
fi
- if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
- echo -n "Bundle "
- compare_all_libs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
- fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_libs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
@@ -1467,10 +1362,6 @@
if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
compare_all_execs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
fi
- if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
- echo -n "Overlay "
- compare_all_execs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
- fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_execs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
--- a/common/bin/compare_exceptions.sh.incl Tue Nov 18 15:25:16 2014 -0800
+++ b/common/bin/compare_exceptions.sh.incl Wed Jul 05 20:08:34 2017 +0200
@@ -84,7 +84,9 @@
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
+./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@@ -171,7 +173,9 @@
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
+./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@@ -314,7 +318,9 @@
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
+./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@@ -453,7 +459,9 @@
./bin/amd64/jconsole
./bin/amd64/jdb
./bin/amd64/jhat
+./bin/amd64/jimage
./bin/amd64/jinfo
+./bin/amd64/jjs
./bin/amd64/jmap
./bin/amd64/jps
./bin/amd64/jrunscript
@@ -611,7 +619,9 @@
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
+./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@@ -755,7 +765,9 @@
./bin/sparcv9/jconsole
./bin/sparcv9/jdb
./bin/sparcv9/jhat
+./bin/sparcv9/jimage
./bin/sparcv9/jinfo
+./bin/sparcv9/jjs
./bin/sparcv9/jmap
./bin/sparcv9/jps
./bin/sparcv9/jrunscript
@@ -836,7 +848,9 @@
./bin/jconsole.exe
./bin/jdb.exe
./bin/jhat.exe
+./bin/jimage.exe
./bin/jinfo.exe
+./bin/jjs.exe
./bin/jmap.exe
./bin/jps.exe
./bin/jrunscript.exe
@@ -930,7 +944,9 @@
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
+./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
--- a/common/bin/unshuffle_list.txt Tue Nov 18 15:25:16 2014 -0800
+++ b/common/bin/unshuffle_list.txt Wed Jul 05 20:08:34 2017 +0200
@@ -1212,6 +1212,7 @@
jdk/src/java.rmi/share/doc/stub/java/rmi/activation : jdk/src/share/doc/stub/java/rmi/activation
jdk/src/java.rmi/unix/bin/java-rmi.cgi.sh : jdk/src/solaris/bin/java-rmi.cgi.sh
jdk/src/java.scripting/share/classes/javax/script : jdk/src/share/classes/javax/script
+jdk/src/java.scripting/share/classes/com/sun/tools/script/shell : jdk/src/share/classes/com/sun/tools/script/shell
jdk/src/java.security.acl/share/classes/java/security/acl : jdk/src/share/classes/java/security/acl
jdk/src/java.security.acl/share/classes/sun/security/acl : jdk/src/share/classes/sun/security/acl
jdk/src/java.security.jgss/macosx/native/libosxkrb5/nativeccache.c : jdk/src/share/native/sun/security/krb5/nativeccache.c
@@ -1301,7 +1302,6 @@
jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m : jdk/src/macosx/native/apple/security/KeystoreImpl.m
jdk/src/jdk.dev/share/classes/com/sun/jarsigner : jdk/src/share/classes/com/sun/jarsigner
jdk/src/jdk.dev/share/classes/com/sun/tools/hat : jdk/src/share/classes/com/sun/tools/hat
-jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell : jdk/src/share/classes/com/sun/tools/script/shell
jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner : jdk/src/share/classes/sun/security/tools/jarsigner
jdk/src/jdk.dev/share/classes/sun/tools/jar : jdk/src/share/classes/sun/tools/jar
jdk/src/jdk.dev/share/classes/sun/tools/native2ascii : jdk/src/share/classes/sun/tools/native2ascii
--- a/corba/.hgtags Tue Nov 18 15:25:16 2014 -0800
+++ b/corba/.hgtags Wed Jul 05 20:08:34 2017 +0200
@@ -282,3 +282,4 @@
7e9add74ad50841fb39dae75db56374aefa1de4c jdk9-b37
8acf056126e819cf536eef02aee0f61f207a6b52 jdk9-b38
53bf36cb722db50815712258a77cb6bbe25a2f5f jdk9-b39
+e27c725d6c9d155667b35255f442d4ceb8c3c084 jdk9-b40
--- a/corba/make/CommonCorba.gmk Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-################################################################################
-# The Corba sources are old and generates a LOT of warnings.
-# Disable these using Xlint, until someone cares to fix them.
-DISABLE_CORBA_WARNINGS := -Xlint:all,-deprecation,-unchecked,-serial,-fallthrough,-cast,-rawtypes,-static,-dep-ann
-
-# The "generate old bytecode" javac setup uses the new compiler to compile for the
-# boot jdk to generate tools that need to be run with the boot jdk.
-# Thus we force the target bytecode to the boot jdk bytecode.
-$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
- JVM := $(JAVA), \
- JAVAC := $(NEW_JAVAC), \
- FLAGS := $(BOOT_JDK_SOURCETARGET) \
- -bootclasspath "$(BOOT_RTJAR)$(PATH_SEP)$(BOOT_TOOLSJAR)" \
- $(DISABLE_CORBA_WARNINGS), \
- SERVER_DIR := $(SJAVAC_SERVER_DIR), \
- SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
-
-# The "generate new bytecode" uses the new compiler to generate bytecode
-# for the new jdk that is being built. The code compiled by this setup
-# cannot necessarily be run with the boot jdk.
-$(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE, \
- JVM := $(JAVA), \
- JAVAC := $(NEW_JAVAC), \
- FLAGS := -cp $(BOOT_TOOLSJAR) -XDignore.symbol.file=true $(DISABLE_CORBA_WARNINGS), \
- SERVER_DIR := $(SJAVAC_SERVER_DIR), \
- SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
-
-################################################################################
--- a/corba/make/CompileCorba.gmk Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# This must be the first rule
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-include JavaCompilation.gmk
-
-include CommonCorba.gmk
-
-################################################################################
-
-$(eval $(call SetupJavaCompilation,BUILD_INTERIM_CORBA, \
- SETUP := GENERATE_OLDBYTECODE, \
- SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes \
- $(CORBA_TOPDIR)/src/jdk.rmic/share/classes \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba, \
- EXCLUDES := com/sun/corba/se/PortableActivationIDL, \
- EXCLUDE_FILES := com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java \
- com/sun/corba/se/spi/presentation/rmi/StubWrapper.java \
- org/omg/PortableInterceptor/UNKNOWN.java \
- com/sun/tools/corba/se/idl/ResourceBundleUtil.java \
- com/sun/corba/se/impl/presentation/rmi/jndi.properties, \
- COPY := .prp, \
- CLEAN := .properties, \
- BIN := $(CORBA_OUTPUTDIR)/interim_classes, \
- JAR := $(INTERIM_CORBA_JAR)))
-
-################################################################################
-# Copy idl files straight to jdk/include.
-$(JDK_OUTPUTDIR)/include/%: $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/%
- $(install-file)
-
-IDL_TARGET_FILES := $(JDK_OUTPUTDIR)/include/orb.idl $(JDK_OUTPUTDIR)/include/ir.idl
-
-################################################################################
-
-all: $(BUILD_INTERIM_CORBA) $(IDL_TARGET_FILES)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/corba/make/CompileInterim.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,55 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This must be the first rule
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+include SetupJavaCompilers.gmk
+
+################################################################################
+
+$(eval $(call SetupJavaCompilation,BUILD_INTERIM_CORBA, \
+ SETUP := GENERATE_OLDBYTECODE, \
+ SRC := $(JDK_TOPDIR)/src/jdk.rmic/share/classes \
+ $(CORBA_TOPDIR)/src/java.corba/share/classes \
+ $(CORBA_TOPDIR)/src/jdk.rmic/share/classes \
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.corba, \
+ EXCLUDES := com/sun/corba/se/PortableActivationIDL, \
+ EXCLUDE_FILES := com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java \
+ com/sun/corba/se/spi/presentation/rmi/StubWrapper.java \
+ org/omg/PortableInterceptor/UNKNOWN.java \
+ com/sun/tools/corba/se/idl/ResourceBundleUtil.java \
+ com/sun/corba/se/impl/presentation/rmi/jndi.properties, \
+ COPY := .prp, \
+ CLEAN := .properties, \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/corba_interim_classes, \
+ JAR := $(INTERIM_CORBA_JAR)))
+
+################################################################################
+
+all: $(BUILD_INTERIM_CORBA)
--- a/corba/make/GensrcCorba.gmk Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-include JavaCompilation.gmk
-include IdlCompilation.gmk
-
-include CommonCorba.gmk
-
-################################################################################
-
-$(eval $(call SetupJavaCompilation,BUILD_TOOLS_CORBA, \
- SETUP := GENERATE_OLDBYTECODE, \
- SRC := $(CORBA_TOPDIR)/make/src/classes, \
- BIN := $(CORBA_OUTPUTDIR)/tools_classes))
-
-TOOL_LOGUTIL_CMD := $(JAVA) -cp $(CORBA_OUTPUTDIR)/tools_classes \
- build.tools.logutil.MC
-
-$(eval $(call SetupJavaCompilation,BUILD_IDLJ, \
- SETUP := GENERATE_OLDBYTECODE, \
- SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes, \
- BIN := $(CORBA_OUTPUTDIR)/idlj_classes, \
- COPY := .prp, \
- INCLUDES := com/sun/tools/corba/se/idl, \
- EXCLUDE_FILES := ResourceBundleUtil.java))
-
-# Force the language to english for predictable source code generation.
-TOOL_IDLJ_CMD := $(JAVA) -cp $(CORBA_OUTPUTDIR)/idlj_classes \
- -Duser.language=en com.sun.tools.corba.se.idl.toJavaPortable.Compile
-
-################################################################################
-
-# Generate LogWrapper classes
-$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/%SystemException.java: \
- $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
- $(BUILD_TOOLS_CORBA)
- $(MKDIR) -p $(@D)
- $(RM) -f $(@D)/_the_wrappers.d
- $(ECHO) $(LOG_INFO) Generating class file from $*.mc
- $(TOOL_LOGUTIL_CMD) make-class $< $(@D)
-
-# Generate LogWrapper properties file by concatening resource files
-$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/LogStrings.properties: \
- $(CORBA_OUTPUTDIR)/logwrappers/ActivationSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/IORSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/InterceptorsSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/NamingSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/OMGSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/ORBUtilSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/POASystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/UtilSystemException.resource
- $(MKDIR) -p $(@D)
- $(ECHO) $(LOG_INFO) Concatenating 8 resource files into $(@F)
- $(CAT) $^ > $@
-
-# The resources files are generated from lisp-like .mc files.
-$(CORBA_OUTPUTDIR)/logwrappers/%SystemException.resource: \
- $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
- $(BUILD_TOOLS_CORBA)
- $(MKDIR) -p $(@D)
- $(RM) -f $(@D)/_the_wrappers.d
- $(ECHO) $(LOG_INFO) Generating resource file from $*.mc
- $(TOOL_LOGUTIL_CMD) make-resource $< $(@D)
-
-
-LOGWRAPPER_TARGETS := \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/ActivationSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/IORSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/InterceptorsSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/NamingSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/OMGSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/ORBUtilSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/POASystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/UtilSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/LogStrings.properties
-
-################################################################################
-# Build the IDLs.
-
-IDL_DELETES := \
- org/omg/DynamicAny/*POA* \
- org/omg/DynamicAny/*Holder* \
- org/omg/DynamicAny/DynValueBoxHelper.java \
- org/omg/DynamicAny/DynValueCommonHelper.java \
- org/omg/DynamicAny/_DynValueCommonStub.java \
- org/omg/DynamicAny/_DynValueBoxStub.java \
- org/omg/DynamicAny/DynAnyPackage/TypeMismatchHolder.java \
- org/omg/DynamicAny/DynAnyPackage/InvalidValueHolder.java \
- org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHolder.java \
- org/omg/IOP/BI_DIR_IIOP.java \
- org/omg/IOP/ChainBypassCheck.java \
- org/omg/IOP/ChainBypassInfo.java \
- org/omg/IOP/FORWARDED_IDENTITY.java \
- org/omg/IOP/INVOCATION_POLICIES.java \
- org/omg/IOP/LogicalThreadId.java \
- org/omg/IOP/SendingContextRunTime.java \
- org/omg/IOP/UnknownExceptionInfo.java \
- org/omg/IOP/TaggedComponentSeqHolder.java \
- org/omg/PortableServer/CurrentPackage/NoContextHolder.java \
- org/omg/PortableServer/ForwardRequestHolder.java \
- org/omg/PortableServer/IdAssignmentPolicyValueHelper.java \
- org/omg/PortableServer/IdAssignmentPolicyValueHolder.java \
- org/omg/PortableServer/IdUniquenessPolicyValueHelper.java \
- org/omg/PortableServer/IdUniquenessPolicyValueHolder.java \
- org/omg/PortableServer/ImplicitActivationPolicyValueHelper.java \
- org/omg/PortableServer/ImplicitActivationPolicyValueHolder.java \
- org/omg/PortableServer/LifespanPolicyValueHelper.java \
- org/omg/PortableServer/LifespanPolicyValueHolder.java \
- org/omg/PortableServer/ServantRetentionPolicyValueHelper.java \
- org/omg/PortableServer/ServantRetentionPolicyValueHolder.java \
- org/omg/PortableServer/ObjectIdHelper.java \
- org/omg/PortableServer/ObjectIdHolder.java \
- org/omg/PortableServer/POAListHelper.java \
- org/omg/PortableServer/POAListHolder.java \
- org/omg/PortableServer/POAManagerPackage/AdapterInactiveHolder.java \
- org/omg/PortableServer/POAManagerPackage/StateHelper.java \
- org/omg/PortableServer/POAManagerPackage/StateHolder.java \
- org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHolder.java \
- org/omg/PortableServer/POAPackage/AdapterNonExistentHolder.java \
- org/omg/PortableServer/POAPackage/InvalidPolicyHolder.java \
- org/omg/PortableServer/POAPackage/NoServantHolder.java \
- org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHolder.java \
- org/omg/PortableServer/POAPackage/ObjectNotActiveHolder.java \
- org/omg/PortableServer/POAPackage/ServantAlreadyActiveHolder.java \
- org/omg/PortableServer/POAPackage/ServantNotActiveHolder.java \
- org/omg/PortableServer/POAPackage/WrongAdapterHolder.java \
- org/omg/PortableServer/POAPackage/WrongPolicyHolder.java \
- org/omg/PortableServer/RequestProcessingPolicyValueHelper.java \
- org/omg/PortableServer/RequestProcessingPolicyValueHolder.java \
- org/omg/PortableServer/ServantActivatorHolder.java \
- org/omg/PortableServer/ServantLocatorHolder.java \
- org/omg/PortableServer/ThreadPolicyValueHelper.java \
- org/omg/PortableServer/ThreadPolicyValueHolder.java \
- org/omg/PortableInterceptor/ClientRequestInfoHelper.java \
- org/omg/PortableInterceptor/ClientRequestInterceptorHelper.java \
- org/omg/PortableInterceptor/IORInfoHelper.java \
- org/omg/PortableInterceptor/IORInterceptorHelper.java \
- org/omg/PortableInterceptor/InterceptorHelper.java \
- org/omg/PortableInterceptor/ORBInitInfoHelper.java \
- org/omg/PortableInterceptor/ORBInitializerHelper.java \
- org/omg/PortableInterceptor/PolicyFactoryHelper.java \
- org/omg/PortableInterceptor/ReplyStatusHelper.java \
- org/omg/PortableInterceptor/RequestInfoHelper.java \
- org/omg/PortableInterceptor/ServerRequestInfoHelper.java \
- org/omg/PortableInterceptor/ServerRequestInterceptorHelper.java \
- org/omg/PortableInterceptor/SlotIdHelper.java \
- org/omg/PortableInterceptor/ClientRequestInfoHolder.java \
- org/omg/PortableInterceptor/ClientRequestInterceptorHolder.java \
- org/omg/PortableInterceptor/CurrentHolder.java \
- org/omg/PortableInterceptor/ForwardRequestHolder.java \
- org/omg/PortableInterceptor/IORInfoHolder.java \
- org/omg/PortableInterceptor/IORInterceptorHolder.java \
- org/omg/PortableInterceptor/InterceptorHolder.java \
- org/omg/PortableInterceptor/InvalidSlotHolder.java \
- org/omg/PortableInterceptor/ORBInitInfoHolder.java \
- org/omg/PortableInterceptor/ORBInitializerHolder.java \
- org/omg/PortableInterceptor/PolicyFactoryHolder.java \
- org/omg/PortableInterceptor/RequestInfoHolder.java \
- org/omg/PortableInterceptor/ServerRequestInfoHolder.java \
- org/omg/PortableInterceptor/ServerRequestInterceptorHolder.java \
- org/omg/PortableInterceptor/TaggedComponentSeqHolder.java \
- org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHolder.java \
- org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHolder.java \
- org/omg/IOP/CodecPackage/FormatMismatchHolder.java \
- org/omg/IOP/CodecPackage/InvalidTypeForEncodingHolder.java \
- org/omg/IOP/CodecPackage/TypeMismatchHolder.java \
- org/omg/IOP/CodecHelper.java \
- org/omg/IOP/EncodingFormatHelper.java \
- org/omg/IOP/EncodingHelper.java \
- org/omg/IOP/CodecFactoryPackage/UnknownEncodingHolder.java \
- org/omg/IOP/CodecFactoryHolder.java \
- org/omg/IOP/CodecHolder.java \
- org/omg/IOP/EncodingHolder.java \
- org/omg/IOP/TaggedComponentSeqHelper.java \
- org/omg/Dynamic/ContextListHelper.java \
- org/omg/Dynamic/ExceptionListHelper.java \
- org/omg/Dynamic/ParameterHolder.java \
- org/omg/Dynamic/ParameterListHolder.java \
- org/omg/Dynamic/ExceptionListHolder.java \
- org/omg/Dynamic/ParameterHelper.java \
- org/omg/Dynamic/ParameterListHelper.java \
- org/omg/Dynamic/RequestContextHelper.java \
- org/omg/CORBA/OctetSeqHelper.java \
- org/omg/CORBA/OctetSeqHolder.java \
- org/omg/CORBA/PolicyError.java \
- org/omg/CORBA/RepositoryIdHelper.java \
- #
-
-$(eval $(call SetupIdlCompilation,BUILD_IDLS, \
- IDLJ := $(TOOL_IDLJ_CMD), \
- SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes, \
- BIN := $(CORBA_OUTPUTDIR)/gensrc/java.corba, \
- EXCLUDES := com/sun/tools/corba/se/idl/% \
- org/omg/CORBA/% \
- com/sun/corba/se/GiopIDL/% \
- org/omg/PortableServer/corba.idl, \
- INCLUDES := %, \
- OLDIMPLBASES := com/sun/corba/se/PortableActivationIDL/activation.idl \
- com/sun/corba/se/spi/activation/activation.idl, \
- DELETES := $(IDL_DELETES)))
-
-$(BUILD_IDLS): $(BUILD_IDLJ)
-
-################################################################################
-# zh_HK is just a copy of zh_TW
-
-$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties: \
- $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties
- $(install-file)
-
-################################################################################
-
-all: $(BUILD_IDLS) $(LOGWRAPPER_TARGETS) \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/corba/make/copy/Copy-java.corba.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# Copy idl files to jdk/lib.
+$(eval $(call SetupCopyFiles,COPY_IDL, \
+ SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl, \
+ DEST := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE), \
+ FILES := $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/orb.idl \
+ $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ir.idl))
+
+TARGETS := $(COPY_IDL)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/corba/make/gensrc/Gensrc-java.corba.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,243 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+include IdlCompilation.gmk
+include SetupJavaCompilers.gmk
+
+################################################################################
+
+$(eval $(call SetupJavaCompilation,BUILD_TOOLS_CORBA, \
+ SETUP := GENERATE_OLDBYTECODE, \
+ SRC := $(CORBA_TOPDIR)/make/src/classes, \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/corba_tools_classes))
+
+TOOL_LOGUTIL_CMD := $(JAVA) -cp $(BUILDTOOLS_OUTPUTDIR)/corba_tools_classes \
+ build.tools.logutil.MC
+
+$(eval $(call SetupJavaCompilation,BUILD_IDLJ, \
+ SETUP := GENERATE_OLDBYTECODE, \
+ SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes, \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/idlj_classes, \
+ COPY := .prp, \
+ INCLUDES := com/sun/tools/corba/se/idl, \
+ EXCLUDE_FILES := ResourceBundleUtil.java))
+
+# Force the language to english for predictable source code generation.
+TOOL_IDLJ_CMD := $(JAVA) -cp $(BUILDTOOLS_OUTPUTDIR)/idlj_classes \
+ -Duser.language=en com.sun.tools.corba.se.idl.toJavaPortable.Compile
+
+################################################################################
+
+EXCEPTION_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging
+LOGWRAPPER_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/_logwrappers
+
+# Generate LogWrapper classes
+$(EXCEPTION_DIR)/%SystemException.java: \
+ $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
+ $(BUILD_TOOLS_CORBA)
+ $(MKDIR) -p $(@D)
+ $(RM) -f $(@D)/_the_wrappers.d
+ $(ECHO) $(LOG_INFO) Generating class file from $*.mc
+ $(TOOL_LOGUTIL_CMD) make-class $< $(@D)
+
+# Generate LogWrapper properties file by concatening resource files
+$(EXCEPTION_DIR)/LogStrings.properties: \
+ $(LOGWRAPPER_DIR)/ActivationSystemException.resource \
+ $(LOGWRAPPER_DIR)/IORSystemException.resource \
+ $(LOGWRAPPER_DIR)/InterceptorsSystemException.resource \
+ $(LOGWRAPPER_DIR)/NamingSystemException.resource \
+ $(LOGWRAPPER_DIR)/OMGSystemException.resource \
+ $(LOGWRAPPER_DIR)/ORBUtilSystemException.resource \
+ $(LOGWRAPPER_DIR)/POASystemException.resource \
+ $(LOGWRAPPER_DIR)/UtilSystemException.resource
+ $(MKDIR) -p $(@D)
+ $(ECHO) $(LOG_INFO) Concatenating 8 resource files into $(@F)
+ $(CAT) $^ > $@
+
+# The resources files are generated from lisp-like .mc files.
+$(LOGWRAPPER_DIR)/%SystemException.resource: \
+ $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
+ $(BUILD_TOOLS_CORBA)
+ $(MKDIR) -p $(@D)
+ $(RM) -f $(@D)/_the_wrappers.d
+ $(ECHO) $(LOG_INFO) Generating resource file from $*.mc
+ $(TOOL_LOGUTIL_CMD) make-resource $< $(@D)
+
+
+LOGWRAPPER_TARGETS := \
+ $(EXCEPTION_DIR)/ActivationSystemException.java \
+ $(EXCEPTION_DIR)/IORSystemException.java \
+ $(EXCEPTION_DIR)/InterceptorsSystemException.java \
+ $(EXCEPTION_DIR)/NamingSystemException.java \
+ $(EXCEPTION_DIR)/OMGSystemException.java \
+ $(EXCEPTION_DIR)/ORBUtilSystemException.java \
+ $(EXCEPTION_DIR)/POASystemException.java \
+ $(EXCEPTION_DIR)/UtilSystemException.java \
+ $(EXCEPTION_DIR)/LogStrings.properties
+
+################################################################################
+# Build the IDLs.
+
+IDL_DELETES := \
+ org/omg/DynamicAny/*POA* \
+ org/omg/DynamicAny/*Holder* \
+ org/omg/DynamicAny/DynValueBoxHelper.java \
+ org/omg/DynamicAny/DynValueCommonHelper.java \
+ org/omg/DynamicAny/_DynValueCommonStub.java \
+ org/omg/DynamicAny/_DynValueBoxStub.java \
+ org/omg/DynamicAny/DynAnyPackage/TypeMismatchHolder.java \
+ org/omg/DynamicAny/DynAnyPackage/InvalidValueHolder.java \
+ org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHolder.java \
+ org/omg/IOP/BI_DIR_IIOP.java \
+ org/omg/IOP/ChainBypassCheck.java \
+ org/omg/IOP/ChainBypassInfo.java \
+ org/omg/IOP/FORWARDED_IDENTITY.java \
+ org/omg/IOP/INVOCATION_POLICIES.java \
+ org/omg/IOP/LogicalThreadId.java \
+ org/omg/IOP/SendingContextRunTime.java \
+ org/omg/IOP/UnknownExceptionInfo.java \
+ org/omg/IOP/TaggedComponentSeqHolder.java \
+ org/omg/PortableServer/CurrentPackage/NoContextHolder.java \
+ org/omg/PortableServer/ForwardRequestHolder.java \
+ org/omg/PortableServer/IdAssignmentPolicyValueHelper.java \
+ org/omg/PortableServer/IdAssignmentPolicyValueHolder.java \
+ org/omg/PortableServer/IdUniquenessPolicyValueHelper.java \
+ org/omg/PortableServer/IdUniquenessPolicyValueHolder.java \
+ org/omg/PortableServer/ImplicitActivationPolicyValueHelper.java \
+ org/omg/PortableServer/ImplicitActivationPolicyValueHolder.java \
+ org/omg/PortableServer/LifespanPolicyValueHelper.java \
+ org/omg/PortableServer/LifespanPolicyValueHolder.java \
+ org/omg/PortableServer/ServantRetentionPolicyValueHelper.java \
+ org/omg/PortableServer/ServantRetentionPolicyValueHolder.java \
+ org/omg/PortableServer/ObjectIdHelper.java \
+ org/omg/PortableServer/ObjectIdHolder.java \
+ org/omg/PortableServer/POAListHelper.java \
+ org/omg/PortableServer/POAListHolder.java \
+ org/omg/PortableServer/POAManagerPackage/AdapterInactiveHolder.java \
+ org/omg/PortableServer/POAManagerPackage/StateHelper.java \
+ org/omg/PortableServer/POAManagerPackage/StateHolder.java \
+ org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHolder.java \
+ org/omg/PortableServer/POAPackage/AdapterNonExistentHolder.java \
+ org/omg/PortableServer/POAPackage/InvalidPolicyHolder.java \
+ org/omg/PortableServer/POAPackage/NoServantHolder.java \
+ org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHolder.java \
+ org/omg/PortableServer/POAPackage/ObjectNotActiveHolder.java \
+ org/omg/PortableServer/POAPackage/ServantAlreadyActiveHolder.java \
+ org/omg/PortableServer/POAPackage/ServantNotActiveHolder.java \
+ org/omg/PortableServer/POAPackage/WrongAdapterHolder.java \
+ org/omg/PortableServer/POAPackage/WrongPolicyHolder.java \
+ org/omg/PortableServer/RequestProcessingPolicyValueHelper.java \
+ org/omg/PortableServer/RequestProcessingPolicyValueHolder.java \
+ org/omg/PortableServer/ServantActivatorHolder.java \
+ org/omg/PortableServer/ServantLocatorHolder.java \
+ org/omg/PortableServer/ThreadPolicyValueHelper.java \
+ org/omg/PortableServer/ThreadPolicyValueHolder.java \
+ org/omg/PortableInterceptor/ClientRequestInfoHelper.java \
+ org/omg/PortableInterceptor/ClientRequestInterceptorHelper.java \
+ org/omg/PortableInterceptor/IORInfoHelper.java \
+ org/omg/PortableInterceptor/IORInterceptorHelper.java \
+ org/omg/PortableInterceptor/InterceptorHelper.java \
+ org/omg/PortableInterceptor/ORBInitInfoHelper.java \
+ org/omg/PortableInterceptor/ORBInitializerHelper.java \
+ org/omg/PortableInterceptor/PolicyFactoryHelper.java \
+ org/omg/PortableInterceptor/ReplyStatusHelper.java \
+ org/omg/PortableInterceptor/RequestInfoHelper.java \
+ org/omg/PortableInterceptor/ServerRequestInfoHelper.java \
+ org/omg/PortableInterceptor/ServerRequestInterceptorHelper.java \
+ org/omg/PortableInterceptor/SlotIdHelper.java \
+ org/omg/PortableInterceptor/ClientRequestInfoHolder.java \
+ org/omg/PortableInterceptor/ClientRequestInterceptorHolder.java \
+ org/omg/PortableInterceptor/CurrentHolder.java \
+ org/omg/PortableInterceptor/ForwardRequestHolder.java \
+ org/omg/PortableInterceptor/IORInfoHolder.java \
+ org/omg/PortableInterceptor/IORInterceptorHolder.java \
+ org/omg/PortableInterceptor/InterceptorHolder.java \
+ org/omg/PortableInterceptor/InvalidSlotHolder.java \
+ org/omg/PortableInterceptor/ORBInitInfoHolder.java \
+ org/omg/PortableInterceptor/ORBInitializerHolder.java \
+ org/omg/PortableInterceptor/PolicyFactoryHolder.java \
+ org/omg/PortableInterceptor/RequestInfoHolder.java \
+ org/omg/PortableInterceptor/ServerRequestInfoHolder.java \
+ org/omg/PortableInterceptor/ServerRequestInterceptorHolder.java \
+ org/omg/PortableInterceptor/TaggedComponentSeqHolder.java \
+ org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHolder.java \
+ org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHolder.java \
+ org/omg/IOP/CodecPackage/FormatMismatchHolder.java \
+ org/omg/IOP/CodecPackage/InvalidTypeForEncodingHolder.java \
+ org/omg/IOP/CodecPackage/TypeMismatchHolder.java \
+ org/omg/IOP/CodecHelper.java \
+ org/omg/IOP/EncodingFormatHelper.java \
+ org/omg/IOP/EncodingHelper.java \
+ org/omg/IOP/CodecFactoryPackage/UnknownEncodingHolder.java \
+ org/omg/IOP/CodecFactoryHolder.java \
+ org/omg/IOP/CodecHolder.java \
+ org/omg/IOP/EncodingHolder.java \
+ org/omg/IOP/TaggedComponentSeqHelper.java \
+ org/omg/Dynamic/ContextListHelper.java \
+ org/omg/Dynamic/ExceptionListHelper.java \
+ org/omg/Dynamic/ParameterHolder.java \
+ org/omg/Dynamic/ParameterListHolder.java \
+ org/omg/Dynamic/ExceptionListHolder.java \
+ org/omg/Dynamic/ParameterHelper.java \
+ org/omg/Dynamic/ParameterListHelper.java \
+ org/omg/Dynamic/RequestContextHelper.java \
+ org/omg/CORBA/OctetSeqHelper.java \
+ org/omg/CORBA/OctetSeqHolder.java \
+ org/omg/CORBA/PolicyError.java \
+ org/omg/CORBA/RepositoryIdHelper.java \
+ #
+
+$(eval $(call SetupIdlCompilation,BUILD_IDLS, \
+ IDLJ := $(TOOL_IDLJ_CMD), \
+ SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes, \
+ BIN := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba, \
+ EXCLUDES := com/sun/tools/corba/se/idl/% \
+ org/omg/CORBA/% \
+ com/sun/corba/se/GiopIDL/% \
+ org/omg/PortableServer/corba.idl, \
+ INCLUDES := %, \
+ OLDIMPLBASES := com/sun/corba/se/PortableActivationIDL/activation.idl \
+ com/sun/corba/se/spi/activation/activation.idl, \
+ DELETES := $(IDL_DELETES)))
+
+$(BUILD_IDLS): $(BUILD_IDLJ)
+
+################################################################################
+# zh_HK is just a copy of zh_TW
+
+$(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties: \
+ $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties
+ $(install-file)
+
+################################################################################
+
+all: $(BUILD_IDLS) $(LOGWRAPPER_TARGETS) \
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties
+
--- a/corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java Tue Nov 18 15:25:16 2014 -0800
+++ b/corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java Wed Jul 05 20:08:34 2017 +0200
@@ -352,7 +352,7 @@
env.output(Main.getText("rmic.generated", file.getPath(), Long.toString(duration)));
}
if (sourceFile) {
- env.parseFile(new ClassFile(file));
+ env.parseFile(ClassFile.newClassFile(file));
}
} catch (IOException e) {
env.error(0, "cant.write", file.toString());
--- a/hotspot/.hgtags Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/.hgtags Wed Jul 05 20:08:34 2017 +0200
@@ -442,3 +442,4 @@
b1c2dd843f247a1db19e1e85eb62ca405f72dc26 jdk9-b37
c363a8b87e477ee45d6d3cb2a36cb365141bc596 jdk9-b38
9cb75e5e394827ccbaf2e15524108a412dc4ddc5 jdk9-b39
+6b09b3193d731e3288e2a240c504a20d0a06c766 jdk9-b40
--- a/hotspot/make/bsd/makefiles/sa.make Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/make/bsd/makefiles/sa.make Wed Jul 05 20:08:34 2017 +0200
@@ -63,6 +63,10 @@
SA_CLASSPATH=$(shell test -f $(ALT_SA_CLASSPATH) && echo $(ALT_SA_CLASSPATH))
endif
+ifneq ($(SA_CLASSPATH),)
+ SA_CLASSPATH_ARG := -classpath $(SA_CLASSPATH)
+endif
+
# TODO: if it's a modules image, check if SA module is installed.
MODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules
@@ -114,7 +118,7 @@
# are in AGENT_FILES, so use the shell to expand them.
# Be extra carefull to not produce too long command lines in the shell!
$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
- $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
+ $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) $(SA_CLASSPATH_ARG) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
--- a/hotspot/src/os/aix/vm/os_aix.cpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/os/aix/vm/os_aix.cpp Wed Jul 05 20:08:34 2017 +0200
@@ -512,15 +512,13 @@
#define DEFAULT_LIBPATH "/usr/lib:/lib"
#define EXTENSIONS_DIR "/lib/ext"
-#define ENDORSED_DIR "/lib/endorsed"
// Buffer that fits several sprintfs.
// Note that the space for the trailing null is provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR), // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -571,15 +569,10 @@
sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#undef DEFAULT_LIBPATH
#undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@@ -2778,6 +2771,10 @@
return ::read(fd, buf, nBytes);
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ return ::pread(fd, buf, nBytes, offset);
+}
+
void os::naked_short_sleep(jlong ms) {
struct timespec req;
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Wed Jul 05 20:08:34 2017 +0200
@@ -353,7 +353,6 @@
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/java/packages"
#define EXTENSIONS_DIR "/lib/ext"
-#define ENDORSED_DIR "/lib/endorsed"
#ifndef __APPLE__
@@ -361,9 +360,8 @@
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -425,10 +423,6 @@
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#else // __APPLE__
@@ -445,9 +439,8 @@
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX3((size_t)MAXPATHLEN, // for dll_dir & friends.
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + system_ext_size, // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ MAX2((size_t)MAXPATHLEN, // for dll_dir & friends.
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + system_ext_size); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -525,10 +518,6 @@
user_home_dir, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#undef SYS_EXTENSIONS_DIR
@@ -538,7 +527,6 @@
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@@ -2576,6 +2564,10 @@
RESTARTABLE_RETURN_INT(::read(fd, buf, nBytes));
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ RESTARTABLE_RETURN_INT(::pread(fd, buf, nBytes, offset));
+}
+
void os::naked_short_sleep(jlong ms) {
struct timespec req;
--- a/hotspot/src/os/linux/vm/os_linux.cpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/os/linux/vm/os_linux.cpp Wed Jul 05 20:08:34 2017 +0200
@@ -337,15 +337,13 @@
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/java/packages"
#define EXTENSIONS_DIR "/lib/ext"
-#define ENDORSED_DIR "/lib/endorsed"
// Buffer that fits several sprintfs.
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -410,16 +408,11 @@
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#undef DEFAULT_LIBPATH
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@@ -3783,6 +3776,10 @@
return ::read(fd, buf, nBytes);
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ return ::pread(fd, buf, nBytes, offset);
+}
+
// Short sleep, direct OS call.
//
// Note: certain versions of Linux CFS scheduler (since 2.6.23) do not guarantee
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Wed Jul 05 20:08:34 2017 +0200
@@ -609,17 +609,15 @@
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/jdk/packages"
#define EXTENSIONS_DIR "/lib/ext"
-#define ENDORSED_DIR "/lib/endorsed"
char cpu_arch[12];
// Buffer that fits several sprintfs.
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX4((size_t)MAXPATHLEN, // For dll_dir & friends.
+ MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
sizeof(SYS_EXT_DIR) + sizeof("/lib/") + strlen(cpu_arch), // invariant ld_library_path
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -765,15 +763,10 @@
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
}
void os::breakpoint() {
@@ -3164,6 +3157,15 @@
return res;
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ size_t res;
+ JavaThread* thread = (JavaThread*)Thread::current();
+ assert(thread->thread_state() == _thread_in_vm, "Assumed _thread_in_vm");
+ ThreadBlockInVM tbiv(thread);
+ RESTARTABLE(::pread(fd, buf, (size_t) nBytes, offset), res);
+ return res;
+}
+
size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
size_t res;
assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native,
--- a/hotspot/src/os/windows/vm/os_windows.cpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/os/windows/vm/os_windows.cpp Wed Jul 05 20:08:34 2017 +0200
@@ -292,19 +292,6 @@
#undef BIN_DIR
#undef PACKAGE_DIR
- // Default endorsed standards directory.
- {
-#define ENDORSED_DIR "\\lib\\endorsed"
- size_t len = strlen(Arguments::get_java_home()) + sizeof(ENDORSED_DIR);
- char * buf = NEW_C_HEAP_ARRAY(char, len, mtInternal);
- sprintf(buf, "%s%s", Arguments::get_java_home(), ENDORSED_DIR);
- Arguments::set_endorsed_dirs(buf);
- // (Arguments::set_endorsed_dirs() calls SystemProperty::set_value(), which
- // duplicates the input.)
- FREE_C_HEAP_ARRAY(char, buf, mtInternal);
-#undef ENDORSED_DIR
- }
-
#ifndef _WIN64
// set our UnhandledExceptionFilter and save any previous one
prev_uef_handler = SetUnhandledExceptionFilter(Handle_FLT_Exception);
@@ -4376,6 +4363,23 @@
return (jlong) ::_lseeki64(fd, offset, whence);
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ OVERLAPPED ov;
+ DWORD nread;
+ BOOL result;
+
+ ZeroMemory(&ov, sizeof(ov));
+ ov.Offset = (DWORD)offset;
+ ov.OffsetHigh = (DWORD)(offset >> 32);
+
+ HANDLE h = (HANDLE)::_get_osfhandle(fd);
+
+ result = ReadFile(h, (LPVOID)buf, nBytes, &nread, &ov);
+
+ return result ? nread : 0;
+}
+
+
// This method is a slightly reworked copy of JDK's sysNativePath
// from src/windows/hpi/src/path_md.c
--- a/hotspot/src/share/vm/classfile/classLoader.cpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp Wed Jul 05 20:08:34 2017 +0200
@@ -28,6 +28,7 @@
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderExt.hpp"
#include "classfile/classLoaderData.inline.hpp"
+#include "classfile/imageFile.hpp"
#include "classfile/javaClasses.hpp"
#if INCLUDE_CDS
#include "classfile/sharedPathsMiscInfo.hpp"
@@ -67,7 +68,7 @@
#include "utilities/hashtable.hpp"
#include "utilities/hashtable.inline.hpp"
-// Entry points in zip.dll for loading zip/jar file entries
+// Entry points in zip.dll for loading zip/jar file entries and image file entries
typedef void * * (JNICALL *ZipOpen_t)(const char *name, char **pmsg);
typedef void (JNICALL *ZipClose_t)(jzfile *zip);
@@ -75,6 +76,7 @@
typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf);
typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf);
typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n);
+typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg);
typedef jint (JNICALL *Crc32_t)(jint crc, const jbyte *buf, jint len);
static ZipOpen_t ZipOpen = NULL;
@@ -84,6 +86,7 @@
static ReadMappedEntry_t ReadMappedEntry = NULL;
static GetNextEntry_t GetNextEntry = NULL;
static canonicalize_fn_t CanonicalizeEntry = NULL;
+static ZipInflateFully_t ZipInflateFully = NULL;
static Crc32_t Crc32 = NULL;
// Globals
@@ -322,6 +325,8 @@
}
bool LazyClassPathEntry::is_jar_file() {
+ size_t len = strlen(_path);
+ if (len < 4 || strcmp(_path + len - 4, ".jar") != 0) return false;
return ((_st.st_mode & S_IFREG) == S_IFREG);
}
@@ -385,6 +390,78 @@
}
}
+ClassPathImageEntry::ClassPathImageEntry(char* name) : ClassPathEntry(), _image(new ImageFile(name)) {
+ bool opened = _image->open();
+ if (!opened) {
+ _image = NULL;
+ }
+}
+
+ClassPathImageEntry::~ClassPathImageEntry() {
+ if (_image) {
+ _image->close();
+ _image = NULL;
+ }
+}
+
+const char* ClassPathImageEntry::name() {
+ return _image ? _image->name() : "";
+}
+
+ClassFileStream* ClassPathImageEntry::open_stream(const char* name, TRAPS) {
+ u1* buffer;
+ u8 size;
+ _image->get_resource(name, buffer, size);
+
+ if (buffer) {
+ if (UsePerfData) {
+ ClassLoader::perf_sys_classfile_bytes_read()->inc(size);
+ }
+ return new ClassFileStream(buffer, (int)size, (char*)name); // Resource allocated
+ }
+
+ return NULL;
+}
+
+#ifndef PRODUCT
+void ClassPathImageEntry::compile_the_world(Handle loader, TRAPS) {
+ tty->print_cr("CompileTheWorld : Compiling all classes in %s", name());
+ tty->cr();
+ const ImageStrings strings = _image->get_strings();
+ // Retrieve each path component string.
+ u4 count = _image->get_location_count();
+ for (u4 i = 0; i < count; i++) {
+ u1* location_data = _image->get_location_data(i);
+
+ if (location_data) {
+ ImageLocation location(location_data);
+ const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
+ const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
+ const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
+ assert((strlen(parent) + strlen(base) + strlen(extension)) < JVM_MAXPATHLEN, "path exceeds buffer");
+ char path[JVM_MAXPATHLEN];
+ strcpy(path, parent);
+ strcat(path, base);
+ strcat(path, extension);
+ ClassLoader::compile_the_world_in(path, loader, CHECK);
+ }
+ }
+ if (HAS_PENDING_EXCEPTION) {
+ if (PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
+ CLEAR_PENDING_EXCEPTION;
+ tty->print_cr("\nCompileTheWorld : Ran out of memory\n");
+ tty->print_cr("Increase class metadata storage if a limit was set");
+ } else {
+ tty->print_cr("\nCompileTheWorld : Unexpected exception occurred\n");
+ }
+ }
+}
+
+bool ClassPathImageEntry::is_jrt() {
+ return string_ends_with(name(), "bootmodules.jimage");
+}
+#endif
+
static void print_meta_index(LazyClassPathEntry* entry,
GrowableArray<char*>& meta_packages) {
tty->print("[Meta index for %s=", entry->name());
@@ -634,7 +711,7 @@
}
ClassPathEntry* new_entry = NULL;
if ((st->st_mode & S_IFREG) == S_IFREG) {
- // Regular file, should be a zip file
+ // Regular file, should be a zip or image file
// Canonicalized filename
char canonical_path[JVM_MAXPATHLEN];
if (!get_canonical_path(path, canonical_path, JVM_MAXPATHLEN)) {
@@ -645,6 +722,11 @@
return NULL;
}
}
+ // TODO - add proper criteria for selecting image file
+ ClassPathImageEntry* entry = new ClassPathImageEntry(canonical_path);
+ if (entry->is_open()) {
+ new_entry = entry;
+ } else {
char* error_msg = NULL;
jzfile* zip;
{
@@ -655,9 +737,6 @@
}
if (zip != NULL && error_msg == NULL) {
new_entry = new ClassPathZipEntry(zip, path);
- if (TraceClassLoading || TraceClassPaths) {
- tty->print_cr("[Opened %s]", path);
- }
} else {
ResourceMark rm(thread);
char *msg;
@@ -675,10 +754,14 @@
return NULL;
}
}
+ }
+ if (TraceClassLoading || TraceClassPaths) {
+ tty->print_cr("[Opened %s]", path);
+ }
} else {
// Directory
new_entry = new ClassPathDirEntry(path);
- if (TraceClassLoading || TraceClassPaths) {
+ if (TraceClassLoading) {
tty->print_cr("[Path %s]", path);
}
}
@@ -801,6 +884,7 @@
ReadEntry = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry"));
ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry"));
GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry"));
+ ZipInflateFully = CAST_TO_FN_PTR(ZipInflateFully_t, os::dll_lookup(handle, "ZIP_InflateFully"));
Crc32 = CAST_TO_FN_PTR(Crc32_t, os::dll_lookup(handle, "ZIP_CRC32"));
// ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL
@@ -809,12 +893,20 @@
vm_exit_during_initialization("Corrupted ZIP library", path);
}
+ if (ZipInflateFully == NULL) {
+ vm_exit_during_initialization("Corrupted ZIP library ZIP_InflateFully missing", path);
+ }
+
// Lookup canonicalize entry in libjava.dll
void *javalib_handle = os::native_java_library();
CanonicalizeEntry = CAST_TO_FN_PTR(canonicalize_fn_t, os::dll_lookup(javalib_handle, "Canonicalize"));
// This lookup only works on 1.3. Do not check for non-null here
}
+jboolean ClassLoader::decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg) {
+ return (*ZipInflateFully)(in, inSize, out, outSize, pmsg);
+}
+
int ClassLoader::crc32(int crc, const char* buf, int len) {
assert(Crc32 != NULL, "ZIP_CRC32 is not found");
return (*Crc32)(crc, (const jbyte*)buf, len);
@@ -1367,8 +1459,7 @@
tty->cr();
}
-
-bool ClassPathDirEntry::is_rt_jar() {
+bool ClassPathDirEntry::is_jrt() {
return false;
}
@@ -1393,13 +1484,13 @@
}
}
-bool ClassPathZipEntry::is_rt_jar() {
+bool ClassPathZipEntry::is_jrt() {
real_jzfile* zip = (real_jzfile*) _zip;
int len = (int)strlen(zip->name);
// Check whether zip name ends in "rt.jar"
// This will match other archives named rt.jar as well, but this is
// only used for debugging.
- return (len >= 6) && (strcasecmp(zip->name + len - 6, "rt.jar") == 0);
+ return string_ends_with(zip->name, "rt.jar");
}
void LazyClassPathEntry::compile_the_world(Handle loader, TRAPS) {
@@ -1409,7 +1500,7 @@
}
}
-bool LazyClassPathEntry::is_rt_jar() {
+bool LazyClassPathEntry::is_jrt() {
Thread* THREAD = Thread::current();
ClassPathEntry* cpe = resolve_entry(THREAD);
return (cpe != NULL) ? cpe->is_jar_file() : false;
@@ -1428,7 +1519,7 @@
jlong start = os::javaTimeMillis();
while (e != NULL) {
// We stop at rt.jar, unless it is the first bootstrap path entry
- if (e->is_rt_jar() && e != _first_entry) break;
+ if (e->is_jrt() && e != _first_entry) break;
e->compile_the_world(system_class_loader, CATCH);
e = e->next();
}
@@ -1476,9 +1567,9 @@
}
void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
- int len = (int)strlen(name);
- if (len > 6 && strcmp(".class", name + len - 6) == 0) {
+ if (string_ends_with(name, ".class")) {
// We have a .class file
+ int len = (int)strlen(name);
char buffer[2048];
strncpy(buffer, name, len - 6);
buffer[len-6] = 0;
--- a/hotspot/src/share/vm/classfile/classLoader.hpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp Wed Jul 05 20:08:34 2017 +0200
@@ -66,7 +66,7 @@
virtual ClassFileStream* open_stream(const char* name, TRAPS) = 0;
// Debugging
NOT_PRODUCT(virtual void compile_the_world(Handle loader, TRAPS) = 0;)
- NOT_PRODUCT(virtual bool is_rt_jar() = 0;)
+ NOT_PRODUCT(virtual bool is_jrt() = 0;)
};
@@ -80,7 +80,7 @@
ClassFileStream* open_stream(const char* name, TRAPS);
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
- NOT_PRODUCT(bool is_rt_jar();)
+ NOT_PRODUCT(bool is_jrt();)
};
@@ -112,7 +112,7 @@
void contents_do(void f(const char* name, void* context), void* context);
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
- NOT_PRODUCT(bool is_rt_jar();)
+ NOT_PRODUCT(bool is_jrt();)
};
@@ -138,7 +138,25 @@
virtual bool is_lazy();
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
- NOT_PRODUCT(bool is_rt_jar();)
+ NOT_PRODUCT(bool is_jrt();)
+};
+
+// For java image files
+class ImageFile;
+class ClassPathImageEntry: public ClassPathEntry {
+private:
+ ImageFile *_image;
+public:
+ bool is_jar_file() { return false; }
+ bool is_open() { return _image != NULL; }
+ const char* name();
+ ClassPathImageEntry(char* name);
+ ~ClassPathImageEntry();
+ ClassFileStream* open_stream(const char* name, TRAPS);
+
+ // Debugging
+ NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
+ NOT_PRODUCT(bool is_jrt();)
};
class PackageHashtable;
@@ -226,6 +244,7 @@
// to avoid confusing the zip library
static bool get_canonical_path(const char* orig, char* out, int len);
public:
+ static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg);
static int crc32(int crc, const char* buf, int len);
static bool update_class_path_entry_list(const char *path,
bool check_for_duplicates,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/imageFile.cpp Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/imageFile.hpp"
+#include "runtime/os.inline.hpp"
+#include "utilities/bytes.hpp"
+
+
+// Compute the Perfect Hashing hash code for the supplied string.
+u4 ImageStrings::hash_code(const char* string, u4 seed) {
+ u1* bytes = (u1*)string;
+
+ // Compute hash code.
+ for (u1 byte = *bytes++; byte; byte = *bytes++) {
+ seed = (seed * HASH_MULTIPLIER) ^ byte;
+ }
+
+ // Ensure the result is unsigned.
+ return seed & 0x7FFFFFFF;
+}
+
+// Test to see if string begins with start. If so returns remaining portion
+// of string. Otherwise, NULL.
+const char* ImageStrings::starts_with(const char* string, const char* start) {
+ char ch1, ch2;
+
+ // Match up the strings the best we can.
+ while ((ch1 = *string) && (ch2 = *start)) {
+ if (ch1 != ch2) {
+ // Mismatch, return NULL.
+ return NULL;
+ }
+
+ string++, start++;
+ }
+
+ // Return remainder of string.
+ return string;
+}
+
+ImageLocation::ImageLocation(u1* data) {
+ // Deflate the attribute stream into an array of attributes.
+ memset(_attributes, 0, sizeof(_attributes));
+ u1 byte;
+
+ while ((byte = *data) != ATTRIBUTE_END) {
+ u1 kind = attribute_kind(byte);
+ u1 n = attribute_length(byte);
+ assert(kind < ATTRIBUTE_COUNT, "invalid image location attribute");
+ _attributes[kind] = attribute_value(data + 1, n);
+ data += n + 1;
+ }
+}
+
+ImageFile::ImageFile(const char* name) {
+ // Copy the image file name.
+ _name = NEW_C_HEAP_ARRAY(char, strlen(name)+1, mtClass);
+ strcpy(_name, name);
+
+ // Initialize for a closed file.
+ _fd = -1;
+ _memory_mapped = true;
+ _index_data = NULL;
+}
+
+ImageFile::~ImageFile() {
+ // Ensure file is closed.
+ close();
+
+ // Free up name.
+ FREE_C_HEAP_ARRAY(char, _name, mtClass);
+}
+
+bool ImageFile::open() {
+ // If file exists open for reading.
+ struct stat st;
+ if (os::stat(_name, &st) != 0 ||
+ (st.st_mode & S_IFREG) != S_IFREG ||
+ (_fd = os::open(_name, 0, O_RDONLY)) == -1) {
+ return false;
+ }
+
+ // Read image file header and verify.
+ u8 header_size = sizeof(ImageHeader);
+ if (os::read(_fd, &_header, header_size) != header_size ||
+ _header._magic != IMAGE_MAGIC ||
+ _header._major_version != MAJOR_VERSION ||
+ _header._minor_version != MINOR_VERSION) {
+ close();
+ return false;
+ }
+
+ // Memory map index.
+ _index_size = index_size();
+ _index_data = (u1*)os::map_memory(_fd, _name, 0, NULL, _index_size, true, false);
+
+ // Failing that, read index into C memory.
+ if (_index_data == NULL) {
+ _memory_mapped = false;
+ _index_data = NEW_RESOURCE_ARRAY(u1, _index_size);
+
+ if (os::seek_to_file_offset(_fd, 0) == -1) {
+ close();
+ return false;
+ }
+
+ if (os::read(_fd, _index_data, _index_size) != _index_size) {
+ close();
+ return false;
+ }
+
+ return true;
+ }
+
+// Used to advance a pointer, unstructured.
+#undef nextPtr
+#define nextPtr(base, fromType, count, toType) (toType*)((fromType*)(base) + (count))
+ // Pull tables out from the index.
+ _redirect_table = nextPtr(_index_data, u1, header_size, s4);
+ _offsets_table = nextPtr(_redirect_table, s4, _header._location_count, u4);
+ _location_bytes = nextPtr(_offsets_table, u4, _header._location_count, u1);
+ _string_bytes = nextPtr(_location_bytes, u1, _header._locations_size, u1);
+#undef nextPtr
+
+ // Successful open.
+ return true;
+}
+
+void ImageFile::close() {
+ // Dealllocate the index.
+ if (_index_data) {
+ if (_memory_mapped) {
+ os::unmap_memory((char*)_index_data, _index_size);
+ } else {
+ FREE_RESOURCE_ARRAY(u1, _index_data, _index_size);
+ }
+
+ _index_data = NULL;
+ }
+
+ // close file.
+ if (_fd != -1) {
+ os::close(_fd);
+ _fd = -1;
+ }
+
+}
+
+// Return the attribute stream for a named resourced.
+u1* ImageFile::find_location_data(const char* path) const {
+ // Compute hash.
+ u4 hash = ImageStrings::hash_code(path) % _header._location_count;
+ s4 redirect = _redirect_table[hash];
+
+ if (!redirect) {
+ return NULL;
+ }
+
+ u4 index;
+
+ if (redirect < 0) {
+ // If no collision.
+ index = -redirect - 1;
+ } else {
+ // If collision, recompute hash code.
+ index = ImageStrings::hash_code(path, redirect) % _header._location_count;
+ }
+
+ assert(index < _header._location_count, "index exceeds location count");
+ u4 offset = _offsets_table[index];
+ assert(offset < _header._locations_size, "offset exceeds location attributes size");
+
+ if (offset == 0) {
+ return NULL;
+ }
+
+ return _location_bytes + offset;
+}
+
+// Verify that a found location matches the supplied path.
+bool ImageFile::verify_location(ImageLocation& location, const char* path) const {
+ // Retrieve each path component string.
+ ImageStrings strings(_string_bytes, _header._strings_size);
+ // Match a path with each subcomponent without concatenation (copy).
+ // Match up path parent.
+ const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
+ const char* next = ImageStrings::starts_with(path, parent);
+ // Continue only if a complete match.
+ if (!next) return false;
+ // Match up path base.
+ const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
+ next = ImageStrings::starts_with(next, base);
+ // Continue only if a complete match.
+ if (!next) return false;
+ // Match up path extension.
+ const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
+ next = ImageStrings::starts_with(next, extension);
+
+ // True only if complete match and no more characters.
+ return next && *next == '\0';
+}
+
+// Return the resource for the supplied location.
+u1* ImageFile::get_resource(ImageLocation& location) const {
+ // Retrieve the byte offset and size of the resource.
+ u8 offset = _index_size + location.get_attribute(ImageLocation::ATTRIBUTE_OFFSET);
+ u8 size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+ u8 compressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_COMPRESSED);
+ u8 read_size = compressed_size ? compressed_size : size;
+
+ // Allocate space for the resource.
+ u1* data = NEW_RESOURCE_ARRAY(u1, read_size);
+
+ bool is_read = os::read_at(_fd, data, read_size, offset) == read_size;
+ guarantee(is_read, "error reading from image or short read");
+
+ // If not compressed, just return the data.
+ if (!compressed_size) {
+ return data;
+ }
+
+ u1* uncompressed = NEW_RESOURCE_ARRAY(u1, size);
+ char* msg = NULL;
+ jboolean res = ClassLoader::decompress(data, compressed_size, uncompressed, size, &msg);
+ if (!res) warning("decompression failed due to %s\n", msg);
+ guarantee(res, "decompression failed");
+
+ return uncompressed;
+}
+
+void ImageFile::get_resource(const char* path, u1*& buffer, u8& size) const {
+ buffer = NULL;
+ size = 0;
+ u1* data = find_location_data(path);
+ if (data) {
+ ImageLocation location(data);
+ if (verify_location(location, path)) {
+ size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+ buffer = get_resource(location);
+ }
+ }
+}
+
+GrowableArray<const char*>* ImageFile::packages(const char* name) {
+ char entry[JVM_MAXPATHLEN];
+ bool overflow = jio_snprintf(entry, sizeof(entry), "%s/packages.offsets", name) == -1;
+ guarantee(!overflow, "package name overflow");
+
+ u1* buffer;
+ u8 size;
+
+ get_resource(entry, buffer, size);
+ guarantee(buffer, "missing module packages reource");
+ ImageStrings strings(_string_bytes, _header._strings_size);
+ GrowableArray<const char*>* pkgs = new GrowableArray<const char*>();
+ int count = size / 4;
+ for (int i = 0; i < count; i++) {
+ u4 offset = Bytes::get_Java_u4(buffer + (i*4));
+ const char* p = strings.get(offset);
+ pkgs->append(p);
+ }
+
+ return pkgs;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/imageFile.hpp Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,343 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_CLASSFILE_IMAGEFILE_HPP
+#define SHARE_VM_CLASSFILE_IMAGEFILE_HPP
+
+#include "classfile/classLoader.hpp"
+#include "memory/allocation.hpp"
+#include "memory/allocation.inline.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+// Image files are an alternate file format for storing classes and resources. The
+// goal is to supply file access which is faster and smaller that the jar format.
+// It should be noted that unlike jars information stored in an image is in native
+// endian format. This allows the image to be memory mapped into memory without
+// endian translation. This also means that images are platform dependent.
+//
+// Image files are structured as three sections;
+//
+// +-----------+
+// | Header |
+// +-----------+
+// | |
+// | Directory |
+// | |
+// +-----------+
+// | |
+// | |
+// | Resources |
+// | |
+// | |
+// +-----------+
+//
+// The header contains information related to identification and description of
+// contents.
+//
+// +-------------------------+
+// | Magic (0xCAFEDADA) |
+// +------------+------------+
+// | Major Vers | Minor Vers |
+// +------------+------------+
+// | Location Count |
+// +-------------------------+
+// | Attributes Size |
+// +-------------------------+
+// | Strings Size |
+// +-------------------------+
+//
+// Magic - means of identifying validity of the file. This avoids requiring a
+// special file extension.
+// Major vers, minor vers - differences in version numbers indicate structural
+// changes in the image.
+// Location count - number of locations/resources in the file. This count is also
+// the length of lookup tables used in the directory.
+// Attributes size - number of bytes in the region used to store location attribute
+// streams.
+// Strings size - the size of the region used to store strings used by the
+// directory and meta data.
+//
+// The directory contains information related to resource lookup. The algorithm
+// used for lookup is "A Practical Minimal Perfect Hashing Method"
+// (http://homepages.dcc.ufmg.br/~nivio/papers/wea05.pdf). Given a path string
+// in the form <package>/<base>.<extension> return the resource location
+// information;
+//
+// redirectIndex = hash(path, DEFAULT_SEED) % count;
+// redirect = redirectTable[redirectIndex];
+// if (redirect == 0) return not found;
+// locationIndex = redirect < 0 ? -1 - redirect : hash(path, redirect) % count;
+// location = locationTable[locationIndex];
+// if (!verify(location, path)) return not found;
+// return location;
+//
+// Note: The hash function takes an initial seed value. A different seed value
+// usually returns a different result for strings that would otherwise collide with
+// other seeds. The verify function guarantees the found resource location is
+// indeed the resource we are looking for.
+//
+// The following is the format of the directory;
+//
+// +-------------------+
+// | Redirect Table |
+// +-------------------+
+// | Attribute Offsets |
+// +-------------------+
+// | Attribute Data |
+// +-------------------+
+// | Strings |
+// +-------------------+
+//
+// Redirect Table - Array of 32-bit signed values representing actions that
+// should take place for hashed strings that map to that
+// value. Negative values indicate no hash collision and can be
+// quickly converted to indices into attribute offsets. Positive
+// values represent a new seed for hashing an index into attribute
+// offsets. Zero indicates not found.
+// Attribute Offsets - Array of 32-bit unsigned values representing offsets into
+// attribute data. Attribute offsets can be iterated to do a
+// full survey of resources in the image.
+// Attribute Data - Bytes representing compact attribute data for locations. (See
+// comments in ImageLocation.)
+// Strings - Collection of zero terminated UTF-8 strings used by the directory and
+// image meta data. Each string is accessed by offset. Each string is
+// unique. Offset zero is reserved for the empty string.
+//
+// Note that the memory mapped directory assumes 32 bit alignment of the image
+// header, the redirect table and the attribute offsets.
+//
+
+
+// Manage image file string table.
+class ImageStrings {
+private:
+ // Data bytes for strings.
+ u1* _data;
+ // Number of bytes in the string table.
+ u4 _size;
+
+public:
+ // Prime used to generate hash for Perfect Hashing.
+ static const u4 HASH_MULTIPLIER = 0x01000193;
+
+ ImageStrings(u1* data, u4 size) : _data(data), _size(size) {}
+
+ // Return the UTF-8 string beginning at offset.
+ inline const char* get(u4 offset) const {
+ assert(offset < _size, "offset exceeds string table size");
+ return (const char*)(_data + offset);
+ }
+
+ // Compute the Perfect Hashing hash code for the supplied string.
+ inline static u4 hash_code(const char* string) {
+ return hash_code(string, HASH_MULTIPLIER);
+ }
+
+ // Compute the Perfect Hashing hash code for the supplied string, starting at seed.
+ static u4 hash_code(const char* string, u4 seed);
+
+ // Test to see if string begins with start. If so returns remaining portion
+ // of string. Otherwise, NULL. Used to test sections of a path without
+ // copying.
+ static const char* starts_with(const char* string, const char* start);
+
+};
+
+// Manage image file location attribute streams. Within an image, a location's
+// attributes are compressed into a stream of bytes. An attribute stream is
+// composed of individual attribute sequences. Each attribute sequence begins with
+// a header byte containing the attribute 'kind' (upper 5 bits of header) and the
+// 'length' less 1 (lower 3 bits of header) of bytes that follow containing the
+// attribute value. Attribute values present as most significant byte first.
+//
+// Ex. Container offset (ATTRIBUTE_OFFSET) 0x33562 would be represented as 0x22
+// (kind = 4, length = 3), 0x03, 0x35, 0x62.
+//
+// An attribute stream is terminated with a header kind of ATTRIBUTE_END (header
+// byte of zero.)
+//
+// ImageLocation inflates the stream into individual values stored in the long
+// array _attributes. This allows an attribute value can be quickly accessed by
+// direct indexing. Unspecified values default to zero.
+//
+// Notes:
+// - Even though ATTRIBUTE_END is used to mark the end of the attribute stream,
+// streams will contain zero byte values to represent lesser significant bits.
+// Thus, detecting a zero byte is not sufficient to detect the end of an attribute
+// stream.
+// - ATTRIBUTE_OFFSET represents the number of bytes from the beginning of the region
+// storing the resources. Thus, in an image this represents the number of bytes
+// after the directory.
+// - Currently, compressed resources are represented by having a non-zero
+// ATTRIBUTE_COMPRESSED value. This represents the number of bytes stored in the
+// image, and the value of ATTRIBUTE_UNCOMPRESSED represents number of bytes of the
+// inflated resource in memory. If the ATTRIBUTE_COMPRESSED is zero then the value
+// of ATTRIBUTE_UNCOMPRESSED represents both the number of bytes in the image and
+// in memory. In the future, additional compression techniques will be used and
+// represented differently.
+// - Package strings include trailing slash and extensions include prefix period.
+//
+class ImageLocation {
+public:
+ // Attribute kind enumeration.
+ static const u1 ATTRIBUTE_END = 0; // End of attribute stream marker
+ static const u1 ATTRIBUTE_BASE = 1; // String table offset of resource path base
+ static const u1 ATTRIBUTE_PARENT = 2; // String table offset of resource path parent
+ static const u1 ATTRIBUTE_EXTENSION = 3; // String table offset of resource path extension
+ static const u1 ATTRIBUTE_OFFSET = 4; // Container byte offset of resource
+ static const u1 ATTRIBUTE_COMPRESSED = 5; // In image byte size of the compressed resource
+ static const u1 ATTRIBUTE_UNCOMPRESSED = 6; // In memory byte size of the uncompressed resource
+ static const u1 ATTRIBUTE_COUNT = 7; // Number of attribute kinds
+
+private:
+ // Values of inflated attributes.
+ u8 _attributes[ATTRIBUTE_COUNT];
+
+ // Return the attribute value number of bytes.
+ inline static u1 attribute_length(u1 data) {
+ return (data & 0x7) + 1;
+ }
+
+ // Return the attribute kind.
+ inline static u1 attribute_kind(u1 data) {
+ u1 kind = data >> 3;
+ assert(kind < ATTRIBUTE_COUNT, "invalid attribute kind");
+ return kind;
+ }
+
+ // Return the attribute length.
+ inline static u8 attribute_value(u1* data, u1 n) {
+ assert(0 < n && n <= 8, "invalid attribute value length");
+ u8 value = 0;
+
+ // Most significant bytes first.
+ for (u1 i = 0; i < n; i++) {
+ value <<= 8;
+ value |= data[i];
+ }
+
+ return value;
+ }
+
+public:
+ ImageLocation(u1* data);
+
+ // Retrieve an attribute value from the inflated array.
+ inline u8 get_attribute(u1 kind) const {
+ assert(ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT, "invalid attribute kind");
+ return _attributes[kind];
+ }
+
+ // Retrieve an attribute string value from the inflated array.
+ inline const char* get_attribute(u4 kind, const ImageStrings& strings) const {
+ return strings.get((u4)get_attribute(kind));
+ }
+};
+
+// Manage the image file.
+class ImageFile: public CHeapObj<mtClass> {
+private:
+ // Image file marker.
+ static const u4 IMAGE_MAGIC = 0xCAFEDADA;
+ // Image file major version number.
+ static const u2 MAJOR_VERSION = 0;
+ // Image file minor version number.
+ static const u2 MINOR_VERSION = 1;
+
+ struct ImageHeader {
+ u4 _magic; // Image file marker
+ u2 _major_version; // Image file major version number
+ u2 _minor_version; // Image file minor version number
+ u4 _location_count; // Number of locations managed in index.
+ u4 _locations_size; // Number of bytes in attribute table.
+ u4 _strings_size; // Number of bytes in string table.
+ };
+
+ char* _name; // Name of image
+ int _fd; // File descriptor
+ bool _memory_mapped; // Is file memory mapped
+ ImageHeader _header; // Image header
+ u8 _index_size; // Total size of index
+ u1* _index_data; // Raw index data
+ s4* _redirect_table; // Perfect hash redirect table
+ u4* _offsets_table; // Location offset table
+ u1* _location_bytes; // Location attributes
+ u1* _string_bytes; // String table
+
+ // Compute number of bytes in image file index.
+ inline u8 index_size() {
+ return sizeof(ImageHeader) +
+ _header._location_count * sizeof(u4) * 2 +
+ _header._locations_size +
+ _header._strings_size;
+ }
+
+public:
+ ImageFile(const char* name);
+ ~ImageFile();
+
+ // Open image file for access.
+ bool open();
+ // Close image file.
+ void close();
+
+ // Retrieve name of image file.
+ inline const char* name() const {
+ return _name;
+ }
+
+ // Return a string table accessor.
+ inline const ImageStrings get_strings() const {
+ return ImageStrings(_string_bytes, _header._strings_size);
+ }
+
+ // Return number of locations in image file index.
+ inline u4 get_location_count() const {
+ return _header._location_count;
+ }
+
+ // Return location attribute stream for location i.
+ inline u1* get_location_data(u4 i) const {
+ u4 offset = _offsets_table[i];
+
+ return offset != 0 ? _location_bytes + offset : NULL;
+ }
+
+ // Return the attribute stream for a named resourced.
+ u1* find_location_data(const char* path) const;
+
+ // Verify that a found location matches the supplied path.
+ bool verify_location(ImageLocation& location, const char* path) const;
+
+ // Return the resource for the supplied location info.
+ u1* get_resource(ImageLocation& location) const;
+
+ // Return the resource associated with the path else NULL if not found.
+ void get_resource(const char* path, u1*& buffer, u8& size) const;
+
+ // Return an array of packages for a given module
+ GrowableArray<const char*>* packages(const char* name);
+};
+
+#endif // SHARE_VM_CLASSFILE_IMAGEFILE_HPP
--- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp Wed Jul 05 20:08:34 2017 +0200
@@ -110,7 +110,7 @@
bool SharedPathsMiscInfo::check(jint type, const char* path) {
switch (type) {
case BOOT:
- if (strcmp(path, Arguments::get_sysclasspath()) != 0) {
+ if (os::file_name_strcmp(path, Arguments::get_sysclasspath()) != 0) {
return fail("[BOOT classpath mismatch, actual: -Dsun.boot.class.path=", Arguments::get_sysclasspath());
}
break;
--- a/hotspot/src/share/vm/memory/filemap.cpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/share/vm/memory/filemap.cpp Wed Jul 05 20:08:34 2017 +0200
@@ -217,9 +217,14 @@
EXCEPTION_MARK; // The following call should never throw, but would exit VM on error.
SharedClassUtil::update_shared_classpath(cpe, ent, st.st_mtime, st.st_size, THREAD);
} else {
- ent->_filesize = -1;
- if (!os::dir_is_empty(name)) {
- ClassLoader::exit_with_path_failure("Cannot have non-empty directory in archived classpaths", name);
+ struct stat st;
+ if ((os::stat(name, &st) == 0) && ((st.st_mode & S_IFDIR) == S_IFDIR)) {
+ if (!os::dir_is_empty(name)) {
+ ClassLoader::exit_with_path_failure("Cannot have non-empty directory in archived classpaths", name);
+ }
+ ent->_filesize = -1;
+ } else {
+ ent->_filesize = -2;
}
}
ent->_name = strptr;
@@ -271,7 +276,7 @@
fail_continue("directory is not empty: %s", name);
ok = false;
}
- } else {
+ } else if (ent->is_jar()) {
if (ent->_timestamp != st.st_mtime ||
ent->_filesize != st.st_size) {
ok = false;
--- a/hotspot/src/share/vm/memory/filemap.hpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/share/vm/memory/filemap.hpp Wed Jul 05 20:08:34 2017 +0200
@@ -44,8 +44,11 @@
class SharedClassPathEntry VALUE_OBJ_CLASS_SPEC {
public:
const char *_name;
- time_t _timestamp; // jar timestamp, 0 if is directory
- long _filesize; // jar file size, -1 if is directory
+ time_t _timestamp; // jar timestamp, 0 if is directory or other
+ long _filesize; // jar file size, -1 if is directory, -2 if other
+ bool is_jar() {
+ return _timestamp != 0;
+ }
bool is_dir() {
return _filesize == -1;
}
--- a/hotspot/src/share/vm/runtime/arguments.cpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Wed Jul 05 20:08:34 2017 +0200
@@ -115,8 +115,6 @@
vfprintf_hook_t Arguments::_vfprintf_hook = NULL;
-SystemProperty *Arguments::_java_ext_dirs = NULL;
-SystemProperty *Arguments::_java_endorsed_dirs = NULL;
SystemProperty *Arguments::_sun_boot_library_path = NULL;
SystemProperty *Arguments::_java_library_path = NULL;
SystemProperty *Arguments::_java_home = NULL;
@@ -125,6 +123,7 @@
char* Arguments::_meta_index_path = NULL;
char* Arguments::_meta_index_dir = NULL;
+char* Arguments::_ext_dirs = NULL;
// Check if head of 'option' matches 'name', and sets 'tail' remaining part of option string
@@ -184,8 +183,6 @@
// Following are JVMTI agent writable properties.
// Properties values are set to NULL and they are
// os specific they are initialized in os::init_system_properties_values().
- _java_ext_dirs = new SystemProperty("java.ext.dirs", NULL, true);
- _java_endorsed_dirs = new SystemProperty("java.endorsed.dirs", NULL, true);
_sun_boot_library_path = new SystemProperty("sun.boot.library.path", NULL, true);
_java_library_path = new SystemProperty("java.library.path", NULL, true);
_java_home = new SystemProperty("java.home", NULL, true);
@@ -194,8 +191,6 @@
_java_class_path = new SystemProperty("java.class.path", "", true);
// Add to System Property list.
- PropertyList_add(&_system_properties, _java_ext_dirs);
- PropertyList_add(&_system_properties, _java_endorsed_dirs);
PropertyList_add(&_system_properties, _sun_boot_library_path);
PropertyList_add(&_system_properties, _java_library_path);
PropertyList_add(&_system_properties, _java_home);
@@ -344,13 +339,9 @@
// components, in order:
//
// prefix // from -Xbootclasspath/p:...
-// endorsed // the expansion of -Djava.endorsed.dirs=...
// base // from os::get_system_properties() or -Xbootclasspath=
// suffix // from -Xbootclasspath/a:...
//
-// java.endorsed.dirs is a list of directories; any jar or zip files in the
-// directories are added to the sysclasspath just before the base.
-//
// This could be AllStatic, but it isn't needed after argument processing is
// complete.
class SysClassPath: public StackObj {
@@ -364,16 +355,9 @@
inline void add_suffix(const char* suffix);
inline void reset_path(const char* base);
- // Expand the jar/zip files in each directory listed by the java.endorsed.dirs
- // property. Must be called after all command-line arguments have been
- // processed (in particular, -Djava.endorsed.dirs=...) and before calling
- // combined_path().
- void expand_endorsed();
-
inline const char* get_base() const { return _items[_scp_base]; }
inline const char* get_prefix() const { return _items[_scp_prefix]; }
inline const char* get_suffix() const { return _items[_scp_suffix]; }
- inline const char* get_endorsed() const { return _items[_scp_endorsed]; }
// Combine all the components into a single c-heap-allocated string; caller
// must free the string if/when no longer needed.
@@ -390,20 +374,17 @@
// base are allocated in the C heap and freed by this class.
enum {
_scp_prefix, // from -Xbootclasspath/p:...
- _scp_endorsed, // the expansion of -Djava.endorsed.dirs=...
_scp_base, // the default sysclasspath
_scp_suffix, // from -Xbootclasspath/a:...
_scp_nitems // the number of items, must be last.
};
const char* _items[_scp_nitems];
- DEBUG_ONLY(bool _expansion_done;)
};
SysClassPath::SysClassPath(const char* base) {
memset(_items, 0, sizeof(_items));
_items[_scp_base] = base;
- DEBUG_ONLY(_expansion_done = false;)
}
SysClassPath::~SysClassPath() {
@@ -411,7 +392,6 @@
for (int i = 0; i < _scp_nitems; ++i) {
if (i != _scp_base) reset_item_at(i);
}
- DEBUG_ONLY(_expansion_done = false;)
}
inline void SysClassPath::set_base(const char* base) {
@@ -447,41 +427,11 @@
//------------------------------------------------------------------------------
-void SysClassPath::expand_endorsed() {
- assert(_items[_scp_endorsed] == NULL, "can only be called once.");
-
- const char* path = Arguments::get_property("java.endorsed.dirs");
- if (path == NULL) {
- path = Arguments::get_endorsed_dir();
- assert(path != NULL, "no default for java.endorsed.dirs");
- }
-
- char* expanded_path = NULL;
- const char separator = *os::path_separator();
- const char* const end = path + strlen(path);
- while (path < end) {
- const char* tmp_end = strchr(path, separator);
- if (tmp_end == NULL) {
- expanded_path = add_jars_to_path(expanded_path, path);
- path = end;
- } else {
- char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
- memcpy(dirpath, path, tmp_end - path);
- dirpath[tmp_end - path] = '\0';
- expanded_path = add_jars_to_path(expanded_path, dirpath);
- FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
- path = tmp_end + 1;
- }
- }
- _items[_scp_endorsed] = expanded_path;
- DEBUG_ONLY(_expansion_done = true;)
-}
// Combine the bootclasspath elements, some of which may be null, into a single
// c-heap-allocated string.
char* SysClassPath::combined_path() {
assert(_items[_scp_base] != NULL, "empty default sysclasspath");
- assert(_expansion_done, "must call expand_endorsed() first.");
size_t lengths[_scp_nitems];
size_t total_len = 0;
@@ -3084,6 +3034,20 @@
#endif
// -D
} else if (match_option(option, "-D", &tail)) {
+ if (match_option(option, "-Djava.endorsed.dirs=", &tail)) {
+ // abort if -Djava.endorsed.dirs is set
+ jio_fprintf(defaultStream::output_stream(),
+ "-Djava.endorsed.dirs is not supported. Endorsed standards and standalone APIs\n"
+ "in modular form will be supported via the concept of upgradeable modules.\n");
+ return JNI_EINVAL;
+ }
+ if (match_option(option, "-Djava.ext.dirs=", &tail)) {
+ // abort if -Djava.ext.dirs is set
+ jio_fprintf(defaultStream::output_stream(),
+ "-Djava.ext.dirs is not supported. Use -classpath instead.\n");
+ return JNI_EINVAL;
+ }
+
if (!add_property(tail)) {
return JNI_ENOMEM;
}
@@ -3529,11 +3493,89 @@
}
}
+static bool has_jar_files(const char* directory) {
+ DIR* dir = os::opendir(directory);
+ if (dir == NULL) return false;
+
+ struct dirent *entry;
+ char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(directory), mtInternal);
+ bool hasJarFile = false;
+ while (!hasJarFile && (entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
+ const char* name = entry->d_name;
+ const char* ext = name + strlen(name) - 4;
+ hasJarFile = ext > name && (os::file_name_strcmp(ext, ".jar") == 0);
+ }
+ FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+ os::closedir(dir);
+ return hasJarFile ;
+}
+
+static int check_non_empty_dirs(const char* path) {
+ const char separator = *os::path_separator();
+ const char* const end = path + strlen(path);
+ int nonEmptyDirs = 0;
+ while (path < end) {
+ const char* tmp_end = strchr(path, separator);
+ if (tmp_end == NULL) {
+ if (has_jar_files(path)) {
+ nonEmptyDirs++;
+ jio_fprintf(defaultStream::output_stream(),
+ "Non-empty directory: %s\n", path);
+ }
+ path = end;
+ } else {
+ char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
+ memcpy(dirpath, path, tmp_end - path);
+ dirpath[tmp_end - path] = '\0';
+ if (has_jar_files(dirpath)) {
+ nonEmptyDirs++;
+ jio_fprintf(defaultStream::output_stream(),
+ "Non-empty directory: %s\n", dirpath);
+ }
+ FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
+ path = tmp_end + 1;
+ }
+ }
+ return nonEmptyDirs;
+}
+
jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
- // This must be done after all -D arguments have been processed.
- scp_p->expand_endorsed();
-
- if (scp_assembly_required || scp_p->get_endorsed() != NULL) {
+ // check if the default lib/endorsed directory exists; if so, error
+ char path[JVM_MAXPATHLEN];
+ const char* fileSep = os::file_separator();
+ sprintf(path, "%s%slib%sendorsed", Arguments::get_java_home(), fileSep, fileSep);
+
+ if (CheckEndorsedAndExtDirs) {
+ int nonEmptyDirs = 0;
+ // check endorsed directory
+ nonEmptyDirs += check_non_empty_dirs(path);
+ // check the extension directories
+ nonEmptyDirs += check_non_empty_dirs(Arguments::get_ext_dirs());
+ if (nonEmptyDirs > 0) {
+ return JNI_ERR;
+ }
+ }
+
+ DIR* dir = os::opendir(path);
+ if (dir != NULL) {
+ jio_fprintf(defaultStream::output_stream(),
+ "<JAVA_HOME>/lib/endorsed is not supported. Endorsed standards and standalone APIs\n"
+ "in modular form will be supported via the concept of upgradeable modules.\n");
+ os::closedir(dir);
+ return JNI_ERR;
+ }
+
+ sprintf(path, "%s%slib%sext", Arguments::get_java_home(), fileSep, fileSep);
+ dir = os::opendir(path);
+ if (dir != NULL) {
+ jio_fprintf(defaultStream::output_stream(),
+ "<JAVA_HOME>/lib/ext exists, extensions mechanism no longer supported; "
+ "Use -classpath instead.\n.");
+ os::closedir(dir);
+ return JNI_ERR;
+ }
+
+ if (scp_assembly_required) {
// Assemble the bootclasspath elements into the final path.
Arguments::set_sysclasspath(scp_p->combined_path());
}
--- a/hotspot/src/share/vm/runtime/arguments.hpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/share/vm/runtime/arguments.hpp Wed Jul 05 20:08:34 2017 +0200
@@ -254,8 +254,6 @@
static SystemProperty* _system_properties;
// Quick accessor to System properties in the list:
- static SystemProperty *_java_ext_dirs;
- static SystemProperty *_java_endorsed_dirs;
static SystemProperty *_sun_boot_library_path;
static SystemProperty *_java_library_path;
static SystemProperty *_java_home;
@@ -266,6 +264,10 @@
static char* _meta_index_path;
static char* _meta_index_dir;
+ // temporary: to emit warning if the default ext dirs are not empty.
+ // remove this variable when the warning is no longer needed.
+ static char* _ext_dirs;
+
// java.vendor.url.bug, bug reporting URL for fatal errors.
static const char* _java_vendor_url_bug;
@@ -586,8 +588,7 @@
static void set_dll_dir(char *value) { _sun_boot_library_path->set_value(value); }
static void set_java_home(char *value) { _java_home->set_value(value); }
static void set_library_path(char *value) { _java_library_path->set_value(value); }
- static void set_ext_dirs(char *value) { _java_ext_dirs->set_value(value); }
- static void set_endorsed_dirs(char *value) { _java_endorsed_dirs->set_value(value); }
+ static void set_ext_dirs(char *value) { _ext_dirs = os::strdup_check_oom(value); }
static void set_sysclasspath(char *value) { _sun_boot_class_path->set_value(value); }
static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); }
static void set_meta_index_path(char* meta_index_path, char* meta_index_dir) {
@@ -597,14 +598,14 @@
static char* get_java_home() { return _java_home->value(); }
static char* get_dll_dir() { return _sun_boot_library_path->value(); }
- static char* get_endorsed_dir() { return _java_endorsed_dirs->value(); }
static char* get_sysclasspath() { return _sun_boot_class_path->value(); }
static char* get_meta_index_path() { return _meta_index_path; }
static char* get_meta_index_dir() { return _meta_index_dir; }
- static char* get_ext_dirs() { return _java_ext_dirs->value(); }
+ static char* get_ext_dirs() { return _ext_dirs; }
static char* get_appclasspath() { return _java_class_path->value(); }
static void fix_appclasspath();
+
// Operation modi
static Mode mode() { return _mode; }
static bool is_interpreter_only() { return mode() == _int; }
--- a/hotspot/src/share/vm/runtime/globals.hpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/share/vm/runtime/globals.hpp Wed Jul 05 20:08:34 2017 +0200
@@ -1233,6 +1233,9 @@
product(bool, CheckJNICalls, false, \
"Verify all arguments to JNI calls") \
\
+ product(bool, CheckEndorsedAndExtDirs, false, \
+ "Verify the endorsed and extension directories are not used") \
+ \
product(bool, UseFastJNIAccessors, true, \
"Use optimized versions of Get<Primitive>Field") \
\
--- a/hotspot/src/share/vm/runtime/os.cpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/share/vm/runtime/os.cpp Wed Jul 05 20:08:34 2017 +0200
@@ -1230,11 +1230,21 @@
Arguments::set_meta_index_path(meta_index, meta_index_dir);
char* sysclasspath = NULL;
+ struct stat st;
+
+ // modular image if bootmodules.jimage exists
+ char* jimage = format_boot_path("%/lib/modules/bootmodules.jimage", home, home_len, fileSep, pathSep);
+ if (jimage == NULL) return false;
+ bool has_jimage = (os::stat(jimage, &st) == 0);
+ if (has_jimage) {
+ Arguments::set_sysclasspath(jimage);
+ return true;
+ }
+ FREE_C_HEAP_ARRAY(char, jimage, mtInternal);
// images build if rt.jar exists
char* rt_jar = format_boot_path("%/lib/rt.jar", home, home_len, fileSep, pathSep);
if (rt_jar == NULL) return false;
- struct stat st;
bool has_rt_jar = (os::stat(rt_jar, &st) == 0);
FREE_C_HEAP_ARRAY(char, rt_jar, mtInternal);
--- a/hotspot/src/share/vm/runtime/os.hpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/share/vm/runtime/os.hpp Wed Jul 05 20:08:34 2017 +0200
@@ -500,6 +500,7 @@
//File i/o operations
static size_t read(int fd, void *buf, unsigned int nBytes);
+ static size_t read_at(int fd, void *buf, unsigned int nBytes, jlong offset);
static size_t restartable_read(int fd, void *buf, unsigned int nBytes);
static size_t write(int fd, const void *buf, unsigned int nBytes);
--- a/hotspot/src/share/vm/runtime/statSampler.cpp Tue Nov 18 15:25:16 2014 -0800
+++ b/hotspot/src/share/vm/runtime/statSampler.cpp Wed Jul 05 20:08:34 2017 +0200
@@ -225,8 +225,6 @@
"java.vm.info",
"java.library.path",
"java.class.path",
- "java.endorsed.dirs",
- "java.ext.dirs",
"java.version",
"java.home",
NULL
--- a/jaxp/.hgtags Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/.hgtags Wed Jul 05 20:08:34 2017 +0200
@@ -282,3 +282,4 @@
48e4ec70cc1c8651e4a0324d91f193c4edd83af9 jdk9-b37
6c6b34477e93e6fb350035f73ed7c02266b78380 jdk9-b38
a12d347f84176200593999f4da91ae2bb86865b2 jdk9-b39
+3f46e2196498de33e7c65efa7b372e46f1faba01 jdk9-b40
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassPath.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassPath.java Wed Jul 05 20:08:34 2017 +0200
@@ -151,18 +151,17 @@
}
/** Checks for class path components in the following properties:
- * "java.class.path", "sun.boot.class.path", "java.ext.dirs"
+ * "java.class.path", "sun.boot.class.path"
*
* @return class path as used by default by BCEL
*/
public static final String getClassPath() {
- String class_path, boot_path, ext_path;
+ String class_path, boot_path;
try {
class_path = SecuritySupport.getSystemProperty("java.class.path");
boot_path = SecuritySupport.getSystemProperty("sun.boot.class.path");
- ext_path = SecuritySupport.getSystemProperty("java.ext.dirs");
}
catch (SecurityException e) {
return "";
@@ -173,23 +172,6 @@
getPathComponents(class_path, list);
getPathComponents(boot_path, list);
- ArrayList dirs = new ArrayList();
- getPathComponents(ext_path, dirs);
-
- for(Iterator e = dirs.iterator(); e.hasNext(); ) {
- File ext_dir = new File((String)e.next());
- String[] extensions = SecuritySupport.getFileList(ext_dir, new FilenameFilter() {
- public boolean accept(File dir, String name) {
- name = name.toLowerCase();
- return name.endsWith(".zip") || name.endsWith(".jar");
- }
- });
-
- if(extensions != null)
- for(int i=0; i < extensions.length; i++)
- list.add(ext_path + File.separatorChar + extensions[i]);
- }
-
StringBuffer buf = new StringBuffer();
for(Iterator e = list.iterator(); e.hasNext(); ) {
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java Wed Jul 05 20:08:34 2017 +0200
@@ -243,6 +243,9 @@
if (protocol.equalsIgnoreCase("jar")) {
String path = url.getPath();
protocol = path.substring(0, path.indexOf(":"));
+ } else if (protocol.equalsIgnoreCase("jrt")) {
+ // if the systemId is "jrt" then allow access if "file" allowed
+ protocol = "file";
}
}
@@ -278,7 +281,7 @@
/**
* Read JAXP system property in this order: system property,
- * $java.home/lib/jaxp.properties if the system property is not specified
+ * $java.home/conf/jaxp.properties if the system property is not specified
*
* @param propertyId the Id of the property
* @return the value of the property
@@ -292,7 +295,7 @@
}
/**
- * Read from $java.home/lib/jaxp.properties for the specified property
+ * Read from $java.home/conf/jaxp.properties for the specified property
* The program
*
* @param propertyId the Id of the property
@@ -306,7 +309,7 @@
synchronized (cacheProps) {
if (firstTime) {
String configFile = getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
if (getFileExists(f)) {
is = getFileInputStream(f);
@@ -332,12 +335,12 @@
}
/**
- * Cache for properties in java.home/lib/jaxp.properties
+ * Cache for properties in java.home/conf/jaxp.properties
*/
static final Properties cacheProps = new Properties();
/**
- * Flag indicating if the program has tried reading java.home/lib/jaxp.properties
+ * Flag indicating if the program has tried reading java.home/conf/jaxp.properties
*/
static volatile boolean firstTime = true;
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java Wed Jul 05 20:08:34 2017 +0200
@@ -558,9 +558,6 @@
* Logs java.class.path and other likely paths; then attempts
* to search those paths for .jar files with Xalan-related classes.
*
- * //@todo NOTE: We don't actually search java.ext.dirs for
- * // *.jar files therein! This should be updated
- *
* @param h Hashtable to put information in
* @see #jarNames
* @see #checkPathForJars(String, String[])
@@ -615,20 +612,6 @@
h.put(FOUNDCLASSES + "sun.boot.class.path", classpathJars);
}
- //@todo NOTE: We don't actually search java.ext.dirs for
- // *.jar files therein! This should be updated
- othercp = SecuritySupport.getSystemProperty("java.ext.dirs");
-
- if (null != othercp)
- {
- h.put("java.ext.dirs", othercp);
-
- classpathJars = checkPathForJars(othercp, jarNames);
-
- if (null != classpathJars)
- h.put(FOUNDCLASSES + "java.ext.dirs", classpathJars);
- }
-
//@todo also check other System properties' paths?
// v2 = checkPathForJars(System.getProperty("sun.boot.library.path"), jarNames); // ?? may not be needed
// v3 = checkPathForJars(System.getProperty("java.library.path"), jarNames); // ?? may not be needed
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java Wed Jul 05 20:08:34 2017 +0200
@@ -41,7 +41,7 @@
* Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
* </li>
* <li>
- * If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
+ * If the file ${JAVA_HOME}/conf/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
* The <code>Properties</code> <code>Object </code> is then queried for the property as documented in the prior step
* and processed as documented in the prior step.
* </li>
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java Wed Jul 05 20:08:34 2017 +0200
@@ -237,6 +237,9 @@
if (protocol.equalsIgnoreCase("jar")) {
String path = url.getPath();
protocol = path.substring(0, path.indexOf(":"));
+ } else if (protocol.equalsIgnoreCase("jrt")) {
+ // if the systemId is "jrt" then allow access if "file" allowed
+ protocol = "file";
}
}
@@ -272,7 +275,7 @@
/**
* Read JAXP system property in this order: system property,
- * $java.home/lib/jaxp.properties if the system property is not specified
+ * $java.home/conf/jaxp.properties if the system property is not specified
*
* @param propertyId the Id of the property
* @return the value of the property
@@ -286,7 +289,7 @@
}
/**
- * Read from $java.home/lib/jaxp.properties for the specified property
+ * Read from $java.home/conf/jaxp.properties for the specified property
* The program
*
* @param propertyId the Id of the property
@@ -300,7 +303,7 @@
synchronized (cacheProps) {
if (firstTime) {
String configFile = getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
if (getFileExists(f)) {
is = getFileInputStream(f);
@@ -326,12 +329,12 @@
}
/**
- * Cache for properties in java.home/lib/jaxp.properties
+ * Cache for properties in java.home/conf/jaxp.properties
*/
static final Properties cacheProps = new Properties();
/**
- * Flag indicating if the program has tried reading java.home/lib/jaxp.properties
+ * Flag indicating if the program has tried reading java.home/conf/jaxp.properties
*/
static volatile boolean firstTime = true;
--- a/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java Wed Jul 05 20:08:34 2017 +0200
@@ -247,7 +247,7 @@
* </p>
*
* <p>
- * <b>${JAVA_HOME}/lib/jaxp.properties:</b> This configuration file is in standard
+ * <b>${JAVA_HOME}/conf/jaxp.properties:</b> This configuration file is in standard
* {@link java.util.Properties} format. If the file exists and the system property is specified,
* its value will be used to override the default of the property.
* </p>
@@ -314,7 +314,7 @@
* </p>
*
* <p>
- * <b>${JAVA_HOME}/lib/jaxp.properties:</b> This configuration file is in standard
+ * <b>${JAVA_HOME}/conf/jaxp.properties:</b> This configuration file is in standard
* java.util.Properties format. If the file exists and the system property is specified,
* its value will be used to override the default of the property.
*
@@ -380,7 +380,7 @@
* </p>
*
* <p>
- * <b>${JAVA_HOME}/lib/jaxp.properties: </b> This configuration file is in standard
+ * <b>${JAVA_HOME}/conf/jaxp.properties: </b> This configuration file is in standard
* java.util.Properties format. If the file exists and the system property is specified,
* its value will be used to override the default of the property.
*
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java Wed Jul 05 20:08:34 2017 +0200
@@ -43,7 +43,7 @@
* Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
* </li>
* <li>
- * If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
+ * If the file ${JAVA_HOME}/conf/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
* The <code>Properties</code> <code>Object </code> is then queried for the property as documented in the prior step
* and processed as documented in the prior step.
* </li>
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java Wed Jul 05 20:08:34 2017 +0200
@@ -50,12 +50,12 @@
private static boolean debug = false;
/**
- * Cache for properties in java.home/lib/jaxp.properties
+ * Cache for properties in java.home/conf/jaxp.properties
*/
private final static Properties cacheProps = new Properties();
/**
- * Flag indicating if properties from java.home/lib/jaxp.properties
+ * Flag indicating if properties from java.home/conf/jaxp.properties
* have been cached.
*/
private static volatile boolean firstTime = true;
@@ -237,13 +237,13 @@
if (debug) se.printStackTrace();
}
- // try to read from $java.home/lib/jaxp.properties
+ // try to read from $java.home/conf/jaxp.properties
try {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
String configFile = ss.getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
if (ss.doesFileExist(f)) {
@@ -256,7 +256,7 @@
final String factoryClassName = cacheProps.getProperty(factoryId);
if (factoryClassName != null) {
- dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
+ dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
return newInstance(type, factoryClassName, null, true);
}
}
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java Wed Jul 05 20:08:34 2017 +0200
@@ -66,7 +66,7 @@
* property.
* </li>
* <li>
- * Use the properties file "lib/jaxp.properties" in the JRE directory.
+ * Use the properties file "conf/jaxp.properties" in the JRE directory.
* This configuration file is in standard <code>java.util.Properties
* </code> format and contains the fully qualified name of the
* implementation class with the key being the system property defined
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java Wed Jul 05 20:08:34 2017 +0200
@@ -50,12 +50,12 @@
private static boolean debug = false;
/**
- * Cache for properties in java.home/lib/jaxp.properties
+ * Cache for properties in java.home/conf/jaxp.properties
*/
private static final Properties cacheProps = new Properties();
/**
- * Flag indicating if properties from java.home/lib/jaxp.properties
+ * Flag indicating if properties from java.home/conf/jaxp.properties
* have been cached.
*/
static volatile boolean firstTime = true;
@@ -236,13 +236,13 @@
if (debug) se.printStackTrace();
}
- // try to read from $java.home/lib/jaxp.properties
+ // try to read from $java.home/conf/jaxp.properties
try {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
String configFile = ss.getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
if (ss.doesFileExist(f)) {
@@ -255,7 +255,7 @@
final String factoryClassName = cacheProps.getProperty(factoryId);
if (factoryClassName != null) {
- dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
+ dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
return newInstance(type, factoryClassName, null, true);
}
}
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java Wed Jul 05 20:08:34 2017 +0200
@@ -70,7 +70,7 @@
* property.
* </li>
* <li>
- * Use the properties file "lib/jaxp.properties" in the JRE directory.
+ * Use the properties file "conf/jaxp.properties" in the JRE directory.
* This configuration file is in standard <code>java.util.Properties
* </code> format and contains the fully qualified name of the
* implementation class with the key being the system property defined
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java Wed Jul 05 20:08:34 2017 +0200
@@ -51,12 +51,12 @@
private static boolean debug = false;
/**
- * Cache for properties in java.home/lib/jaxp.properties
+ * Cache for properties in java.home/conf/jaxp.properties
*/
final private static Properties cacheProps = new Properties();
/**
- * Flag indicating if properties from java.home/lib/jaxp.properties
+ * Flag indicating if properties from java.home/conf/jaxp.properties
* have been cached.
*/
private static volatile boolean firstTime = true;
@@ -271,7 +271,7 @@
}
// Try read $java.home/lib/stax.properties followed by
- // $java.home/lib/jaxp.properties if former not present
+ // $java.home/conf/jaxp.properties if former not present
String configFile = null;
try {
if (firstTime) {
@@ -287,7 +287,7 @@
}
else {
configFile = ss.getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
f = new File(configFile);
if (ss.doesFileExist(f)) {
dPrint("Read properties file "+f);
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java Wed Jul 05 20:08:34 2017 +0200
@@ -53,12 +53,12 @@
private static boolean debug = false;
/**
- * Cache for properties in java.home/lib/jaxp.properties
+ * Cache for properties in java.home/conf/jaxp.properties
*/
private final static Properties cacheProps = new Properties();
/**
- * Flag indicating if properties from java.home/lib/jaxp.properties
+ * Flag indicating if properties from java.home/conf/jaxp.properties
* have been cached.
*/
static volatile boolean firstTime = true;
@@ -268,13 +268,13 @@
if (debug) se.printStackTrace();
}
- // try to read from $java.home/lib/jaxp.properties
+ // try to read from $java.home/conf/jaxp.properties
try {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
String configFile = ss.getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
if (ss.doesFileExist(f)) {
@@ -287,7 +287,7 @@
final String factoryClassName = cacheProps.getProperty(factoryId);
if (factoryClassName != null) {
- dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
+ dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
return newInstance(type, factoryClassName, null, true, true);
}
}
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java Wed Jul 05 20:08:34 2017 +0200
@@ -62,7 +62,7 @@
* property.
* </li>
* <li>
- * Use the properties file "lib/jaxp.properties" in the JRE directory.
+ * Use the properties file "conf/jaxp.properties" in the JRE directory.
* This configuration file is in standard <code>java.util.Properties
* </code> format and contains the fully qualified name of the
* implementation class with the key being the system property defined
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java Wed Jul 05 20:08:34 2017 +0200
@@ -141,7 +141,7 @@
* and returns it if it is successfully created.
* </li>
* <li>
- * <code>$java.home/lib/jaxp.properties</code> is read and
+ * <code>$java.home/conf/jaxp.properties</code> is read and
* the value associated with the key being the system property above
* is looked for. If present, the value is processed just like above.
* </li>
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java Wed Jul 05 20:08:34 2017 +0200
@@ -181,10 +181,10 @@
String javah = ss.getSystemProperty( "java.home" );
String configFile = javah + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
- // try to read from $java.home/lib/jaxp.properties
+ // try to read from $java.home/conf/jaxp.properties
try {
if(firstTime){
synchronized(cacheProps){
@@ -199,7 +199,7 @@
}
}
final String factoryClassName = cacheProps.getProperty(propertyName);
- debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
+ debugPrintln("found " + factoryClassName + " in $java.home/conf/jaxp.properties");
if (factoryClassName != null) {
sf = createInstance(factoryClassName, true);
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java Wed Jul 05 20:08:34 2017 +0200
@@ -117,7 +117,7 @@
* and returns it if it is successfully created.
* </li>
* <li>
- * ${java.home}/lib/jaxp.properties is read and the value associated with the key being the system property above is looked for.
+ * ${java.home}/conf/jaxp.properties is read and the value associated with the key being the system property above is looked for.
* If present, the value is processed just like above.
* </li>
* <li>
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java Wed Jul 05 20:08:34 2017 +0200
@@ -176,9 +176,9 @@
String javah = ss.getSystemProperty( "java.home" );
String configFile = javah + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
- // try to read from $java.home/lib/jaxp.properties
+ // try to read from $java.home/conf/jaxp.properties
try {
if(firstTime){
synchronized(cacheProps){
@@ -193,7 +193,7 @@
}
}
final String factoryClassName = cacheProps.getProperty(propertyName);
- debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
+ debugPrintln("found " + factoryClassName + " in $java.home/conf/jaxp.properties");
if (factoryClassName != null) {
xpathFactory = createInstance(factoryClassName, true);
--- a/jdk/.hgtags Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/.hgtags Wed Jul 05 20:08:34 2017 +0200
@@ -282,3 +282,4 @@
27c3345d6dce39a22c262f30bb1f0e0b00c3709e jdk9-b37
d2d745313c81d1fc01f426983b9f784ab1f750e8 jdk9-b38
ca6edf957fe1c6ea818530b503578e872cea7239 jdk9-b39
+f1ed1540da70a066527fd043413107e47721edbf jdk9-b40
--- a/jdk/make/Bundles.gmk Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-include $(SPEC)
-include MakeBase.gmk
-
-default: bundles
-
-# Only macosx has bundles defined.
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-
- bundles: jre-bundle jdk-bundle
-
- # JDK_BUNDLE_DIR and JRE_BUNDLE_DIR are defined in SPEC.
-
- MACOSX_PLIST_SRC := $(JDK_TOPDIR)/make/data/bundle
-
- # All these OPENJDK checks are needed since there is no coherency between
- # these values in open and closed. Should probably be fixed.
- ifndef OPENJDK
- BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(JDK_MINOR_VERSION)u$(JDK_UPDATE_VERSION)
- else
- BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE)
- endif
- BUNDLE_ID_JRE := $(BUNDLE_ID).jre
- BUNDLE_ID_JDK := $(BUNDLE_ID).jdk
-
- BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_MINOR_VERSION)
- BUNDLE_NAME_JRE := $(BUNDLE_NAME)
- BUNDLE_NAME_JDK := $(BUNDLE_NAME)
-
- ifndef OPENJDK
- BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_VERSION)
- else
- BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) ($(JDK_VERSION))
- endif
- BUNDLE_INFO_JRE := $(BUNDLE_INFO)
- BUNDLE_INFO_JDK := $(BUNDLE_INFO)
-
- BUNDLE_PLATFORM_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)
- BUNDLE_VERSION := $(JDK_VERSION)
- ifeq ($(COMPANY_NAME), N/A)
- BUNDLE_VENDOR := UNDEFINED
- else
- BUNDLE_VENDOR := $(COMPANY_NAME)
- endif
-
-
- JDK_FILE_LIST := $(shell $(FIND) $(JDK_IMAGE_DIR))
- JRE_FILE_LIST := $(shell $(FIND) $(JRE_IMAGE_DIR))
-
- JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_BUNDLE_DIR)/Home/,$(JDK_FILE_LIST))
- JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_BUNDLE_DIR)/Home/,$(JRE_FILE_LIST))
-
- # Copy empty directories (jre/lib/applet).
- $(JDK_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
- $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(MKDIR) -p $(@D)
- if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
-
- $(JRE_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
- $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(MKDIR) -p $(@D)
- if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
-
- $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib:
- $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(MKDIR) -p $(@D)
- $(RM) $@
- $(LN) -s ../Home/jre/lib/jli/libjli.dylib $@
-
- $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib:
- $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(MKDIR) -p $(@D)
- $(RM) $@
- $(LN) -s ../Home/lib/jli/libjli.dylib $@
-
- $(JDK_BUNDLE_DIR)/Info.plist: $(SPEC)
- $(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(MKDIR) -p $(@D)
- $(SED) -e "s/@@ID@@/$(BUNDLE_ID_JDK)/g" \
- -e "s/@@NAME@@/$(BUNDLE_NAME_JDK)/g" \
- -e "s/@@INFO@@/$(BUNDLE_INFO_JDK)/g" \
- -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
- -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
- -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
- < $(MACOSX_PLIST_SRC)/JDK-Info.plist > $@
-
- $(JRE_BUNDLE_DIR)/Info.plist: $(SPEC)
- $(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(MKDIR) -p $(@D)
- $(SED) -e "s/@@ID@@/$(BUNDLE_ID_JRE)/g" \
- -e "s/@@NAME@@/$(BUNDLE_NAME_JRE)/g" \
- -e "s/@@INFO@@/$(BUNDLE_INFO_JRE)/g" \
- -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
- -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
- -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
- < $(MACOSX_PLIST_SRC)/JRE-Info.plist > $@
-
- jdk-bundle: $(JDK_TARGET_LIST) $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib \
- $(JDK_BUNDLE_DIR)/Info.plist
- $(SETFILE) -a B $(dir $(JDK_BUNDLE_DIR))
-
- jre-bundle: $(JRE_TARGET_LIST) $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib \
- $(JRE_BUNDLE_DIR)/Info.plist
- $(SETFILE) -a B $(dir $(JRE_BUNDLE_DIR))
-
-else # Not macosx
-
- bundles:
- $(ECHO) "No bundles defined for $(OPENJDK_TARGET_OS)"
-
-endif # macosx
-
-.PHONY: jdk-bundle jre-bundle bundles
--- a/jdk/make/CompileDemos.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/CompileDemos.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -53,7 +53,7 @@
$$(eval $$(call SetupJavaCompilation,BUILD_DEMO_APPLET_$1, \
SETUP := GENERATE_USINGJDKBYTECODE, \
SRC := $(JDK_TOPDIR)/src/$3demo/share/applets/$1, \
- BIN := $(JDK_OUTPUTDIR)/demo/applets/$1, \
+ BIN := $(SUPPORT_OUTPUTDIR)/demo/image/applets/$1, \
COPY := .html .java .xyz .obj .au .gif, \
DISABLE_SJAVAC := $2))
BUILD_DEMOS += $$(BUILD_DEMO_APPLET_$1)
@@ -118,27 +118,27 @@
SETUP := GENERATE_USINGJDKBYTECODE, \
ADD_JAVAC_FLAGS := $3, \
SRC := $$($1_MAIN_SRC) $5, \
- BIN := $(JDK_OUTPUTDIR)/democlasses/$2/$1, \
+ BIN := $(SUPPORT_OUTPUTDIR)/demo/classes/$2/$1, \
COPY := $(PATTERNS_TO_COPY) $(10), \
- JAR := $(JDK_OUTPUTDIR)/demo/$2/$1/$$($1_JARFILE), \
+ JAR := $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/$$($1_JARFILE), \
JARMAIN := $4, \
MANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf, \
EXTRA_MANIFEST_ATTR := $(11), \
- SRCZIP := $(JDK_OUTPUTDIR)/demo/$2/$1/src.zip, \
+ SRCZIP := $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/src.zip, \
EXCLUDE_FILES := $9, \
DISABLE_SJAVAC := $(12)))
BUILD_DEMOS += $$(BUILD_DEMO_$1) \
- $(JDK_OUTPUTDIR)/demo/$2/$1/$$($1_JARFILE) \
- $(JDK_OUTPUTDIR)/demo/$2/$1/src.zip
+ $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/$$($1_JARFILE) \
+ $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/src.zip
endif
# Copy files.
$1_COPY_TARGETS := $$(patsubst $$($1_SRC_BASE)/%, \
- $(JDK_OUTPUTDIR)/demo/$2/$1/%, \
+ $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/%, \
$$(wildcard $$(addprefix $$($1_SRC_BASE)/, $7)))
ifneq ($7, )
- $(JDK_OUTPUTDIR)/demo/$2/$1/%: $$($1_SRC_BASE)/%
+ $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/%: $$($1_SRC_BASE)/%
$$(call install-file)
$(CHMOD) -f ug+w $$@
@@ -148,20 +148,20 @@
endef
$(eval $(call SetupDemo,CodePointIM,jfc,,CodePointIM,,,*.html))
-$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services: \
- $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar \
+$(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/_the.services: \
+ $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/CodePointIM.jar \
$(DEMO_SHARE_SRC)/jfc/CodePointIM/java.awt.im.spi.InputMethodDescriptor
- (cd $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM && \
+ (cd $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM && \
$(MKDIR) -p _the.tmp/META-INF/services && \
$(CP) $(DEMO_SHARE_SRC)/jfc/CodePointIM/java.awt.im.spi.InputMethodDescriptor _the.tmp/META-INF/services && \
cd ./_the.tmp && \
- $(JAR) uf $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar META-INF/services/java.awt.im.spi.InputMethodDescriptor && \
+ $(JAR) uf $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/CodePointIM.jar META-INF/services/java.awt.im.spi.InputMethodDescriptor && \
cd ./META-INF/services && \
- $(JAR) uf $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar java.awt.im.spi.InputMethodDescriptor)
- $(RM) -r $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.tmp
+ $(JAR) uf $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/CodePointIM.jar java.awt.im.spi.InputMethodDescriptor)
+ $(RM) -r $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/_the.tmp
$(TOUCH) $@
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services
+BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/_the.services
ifneq ($(OPENJDK_TARGET_OS), solaris)
$(eval $(call SetupDemo,MoleculeViewer,applets,,XYZChemModel,,,example*.html *.java))
@@ -192,10 +192,10 @@
SplashScreen-Image: resources/images/splash.png,true))
BUILD_DEMOS += $(patsubst $(DEMO_CLOSED_SHARE_SRC)/nbproject/%, \
- $(JDK_OUTPUTDIR)/demo/nbproject/%, \
+ $(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%, \
$(call CacheFind, $(DEMO_CLOSED_SHARE_SRC)/nbproject))
- $(JDK_OUTPUTDIR)/demo/nbproject/%: $(DEMO_CLOSED_SHARE_SRC)/nbproject/%
+ $(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%: $(DEMO_CLOSED_SHARE_SRC)/nbproject/%
$(call install-file)
$(CHMOD) -f ug+w $@
endif
@@ -266,16 +266,16 @@
-D "JDK_FNAME=$1.dll" \
-D "JDK_INTERNAL_NAME=$1" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/demoobjs/jvmti/$1, \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1, \
+ OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib, \
LIBRARY := $1))
$$(eval $$(call SetupZipArchive,BUILD_DEMO_JVMTI_SRC_$1, \
SRC := $(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC), \
EXCLUDE_FILES := $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE), \
- ZIP := $(JDK_OUTPUTDIR)/demo/jvmti/$1/src.zip))
+ ZIP := $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/src.zip))
- $(JDK_OUTPUTDIR)/demo/jvmti/$1/README.txt: $(DEMO_SHARE_SRC)/jvmti/$1/README.txt
+ $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/README.txt: $(DEMO_SHARE_SRC)/jvmti/$1/README.txt
$$(call install-file)
$(CHMOD) -f ug+w $$@
@@ -283,30 +283,30 @@
$$(eval $$(call SetupJavaCompilation,BUILD_DEMO_JVMTI_$1_JAVA, \
SETUP := GENERATE_USINGJDKBYTECODE, \
SRC := $(DEMO_SHARE_SRC)/jvmti/$1, \
- BIN := $(JDK_OUTPUTDIR)/democlasses/jvmti/$1, \
+ BIN := $(SUPPORT_OUTPUTDIR)/demo/classes/jvmti/$1, \
COPY := $(PATTERNS_TO_COPY), \
- JAR := $(JDK_OUTPUTDIR)/demo/jvmti/$1/$1.jar, \
+ JAR := $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/$1.jar, \
EXTRA_MANIFEST_ATTR := Main-Class: \n, \
MANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf))
- BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jvmti/$1/$1.jar
+ BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/$1.jar
endif
BUILD_DEMOS += $$(BUILD_DEMO_JVMTI_$1) \
- $(JDK_OUTPUTDIR)/demo/jvmti/$1/src.zip \
- $(JDK_OUTPUTDIR)/demo/jvmti/$1/README.txt
+ $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/src.zip \
+ $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/README.txt
ifeq ($(OPENJDK_TARGET_OS), windows)
# These files normally end up in OBJECT_DIR but for demos they
# are supposed to be included in the distro.
- $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.lib: $$(BUILD_DEMO_JVMTI_$1)
- $(CP) $(JDK_OUTPUTDIR)/demoobjs/jvmti/$1/$1.lib $$@
+ $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.lib: $$(BUILD_DEMO_JVMTI_$1)
+ $(CP) $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1/$1.lib $$@
- $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.exp: $$(BUILD_DEMO_JVMTI_$1)
- $(CP) $(JDK_OUTPUTDIR)/demoobjs/jvmti/$1/$1.exp $$@
+ $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.exp: $$(BUILD_DEMO_JVMTI_$1)
+ $(CP) $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1/$1.exp $$@
- BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.lib \
- $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.exp
+ BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.lib \
+ $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.exp
endif
endef
@@ -321,95 +321,97 @@
##################################################################################################
-$(JDK_OUTPUTDIR)/demo/management/index.html: $(DEMO_SHARE_SRC)/management/index.html
+$(SUPPORT_OUTPUTDIR)/demo/image/management/index.html: $(DEMO_SHARE_SRC)/management/index.html
$(call install-file)
$(CHMOD) -f ug+w $@
-$(JDK_OUTPUTDIR)/demo/jvmti/index.html: $(DEMO_SHARE_SRC)/jvmti/index.html
+$(SUPPORT_OUTPUTDIR)/demo/image/jvmti/index.html: $(DEMO_SHARE_SRC)/jvmti/index.html
$(call install-file)
$(CHMOD) -f ug+w $@
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/management/index.html \
- $(JDK_OUTPUTDIR)/demo/jvmti/index.html
+BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/management/index.html \
+ $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/index.html
##################################################################################################
# The netbeans project files are copied into the demo directory.
ifeq ($(OPENJDK_TARGET_OS), solaris)
BUILD_DEMOS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \
- $(JDK_OUTPUTDIR)/demo/nbproject/%, \
+ $(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%, \
$(filter-out $(DEMO_SHARE_SRC)/nbproject/jfc/SwingApplet%, \
$(call CacheFind, $(DEMO_SHARE_SRC)/nbproject)))
else
BUILD_DEMOS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \
- $(JDK_OUTPUTDIR)/demo/nbproject/%, \
+ $(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%, \
$(call CacheFind, $(DEMO_SHARE_SRC)/nbproject))
endif
-$(JDK_OUTPUTDIR)/demo/nbproject/%: $(DEMO_SHARE_SRC)/nbproject/%
+$(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%: $(DEMO_SHARE_SRC)/nbproject/%
$(call install-file)
$(CHMOD) -f ug+w $@
##################################################################################################
-$(JDK_OUTPUTDIR)/demo/README: $(DEMO_SHARE_SRC)/README
+$(SUPPORT_OUTPUTDIR)/demo/image/README: $(DEMO_SHARE_SRC)/README
$(call install-file)
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/README
+BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/README
##################################################################################################
ifeq ($(OPENJDK_TARGET_OS), solaris)
- $(JDK_OUTPUTDIR)/democlasses/jni/Poller/%: $(DEMO_SOLARIS_SRC)/jni/Poller/%
+ $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller/%: $(DEMO_SOLARIS_SRC)/jni/Poller/%
$(call install-file)
$(CHMOD) -f ug+w $@
- $(JDK_OUTPUTDIR)/demo/jni/Poller/README.txt: $(DEMO_SOLARIS_SRC)/jni/Poller/README.txt
+ $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/README.txt: $(DEMO_SOLARIS_SRC)/jni/Poller/README.txt
$(call install-file)
$(CHMOD) -f ug+w $@
- $(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar: \
- $(JDK_OUTPUTDIR)/democlasses/jni/Poller/README.txt $(JDK_OUTPUTDIR)/democlasses/jni/Poller/Poller.c
+ $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/Poller.jar: \
+ $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller/README.txt \
+ $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller/Poller.c
$(eval $(call SetupJavaCompilation,BUILD_DEMO_POLLER_JAR, \
SETUP := GENERATE_USINGJDKBYTECODE, \
SRC := $(DEMO_SOLARIS_SRC)/jni/Poller, \
- BIN := $(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
- HEADERS := $(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
- JAR := $(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar, \
+ BIN := $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller, \
+ HEADERS := $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller, \
+ JAR := $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/Poller.jar, \
MANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf, \
- SRCZIP := $(JDK_OUTPUTDIR)/demo/jni/Poller/src.zip, \
+ SRCZIP := $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/src.zip, \
COPY := README.txt Poller.c, \
JARMAIN := Client))
- BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar $(JDK_OUTPUTDIR)/demo/jni/Poller/src.zip \
- $(JDK_OUTPUTDIR)/demo/jni/Poller/README.txt
+ BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/Poller.jar \
+ $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/src.zip \
+ $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/README.txt
$(eval $(call SetupNativeCompilation,BUILD_LIBPOLLER, \
SRC := $(DEMO_SOLARIS_SRC)/jni/Poller, \
LANG := C, \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(SHARED_LIBRARY_FLAGS) \
- -I$(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
+ -I$(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller, \
LDFLAGS := $(LDFLAGS_JDKLIB), \
LDFLAGS_SUFFIX_solaris := -lc, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/demoobjs/jni/Poller, \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/demoobjs, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/demo/native/jni/Poller, \
+ OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/demo/native, \
LIBRARY := Poller))
#
# We can only compile native code after jar has been build (since we depend on generated .h files)
#
- $(JDK_OUTPUTDIR)/demoobjs/jni/Poller/Poller.o: $(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar
+ $(SUPPORT_OUTPUTDIR)/demo/native/jni/Poller/Poller.o: $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/Poller.jar
- $(JDK_OUTPUTDIR)/demo/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX): \
- $(JDK_OUTPUTDIR)/demoobjs/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
+ $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX): \
+ $(SUPPORT_OUTPUTDIR)/demo/native/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
$(call install-file)
- BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
+ BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
endif
@@ -419,22 +421,22 @@
DB_ZIP_DIR := $(wildcard $(JDK_TOPDIR)/src/closed/db)
DB_DEMO_ZIPFILE := $(wildcard $(DB_ZIP_DIR)/*.zip)
- $(JDK_OUTPUTDIR)/demo/_the.db.unzipped: $(DB_DEMO_ZIPFILE)
+ $(SUPPORT_OUTPUTDIR)/demo/image/_the.db.unzipped: $(DB_DEMO_ZIPFILE)
$(MKDIR) -p $(@D)
- $(RM) -r $(JDK_OUTPUTDIR)/demo/db $(JDK_OUTPUTDIR)/demo/demo
- $(CD) $(JDK_OUTPUTDIR)/demo && $(UNZIP) -q -o $<
- $(MV) $(JDK_OUTPUTDIR)/demo/db-derby-*-bin/demo $(JDK_OUTPUTDIR)/demo/db
- $(CD) $(JDK_OUTPUTDIR)/demo && $(RM) -r db-derby-*-bin
+ $(RM) -r $(SUPPORT_OUTPUTDIR)/demo/image/db $(SUPPORT_OUTPUTDIR)/demo/image/demo
+ $(CD) $(SUPPORT_OUTPUTDIR)/demo/image && $(UNZIP) -q -o $<
+ $(MV) $(SUPPORT_OUTPUTDIR)/demo/image/db-derby-*-bin/demo $(SUPPORT_OUTPUTDIR)/demo/image/db
+ $(CD) $(SUPPORT_OUTPUTDIR)/demo/image && $(RM) -r db-derby-*-bin
$(TOUCH) $@
# Copy this after the unzip above to avoid race with directory creation and mv command.
- $(JDK_OUTPUTDIR)/demo/db/README-JDK-DEMOS.html: \
+ $(SUPPORT_OUTPUTDIR)/demo/image/db/README-JDK-DEMOS.html: \
$(DB_ZIP_DIR)/README-JDK-DEMOS.html \
- | $(JDK_OUTPUTDIR)/demo/_the.db.unzipped
+ | $(SUPPORT_OUTPUTDIR)/demo/image/_the.db.unzipped
$(MKDIR) -p $(@D)
$(CAT) $< | $(SED) "s/XXXX/$(shell cat $(DB_ZIP_DIR)/COPYRIGHTYEAR)/" > $@
- BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/_the.db.unzipped $(JDK_OUTPUTDIR)/demo/db/README-JDK-DEMOS.html
+ BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/_the.db.unzipped $(SUPPORT_OUTPUTDIR)/demo/image/db/README-JDK-DEMOS.html
endif
##################################################################################################
--- a/jdk/make/CompileInterimRmic.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/CompileInterimRmic.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -45,7 +45,7 @@
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(JDK_TOPDIR)/src/jdk.rmic/share/classes, \
INCLUDES := $(RMIC_PKGS), \
- BIN := $(JDK_OUTPUTDIR)/interim_rmic_classes, \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_rmic_classes, \
COPY := .properties, \
JAVAC_SOURCE_PATH_OVERRIDE := $(addprefix $(JDK_TOPDIR)/src/jdk.rmic/share/classes/, $(RMIC_PKGS))))
--- a/jdk/make/CopySamples.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/CopySamples.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -28,7 +28,7 @@
include $(SPEC)
include MakeBase.gmk
-SAMPLE_TARGET_DIR := $(JDK_OUTPUTDIR)/sample
+SAMPLE_TARGET_DIR := $(SUPPORT_OUTPUTDIR)/sample
SAMPLE_SOURCE_DIR := $(JDK_TOPDIR)/src/sample/share
SAMPLE_CLOSED_SOURCE_DIR := $(JDK_TOPDIR)/src/closed/sample/share
SAMPLE_SOLARIS_SOURCE_DIR := $(JDK_TOPDIR)/src/sample/solaris
--- a/jdk/make/CreateJars.gmk Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,795 +0,0 @@
-#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-include $(SPEC)
-include MakeBase.gmk
-include JavaCompilation.gmk
-
-default: all
-
-include Tools.gmk
-
-JDK_OUT_CLASSES := $(wildcard $(JDK_OUTPUTDIR)/modules/*)
-$(eval $(call FillCacheFind, $(JDK_OUT_CLASSES)))
-
-include Profiles.gmk
-
-#
-# This makefile...so that altering will trigger rebuilding include/exclude-lists => jars
-#
-MAKEFILE = $(JDK_TOPDIR)/make/CreateJars.gmk
-#
-# And similarly for the Profiles
-PROFILE_MAKEFILES = $(JDK_TOPDIR)/make/Profiles.gmk $(JDK_TOPDIR)/make/profile-rtjar-includes.txt
-
-MAINMANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf
-BEANMANIFEST := $(JDK_TOPDIR)/make/data/swingbeaninfo/manifest.mf
-
-$(eval $(call MakeDir, $(IMAGES_OUTPUTDIR)/lib))
-
-##########################################################################################
-
-$(eval $(call SetupArchive,BUILD_JCONSOLE_JAR, , \
- SRCS := $(JDK_OUTPUTDIR)/modules/jdk.jconsole, \
- SUFFIXES := .class .gif .png .properties, \
- INCLUDES := sun/tools/jconsole com/sun/tools/jconsole, \
- JARMAIN := sun.tools.jconsole.JConsole, \
- JAR := $(IMAGES_OUTPUTDIR)/lib/jconsole.jar, \
- SKIP_METAINF := true))
-
-
-##########################################################################################
-
-$(eval $(call SetupArchive,BUILD_DNS_JAR, , \
- SRCS := $(JDK_OUTPUTDIR)/modules/jdk.naming.dns, \
- INCLUDES := sun/net/spi/nameservice/dns, \
- EXTRA_FILES := META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor, \
- JAR := $(IMAGES_OUTPUTDIR)/lib/ext/dnsns.jar, \
- SKIP_METAINF := true))
-
-
-##########################################################################################
-
-LOCALEDATA_INCLUDE_LOCALES := ar be bg ca cs da de el es et fi fr ga hi hr hu in is it \
- iw ja ko lt lv mk ms mt nl no pl pt ro ru sk sl sq sr sv \
- th tr uk vi zh
-
-LOCALEDATA_INCLUDES := sun/util/resources/provider/NonEnLocaleDataMetaInfo.class
-LOCALEDATA_INCLUDES += $(addprefix sun/text/resources/, $(LOCALEDATA_INCLUDE_LOCALES)) \
- $(addprefix sun/util/resources/, $(LOCALEDATA_INCLUDE_LOCALES))
-
-LOCALEDATA_SERVICES_DIR := $(IMAGES_OUTPUTDIR)/localemetainfo
-
-LOCALEDATA_METAINF_SERVICES := $(LOCALEDATA_SERVICES_DIR)/META-INF/services/sun.util.locale.provider.LocaleDataMetaInfo
-
-$(LOCALEDATA_METAINF_SERVICES): $(JDK_TOPDIR)/src/jdk.localedata/META-INF/localedata-services/sun.util.locale.provider.LocaleDataMetaInfo
- $(install-file)
-
-$(eval $(call SetupArchive,BUILD_LOCALEDATA_JAR, \
- $(LOCALEDATA_METAINF_SERVICES), \
- SRCS := $(JDK_OUTPUTDIR)/modules/jdk.localedata \
- $(LOCALEDATA_SERVICES_DIR), \
- SUFFIXES := .class _dict _th, \
- INCLUDES := $(LOCALEDATA_INCLUDES), \
- EXTRA_FILES := META-INF/services/sun.util.locale.provider.LocaleDataMetaInfo, \
- JAR := $(IMAGES_OUTPUTDIR)/lib/ext/localedata.jar, \
- SKIP_METAINF := true))
-
-##########################################################################################
-#
-# Different variants of rt.jar are built based on the current profile. The output
-# directory is augmented with the profile name so that the final jar file and all the
-# intermediary list files will be in directory. This has the form lib$PROFILE rather than
-# lib/$PROFILE so that it won't get copied as part of the image generation process.
-# Each profile customizes the RT_JAR_EXCLUDES variable.
-#
-##########################################################################################
-
-# Full JRE exclude list for rt.jar and resources.jar
-# This value should exclude types destined for jars other than rt.jar and resources.jar.
-# When building a Profile this value augments the profile specific exclusions
-RT_JAR_EXCLUDES += \
- com/oracle/security/ucrypto \
- com/sun/codemodel \
- com/sun/crypto/provider \
- com/sun/istack/internal/tools \
- com/sun/jarsigner \
- com/sun/java/accessibility \
- com/sun/javadoc \
- com/sun/jdi \
- com/sun/net/ssl/internal/ssl \
- com/sun/source \
- com/sun/tools \
- com/sun/xml/internal/dtdparser \
- com/sun/xml/internal/rngom \
- com/sun/xml/internal/xsom \
- javax/crypto \
- javax/swing/AbstractButtonBeanInfo.class \
- javax/swing/beaninfo \
- javax/swing/BoxBeanInfo.class \
- javax/swing/JAppletBeanInfo.class \
- javax/swing/JButtonBeanInfo.class \
- javax/swing/JCheckBoxBeanInfo.class \
- javax/swing/JCheckBoxMenuItemBeanInfo.class \
- javax/swing/JColorChooserBeanInfo.class \
- javax/swing/JComboBoxBeanInfo.class \
- javax/swing/JComponentBeanInfo.class \
- javax/swing/JDesktopPaneBeanInfo.class \
- javax/swing/JDialogBeanInfo.class \
- javax/swing/JEditorPaneBeanInfo.class \
- javax/swing/JFileChooserBeanInfo.class \
- javax/swing/JFormattedTextFieldBeanInfo.class \
- javax/swing/JFrameBeanInfo.class \
- javax/swing/JInternalFrameBeanInfo.class \
- javax/swing/JLabelBeanInfo.class \
- javax/swing/JLayeredPaneBeanInfo.class \
- javax/swing/JListBeanInfo.class \
- javax/swing/JMenuBarBeanInfo.class \
- javax/swing/JMenuBeanInfo.class \
- javax/swing/JMenuItemBeanInfo.class \
- javax/swing/JOptionPaneBeanInfo.class \
- javax/swing/JPanelBeanInfo.class \
- javax/swing/JPasswordFieldBeanInfo.class \
- javax/swing/JPopupMenuBeanInfo.class \
- javax/swing/JProgressBarBeanInfo.class \
- javax/swing/JRadioButtonBeanInfo.class \
- javax/swing/JRadioButtonMenuItemBeanInfo.class \
- javax/swing/JScrollBarBeanInfo.class \
- javax/swing/JScrollPaneBeanInfo.class \
- javax/swing/JSeparatorBeanInfo.class \
- javax/swing/JSliderBeanInfo.class \
- javax/swing/JSpinnerBeanInfo.class \
- javax/swing/JSplitPaneBeanInfo.class \
- javax/swing/JTabbedPaneBeanInfo.class \
- javax/swing/JTableBeanInfo.class \
- javax/swing/JTextAreaBeanInfo.class \
- javax/swing/JTextFieldBeanInfo.class \
- javax/swing/JTextPaneBeanInfo.class \
- javax/swing/JToggleButtonBeanInfo.class \
- javax/swing/JToolBarBeanInfo.class \
- javax/swing/JTreeBeanInfo.class \
- javax/swing/JWindowBeanInfo.class \
- javax/swing/SwingBeanInfoBase.class \
- javax/swing/text/JTextComponentBeanInfo.class \
- jdk/nio/zipfs \
- META-INF/services/com.sun.jdi.connect.Connector \
- META-INF/services/com.sun.jdi.connect.spi.TransportService \
- META-INF/services/com.sun.tools.attach.spi.AttachProvider \
- META-INF/services/com.sun.tools.xjc.Plugin \
- META-INF/services/javax.script.ScriptEngineFactory \
- META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor \
- META-INF/services/java.nio.file.spi.FileSystemProvider \
- org/relaxng/datatype \
- sun/awt/HKSCS.class \
- sun/awt/motif/X11GB2312.class \
- sun/awt/motif/X11GB2312$$$$Decoder.class \
- sun/awt/motif/X11GB2312$$$$Encoder.class \
- sun/awt/motif/X11GBK.class \
- sun/awt/motif/X11GBK$$$$Encoder.class \
- sun/awt/motif/X11KSC5601.class \
- sun/awt/motif/X11KSC5601$$$$Decoder.class \
- sun/awt/motif/X11KSC5601$$$$Encoder.class \
- sun/jvmstat \
- sun/net/spi/nameservice/dns \
- sun/nio/cs/ext \
- sun/rmi/rmic \
- sun/security/ec \
- sun/security/internal \
- sun/security/mscapi \
- sun/security/pkcs11 \
- sun/security/provider/Sun.class \
- sun/security/rsa/SunRsaSign.class \
- sun/security/ssl \
- sun/security/tools/jarsigner \
- sun/swing/BeanInfoUtils.class \
- sun/text/resources/cldr \
- sun/tools/asm \
- sun/tools/attach \
- sun/tools/java \
- sun/tools/javac \
- sun/tools/jcmd \
- sun/tools/jconsole \
- sun/tools/jinfo \
- sun/tools/jmap \
- sun/tools/jps \
- sun/tools/jstack \
- sun/tools/jstat \
- sun/tools/jstatd \
- sun/tools/native2ascii \
- sun/tools/serialver \
- sun/tools/tree \
- sun/tools/util \
- sun/util/resources/provider/NonEnLocaleDataMetaInfo.class \
- META-INF/services/sun.util.locale.provider.LocaleDataMetaInfo \
- sun/util/resources/cldr \
- $(LOCALEDATA_INCLUDES) \
- com/oracle/jrockit/jfr \
- oracle/jrockit/jfr \
- jdk/jfr \
- jdk/internal/dynalink \
- jdk/nashorn \
- sun/jvm \
- toolbarButtonGraphics \
- sa.properties \
- com/sun/java/swing/action \
- com/sun/java/swing/ui \
- com/oracle/security \
- #
-
-# Find all files in the classes dir to use as dependencies. This could be more fine granular.
-ALL_FILES_IN_CLASSES := $(call not-containing, _the., $(filter-out %javac_state, \
- $(call CacheFind, $(JDK_OUT_CLASSES))))
-
-RT_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar_manifest
-RESOURCE_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar_manifest
-
-$(RT_JAR_MANIFEST_FILE): $(MAINMANIFEST) $(BEANMANIFEST)
- $(MKDIR) -p $(@D)
- $(RM) $@ $@.tmp
- $(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \
- -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
- $(MAINMANIFEST) >> $@.tmp
- $(ECHO) >> $@.tmp
- $(CAT) $(BEANMANIFEST) >> $@.tmp
- $(MV) $@.tmp $@
-
-$(RESOURCE_JAR_MANIFEST_FILE): $(MAINMANIFEST)
- $(MKDIR) -p $(@D)
- $(RM) $@ $@.tmp
- $(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \
- -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
- $(MAINMANIFEST) >> $@.tmp
- $(MV) $@.tmp $@
-
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude: $(MAKEFILE) $(PROFILE_MAKEFILES)
- $(MKDIR) -p $(@D)
- $(RM) $@ $@.tmp
- $(call ListPathsSafely,RT_JAR_EXCLUDES,\n, >> $@.tmp)
- $(MV) $@.tmp $@
-
-$(IMAGES_OUTPUTDIR)/lib/classlist: $(JDK_TOPDIR)/make/data/classlist/classlist.$(OPENJDK_TARGET_OS) \
- $(MAKEFILE)
- $(MKDIR) -p $(@D)
- $(RM) $@ $@.tmp
- $(TOOL_ADDJSUM) $< $@.tmp
- $(MV) $@.tmp $@
-
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents: $(BUILD_TOOLS_JDK) $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude \
- $(ALL_FILES_IN_CLASSES) $(IMAGES_OUTPUTDIR)/lib/classlist
- $(MKDIR) -p $(@D)
- $(RM) $@ $@.tmp
- ($(CD) $(JDK_OUTPUTDIR)/modules && \
- $(TOOL_JARREORDER) -m \
- -o $@.tmp $(IMAGES_OUTPUTDIR)/lib/classlist $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude . )
- $(MV) $@.tmp $@
-
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents
- $(MKDIR) -p $(@D)
- $(RM) $@ $@.tmp
- $(GREP) -e '\.class$$' $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents > $@.tmp
- ifneq ($(PROFILE), )
- # Add back classes from excluded packages (fixing the $ substitution in the process)
- # This currently won't work with modular build layout, but there currently are no
- # types needing to be re added.
- for type in $(subst \$$,\, $(RT_JAR_INCLUDE_TYPES)) ; do \
- $(ECHO) $$type >> $@.tmp ; \
- done
- endif
- $(MV) $@.tmp $@
-
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents
- $(MKDIR) -p $(@D)
- $(RM) $@ $@.tmp
- $(GREP) -v -e '\.class$$' \
- -e '/_the\.' -e '^_the\.' -e '\\_the\.' -e ' _the\.' -e 'javac_state' \
- $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents > $@.tmp
- ifneq ($(PROFILE), )
- # Strip out all META-INF/services/ entries
- $(GREP) -v -e 'META-INF/services/' $@.tmp > $@.tmp2
- # Add back the required services
- # FIXME: On Solaris if PROFILE_INCLUDE_METAINF_SERVICES is not defined
- # we get a syntax error from sh. That doesn't happen on linux
- # Preserve any -C <dir> part of the original include line.
- for service in $(PROFILE_INCLUDE_METAINF_SERVICES) ; do \
- $(GREP) -e "$$service" $@.tmp >> $@.tmp2; \
- done
- $(MV) $@.tmp2 $@.tmp
- endif
- $(MV) $@.tmp $@
-
-# This is a hack but I don't know how to make this fit into the existing scheme
-$(PROFILE_VERSION_CLASS_TARGETS): $(PROFILE_VERSION_JAVA_TARGETS)
- @$(JAVAC) -d $(@D)/../../ $(@D)/$(VERSION_JAVA_FILE)
-
-
-RT_JAR_CREATE_OPTIONS := c0fm
-RT_JAR_UPDATE_OPTIONS := u0f
-ifeq ($(COMPRESS_JARS), true)
- RT_JAR_CREATE_OPTIONS := cfm
- RT_JAR_UPDATE_OPTIONS := uf
-endif
-
-# This defines a target-specific variables to make the shell logic easier to see.
-# We need to find the Version.class file for the profile currently being built
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/rt.jar: \
- CLASS_FILE = $(if $(PROFILE), $(strip $(foreach class, $(PROFILE_VERSION_CLASS_TARGETS), $(if $(findstring $(PROFILE), $(class)), $(class)))), NO_SUCH_FILE)
-# This is the real target
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/rt.jar: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents $(RT_JAR_MANIFEST_FILE) $(PROFILE_VERSION_CLASS_TARGETS)
- $(ECHO) Creating rt.jar $(PROFILE) Compressed=$(COMPRESS_JARS)
- $(MKDIR) -p $(@D)
- $(RM) $@ $@.tmp
- $(CD) $(JDK_OUTPUTDIR)/modules && \
- $(JAR) $(RT_JAR_CREATE_OPTIONS) $@.tmp $(RT_JAR_MANIFEST_FILE) \
- @$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents && \
- if [ -f $(CLASS_FILE) ]; then \
- $(ECHO) Updating rt.jar $(PROFILE) && \
- $(CD) $(patsubst %$(VERSION_CLASS_PATH), %, $(CLASS_FILE)) && \
- $(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(VERSION_CLASS_PATH); \
- fi
- $(MV) $@.tmp $@
-
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/resources.jar: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents \
- $(RESOURCE_JAR_MANIFEST_FILE)
- $(ECHO) Creating resources.jar
- $(MKDIR) -p $(@D)
- $(RM) $@ $@.tmp
- $(CD) $(JDK_OUTPUTDIR)/modules && \
- $(JAR) $(RT_JAR_CREATE_OPTIONS) $@.tmp $(RESOURCE_JAR_MANIFEST_FILE) \
- @$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents
- $(MV) $@.tmp $@
-
-##########################################################################################
-
-ifneq ($(OPENJDK_TARGET_OS), windows)
- CHARSETS_EXTRA_FILES := sun/awt/motif/X11GBK.class \
- sun/awt/motif/X11GB2312$$$$Decoder.class \
- sun/awt/motif/X11GB2312.class \
- sun/awt/motif/X11KSC5601$$$$Decoder.class \
- sun/awt/motif/X11KSC5601$$$$Encoder.class \
- sun/awt/motif/X11GB2312$$$$Encoder.class \
- sun/awt/motif/X11GBK$$$$Encoder.class \
- sun/awt/motif/X11KSC5601.class
-endif
-
-$(eval $(call SetupArchive,BUILD_CHARSETS_JAR, , \
- SRCS := $(JDK_OUT_CLASSES), \
- SUFFIXES := .class .dat, \
- INCLUDES := sun/nio/cs/ext, \
- EXTRA_FILES := sun/awt/HKSCS.class \
- $(CHARSETS_EXTRA_FILES), \
- JAR := $(IMAGES_OUTPUTDIR)/lib/charsets.jar, \
- SKIP_METAINF := true, \
- CHECK_COMPRESS_JAR := true))
-
-##########################################################################################
-
-$(eval $(call SetupArchive,BUILD_ZIPFS_JAR, , \
- SRCS := $(JDK_OUT_CLASSES), \
- INCLUDES := jdk/nio/zipfs, \
- EXTRA_FILES := META-INF/services/java.nio.file.spi.FileSystemProvider, \
- JAR := $(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar, \
- SKIP_METAINF := true, \
- CHECK_COMPRESS_JAR := true))
-
-##########################################################################################
-
-ifndef OPENJDK
- ifeq ($(ENABLE_JFR), true)
- $(eval $(call SetupArchive,BUILD_JFR_JAR, , \
- SRCS := $(JDK_OUTPUTDIR)/modules/jdk.jfr, \
- SUFFIXES := .class .jfc .xsd, \
- INCLUDES := com/oracle/jrockit/jfr \
- oracle/jrockit/jfr \
- jdk/jfr, \
- JAR := $(IMAGES_OUTPUTDIR)/lib/jfr.jar, \
- SKIP_METAINF := true, \
- MANIFEST := $(MAINMANIFEST), \
- CHECK_COMPRESS_JAR := true))
-
- endif
-endif
-
-##########################################################################################
-
-$(eval $(call SetupArchive,BUILD_JSSE_JAR, , \
- SRCS := $(JDK_OUT_CLASSES), \
- INCLUDES := sun/security/provider/Sun.class \
- sun/security/rsa/SunRsaSign.class \
- sun/security/ssl \
- com/sun/net/ssl/internal/ssl, \
- JAR := $(IMAGES_OUTPUTDIR)/lib/jsse.jar, \
- SKIP_METAINF := true, \
- MANIFEST := $(MAINMANIFEST), \
- CHECK_COMPRESS_JAR := true))
-
-##########################################################################################
-
-$(eval $(call SetupArchive,BUILD_SWINGBEANS_JAR, , \
- SRCS := $(JDK_OUTPUTDIR)/modules/java.desktop, \
- SUFFIXES := BeanInfo.class .gif, \
- INCLUDES := javax/swing sun/swing, \
- EXCLUDES := javax/swing/plaf, \
- EXTRA_FILES := javax/swing/SwingBeanInfoBase.class sun/swing/BeanInfoUtils.class, \
- JAR := $(IMAGES_OUTPUTDIR)/lib/dt.jar, \
- SKIP_METAINF := true))
-
-##########################################################################################
-
-# Get the CLDRVERSION
-include gensrc/GensrcCLDR.gmk
-
-CLDRDATA_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/cldrdata.jar
-
-CLDR_SERVICES_DIR := $(IMAGES_OUTPUTDIR)/cldrmetainfo
-
-CLDR_METAINF_SERVICES := $(CLDR_SERVICES_DIR)/META-INF/services/sun.util.locale.provider.LocaleDataMetaInfo
-
-$(CLDR_METAINF_SERVICES): $(JDK_TOPDIR)/src/jdk.localedata/META-INF/cldrdata-services/sun.util.locale.provider.LocaleDataMetaInfo
- $(install-file)
-
-$(eval $(call SetupArchive,BUILD_CLDRDATA_JAR, \
- $(CLDR_METAINF_SERVICES), \
- SRCS := $(JDK_OUTPUTDIR)/modules/jdk.localedata \
- $(CLDR_SERVICES_DIR), \
- SUFFIXES := .class, \
- INCLUDES := sun/text/resources/cldr \
- sun/util/resources/cldr, \
- EXTRA_FILES := META-INF/services/sun.util.locale.provider.LocaleDataMetaInfo, \
- JAR := $(CLDRDATA_JAR_DST), \
- EXTRA_MANIFEST_ATTR := CLDR-Version: $(CLDRVERSION), \
- SKIP_METAINF := true))
-
-##########################################################################################
-
-TOOLS_JAR_INCLUDES := \
- com/sun/codemodel \
- com/sun/istack/internal/tools \
- com/sun/jarsigner \
- com/sun/javadoc \
- com/sun/jdi \
- com/sun/source \
- com/sun/tools/attach \
- com/sun/tools/classfile \
- com/sun/tools/corba \
- com/sun/tools/doclets \
- com/sun/tools/doclint \
- com/sun/tools/example/debug/expr \
- com/sun/tools/example/debug/tty \
- com/sun/tools/hat \
- com/sun/tools/internal/jxc \
- com/sun/tools/internal/jxc/ap \
- com/sun/tools/internal/ws \
- com/sun/tools/internal/ws/wscompile/plugin/at_generated \
- com/sun/tools/internal/xjc \
- com/sun/tools/javac \
- com/sun/tools/javadoc \
- com/sun/tools/javah \
- com/sun/tools/javap \
- com/sun/tools/jdeps \
- com/sun/tools/jdi \
- com/sun/tools/script/shell \
- com/sun/xml/internal/dtdparser \
- com/sun/xml/internal/rngom \
- com/sun/xml/internal/xsom \
- org/relaxng/datatype \
- sun/applet \
- sun/jvmstat \
- sun/rmi/rmic \
- sun/security/tools/jarsigner \
- sun/tools/asm \
- sun/tools/attach \
- sun/tools/jar \
- sun/tools/java \
- sun/tools/javac \
- sun/tools/jcmd \
- sun/tools/jinfo \
- sun/tools/jmap \
- sun/tools/jps \
- sun/tools/jstack \
- sun/tools/jstat \
- sun/tools/jstatd \
- sun/tools/native2ascii \
- sun/tools/serialver \
- sun/tools/tree \
- sun/tools/util
-
-# The sjavac tools is not ready for public consumption.
-TOOLS_JAR_EXCLUDES = com/sun/tools/sjavac
-
-TOOLS_JAR_SRC := $(addprefix $(JDK_OUTPUTDIR)/modules/,\
- java.corba \
- java.desktop \
- jdk.attach \
- jdk.compiler \
- jdk.dev \
- jdk.javadoc \
- jdk.jconsole \
- jdk.jcmd \
- jdk.jdi \
- jdk.jvmstat \
- jdk.rmic \
- jdk.runtime \
- jdk.xml.bind \
- jdk.xml.ws \
- )
- #
-
-$(eval $(call SetupArchive,BUILD_TOOLS_JAR, , \
- SRCS := $(TOOLS_JAR_SRC), \
- SUFFIXES := .class .prp .gif .properties .xml .css .xsd .js .html .txt .java \
- Tool aliasmap options, \
- INCLUDES := $(TOOLS_JAR_INCLUDES), \
- EXCLUDES := $(TOOLS_JAR_EXCLUDES), \
- EXTRA_FILES := \
- $(JDK_OUTPUTDIR)/modules/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector \
- META-INF/services/com.sun.jdi.connect.spi.TransportService \
- META-INF/services/com.sun.tools.attach.spi.AttachProvider \
- META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin \
- META-INF/services/com.sun.tools.internal.xjc.Plugin, \
- JAR := $(IMAGES_OUTPUTDIR)/lib/tools.jar, \
- SKIP_METAINF := true, \
- CHECK_COMPRESS_JAR := true))
-
-
-##########################################################################################
-
-include CORE_PKGS.gmk
-include NON_CORE_PKGS.gmk
-
-# The compiler should not issue a "Proprietary" warning when compiling
-# classes in the com.sun.java.swing.plaf packages, since we've always
-# allowed, and even advocated, extending them (see bug 6476749).
-#
-# This approach is NOT to be used as a general purpose way to avoid such
-# compiler warnings for non-core packages. The correct way is to document
-# the packages in NON_CORE_PKGS.gmk, and include them in the NON_CORE_PKGS
-# definition.
-#
-# Swing has taken this approach only as a temporary measure to avoid
-# the compiler warnings until we can properly document these packages.
-# This is covered under 6491853.
-EXCLUDE_PROPWARN_PKGS = com.sun.java.swing.plaf.windows \
- com.sun.java.swing.plaf.motif \
- com.sun.java.swing.plaf.gtk
-
-#
-# Include the exported private packages in ct.sym.
-# This is an interim solution until the ct.sym is replaced
-# with a new module system (being discussed for JDK 8).
-#
-EXPORTED_PRIVATE_PKGS = com.oracle.net \
- com.oracle.nio
-
-$(IMAGES_OUTPUTDIR)/symbols/_the.symbols: $(IMAGES_OUTPUTDIR)/lib/rt.jar
- $(RM) -r $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
- $(MKDIR) -p $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
- $(JAVA) $(NEW_JAVAC) \
- -bootclasspath "$(IMAGES_OUTPUTDIR)/lib/rt.jar" \
- -XDprocess.packages -proc:only \
- -processor com.sun.tools.javac.sym.CreateSymbols \
- -Acom.sun.tools.javac.sym.Jar=$(IMAGES_OUTPUTDIR)/lib/rt.jar \
- -Acom.sun.tools.javac.sym.Dest=$(IMAGES_OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
- -Acom.sun.tools.javac.sym.Profiles=profile-rtjar-includes.txt \
- $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS)
- $(TOUCH) $@
-
-$(eval $(call MakeDir, $(IMAGES_OUTPUTDIR)/symbols))
-$(eval $(call SetupArchive,BUILD_CT_SYM, $(IMAGES_OUTPUTDIR)/symbols/_the.symbols, \
- SRCS := $(IMAGES_OUTPUTDIR)/symbols, \
- INCLUDES := META-INF/sym, \
- JAR := $(IMAGES_OUTPUTDIR)/lib/ct.sym, \
- CHECK_COMPRESS_JAR := true))
-
-
-##########################################################################################
-
-ifdef OPENJDK
- SRC_ZIP_INCLUDES = \
- com \
- java \
- javax \
- jdk \
- org \
- sun \
- #
- SRC_ZIP_EXCLUDES =
-else
- SRC_ZIP_INCLUDES = \
- com/sun/corba \
- com/sun/image/codec/jpeg \
- com/sun/imageio \
- com/sun/java_cup \
- com/sun/javadoc \
- com/sun/java/swing \
- com/sun/jmx \
- com/sun/naming \
- com/sun/org/apache \
- com/sun/security/auth \
- com/sun/security/jgss \
- com/sun/source \
- java \
- javax/accessibility \
- javax/annotation \
- javax/imageio \
- javax/lang \
- javax/management \
- javax/naming \
- javax/print \
- javax/rmi \
- javax/script \
- javax/security \
- javax/sound \
- javax/sql \
- javax/swing \
- javax/tools \
- javax/xml \
- org/ietf \
- org/omg \
- org/w3c/dom \
- org/xml/sax \
- #
- SRC_ZIP_EXCLUDES = javax/swing/beaninfo
-endif
-
-SRC_ZIP_SRCS := $(wildcard \
- $(JDK_TOPDIR)/src/*/share/classes \
- $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \
- $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_API_DIR)/classes \
- $(LANGTOOLS_TOPDIR)/src/*/share/classes \
- $(CORBA_TOPDIR)/src/*/share/classes \
- $(JAXP_TOPDIR)/src/*/share/classes \
- $(JAXWS_TOPDIR)/src/*/share/classes \
- $(JDK_OUTPUTDIR)/gensrc/j* \
- $(JDK_OUTPUTDIR)/gendocsrc_rmic \
- $(CORBA_OUTPUTDIR)/gensrc/j* \
- ) \
- #
-ifndef OPENJDK
- SRC_ZIP_SRCS += $(wildcard $(JDK_TOPDIR)/src/closed/*/share/classes)
-endif
-
-# Need to copy launcher src files into desired directory structure
-# before zipping the sources.
-$(eval $(call SetupCopyFiles,COPY_LAUNCHER_SRC, \
- SRC := $(JDK_TOPDIR)/src/java.base, \
- DEST := $(IMAGES_OUTPUTDIR)/src/launcher, \
- FLATTEN := true, \
- FILES := $(wildcard \
- $(JDK_TOPDIR)/src/java.base/share/native/launcher/* \
- $(JDK_TOPDIR)/src/java.base/share/native/libjli/* \
- $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli/java_md*)))
-
-LAUNCHER_ZIP_SRC := $(COPY_LAUNCHER_SRC)
-
-$(IMAGES_OUTPUTDIR)/src.zip: $(LAUNCHER_ZIP_SRC)
-
-# This dir needs to exist before macro is evaluated to avoid warning from find.
-$(eval $(call MakeDir, $(IMAGES_OUTPUTDIR)/src))
-$(eval $(call SetupZipArchive,BUILD_SRC_ZIP, \
- SRC := $(SRC_ZIP_SRCS) $(IMAGES_OUTPUTDIR)/src, \
- INCLUDES := $(SRC_ZIP_INCLUDES) launcher, \
- EXCLUDES := $(SRC_ZIP_EXCLUDES), \
- SUFFIXES := .java .c .h, \
- ZIP := $(IMAGES_OUTPUTDIR)/src.zip, \
- EXTRA_DEPS := $(LAUNCHER_ZIP_SRC)))
-
-##########################################################################################
-
-# This file is imported from hotspot in Import.gmk. Copying it into images/lib so that
-# all jars can be found in one place when creating images in Images.gmk. It needs to be
-# done here so that clean targets can be simple and accurate.
-$(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar: $(HOTSPOT_DIST)/lib/sa-jdi.jar
- $(install-file)
-
-##########################################################################################
-#
-# sec-bin.zip is used by builds where the corresponding sources are not available
-#
-$(eval $(call SetupZipArchive,BUILD_SEC_BIN_ZIP, \
- SRC := $(JDK_OUTPUTDIR), \
- INCLUDES := \
- modules/java.base/javax/crypto \
- modules/java.base/javax/crypto/spec \
- modules/java.base/sun/security/internal/interfaces \
- modules/java.base/sun/security/internal/spec \
- modules/java.base/com/sun/crypto/provider \
- modules/jdk.crypto.ec/sun/security/ec \
- modules/jdk.crypto.mscapi/sun/security/mscapi \
- modules/jdk.crypto.pkcs11/sun/security/pkcs11 \
- modules/jdk.crypto.pkcs11/sun/security/pkcs11/wrapper \
- modules/jdk.crypto.ucrypto/com/oracle/security/ucrypto \
- modules/java.base/javax/net \
- modules/java.base/javax/security/cert \
- modules/java.base/com/sun/net/ssl \
- modules/java.base/com/sun/security/cert \
- modules/java.base/sun/net/www/protocol/https \
- modules/java.base/sun/security/pkcs12 \
- modules/java.base/sun/security/ssl \
- modules/java.security.jgss/sun/security/krb5 \
- modules/java.security.jgss/sun/security/krb5/internal \
- modules/java.security.jgss/sun/security/krb5/internal/ccache \
- modules/java.security.jgss/sun/security/krb5/internal/crypto \
- modules/java.security.jgss/sun/security/krb5/internal/ktab \
- modules/java.security.jgss/sun/security/krb5/internal/rcache \
- modules/java.security.jgss/sun/security/krb5/internal/util, \
- INCLUDE_FILES := modules/java.security.jgss/sun/security/jgss/spi/GSSContextSpi.class, \
- EXCLUDES := modules/java.security.jgss/sun/security/krb5/internal/tools, \
- ZIP := $(IMAGES_OUTPUTDIR)/sec-bin.zip))
-
-JARS += $(IMAGES_OUTPUTDIR)/sec-bin.zip
-
-##########################################################################################
-#
-# Windows specific binary security packages.
-#
-ifeq ($(OPENJDK_TARGET_OS), windows)
- # sec-windows-bin.zip is used by builds where the corresponding sources are not available
- $(eval $(call SetupZipArchive,BUILD_SEC_WINDOWS_BIN_ZIP, \
- SRC := $(JDK_OUTPUTDIR), \
- INCLUDES := modules/java.security.jgss/sun/security/krb5/internal/tools, \
- ZIP := $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip))
-
- JARS += $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip
-
- # JGSS files contain the native Kerberos library
- ifeq ($(OPENJDK_TARGET_CPU), x86_64)
- JGSS_ZIP_NAME = jgss-windows-x64-bin.zip
- else
- JGSS_ZIP_NAME = jgss-windows-i586-bin.zip
- endif
-
- $(eval $(call SetupZipArchive,BUILD_JGSS_BIN_ZIP, \
- SRC := $(JDK_OUTPUTDIR), \
- INCLUDE_FILES := bin/w2k_lsa_auth.dll \
- bin/w2k_lsa_auth.map \
- bin/w2k_lsa_auth.pdb, \
- ZIP := $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)))
-
- JARS += $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)
-endif
-
-##########################################################################################
-
-# This rule copies all jars from jdk/lib/... to images/lib/... to avoid having to track
-# which jars are where
-$(IMAGES_OUTPUTDIR)/lib/%: $(JDK_OUTPUTDIR)/lib/%
- $(install-file)
-
-##########################################################################################
-
-# Import nashorn.jar from nashorn dist dir.
-$(IMAGES_OUTPUTDIR)/lib/ext/nashorn.jar: $(NASHORN_DIST)/nashorn.jar
- $(install-file)
-
-##########################################################################################
-
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, jdk, CreateJars.gmk))
-
-##########################################################################################
-
-all: $(JARS)
-
-.PHONY: default all
--- a/jdk/make/CreatePolicyJars.gmk Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-#
-# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-include JavaCompilation.gmk
-
-
-################################################################################
-
-US_EXPORT_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar
-
-ifneq ($(BUILD_CRYPTO), no)
-
- US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED := \
- $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/US_export_policy.jar
- US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED := \
- $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/US_export_policy.jar
-
- ifndef OPENJDK
- #
- # In past releases, Oracle JDK has had a separately downloadable set of
- # policy files which has been a nightmare for deployment.
- #
- # Now if we're closed and limited (default for Oracle JDK), create
- # an "unlimited_policy" directory that contains the unlimited policy
- # files. It will be up to the user/deployer to make an informed choice
- # as to whether they are legally entitled to use the unlimited policy
- # file in their environment. Users/deployers simply need to overwrite
- # the files. Consult README.txt (below) for more info.
- #
- UNLIMITED_POLICY_DIR := $(JDK_OUTPUTDIR)/lib/security/unlimited_policy
- endif
-
- #
- # TODO fix so that SetupArchive does not write files into SRCS
- # then we don't need this extra copying
- #
- # NOTE: We currently do not place restrictions on our limited export
- # policy. This was not a typo. This means we are shipping the same file
- # for both limited and unlimited US_export_policy.jar. Only the local
- # policy file currently has restrictions.
- #
- US_EXPORT_POLICY_JAR_SRC_DIR := \
- $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited
- US_EXPORT_POLICY_JAR_TMP := \
- $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/US_export_policy_jar.tmp
-
- $(US_EXPORT_POLICY_JAR_TMP)/%: $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
- $(install-file)
-
- US_EXPORT_POLICY_JAR_DEPS := \
- $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
-
- $(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR, \
- $(US_EXPORT_POLICY_JAR_DEPS), \
- SRCS := $(US_EXPORT_POLICY_JAR_TMP), \
- SUFFIXES := .policy, \
- JAR := $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED), \
- EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
- SKIP_METAINF := true))
-
- $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED): \
- $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
- $(ECHO) $(LOG_INFO) \
- Copying unlimited $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(install-file)
-
- TARGETS += $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED) \
- $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
-endif
-
-ifeq ($(UNLIMITED_CRYPTO), true)
- $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
- $(install-file)
-else
- $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED)
- $(install-file)
-endif
-
-ifndef OPENJDK
- ifneq ($(UNLIMITED_CRYPTO), true)
- $(UNLIMITED_POLICY_DIR)/US_export_policy.jar: \
- $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
- $(install-file)
- TARGETS += $(UNLIMITED_POLICY_DIR)/US_export_policy.jar
- endif
-endif
-
-POLICY_JARS += $(US_EXPORT_POLICY_JAR_DST)
-
-################################################################################
-
-LOCAL_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/local_policy.jar
-
-ifneq ($(BUILD_CRYPTO), no)
-
- LOCAL_POLICY_JAR_LIMITED_UNSIGNED := \
- $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/local_policy.jar
- LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED := \
- $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/local_policy.jar
-
- #
- # TODO fix so that SetupArchive does not write files into SRCS
- # then we don't need this extra copying
- #
- LOCAL_POLICY_JAR_LIMITED_TMP := \
- $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/local_policy_jar.tmp
- LOCAL_POLICY_JAR_UNLIMITED_TMP := \
- $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/local_policy_jar.tmp
-
- $(LOCAL_POLICY_JAR_LIMITED_TMP)/%: \
- $(JDK_TOPDIR)/make/data/cryptopolicy/limited/%
- $(install-file)
-
- $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/%: \
- $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited/%
- $(install-file)
-
- $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_LIMITED, \
- $(LOCAL_POLICY_JAR_LIMITED_TMP)/exempt_local.policy \
- $(LOCAL_POLICY_JAR_LIMITED_TMP)/default_local.policy, \
- SRCS := $(LOCAL_POLICY_JAR_LIMITED_TMP), \
- SUFFIXES := .policy, \
- JAR := $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED), \
- EXTRA_MANIFEST_ATTR := Crypto-Strength: limited, \
- SKIP_METAINF := true))
-
- $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_UNLIMITED, \
- $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/default_local.policy, \
- SRCS := $(LOCAL_POLICY_JAR_UNLIMITED_TMP), \
- SUFFIXES := .policy, \
- JAR := $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED), \
- EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
- SKIP_METAINF := true))
-
- TARGETS += $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED) \
- $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
-
- ifndef OPENJDK
- ifneq ($(UNLIMITED_CRYPTO), true)
- $(UNLIMITED_POLICY_DIR)/README.txt: \
- $(JDK_TOPDIR)/make/closed/data/cryptopolicy/README.txt
- $(install-file)
-
- TARGETS += $(UNLIMITED_POLICY_DIR)/README.txt
- endif
- endif
-endif
-
-ifeq ($(UNLIMITED_CRYPTO), true)
- $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
- $(install-file)
-else
- $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED)
- $(install-file)
-endif
-
-ifndef OPENJDK
- ifneq ($(UNLIMITED_CRYPTO), true)
- $(UNLIMITED_POLICY_DIR)/local_policy.jar: \
- $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
- $(install-file)
- TARGETS += $(UNLIMITED_POLICY_DIR)/local_policy.jar
- endif
-endif
-
-POLICY_JARS += $(LOCAL_POLICY_JAR_DST)
-TARGETS += $(POLICY_JARS)
-
-################################################################################
-
-all: $(TARGETS)
-
--- a/jdk/make/CreateSecurityJars.gmk Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-#
-# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-include JavaCompilation.gmk
-
-##########################################################################################
-# Create manifest for security jars
-#
-# Include these extra attributes for now, should probably take out.
-#
-MAINMANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf
-JCE_MANIFEST := $(JDK_OUTPUTDIR)/jce/unsigned/_the.security.manifest.mf
-
-$(JCE_MANIFEST): $(MAINMANIFEST)
- $(MKDIR) -p $(@D)
- $(RM) $@ $@.tmp
- $(SED) -e "s#@@RELEASE@@#$(JDK_VERSION)#" \
- -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
- $(MAINMANIFEST) >> $@.tmp
- $(ECHO) "Extension-Name: javax.crypto" >> $@.tmp
- $(ECHO) "Implementation-Vendor-Id: com.sun" >> $@.tmp
- $(ECHO) "Release-Version: $(RELEASE)" >> $@.tmp
- $(MV) $@.tmp $@
-
-##########################################################################################
-# For crypto jars, always build the jar.
-#
-# The source for the crypto jars is not available for all licensees.
-# The BUILD_CRYPTO variable is set to no if these jars can't be built
-# to skip that step of the build.
-
-SUNPKCS11_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunpkcs11.jar
-SUNPKCS11_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/sunpkcs11.jar
-
-$(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR, , \
- SRCS := $(JDK_OUTPUTDIR)/modules/jdk.crypto.pkcs11, \
- SUFFIXES := .class, \
- INCLUDES := sun/security/pkcs11, \
- JAR := $(SUNPKCS11_JAR_UNSIGNED), \
- MANIFEST := $(JCE_MANIFEST), \
- SKIP_METAINF := true))
-
-$(SUNPKCS11_JAR_UNSIGNED): $(JCE_MANIFEST)
-
-$(SUNPKCS11_JAR_DST): $(SUNPKCS11_JAR_UNSIGNED)
- $(install-file)
-
-TARGETS += $(SUNPKCS11_JAR_UNSIGNED) $(SUNPKCS11_JAR_DST)
-
-##########################################################################################
-
-SUNEC_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunec.jar
-SUNEC_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/sunec.jar
-
-$(eval $(call SetupArchive,BUILD_SUNEC_JAR, , \
- SRCS := $(JDK_OUTPUTDIR)/modules/jdk.crypto.ec, \
- SUFFIXES := .class, \
- INCLUDES := sun/security/ec, \
- JAR := $(SUNEC_JAR_UNSIGNED), \
- MANIFEST := $(JCE_MANIFEST), \
- SKIP_METAINF := true))
-
-$(SUNEC_JAR_UNSIGNED): $(JCE_MANIFEST)
-
-$(SUNEC_JAR_DST): $(SUNEC_JAR_UNSIGNED)
- $(install-file)
-
-TARGETS += $(SUNEC_JAR_UNSIGNED) $(SUNEC_JAR_DST)
-
-##########################################################################################
-
-SUNJCE_PROVIDER_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunjce_provider.jar
-SUNJCE_PROVIDER_JAR_UNSIGNED := \
- $(JDK_OUTPUTDIR)/jce/unsigned/sunjce_provider.jar
-
-ifneq ($(BUILD_CRYPTO), no)
- $(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR, , \
- SRCS := $(JDK_OUTPUTDIR)/modules/java.base, \
- SUFFIXES := .class, \
- INCLUDES := com/sun/crypto/provider, \
- JAR := $(SUNJCE_PROVIDER_JAR_UNSIGNED), \
- MANIFEST := $(JCE_MANIFEST), \
- SKIP_METAINF := true))
-
- $(SUNJCE_PROVIDER_JAR_UNSIGNED): $(JCE_MANIFEST)
-
- TARGETS += $(SUNJCE_PROVIDER_JAR_UNSIGNED)
-endif
-
-$(SUNJCE_PROVIDER_JAR_DST): $(SUNJCE_PROVIDER_JAR_UNSIGNED)
- $(install-file)
-
-TARGETS += $(SUNJCE_PROVIDER_JAR_DST)
-
-##########################################################################################
-
-JCE_JAR_DST := $(JDK_OUTPUTDIR)/lib/jce.jar
-JCE_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/jce.jar
-
-ifneq ($(BUILD_CRYPTO), no)
- $(eval $(call SetupArchive,BUILD_JCE_JAR, , \
- SRCS := $(JDK_OUTPUTDIR)/modules/java.base, \
- SUFFIXES := .class, \
- INCLUDES := javax/crypto sun/security/internal, \
- JAR := $(JCE_JAR_UNSIGNED), \
- MANIFEST := $(JCE_MANIFEST), \
- SKIP_METAINF := true))
-
- $(JCE_JAR_UNSIGNED): $(JCE_MANIFEST)
-
- TARGETS += $(JCE_JAR_UNSIGNED)
-endif
-
-$(JCE_JAR_DST): $(JCE_JAR_UNSIGNED)
- $(install-file)
-
-TARGETS += $(JCE_JAR_DST)
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
-
- SUNMSCAPI_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunmscapi.jar
- SUNMSCAPI_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/sunmscapi.jar
-
- $(eval $(call SetupArchive,BUILD_SUNMSCAPI_JAR, , \
- SRCS := $(JDK_OUTPUTDIR)/modules/jdk.crypto.mscapi, \
- SUFFIXES := .class, \
- INCLUDES := sun/security/mscapi, \
- JAR := $(SUNMSCAPI_JAR_UNSIGNED), \
- MANIFEST := $(JCE_MANIFEST), \
- SKIP_METAINF := true))
-
- $(SUNMSCAPI_JAR_UNSIGNED): $(JCE_MANIFEST)
-
- $(SUNMSCAPI_JAR_DST): $(SUNMSCAPI_JAR_UNSIGNED)
- $(install-file)
-
- TARGETS += $(SUNMSCAPI_JAR_UNSIGNED) $(SUNMSCAPI_JAR_DST)
-
-endif
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-
- UCRYPTO_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/ucrypto.jar
- UCRYPTO_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/ucrypto.jar
-
- $(eval $(call SetupArchive,BUILD_UCRYPTO_JAR, , \
- SRCS := $(JDK_OUTPUTDIR)/modules/jdk.crypto.ucrypto, \
- SUFFIXES := .class, \
- INCLUDES := com/oracle/security/ucrypto, \
- JAR := $(UCRYPTO_JAR_UNSIGNED), \
- MANIFEST := $(JCE_MANIFEST), \
- SKIP_METAINF := true))
-
- $(UCRYPTO_JAR_UNSIGNED): $(JCE_MANIFEST)
-
- $(UCRYPTO_JAR_DST): $(UCRYPTO_JAR_UNSIGNED)
- $(install-file)
-
- TARGETS += $(UCRYPTO_JAR_UNSIGNED) $(UCRYPTO_JAR_DST)
-
-endif
-
-all: $(TARGETS)
-
-.PHONY: default all
--- a/jdk/make/Images.gmk Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,782 +0,0 @@
-#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-include $(SPEC)
-include MakeBase.gmk
-include JavaCompilation.gmk
-
-default: images
-
-# Prepare the find cache.
-$(eval $(call FillCacheFind, \
- $(wildcard $(JDK_OUTPUTDIR)/bin \
- $(JDK_OUTPUTDIR)/lib \
- $(IMAGES_OUTPUTDIR)/lib \
- $(JDK_OUTPUTDIR)/include \
- $(JDK_OUTPUTDIR)/sample \
- $(JDK_OUTPUTDIR)/demo)))
-
-include Tools.gmk
-
-include Profiles.gmk
-
-# Note: This double-colon rule is intentional, to support
-# custom make file integration.
-images:: jre-image jdk-image
-
-overlay-images: jre-overlay-image jdk-overlay-image
-
-
-
-# Processing license files from source area to image area
-# These will be modified to have the platform specific EOL chars.
-define process-doc-file
- $(ECHO) $(LOG_INFO) Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(MKDIR) -p $(@D)
- $(RM) $@
- LC_ALL=C $(SED) 's/$$//g' $< > $@
- $(CHMOD) 444 $@
-endef
-
-define AddFileToCopy
- # Param 1 - src root dir
- # Param 2 - dest root dir
- # Param 3 - src file
- # Param 4 - variable to add targets to
-
- # Remove src dir root from src file
- $2_$3_FILE := $$(patsubst $1/%,%,$3)
-
- $2/$$($2_$3_FILE): $3
- $(ECHO) $(LOG_INFO) Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
- $$(install-file)
-
- $4 += $2/$$($2_$3_FILE)
-endef
-
-################################################################################
-#
-# JRE and JDK build rules
-#
-################################################################################
-#
-# Variable prefixes explained:
-# JRE_ refers to files in the j2re-*-image.
-# JDK_ refers to files in the j2sdk-image outside of the jre subdir.
-# JDKJRE_ refers to files in the j2sdk-image inside the jre subdir.
-#
-
-################################################################################
-# /bin dir
-
-ifeq ($(PROFILE), )
- NOT_JRE_BIN_FILES := \
- appletviewer$(EXE_SUFFIX) \
- idlj$(EXE_SUFFIX) \
- jar$(EXE_SUFFIX) \
- jarsigner$(EXE_SUFFIX) \
- java-rmi.cgi \
- javac$(EXE_SUFFIX) \
- javadoc$(EXE_SUFFIX) \
- javah$(EXE_SUFFIX) \
- javap$(EXE_SUFFIX) \
- jdeps$(EXE_SUFFIX) \
- jcmd$(EXE_SUFFIX) \
- jdb$(EXE_SUFFIX) \
- jps$(EXE_SUFFIX) \
- jrunscript$(EXE_SUFFIX) \
- jstat$(EXE_SUFFIX) \
- jstatd$(EXE_SUFFIX) \
- jstack$(EXE_SUFFIX) \
- packagebean$(SCRIPT_SUFFIX) \
- rmic$(EXE_SUFFIX) \
- serialver$(EXE_SUFFIX) \
- unregbean$(EXE_SUFFIX) \
- jconsole$(EXE_SUFFIX) \
- jinfo$(EXE_SUFFIX) \
- jmap$(EXE_SUFFIX) \
- native2ascii$(EXE_SUFFIX) \
- xjc$(EXE_SUFFIX) \
- wsgen$(EXE_SUFFIX) \
- wsimport$(EXE_SUFFIX) \
- schemagen$(EXE_SUFFIX) \
- jsadebugd$(EXE_SUFFIX) \
- jhat$(EXE_SUFFIX)
-endif
-
-WINDOWS_JDK_BIN_FILES = \
- $(EXE_SUFFIX) \
- $(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \
- $(notdir $(MSVCR_DLL))
-
-WINDOWS_JDKJRE_BIN_FILES := \
- $(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
- $(SALIB_NAME)
-
-# Find all files in bin dir
-ALL_BIN_LIST := $(call CacheFind, $(JDK_OUTPUTDIR)/bin)
-
-# Prevent sjavac from entering the images.
-ALL_BIN_LIST := $(filter-out %/sjavac, $(ALL_BIN_LIST))
-
-# For unknown reason the debuginfo files for executables are not put into images
-# e.g filter them out
-ifneq ($(OPENJDK_TARGET_OS), windows)
- ALL_BIN_LIST := $(filter-out %.debuginfo %.diz, $(ALL_BIN_LIST))
-else
- # On windows, the libraries are in the bin dir, only filter out debuginfo files
- # for executables. "java" is both a library and executable.
- ALL_BIN_EXEC_FILES := $(filter-out java.exe, $(notdir $(filter %.exe, $(ALL_BIN_LIST))))
- ALL_BIN_DEBUG_FILTER := $(addprefix %, $(patsubst %.exe, %.debuginfo, $(ALL_BIN_EXEC_FILES)) \
- $(patsubst %.exe, %.diz, $(ALL_BIN_EXEC_FILES))) %.pdb
- ALL_BIN_LIST := $(filter-out $(ALL_BIN_DEBUG_FILTER), $(ALL_BIN_LIST))
-endif
-
-JDKJRE_BIN_LIST := $(filter-out $(addprefix %, $(NOT_JRE_BIN_FILES)), $(ALL_BIN_LIST))
-JRE_BIN_LIST := $(filter-out $(addprefix %, $(WINDOWS_JDKJRE_BIN_FILES)), $(JDKJRE_BIN_LIST))
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- JDK_BIN_LIST := $(filter $(addprefix %, $(WINDOWS_JDK_BIN_FILES)), $(ALL_BIN_LIST))
- # On windows x86, the server jvm is filtered out from the j2re image. This could possibly
- # be handled by profiles in the future. If no client jvm is built, leave server in.
- ifeq ($(OPENJDK_TARGET_CPU), x86)
- ifeq ($(JVM_VARIANT_CLIENT), true)
- JRE_BIN_LIST := $(filter-out $(JDK_OUTPUTDIR)/bin/server/%, $(JRE_BIN_LIST))
- endif
- endif
-else
- JDK_BIN_LIST := $(ALL_BIN_LIST)
-endif
-
-ifneq ($(OPENJDK_TARGET_CPU_ISADIR), )
- OVERLAY_FILTER := $(JDK_OUTPUTDIR)/bin$(OPENJDK_TARGET_CPU_ISADIR)%
-endif
-
-$(foreach f,$(filter-out $(OVERLAY_FILTER),$(JRE_BIN_LIST)), \
- $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JRE_IMAGE_DIR),$f,JRE_BIN_TARGETS)))
-$(foreach f,$(filter-out $(OVERLAY_FILTER),$(JDK_BIN_LIST)), \
- $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_BIN_TARGETS)))
-$(foreach f,$(filter-out $(OVERLAY_FILTER),$(JDKJRE_BIN_LIST)), \
- $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR)/jre,$f,JDKJRE_BIN_TARGETS)))
-
-$(foreach f,$(filter $(OVERLAY_FILTER),$(JRE_BIN_LIST)), \
- $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JRE_OVERLAY_IMAGE_DIR),$f,JRE_BIN_TARGETS)))
-$(foreach f,$(filter $(OVERLAY_FILTER),$(JDK_BIN_LIST)), \
- $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR),$f,JDK_BIN_TARGETS)))
-$(foreach f,$(filter $(OVERLAY_FILTER),$(JDKJRE_BIN_LIST)), \
- $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR)/jre,$f,JDKJRE_BIN_TARGETS)))
-
-################################################################################
-# /lib dir
-ifneq ($(OPENJDK_TARGET_OS), macosx)
- JDKJRE_LIB_FILES := \
- $(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
- $(SALIB_NAME)
-endif
-
-ifeq ($(PROFILE), )
- NOT_JRE_LIB_FILES := \
- tools.jar \
- jconsole.jar \
- sa-jdi.jar \
- dt.jar \
- ct.sym
-
- ifeq ($(OPENJDK_TARGET_OS), windows)
- NOT_JRE_LIB_FILES += jawt.lib jvm.lib
- endif
-endif
-
-JDK_LIB_FILES := $(NOT_JRE_LIB_FILES)
-ifeq ($(OPENJDK_TARGET_OS), linux)
- JDK_LIB_FILES += jexec
-endif
-
-ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris),) # If Linux or Solaris
- JDK_LIB_FILES += $(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \
- $(LIBRARY_PREFIX)jawt$(SHARED_LIBRARY_SUFFIX)
-endif
-
-# Find all files to copy from $(JDK_OUTPUTDIR)/lib
-# Jar files are not expected to be here
-ALL_JDKOUT_LIB_LIST := $(call not-containing,_the., $(filter-out %.jar, \
- $(call CacheFind, $(JDK_OUTPUTDIR)/lib)))
-# Find all files to copy from $(IMAGES_OUTPUTDIR)/lib
-# This is were the jar files are and might not exist if building overlay-images
-ifneq ($(wildcard $(IMAGES_OUTPUTDIR)/lib), )
- ALL_IMAGES_LIB_LIST := $(call not-containing,_the., \
- $(call CacheFind, $(IMAGES_OUTPUTDIR)/lib))
-endif
-
-# Filter files to copy for each destination
-JRE_JDKOUT_LIB_LIST := $(filter-out $(addprefix %, $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)), \
- $(ALL_JDKOUT_LIB_LIST))
-JDKJRE_JDKOUT_LIB_LIST := $(filter-out $(addprefix %, $(NOT_JRE_LIB_FILES)), $(ALL_JDKOUT_LIB_LIST))
-JDK_JDKOUT_LIB_LIST := $(filter $(addprefix %, $(JDK_LIB_FILES)), $(ALL_JDKOUT_LIB_LIST))
-
-JRE_IMAGES_LIB_LIST := $(filter-out $(addprefix %, $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)), \
- $(ALL_IMAGES_LIB_LIST))
-JDKJRE_IMAGES_LIB_LIST := $(filter-out $(addprefix %, $(NOT_JRE_LIB_FILES)), $(ALL_IMAGES_LIB_LIST))
-JDK_IMAGES_LIB_LIST := $(filter $(addprefix %, $(JDK_LIB_FILES)), $(ALL_IMAGES_LIB_LIST))
-
-# Iterate over files to copy to create rules for each one
-$(foreach f,$(JRE_JDKOUT_LIB_LIST), \
- $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JRE_IMAGE_DIR),$f,JRE_LIB_TARGETS)))
-$(foreach f,$(JDK_JDKOUT_LIB_LIST), \
- $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_LIB_TARGETS)))
-$(foreach f,$(JDKJRE_JDKOUT_LIB_LIST), \
- $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR)/jre,$f,JDKJRE_LIB_TARGETS)))
-
-$(foreach f,$(JRE_IMAGES_LIB_LIST), \
- $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR),$(JRE_IMAGE_DIR),$f,JRE_LIB_TARGETS)))
-$(foreach f,$(JDK_IMAGES_LIB_LIST), \
- $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_LIB_TARGETS)))
-$(foreach f,$(JDKJRE_IMAGES_LIB_LIST), \
- $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR),$(JDK_IMAGE_DIR)/jre,$f,JDKJRE_LIB_TARGETS)))
-
-$(foreach f,$(filter $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JRE_JDKOUT_LIB_LIST)), \
- $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JRE_OVERLAY_IMAGE_DIR),$f,JRE_OVERLAY_LIB_TARGETS)))
-$(foreach f,$(filter $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JDK_JDKOUT_LIB_LIST)), \
- $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR),$f,JDK_OVERLAY_LIB_TARGETS)))
-$(foreach f,$(filter $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JDKJRE_JDKOUT_LIB_LIST)), \
- $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR)/jre,$f,JDKJRE_OVERLAY_LIB_TARGETS)))
-
-ifneq ($(PROFILE), )
- # Files in lib$(PROFILE) are excluded from the generic copying routines so
- # we have to add them back in here
- $(foreach f,$(CUSTOM_PROFILE_JARS), \
- $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR)/lib$(PROFILE),$(JRE_IMAGE_DIR)/lib,$f,JRE_LIB_TARGETS)))
-endif
-
-# CTE plugin security change require new empty directory lib/applet
-$(JRE_IMAGE_DIR)/lib/applet:
- $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(MKDIR) -p $@
-
-$(JDK_IMAGE_DIR)/jre/lib/applet:
- $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(MKDIR) -p $@
-
-$(JRE_IMAGE_DIR)/lib/meta-index: $(JRE_LIB_TARGETS)
- $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
-
-$(JDK_IMAGE_DIR)/jre/lib/meta-index: $(JDKJRE_LIB_TARGETS)
- $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
-
-$(JRE_IMAGE_DIR)/lib/ext/meta-index: $(JRE_LIB_TARGETS)
- $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
-
-$(JDK_IMAGE_DIR)/jre/lib/ext/meta-index: $(JDKJRE_LIB_TARGETS)
- $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
-
-################################################################################
-# /man dir
-#
-# All variables in this section are assigned with simple =, without :, to enable
-# more selective overriding from the custom version of this file.
-#
-# Avoid evaluating this whole section on windows for speed and stability
-ifneq ($(OPENJDK_TARGET_OS), windows)
- JRE_MAN_PAGES = \
- java.1 \
- jjs.1 \
- keytool.1 \
- orbd.1 \
- pack200.1 \
- policytool.1 \
- rmid.1 \
- rmiregistry.1 \
- servertool.1 \
- tnameserv.1 \
- unpack200.1
-
- ifndef OPENJDK
- ifneq ($(OPENJDK_TARGET_OS), solaris)
- JRE_MAN_PAGES += javaws.1
- endif
- endif
-
- JDK_MAN_PAGES = \
- $(JRE_MAN_PAGES) \
- appletviewer.1 \
- idlj.1 \
- jar.1 \
- jarsigner.1 \
- javac.1 \
- javadoc.1 \
- javah.1 \
- javap.1 \
- jconsole.1 \
- jcmd.1 \
- jdb.1 \
- jdeps.1 \
- jhat.1 \
- jinfo.1 \
- jmap.1 \
- jps.1 \
- jrunscript.1 \
- jsadebugd.1 \
- jstack.1 \
- jstat.1 \
- jstatd.1 \
- native2ascii.1 \
- rmic.1 \
- schemagen.1 \
- serialver.1 \
- wsgen.1 \
- wsimport.1 \
- xjc.1
-
- # This variable is potentially overridden in the closed makefile.
- MAN_SRC_BASEDIR ?= $(JDK_TOPDIR)/src
-
- ifeq ($(OPENJDK_TARGET_OS), linux)
- MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/linux/doc
- MAN1_SUBDIR = man
- endif
- ifeq ($(OPENJDK_TARGET_OS), solaris)
- MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/solaris/doc
- MAN1_SUBDIR = sun/man/man1
- endif
- ifeq ($(OPENJDK_TARGET_OS), macosx)
- MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/bsd/doc
- MAN1_SUBDIR = man
- endif
-
- $(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
- $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(install-file)
-
- $(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
- $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(install-file)
-
- $(JRE_IMAGE_DIR)/man/man1/%: $(JDK_OUTPUTDIR)/impdoc/$(MAN1_SUBDIR)/%
- $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(install-file)
-
- $(JDK_IMAGE_DIR)/man/man1/%: $(JDK_OUTPUTDIR)/impdoc/$(MAN1_SUBDIR)/%
- $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(install-file)
-
- define install-ja-manpage
- $(MKDIR) -p $(@D)
- $(CAT) $< \
- | $(NATIVE2ASCII) -encoding eucJP \
- | $(SED) 's/@@VERSION@@/$(THIS_JDK_VERSION)/g' \
- | $(NATIVE2ASCII) -reverse -encoding $1 \
- > $@
- endef
-
- $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
- $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(call install-ja-manpage, UTF-8)
-
- $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
- $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(call install-ja-manpage, UTF-8)
-
- $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
- $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(call install-ja-manpage, PCK)
-
- $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
- $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(call install-ja-manpage, PCK)
-
- ifeq ($(OPENJDK_TARGET_OS), solaris)
- $(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
- $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(install-file)
-
- $(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
- $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(install-file)
- endif
-
- ifeq ($(OPENJDK_TARGET_OS), linux)
- $(JRE_IMAGE_DIR)/man/ja:
- $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
-
- $(JDK_IMAGE_DIR)/man/ja:
- $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
- endif
-
- ifeq ($(OPENJDK_TARGET_OS), macosx)
- $(JRE_IMAGE_DIR)/man/ja:
- $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
-
- $(JDK_IMAGE_DIR)/man/ja:
- $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
- endif
-
- ifeq ($(OPENJDK_TARGET_OS), linux)
- JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
- $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
- $(JRE_IMAGE_DIR)/man/ja
-
- JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
- $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
- $(JDK_IMAGE_DIR)/man/ja
- endif
-
- ifeq ($(OPENJDK_TARGET_OS), solaris)
- JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
- $(addprefix $(JRE_IMAGE_DIR)/man/ja/man1/, $(JRE_MAN_PAGES)) \
- $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
- $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JRE_MAN_PAGES))
-
- JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
- $(addprefix $(JDK_IMAGE_DIR)/man/ja/man1/, $(JDK_MAN_PAGES)) \
- $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
- $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JDK_MAN_PAGES))
- endif
-
- ifeq ($(OPENJDK_TARGET_OS), macosx)
- JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
- $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
- $(JRE_IMAGE_DIR)/man/ja
-
- JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
- $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
- $(JDK_IMAGE_DIR)/man/ja
- endif
-
-endif # Windows
-
-################################################################################
-# /demo dir
-
-# FIXME: demo/applets/GraphLayout/GraphPanel$2.class is sometimes not copied.
-
-# The db demo contains an empty dir that needs to be copied. The other
-# directories will always trigger the rule for recompile since
-# _the.list_of_packages files are touched.
-$(JDK_IMAGE_DIR)/demo/%: $(JDK_OUTPUTDIR)/demo/%
- if [ ! -d "$@" ]; then \
- $(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'; \
- $(MKDIR) -p $(@D); \
- if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) '$<' '$@'; fi \
- fi
-
-# Find all files including directories
-JDK_DEMO_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/demo/%, $(JDK_IMAGE_DIR)/demo/%, \
- $(shell $(FIND) $(JDK_OUTPUTDIR)/demo ! \( -name "_the*" -o -name "javac_state" \) ))
-
-
-
-# Param 1 is source file
-define CreateOverlayDemoRule
- $1_TARGET := $$(subst $(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR), \
- $$(dir $1)$(OPENJDK_TARGET_CPU_ISADIR)/$$(notdir $1))
- $$($1_TARGET): $1
- $(ECHO) $(LOG_INFO) Copying '$$(patsubst $(OUTPUT_ROOT)/%,%,$$@)'
- $$(call install-file)
-
- JDK_OVERLAY_DEMO_TARGETS += $$($1_TARGET)
-endef
-JDK_OVERLAY_DEMO_SOURCES := $(filter %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(JDK_OUTPUTDIR)/demo))
-$(foreach lib, $(JDK_OVERLAY_DEMO_SOURCES), $(eval $(call CreateOverlayDemoRule, $(lib))))
-
-################################################################################
-# /sample dir
-
-$(foreach f,$(call CacheFind,$(JDK_OUTPUTDIR)/sample), \
- $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_SAMPLE_TARGETS)))
-
-################################################################################
-# /db dir
-
-ifndef OPENJDK
- DB_ZIP_DIR := $(wildcard $(JDK_TOPDIR)/src/closed/db)
-
- $(IMAGES_OUTPUTDIR)/_unzip/%.unzipped: $(DB_ZIP_DIR)/%
- $(ECHO) Unzipping $(patsubst $(SRC_ROOT)/%,%,$<)
- $(RM) -r $(JDK_IMAGE_DIR)/db
- $(MKDIR) -p $(JDK_IMAGE_DIR)/db
- cd $(JDK_IMAGE_DIR)/db && $(UNZIP) -q -o $< -x */index.html */KEYS */test/* *javadoc/* */docs/* */demo/* 2> /dev/null
- cd $(JDK_IMAGE_DIR)/db && $(MV) db-derby-*-bin/* . && $(RM) -r db-derby-*-bin
- $(MKDIR) -p $(@D)
- $(TOUCH) $@
-
- $(JDK_IMAGE_DIR)/db/README-JDK.html: $(DB_ZIP_DIR)/README-JDK.html
- $(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'
- $(MKDIR) -p $(@D)
- $(CAT) $< | $(SED) "s/XXXX/$(shell cat $(DB_ZIP_DIR)/COPYRIGHTYEAR)/" > $@
-
- $(JDK_IMAGE_DIR)/db/3RDPARTY: $(DB_ZIP_DIR)/3RDPARTY
- $(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'
- $(MKDIR) -p $(@D)
- $(CAT) $< | $(SED) "s/XXXX/$(shell cat $(DB_ZIP_DIR)/COPYRIGHTYEAR)/" > $@
-
- JDK_DB_TARGETS := $(patsubst $(DB_ZIP_DIR)/%, $(IMAGES_OUTPUTDIR)/_unzip/%.unzipped, \
- $(wildcard $(DB_ZIP_DIR)/*.zip)) \
- $(JDK_IMAGE_DIR)/db/README-JDK.html $(JDK_IMAGE_DIR)/db/3RDPARTY
-
-endif
-
-################################################################################
-# /include dir
-
-$(foreach f,$(call CacheFind,$(JDK_OUTPUTDIR)/include), \
- $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_INCLUDE_TARGETS)))
-
-################################################################################
-# doc files
-
-ifdef OPENJDK
- JRE_DOC_FILES := LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
- JDK_DOC_FILES := LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
- JRE_DOC_LOCATION := $(JDK_TOPDIR)
- JDK_DOC_LOCATION := $(JDK_TOPDIR)
-else
- JRE_DOC_FILES := COPYRIGHT Welcome.html LICENSE THIRDPARTYLICENSEREADME.txt
- JDK_DOC_FILES := COPYRIGHT README.html LICENSE THIRDPARTYLICENSEREADME.txt
- ifeq ($(OPENJDK_TARGET_OS), windows)
- JRE_DOC_FILES += README.txt
- else
- JRE_DOC_FILES += README
- endif
- JDK_DOC_FILES += demo/DEMOS_LICENSE sample/SAMPLES_LICENSE
- JRE_DOC_LOCATION := $(JDK_TOPDIR)/src/closed/doc/jre
- JDK_DOC_LOCATION := $(JDK_TOPDIR)/src/closed/doc/jdk
-endif
-JRE_DOC_TARGETS := $(addprefix $(JRE_IMAGE_DIR)/, $(JRE_DOC_FILES))
-JDKJRE_DOC_TARGETS := $(addprefix $(JDK_IMAGE_DIR)/jre/, $(JRE_DOC_FILES))
-JDK_DOC_TARGETS := $(addprefix $(JDK_IMAGE_DIR)/, $(JDK_DOC_FILES))
-
-$(JRE_IMAGE_DIR)/%: $(JRE_DOC_LOCATION)/%
- $(process-doc-file)
-
-$(JDK_IMAGE_DIR)/jre/%: $(JRE_DOC_LOCATION)/%
- $(process-doc-file)
-
-$(JRE_IMAGE_DIR)/README.txt: $(JRE_DOC_LOCATION)/README
- $(process-doc-file)
-
-$(JDK_IMAGE_DIR)/jre/README.txt: $(JRE_DOC_LOCATION)/README
- $(process-doc-file)
-
-$(JDK_IMAGE_DIR)/%: $(JDK_DOC_LOCATION)/%
- $(process-doc-file)
-
-$(JDK_IMAGE_DIR)/demo/%: $(JDK_DOC_LOCATION)/%
- $(process-doc-file)
-
-$(JDK_IMAGE_DIR)/sample/%: $(JDK_DOC_LOCATION)/%
- $(process-doc-file)
-
-JRE_INFO_FILE := $(JRE_IMAGE_DIR)/release
-JDK_INFO_FILE := $(JDK_IMAGE_DIR)/release
-
-JRE_OVERLAY_INFO_FILE := $(JRE_OVERLAY_IMAGE_DIR)/release
-JDK_OVERLAY_INFO_FILE := $(JDK_OVERLAY_IMAGE_DIR)/release
-
-# Common way to emit a line into the release or info file
-define info-file-item # name value
- $(PRINTF) '%s="%s"\n' $1 $2 >> $@
-endef
-
-define create-info-file
- $(MKDIR) -p $(@D)
- $(RM) $@
- $(call info-file-item, "JAVA_VERSION", "$(JDK_VERSION)")
- $(call info-file-item, "OS_NAME", "$(REQUIRED_OS_NAME)")
- $(call info-file-item, "OS_VERSION", "$(REQUIRED_OS_VERSION)")
- $(call info-file-item, "OS_ARCH", "$(OPENJDK_TARGET_CPU_LEGACY)")
- if [ -n "$(JDK_ARCH_ABI_PROP_NAME)" ]; then $(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)"); fi
- $(call info-file-item, "SOURCE", "$(ALL_SOURCE_TIPS)")
-endef
-
-ALL_SOURCE_TIPS = $(shell \
- if [ -f $(OUTPUT_ROOT)/source_tips ] ; then \
- $(CAT) $(OUTPUT_ROOT)/source_tips ; \
- fi)
-
-$(JRE_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
- $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(call create-info-file)
- ifneq ($(PROFILE), )
- $(call info-file-item, "JAVA_PROFILE", "$(call profile_name, $(call profile_number, $(PROFILE)))")
- endif
-
-$(JDK_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
- $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(call create-info-file)
-
-$(JRE_OVERLAY_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
- $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(call create-info-file)
-
-$(JDK_OVERLAY_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
- $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(call create-info-file)
-
-$(JDK_IMAGE_DIR)/src.zip: $(IMAGES_OUTPUTDIR)/src.zip
- $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
- $(install-file)
-
-################################################################################
-# Post processing (strip etc)
-
-ifneq ($(POST_STRIP_CMD), )
- ifeq ($(OPENJDK_TARGET_OS), windows)
- EXEC_LIST_BIN := $(filter-out %$(notdir $(MSVCR_DLL)), $(filter %.exe %.dll, $(ALL_BIN_LIST)))
- else
- # Find all executables in JDK_OUTPUTDIR since they exist when this makefile is parsed
- EXEC_LIST_BIN := $(shell $(FILE) `$(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*$(EXE_SUFFIX) ! -name \*.debuginfo` \
- | $(EGREP) 'ELF' | $(CUT) -d':' -f1)
- # On mac, the old build searches for static libraries for stripping instead of shared.
- # Not clear if it's intentional.
- ifneq ($(OPENJDK_TARGET_OS), macosx)
- EXEC_LIST_LIB := $(shell $(FIND) $(JDK_OUTPUTDIR)/lib -type f -name \*$(SHARED_LIBRARY_SUFFIX))
- endif
- endif
- # Filter out sjavac
- EXEC_LIST_BIN := $(filter-out %sjavac$(EXE_SUFFIX), $(EXEC_LIST_BIN))
-
- # Filter out the overlay specific bin files
- EXEC_LIST := $(filter-out $(OVERLAY_FILTER), $(EXEC_LIST_BIN)) $(EXEC_LIST_LIB)
- EXEC_LIST_OVERLAY := $(filter $(OVERLAY_FILTER), $(EXEC_LIST_BIN)) $(EXEC_LIST_LIB)
-
- # Filter out non JRE files and convert to unique touch files to depend on
- JRE_STRIP_LIST := $(patsubst $(JDK_OUTPUTDIR)/%, $(IMAGES_OUTPUTDIR)/_strip_jre$(PROFILE)/%.stripped, \
- $(filter-out $(addprefix %, $(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)), \
- $(EXEC_LIST)))
-
- JDKJRE_STRIP_LIST := $(patsubst $(JDK_OUTPUTDIR)/%, \
- $(IMAGES_OUTPUTDIR)/_strip_jdk/jre/%.stripped, \
- $(filter-out $(addprefix %, $(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES)), $(EXEC_LIST)))
-
- JDK_BIN_STRIP_LIST := $(patsubst $(JDK_OUTPUTDIR)/%, \
- $(IMAGES_OUTPUTDIR)/_strip_jdk/%.stripped, \
- $(filter-out $(JDK_OUTPUTDIR)/lib/%, $(EXEC_LIST)))
-
- # Do the same for overlay image
- JRE_OVERLAY_STRIP_LIST := $(patsubst $(JDK_OUTPUTDIR)/%, $(IMAGES_OUTPUTDIR)/_strip_jre_overlay/%.stripped, \
- $(filter-out $(addprefix %, $(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)), \
- $(EXEC_LIST_OVERLAY)))
-
- JDKJRE_OVERLAY_STRIP_LIST := $(patsubst $(JDK_OUTPUTDIR)/%, \
- $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/jre/%.stripped, \
- $(filter-out $(addprefix %, $(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES)), $(EXEC_LIST_OVERLAY)))
-
- JDK_OVERLAY_BIN_STRIP_LIST := $(patsubst $(JDK_OUTPUTDIR)/%, \
- $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/%.stripped, \
- $(filter-out $(JDK_OUTPUTDIR)/lib/%, $(EXEC_LIST_OVERLAY)))
-
- define mcs-file
- $(if $(POST_MCS_CMD), $(POST_MCS_CMD) $<)
- endef
-
- define strip-file
- $(ECHO) Stripping $(LOG_INFO) $(patsubst $(OUTPUT_ROOT)/%,%,$<)
- $(CHMOD) u+w $<
- $(POST_STRIP_CMD) $<
- $(call mcs-file)
- $(CHMOD) go-w $<
- $(MKDIR) -p $(@D)
- $(TOUCH) $@
- endef
-
- # Setup a rule for stripping files based on touch files
- $(IMAGES_OUTPUTDIR)/_strip_jre$(PROFILE)/%.stripped: $(JRE_IMAGE_DIR)/%
- $(call strip-file)
-
- $(IMAGES_OUTPUTDIR)/_strip_jdk/%.stripped: $(JDK_IMAGE_DIR)/%
- $(call strip-file)
-
- $(IMAGES_OUTPUTDIR)/_strip_jre_overlay/%.stripped: $(JRE_OVERLAY_IMAGE_DIR)/%
- $(call strip-file)
-
- $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/%.stripped: $(JDK_OVERLAY_IMAGE_DIR)/%
- $(call strip-file)
-
-endif
-
-################################################################################
-
-# Include the custom makefile right here, after all variables have been defined
-# so that they may be overridden, but before the main targets are declared, so
-# that overriding has an effect.
-$(eval $(call IncludeCustomExtension, jdk, Images.gmk))
-
-################################################################################
-# Main targets
-
-jre-image: $(JRE_BIN_TARGETS) $(JRE_LIB_TARGETS) $(JRE_IMAGE_DIR)/lib/applet \
- $(JRE_IMAGE_DIR)/lib/meta-index $(JRE_IMAGE_DIR)/lib/ext/meta-index \
- $(JRE_MAN_PAGE_LIST) $(JRE_DOC_TARGETS) $(JRE_INFO_FILE) $(JRE_STRIP_LIST) \
- $(JRE_BIN_ISADIR_LINK_TARGETS)
-
-jdk-image: $(JDK_BIN_TARGETS) $(JDKJRE_BIN_TARGETS) \
- $(JDK_LIB_TARGETS) $(JDKJRE_LIB_TARGETS) \
- $(JDK_IMAGE_DIR)/jre/lib/applet \
- $(JDK_DEMO_TARGETS) \
- $(JDK_IMAGE_DIR)/jre/lib/meta-index $(JDK_IMAGE_DIR)/jre/lib/ext/meta-index \
- $(JDK_MAN_PAGE_LIST) $(JDK_SAMPLE_TARGETS) \
- $(JDK_DB_TARGETS) $(JDK_INCLUDE_TARGETS) \
- $(JDKJRE_DOC_TARGETS) $(JDK_DOC_TARGETS) \
- $(JDK_INFO_FILE) $(JDKJRE_STRIP_LIST) $(JDK_BIN_STRIP_LIST) \
- $(JDK_IMAGE_DIR)/src.zip \
- $(JDK_BIN_ISADIR_LINK_TARGETS) $(JDKJRE_BIN_ISADIR_LINK_TARGETS)
-
-jre-overlay-image: $(JRE_OVERLAY_BIN_TARGETS) $(JRE_OVERLAY_LIB_TARGETS) \
- $(JRE_OVERLAY_INFO_FILE) $(JRE_OVERLAY_STRIP_LIST)
-
-jdk-overlay-image: $(JDK_OVERLAY_BIN_TARGETS) $(JDKJRE_OVERLAY_BIN_TARGETS) \
- $(JDK_OVERLAY_LIB_TARGETS) $(JDKJRE_OVERLAY_LIB_TARGETS) \
- $(JDK_OVERLAY_DEMO_TARGETS) $(JDK_OVERLAY_INFO_FILE) \
- $(JDKJRE_OVERLAY_STRIP_LIST) $(JDK_OVERLAY_BIN_STRIP_LIST)
-
-ifneq ($(PROFILE), )
- PROFILE_IMAGE_JARS := $(filter %.jar, $(JRE_LIB_TARGETS))
-
- PROFILE_IMAGE_JARS_CHECKED := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_jars_checked
-
- $(PROFILE_IMAGE_JARS_CHECKED) : $(PROFILE_IMAGE_JARS)
- $(TOOL_CHECKDEPS) $(JRE_IMAGE_DIR) \
- $(call profile_name, $(call profile_number, $(PROFILE)))
- $(TOUCH) $@
-
- profile-image: $(JRE_BIN_TARGETS) $(JRE_LIB_TARGETS) \
- $(JRE_IMAGE_DIR)/lib/meta-index $(JRE_IMAGE_DIR)/lib/ext/meta-index \
- $(JRE_INFO_FILE) $(JRE_STRIP_LIST) $(PROFILE_IMAGE_JARS_CHECKED)
-
- .PHONY: profile-image
-
-endif # Profile
-
-################################################################################
-
-.PHONY: default images jre-image jdk-image
--- a/jdk/make/Import.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/Import.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, 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
@@ -31,34 +31,53 @@
################################################################################
# Put the libraries here. Different locations for different target apis.
-ifeq ($(OPENJDK_TARGET_OS_API), posix)
- INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
+ifneq ($(OPENJDK_TARGET_OS), windows)
HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)
+ BASE_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)
+ SA_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent$(OPENJDK_TARGET_CPU_LIBDIR)
else
- INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/bin
HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/jre/bin
+ BASE_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
+ SA_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent
endif
################################################################################
-
-define CopyDir
- $1_SRC_FILES := $(shell $(FIND) $2 -type f -a \( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE),$4) \))
- $1_DST_FILES := $$(patsubst $2/%,$3/%,$$($1_SRC_FILES))
- HOTSPOT_IMPORT_TARGET_FILES += $$($1_DST_FILES)
- $3/%: $2/%
- $(ECHO) $(LOG_INFO) Copying $$(@F)
- $$(install-file)
-endef
-
-################################################################################
-
#
# Import hotspot
#
-HOTSPOT_IMPORT_FILES := $(addprefix $(LIBRARY_PREFIX), jvm.* saproc.* jsig.* sawindbg.* jvm_db.* jvm_dtrace.*) \
- Xusage.txt sa-jdi.jar
-$(eval $(call CopyDir,HOTSPOT0, $(HOTSPOT_LIB_DIR), $(INSTALL_LIBRARIES_HERE), $(HOTSPOT_IMPORT_FILES)))
-$(eval $(call CopyDir,HOTSPOT1, $(HOTSPOT_DIST)/lib, $(JDK_OUTPUTDIR)/lib, $(HOTSPOT_IMPORT_FILES)))
+HOTSPOT_BASE_IMPORT_FILES := \
+ $(addprefix $(LIBRARY_PREFIX), jvm.* jsig.* jvm_db.* jvm_dtrace.*) \
+ Xusage.txt \
+ #
+
+HOTSPOT_SA_IMPORT_FILES := \
+ $(addprefix $(LIBRARY_PREFIX), saproc.* sawindbg.*) \
+ #
+
+$(eval $(call SetupCopyFiles,COPY_HOTSPOT_BASE, \
+ SRC := $(HOTSPOT_LIB_DIR), \
+ DEST := $(BASE_INSTALL_LIBRARIES_HERE), \
+ FILES := $(shell $(FIND) $(HOTSPOT_LIB_DIR) -type f \
+ -a \( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE), $(HOTSPOT_BASE_IMPORT_FILES)) \) )))
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ $(eval $(call SetupCopyFiles,COPY_HOTSPOT_BASE_JVMLIB, \
+ SRC := $(HOTSPOT_DIST)/lib, \
+ DEST := $(BASE_INSTALL_LIBRARIES_HERE), \
+ FILES := $(wildcard $(HOTSPOT_DIST)/lib/*.lib)))
+endif
+
+BASE_TARGETS := $(COPY_HOTSPOT_BASE) $(COPY_HOTSPOT_BASE_JVMLIB)
+
+$(eval $(call SetupCopyFiles,COPY_HOTSPOT_SA, \
+ SRC := $(HOTSPOT_LIB_DIR), \
+ DEST := $(SA_INSTALL_LIBRARIES_HERE), \
+ FILES := $(shell $(FIND) $(HOTSPOT_LIB_DIR) -type f \
+ -a \( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE), $(HOTSPOT_SA_IMPORT_FILES)) \) )))
+
+SA_TARGETS := $(COPY_HOTSPOT_SA)
+
+################################################################################
ifeq ($(OPENJDK_TARGET_OS), macosx)
JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig$(SHARED_LIBRARY_SUFFIX).dSYM) \
@@ -70,39 +89,39 @@
ifneq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(JVM_VARIANT_SERVER), true)
- HOTSPOT_IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
+ BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
ifneq (, $(JSIG_DEBUGINFO))
- HOTSPOT_IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/server/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
+ BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/server/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
endif
endif
ifeq ($(JVM_VARIANT_CLIENT), true)
- HOTSPOT_IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
+ BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
ifneq (, $(JSIG_DEBUGINFO))
- HOTSPOT_IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
+ BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
endif
endif
ifneq ($(OPENJDK_TARGET_OS), macosx)
ifeq ($(JVM_VARIANT_MINIMAL1), true)
- HOTSPOT_IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
+ BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
ifneq (,$(JSIG_DEBUGINFO))
- HOTSPOT_IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
+ BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
endif
endif
endif
endif
-$(INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
+$(BASE_INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
ifeq ($(OPENJDK_TARGET_OS), macosx)
- $(INSTALL_LIBRARIES_HERE)/server/%.dSYM : $(INSTALL_LIBRARIES_HERE)/%.dSYM
+ $(BASE_INSTALL_LIBRARIES_HERE)/server/%.dSYM : $(BASE_INSTALL_LIBRARIES_HERE)/%.dSYM
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
- $(INSTALL_LIBRARIES_HERE)/server/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
+ $(BASE_INSTALL_LIBRARIES_HERE)/server/%.diz : $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
$(MKDIR) -p $(@D)
$(RM) $@
$(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
@@ -111,12 +130,12 @@
$(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
$(MV) $@.tmp $@
else
- $(INSTALL_LIBRARIES_HERE)/server/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
+ $(BASE_INSTALL_LIBRARIES_HERE)/server/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
- $(INSTALL_LIBRARIES_HERE)/server/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
+ $(BASE_INSTALL_LIBRARIES_HERE)/server/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
$(MKDIR) -p $(@D)
$(RM) $@
$(RM) $@.tmp $(basename $@).debuginfo
@@ -126,18 +145,18 @@
$(MV) $@.tmp $@
endif
-$(INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
+$(BASE_INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
ifeq ($(OPENJDK_TARGET_OS), macosx)
- $(INSTALL_LIBRARIES_HERE)/client/%.dSYM : $(INSTALL_LIBRARIES_HERE)/%.dSYM
+ $(BASE_INSTALL_LIBRARIES_HERE)/client/%.dSYM : $(BASE_INSTALL_LIBRARIES_HERE)/%.dSYM
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
- $(INSTALL_LIBRARIES_HERE)/client/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
+ $(BASE_INSTALL_LIBRARIES_HERE)/client/%.diz : $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
$(MKDIR) -p $(@D)
$(RM) $@
$(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
@@ -146,12 +165,33 @@
$(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
$(MV) $@.tmp $@
else
- $(INSTALL_LIBRARIES_HERE)/client/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
+ $(BASE_INSTALL_LIBRARIES_HERE)/client/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
- $(INSTALL_LIBRARIES_HERE)/client/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
+ $(BASE_INSTALL_LIBRARIES_HERE)/client/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(RM) $@.tmp $(basename $@).debuginfo
+ $(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
+ $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
+ $(RM) $(basename $@).debuginfo
+ $(MV) $@.tmp $@
+endif
+
+$(BASE_INSTALL_LIBRARIES_HERE)/minimal/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(LN) -s ../$(@F) $@
+
+ifneq ($(OPENJDK_TARGET_OS), macosx)
+ $(BASE_INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(LN) -s ../$(@F) $@
+
+ $(BASE_INSTALL_LIBRARIES_HERE)/minimal/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
$(MKDIR) -p $(@D)
$(RM) $@
$(RM) $@.tmp $(basename $@).debuginfo
@@ -161,31 +201,69 @@
$(MV) $@.tmp $@
endif
-$(INSTALL_LIBRARIES_HERE)/minimal/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
- $(MKDIR) -p $(@D)
- $(RM) $@
- $(LN) -s ../$(@F) $@
+################################################################################
-ifneq ($(OPENJDK_TARGET_OS), macosx)
- $(INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
+$(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/_the.sa.jar.unpacked: $(HOTSPOT_DIST)/lib/sa-jdi.jar \
+ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
+ $(ECHO) $(LOG_INFO) Unzipping $(<F)
+ $(RM) -r $(@D)
$(MKDIR) -p $(@D)
- $(RM) $@
- $(LN) -s ../$(@F) $@
+ $(CD) $(@D) && $(UNZIP) $< -x META-INF/MANIFEST.MF $(LOG_DEBUG)
+ # We must move the service provider file out of the way so that
+ # Gensrc-jdk.jdi.gmk can combine them.
+ $(MKDIR) -p $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent
+ $(MV) $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector \
+ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
+ $(TOUCH) $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
+ $(TOUCH) $@
+
+# Declaring this dependency guarantees that _the.sa.services will be rebuilt
+# even if zip is already unpacked.
+$(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services: $(HOTSPOT_DIST)/lib/sa-jdi.jar
+
+SA_TARGETS += $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/_the.sa.jar.unpacked \
+ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
+
+################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ $(eval $(call SetupCopyFiles,BASE_COPY_LIBS_BIN, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
+ DEST := $(JDK_OUTPUTDIR)/bin, \
+ FILES := $(filter-out %.lib, $(BASE_TARGETS))))
- $(INSTALL_LIBRARIES_HERE)/minimal/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
- $(MKDIR) -p $(@D)
- $(RM) $@
- $(RM) $@.tmp $(basename $@).debuginfo
- $(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
- $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
- $(RM) $(basename $@).debuginfo
- $(MV) $@.tmp $@
+ $(eval $(call SetupCopyFiles,BASE_COPY_LIBS_LIB, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
+ DEST := $(JDK_OUTPUTDIR)/lib, \
+ FILES := $(filter %.lib, $(BASE_TARGETS))))
+
+ $(eval $(call SetupCopyFiles,SA_COPY_LIBS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent, \
+ DEST := $(JDK_OUTPUTDIR)/lib, \
+ FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent/%, \
+ $(SA_TARGETS))))
+
+ $(eval $(call SetupCopyFiles,SA_COPY_LIBS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent, \
+ DEST := $(JDK_OUTPUTDIR)/bin, \
+ FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent/%, \
+ $(SA_TARGETS))))
+else
+ $(eval $(call SetupCopyFiles,BASE_COPY_LIBS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
+ DEST := $(JDK_OUTPUTDIR)/lib, \
+ FILES := $(BASE_TARGETS)))
+
+ $(eval $(call SetupCopyFiles,SA_COPY_LIBS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent, \
+ DEST := $(JDK_OUTPUTDIR)/lib, \
+ FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent/%, $(SA_TARGETS))))
endif
-##########################################################################################
-
-hotspot: $(HOTSPOT_IMPORT_TARGET_FILES)
+################################################################################
-all: hotspot
+all: $(BASE_TARGETS) $(SA_TARGETS) \
+ $(BASE_COPY_LIBS_BIN) $(BASE_COPY_LIBS_LIB) \
+ $(BASE_COPY_LIBS) $(SA_COPY_LIBS)
-.PHONY: hotspot all
+.PHONY: default all
--- a/jdk/make/ProfileNames.gmk Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-#
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# This was split out from Profiles.gmk to allow GenSrcMisc.gmk to include it
-# without attempting to generate lists for output files that don't exist yet
-
-# These are the external names of each profile
-
-PROFILE_NAMES := compact1 compact2 compact3
-
-# The include files use 1,2,3 for simplicity and conciseness. Internally we
-# use profile_1, profile_2 and profile_3.
-
-ALL_PROFILES := profile_1 profile_2 profile_3
-
-# This defines targets to generate per-profile Version.java/class files into
-# distinct locations
-
-VERSION_JAVA_DIR := sun/misc
-VERSION_JAVA_FILE := Version.java
-VERSION_JAVA_PATH := $(VERSION_JAVA_DIR)/$(VERSION_JAVA_FILE)
-VERSION_CLASS_PATH := $(VERSION_JAVA_PATH:.java=.class)
-
-PROFILE_VERSION_JAVA_TARGETS := $(foreach i, $(ALL_PROFILES), $(subst XXX,$i, $(JDK_OUTPUTDIR)/gen_XXX/$(VERSION_JAVA_PATH)))
-
-PROFILE_VERSION_CLASS_TARGETS := $(foreach i, $(PROFILE_VERSION_JAVA_TARGETS), $(i:.java=.class))
-
-# Function to map from profile designator, profile_1 etc, to its number
-profile_number = $(if $(patsubst profile_%,%, $(1)), $(patsubst profile_%,%, $(1)), $(words $(PROFILE_NAMES) extra))
-
-# Function to map from profile number, 1, 2 etc, to the corresponding name
-# An invalid number maps to an empty name
-profile_name = $(word $(1), $(PROFILE_NAMES))
-
-# Function to isolate a profile number from a Version.java target
-# Evaluates to the arg if the arg is not a profile version target
-profile_version_number = $(patsubst $(JDK_OUTPUTDIR)/gen_profile_%/$(VERSION_JAVA_PATH), %, $(1))
-
-# Function to go from a profile Version.java target to profile name. If not
-# a profile version target then we need a number that maps to an empty name
-profile_version_name = $(word $(if $(filter-out $(call profile_version_number, $(1)), $(1)), $(call profile_version_number, $(1)), $(words $(PROFILE_NAMES) extra)), $(PROFILE_NAMES))
--- a/jdk/make/Profiles.gmk Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,324 +0,0 @@
-#
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-include ProfileNames.gmk
-
-# This defines the include lists for each profile, categorized as lib, bin
-# and other. We can use these to define the file lists for each profile
-# directly, rather than constructing a set of files to exclude from the
-# set of all files. But initially we will stick with generating exclude lists
-# as that is how the main build process already works.
-
-include profile-includes.txt
-
-###############################################################################
-# Per profile Jar lists
-#
-# These are the jar files to be built. In some builds these have to be
-# imported (signed jars) rather than built.
-#
-# The incoming lists, eg PROFILE_1_JRE_JARS_FILES, are the jars to be
-# included in this profile. They have the jar name relative to the lib
-# directory. We have to turn these into targets by adding the
-# $(IMAGES_OUTPUTDIR)/lib prefix
-#
-# Note that some jars may be optional depending on the type of build (jdk vs.
-# openjdk) and the platform.
-#
-# WARNING: incoming lists are currently validated for linux only!
-###############################################################################
-
-# These are jar files for which the contents vary depending on the profile
-CUSTOM_JARS := rt.jar resources.jar
-# This is used in Images.gmk
-CUSTOM_PROFILE_JARS := $(addprefix $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/, $(CUSTOM_JARS))
-
-# These are the common jar files built for and included with this profile
-# Filter out the custom jars and turn them into targets.
-
-PROFILE_1_JARS := \
- $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(filter-out $(CUSTOM_JARS), $(PROFILE_1_JRE_JAR_FILES)))
-
-PROFILE_2_JARS := \
- $(if $(PROFILE_2_JRE_JAR_FILES), $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_2_JRE_JAR_FILES))) \
- $(PROFILE_1_JARS)
-
-PROFILE_3_JARS := \
- $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_3_JRE_JAR_FILES)) \
- $(PROFILE_2_JARS)
-
-ifneq ($(ENABLE_JFR), true)
- FULL_JRE_JAR_FILES := $(filter-out jfr.jar, $(FULL_JRE_JAR_FILES))
-endif
-
-FULL_JRE_JARS := \
- $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(FULL_JRE_JAR_FILES)) \
- $(PROFILE_3_JARS)
-
-# The full set of "jar" files needed for a complete JDK (ct.sym and src.zip
-# are also included.)
-# Note we need to add back the regular form of all the custom profile jars e.g.
-# rt.jar and resources.jar that we filtered out above
-
-ALL_JARS := $(FULL_JRE_JARS) \
- $(IMAGES_OUTPUTDIR)/lib/rt.jar \
- $(IMAGES_OUTPUTDIR)/lib/resources.jar \
- $(IMAGES_OUTPUTDIR)/lib/jconsole.jar \
- $(IMAGES_OUTPUTDIR)/lib/dt.jar \
- $(IMAGES_OUTPUTDIR)/lib/tools.jar \
- $(IMAGES_OUTPUTDIR)/lib/ct.sym \
- $(IMAGES_OUTPUTDIR)/src.zip
-
-ifeq ($(INCLUDE_SA), true)
- ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), solaris)
- ifndef OPENJDK
- ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/ext/ucrypto.jar
- endif
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/ext/sunmscapi.jar
-endif
-
-ifeq ($(PROFILE), profile_1)
- PROFILE_JARS := $(PROFILE_1_JARS)
-else ifeq ($(PROFILE), profile_2)
- PROFILE_JARS := $(PROFILE_2_JARS)
-else ifeq ($(PROFILE), profile_3)
- PROFILE_JARS := $(PROFILE_3_JARS)
-endif
-ifneq ($(PROFILE), )
- JARS := $(CUSTOM_PROFILE_JARS) $(PROFILE_JARS)
-else
- JARS := $(ALL_JARS)
-endif
-
-###############################################################################
-# JRE contents
-###############################################################################
-
-
-# we don't need to do anything if not building a profile
-ifneq ($(PROFILE), )
-
-
-# Need all files to generate the exclude lists
-NEW_ALL_BIN_LIST := $(patsubst $(JDK_OUTPUTDIR)/bin/%,%,$(shell $(FIND) $(JDK_OUTPUTDIR)/bin \( -type f -o -type l \) ! -name "sjavac"))
-
-ALL_JRE_BIN_FILES := \
- $(PROFILE_1_JRE_BIN_FILES) \
- $(PROFILE_2_JRE_BIN_FILES) \
- $(PROFILE_3_JRE_BIN_FILES) \
- $(FULL_JRE_BIN_FILES)
-
-NOT_JRE_BIN_FILES := $(filter-out $(ALL_JRE_BIN_FILES), $(NEW_ALL_BIN_LIST))
-
-# Additional exclusions for profile JRE
-ifeq ($(PROFILE), profile_1)
- NOT_JRE_BIN_FILES += \
- $(PROFILE_2_JRE_BIN_FILES) \
- $(PROFILE_3_JRE_BIN_FILES) \
- $(FULL_JRE_BIN_FILES)
-endif
-
-ifeq ($(PROFILE), profile_2)
- NOT_JRE_BIN_FILES += \
- $(PROFILE_3_JRE_BIN_FILES) \
- $(FULL_JRE_BIN_FILES)
-endif
-
-ifeq ($(PROFILE), profile_3)
- NOT_JRE_BIN_FILES += \
- $(FULL_JRE_BIN_FILES)
-endif
-
-NOT_JRE_BIN_FILES := $(addprefix $(JDK_OUTPUTDIR)/bin/, $(NOT_JRE_BIN_FILES))
-
-# Need all files to generate the exclude lists
-NEW_ALL_LIB_LIST := $(patsubst $(JDK_OUTPUTDIR)/lib/%,%,$(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) ))
-NEW_ALL_LIB_LIST += $(patsubst $(IMAGES_OUTPUTDIR)/lib/%,%,$(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) ))
-
-ALL_JRE_LIB_FILES := \
- $(PROFILE_1_JRE_LIB_FILES) \
- $(PROFILE_2_JRE_LIB_FILES) \
- $(PROFILE_3_JRE_LIB_FILES) \
- $(FULL_JRE_LIB_FILES)
-
-NOT_JRE_LIB_FILES := $(filter-out $(ALL_JRE_LIB_FILES), $(NEW_ALL_LIB_LIST))
-
-# Although these are NOT JRE lib files we have to filter them from the list
-# (ie cause them to be added them back in here) because the logic in
-# Images.gmk expects them to be there and handles them differently.
-# If we don't, they end up in the wrong place in the JDK image.
-# This needs fixing.
-NOT_JRE_LIB_FILES := $(filter-out $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(SALIB_NAME), $(NOT_JRE_LIB_FILES))
-
-# Additional exclusions for profile JREs
-ifeq ($(PROFILE), profile_1)
- NOT_JRE_LIB_FILES += \
- $(PROFILE_2_JRE_LIB_FILES) \
- $(PROFILE_3_JRE_LIB_FILES) \
- $(FULL_JRE_LIB_FILES)
-endif
-
-ifeq ($(PROFILE), profile_2)
- NOT_JRE_LIB_FILES += \
- $(PROFILE_3_JRE_LIB_FILES) \
- $(FULL_JRE_LIB_FILES)
-endif
-
-ifeq ($(PROFILE), profile_3)
- NOT_JRE_LIB_FILES += \
- $(FULL_JRE_LIB_FILES)
-endif
-
-# Exclude the custom jar files as these will be added back via a special rule
-NOT_JRE_LIB_FILES += $(CUSTOM_JARS)
-
-###############################################################################
-# Customization of rt.jar file contents
-# These are expressed as exclusions from everything found in the
-# JDK_OUTPUTDIR/classes directory
-###############################################################################
-
-# The main set of excluded types/packages (ie everything not destined to be
-# part of rt.jar or resources.jar is captured in the CreateJars.gmk RT_JAR_EXCLUDES
-# variable. We add to that for the per-profile exclusion lists
-
-# For each profile we have four variables:
-#
-# - PROFILE_n_RTJAR_INCLUDE_PACKAGES
-#
-# This is a package prefix indicating that all classes in that package
-# and conditionally its subpackages are included in rt.jar for this profile.
-# The subpackages will be included as long as they do not appear in the
-# include list of a higher profile
-#
-# - PROFILE_n_RTJAR_INCLUDE_TYPES
-#
-# These are specific types that must be included within a package.
-# There are two cases:
-# - individual types in a package that is otherwise excluded at this
-# profile level. The only arises if there are split packages.
-#
-# - A higher-level package is included in a high profile where a subpackage
-# is included in a lower profile. Including the package in the high profile
-# would exclude it and all subpackages from the lower profile, so instead
-# the classes in the package are listed for that higher profile (as *.class)
-#
-# These types are explicitly added back into the rt.jar content lists.
-#
-# - PROFILE_n_RTJAR_EXCLUDE_TYPES
-#
-# These are specific types that must be excluded even though most of the
-# containing package is include. Again this occurs with split packges.
-#
-# So the exclude list for each profile consists of the include lists
-# for all profiles above it, together with any explicitly excluded types.
-# This is then combined with the overall RT_JAR_EXCLUDES list (which covers
-# things that go into other jar files).
-#
-# We also have to define the types to be explicitly included. This
-# accumulates up the profiles ie profile 3 has to include the types
-# that profiles 1 and 2 had to include. This is unnecessary if, for example,
-# profile 3 includes the entire package, but it is harmless to add them
-# explicitly, and complex to determine if we still need to include them.
-#
-# Need a way to express:
-# for (int i = profile+1; i < 4; i++)
-# RT_JAR_EXCLUDES += PROFILE_$i_RTJAR_INCLUDE_PACKAGES
-#
-# Do it the long way for now
-#
-# - PROFILE_n_INCLUDE_METAINF_SERVICES
-#
-# These are META-INF/services/ entries found in resources.jar. Together
-# resources.jar and rt.jar hold the contents of the classes directory, (the
-# classes in rt.jar and everything else in resources.jar).Hence the
-# include/exclude information for resources.jar is tied to that of rt.jar
-
-include profile-rtjar-includes.txt
-
-# Function to expand foo/*.class into the set of classes
-# NOTE: Files found by wildcard are stipped of extra $, so call DoubleDollar
-# to keep the file names compatible with make.
-# But note that if you echo these values they will NOT display as expected.
-class_list = $(foreach dir, $(JDK_OUT_CLASSES), $(patsubst $(dir)/%,%, \
- $(foreach i, $(1), $(call DoubleDollar, $(wildcard $(dir)/$i)))))
-
-ifeq ($(PROFILE), profile_1)
- RT_JAR_EXCLUDES += \
- $(call class_list, $(PROFILE_1_RTJAR_EXCLUDE_TYPES)) \
- $(PROFILE_2_RTJAR_INCLUDE_PACKAGES) \
- $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
- $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
- $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
- $(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
- $(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
- RT_JAR_INCLUDE_TYPES := \
- $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES))
- PROFILE_INCLUDE_METAINF_SERVICES := \
- $(PROFILE_1_INCLUDE_METAINF_SERVICES)
-endif
-ifeq ($(PROFILE), profile_2)
- RT_JAR_EXCLUDES += \
- $(call class_list, $(PROFILE_2_RTJAR_EXCLUDE_TYPES)) \
- $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
- $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
- $(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
- $(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
- RT_JAR_INCLUDE_TYPES := \
- $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
- $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES))
- PROFILE_INCLUDE_METAINF_SERVICES := \
- $(PROFILE_1_INCLUDE_METAINF_SERVICES) \
- $(PROFILE_2_INCLUDE_METAINF_SERVICES)
-endif
-ifeq ($(PROFILE), profile_3)
- RT_JAR_EXCLUDES += \
- $(call class_list, $(PROFILE_3_RTJAR_EXCLUDE_TYPES)) \
- $(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
- $(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
- RT_JAR_INCLUDE_TYPES := \
- $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
- $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
- $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES))
- PROFILE_INCLUDE_METAINF_SERVICES := \
- $(PROFILE_1_INCLUDE_METAINF_SERVICES) \
- $(PROFILE_2_INCLUDE_METAINF_SERVICES) \
- $(PROFILE_3_INCLUDE_METAINF_SERVICES)
-endif
-
-# Filter out non-OpenJDK services
-ifdef OPENJDK
- EXCLUDED_SERVICES := META-INF/services/javax.script.ScriptEngineFactory
- PROFILE_INCLUDE_METAINF_SERVICES := $(filter-out $(EXCLUDED_SERVICES), $(PROFILE_INCLUDE_METAINF_SERVICES))
-endif
-
-
-endif # profile
--- a/jdk/make/Tools.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/Tools.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -38,104 +38,124 @@
ifeq (, $(BUILD_TOOLS_JDK))
$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
SETUP := GENERATE_OLDBYTECODE, \
+ ADD_JAVAC_FLAGS := "-Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes", \
SRC := $(JDK_TOPDIR)/make/src/classes, \
- BIN := $(JDK_OUTPUTDIR)/btclasses))
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
+ COPY := boot.modules ext.modules))
endif
-$(JDK_OUTPUTDIR)/btclasses/build/tools/generatenimbus/resources/%.template: \
+$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/generatenimbus/resources/%.template: \
$(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/%.template
$(call install-file)
-BUILD_TOOLS_JDK += $(foreach i, $(wildcard $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/*.template), $(JDK_OUTPUTDIR)/btclasses/build/tools/generatenimbus/resources/$(notdir $i))
+BUILD_TOOLS_JDK += $(foreach i, $(wildcard $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/*.template), $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/generatenimbus/resources/$(notdir $i))
# Resource used by CheckDeps tool
-$(JDK_OUTPUTDIR)/btclasses/build/tools/deps/refs.allowed: \
+$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/deps/refs.allowed: \
$(JDK_TOPDIR)/make/data/checkdeps/refs.allowed
$(call install-file)
-BUILD_TOOLS_JDK += $(JDK_OUTPUTDIR)/btclasses/build/tools/deps/refs.allowed
+BUILD_TOOLS_JDK += $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/deps/refs.allowed
# Add a checksum ("jsum") to the end of a text file. Prevents trivial tampering with class lists.
-TOOL_ADDJSUM = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_ADDJSUM = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.addjsum.AddJsum
# The buildmetaindex tool creates a meta-index to make core class loaders lazier.
-TOOL_BUILDMETAINDEX = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_BUILDMETAINDEX = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.buildmetaindex.BuildMetaIndex
-TOOL_COMPILEFONTCONFIG = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_COMPILEFONTCONFIG = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.compilefontconfig.CompileFontConfig
-TOOL_COMPILEPROPERTIES = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_COMPILEPROPERTIES = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.compileproperties.CompileProperties
-TOOL_JARREORDER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_JARREORDER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.jarreorder.JarReorder
-TOOL_GENERATECHARACTER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATECHARACTER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.generatecharacter.GenerateCharacter
-TOOL_CHARACTERNAME = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CHARACTERNAME = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.generatecharacter.CharacterName
TOOL_DTDBUILDER = $(JAVA_SMALL) -Ddtd_home=$(JDK_TOPDIR)/make/data/dtdbuilder \
-Djava.awt.headless=true \
- -cp $(JDK_OUTPUTDIR)/btclasses build.tools.dtdbuilder.DTDBuilder
+ -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.dtdbuilder.DTDBuilder
TOOL_GENERATEBREAKITERATORDATA = $(JAVA_SMALL) \
- -cp $(JDK_OUTPUTDIR)/btclasses \
+ -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.generatebreakiteratordata.GenerateBreakIteratorData
-TOOL_GENERATECURRENCYDATA = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATECURRENCYDATA = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.generatecurrencydata.GenerateCurrencyData
-TOOL_HASHER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_HASHER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.hasher.Hasher
-TOOL_TZDB = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_TZDB = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.tzdb.TzdbZoneRulesCompiler
-TOOL_BLACKLISTED_CERTS = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_BLACKLISTED_CERTS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.blacklistedcertsconverter.BlacklistedCertsConverter
-TOOL_MAKEJAVASECURITY = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_MAKEJAVASECURITY = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.makejavasecurity.MakeJavaSecurity
# TODO: There are references to the jdwpgen.jar in jdk/make/netbeans/jdwpgen/build.xml
# and nbproject/project.properties in the same dir. Needs to be looked at.
-TOOL_JDWPGEN = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.jdwpgen.Main
+TOOL_JDWPGEN = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.jdwpgen.Main
# TODO: Lots of files in jdk/make/tools/CharsetMapping dir
-TOOL_CHARSETMAPPING = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CHARSETMAPPING = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.charsetmapping.Main $(LOG_INFO)
-TOOL_SPP = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.spp.Spp
+TOOL_SPP = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.spp.Spp
# Nimbus is used somewhere in the swing build.
-TOOL_GENERATENIMBUS = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATENIMBUS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.generatenimbus.Generator
-TOOL_WRAPPERGENERATOR = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_WRAPPERGENERATOR = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.x11wrappergen.WrapperGenerator
-TOOL_AWT_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_AWT_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.icondata.awt.ToBin
-TOOL_OSX_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_OSX_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.icondata.osxapp.ToBin
-TOOL_CLDRCONVERTER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CLDRCONVERTER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.cldrconverter.CLDRConverter
TOOL_CHECKDEPS = $(JAVA_SMALL) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
- -cp "$(JDK_OUTPUTDIR)/btclasses$(PATH_SEP)$(JDK_OUTPUTDIR)" \
+ -cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes$(PATH_SEP)$(JDK_OUTPUTDIR)" \
build.tools.deps.CheckDeps
TOOL_GENMODULESXML = $(JAVA_SMALL) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
- -cp "$(JDK_OUTPUTDIR)/btclasses$(PATH_SEP)$(JDK_OUTPUTDIR)" \
+ -cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes$(PATH_SEP)$(JDK_OUTPUTDIR)" \
build.tools.module.GenJdepsModulesXml
+TOOL_IMAGEBUILDER = $(JAVA_SMALL) -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
+ -cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes$(PATH_SEP)$(JDK_OUTPUTDIR)" \
+ build.tools.module.ImageBuilder
+
+##########################################################################################
+
+JIMAGE_PKGS := \
+ jdk/internal/jimage \
+ jdk/internal/jrtfs \
+ #
+
+$(eval $(call SetupJavaCompilation,BUILD_INTERIM_JIMAGE, \
+ SETUP := GENERATE_OLDBYTECODE, \
+ SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
+ INCLUDES := $(JIMAGE_PKGS), \
+ EXCLUDES := jdk/internal/jimage/concurrent, \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes))
+
##########################################################################################
# Tools needed on solaris because OBJCOPY is broken.
@@ -147,8 +167,8 @@
CC := $(BUILD_CC), \
LDEXE := $(BUILD_LD), \
LDFLAGS := -lelf, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/add_gnu_debuglink, \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/btbin, \
+ OBJECT_DIR := $(BUILDTOOLS_OUTPUTDIR)/objs/add_gnu_debuglink, \
+ OUTPUT_DIR := $(BUILDTOOLS_OUTPUTDIR)/bin, \
PROGRAM := add_gnu_debuglink))
$(eval $(call SetupNativeCompilation,FIX_EMPTY_SEC_HDR_FLAGS, \
@@ -157,11 +177,13 @@
CC := $(BUILD_CC), \
LDEXE := $(BUILD_LD), \
LDFLAGS := -lelf, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/fix_empty_sec_hdr_flags, \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/btbin, \
+ OBJECT_DIR := $(BUILDTOOLS_OUTPUTDIR)/objs/fix_empty_sec_hdr_flags, \
+ OUTPUT_DIR := $(BUILDTOOLS_OUTPUTDIR)/bin, \
PROGRAM := fix_empty_sec_hdr_flags))
endif
+$(BUILD_TOOLS_JDK): $(BUILD_INTERIM_JIMAGE)
+
java-tools: $(BUILD_TOOLS_JDK)
all: java-tools
--- a/jdk/make/UnpackSecurity.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/UnpackSecurity.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, 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
@@ -37,33 +37,44 @@
define unzip-sec-file
$(ECHO) Unzipping $(<F)
- $(MKDIR) -p $(@D)
+ $(MKDIR) -p $(@D) $(JDK_OUTPUTDIR)
$(RM) $@
($(CD) $(JDK_OUTPUTDIR) && $(UNZIP) -q -o $< > $@.tmp)
$(MV) $@.tmp $@
endef
-$(JDK_OUTPUTDIR)/classes/_the.sec-bin.unzipped: $(SEC_FILES_ZIP)
- $(call unzip-sec-file)
+define unzip-native-sec-file
+ $(ECHO) Unzipping $(<F)
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ ($(CD) $(SUPPORT_OUTPUTDIR) && $(UNZIP) -q -o $< > $@.tmp)
+ $(MV) $@.tmp $@
+endef
-$(JDK_OUTPUTDIR)/classes/_the.sec-windows-bin.unzipped: $(SEC_FILES_WIN_ZIP)
- $(call unzip-sec-file)
-
-$(JDK_OUTPUTDIR)/classes/_the.jgss-windows-i586-bin.unzipped: $(JGSS_WIN32_FILES_ZIP)
+$(SUPPORT_OUTPUTDIR)/_the.sec-bin.unzipped: $(SEC_FILES_ZIP)
$(call unzip-sec-file)
-$(JDK_OUTPUTDIR)/classes/_the.jgss-windows-x64-bin.unzipped: $(JGSS_WIN64_FILES_ZIP)
+# Trying to unzip both of the sec files at the same time may cause a race
+# when creating directories common to both files.
+$(SUPPORT_OUTPUTDIR)/_the.sec-windows-bin.unzipped: $(SEC_FILES_WIN_ZIP) \
+ | $(SUPPORT_OUTPUTDIR)/_the.sec-bin.unzipped
$(call unzip-sec-file)
+$(SUPPORT_OUTPUTDIR)/_the.jgss-windows-i586-bin.unzipped: $(JGSS_WIN32_FILES_ZIP)
+ $(call unzip-native-sec-file)
+
+$(SUPPORT_OUTPUTDIR)/_the.jgss-windows-x64-bin.unzipped: $(JGSS_WIN64_FILES_ZIP)
+ $(call unzip-native-sec-file)
+
ifneq ($(wildcard $(SEC_FILES_ZIP)), )
- IMPORT_TARGET_FILES += $(JDK_OUTPUTDIR)/classes/_the.sec-bin.unzipped
+ IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.sec-bin.unzipped
ifeq ($(OPENJDK_TARGET_OS), windows)
- IMPORT_TARGET_FILES += $(JDK_OUTPUTDIR)/classes/_the.sec-windows-bin.unzipped
+ IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.sec-windows-bin.unzipped
ifeq ($(OPENJDK_TARGET_CPU), x86)
- IMPORT_TARGET_FILES += $(JDK_OUTPUTDIR)/classes/_the.jgss-windows-i586-bin.unzipped
+ IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.jgss-windows-i586-bin.unzipped
endif
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
- IMPORT_TARGET_FILES += $(JDK_OUTPUTDIR)/classes/_the.jgss-windows-x64-bin.unzipped
+ IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.jgss-windows-x64-bin.unzipped
endif
endif
endif
--- a/jdk/make/copy/Copy-java.base.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/copy/Copy-java.base.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -31,7 +31,7 @@
#
# Copy exported header files to outputdir.
#
-JAVA_BASE_HEADERS := \
+TARGETS += \
$(INCLUDE_DST_DIR)/jni.h \
$(INCLUDE_DST_DIR)/jvmti.h \
$(INCLUDE_DST_DIR)/jvmticmlr.h \
@@ -55,7 +55,7 @@
$(LIB_DST_DIR)/tzmappings: $(TZMAPPINGS_SRC)/tzmappings
$(call install-file)
- BASE_CONF_FILES += $(LIB_DST_DIR)/tzmappings
+ TARGETS += $(LIB_DST_DIR)/tzmappings
endif
@@ -63,11 +63,13 @@
# Copy msvcrXX.dll on windows
ifeq ($(OPENJDK_TARGET_OS), windows)
- MSVCR_TARGET := $(JDK_OUTPUTDIR)/bin/$(notdir $(MSVCR_DLL))
+ MSVCR_TARGET := $(LIB_DST_DIR)/$(notdir $(MSVCR_DLL))
# Chmod to avoid permission issues if bundles are unpacked on unix platforms.
$(MSVCR_TARGET): $(MSVCR_DLL)
$(call install-file)
$(CHMOD) a+rx $@
+
+ TARGETS += $(MSVCR_TARGET)
endif
################################################################################
@@ -85,7 +87,7 @@
else
JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/conf/$(JVMCFG_ARCH)/jvm.cfg
endif
-JVMCFG_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
+JVMCFG_DIR := $(LIB_DST_DIR)$(OPENJDK_TARGET_CPU_LIBDIR)
JVMCFG := $(JVMCFG_DIR)/jvm.cfg
# To do: should this also support -zeroshark?
@@ -143,12 +145,12 @@
endif
endif
-BASE_CONF_FILES += $(JVMCFG)
+TARGETS += $(JVMCFG)
################################################################################
POLICY_SRC := $(JDK_TOPDIR)/src/java.base/share/conf/security/java.policy
-POLICY_DST := $(JDK_OUTPUTDIR)/lib/security/java.policy
+POLICY_DST := $(CONF_DST_DIR)/security/java.policy
POLICY_SRC_LIST :=
@@ -167,40 +169,34 @@
$(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
$(MV) $@.tmp $@
-BASE_CONF_FILES += $(POLICY_DST)
+TARGETS += $(POLICY_DST)
################################################################################
ifeq ($(CACERTS_FILE), )
CACERTS_FILE := $(JDK_TOPDIR)/src/java.base/share/conf/security/cacerts
endif
-CACERTS_DST := $(JDK_OUTPUTDIR)/lib/security/cacerts
+CACERTS_DST := $(LIB_DST_DIR)/security/cacerts
$(CACERTS_DST): $(CACERTS_FILE)
$(call install-file)
-BASE_CONF_FILES += $(CACERTS_DST)
+TARGETS += $(CACERTS_DST)
################################################################################
-$(JDK_OUTPUTDIR)/lib/net.properties: $(JDK_TOPDIR)/src/java.base/share/conf/net.properties
+$(CONF_DST_DIR)/net.properties: $(JDK_TOPDIR)/src/java.base/share/conf/net.properties
$(ECHO) $(LOG_INFO) Copying $(@F)
$(call install-file)
-NET_CONF_FILES += $(JDK_OUTPUTDIR)/lib/net.properties
+TARGETS += $(CONF_DST_DIR)/net.properties
ifeq ($(OPENJDK_TARGET_OS), solaris)
- $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/${OPENJDK_TARGET_OS_API_DIR}/conf/sdp/sdp.conf.template
+ $(CONF_DST_DIR)/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/${OPENJDK_TARGET_OS_API_DIR}/conf/sdp/sdp.conf.template
$(ECHO) $(LOG_INFO) Copying $(@F)
$(call install-file)
- NET_CONF_FILES += $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template
+ TARGETS += $(CONF_DST_DIR)/sdp/sdp.conf.template
endif
################################################################################
-
-java.base: $(BASE_CONF_FILES) $(NET_CONF_FILES) $(JAVA_BASE_HEADERS) $(MSVCR_TARGET)
-
-all: java.base
-
-.PHONY: all java.base
--- a/jdk/make/copy/Copy-java.desktop.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/copy/Copy-java.desktop.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -29,7 +29,7 @@
################################################################################
-JAVA_DESKTOP_HEADERS := \
+TARGETS += \
$(INCLUDE_DST_DIR)/jawt.h \
$(INCLUDE_DST_OS_DIR)/jawt_md.h \
#
@@ -62,9 +62,9 @@
#TODO: rework this to avoid hardcoding library name in the makefile
#
ifeq ($(OPENJDK_TARGET_OS), windows)
- FREETYPE_TARGET_LIB := $(JDK_OUTPUTDIR)/bin/$(call SHARED_LIBRARY,freetype)
+ FREETYPE_TARGET_LIB := $(LIB_DST_DIR)/$(call SHARED_LIBRARY,freetype)
else
- FREETYPE_TARGET_LIB := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/$(call SHARED_LIBRARY,freetype).6
+ FREETYPE_TARGET_LIB := $(LIB_DST_DIR)$(OPENJDK_TARGET_CPU_LIBDIR)/$(call SHARED_LIBRARY,freetype).6
endif
# We can't use $(install-file) in this rule because it preserves symbolic links and
@@ -75,14 +75,16 @@
ifeq ($(OPENJDK_BUILD_OS), windows)
$(CHMOD) +rx $@
endif
+
+ TARGETS += $(FREETYPE_TARGET_LIB)
endif
################################################################################
-$(JDK_OUTPUTDIR)/lib/sound.properties: $(JDK_TOPDIR)/src/java.desktop/share/conf/sound.properties
+$(CONF_DST_DIR)/sound.properties: $(JDK_TOPDIR)/src/java.desktop/share/conf/sound.properties
$(call install-file)
-DESKTOP_CONF_FILES += $(JDK_OUTPUTDIR)/lib/sound.properties
+TARGETS += $(CONF_DST_DIR)/sound.properties
################################################################################
#
@@ -95,7 +97,7 @@
$(LIB_DST_DIR)/%: $(PSFONTPROPFILE_SRC_DIR)/%
$(call install-file)
-DESKTOP_CONF_FILES += $(PSFONTPROPFILE_TARGET_FILES)
+TARGETS += $(PSFONTPROPFILE_TARGET_FILES)
################################################################################
#
@@ -113,7 +115,7 @@
$(CURSORS_DEST_DIR)/cursors.properties: $(CURSORS_OPENJDK_TARGET_OS_LIB_SRC)/cursors.properties
$(call install-file)
-DESKTOP_CONF_FILES += $(CURSORS_DEST_DIR)/cursors.properties
+TARGETS += $(CURSORS_DEST_DIR)/cursors.properties
CURSORS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/share/conf/images/cursors
ifeq ($(OPENJDK_TARGET_OS), windows)
@@ -126,12 +128,6 @@
$(CURSORS_DEST_DIR)/%: $(CURSORS_LIB_SRC)/%
$(call install-file)
-DESKTOP_CONF_FILES += $(CURSORS_TARGET_FILES)
+TARGETS += $(CURSORS_TARGET_FILES)
################################################################################
-
-java.desktop: $(DESKTOP_CONF_FILES) $(FREETYPE_TARGET_LIB) $(JAVA_DESKTOP_HEADERS)
-
-all: java.desktop
-
-.PHONY: all java.desktop
--- a/jdk/make/copy/Copy-java.logging.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/copy/Copy-java.logging.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -29,15 +29,9 @@
LOGGING_LIB_SRC := $(JDK_TOPDIR)/src/java.logging/share/conf
-$(LIB_DST_DIR)/logging.properties: $(LOGGING_LIB_SRC)/logging.properties
+$(CONF_DST_DIR)/logging.properties: $(LOGGING_LIB_SRC)/logging.properties
$(call install-file)
-LOGGING_CONF_FILES := $(LIB_DST_DIR)/logging.properties
+TARGETS := $(CONF_DST_DIR)/logging.properties
################################################################################
-
-java.logging: $(LOGGING_CONF_FILES)
-
-all: java.logging
-
-.PHONY: all java.logging
--- a/jdk/make/copy/Copy-java.management.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/copy/Copy-java.management.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -27,30 +27,24 @@
################################################################################
-MGMT_LIBDIR := $(LIB_DST_DIR)/management
-MGMT_LIB_SRC := $(JDK_TOPDIR)/src/java.management/share/conf
-MGMT_SRC_FILES := $(wildcard $(MGMT_LIB_SRC)/*)
-MGMT_TARGET_FILES := $(subst $(MGMT_LIB_SRC),$(MGMT_LIBDIR),$(MGMT_SRC_FILES))
+MGMT_CONF_DIR := $(CONF_DST_DIR)/management
+MGMT_CONF_SRC := $(JDK_TOPDIR)/src/java.management/share/conf
+MGMT_SRC_FILES := $(wildcard $(MGMT_CONF_SRC)/*)
+MGMT_TARGET_FILES := $(subst $(MGMT_CONF_SRC),$(MGMT_CONF_DIR),$(MGMT_SRC_FILES))
-$(MGMT_LIBDIR)/management.properties: $(MGMT_LIB_SRC)/management.properties
+$(MGMT_CONF_DIR)/management.properties: $(MGMT_CONF_SRC)/management.properties
$(call install-file)
$(CHMOD) 644 $@
# this file has different permissions...don't know why...
-$(MGMT_LIBDIR)/jmxremote.access: $(MGMT_LIB_SRC)/jmxremote.access
+$(MGMT_CONF_DIR)/jmxremote.access: $(MGMT_CONF_SRC)/jmxremote.access
$(call install-file)
$(CHMOD) 644 $@
-$(MGMT_LIBDIR)/%: $(MGMT_LIB_SRC)/%
+$(MGMT_CONF_DIR)/%: $(MGMT_CONF_SRC)/%
$(call install-file)
$(CHMOD) 444 $@
-MANAGEMENT_CONF_FILES := $(MGMT_TARGET_FILES)
+TARGETS := $(MGMT_TARGET_FILES)
################################################################################
-
-java.management: $(MANAGEMENT_CONF_FILES)
-
-all: java.management
-
-.PHONY: all java.management
--- a/jdk/make/copy/Copy-jdk.crypto.pkcs11.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/copy/Copy-jdk.crypto.pkcs11.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -31,20 +31,15 @@
SUNPKCS11_CFG_SRC := \
$(JDK_TOPDIR)/src/jdk.crypto.pkcs11/solaris/conf/security/sunpkcs11-solaris.cfg
- SUNPKCS11_CFG_DST := $(JDK_OUTPUTDIR)/lib/security/sunpkcs11-solaris.cfg
+ SUNPKCS11_CFG_DST := $(CONF_DST_DIR)/security/sunpkcs11-solaris.cfg
$(SUNPKCS11_CFG_DST): $(SUNPKCS11_CFG_SRC)
$(call install-file)
SECURITY_PKCS11_CONF_FILES += $(SUNPKCS11_CFG_DST)
+ TARGETS := $(SUNPKCS11_CFG_DST)
+
endif
################################################################################
-
-jdk.crypto.pkcs11: $(SECURITY_PKCS11_CONF_FILES)
-
-all: jdk.crypto.pkcs11
-
-.PHONY: all jdk.crypto.pkcs11
-
--- a/jdk/make/copy/Copy-jdk.crypto.ucrypto.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/copy/Copy-jdk.crypto.ucrypto.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -30,20 +30,13 @@
ifeq ($(OPENJDK_TARGET_OS), solaris)
UCRYPTO_CFG_SRC := $(JDK_TOPDIR)/src/jdk.crypto.ucrypto/solaris/conf/security/ucrypto-solaris.cfg
- UCRYPTO_CFG_DST := $(JDK_OUTPUTDIR)/lib/security/ucrypto-solaris.cfg
+ UCRYPTO_CFG_DST := $(CONF_DST_DIR)/security/ucrypto-solaris.cfg
$(UCRYPTO_CFG_DST): $(UCRYPTO_CFG_SRC)
$(call install-file)
- SECURITY_UCRYPTO_CONF_FILES += $(UCRYPTO_CFG_DST)
+ TARGETS += $(UCRYPTO_CFG_DST)
endif
################################################################################
-
-jdk.crypto.ucrypto: $(SECURITY_UCRYPTO_CONF_FILES)
-
-all: jdk.crypto.ucrypto
-
-.PHONY: all jdk.crypto.ucrypto
-
--- a/jdk/make/copy/Copy-jdk.hprof.agent.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/copy/Copy-jdk.hprof.agent.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -32,12 +32,6 @@
$(LIB_DST_DIR)/jvm.hprof.txt: $(HPROF_SRC)
$(call install-file)
-HPROF_CONF_FILES := $(LIB_DST_DIR)/jvm.hprof.txt
+TARGETS := $(LIB_DST_DIR)/jvm.hprof.txt
################################################################################
-
-jdk.hprof.agent: $(HPROF_CONF_FILES)
-
-all: jdk.hprof.agent
-
-.PHONY: all jdk.hprof.agent
--- a/jdk/make/copy/Copy-jdk.jdwp.agent.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/copy/Copy-jdk.jdwp.agent.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -27,16 +27,9 @@
################################################################################
-
-JDK_DEBUG_AGENT_HEADERS := $(INCLUDE_DST_DIR)/jdwpTransport.h
+TARGETS := $(INCLUDE_DST_DIR)/jdwpTransport.h
$(INCLUDE_DST_DIR)/%.h: $(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/include/%.h
$(call install-file)
################################################################################
-
-jdk.jdwp.agent: $(JDK_DEBUG_AGENT_HEADERS)
-
-all: jdk.jdwp.agent
-
-.PHONY: all jdk.jdwp.agent
--- a/jdk/make/copy/CopyCommon.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/copy/CopyCommon.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -23,13 +23,9 @@
# questions.
#
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
-INCLUDE_DST_DIR := $(JDK_OUTPUTDIR)/include
-LIB_DST_DIR := $(JDK_OUTPUTDIR)/lib
+INCLUDE_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)
+LIB_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)
+CONF_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE)
INCLUDE_DST_OS_DIR := $(INCLUDE_DST_DIR)/$(OPENJDK_TARGET_OS)
--- a/jdk/make/gendata/Gendata-java.base.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gendata/Gendata-java.base.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -29,15 +29,14 @@
$(eval $(call IncludeCustomExtension, jdk, gendata/Gendata-java.base.gmk))
include GendataBreakIterator.gmk
-GENDATA += $(BREAK_ITERATOR)
include GendataTZDB.gmk
-GENDATA += $(GENDATA_TZDB)
include GendataBlacklistedCerts.gmk
-GENDATA += $(GENDATA_BLACKLISTED_CERTS)
-##########################################################################################
+include GendataPolicyJars.gmk
+
+################################################################################
GENDATA_UNINAME := $(JDK_OUTPUTDIR)/modules/java.base/java/lang/uniName.dat
@@ -45,9 +44,9 @@
$(MKDIR) -p $(@D)
$(TOOL_CHARACTERNAME) $< $@
-GENDATA += $(GENDATA_UNINAME)
+TARGETS += $(GENDATA_UNINAME)
-##########################################################################################
+################################################################################
GENDATA_CURDATA := $(JDK_OUTPUTDIR)/modules/java.base/java/util/currency.data
@@ -58,12 +57,12 @@
$(MV) $@.tmp $@
$(CHMOD) 444 $@
-GENDATA += $(GENDATA_CURDATA)
+TARGETS += $(GENDATA_CURDATA)
-##########################################################################################
+################################################################################
GENDATA_JAVA_SECURITY_SRC := $(JDK_TOPDIR)/src/java.base/share/conf/security/java.security
-GENDATA_JAVA_SECURITY := $(JDK_OUTPUTDIR)/lib/security/java.security
+GENDATA_JAVA_SECURITY := $(SUPPORT_OUTPUTDIR)/modules_conf/java.base/security/java.security
# RESTRICTED_PKGS_SRC is optionally set in custom extension for this makefile
@@ -73,14 +72,17 @@
$(TOOL_MAKEJAVASECURITY) $(GENDATA_JAVA_SECURITY_SRC) $@ $(OPENJDK_TARGET_OS) \
$(RESTRICTED_PKGS_SRC) || exit 1
-GENDATA += $(GENDATA_JAVA_SECURITY)
+TARGETS += $(GENDATA_JAVA_SECURITY)
-##########################################################################################
-
-$(GENDATA): $(BUILD_TOOLS_JDK)
+################################################################################
-java.base: $(GENDATA)
+$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist: \
+ $(JDK_TOPDIR)/make/data/classlist/classlist.$(OPENJDK_TARGET_OS)
+ $(MKDIR) -p $(@D)
+ $(RM) $@ $@.tmp
+ $(TOOL_ADDJSUM) $< $@.tmp
+ $(MV) $@.tmp $@
-all: java.base
+TARGETS += $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist
-.PHONY: all java.base
+################################################################################
--- a/jdk/make/gendata/Gendata-java.desktop.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gendata/Gendata-java.desktop.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -26,15 +26,5 @@
include GendataCommon.gmk
include GendataFontConfig.gmk
-GENDATA += $(GENDATA_FONT_CONFIG)
include GendataHtml32dtd.gmk
-GENDATA += $(GENDATA_HTML32DTD)
-
-$(GENDATA): $(BUILD_TOOLS_JDK)
-
-java.desktop: $(GENDATA)
-
-all: $(GENDATA)
-
-.PHONY: all java.desktop
--- a/jdk/make/gendata/Gendata-jdk.dev.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gendata/Gendata-jdk.dev.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -27,20 +27,16 @@
$(eval $(call IncludeCustomExtension, jdk, gendata/Gendata-jdk.dev.gmk))
-GENDATA := $(JDK_OUTPUTDIR)/modules/jdk.dev/com/sun/tools/jdeps/resources/jdeps-modules.xml
-METADATA_FILES += $(TOPDIR)/modules.xml
+JDEPS_MODULES_XML := $(JDK_OUTPUTDIR)/modules/jdk.dev/com/sun/tools/jdeps/resources/jdeps-modules.xml
+MODULES_XML += $(TOPDIR)/modules.xml
#
# Generate modules.xml for jdeps to use
# It augments $(TOPDIR)/modules.xml to include module membership
#
-$(GENDATA): $(BUILD_TOOLS_JDK) $(METADATA_FILES)
+$(JDEPS_MODULES_XML): $(BUILD_TOOLS_JDK) $(MODULES_XML)
$(MKDIR) -p $(@D)
$(RM) $@
- $(TOOL_GENMODULESXML) -o $@ -mp $(JDK_OUTPUTDIR)/modules $(METADATA_FILES)
-
-jdk.dev: $(GENDATA)
+ $(TOOL_GENMODULESXML) -o $@ -mp $(JDK_OUTPUTDIR)/modules $(MODULES_XML)
-all: $(GENDATA)
-
-.PHONY: all jdk.dev
+TARGETS += $(JDEPS_MODULES_XML)
--- a/jdk/make/gendata/GendataBlacklistedCerts.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gendata/GendataBlacklistedCerts.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -24,7 +24,7 @@
#
GENDATA_BLACKLISTED_CERTS_SRC := $(JDK_TOPDIR)/make/data/blacklistedcertsconverter/blacklisted.certs.pem
-GENDATA_BLACKLISTED_CERTS := $(JDK_OUTPUTDIR)/lib/security/blacklisted.certs
+GENDATA_BLACKLISTED_CERTS := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/security/blacklisted.certs
ifndef OPENJDK
GENDATA_BLACKLISTED_CERTS_SRC += $(wildcard $(JDK_TOPDIR)/make/closed/data/blacklistedcertsconverter/blacklisted.certs.pem)
@@ -34,3 +34,5 @@
$(ECHO) "Generating blacklisted certs"
$(MKDIR) -p $(@D)
($(CAT) $(GENDATA_BLACKLISTED_CERTS_SRC) | $(TOOL_BLACKLISTED_CERTS) > $@) || exit 1
+
+TARGETS += $(GENDATA_BLACKLISTED_CERTS)
--- a/jdk/make/gendata/GendataBreakIterator.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gendata/GendataBreakIterator.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -33,17 +33,16 @@
# They are used at JDK build phase in order to create $(BIFILES) which
# are used on runtime instead.
#
-TEXT_SRCDIR = $(JDK_TOPDIR)/src/java.base/share/classes \
+TEXT_SRCDIR := $(JDK_TOPDIR)/src/java.base/share/classes \
$(JDK_TOPDIR)/src/jdk.localedata/share/classes
-TEXT_PKG = sun/text/resources
-TEXT_SOURCES = $(TEXT_PKG)/BreakIteratorRules.java \
+TEXT_PKG := sun/text/resources
+TEXT_SOURCES := $(TEXT_PKG)/BreakIteratorRules.java \
$(TEXT_PKG)/BreakIteratorInfo.java \
$(TEXT_PKG)/th/BreakIteratorRules_th.java \
$(TEXT_PKG)/th/BreakIteratorInfo_th.java
# Generate BreakIteratorData
-BREAK_ITERATOR_DIR = $(JDK_OUTPUTDIR)/break_iterator
-BREAK_ITERATOR_CLASSES = $(BREAK_ITERATOR_DIR)/classes
+BREAK_ITERATOR_CLASSES := $(BUILDTOOLS_OUTPUTDIR)/break_iterator_classes
# JAVAC_SOURCE_PATH_OVERRIDE is set to isolate the compile to just those
# two files in that directory and not get anything implicit from
@@ -62,16 +61,16 @@
# Generate data resource files.
# input
-UNICODEDATA = $(JDK_TOPDIR)/make/data/unicodedata/UnicodeData.txt
+UNICODEDATA := $(JDK_TOPDIR)/make/data/unicodedata/UnicodeData.txt
# output
-BASE_DATA_PKG_DIR = $(JDK_OUTPUTDIR)/modules/java.base/sun/text/resources
-SL_DATA_PKG_DIR = $(JDK_OUTPUTDIR)/modules/jdk.localedata/sun/text/resources
-BIFILES = $(BASE_DATA_PKG_DIR)/CharacterBreakIteratorData \
+BASE_DATA_PKG_DIR := $(JDK_OUTPUTDIR)/modules/java.base/sun/text/resources
+SL_DATA_PKG_DIR := $(JDK_OUTPUTDIR)/modules/jdk.localedata/sun/text/resources
+BIFILES := $(BASE_DATA_PKG_DIR)/CharacterBreakIteratorData \
$(BASE_DATA_PKG_DIR)/WordBreakIteratorData \
$(BASE_DATA_PKG_DIR)/LineBreakIteratorData \
$(BASE_DATA_PKG_DIR)/SentenceBreakIteratorData
-BIFILES_TH = $(SA_DATA_PKG_DIR)/th/WordBreakIteratorData_th \
+BIFILES_TH := $(SA_DATA_PKG_DIR)/th/WordBreakIteratorData_th \
$(SA_DATA_PKG_DIR)/th/LineBreakIteratorData_th
$(BIFILES): $(BASE_DATA_PKG_DIR)/_the.bifiles
@@ -97,5 +96,4 @@
-language th
$(TOUCH) $@
-
-BREAK_ITERATOR += $(BIFILES) $(BIFILES_TH)
+TARGETS += $(BIFILES) $(BIFILES_TH)
--- a/jdk/make/gendata/GendataCommon.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gendata/GendataCommon.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -23,10 +23,6 @@
# questions.
#
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
include JavaCompilation.gmk
include SetupJavaCompilers.gmk
# We need the tools.
--- a/jdk/make/gendata/GendataFontConfig.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gendata/GendataFontConfig.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -23,7 +23,7 @@
# questions.
#
-GENDATA_FONT_CONFIG_DST := $(JDK_OUTPUTDIR)/lib
+GENDATA_FONT_CONFIG_DST := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)
GENDATA_FONT_CONFIG_DATA_DIR := $(JDK_TOPDIR)/make/data/fontconfig
ifndef OPENJDK
@@ -42,7 +42,7 @@
$(GENDATA_FONT_CONFIG_DST)/%.bfc: \
$(GENDATA_FONT_CONFIG_DATA_DIR)/$(OPENJDK_TARGET_OS).%.properties \
- $(BUILD_TOOLS)
+ $(BUILD_TOOLS_JDK)
$(MKDIR) -p $(@D)
$(RM) $@
$(TOOL_COMPILEFONTCONFIG) $< $@
@@ -54,5 +54,5 @@
GENDATA_BFONT_CONFIGS := $(patsubst $(GENDATA_FONT_CONFIG_DATA_DIR)/$(OPENJDK_TARGET_OS).%.properties, \
$(GENDATA_FONT_CONFIG_DST)/%.bfc, $(GENDATA_FONT_CONFIG_SRC_FILES))
-GENDATA_FONT_CONFIG := $(GENDATA_FONT_CONFIGS) $(GENDATA_BFONT_CONFIGS)
+TARGETS := $(GENDATA_FONT_CONFIGS) $(GENDATA_BFONT_CONFIGS)
--- a/jdk/make/gendata/GendataHtml32dtd.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gendata/GendataHtml32dtd.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -26,10 +26,10 @@
GENDATA_HTML32DTD :=
HTML32DTD = $(JDK_OUTPUTDIR)/modules/java.desktop/javax/swing/text/html/parser/html32.bdtd
-$(HTML32DTD): $(BUILD_TOOLS)
+$(HTML32DTD): $(BUILD_TOOLS_JDK)
$(ECHO) "Generating HTML DTD file"
$(MKDIR) -p $(@D)
$(RM) $@
($(TOOL_DTDBUILDER) $(LOG_INFO) html32 > $@) || exit 1
-GENDATA_HTML32DTD += $(HTML32DTD)
+TARGETS += $(HTML32DTD)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/gendata/GendataPolicyJars.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,197 @@
+#
+# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+
+
+################################################################################
+
+US_EXPORT_POLICY_JAR_DST := \
+ $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/security/US_export_policy.jar
+
+ifneq ($(BUILD_CRYPTO), no)
+
+ US_EXPORT_POLICY_JAR_LIMITED := \
+ $(SUPPORT_OUTPUTDIR)/jce/policy/limited/US_export_policy.jar
+ US_EXPORT_POLICY_JAR_UNLIMITED := \
+ $(SUPPORT_OUTPUTDIR)/jce/policy/unlimited/US_export_policy.jar
+
+ ifndef OPENJDK
+ #
+ # In past releases, Oracle JDK has had a separately downloadable set of
+ # policy files which has been a nightmare for deployment.
+ #
+ # Now if we're closed and limited (default for Oracle JDK), create
+ # an "unlimited_policy" directory that contains the unlimited policy
+ # files. It will be up to the user/deployer to make an informed choice
+ # as to whether they are legally entitled to use the unlimited policy
+ # file in their environment. Users/deployers simply need to overwrite
+ # the files. Consult README.txt (below) for more info.
+ #
+ UNLIMITED_POLICY_DIR := \
+ $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/security/unlimited_policy
+ endif
+
+ #
+ # TODO fix so that SetupArchive does not write files into SRCS
+ # then we don't need this extra copying
+ #
+ # NOTE: We currently do not place restrictions on our limited export
+ # policy. This was not a typo. This means we are shipping the same file
+ # for both limited and unlimited US_export_policy.jar. Only the local
+ # policy file currently has restrictions.
+ #
+ US_EXPORT_POLICY_JAR_SRC_DIR := \
+ $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited
+ US_EXPORT_POLICY_JAR_TMP := \
+ $(SUPPORT_OUTPUTDIR)/jce/policy/unlimited/US_export_policy_jar.tmp
+
+ $(US_EXPORT_POLICY_JAR_TMP)/%: $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
+ $(install-file)
+
+ US_EXPORT_POLICY_JAR_DEPS := \
+ $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
+
+ $(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR, \
+ $(US_EXPORT_POLICY_JAR_DEPS), \
+ SRCS := $(US_EXPORT_POLICY_JAR_TMP), \
+ SUFFIXES := .policy, \
+ JAR := $(US_EXPORT_POLICY_JAR_UNLIMITED), \
+ EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
+ SKIP_METAINF := true))
+
+ $(US_EXPORT_POLICY_JAR_LIMITED): \
+ $(US_EXPORT_POLICY_JAR_UNLIMITED)
+ $(ECHO) $(LOG_INFO) \
+ Copying unlimited $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(install-file)
+
+ TARGETS += $(US_EXPORT_POLICY_JAR_LIMITED) $(US_EXPORT_POLICY_JAR_UNLIMITED)
+endif
+
+ifeq ($(UNLIMITED_CRYPTO), true)
+ $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNLIMITED)
+ $(install-file)
+else
+ $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_LIMITED)
+ $(install-file)
+endif
+
+ifndef OPENJDK
+ ifneq ($(UNLIMITED_CRYPTO), true)
+ $(UNLIMITED_POLICY_DIR)/US_export_policy.jar: \
+ $(US_EXPORT_POLICY_JAR_UNLIMITED)
+ $(install-file)
+ TARGETS += $(UNLIMITED_POLICY_DIR)/US_export_policy.jar
+ endif
+endif
+
+POLICY_JARS += $(US_EXPORT_POLICY_JAR_DST)
+
+################################################################################
+
+LOCAL_POLICY_JAR_DST := \
+ $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/security/local_policy.jar
+
+ifneq ($(BUILD_CRYPTO), no)
+
+ LOCAL_POLICY_JAR_LIMITED := \
+ $(SUPPORT_OUTPUTDIR)/jce/policy/limited/local_policy.jar
+ LOCAL_POLICY_JAR_UNLIMITED := \
+ $(SUPPORT_OUTPUTDIR)/jce/policy/unlimited/local_policy.jar
+
+ #
+ # TODO fix so that SetupArchive does not write files into SRCS
+ # then we don't need this extra copying
+ #
+ LOCAL_POLICY_JAR_LIMITED_TMP := \
+ $(SUPPORT_OUTPUTDIR)/jce/policy/limited/local_policy_jar.tmp
+ LOCAL_POLICY_JAR_UNLIMITED_TMP := \
+ $(SUPPORT_OUTPUTDIR)/jce/policy/unlimited/local_policy_jar.tmp
+
+ $(LOCAL_POLICY_JAR_LIMITED_TMP)/%: \
+ $(JDK_TOPDIR)/make/data/cryptopolicy/limited/%
+ $(install-file)
+
+ $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/%: \
+ $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited/%
+ $(install-file)
+
+ $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_LIMITED, \
+ $(LOCAL_POLICY_JAR_LIMITED_TMP)/exempt_local.policy \
+ $(LOCAL_POLICY_JAR_LIMITED_TMP)/default_local.policy, \
+ SRCS := $(LOCAL_POLICY_JAR_LIMITED_TMP), \
+ SUFFIXES := .policy, \
+ JAR := $(LOCAL_POLICY_JAR_LIMITED), \
+ EXTRA_MANIFEST_ATTR := Crypto-Strength: limited, \
+ SKIP_METAINF := true))
+
+ $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_UNLIMITED, \
+ $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/default_local.policy, \
+ SRCS := $(LOCAL_POLICY_JAR_UNLIMITED_TMP), \
+ SUFFIXES := .policy, \
+ JAR := $(LOCAL_POLICY_JAR_UNLIMITED), \
+ EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
+ SKIP_METAINF := true))
+
+ TARGETS += $(LOCAL_POLICY_JAR_LIMITED) $(LOCAL_POLICY_JAR_UNLIMITED)
+
+ ifndef OPENJDK
+ ifneq ($(UNLIMITED_CRYPTO), true)
+ $(UNLIMITED_POLICY_DIR)/README.txt: \
+ $(JDK_TOPDIR)/make/closed/data/cryptopolicy/README.txt
+ $(install-file)
+
+ TARGETS += $(UNLIMITED_POLICY_DIR)/README.txt
+ endif
+ endif
+endif
+
+ifeq ($(UNLIMITED_CRYPTO), true)
+ $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNLIMITED)
+ $(install-file)
+else
+ $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_LIMITED)
+ $(install-file)
+endif
+
+ifndef OPENJDK
+ ifneq ($(UNLIMITED_CRYPTO), true)
+ $(UNLIMITED_POLICY_DIR)/local_policy.jar: \
+ $(LOCAL_POLICY_JAR_UNLIMITED)
+ $(install-file)
+ TARGETS += $(UNLIMITED_POLICY_DIR)/local_policy.jar
+ endif
+endif
+
+POLICY_JARS += $(LOCAL_POLICY_JAR_DST)
+TARGETS += $(POLICY_JARS)
+
+################################################################################
+
--- a/jdk/make/gendata/GendataTZDB.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gendata/GendataTZDB.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, 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
@@ -32,11 +32,11 @@
TZDATA_TZFILE := africa antarctica asia australasia europe northamerica pacificnew southamerica backward etcetera gmt jdk11_backward
TZDATA_TZFILES := $(addprefix $(TZDATA_DIR)/,$(TZDATA_TZFILE))
-GENDATA_TZDB_DAT := $(JDK_OUTPUTDIR)/lib/tzdb.dat
+GENDATA_TZDB_DAT := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/tzdb.dat
$(GENDATA_TZDB_DAT): $(TZDATA_TZFILES)
$(RM) $(GENDATA_TZDB_DAT)
$(MKDIR) -p $(@D)
$(TOOL_TZDB) -srcdir $(TZDATA_DIR) -dstfile $(GENDATA_TZDB_DAT) $(TZDATA_TZFILE)
-GENDATA_TZDB += $(GENDATA_TZDB_DAT)
+TARGETS += $(GENDATA_TZDB_DAT)
--- a/jdk/make/gensrc/Gensrc-jdk.charsets.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/Gensrc-jdk.charsets.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -30,7 +30,7 @@
# Generate files using the charsetmapping tool
#
CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping
-CHARSET_GENSRC_JAVA_DIR_CS := $(JDK_OUTPUTDIR)/gensrc/jdk.charsets/sun/nio/cs/ext
+CHARSET_GENSRC_JAVA_DIR_CS := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.charsets/sun/nio/cs/ext
CHARSET_DONE_CS := $(CHARSET_GENSRC_JAVA_DIR_CS)/_the.charsetmapping
CHARSET_COPYRIGHT_HEADER := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping
CHARSET_TEMPLATES := \
--- a/jdk/make/gensrc/Gensrc-jdk.dev.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/Gensrc-jdk.dev.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -31,7 +31,9 @@
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
$(filter %.properties, \
- $(call CacheFind, $(JDK_TOPDIR)/src/jdk.dev/share/classes/sun/tools/jar/resources)), \
+ $(call CacheFind, \
+ $(JDK_TOPDIR)/src/jdk.dev/share/classes/jdk/tools/jimage/resources \
+ $(JDK_TOPDIR)/src/jdk.dev/share/classes/sun/tools/jar/resources)), \
ListResourceBundle))
TARGETS += $(COMPILE_PROPERTIES)
--- a/jdk/make/gensrc/Gensrc-jdk.jconsole.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/Gensrc-jdk.jconsole.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -28,7 +28,7 @@
##########################################################################################
# Version file for jconsole
-$(JDK_OUTPUTDIR)/gensrc/jdk.jconsole/sun/tools/jconsole/Version.java: \
+$(SUPPORT_OUTPUTDIR)/gensrc/jdk.jconsole/sun/tools/jconsole/Version.java: \
$(JDK_TOPDIR)/src/jdk.jconsole/share/classes/sun/tools/jconsole/Version.java.template
$(MKDIR) -p $(@D)
$(RM) $@ $@.tmp
@@ -36,7 +36,7 @@
$(SED) -e 's/@@jconsole_version@@/$(FULL_VERSION)/g' $< > $@.tmp
$(MV) $@.tmp $@
-GENSRC_JDK_JCONSOLE += $(JDK_OUTPUTDIR)/gensrc/jdk.jconsole/sun/tools/jconsole/Version.java
+GENSRC_JDK_JCONSOLE += $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jconsole/sun/tools/jconsole/Version.java
jdk.jconsole: $(GENSRC_JDK_JCONSOLE)
--- a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -30,27 +30,34 @@
# and a JDWPCommands.h C-header file.
JDWP_SPEC_FILE := $(JDK_TOPDIR)/make/data/jdwp/jdwp.spec
-
-$(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h: $(JDWP_SPEC_FILE)
+HEADER_FILE := $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
+JAVA_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java
-$(JDK_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java: \
- $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK)
+# Both the header and java file are created using the same recipe. By declaring
+# this rule and adding header file to dependencies for java file, both are
+# rebuilt if either is missing
+$(HEADER_FILE): $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK)
+
+# Touch the target of this rule at the end to avoid triggering false rebuilds
+$(JAVA_FILE): $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK) $(HEADER_FILE)
$(MKDIR) -p $(@D)
- $(MKDIR) -p $(JDK_OUTPUTDIR)/gensrc_jdwp_headers
- $(RM) $@ $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h
+ $(MKDIR) -p $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent
+ $(RM) $@ $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
$(ECHO) $(LOG_INFO) Creating JDWP.java and JDWPCommands.h from jdwp.spec
- $(TOOL_JDWPGEN) $< -jdi $@ -include $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h
+ $(TOOL_JDWPGEN) $< -jdi $@ -include \
+ $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
+ $(TOUCH) $@
-$(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html: $(JDWP_SPEC_FILE) \
+$(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html: $(JDWP_SPEC_FILE) \
$(BUILD_TOOLS_JDK)
$(MKDIR) -p $(@D)
$(RM) $@
$(ECHO) $(LOG_INFO) Creating $(@F) from jdwp.spec
$(TOOL_JDWPGEN) $< -doc $@
-GENSRC_JDWP := $(JDK_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java \
- $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h \
- $(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html
+GENSRC_JDWP := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java \
+ $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h \
+ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
GENSRC_JDK_JDI += $(GENSRC_JDWP)
################################################################################
@@ -61,11 +68,18 @@
endef
# Filter com.sun.jdi.connect.Connector
-$(JDK_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \
- $(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector
+$(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \
+ $(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector \
+ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
$(process-provider)
-GENSRC_JDK_JDI += $(JDK_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector
+# Copy the same service file into jdk.hotspot.agent so that they are kept the same.
+$(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector: \
+ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector
+ $(install-file)
+
+GENSRC_JDK_JDI += $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector \
+ $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector
################################################################################
--- a/jdk/make/gensrc/GensrcBuffer.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/GensrcBuffer.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -25,8 +25,7 @@
GENSRC_BUFFER :=
-GENSRC_BUFFER_TMP := $(JDK_OUTPUTDIR)/gensrc
-GENSRC_BUFFER_DST := $(JDK_OUTPUTDIR)/gensrc/java.base/java/nio
+GENSRC_BUFFER_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio
GENSRC_BUFFER_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/java/nio
--- a/jdk/make/gensrc/GensrcCLDR.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/GensrcCLDR.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, 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
@@ -26,7 +26,7 @@
CLDRVERSION := 21.0.1
CLDRSRCDIR := $(JDK_TOPDIR)/src/jdk.localedata/share/classes/sun/util/cldr/resources/$(subst .,_,$(CLDRVERSION))
-GENSRC_DIR := $(JDK_OUTPUTDIR)/gensrc/jdk.localedata
+GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata
CLDR_METAINFO_FILE := $(GENSRC_DIR)/sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo.java
--- a/jdk/make/gensrc/GensrcCharacterData.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/GensrcCharacterData.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -24,7 +24,7 @@
#
#
-# Rules to create $(JDK_OUTPUTDIR)/gensrc/sun/lang/CharacterData*.java
+# Rules to create $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/lang/CharacterData*.java
#
GENSRC_CHARACTERDATA :=
@@ -33,7 +33,8 @@
UNICODEDATA = $(JDK_TOPDIR)/make/data/unicodedata
define SetupCharacterData
- $(JDK_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java: $(CHARACTERDATA)/$1.java.template $(BUILD_TOOLS_JDK)
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java: \
+ $(CHARACTERDATA)/$1.java.template
$(MKDIR) -p $$(@D)
$(ECHO) $(LOG_INFO) Generating $1.java
$(TOOL_GENERATECHARACTER) $2 \
@@ -41,10 +42,10 @@
-spec $(UNICODEDATA)/UnicodeData.txt \
-specialcasing $(UNICODEDATA)/SpecialCasing.txt \
-proplist $(UNICODEDATA)/PropList.txt \
- -o $(JDK_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java -string \
+ -o $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java -string \
-usecharforbyte $3
- GENSRC_CHARACTERDATA += $(JDK_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java
+ GENSRC_CHARACTERDATA += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java
endef
$(eval $(call SetupCharacterData,CharacterDataLatin1, , -latin1 8))
@@ -54,12 +55,12 @@
$(eval $(call SetupCharacterData,CharacterData0E, -plane 14, 11 4 1))
# Copy two Java files that need no preprocessing.
-$(JDK_OUTPUTDIR)/gensrc/java.base/java/lang/%.java: $(CHARACTERDATA)/%.java.template
+$(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/%.java: $(CHARACTERDATA)/%.java.template
$(ECHO) $(LOG_INFO) Generating $(@F)
$(call install-file)
-GENSRC_CHARACTERDATA += $(JDK_OUTPUTDIR)/gensrc/java.base/java/lang/CharacterDataUndefined.java \
- $(JDK_OUTPUTDIR)/gensrc/java.base/java/lang/CharacterDataPrivateUse.java
+GENSRC_CHARACTERDATA += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/CharacterDataUndefined.java \
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/CharacterDataPrivateUse.java
GENSRC_JAVA_BASE += $(GENSRC_CHARACTERDATA)
$(GENSRC_CHARACTERDATA): $(BUILD_TOOLS_JDK)
--- a/jdk/make/gensrc/GensrcCharsetCoder.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/GensrcCharsetCoder.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -25,14 +25,13 @@
GENSRC_CHARSETCODER :=
-GENSRC_CHARSETCODER_TMP := $(JDK_OUTPUTDIR)/gensrc
-GENSRC_CHARSETCODER_DST := $(JDK_OUTPUTDIR)/gensrc/java.base/java/nio/charset
+GENSRC_CHARSETCODER_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio/charset
GENSRC_CHARSETCODER_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/java/nio
GENSRC_CHARSETCODER_TEMPLATE := $(GENSRC_CHARSETCODER_SRC)/charset/Charset-X-Coder.java.template
-###
+################################################################################
$(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
$(MKDIR) -p $(@D)
@@ -67,7 +66,7 @@
GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java
-###
+################################################################################
$(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
$(MKDIR) -p $(@D)
@@ -103,6 +102,6 @@
GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java
GENSRC_JAVA_BASE += $(GENSRC_CHARSETCODER)
-###
+################################################################################
$(GENSRC_CHARSETCODER): $(BUILD_TOOLS_JDK)
--- a/jdk/make/gensrc/GensrcCharsetMapping.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/GensrcCharsetMapping.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -28,7 +28,7 @@
# Generate files using the charsetmapping tool
#
CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping
-CHARSET_GENSRC_JAVA_DIR_BASE := $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/cs
+CHARSET_GENSRC_JAVA_DIR_BASE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/cs
CHARSET_DONE_BASE := $(CHARSET_GENSRC_JAVA_DIR_BASE)/_the.charsetmapping
CHARSET_TEMPLATES := \
$(CHARSET_DATA_DIR)/SingleByte-X.java.template \
@@ -46,7 +46,7 @@
#
# Generate the sun/nio/cs/StandardCharsets.java file
#
-CHARSET_STANDARD_GENSRC_DIR := $(JDK_OUTPUTDIR)/gensrc/standardcharsets
+CHARSET_STANDARD_GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_standardcharsets
CHARSET_STANDARD_DATA := $(CHARSET_DATA_DIR)/standard-charsets
CHARSET_STANDARD_JAVA := sun/nio/cs/StandardCharsets.java
@@ -118,7 +118,7 @@
$(eval $(call SetupTextFileProcessing, BUILD_CHARSET_STANDARD, \
SOURCE_FILES := $(JDK_TOPDIR)/src/java.base/share/classes/$(CHARSET_STANDARD_JAVA).template, \
- OUTPUT_FILE := $(JDK_OUTPUTDIR)/gensrc/java.base/$(CHARSET_STANDARD_JAVA), \
+ OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/$(CHARSET_STANDARD_JAVA), \
INCLUDES := \
_INCLUDE_ALIASES_TABLES_ => $(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet ; \
_INCLUDE_ALIASES_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet ; \
--- a/jdk/make/gensrc/GensrcExceptions.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/GensrcExceptions.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -25,8 +25,7 @@
GENSRC_EXCEPTIONS :=
-GENSRC_EXCEPTIONS_TMP := $(JDK_OUTPUTDIR)/gensrc
-GENSRC_EXCEPTIONS_DST := $(JDK_OUTPUTDIR)/gensrc/java.base/java/nio
+GENSRC_EXCEPTIONS_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio
GENSRC_EXCEPTIONS_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/java/nio
GENSRC_EXCEPTIONS_CMD := $(JDK_TOPDIR)/make/scripts/genExceptions.sh
--- a/jdk/make/gensrc/GensrcIcons.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/GensrcIcons.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -25,8 +25,8 @@
GENSRC_AWT_ICONS :=
GENSRC_AWT_ICONS_SRC :=
-GENSRC_AWT_ICONS_TMP := $(JDK_OUTPUTDIR)/gensrc
-GENSRC_AWT_ICONS_DST := $(GENSRC_AWT_ICONS_TMP)/java.desktop/sun/awt/
+GENSRC_AWT_ICONS_TMP := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop
+GENSRC_AWT_ICONS_DST := $(GENSRC_AWT_ICONS_TMP)/sun/awt/
ifdef OPENJDK
X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)
@@ -62,14 +62,14 @@
GENSRC_AWT_ICONS_SHORT_NAME = $(subst .,_,$(subst -,_,$(1)))
GENSRC_AWT_ICONS_DST_NAME = AWTIcon$(2)_$(subst .,_,$(subst -,_,$(1)))
-###
+################################################################################
$(GENSRC_AWT_ICONS_TMP)/_the.icons.dir:
$(ECHO) Generating icon classes
$(MKDIR) -p $(GENSRC_AWT_ICONS_DST)
$(TOUCH) $@
-###
+################################################################################
define SetupGensrcAWTIcon
# param 1 is for src-file
@@ -107,11 +107,11 @@
GENSRC_JAVA_DESKTOP += $(GENSRC_AWT_ICONS)
-###
+################################################################################
ifeq ($(OPENJDK_TARGET_OS), macosx)
- GENSRC_OSX_ICONS_DST := $(JDK_OUTPUTDIR)/gensrc_headers_icons
+ GENSRC_OSX_ICONS_DST := $(SUPPORT_OUTPUTDIR)/headers/java.desktop
GENSRC_OSX_ICONS := $(GENSRC_OSX_ICONS_DST)/AWTIconData.h
ifdef OPENJDK
--- a/jdk/make/gensrc/GensrcLocaleData.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/GensrcLocaleData.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -42,14 +42,14 @@
LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES)))))
# Include the list of resources found during the previous compile.
--include $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources
+-include $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_the.locale_resources
MISSING_RESOURCES := $(filter-out $(LOCALE_RESOURCES), $(PREV_LOCALE_RESOURCES))
NEW_RESOURCES := $(filter-out $(PREV_LOCALE_RESOURCES), $(LOCALE_RESOURCES))
ifneq (, $(MISSING_RESOURCES)$(NEW_RESOURCES))
# There is a difference in the number of supported resources. Trigger a regeneration.
- $(shell $(RM) $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java)
+ $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/LocaleDataMetaInfo.java)
endif
# The EN locales
@@ -116,26 +116,28 @@
SED_ENARGS += -e 's/$(HASH)AvailableLocales_Locales$(HASH)/$(sort $(ALL_EN_LOCALES))/g'
SED_NONENARGS += -e 's/$(HASH)AvailableLocales_Locales$(HASH)/$(sort $(ALL_NON_EN_LOCALES))/g'
-$(JDK_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/EnLocaleDataMetaInfo.java: \
+$(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/EnLocaleDataMetaInfo.java: \
$(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
$(MKDIR) -p $(@D)
$(ECHO) Creating sun/util/locale/provider/EnLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
- $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" > $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources
+ $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \
+ > $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources
$(SED) $(SED_ENARGS) $< > $@
-$(JDK_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonEnLocaleDataMetaInfo.java: \
+$(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonEnLocaleDataMetaInfo.java: \
$(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
$(MKDIR) -p $(@D)
$(ECHO) Creating sun/util/resources/provider/NonEnLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
- $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" > $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources
+ $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \
+ > $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/_the.locale_resources
$(SED) $(SED_NONENARGS) $< > $@
-GENSRC_BASELOCALEDATA := $(JDK_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/EnLocaleDataMetaInfo.java
-GENSRC_LOCALEDATA := $(JDK_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonEnLocaleDataMetaInfo.java
+GENSRC_BASELOCALEDATA := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/EnLocaleDataMetaInfo.java
+GENSRC_LOCALEDATA := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonEnLocaleDataMetaInfo.java
################################################################################
-GENSRC_CRBC_DST := $(JDK_OUTPUTDIR)/gensrc/java.base/sun/util/CoreResourceBundleControl.java
+GENSRC_CRBC_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/CoreResourceBundleControl.java
GENSRC_CRBC_CMD := $(JDK_TOPDIR)/make/scripts/localelist.sh
JRE_NONEXIST_LOCALES := en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh
--- a/jdk/make/gensrc/GensrcMisc.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/GensrcMisc.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -23,37 +23,32 @@
# questions.
#
-include ProfileNames.gmk
-
##########################################################################################
# Install the launcher name, release version string, full version
# string and the runtime name into the Version.java file.
# To be printed by java -version
-$(JDK_OUTPUTDIR)/gensrc/java.base/sun/misc/Version.java \
-$(PROFILE_VERSION_JAVA_TARGETS): \
+$(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/misc/Version.java: \
$(JDK_TOPDIR)/src/java.base/share/classes/sun/misc/Version.java.template
$(MKDIR) -p $(@D)
$(RM) $@ $@.tmp
- $(ECHO) Generating sun/misc/Version.java $(call profile_version_name, $@)
+ $(ECHO) Generating sun/misc/Version.java
$(SED) -e 's/@@launcher_name@@/$(LAUNCHER_NAME)/g' \
-e 's/@@java_version@@/$(RELEASE)/g' \
-e 's/@@java_runtime_version@@/$(FULL_VERSION)/g' \
-e 's/@@java_runtime_name@@/$(RUNTIME_NAME)/g' \
- -e 's/@@java_profile_name@@/$(call profile_version_name, $@)/g' \
$< > $@.tmp
$(MV) $@.tmp $@
-GENSRC_JAVA_BASE += $(JDK_OUTPUTDIR)/gensrc/java.base/sun/misc/Version.java \
- $(PROFILE_VERSION_JAVA_TARGETS)
+GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/misc/Version.java
##########################################################################################
-GENSRC_JAVA_BASE += $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java
+GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java
GENSRC_SOR_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/ch
GENSRC_SOR_SRC_FILE := genSocketOptionRegistry.c
-GENSRC_SOR_BIN := $(JDK_OUTPUTDIR)/btnative/genSocketOptionRegistry
+GENSRC_SOR_BIN := $(BUILDTOOLS_OUTPUTDIR)/native/genSocketOptionRegistry
SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOR_SRC)/$(GENSRC_SOR_SRC_FILE) | \
$(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
@@ -71,14 +66,15 @@
SOR_PREGEN_FILE := $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java.template
ifeq ($(wildcard $(SOR_PREGEN_FILE)), )
- $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java: $(BUILD_GENSRC_SOR_EXE)
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java: $(BUILD_GENSRC_SOR_EXE)
$(MKDIR) -p $(@D)
$(RM) $@ $@.tmp
- NAWK="$(NAWK)" SH="$(SH)" $(SH) -e $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(SOR_COPYRIGHT_YEARS)" > $@.tmp
+ NAWK="$(NAWK)" SH="$(SH)" $(SH) -e \
+ $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(SOR_COPYRIGHT_YEARS)" > $@.tmp
$(BUILD_GENSRC_SOR_EXE) >> $@.tmp
$(MV) $@.tmp $@
else
- $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java: $(SOR_PREGEN_FILE)
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java: $(SOR_PREGEN_FILE)
$(call install-file)
endif
@@ -86,11 +82,11 @@
ifneq ($(OPENJDK_TARGET_OS), windows)
- GENSRC_JAVA_BASE += $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java
+ GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java
GENSRC_UC_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/fs
GENSRC_UC_SRC_FILE := genUnixConstants.c
- GENSRC_UC_BIN := $(JDK_OUTPUTDIR)/btnative/genUnixConstants
+ GENSRC_UC_BIN := $(BUILDTOOLS_OUTPUTDIR)/native/genUnixConstants
UC_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_UC_SRC)/$(GENSRC_UC_SRC_FILE) | \
$(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
@@ -109,14 +105,15 @@
UC_PREGEN_FILE := $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java.template
ifeq ($(wildcard $(UC_PREGEN_FILE)), )
- $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java: $(BUILD_GENSRC_UC_EXE)
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java: $(BUILD_GENSRC_UC_EXE)
$(MKDIR) -p $(@D)
$(RM) $@ $@.tmp
- NAWK="$(NAWK)" SH="$(SH)" $(SH) -e $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(UC_COPYRIGHT_YEARS)" > $@.tmp
+ NAWK="$(NAWK)" SH="$(SH)" $(SH) -e \
+ $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(UC_COPYRIGHT_YEARS)" > $@.tmp
$(BUILD_GENSRC_UC_EXE) >> $@.tmp
$(MV) $@.tmp $@
else
- $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java: $(UC_PREGEN_FILE)
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java: $(UC_PREGEN_FILE)
$(call install-file)
endif
@@ -126,11 +123,11 @@
ifeq ($(OPENJDK_TARGET_OS), solaris)
- GENSRC_JAVA_BASE += $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java
+ GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java
GENSRC_SOL_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/fs
GENSRC_SOL_SRC_FILE := genSolarisConstants.c
- GENSRC_SOL_BIN := $(JDK_OUTPUTDIR)/btnative/genSolarisConstants
+ GENSRC_SOL_BIN := $(BUILDTOOLS_OUTPUTDIR)/native/genSolarisConstants
SOL_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOL_SRC)/$(GENSRC_SOL_SRC_FILE) | \
$(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
@@ -145,10 +142,11 @@
OUTPUT_DIR := $(GENSRC_SOL_BIN), \
PROGRAM := genSolarisConstants))
- $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java: $(BUILD_GENSRC_SOL_EXE)
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java: $(BUILD_GENSRC_SOL_EXE)
$(MKDIR) -p $(@D)
$(RM) $@ $@.tmp
- NAWK="$(NAWK)" SH="$(SH)" $(SH) -e $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(SOL_COPYRIGHT_YEARS)" > $@.tmp
+ NAWK="$(NAWK)" SH="$(SH)" $(SH) -e \
+ $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(SOL_COPYRIGHT_YEARS)" > $@.tmp
$(BUILD_GENSRC_SOL_EXE) >> $@.tmp
$(MV) $@.tmp $@
--- a/jdk/make/gensrc/GensrcProperties.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/GensrcProperties.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -30,7 +30,7 @@
# Helper macro for SetupCopy-zh_HK.
define SetupOneCopy-zh_HK
$1_$2_TARGET := $$(patsubst $(JDK_TOPDIR)/src/$(MODULE)/share/classes/%, \
- $(JDK_OUTPUTDIR)/gensrc/$(MODULE)/%, \
+ $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/%, \
$$(subst _zh_TW,_zh_HK, $2))
$$($1_$2_TARGET): $2
@@ -62,7 +62,7 @@
# Strip away prefix and suffix, leaving for example only:
# "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
$1_JAVAS := $$(patsubst $(JDK_TOPDIR)/src/%, \
- $(JDK_OUTPUTDIR)/gensrc/%, \
+ $(SUPPORT_OUTPUTDIR)/gensrc/%, \
$$(patsubst %.properties, %.java, \
$$(subst /share/classes,, $$($1_SRCS))))
@@ -78,10 +78,10 @@
$$(addsuffix _SPACE_$$($1_CLASS), \
$$(addprefix _SPACE_, $$($1_JAVAS)))))
- $1_TARGET := $(JDK_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.done
- $1_CMDLINE_FILE := $(JDK_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline
+ $1_TARGET := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.done
+ $1_CMDLINE_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline
- # Now setup the rule for the generation of the resource bundles.
+# Now setup the rule for the generation of the resource bundles.
$$($1_TARGET): $$($1_SRCS) $$($1_JAVAS) $(BUILD_TOOLS_JDK)
$(MKDIR) -p $$(@D) $$($1_DIRS)
$(ECHO) Compiling $$(words $$($1_SRCS)) properties into resource bundles for $(MODULE)
--- a/jdk/make/gensrc/GensrcSwing.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/GensrcSwing.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -27,25 +27,26 @@
# Generate java files for javax.swing.plaf package
#
NIMBUS_PACKAGE = javax.swing.plaf
-NIMBUS_GENSRC_DIR = $(JDK_OUTPUTDIR)/gensrc/java.desktop/javax/swing/plaf/nimbus
+NIMBUS_GENSRC_DIR = $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/javax/swing/plaf/nimbus
NIMBUS_SKIN_FILE = $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/skin.laf
-$(JDK_OUTPUTDIR)/gensrc/_the.generated_nimbus: $(NIMBUS_SKIN_FILE) $(BUILD_TOOLS_JDK)
+$(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus: $(NIMBUS_SKIN_FILE) $(BUILD_TOOLS_JDK)
$(MKDIR) -p $(@D)
$(ECHO) "Generating Nimbus source files"
$(TOOL_GENERATENIMBUS) $(LOG_INFO) \
- -skinFile $(NIMBUS_SKIN_FILE) -buildDir $(JDK_OUTPUTDIR)/gensrc/java.desktop \
+ -skinFile $(NIMBUS_SKIN_FILE) -buildDir $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop \
-packagePrefix $(NIMBUS_PACKAGE).nimbus -lafName Nimbus
$(ECHO) $(LOG_INFO) "Finished generating Nimbus source files"
$(TOUCH) $@
-GENSRC_SWING_NIMBUS := $(JDK_OUTPUTDIR)/gensrc/_the.generated_nimbus
+GENSRC_SWING_NIMBUS := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus
#
# Generate beaninfo java files
#
-DOCLET_DATA_DIR = $(JDK_TOPDIR)/make/data/swingbeaninfo
+BEANINFO_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/java.desktop
+DOCLET_DATA_DIR := $(JDK_TOPDIR)/make/data/swingbeaninfo
# javax.swing package
BEANS = AbstractButton Box JComponent JApplet JButton \
@@ -67,41 +68,44 @@
# Dummy variable so far, in the old build system it was false by default
SWINGBEAN_DEBUG_FLAG = false
-# GenDocletBeanInfo is compiled in Tools.gmk and picks up from $(JDK_OUTPUTDIR)/btclasses
+# GenDocletBeanInfo is compiled in Tools.gmk and picks up from $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes
# LocaleDataMetaInfo needs to be generated before running this to avoid confusing errors
# in the build log.
-$(JDK_OUTPUTDIR)/gensrc_no_srczip/_the.generated_beaninfo: $(BEANS_SRC) \
- $(JDK_OUTPUTDIR)/gensrc_no_srczip/java.desktop/javax/swing/SwingBeanInfoBase.java \
- $(JDK_OUTPUTDIR)/gensrc/java.desktop/sun/swing/BeanInfoUtils.java $(BUILD_TOOLS_JDK) \
- | $(GENSRC_LOCALEDATAMETAINFO)
+$(BEANINFO_OUTPUTDIR)/_the.generated_beaninfo: $(BEANS_SRC) \
+ $(BEANINFO_OUTPUTDIR)/javax/swing/SwingBeanInfoBase.java \
+ $(BEANINFO_OUTPUTDIR)/sun/swing/BeanInfoUtils.java $(BUILD_TOOLS_JDK)
$(ECHO) Generating beaninfo
- $(MKDIR) -p $(JDK_OUTPUTDIR)/gensrc_no_srczip/java.desktop/javax/swing
+ $(MKDIR) -p $(BEANINFO_OUTPUTDIR)/javax/swing
$(JAVA) -Djava.awt.headless=true $(NEW_JAVADOC) \
-sourcepath "$(subst $(SPACE),$(PATH_SEP),\
$(wildcard $(JDK_TOPDIR)/src/*/*/classes) \
- $(JDK_OUTPUTDIR)/gensrc/java.base)" \
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.base)" \
-doclet build.tools.swingbeaninfo.GenDocletBeanInfo \
- -x $(SWINGBEAN_DEBUG_FLAG) -d $(JDK_OUTPUTDIR)/gensrc_no_srczip/java.desktop/javax/swing \
- -t $(DOCLET_DATA_DIR)/SwingBeanInfo.template -docletpath $(JDK_OUTPUTDIR)/btclasses \
+ -x $(SWINGBEAN_DEBUG_FLAG) -d $(BEANINFO_OUTPUTDIR)/javax/swing \
+ -t $(DOCLET_DATA_DIR)/SwingBeanInfo.template \
+ -docletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
-XDignore.symbol.file=true \
- -classpath $(JDK_OUTPUTDIR)/btclasses $(BEANS_SRC) $(LOG_INFO)
+ -classpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes $(BEANS_SRC) $(LOG_INFO)
# Move the JTextComponent into its proper package directory.
- $(MKDIR) -p $(JDK_OUTPUTDIR)/gensrc_no_srczip/java.desktop/javax/swing/text
- $(MV) $(JDK_OUTPUTDIR)/gensrc_no_srczip/java.desktop/javax/swing/JTextComponentBeanInfo.java $(JDK_OUTPUTDIR)/gensrc_no_srczip/java.desktop/javax/swing/text/JTextComponentBeanInfo.java
+ $(MKDIR) -p $(BEANINFO_OUTPUTDIR)/javax/swing/text
+ $(MV) $(BEANINFO_OUTPUTDIR)/javax/swing/JTextComponentBeanInfo.java \
+ $(BEANINFO_OUTPUTDIR)/javax/swing/text/JTextComponentBeanInfo.java
$(TOUCH) $@
# This file is the part of dt.jar
# For some reason it is under $(JDK_TOPDIR)/make/data/swingbeaninfo
# Should it be moved under $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing instead?
-$(JDK_OUTPUTDIR)/gensrc_no_srczip/java.desktop/javax/swing/SwingBeanInfoBase.java: $(DOCLET_DATA_DIR)/javax/swing/SwingBeanInfoBase.java
+$(BEANINFO_OUTPUTDIR)/javax/swing/SwingBeanInfoBase.java: \
+ $(DOCLET_DATA_DIR)/javax/swing/SwingBeanInfoBase.java
$(call install-file)
# This file is the part of dt.jar
# For some reason it is under $(JDK_TOPDIR)/make/data/swingbeaninfo
# Should it be moved under $(JDK_TOPDIR)/src/java.desktop/share/classes/sun/swing instead?
-$(JDK_OUTPUTDIR)/gensrc/java.desktop/sun/swing/BeanInfoUtils.java: $(DOCLET_DATA_DIR)/sun/swing/BeanInfoUtils.java
+$(BEANINFO_OUTPUTDIR)/sun/swing/BeanInfoUtils.java: \
+ $(DOCLET_DATA_DIR)/sun/swing/BeanInfoUtils.java
$(call install-file)
-GENSRC_SWING_BEANINFO = $(JDK_OUTPUTDIR)/gensrc_no_srczip/_the.generated_beaninfo
+GENSRC_SWING_BEANINFO = $(BEANINFO_OUTPUTDIR)/_the.generated_beaninfo
GENSRC_JAVA_DESKTOP += $(GENSRC_SWING_BEANINFO) $(GENSRC_SWING_NIMBUS)
--- a/jdk/make/gensrc/GensrcX11Wrappers.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/gensrc/GensrcX11Wrappers.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, 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
@@ -37,9 +37,9 @@
GENSRC_X11WRAPPERS :=
# Put temporary c-code and executable to calculate offsets here.
# Also put verification offset file here as well.
-GENSRC_X11WRAPPERS_TMP := $(JDK_OUTPUTDIR)/gensrc_x11wrappers
+GENSRC_X11WRAPPERS_TMP := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_x11wrappers
# Put the generated Java classes used to interface X11 from awt here.
-GENSRC_X11WRAPPERS_DST := $(JDK_OUTPUTDIR)/gensrc/java.desktop/sun/awt/X11
+GENSRC_X11WRAPPERS_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/sun/awt/X11
# The pre-calculated offset file are stored here:
GENSRC_SIZER_DIR := $(JDK_TOPDIR)/make/data/x11wrappergen
@@ -69,12 +69,12 @@
# Run the tool on the offset files copied from the source repository to generate several Java classes
# used in awt.
-$(JDK_OUTPUTDIR)/gensrc/_the.generated.x11: $(GENSRC_X11_SIZES_USED) $(BUILD_TOOLS_JDK)
+$(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated.x11: $(GENSRC_X11_SIZES_USED) $(BUILD_TOOLS_JDK)
$(MKDIR) -p $(GENSRC_X11WRAPPERS_DST)
$(TOOL_WRAPPERGENERATOR) $(GENSRC_X11WRAPPERS_DST) $(GENSRC_SIZER_DIR)/xlibtypes.txt "gen" $(GENSRC_X11WRAPPERS_TMP)/sizes
$(TOUCH) $@
-GENSRC_X11WRAPPERS += $(JDK_OUTPUTDIR)/gensrc/_the.generated.x11
+GENSRC_X11WRAPPERS += $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated.x11
ifneq ($(COMPILE_TYPE), cross)
# This is not a cross compile, regenerate the offset file, so that we
@@ -91,7 +91,7 @@
MEMORY_MODEL_FLAG="$(COMPILER_TARGET_BITS_FLAG)$*"
endif
- SIZER_CFLAGS := -I$(JDK_OUTPUTDIR)/include \
+ SIZER_CFLAGS := \
-I$(JDK_TOPDIR)/src/java.base/share/native/include \
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_EXPORT_DIR)/native/include \
-I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
--- a/jdk/make/launcher/Launcher-java.base.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-java.base.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -32,20 +32,20 @@
# overwritten.
$(eval $(call SetupLauncher,java, \
-DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib, \
- $(JDK_OUTPUTDIR)/objs/jli_static.lib, $(JAVA_RC_FLAGS), \
- $(JAVA_VERSION_INFO_RESOURCE), $(JDK_OUTPUTDIR)/objs/java_objs,true))
+ $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jli_static.lib, $(JAVA_RC_FLAGS), \
+ $(JAVA_VERSION_INFO_RESOURCE), $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs,true))
-$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
+$(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
$(MKDIR) -p $(@D)
$(RM) $@
- $(CP) $(JDK_OUTPUTDIR)/objs/java_objs$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX) $@
+ $(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX) $@
-LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX)
+TARGETS += $(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX)
ifeq ($(OPENJDK_TARGET_OS), windows)
$(eval $(call SetupLauncher,javaw, \
-DJAVAW -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib, \
- $(JDK_OUTPUTDIR)/objs/jli_static.lib, $(JAVA_RC_FLAGS), \
+ $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jli_static.lib, $(JAVA_RC_FLAGS), \
$(JAVA_VERSION_INFO_RESOURCE),,true))
endif
@@ -57,7 +57,7 @@
BUILD_JEXEC :=
BUILD_JEXEC_SRC :=
BUILD_JEXEC_INC :=
-BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
+BUILD_JEXEC_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)
#
# UNHANDLED:
@@ -90,7 +90,7 @@
endif
ifeq ($(OPENJDK_TARGET_OS), linux)
- BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib
+ BUILD_JEXEC_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
BUILD_JEXEC_INC += -I$(JDK_TOPDIR)/src/java.base/share/native/libjli
endif
endif
@@ -111,12 +111,12 @@
CFLAGS_solaris := -KPIC, \
LDFLAGS := $(LDFLAGS_JDKEXE) \
$(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/jexec_obj, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jexec_obj, \
OUTPUT_DIR := $(BUILD_JEXEC_DST_DIR), \
DEBUG_SYMBOLS := true, \
PROGRAM := jexec))
- LIBRARIES += $(BUILD_JEXEC)
+ TARGETS += $(BUILD_JEXEC)
endif
################################################################################
@@ -124,8 +124,8 @@
BUILD_JSPAWNHELPER :=
BUILD_JSPAWNHELPER_SRC := $(JDK_TOPDIR)/src/java.base/unix/native/jspawnhelper
JSPAWNHELPER_CFLAGS := -I$(JDK_TOPDIR)/src/java.base/unix/native/libjava
-BUILD_JSPAWNHELPER_DST_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
-LINK_JSPAWNHELPER_OBJECTS := $(JDK_OUTPUTDIR)/objs/libjava/childproc.o
+BUILD_JSPAWNHELPER_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)
+LINK_JSPAWNHELPER_OBJECTS := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava/childproc.o
LINK_JSPAWNHELPER_FLAGS :=
ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx solaris aix), )
@@ -133,7 +133,7 @@
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
- BUILD_JSPAWNHELPER_DST_DIR := $(JDK_OUTPUTDIR)/lib
+ BUILD_JSPAWNHELPER_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
endif
ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
@@ -149,19 +149,13 @@
CFLAGS := $(CFLAGS_JDKEXE) $(JSPAWNHELPER_CFLAGS), \
LDFLAGS := $(LDFLAGS_JDKEXE) $(LINK_JSPAWNHELPER_FLAGS), \
LDFLAGS_SUFFIX := $(LINK_JSPAWNHELPER_OBJECTS), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/jspawnhelper, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jspawnhelper, \
OUTPUT_DIR := $(BUILD_JSPAWNHELPER_DST_DIR), \
PROGRAM := jspawnhelper))
$(BUILD_JSPAWNHELPER): $(LINK_JSPAWNHELPER_OBJECTS)
- LIBRARIES += $(BUILD_JSPAWNHELPER)
+ TARGETS += $(BUILD_JSPAWNHELPER)
endif
################################################################################
-
-java.base: $(LAUNCHERS) $(LIBRARIES)
-
-all: java.base
-
-.PHONY: all java.base
--- a/jdk/make/launcher/Launcher-java.corba.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-java.corba.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -45,9 +45,3 @@
"-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
"com.sun.corba.se.impl.naming.cosnaming.TransientNameServer"$(COMMA) }'))
-
-java.corba: $(LAUNCHERS)
-
-all: java.corba
-
-.PHONY: all java.corba
--- a/jdk/make/launcher/Launcher-java.desktop.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-java.desktop.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -34,8 +34,3 @@
$(XLIBS)))
endif
-java.desktop: $(LAUNCHERS)
-
-all: java.desktop
-
-.PHONY: all java.desktop
--- a/jdk/make/launcher/Launcher-java.rmi.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-java.rmi.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -36,12 +36,12 @@
#
# The java-rmi.cgi script in bin/ only gets delivered in certain situations
#
-JAVA_RMI_CGI := $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java-rmi.cgi
+JAVA_RMI_CGI := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/java-rmi.cgi
ifeq ($(OPENJDK_TARGET_OS), linux)
- LAUNCHERS += $(JAVA_RMI_CGI)
+ TARGETS += $(JAVA_RMI_CGI)
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
- LAUNCHERS += $(JAVA_RMI_CGI)
+ TARGETS += $(JAVA_RMI_CGI)
endif
# TODO:
@@ -61,9 +61,3 @@
endif
##########################################################################################
-
-java.rmi: $(LAUNCHERS)
-
-all: java.rmi
-
-.PHONY: all java.rmi
--- a/jdk/make/launcher/Launcher-java.scripting.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-java.scripting.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -28,8 +28,3 @@
$(eval $(call SetupLauncher,jrunscript, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }'))
-java.scripting: $(LAUNCHERS)
-
-all: java.scripting
-
-.PHONY: all java.scripting
--- a/jdk/make/launcher/Launcher-java.security.jgss.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-java.security.jgss.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -36,8 +36,3 @@
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }'))
endif
-java.security.jgss: $(LAUNCHERS)
-
-all: java.security.jgss
-
-.PHONY: all java.security.jgss
--- a/jdk/make/launcher/Launcher-jdk.compiler.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-jdk.compiler.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -30,13 +30,6 @@
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javac.Main"$(COMMA) }'))
-ifeq ($(ENABLE_SJAVAC), yes)
- $(eval $(call SetupLauncher,sjavac, \
- -DEXPAND_CLASSPATH_WILDCARDS \
- -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
- -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.sjavac.Main"$(COMMA) }'))
-endif
-
$(eval $(call SetupLauncher,javah, \
-DEXPAND_CLASSPATH_WILDCARDS \
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
@@ -51,8 +44,12 @@
-DEXPAND_CLASSPATH_WILDCARDS \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))
-jdk.compiler: $(LAUNCHERS)
-
-all: jdk.compiler
-
-.PHONY: all jdk.compiler
+ifeq ($(ENABLE_SJAVAC), yes)
+ # Build sjavac directly to the exploded image so that it does not get included
+ # into any real images
+ $(eval $(call SetupLauncher,sjavac, \
+ -DEXPAND_CLASSPATH_WILDCARDS \
+ -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
+ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.sjavac.Main"$(COMMA) }',,,,,,, \
+ $(JDK_OUTPUTDIR)/bin))
+endif
--- a/jdk/make/launcher/Launcher-jdk.dev.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-jdk.dev.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -36,14 +36,12 @@
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.jdeps.Main"$(COMMA) }'))
+$(eval $(call SetupLauncher,jimage,\
+ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.tools.jimage.Main"$(COMMA) }'))
+
$(eval $(call SetupLauncher,jhat, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.hat.Main"$(COMMA) }'))
$(eval $(call SetupLauncher,native2ascii, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.native2ascii.Main"$(COMMA) }'))
-jdk.dev: $(LAUNCHERS)
-
-all: jdk.dev
-
-.PHONY: all jdk.dev
--- a/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -30,8 +30,3 @@
-DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
,,,,,,,,,Info-privileged.plist))
-jdk.hotspot.agent: $(LAUNCHERS)
-
-all: jdk.hotspot.agent
-
-.PHONY: all jdk.hotspot.agent
--- a/jdk/make/launcher/Launcher-jdk.javadoc.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-jdk.javadoc.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -30,8 +30,3 @@
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javadoc.Main"$(COMMA) }'))
-jdk.javadoc: $(LAUNCHERS)
-
-all: jdk.javadoc
-
-.PHONY: all jdk.javadoc
--- a/jdk/make/launcher/Launcher-jdk.jcmd.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-jdk.jcmd.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -58,8 +58,3 @@
$(eval $(call SetupLauncher,jcmd, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jcmd.JCmd"$(COMMA) }'))
-jdk.jcmd: $(LAUNCHERS)
-
-all: jdk.jcmd
-
-.PHONY: all jdk.jcmd
--- a/jdk/make/launcher/Launcher-jdk.jconsole.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-jdk.jconsole.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -32,8 +32,3 @@
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "-J-Djconsole.showOutputViewer"$(COMMA) "sun.tools.jconsole.JConsole"$(COMMA) }' \
-DAPP_CLASSPATH='{ "/lib/jconsole.jar"$(COMMA) "/lib/tools.jar"$(COMMA) "/classes" }'))
-jdk.jconsole: $(LAUNCHERS)
-
-all: jdk.jconsole
-
-.PHONY: all jdk.jconsole
--- a/jdk/make/launcher/Launcher-jdk.jdi.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-jdk.jdi.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -29,8 +29,3 @@
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.example.debug.tty.TTY"$(COMMA) }' \
-DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))
-jdk.jdi: $(LAUNCHERS)
-
-all: jdk.jdi
-
-.PHONY: all jdk.jdi
--- a/jdk/make/launcher/Launcher-jdk.jvmstat.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-jdk.jvmstat.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -28,8 +28,3 @@
$(eval $(call SetupLauncher,jstatd, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstatd.Jstatd"$(COMMA) }'))
-jdk.jvmstat: $(LAUNCHERS)
-
-all: jdk.jvmstat
-
-.PHONY: all jdk.jvmstat
--- a/jdk/make/launcher/Launcher-jdk.rmic.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-jdk.rmic.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -29,8 +29,3 @@
-DEXPAND_CLASSPATH_WILDCARDS \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }'))
-jdk.rmic: $(LAUNCHERS)
-
-all: jdk.rmic
-
-.PHONY: all jdk.rmic
--- a/jdk/make/launcher/Launcher-jdk.runtime.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-jdk.runtime.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -49,16 +49,16 @@
UNPACKEXE_ZIPOBJS := -lz
else
UNPACKEXE_CFLAGS += -I$(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib-1.2.8
- UNPACKEXE_ZIPOBJS := $(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \
- $(JDK_OUTPUTDIR)/objs/libzip/deflate$(OBJ_SUFFIX) \
- $(JDK_OUTPUTDIR)/objs/libzip/trees$(OBJ_SUFFIX) \
- $(JDK_OUTPUTDIR)/objs/libzip/zadler32$(OBJ_SUFFIX) \
- $(JDK_OUTPUTDIR)/objs/libzip/compress$(OBJ_SUFFIX) \
- $(JDK_OUTPUTDIR)/objs/libzip/zutil$(OBJ_SUFFIX) \
- $(JDK_OUTPUTDIR)/objs/libzip/inflate$(OBJ_SUFFIX) \
- $(JDK_OUTPUTDIR)/objs/libzip/infback$(OBJ_SUFFIX) \
- $(JDK_OUTPUTDIR)/objs/libzip/inftrees$(OBJ_SUFFIX) \
- $(JDK_OUTPUTDIR)/objs/libzip/inffast$(OBJ_SUFFIX)
+ UNPACKEXE_ZIPOBJS := $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zcrc32$(OBJ_SUFFIX) \
+ $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/deflate$(OBJ_SUFFIX) \
+ $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/trees$(OBJ_SUFFIX) \
+ $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zadler32$(OBJ_SUFFIX) \
+ $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/compress$(OBJ_SUFFIX) \
+ $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zutil$(OBJ_SUFFIX) \
+ $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inflate$(OBJ_SUFFIX) \
+ $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/infback$(OBJ_SUFFIX) \
+ $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inftrees$(OBJ_SUFFIX) \
+ $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inffast$(OBJ_SUFFIX)
endif
@@ -108,8 +108,8 @@
LDFLAGS_linux := -lc, \
LDFLAGS_solaris := $(UNPACKEXE_LDFLAGS_solaris) -lc, \
LDFLAGS_SUFFIX := $(LIBCXX), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR), \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR), \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe$(OUTPUT_SUBDIR), \
+ OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe$(OUTPUT_SUBDIR), \
PROGRAM := unpack200, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
@@ -133,15 +133,9 @@
# image. The real fix would be clean up linking of unpack200 using
# -link -incremental:no
# like all other launchers.
-$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX): $(BUILD_UNPACKEXE)
+$(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/unpack200$(EXE_SUFFIX): $(BUILD_UNPACKEXE)
$(call install-file)
-LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX)
+TARGETS += $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/unpack200$(EXE_SUFFIX)
################################################################################
-
-jdk.runtime: $(LAUNCHERS)
-
-all: jdk.runtime
-
-.PHONY: all jdk.runtime
--- a/jdk/make/launcher/Launcher-jdk.scripting.nashorn.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-jdk.scripting.nashorn.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -28,8 +28,3 @@
$(eval $(call SetupLauncher,jjs, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.nashorn.tools.Shell"$(COMMA) }'))
-jdk.scripting.nashorn: $(LAUNCHERS)
-
-all: jdk.scripting.nashorn
-
-.PHONY: all jdk.scripting.nashorn
--- a/jdk/make/launcher/Launcher-jdk.xml.bind.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-jdk.xml.bind.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -31,8 +31,3 @@
$(eval $(call SetupLauncher,xjc, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.xjc.Driver"$(COMMA) }'))
-jdk.xml.bind: $(LAUNCHERS)
-
-all: jdk.xml.bind
-
-.PHONY: all jdk.xml.bind
--- a/jdk/make/launcher/Launcher-jdk.xml.ws.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/Launcher-jdk.xml.ws.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -31,8 +31,3 @@
$(eval $(call SetupLauncher,wsimport, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsImport"$(COMMA) }'))
-jdk.xml.ws: $(LAUNCHERS)
-
-all: jdk.xml.ws
-
-.PHONY: all jdk.xml.ws
--- a/jdk/make/launcher/LauncherCommon.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/launcher/LauncherCommon.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -23,10 +23,6 @@
# questions.
#
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
include NativeCompilation.gmk
# Prepare the find cache.
@@ -93,7 +89,7 @@
$(call LogSetupMacroEntry,SetupLauncher($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11))
$(if $(13),$(error Internal makefile error: Too many arguments to SetupLauncher, please update CompileLaunchers.gmk))
- $1_WINDOWS_JLI_LIB := $(JDK_OUTPUTDIR)/objs/libjli/jli.lib
+ $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib
ifneq ($6, )
$1_WINDOWS_JLI_LIB := $6
endif
@@ -113,14 +109,14 @@
endif
endif
- $1_LDFLAGS += -Wl,-all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
+ $1_LDFLAGS += -Wl,-all_load $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a \
-framework Cocoa -framework Security -framework ApplicationServices \
-sectcreate __TEXT __info_plist $(MACOSX_PLIST_DIR)/$$($1_PLIST_FILE)
$1_LDFLAGS_SUFFIX += -pthread
endif
ifeq ($(OPENJDK_TARGET_OS), aix)
- $1_LDFLAGS_SUFFIX += -L$(JDK_OUTPUTDIR)/objs -ljli_static
+ $1_LDFLAGS_SUFFIX += -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE) -ljli_static
endif
ifeq ($(USE_EXTERNAL_LIBZ), true)
@@ -129,7 +125,7 @@
$1_OUTPUT_DIR_ARG := $9
ifeq (, $$($1_OUTPUT_DIR_ARG))
- $1_OUTPUT_DIR_ARG := $(JDK_OUTPUTDIR)/bin
+ $1_OUTPUT_DIR_ARG := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)
endif
# TODO: maybe it's better to move this if-statement out of this function
@@ -189,10 +185,10 @@
LDFLAGS_SUFFIX := $(LDFLAGS_JDKEXE_SUFFIX) $$($1_LDFLAGS_SUFFIX), \
LDFLAGS_SUFFIX_posix := $4, \
LDFLAGS_SUFFIX_windows := $$($1_WINDOWS_JLI_LIB) \
- $(JDK_OUTPUTDIR)/objs/libjava/java.lib advapi32.lib $5, \
- LDFLAGS_SUFFIX_linux := -L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli $(LIBDL) -lc, \
- LDFLAGS_SUFFIX_solaris := -L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli -lthread $(LIBDL) -lc, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/$1_objs$(OUTPUT_SUBDIR), \
+ $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib $5, \
+ LDFLAGS_SUFFIX_linux := -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli $(LIBDL) -lc, \
+ LDFLAGS_SUFFIX_solaris := -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli -lthread $(LIBDL) -lc, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs$(OUTPUT_SUBDIR), \
OUTPUT_DIR := $$($1_OUTPUT_DIR_ARG)$(OUTPUT_SUBDIR), \
PROGRAM := $1, \
DEBUG_SYMBOLS := true, \
@@ -205,14 +201,14 @@
MANIFEST := $(JAVA_MANIFEST), \
CODESIGN := $$($1_CODESIGN))
- LAUNCHERS += $$(BUILD_LAUNCHER_$1)
+ TARGETS += $$(BUILD_LAUNCHER_$1)
ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix))
- $$(BUILD_LAUNCHER_$1): $(JDK_OUTPUTDIR)/objs/libjli_static.a
+ $$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
- $$(BUILD_LAUNCHER_$1): $(JDK_OUTPUTDIR)/objs/libjava/java.lib \
+ $$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib \
$$($1_WINDOWS_JLI_LIB)
endif
endef
--- a/jdk/make/lib/Awt2dLibraries.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Awt2dLibraries.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -23,7 +23,7 @@
# questions.
#
-WIN_AWT_LIB := $(JDK_OUTPUTDIR)/objs/libawt/awt.lib
+WIN_AWT_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt/awt.lib
################################################################################
@@ -66,12 +66,12 @@
-D "JDK_FNAME=mlib_image.dll" \
-D "JDK_INTERNAL_NAME=mlib_image" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libmlib_image, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmlib_image, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-$(BUILD_LIBMLIB_IMAGE): $(BUILD_LIBJAVA)
+$(BUILD_LIBMLIB_IMAGE): $(call FindLib, java.base, java)
-DESKTOP_LIBRARIES += $(BUILD_LIBMLIB_IMAGE)
+TARGETS += $(BUILD_LIBMLIB_IMAGE)
################################################################################
@@ -132,12 +132,12 @@
$(BUILD_LIBMLIB_LDLIBS) -ljava -ljvm \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX_solaris := -lc, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libmlib_image_v, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmlib_image_v, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- $(BUILD_LIBMLIB_IMAGE_V): $(BUILD_LIBJAVA)
+ $(BUILD_LIBMLIB_IMAGE_V): $(call FindLib, java.base, java)
- DESKTOP_LIBRARIES += $(BUILD_LIBMLIB_IMAGE_V)
+ TARGETS += $(BUILD_LIBMLIB_IMAGE_V)
endif
@@ -167,7 +167,7 @@
LIBAWT_EXFILES += initIDs.c awt/image/cvutils/img_colors.c
endif
-LIBAWT_CFLAGS += -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+LIBAWT_CFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
$(addprefix -I, $(shell find $(LIBAWT_DIRS) -type d)) \
$(LIBJAVA_HEADER_FLAGS) \
$(addprefix -I, $(BUILD_LIBMLIB_IMAGE_SRC)) \
@@ -214,7 +214,7 @@
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/opengl \
-I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
#
LIBAWT_EXFILES += \
java2d/d3d/D3DShaderGen.c \
@@ -259,7 +259,8 @@
LDFLAGS_SUFFIX_linux := -ljvm $(LIBM) $(LIBDL) -ljava, \
LDFLAGS_SUFFIX_solaris := -ljvm $(LIBM) $(LIBDL) -ljava -lc, \
LDFLAGS_SUFFIX_aix :=-ljvm $(LIBM) $(LIBDL) -ljava -lm,\
- LDFLAGS_SUFFIX_macosx := -lmlib_image -ljvm $(LIBM) \
+ LDFLAGS_SUFFIX_macosx := -L$(INSTALL_LIBRARIES_HERE) \
+ -lmlib_image -ljvm $(LIBM) \
-framework Cocoa \
-framework OpenGL \
-framework JavaNativeFoundation \
@@ -281,16 +282,16 @@
-D "JDK_FNAME=awt.dll" \
-D "JDK_INTERNAL_NAME=awt" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-$(BUILD_LIBAWT): $(BUILD_LIBJAVA)
+$(BUILD_LIBAWT): $(call FindLib, java.base, java)
ifeq ($(OPENJDK_TARGET_OS), macosx)
$(BUILD_LIBAWT): $(BUILD_LIBMLIB_IMAGE)
endif
-DESKTOP_LIBRARIES += $(BUILD_LIBAWT)
+TARGETS += $(BUILD_LIBAWT)
################################################################################
@@ -312,7 +313,7 @@
LIBAWT_XAWT_EXCLUDES := medialib
LIBAWT_XAWT_CFLAGS := $(addprefix -I, $(shell $(FIND) $(LIBAWT_XAWT_DIRS) -type d)) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/include \
@@ -365,21 +366,22 @@
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(X_LIBS) $(LIBAWT_XAWT_LDFLAGS) \
$(call SET_SHARED_LIBRARY_ORIGIN) \
- $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+ $(call SET_SHARED_LIBRARY_ORIGIN,/..) \
+ -L $(INSTALL_LIBRARIES_HERE), \
LDFLAGS_SUFFIX := $(LIBAWT_XAWT_LDFLAGS_SUFFIX), \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=xawt.dll" \
-D "JDK_INTERNAL_NAME=xawt" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_xawt, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_xawt, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- $(BUILD_LIBAWT_XAWT): $(BUILD_LIBJAVA)
+ $(BUILD_LIBAWT_XAWT): $(call FindLib, java.base, java)
$(BUILD_LIBAWT_XAWT): $(BUILD_LIBAWT)
- DESKTOP_LIBRARIES += $(BUILD_LIBAWT_XAWT)
+ TARGETS += $(BUILD_LIBAWT_XAWT)
endif
endif
@@ -387,7 +389,7 @@
################################################################################
LIBLCMS_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/liblcms
-LIBLCMS_CPPFLAGS += -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+LIBLCMS_CPPFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
$(LIBJAVA_HEADER_FLAGS) \
@@ -419,6 +421,7 @@
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_posix := -L $(INSTALL_LIBRARIES_HERE), \
LDFLAGS_solaris := /usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2, \
LDFLAGS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc $(LCMS_LIBS), \
@@ -430,10 +433,10 @@
-D "JDK_FNAME=lcms.dll" \
-D "JDK_INTERNAL_NAME=lcms" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/liblcms, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/liblcms, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-DESKTOP_LIBRARIES += $(BUILD_LIBLCMS)
+TARGETS += $(BUILD_LIBLCMS)
$(BUILD_LIBLCMS): $(BUILD_LIBAWT)
@@ -492,7 +495,7 @@
OPTIMIZATION := HIGHEST, \
CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJAVAJPEG_SRC)) \
$(LIBJAVA_HEADER_FLAGS) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop, \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
MAPFILE := $(BUILD_LIBJAVAJPEG_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LIBJPEG_LIBS) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -504,12 +507,12 @@
-D "JDK_INTERNAL_NAME=javajpeg" \
-D "JDK_FTYPE=0x2L", \
REORDER := $(BUILD_LIBJAVAJPEG_REORDER), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjavajpeg, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjavajpeg, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-$(BUILD_LIBJAVAJPEG): $(BUILD_LIBJAVA)
+$(BUILD_LIBJAVAJPEG): $(call FindLib, java.base, java)
-DESKTOP_LIBRARIES += $(BUILD_LIBJAVAJPEG)
+TARGETS += $(BUILD_LIBJAVAJPEG)
################################################################################
@@ -522,7 +525,7 @@
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt \
$(JDK_TOPDIR)/src/java.desktop/share/native/common \
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common -type d)) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
$(LIBJAVA_HEADER_FLAGS) \
#
@@ -578,6 +581,7 @@
MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
LDFLAGS := $(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_posix := -L $(INSTALL_LIBRARIES_HERE), \
LDFLAGS_SUFFIX := $(BUILD_LIBFONTMANAGER_FONTLIB), \
LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \
LDFLAGS_SUFFIX_solaris := $(filter-out -R%, $(X_LIBS)) \
@@ -592,7 +596,7 @@
-D "JDK_FNAME=fontmanager.dll" \
-D "JDK_INTERNAL_NAME=fontmanager" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libfontmanager, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfontmanager, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
@@ -601,7 +605,7 @@
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_XAWT)
endif
-DESKTOP_LIBRARIES += $(BUILD_LIBFONTMANAGER)
+TARGETS += $(BUILD_LIBFONTMANAGER)
################################################################################
@@ -612,7 +616,7 @@
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/java2d/windows \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
$(LIBJAVA_HEADER_FLAGS) \
@@ -639,16 +643,16 @@
-D "JDK_FNAME=jawt.dll" \
-D "JDK_INTERNAL_NAME=jawt" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjawt, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
$(BUILD_LIBJAWT): $(BUILD_LIBAWT)
$(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX): $(BUILD_LIBJAWT)
$(ECHO) Copying $(@F)
- $(CP) $(JDK_OUTPUTDIR)/objs/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
+ $(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
- DESKTOP_LIBRARIES += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
+ TARGETS += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
else # OPENJDK_TARGET_OS not windows
@@ -694,13 +698,14 @@
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjawt/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_posix := -L $(INSTALL_LIBRARIES_HERE), \
LDFLAGS_solaris := $(X_LIBS), \
LDFLAGS_SUFFIX_linux := $(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX), \
LDFLAGS_SUFFIX_aix := $(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX),\
LDFLAGS_SUFFIX_solaris := $(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX) -lXrender, \
LDFLAGS_SUFFIX_macosx := -Xlinker -rpath -Xlinker @loader_path $(JAWT_LIBS) \
-framework Cocoa $(LDFLAGS_JDKLIB_SUFFIX), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjawt, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
ifndef BUILD_HEADLESS_ONLY
@@ -715,7 +720,7 @@
endif # OPENJDK_TARGET_OS
-DESKTOP_LIBRARIES += $(BUILD_LIBJAWT)
+TARGETS += $(BUILD_LIBJAWT)
################################################################################
@@ -732,7 +737,7 @@
#
LIBAWT_HEADLESS_EXCLUDES := medialib
- LIBAWT_HEADLESS_CFLAGS := -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+ LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
$(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
@@ -770,6 +775,7 @@
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_posix := -L $(INSTALL_LIBRARIES_HERE), \
LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN)., \
@@ -777,12 +783,12 @@
LDFLAGS_SUFFIX_linux := -ljvm -lawt -lm $(LIBDL) -ljava, \
LDFLAGS_SUFFIX_aix := -ljvm -lawt -ljava,\
LDFLAGS_SUFFIX_solaris := $(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_headless, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
$(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
- DESKTOP_LIBRARIES += $(BUILD_LIBAWT_HEADLESS)
+ TARGETS += $(BUILD_LIBAWT_HEADLESS)
endif
endif
@@ -853,7 +859,9 @@
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
- LIBSPLASHSCREEN_LDFLAGS_SUFFIX += $(LIBM) -lpthread -liconv -losxapp \
+ LIBSPLASHSCREEN_LDFLAGS_SUFFIX += \
+ -L$(INSTALL_LIBRARIES_HERE) \
+ $(LIBM) -lpthread -liconv -losxapp \
-framework ApplicationServices \
-framework Foundation \
-framework Cocoa \
@@ -885,10 +893,10 @@
-D "JDK_FNAME=splashscreen.dll" \
-D "JDK_INTERNAL_NAME=splashscreen" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsplashscreen, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsplashscreen, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- DESKTOP_LIBRARIES += $(BUILD_LIBSPLASHSCREEN)
+ TARGETS += $(BUILD_LIBSPLASHSCREEN)
ifeq ($(OPENJDK_TARGET_OS), macosx)
$(BUILD_LIBSPLASHSCREEN): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)osxapp$(SHARED_LIBRARY_SUFFIX)
@@ -909,7 +917,7 @@
LIBAWT_LWAWT_CFLAGS := \
$(addprefix -I, $(LIBAWT_LWAWT_DIRS)) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-I$(JDK_TOPDIR)/src/java.desktop/macosx/native/include \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
-I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl \
@@ -945,7 +953,8 @@
$(X_LIBS) \
$(LIBAWT_LWAWT_CFLAGS), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
+ $(call SET_SHARED_LIBRARY_ORIGIN) \
+ -L $(INSTALL_LIBRARIES_HERE), \
LDFLAGS_SUFFIX_macosx := -lawt -lmlib_image -losxapp -ljvm $(LIBM) \
-framework Accelerate \
-framework ApplicationServices \
@@ -958,10 +967,10 @@
-framework JavaRuntimeSupport \
-framework OpenGL \
-framework QuartzCore -ljava, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_lwawt, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_lwawt, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- DESKTOP_LIBRARIES += $(BUILD_LIBAWT_LWAWT)
+ TARGETS += $(BUILD_LIBAWT_LWAWT)
$(BUILD_LIBAWT_LWAWT): $(BUILD_LIBAWT)
@@ -969,7 +978,7 @@
$(BUILD_LIBAWT_LWAWT): $(BUILD_LIBOSXAPP)
- $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBJAVA)
+ $(BUILD_LIBAWT_LWAWT): $(call FindLib, java.base, java)
endif
@@ -989,10 +998,11 @@
-I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
-I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop, \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN) \
- -Xlinker -rpath -Xlinker @loader_path, \
+ -Xlinker -rpath -Xlinker @loader_path \
+ -L $(INSTALL_LIBRARIES_HERE), \
LDFLAGS_SUFFIX_macosx := -lawt -losxapp -lawt_lwawt \
-framework Cocoa \
-framework Carbon \
@@ -1000,10 +1010,10 @@
-framework JavaNativeFoundation \
-framework JavaRuntimeSupport \
-ljava -ljvm, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libosxui, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxui, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- DESKTOP_LIBRARIES += $(BUILD_LIBOSXUI)
+ TARGETS += $(BUILD_LIBOSXUI)
$(BUILD_LIBOSXUI): $(BUILD_LIBAWT)
@@ -1011,7 +1021,7 @@
$(BUILD_LIBOSXUI): $(BUILD_LIBAWT_LWAWT)
- #$(BUILD_LIBOSXUI): $(BUILD_LIBJAVA)
+ #$(BUILD_LIBOSXUI): $(call FindLib, java.base, java)
endif
--- a/jdk/make/lib/CoreLibraries.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/CoreLibraries.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -23,7 +23,7 @@
# questions.
#
-WIN_VERIFY_LIB := $(JDK_OUTPUTDIR)/objs/libverify/verify.lib
+WIN_VERIFY_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify/verify.lib
##########################################################################################
# libfdlibm is statically linked with libjava below and not delivered into the
@@ -41,7 +41,7 @@
ifneq ($(OPENJDK_TARGET_OS), macosx)
$(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM, \
STATIC_LIBRARY := fdlibm, \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
+ OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
SRC := $(LIBFDLIBM_SRC), \
LANG := C, \
OPTIMIZATION := $(BUILD_LIBFDLIBM_OPTIMIZATION), \
@@ -49,7 +49,7 @@
CFLAGS_windows_debug := -DLOGGING, \
CFLAGS_aix := -qfloat=nomaf, \
ARFLAGS := $(ARFLAGS), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
else
@@ -58,15 +58,15 @@
# a plain static library.
$(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM_MAC, \
LIBRARY := fdlibm, \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
+ OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
SRC := $(LIBFDLIBM_SRC), \
LANG := C, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
LDFLAGS := -nostdlib -r -arch x86_64, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- BUILD_LIBFDLIBM := $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
+ BUILD_LIBFDLIBM := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
$(BUILD_LIBFDLIBM): $(BUILD_LIBFDLIBM_MAC)
$(call install-file)
@@ -107,10 +107,10 @@
-D "JDK_INTERNAL_NAME=verify" \
-D "JDK_FTYPE=0x2L", \
REORDER := $(BUILD_LIBVERIFY_REORDER), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libverify, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify, \
DEBUG_SYMBOLS := true))
-BASE_LIBRARIES += $(BUILD_LIBVERIFY)
+TARGETS += $(BUILD_LIBVERIFY)
##########################################################################################
@@ -122,7 +122,7 @@
LIBJAVA_CFLAGS := $(addprefix -I, $(LIBJAVA_SRC_DIRS)) \
-I$(JDK_TOPDIR)/src/java.base/share/native/libfdlibm \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
LIBJAVA_CFLAGS += -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
@@ -164,7 +164,7 @@
LDFLAGS_SUFFIX_solaris := -lsocket -lnsl -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc, \
LDFLAGS_SUFFIX_linux := $(LIBDL) $(BUILD_LIBFDLIBM), \
LDFLAGS_SUFFIX_aix := $(LIBDL) $(BUILD_LIBFDLIBM) -lm,\
- LDFLAGS_SUFFIX_macosx := -L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \
+ LDFLAGS_SUFFIX_macosx := -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/ -lfdlibm \
-framework CoreFoundation \
-framework Foundation \
-framework Security -framework SystemConfiguration, \
@@ -179,10 +179,10 @@
-D "JDK_INTERNAL_NAME=java" \
-D "JDK_FTYPE=0x2L", \
REORDER := $(LIBJAVA_REORDER), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjava, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-BASE_LIBRARIES += $(BUILD_LIBJAVA)
+TARGETS += $(BUILD_LIBJAVA)
$(BUILD_LIBJAVA): $(BUILD_LIBVERIFY)
@@ -217,7 +217,7 @@
$(ZLIB_CPPFLAGS) \
-I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base, \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
CFLAGS_posix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libzip/mapfile-vers, \
REORDER := $(BUILD_LIBZIP_REORDER), \
@@ -225,8 +225,9 @@
$(call SET_SHARED_LIBRARY_ORIGIN) \
$(EXPORT_ZIP_FUNCS), \
LDFLAGS_windows := -export:ZIP_Open -export:ZIP_Close -export:ZIP_FindEntry \
- -export:ZIP_ReadEntry -export:ZIP_GetNextEntry -export:ZIP_CRC32 jvm.lib \
- $(WIN_JAVA_LIB), \
+ -export:ZIP_ReadEntry -export:ZIP_GetNextEntry \
+ -export:ZIP_InflateFully -export:ZIP_CRC32 \
+ jvm.lib $(WIN_JAVA_LIB), \
LDFLAGS_SUFFIX_linux := -ljvm -ljava $(LIBZ), \
LDFLAGS_SUFFIX_solaris := -ljvm -ljava $(LIBZ) -lc, \
LDFLAGS_SUFFIX_aix := -ljvm -ljava $(LIBZ),\
@@ -236,13 +237,13 @@
-D "JDK_FNAME=zip.dll" \
-D "JDK_INTERNAL_NAME=zip" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libzip, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libzip, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
$(BUILD_LIBZIP): $(BUILD_LIBJAVA)
-BASE_LIBRARIES += $(BUILD_LIBZIP)
+TARGETS += $(BUILD_LIBZIP)
##########################################################################################
@@ -363,10 +364,10 @@
-D "JDK_FNAME=jli.dll" \
-D "JDK_INTERNAL_NAME=jli" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-BASE_LIBRARIES += $(BUILD_LIBJLI)
+TARGETS += $(BUILD_LIBJLI)
# On windows, the static library has the same suffix as the import library created by
# with the shared library, so the static library is given a different name. No harm
@@ -374,18 +375,17 @@
ifeq ($(OPENJDK_TARGET_OS), windows)
$(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
STATIC_LIBRARY := jli_static, \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
+ OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
SRC := $(BUILD_LIBJLI_SRC_DIRS), \
INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
LANG := C, \
OPTIMIZATION := HIGH, \
CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
ARFLAGS := $(ARFLAGS), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli_static, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- BUILD_LIBRARIES += $(BUILD_LIBJLI_STATIC)
- BASE_STATIC_LIBRARIES += $(BUILD_LIBJLI_STATIC)
+ TARGETS += $(BUILD_LIBJLI_STATIC)
else ifeq ($(OPENJDK_TARGET_OS), macosx)
#
@@ -394,37 +394,35 @@
# as this is first time I see it
$(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
LIBRARY := jli_static, \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
+ OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
SRC := $(BUILD_LIBJLI_SRC_DIRS), \
INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
LANG := C, \
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
LDFLAGS := -nostdlib -r, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli_static, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- $(JDK_OUTPUTDIR)/objs/libjli_static.a: $(BUILD_LIBJLI_STATIC)
+ $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static.a: $(BUILD_LIBJLI_STATIC)
$(call install-file)
- BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/objs/libjli_static.a
- BASE_STATIC_LIBRARIES += $(JDK_OUTPUTDIR)/objs/libjli_static.a
+ TARGETS += $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static.a
else ifeq ($(OPENJDK_TARGET_OS), aix)
# AIX also requires a static libjli because the compiler doesn't support '-rpath'
$(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC,\
STATIC_LIBRARY:=jli_static,\
- OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs,\
+ OUTPUT_DIR:=$(SUPPORT_OUTPUTDIR)/native/$(MODULE),\
SRC:=$(BUILD_LIBJLI_SRC_DIRS),\
INCLUDE_FILES:=$(BUILD_LIBJLI_FILES),\
LANG:=C,\
OPTIMIZATION:=HIGH, \
CFLAGS:=$(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS),\
ARFLAGS:=$(ARFLAGS),\
- OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static))
+ OBJECT_DIR:=$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static))
- BUILD_LIBRARIES += $(BUILD_LIBJLI_STATIC)
- BASE_STATIC_LIBRARIES += $(BUILD_LIBJLI_STATIC)
+ TARGETS += $(BUILD_LIBJLI_STATIC)
endif
--- a/jdk/make/lib/Lib-java.base.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-java.base.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -32,9 +32,3 @@
include CoreLibraries.gmk
include NetworkingLibraries.gmk
include NioLibraries.gmk
-
-java.base: $(BASE_LIBRARIES) $(BASE_STATIC_LIBRARIES) $(NPT_LIBRARIES)
-
-all: java.base
-
-.PHONY: all java.base
--- a/jdk/make/lib/Lib-java.desktop.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-java.desktop.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -32,9 +32,3 @@
include PlatformLibraries.gmk
include Awt2dLibraries.gmk
include SoundLibraries.gmk
-
-java.desktop: $(DESKTOP_LIBRARIES)
-
-all: java.desktop
-
-.PHONY: all java.desktop
--- a/jdk/make/lib/Lib-java.instrument.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-java.instrument.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -32,7 +32,7 @@
#
LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \
$(addprefix -I, $(LIBINSTRUMENT_SRC)) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.instrument \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.instrument \
-I$(JDK_TOPDIR)/src/java.base/share/native/libjli \
-I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
#
@@ -41,7 +41,7 @@
LIBINSTRUMENT_LDFLAGS_SUFFIX :=
ifeq ($(OPENJDK_TARGET_OS), windows)
- LIBINSTRUMENT_LDFLAGS += $(JDK_OUTPUTDIR)/objs/jli_static.lib $(WIN_JAVA_LIB) \
+ LIBINSTRUMENT_LDFLAGS += $(SUPPORT_OUTPUTDIR)/native/java.base/jli_static.lib $(WIN_JAVA_LIB) \
-export:Agent_OnAttach advapi32.lib
# Statically link the C runtime so that there are not dependencies on modules
# not on the search patch when invoked from the Windows system directory
@@ -68,34 +68,28 @@
$(LIBINSTRUMENT_LDFLAGS), \
LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/jli), \
LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/jli), \
- LDFLAGS_macosx := -Xlinker -all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
+ LDFLAGS_macosx := -Xlinker -all_load $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a \
-framework Cocoa -framework Security -framework ApplicationServices, \
LDFLAGS_SUFFIX := $(LIBINSTRUMENT_LDFLAGS_SUFFIX), \
LDFLAGS_SUFFIX_macosx := -liconv $(LIBZ), \
- LDFLAGS_SUFFIX_solaris := $(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL) -lc, \
- LDFLAGS_SUFFIX_linux := $(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL), \
- LDFLAGS_SUFFIX_aix := $(LIBZ) -L$(JDK_OUTPUTDIR)/objs -ljli_static $(LIBDL),\
+ LDFLAGS_SUFFIX_solaris := $(LIBZ) -L $(call FindLibDirForModule, java.base)/jli -ljli $(LIBDL) -lc, \
+ LDFLAGS_SUFFIX_linux := $(LIBZ) -L $(call FindLibDirForModule, java.base)/jli -ljli $(LIBDL), \
+ LDFLAGS_SUFFIX_aix := $(LIBZ) -L$(SUPPORT_OUTPUTDIR)/native/java.base -ljli_static $(LIBDL),\
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=instrument.dll" \
-D "JDK_INTERNAL_NAME=instrument" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libinstrument, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libinstrument, \
DEBUG_SYMBOLS := true))
ifneq (, $(findstring $(OPENJDK_TARGET_OS), macosx windows aix))
- $(BUILD_LIBINSTRUMENT): $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)jli_static$(STATIC_LIBRARY_SUFFIX)
+ $(BUILD_LIBINSTRUMENT): $(SUPPORT_OUTPUTDIR)/native/java.base/$(LIBRARY_PREFIX)jli_static$(STATIC_LIBRARY_SUFFIX)
else
- $(BUILD_LIBINSTRUMENT): $(INSTALL_LIBRARIES_HERE)/jli/$(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX)
+ $(BUILD_LIBINSTRUMENT): $(call FindLib, java.base, jli, /jli)
endif
$(BUILD_LIBINSTRUMENT): $(BUILD_LIBJAVA)
-INSTRUMENT_LIBRARIES += $(BUILD_LIBINSTRUMENT)
+TARGETS += $(BUILD_LIBINSTRUMENT)
################################################################################
-
-java.instrument: $(INSTRUMENT_LIBRARIES)
-
-all: java.instrument
-
-.PHONY: all java.instrument
--- a/jdk/make/lib/Lib-java.management.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-java.management.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -34,7 +34,7 @@
$(JDK_TOPDIR)/src/java.management/$(OPENJDK_TARGET_OS_API_DIR)/native/libmanagement
BUILD_LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include \
$(addprefix -I,$(BUILD_LIBMANAGEMENT_SRC)) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.management \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.management \
$(LIBJAVA_HEADER_FLAGS) \
#
@@ -82,17 +82,11 @@
-D "JDK_FNAME=management.dll" \
-D "JDK_INTERNAL_NAME=management" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libmanagement, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement, \
DEBUG_SYMBOLS := true))
-$(BUILD_LIBMANAGEMENT): $(BUILD_LIBJAVA)
+$(BUILD_LIBMANAGEMENT): $(call FindLib, java.base, java)
-MANAGEMENT_LIBRARIES += $(BUILD_LIBMANAGEMENT)
+TARGETS += $(BUILD_LIBMANAGEMENT)
################################################################################
-
-java.management: $(MANAGEMENT_LIBRARIES)
-
-all: java.management
-
-.PHONY: all java.management
--- a/jdk/make/lib/Lib-java.prefs.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-java.prefs.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -54,17 +54,11 @@
-D "JDK_FNAME=prefs.dll" \
-D "JDK_INTERNAL_NAME=prefs" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libprefs, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libprefs, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-$(BUILD_LIBPREFS): $(BUILD_LIBJAVA)
+$(BUILD_LIBPREFS): $(call FindLib, java.base, java)
-PREFS_LIBRARIES += $(BUILD_LIBPREFS)
+TARGETS += $(BUILD_LIBPREFS)
################################################################################
-
-java.prefs: $(PREFS_LIBRARIES)
-
-all: java.prefs
-
-.PHONY: all java.prefs
--- a/jdk/make/lib/Lib-java.security.jgss.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-java.security.jgss.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -40,16 +40,16 @@
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2GSS_SRC)) \
$(LIBJAVA_HEADER_FLAGS) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.security.jgss, \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2gss/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX := $(LIBDL), \
LDFLAGS_SUFFIX_solaris := -lc, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2gss, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2gss, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- SECURITY_KERBEROS_LIBRARIES += $(BUILD_LIBJ2GSS)
+ TARGETS += $(BUILD_LIBJ2GSS)
endif
################################################################################
@@ -81,7 +81,7 @@
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(addprefix -I, $(BUILD_LIBKRB5_SRC)) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.security.jgss, \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX := $(BUILD_LIBKRB5_LIBS), \
@@ -90,17 +90,11 @@
-D "JDK_FNAME=$(BUILD_LIBKRB5_NAME).dll" \
-D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libkrb5, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libkrb5, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- SECURITY_KERBEROS_LIBRARIES += $(BUILD_LIBKRB5)
+ TARGETS += $(BUILD_LIBKRB5)
endif
endif
################################################################################
-
-java.security.jgss: $(SECURITY_KERBEROS_LIBRARIES)
-
-all: java.security.jgss
-
-.PHONY: all java.security.jgss
--- a/jdk/make/lib/Lib-java.smartcardio.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-java.smartcardio.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -31,7 +31,7 @@
$(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2pcsc
LIBJ2PCSC_CPPFLAGS := $(addprefix -I,$(LIBJ2PCSC_SRC)) \
-I$(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2pcsc/MUSCLE \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.smartcardio
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.smartcardio
$(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC, \
LIBRARY := j2pcsc, \
@@ -52,15 +52,9 @@
-D "JDK_FNAME=j2pcsc.dll" \
-D "JDK_INTERNAL_NAME=j2pcsc" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2pcsc, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2pcsc, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-SECURITY_SMARTCARDIO_LIBRARIES += $(BUILD_LIBJ2PCSC)
+TARGETS += $(BUILD_LIBJ2PCSC)
################################################################################
-
-java.smartcardio: $(SECURITY_SMARTCARDIO_LIBRARIES)
-
-all: java.smartcardio
-
-.PHONY: all java.smartcardio
--- a/jdk/make/lib/Lib-jdk.attach.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-jdk.attach.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -35,7 +35,7 @@
LANG := C, \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.attach \
+ -I$(SUPPORT_OUTPUTDIR)/headers/jdk.attach \
$(LIBJAVA_HEADER_FLAGS), \
CFLAGS_windows := /Gy, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libattach/mapfile-$(OPENJDK_TARGET_OS), \
@@ -50,17 +50,11 @@
LDFLAGS_windows := /ORDER:@$(JDK_TOPDIR)/make/mapfiles/libattach/reorder-windows-$(OPENJDK_TARGET_CPU), \
LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB) advapi32.lib psapi.lib, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libattach, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libattach, \
DEBUG_SYMBOLS := true))
-$(BUILD_LIBATTACH): $(BUILD_LIBJAVA)
+$(BUILD_LIBATTACH): $(call FindLib, java.base, java)
-ATTACH_LIBRARIES += $(BUILD_LIBATTACH)
+TARGETS += $(BUILD_LIBATTACH)
################################################################################
-
-jdk.attach: $(ATTACH_LIBRARIES)
-
-all: jdk.attach
-
-.PHONY: all jdk.attach
--- a/jdk/make/lib/Lib-jdk.crypto.ec.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-jdk.crypto.ec.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -65,16 +65,10 @@
-D "JDK_FNAME=sunec.dll" \
-D "JDK_INTERNAL_NAME=sunec" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsunec, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsunec, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- SECURITY_SUNEC_LIBRARIES += $(BUILD_LIBSUNEC)
+ TARGETS += $(BUILD_LIBSUNEC)
endif
################################################################################
-
-jdk.crypto.ec: $(SECURITY_SUNEC_LIBRARIES)
-
-all: jdk.crypto.ec
-
-.PHONY: all jdk.crypto.ec
--- a/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -47,16 +47,10 @@
-D "JDK_FNAME=sunmscapi.dll" \
-D "JDK_INTERNAL_NAME=sunmscapi" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsunmscapi, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsunmscapi, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- SECURITY_MSCAPI_LIBRARIES += $(BUILD_LIBSUNMSCAPI)
+ TARGETS += $(BUILD_LIBSUNMSCAPI)
endif
################################################################################
-
-jdk.crypto.mscapi: $(SECURITY_MSCAPI_LIBRARIES)
-
-all: jdk.crypto.mscapi
-
-.PHONY: all jdk.crypto.mscapi
--- a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -38,7 +38,7 @@
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2PKCS11_SRC)) \
$(LIBJAVA_HEADER_FLAGS) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.crypto.pkcs11, \
+ -I$(SUPPORT_OUTPUTDIR)/headers/jdk.crypto.pkcs11, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pkcs11/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -49,15 +49,9 @@
-D "JDK_FNAME=j2pkcs11.dll" \
-D "JDK_INTERNAL_NAME=j2pkcs11" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2pkcs11, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2pkcs11, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-SECURITY_PKCS11_LIBRARIES += $(BUILD_LIBJ2PKCS11)
+TARGETS += $(BUILD_LIBJ2PKCS11)
################################################################################
-
-jdk.crypto.pkcs11: $(SECURITY_PKCS11_LIBRARIES)
-
-all: jdk.crypto.pkcs11
-
-.PHONY: all jdk.crypto.pkcs11
--- a/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -23,8 +23,7 @@
# questions.
#
-include $(SPEC)
-include $(JDK_TOPDIR)/make/lib/LibCommon.gmk
+include LibCommon.gmk
################################################################################
@@ -49,14 +48,8 @@
$(BUILD_LIBJ2UCRYPTO): $(BUILD_LIBJAVA)
- SECURITY_UCRYPTO_LIBRARIES += $(BUILD_LIBJ2UCRYPTO)
+ TARGETS += $(BUILD_LIBJ2UCRYPTO)
endif
################################################################################
-
-jdk.crypto.ucrypto: $(SECURITY_UCRYPTO_LIBRARIES)
-
-all: jdk.crypto.ucrypto
-
-.PHONY: all jdk.crypto.ucrypto
--- a/jdk/make/lib/Lib-jdk.deploy.osx.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-jdk.deploy.osx.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -39,19 +39,19 @@
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
-I$(LIBAPPLESCRIPTENGINE_SRC) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.deploy.osx, \
+ -I$(SUPPORT_OUTPUTDIR)/headers/jdk.deploy.osx, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX := -framework Cocoa \
-framework Carbon \
-framework JavaNativeFoundation \
$(LDFLAGS_JDKLIB_SUFFIX), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libAppleScriptEngine, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libAppleScriptEngine, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- $(BUILD_LIBAPPLESCRIPTENGINE): $(BUILD_LIBJAVA)
+ $(BUILD_LIBAPPLESCRIPTENGINE): $(call FindLib, java.base, java)
- DEPLOY_OSX_LIBRARIES += $(BUILD_LIBAPPLESCRIPTENGINE)
+ TARGETS += $(BUILD_LIBAPPLESCRIPTENGINE)
################################################################################
@@ -59,8 +59,8 @@
LIBOSX_CFLAGS := -I$(LIBOSX_DIRS) \
-I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
$(LIBJAVA_HEADER_FLAGS) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.deploy.osx \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
+ -I$(SUPPORT_OUTPUTDIR)/headers/jdk.deploy.osx \
#
$(eval $(call SetupNativeCompilation,BUILD_LIBOSX, \
@@ -72,6 +72,7 @@
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBOSX_CFLAGS), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
+ -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.desktop \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX_macosx := \
-losxapp \
@@ -82,21 +83,15 @@
-framework Security \
-framework SystemConfiguration \
$(LDFLAGS_JDKLIB_SUFFIX), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libosx, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosx, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- DEPLOY_OSX_LIBRARIES += $(BUILD_LIBOSX)
+ TARGETS += $(BUILD_LIBOSX)
- $(BUILD_LIBOSX): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)osxapp$(SHARED_LIBRARY_SUFFIX)
+ $(BUILD_LIBOSX): $(call FindLib, java.desktop, osxapp)
- $(BUILD_LIBOSX): $(BUILD_LIBJAVA)
+ $(BUILD_LIBOSX): $(call FindLib, java.base, java)
################################################################################
endif
-
-jdk.deploy.osx: $(DEPLOY_OSX_LIBRARIES)
-
-all: jdk.deploy.osx
-
-.PHONY: all jdk.deploy.osx
--- a/jdk/make/lib/Lib-jdk.hprof.agent.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-jdk.hprof.agent.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -62,10 +62,10 @@
-D "JDK_FNAME=hprof.dll" \
-D "JDK_INTERNAL_NAME=hprof" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libhprof_jvmti, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libhprof_jvmti, \
DEBUG_SYMBOLS := true))
-HPROF_LIBRARIES += $(BUILD_LIBHPROF)
+TARGETS += $(BUILD_LIBHPROF)
################################################################################
@@ -88,15 +88,9 @@
-D "JDK_FNAME=java_crw_demo.dll" \
-D "JDK_INTERNAL_NAME=java_crw_demo" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjava_crw_demo, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava_crw_demo, \
DEBUG_SYMBOLS := true))
-CRW_LIBRARIES += $(BUILD_LIBJAVA_CRW_DEMO)
+TARGETS += $(BUILD_LIBJAVA_CRW_DEMO)
################################################################################
-
-jdk.hprof.agent: $(HPROF_LIBRARIES) $(CRW_LIBRARIES)
-
-all: jdk.hprof.agent
-
-.PHONY: all jdk.hprof.agent
--- a/jdk/make/lib/Lib-jdk.jdi.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-jdk.jdi.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -36,7 +36,7 @@
$(addprefix -I, $(LIBDT_SHMEM_SRC)) \
-I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \
-I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/include \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.jdi \
+ -I$(SUPPORT_OUTPUTDIR)/headers/jdk.jdi \
#
$(eval $(call SetupNativeCompilation,BUILD_LIBDT_SHMEM, \
@@ -55,17 +55,11 @@
-D "JDK_FNAME=dt_shmem.dll" \
-D "JDK_INTERNAL_NAME=dt_shmem" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libdt_shmem, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libdt_shmem, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- JDI_TRANSPORT_LIBRARIES += $(BUILD_LIBDT_SHMEM)
+ TARGETS += $(BUILD_LIBDT_SHMEM)
endif # OPENJDK_TARGET_OS
################################################################################
-
-jdk.jdi: $(JDI_TRANSPORT_LIBRARIES)
-
-all: jdk.jdi
-
-.PHONY: all jdk.jdi
--- a/jdk/make/lib/Lib-jdk.jdwp.agent.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-jdk.jdwp.agent.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -55,13 +55,13 @@
-D "JDK_FNAME=dt_socket.dll" \
-D "JDK_INTERNAL_NAME=dt_socket" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libdt_socket, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libdt_socket, \
DEBUG_SYMBOLS := true))
-$(BUILD_LIBDT_SOCKET): $(BUILD_LIBJAVA)
+$(BUILD_LIBDT_SOCKET): $(call FindLib, java.base, java)
# Include socket transport with JDWP agent to allow for remote debugging
-JDWP_LIBRARIES += $(BUILD_LIBDT_SOCKET)
+TARGETS += $(BUILD_LIBDT_SOCKET)
################################################################################
@@ -81,7 +81,7 @@
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DJDWP_LOGGING \
$(LIBJDWP_CPPFLAGS) \
- -I$(JDK_OUTPUTDIR)/gensrc_jdwp_headers, \
+ -I$(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjdwp/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -94,17 +94,11 @@
-D "JDK_FNAME=jdwp.dll" \
-D "JDK_INTERNAL_NAME=jdwp" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjdwp, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjdwp, \
DEBUG_SYMBOLS := true))
-$(BUILD_LIBJDWP): $(BUILD_LIBJAVA)
+$(BUILD_LIBJDWP): $(call FindLib, java.base, java)
-JDWP_LIBRARIES += $(BUILD_LIBJDWP)
+TARGETS += $(BUILD_LIBJDWP)
################################################################################
-
-jdk.jdwp.agent: $(JDWP_LIBRARIES)
-
-all: jdk.jdwp.agent
-
-.PHONY: all jdk.jdwp.agent
--- a/jdk/make/lib/Lib-jdk.runtime.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-jdk.runtime.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -36,17 +36,17 @@
OPTIMIZATION := LOW, \
CFLAGS := $(CXXFLAGS_JDKLIB) \
-DNO_ZLIB -DUNPACK_JNI -DFULL \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-I$(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \
$(LIBJAVA_HEADER_FLAGS), \
CFLAGS_release := -DPRODUCT, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_windows := -map:$(JDK_OUTPUTDIR)/objs/unpack.map -debug \
+ LDFLAGS_windows := -map:$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpack.map -debug \
jvm.lib $(WIN_JAVA_LIB), \
LDFLAGS_SUFFIX_posix := -ljvm $(LIBCXX) -ljava -lc, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libunpack, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libunpack, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=unpack.dll" \
@@ -54,9 +54,9 @@
-D "JDK_FTYPE=0x2L", \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-$(BUILD_LIBUNPACK): $(BUILD_LIBJAVA)
+$(BUILD_LIBUNPACK): $(call FindLib, java.base, java)
-UNPACK_LIBRARIES += $(BUILD_LIBUNPACK)
+TARGETS += $(BUILD_LIBUNPACK)
################################################################################
@@ -72,7 +72,7 @@
CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
$(addprefix -I, $(LIBJSDT_SRC)) \
$(LIBJAVA_HEADER_FLAGS) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.runtime, \
+ -I$(SUPPORT_OUTPUTDIR)/headers/jdk.runtime, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsdt/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -85,17 +85,11 @@
-D "JDK_FNAME=jsdt.dll" \
-D "JDK_INTERNAL_NAME=jsdt" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsdt, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsdt, \
DEBUG_SYMBOLS := true))
-$(BUILD_LIBJSDT): $(BUILD_LIBJAVA)
+$(BUILD_LIBJSDT): $(call FindLib, java.base, java)
-JSDT_LIBRARIES += $(BUILD_LIBJSDT)
+TARGETS += $(BUILD_LIBJSDT)
################################################################################
-
-jdk.runtime: $(JSDT_LIBRARIES) $(UNPACK_LIBRARIES)
-
-all: jdk.runtime
-
-.PHONY: all jdk.runtime
--- a/jdk/make/lib/Lib-jdk.sctp.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-jdk.sctp.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -48,8 +48,8 @@
-I $(JDK_TOPDIR)/src/java.base/share/native/libnio/ch \
$(addprefix -I, $(call FindSrcDirsForLib, java.base, net)) \
$(LIBJAVA_HEADER_FLAGS) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.sctp \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base, \
+ -I$(SUPPORT_OUTPUTDIR)/headers/jdk.sctp \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
CFLAGS_linux := $(SCTP_WERROR), \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsctp/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -58,19 +58,13 @@
LDFLAGS_SUFFIX_posix := -lnio -lnet, \
LDFLAGS_SUFFIX_solaris := -lsocket -ljava -ljvm -lc, \
LDFLAGS_SUFFIX_macosx := -ljava -ljvm, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsctp, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsctp, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- SCTP_LIBRARIES += $(BUILD_LIBSCTP)
+ TARGETS += $(BUILD_LIBSCTP)
- $(BUILD_LIBSCTP): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)nio$(SHARED_LIBRARY_SUFFIX)
+ $(BUILD_LIBSCTP): $(call FindLib, java.base, nio)
endif
endif
################################################################################
-
-jdk.sctp: $(SCTP_LIBRARIES)
-
-all: jdk.sctp
-
-.PHONY: all jdk.sctp
--- a/jdk/make/lib/Lib-jdk.security.auth.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/Lib-jdk.security.auth.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -46,7 +46,7 @@
SRC := $(JDK_TOPDIR)/src/jdk.security.auth/$(OPENJDK_TARGET_OS_API_DIR)/native/libjaas, \
LANG := C, \
OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.security.auth, \
+ CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/jdk.security.auth, \
MAPFILE := $(LIBJAAS_MAPFILE), \
LDFLAGS := $(filter-out -ljava, $(LDFLAGS_JDKLIB)) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -59,17 +59,11 @@
-D "JDK_FNAME=$(LIBJAAS_NAME).dll" \
-D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjaas, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjaas, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-$(BUILD_LIBJAAS): $(BUILD_LIBJAVA)
+$(BUILD_LIBJAAS): $(call FindLib, java.base, java)
-SECURITY_JAAS_LIBRARIES += $(BUILD_LIBJAAS)
+TARGETS += $(BUILD_LIBJAAS)
################################################################################
-
-jdk.security.auth: $(SECURITY_JAAS_LIBRARIES)
-
-all: jdk.security.auth
-
-.PHONY: all jdk.security.auth
--- a/jdk/make/lib/LibCommon.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/LibCommon.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -23,8 +23,6 @@
# questions.
#
-default: all
-
include $(SPEC)
include MakeBase.gmk
include NativeCompilation.gmk
@@ -34,16 +32,9 @@
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
-# Put the libraries here. Different locations for different target apis.
-ifeq ($(OPENJDK_TARGET_OS_API), posix)
- INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
-else
- INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/bin
-endif
-
# Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
# elegant solution to this.
-WIN_JAVA_LIB := $(JDK_OUTPUTDIR)/objs/libjava/java.lib
+WIN_JAVA_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib
# Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
# not on other platforms.
@@ -57,24 +48,45 @@
endif
################################################################################
-
# Find the default set of src dirs for a native library.
# Param 1 - module name
# Param 2 - library name
-FindSrcDirsForLib = $(call uniq, $(wildcard \
- $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
- $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_API_DIR)/native/lib$(strip $2) \
- $(JDK_TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
+define FindSrcDirsForLib
+ $(call uniq, $(wildcard \
+ $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
+ $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_API_DIR)/native/lib$(strip $2) \
+ $(JDK_TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
+endef
################################################################################
+# Find lib dir for module
+# Param 1 - module name
+ifeq ($(OPENJDK_TARGET_OS_API), posix)
+ define FindLibDirForModule
+ $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)$(OPENJDK_TARGET_CPU_LIBDIR)
+ endef
+else
+ define FindLibDirForModule
+ $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
+ endef
+endif
-# A lot of libraries are dependent on libjava. Define the name of that
-# library here to make dependency declarations to it possible in other files.
-BUILD_LIBJAVA := $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)java$(SHARED_LIBRARY_SUFFIX)
+################################################################################
+# Find a library
+# Param 1 - module name
+# Param 2 - library name
+# Param 3 - subdir for library
+define FindLib
+ $(call FindLibDirForModule, $(strip $1))$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(SHARED_LIBRARY_SUFFIX)
+endef
-# Also define the header include flags needed to compile against it.
+################################################################################
+# Define the header include flags needed to compile against it.
LIBJAVA_HEADER_FLAGS := $(addprefix -I, $(call FindSrcDirsForLib, java.base, java))
+# Put the libraries here.
+INSTALL_LIBRARIES_HERE := $(call FindLibDirForModule, $(MODULE))
+
################################################################################
# Define it here since there are multiple uses.
--- a/jdk/make/lib/NetworkingLibraries.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/NetworkingLibraries.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -25,7 +25,7 @@
LIBNET_SRC_DIRS := $(JDK_TOPDIR)/src/java.base/share/native/libnet \
$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnet
-LIBNET_CFLAGS += -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \
+LIBNET_CFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
$(LIBJAVA_HEADER_FLAGS)
LIBNET_CFLAGS += $(foreach dir, $(LIBNET_SRC_DIRS), -I$(dir))
@@ -71,10 +71,10 @@
-D "JDK_FNAME=net.dll" \
-D "JDK_INTERNAL_NAME=net" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libnet, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
$(BUILD_LIBNET): $(BUILD_LIBJAVA)
-BASE_LIBRARIES += $(BUILD_LIBNET)
+TARGETS += $(BUILD_LIBNET)
--- a/jdk/make/lib/NioLibraries.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/NioLibraries.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -35,7 +35,7 @@
BUILD_LIBNIO_CFLAGS := \
$(addprefix -I, $(BUILD_LIBNIO_SRC)) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
$(LIBJAVA_HEADER_FLAGS) \
$(addprefix -I, $(BUILD_LIBNET_SRC))
@@ -78,7 +78,7 @@
LDFLAGS_SUFFIX_solaris := -ljvm -lsocket -lposix4 $(LIBDL) \
-lsendfile -ljava -lnet -lc, \
LDFLAGS_SUFFIX_windows := jvm.lib ws2_32.lib $(WIN_JAVA_LIB) \
- $(JDK_OUTPUTDIR)/objs/libnet/net.lib \
+ $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet/net.lib \
advapi32.lib, \
LDFLAGS_SUFFIX_macosx := -ljava -lnet -pthread -framework CoreFoundation, \
LDFLAGS_SUFFIX :=, \
@@ -87,10 +87,10 @@
-D "JDK_FNAME=nio.dll" \
-D "JDK_INTERNAL_NAME=nio" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libnio, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnio, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-BASE_LIBRARIES += $(BUILD_LIBNIO)
+TARGETS += $(BUILD_LIBNIO)
$(BUILD_LIBNIO): $(BUILD_LIBNET)
--- a/jdk/make/lib/PlatformLibraries.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/PlatformLibraries.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -23,7 +23,7 @@
# questions.
#
-##########################################################################################
+################################################################################
ifeq ($(OPENJDK_TARGET_OS), macosx)
@@ -37,7 +37,7 @@
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(addprefix -I, $(LIBOSXAPP_SRC)) \
- -I$(JDK_OUTPUTDIR)/gensrc_headers_icons, \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX_macosx := \
@@ -53,10 +53,10 @@
-framework OpenGL \
-framework IOSurface \
-framework QuartzCore, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libosxapp, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxapp, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
- DESKTOP_LIBRARIES += $(BUILD_LIBOSXAPP)
+ TARGETS += $(BUILD_LIBOSXAPP)
endif
--- a/jdk/make/lib/SoundLibraries.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/lib/SoundLibraries.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -28,7 +28,7 @@
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjsound \
#
LIBJSOUND_CFLAGS := \
- -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
$(LIBJAVA_HEADER_FLAGS) \
$(foreach dir, $(LIBJSOUND_SRC_DIRS), -I$(dir)) \
#
@@ -172,12 +172,12 @@
-D "JDK_FNAME=jsound.dll" \
-D "JDK_INTERNAL_NAME=jsound" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsound, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsound, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
$(BUILD_LIBJSOUND): $(BUILD_LIBJAVA)
-DESKTOP_LIBRARIES += $(BUILD_LIBJSOUND)
+TARGETS += $(BUILD_LIBJSOUND)
##########################################################################################
@@ -208,12 +208,12 @@
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX := $(ALSA_LIBS) -ljava -ljvm, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsoundalsa, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundalsa, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
$(BUILD_LIBJSOUNDALSA): $(BUILD_LIBJAVA)
- DESKTOP_LIBRARIES += $(BUILD_LIBJSOUNDALSA)
+ TARGETS += $(BUILD_LIBJSOUNDALSA)
endif
@@ -240,11 +240,11 @@
-D "JDK_FNAME=jsoundds.dll" \
-D "JDK_INTERNAL_NAME=jsoundds" \
-D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsoundds, \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundds, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
$(BUILD_LIBJSOUNDDS): $(BUILD_LIBJAVA)
- DESKTOP_LIBRARIES += $(BUILD_LIBJSOUNDDS)
+ TARGETS += $(BUILD_LIBJSOUNDDS)
endif
--- a/jdk/make/mapfiles/libjava/mapfile-vers Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/mapfiles/libjava/mapfile-vers Wed Jul 05 20:08:34 2017 +0200
@@ -274,6 +274,9 @@
Java_sun_misc_VM_initialize;
Java_sun_misc_VMSupport_initAgentProperties;
Java_sun_misc_VMSupport_getVMTemporaryDirectory;
+
+ Java_jdk_internal_jimage_concurrent_ConcurrentPReader_initIDs;
+ Java_jdk_internal_jimage_concurrent_ConcurrentPReader_pread;
# ZipFile.c needs this one
throwFileNotFoundException;
--- a/jdk/make/mapfiles/libzip/mapfile-vers Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/mapfiles/libzip/mapfile-vers Wed Jul 05 20:08:34 2017 +0200
@@ -72,6 +72,7 @@
ZIP_FindEntry;
ZIP_GetEntry;
ZIP_GetNextEntry;
+ ZIP_InflateFully;
ZIP_Lock;
ZIP_Open;
ZIP_Read;
--- a/jdk/make/profile-includes.txt Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,255 +0,0 @@
-#
-# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-PROFILE_1_JRE_BIN_FILES := \
- java$(EXE_SUFFIX) \
- keytool$(EXE_SUFFIX)
-
-PROFILE_1_JRE_LIB_FILES := \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)j2pkcs11$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsig.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)net$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)nio$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sunec$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)zip$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jsig.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jvm.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/Xusage.txt \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/jli/$(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/jvm.cfg \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jsig.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jvm.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/Xusage.txt \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jsig.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jvm.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/Xusage.txt \
- classlist \
- ext/localedata.jar \
- ext/meta-index \
- ext/sunec.jar \
- ext/sunjce_provider.jar \
- ext/sunpkcs11.jar \
- jce.jar \
- jsse.jar \
- logging.properties \
- meta-index \
- net.properties \
- resources.jar \
- rt.jar \
- security/US_export_policy.jar \
- security/blacklist \
- security/blacklisted.certs \
- security/cacerts \
- security/java.policy \
- security/java.security \
- security/local_policy.jar \
- security/trusted.libraries \
- tzdb.dat
-
-ifndef OPENJDK
-PROFILE_1_JRE_LIB_FILES += \
- security/unlimited_policy/README.txt \
- security/unlimited_policy/US_export_policy.jar \
- security/unlimited_policy/local_policy.jar
-endif
-
-PROFILE_1_JRE_OTHER_FILES := \
- COPYRIGHT \
- LICENSE \
- README \
- THIRDPARTYLICENSEREADME.txt \
- Welcome.html \
- release
-
-PROFILE_1_JRE_JAR_FILES := \
- ext/localedata.jar \
- ext/sunec.jar \
- ext/sunjce_provider.jar \
- ext/sunpkcs11.jar \
- jce.jar \
- jsse.jar \
- resources.jar \
- rt.jar \
- security/US_export_policy.jar \
- security/local_policy.jar
-
-ifndef OPENJDK
-PROFILE_1_JRE_JAR_FILES += \
- security/unlimited_policy/US_export_policy.jar \
- security/unlimited_policy/local_policy.jar
-endif
-
-PROFILE_2_JRE_BIN_FILES := \
- rmid$(EXE_SUFFIX) \
- rmiregistry$(EXE_SUFFIX)
-
-PROFILE_2_JRE_LIB_FILES :=
-
-PROFILE_2_JRE_OTHER_FILES :=
-
-PROFILE_2_JRE_JAR_FILES :=
-
-
-PROFILE_3_JRE_BIN_FILES :=
-
-PROFILE_3_JRE_LIB_FILES := \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)hprof$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)hprof.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)instrument$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)instrument.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)j2gss$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)j2pcsc$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jaas_unix$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)prefs$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sctp$(SHARED_LIBRARY_SUFFIX) \
- jvm.hprof.txt \
- management/jmxremote.access \
- management/jmxremote.password.template \
- management/management.properties \
- management/snmp.acl.template
-
-PROFILE_3_JRE_OTHER_FILES :=
-
-PROFILE_3_JRE_JAR_FILES :=
-
-
-FULL_JRE_BIN_FILES := \
- orbd$(EXE_SUFFIX) \
- pack200$(EXE_SUFFIX) \
- policytool$(EXE_SUFFIX) \
- servertool$(EXE_SUFFIX) \
- tnameserv$(EXE_SUFFIX) \
- unpack200$(EXE_SUFFIX)
-
-FULL_JRE_LIB_FILES := \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt_xawt$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)dcpr$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)dt_socket$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)dt_socket.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)fontmanager$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jawt$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jdwp$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jfr$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jpeg$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsound$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsoundalsa$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)kcms$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)mlib_image$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)splashscreen$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)t2k$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX) \
- charsets.jar \
- ext/cldrdata.jar \
- ext/dnsns.jar \
- ext/nashorn.jar \
- ext/zipfs.jar \
- fontconfig.RedHat.5.bfc \
- fontconfig.RedHat.5.properties.src \
- fontconfig.RedHat.6.bfc \
- fontconfig.RedHat.6.properties.src \
- fontconfig.SuSE.10.bfc \
- fontconfig.SuSE.10.properties.src \
- fontconfig.SuSE.11.bfc \
- fontconfig.SuSE.11.properties.src \
- fontconfig.Turbo.bfc \
- fontconfig.Turbo.properties.src \
- fontconfig.bfc \
- fontconfig.properties.src \
- fonts/LucidaBrightDemiBold.ttf \
- fonts/LucidaBrightDemiItalic.ttf \
- fonts/LucidaBrightItalic.ttf \
- fonts/LucidaBrightRegular.ttf \
- fonts/LucidaSansDemiBold.ttf \
- fonts/LucidaSansRegular.ttf \
- fonts/LucidaTypewriterBold.ttf \
- fonts/LucidaTypewriterRegular.ttf \
- fonts/fonts.dir \
- images/cursors/cursors.properties \
- images/cursors/invalid32x32.gif \
- images/cursors/motif_CopyDrop32x32.gif \
- images/cursors/motif_CopyNoDrop32x32.gif \
- images/cursors/motif_LinkDrop32x32.gif \
- images/cursors/motif_LinkNoDrop32x32.gif \
- images/cursors/motif_MoveDrop32x32.gif \
- images/cursors/motif_MoveNoDrop32x32.gif \
- jexec \
- jfr.jar \
- oblique-fonts/LucidaSansDemiOblique.ttf \
- oblique-fonts/LucidaSansOblique.ttf \
- oblique-fonts/LucidaTypewriterBoldOblique.ttf \
- oblique-fonts/LucidaTypewriterOblique.ttf \
- oblique-fonts/fonts.dir \
- psfont.properties.ja \
- psfontj2d.properties \
- sound.properties
-
-FULL_JRE_OTHER_FILES := \
- man/ja_JP.UTF-8/man1/java.1 \
- man/ja_JP.UTF-8/man1/javaws.1 \
- man/ja_JP.UTF-8/man1/keytool.1 \
- man/ja_JP.UTF-8/man1/orbd.1 \
- man/ja_JP.UTF-8/man1/pack200.1 \
- man/ja_JP.UTF-8/man1/policytool.1 \
- man/ja_JP.UTF-8/man1/rmid.1 \
- man/ja_JP.UTF-8/man1/rmiregistry.1 \
- man/ja_JP.UTF-8/man1/servertool.1 \
- man/ja_JP.UTF-8/man1/tnameserv.1 \
- man/ja_JP.UTF-8/man1/unpack200.1 \
- man/man1/java.1 \
- man/man1/javaws.1 \
- man/man1/keytool.1 \
- man/man1/orbd.1 \
- man/man1/pack200.1 \
- man/man1/policytool.1 \
- man/man1/rmid.1 \
- man/man1/rmiregistry.1 \
- man/man1/servertool.1 \
- man/man1/tnameserv.1 \
- man/man1/unpack200.1
-
-FULL_JRE_JAR_FILES := \
- charsets.jar \
- ext/cldrdata.jar \
- ext/dnsns.jar \
- ext/nashorn.jar \
- ext/zipfs.jar \
- jfr.jar
--- a/jdk/make/profile-rtjar-includes.txt Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,245 +0,0 @@
-#
-# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# Included or excluded types must take one of two forms
-# - *.class to indicate all classes; or else
-# - a full single type name e.g.
-# javax/management/remote/rmi/_RMIServer_Stub.class
-# You can not use arbitrary wildcards like _RMI*.class.
-#
-# Notes:
-# - Nested types must use $$ in place of $ as $ is the make meta-character
-# - If a package is not listed in any profile's inclusion list then it will
-# not appear in any profile. But if a package is also missing from the
-# full JRE's inclusion list then it will still be part of the full JRE.
-# This is because the full JRE's inclusion lists are only used to define
-# the exclusion lists for profiles; they are not used to define the full
-# JRE contents - that is still done with the pre-profile legacy mechanism
-# (all packagesthat can be found, less those not intended for rt.jar).
-# This was done to minimize the impact of profiles on the regular
-# non-profile build.
-#
-PROFILE_1_RTJAR_INCLUDE_PACKAGES := \
- com/sun/demo/jvmti/hprof \
- com/sun/java/util/jar/pack \
- com/sun/net/ssl \
- com/sun/nio/file \
- com/sun/security/cert/internal/x509 \
- java/io \
- java/lang \
- java/math \
- java/net \
- java/nio \
- java/security \
- java/text \
- java/time \
- java/util \
- javax/net \
- javax/script \
- javax/security \
- jdk \
- sun/invoke \
- sun/launcher \
- sun/misc \
- sun/net/ \
- sun/nio \
- sun/reflect \
- sun/security \
- sun/text \
- sun/usagetracker \
- sun/util
-
-PROFILE_1_RTJAR_INCLUDE_TYPES :=
-
-PROFILE_1_RTJAR_EXCLUDE_TYPES :=
-
-PROFILE_1_INCLUDE_METAINF_SERVICES :=
-
-
-PROFILE_2_RTJAR_INCLUDE_PACKAGES := \
- com/sun/java_cup/internal/runtime \
- com/sun/net/httpserver \
- com/sun/org/apache \
- com/sun/rmi/rmid \
- com/sun/xml/internal/stream \
- java/rmi \
- java/sql \
- javax/rmi/ssl \
- javax/sql \
- javax/transaction/xa \
- javax/xml \
- org/w3c \
- org/xml/sax \
- sun/net/httpserver \
- sun/rmi \
- sun/util/xml
-
-PROFILE_2_RTJAR_INCLUDE_TYPES :=
-
-PROFILE_2_RTJAR_EXCLUDE_TYPES :=
-
-PROFILE_2_INCLUDE_METAINF_SERVICES :=
-
-PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
- com/sun/jmx \
- com/sun/jndi \
- com/sun/management \
- com/sun/naming/internal \
- com/sun/nio/sctp \
- com/sun/org/apache/xml/internal/security \
- com/sun/rowset \
- com/sun/security/auth \
- com/sun/security/jgss \
- com/sun/security/ntlm \
- com/sun/security/sasl \
- com/sun/tracing \
- jdk/management/cmm \
- java/lang/instrument \
- java/lang/management \
- java/security/acl \
- java/util/prefs \
- javax/annotation/processing \
- javax/lang/model \
- javax/management \
- javax/naming \
- javax/security/auth/kerberos \
- javax/security/sasl \
- javax/smartcardio \
- javax/sql/rowset \
- javax/tools \
- javax/xml/crypto \
- org/ietf/jgss \
- org/jcp/xml \
- sun/instrument \
- sun/management \
- sun/net/dns \
- sun/net/www/protocol/http/ntlm \
- sun/net/www/protocol/http/spnego \
- sun/nio/ch/sctp \
- sun/security/acl \
- sun/security/jgss \
- sun/security/krb5 \
- sun/security/provider/certpath/ldap \
- sun/security/smartcardio \
- sun/tracing
-
-PROFILE_3_RTJAR_INCLUDE_TYPES :=
-
-PROFILE_3_RTJAR_EXCLUDE_TYPES := \
- javax/management/remote/rmi/_RMIConnectionImpl_Tie.class \
- javax/management/remote/rmi/_RMIConnection_Stub.class \
- javax/management/remote/rmi/_RMIServerImpl_Tie.class \
- javax/management/remote/rmi/_RMIServer_Stub.class
-
-FULL_JRE_RTJAR_INCLUDE_PACKAGES := \
- com/oracle \
- com/sun/accessibility/internal/resources \
- com/sun/activation/registries \
- com/sun/awt \
- com/sun/beans \
- com/sun/corba \
- com/sun/image/codec/jpeg \
- com/sun/imageio \
- com/sun/istack \
- com/sun/java/browser \
- com/sun/java/swing \
- com/sun/jmx/remote/protocol/iiop \
- com/sun/jndi/cosnaming \
- com/sun/jndi/toolkit/corba \
- com/sun/jndi/url/corbaname \
- com/sun/jndi/url/iiop \
- com/sun/jndi/url/iiopname \
- com/sun/media/sound \
- com/sun/org/glassfish \
- com/sun/org/omg \
- com/sun/swing \
- com/sun/xml/internal/bind \
- com/sun/xml/internal/fastinfoset \
- com/sun/xml/internal/messaging \
- com/sun/xml/internal/org \
- com/sun/xml/internal/stream/buffer \
- com/sun/xml/internal/txw2 \
- com/sun/xml/internal/ws \
- java/applet \
- java/awt \
- java/beans \
- javax/accessibility \
- javax/activation \
- javax/activity \
- javax/imageio \
- javax/jws \
- javax/print \
- javax/rmi/CORBA \
- javax/sound \
- javax/swing \
- javax/xml/bind \
- javax/xml/soap \
- javax/xml/ws \
- org/omg \
- sun/applet \
- sun/audio \
- sun/awt \
- sun/corba \
- sun/datatransfer \
- sun/dc \
- sun/font \
- sun/java2d \
- sun/net/ftp \
- sun/net/smtp \
- sun/net/www/content/audio \
- sun/net/www/content/image \
- sun/net/www/content/text \
- sun/net/www/protocol/ftp \
- sun/net/www/protocol/mailto \
- sun/net/www/protocol/netdoc \
- sun/print \
- sun/security/tools/policytool \
- sun/swing \
- sun/tools/jar
-
-FULL_JRE_RTJAR_INCLUDE_TYPES := \
- javax/annotation/*.class \
- javax/management/remote/rmi/_RMIConnectionImpl_Tie.class \
- javax/management/remote/rmi/_RMIConnection_Stub.class \
- javax/management/remote/rmi/_RMIServerImpl_Tie.class \
- javax/management/remote/rmi/_RMIServer_Stub.class \
- javax/rmi/*.class \
- javax/transaction/*.class
-
-FULL_JRE_RTJAR_EXCLUDE_TYPES :=
-
-FULL_JRE_INCLUDE_METAINF_SERVICES := \
- META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin \
- META-INF/services/com.sun.tools.internal.xjc.Plugin \
- META-INF/services/javax.print.PrintServiceLookup \
- META-INF/services/javax.print.StreamPrintServiceFactory \
- META-INF/services/javax.sound.midi.spi.MidiDeviceProvider \
- META-INF/services/javax.sound.midi.spi.MidiFileReader \
- META-INF/services/javax.sound.midi.spi.MidiFileWriter \
- META-INF/services/javax.sound.midi.spi.SoundbankReader \
- META-INF/services/javax.sound.sampled.spi.AudioFileReader \
- META-INF/services/javax.sound.sampled.spi.AudioFileWriter \
- META-INF/services/javax.sound.sampled.spi.FormatConversionProvider \
- META-INF/services/javax.sound.sampled.spi.MixerProvider
--- a/jdk/make/rmic/Rmic-java.management.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/rmic/Rmic-java.management.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -54,7 +54,7 @@
$(eval $(call SetupRMICompilation,RMI_SRC, \
CLASSES := $(JMX_RMI_CLASSES), \
CLASSES_DIR := $(CLASSES_DIR)/java.management, \
- STUB_CLASSES_DIR := $(RMIC_GENSRC_DIR), \
+ STUB_CLASSES_DIR := $(RMIC_GENSRC_DIR)/java.management, \
RUN_V12 := true, \
KEEP_GENERATED := true))
--- a/jdk/make/rmic/RmicCommon.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/rmic/RmicCommon.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -31,7 +31,7 @@
##########################################################################################
-BTRMIC_CP := $(INTERIM_CORBA_JAR)$(PATH_SEP)$(JDK_OUTPUTDIR)/interim_rmic_classes$(PATH_SEP)$(INTERIM_LANGTOOLS_JAR)
+BTRMIC_CP := $(INTERIM_CORBA_JAR)$(PATH_SEP)$(BUILDTOOLS_OUTPUTDIR)/interim_rmic_classes$(PATH_SEP)$(INTERIM_LANGTOOLS_JAR)
BTRMIC_ARGS := "-Xbootclasspath/p:$(BTRMIC_CP)" -cp "$(BTRMIC_CP)"
RMIC := $(JAVA) $(BTRMIC_ARGS) sun.rmi.rmic.Main
@@ -39,6 +39,6 @@
# NOTE: If the smart javac dependency management is reintroduced, these classes risk
# interfering with the dependency checking. In that case they will need to be kept separate.
STUB_CLASSES_DIR := $(JDK_OUTPUTDIR)/modules
-RMIC_GENSRC_DIR := $(JDK_OUTPUTDIR)/gendocsrc_rmic
+RMIC_GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/rmic
##########################################################################################
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/src/classes/build/tools/module/ImageBuilder.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,514 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package build.tools.module;
+
+import jdk.internal.jimage.Archive;
+import jdk.internal.jimage.ImageFile;
+import jdk.internal.jimage.ImageModules;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.UncheckedIOException;
+import java.nio.ByteOrder;
+import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.PosixFilePermission;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * A tool for building a runtime image.
+ *
+ * java build.tools.module.ImageBuilder <options> --output <path> top/modules.xml,...
+ * Possible options are:
+ * --cmds Location of native commands
+ * --configs Location of config files
+ * --help Print this usage message
+ * --classes Location of module classes files
+ * --libs Location of native libraries
+ * --mods Comma separated list of module names
+ * --output Location of the output path
+ * --endian Byte order of the target runtime; {little,big}
+ */
+class ImageBuilder {
+ static class BadArgs extends Exception {
+ private static final long serialVersionUID = 0L;
+ BadArgs(String format, Object... args) {
+ super(String.format(format, args));
+ this.format = format;
+ this.args = args;
+ }
+ BadArgs showUsage(boolean b) {
+ showUsage = b;
+ return this;
+ }
+ final String format;
+ final Object[] args;
+ boolean showUsage;
+ }
+
+ static abstract class Option {
+ final boolean hasArg;
+ final String[] aliases;
+ Option(boolean hasArg, String... aliases) {
+ this.hasArg = hasArg;
+ this.aliases = aliases;
+ }
+ boolean isHidden() {
+ return false;
+ }
+ boolean matches(String opt) {
+ for (String a : aliases) {
+ if (a.equals(opt)) {
+ return true;
+ } else if (opt.startsWith("--") && hasArg && opt.startsWith(a + "=")) {
+ return true;
+ }
+ }
+ return false;
+ }
+ boolean ignoreRest() {
+ return false;
+ }
+ abstract void process(ImageBuilder task, String opt, String arg) throws BadArgs;
+ abstract String description();
+ }
+
+ private static Path CWD = Paths.get("");
+
+ private static List<Path> splitPath(String arg, String separator)
+ throws BadArgs
+ {
+ List<Path> paths = new ArrayList<>();
+ for (String p: arg.split(separator)) {
+ if (p.length() > 0) {
+ try {
+ Path path = CWD.resolve(p);
+ if (Files.notExists(path))
+ throw new BadArgs("path not found: %s", path);
+ paths.add(path);
+ } catch (InvalidPathException x) {
+ throw new BadArgs("path not valid: %s", p);
+ }
+ }
+ }
+ return paths;
+ }
+
+ static Option[] recognizedOptions = {
+ new Option(true, "--cmds") {
+ void process(ImageBuilder task, String opt, String arg) throws BadArgs {
+ task.options.cmds = splitPath(arg, File.pathSeparator);
+ }
+ String description() { return "Location of native commands"; }
+ },
+ new Option(true, "--configs") {
+ void process(ImageBuilder task, String opt, String arg) throws BadArgs {
+ task.options.configs = splitPath(arg, File.pathSeparator);
+ }
+ String description() { return "Location of config files"; }
+ },
+ new Option(false, "--help") {
+ void process(ImageBuilder task, String opt, String arg) {
+ task.options.help = true;
+ }
+ String description() { return "Print this usage message"; }
+ },
+ new Option(true, "--classes") {
+ void process(ImageBuilder task, String opt, String arg) throws BadArgs {
+ task.options.classes = splitPath(arg, File.pathSeparator);
+ }
+ String description() { return "Location of module classes files"; }
+ },
+ new Option(true, "--libs") {
+ void process(ImageBuilder task, String opt, String arg) throws BadArgs {
+ task.options.libs = splitPath(arg, File.pathSeparator);
+ }
+ String description() { return "Location of native libraries"; }
+ },
+ new Option(true, "--mods") {
+ void process(ImageBuilder task, String opt, String arg) throws BadArgs {
+ for (String mn : arg.split(",")) {
+ if (mn.isEmpty())
+ throw new BadArgs("Module not found", mn);
+ task.options.mods.add(mn);
+ }
+ }
+ String description() { return "Comma separated list of module names"; }
+ },
+ new Option(true, "--output") {
+ void process(ImageBuilder task, String opt, String arg) throws BadArgs {
+ Path path = Paths.get(arg);
+ task.options.output = path;
+ }
+ String description() { return "Location of the output path"; }
+ },
+ new Option(true, "--endian") {
+ void process(ImageBuilder task, String opt, String arg) throws BadArgs {
+ if (arg.equals("little"))
+ task.options.endian = ByteOrder.LITTLE_ENDIAN;
+ else if (arg.equals("big"))
+ task.options.endian = ByteOrder.BIG_ENDIAN;
+ else
+ throw new BadArgs("Unknown byte order " + arg);
+ }
+ String description() { return "Byte order of the target runtime; {little,big}"; }
+ }
+ };
+
+ private final Options options = new Options();
+
+ private PrintWriter log;
+ void setLog(PrintWriter out) {
+ log = out;
+ }
+
+ Set<Module> moduleGraph = new java.util.HashSet<>();
+
+ /** Module list files */
+ private static final String BOOT_MODULES = "boot.modules";
+ private static final String EXT_MODULES = "ext.modules";
+
+ /**
+ * Result codes.
+ */
+ static final int EXIT_OK = 0, // Completed with no errors.
+ EXIT_ERROR = 1, // Completed but reported errors.
+ EXIT_CMDERR = 2, // Bad command-line arguments
+ EXIT_SYSERR = 3, // System error or resource exhaustion.
+ EXIT_ABNORMAL = 4; // terminated abnormally
+
+
+ static class Options {
+ boolean help;
+ List<Path> classes;
+ List<Path> cmds;
+ List<Path> configs;
+ List<Path> libs;
+ Set<String> mods = new HashSet<>();
+ Path output;
+ ByteOrder endian = ByteOrder.nativeOrder(); // default, if not specified
+ }
+
+ public static void main(String[] args) throws Exception {
+ ImageBuilder builder = new ImageBuilder();
+ int rc = builder.run(args);
+ System.exit(rc);
+ }
+
+ int run(String[] args) {
+ if (log == null)
+ log = new PrintWriter(System.out);
+
+ try {
+ handleOptions(args);
+ if (options.help) {
+ showHelp();
+ return EXIT_OK;
+ }
+
+ if (options.classes == null)
+ throw new BadArgs("--classes must be specified").showUsage(true);
+
+ Path output = options.output;
+ if (output == null)
+ throw new BadArgs("--output must be specified").showUsage(true);
+ Files.createDirectories(output);
+ if (Files.list(output).findFirst().isPresent())
+ throw new BadArgs("dir not empty", output);
+
+ if (options.mods.isEmpty())
+ throw new BadArgs("--mods must be specified").showUsage(true);
+
+ if (moduleGraph.isEmpty())
+ throw new BadArgs("modules.xml must be specified").showUsage(true);
+
+ if (options.cmds == null || options.cmds.isEmpty())
+ warning("--commands is not set");
+ if (options.libs == null || options.libs.isEmpty())
+ warning("--libs is not set");
+ //if (options.configs == null || options.configs.isEmpty())
+ // warning("--configs is not set");
+
+ // additional option combination validation
+
+ boolean ok = run();
+ return ok ? EXIT_OK : EXIT_ERROR;
+ } catch (BadArgs e) {
+ reportError(e.format, e.args);
+ if (e.showUsage)
+ log.println(USAGE_SUMMARY);
+ return EXIT_CMDERR;
+ } catch (Exception x) {
+ x.printStackTrace();
+ return EXIT_ABNORMAL;
+ } finally {
+ log.flush();
+ }
+ }
+
+ private boolean run() throws IOException {
+ createImage();
+ return true;
+ }
+
+ class SimpleResolver {
+ private final Set<Module> initialMods;
+ private final Map<String,Module> nameToModule = new HashMap<>();
+
+ SimpleResolver(Set<String> mods, Set<Module> graph) {
+ graph.stream()
+ .forEach(m -> nameToModule.put(m.name(), m));
+ initialMods = mods.stream()
+ .map(this::nameToModule)
+ .collect(Collectors.toSet());
+ }
+
+ /** Returns the transitive closure, in topological order */
+ List<String> resolve() {
+ List<Module> result = new LinkedList<>();
+ Set<Module> visited = new HashSet<>();
+ Set<Module> done = new HashSet<>();
+ for (Module m : initialMods) {
+ if (!visited.contains(m))
+ visit(m, visited, result, done);
+ }
+ return result.stream()
+ .map(m -> m.name())
+ .collect(Collectors.toList());
+ }
+
+ private void visit(Module m, Set<Module> visited,
+ List<Module> result, Set<Module> done) {
+ if (visited.contains(m)) {
+ if (!done.contains(m))
+ throw new IllegalArgumentException("Cyclic detected: " +
+ m + " " + getModuleDependences(m));
+ return;
+ }
+ visited.add(m);
+ getModuleDependences(m).stream()
+ .forEach(d -> visit(d, visited, result, done));
+ done.add(m);
+ result.add(m);
+ }
+
+ private Module nameToModule(String name) {
+ Module m = nameToModule.get(name);
+ if (m == null)
+ throw new RuntimeException("No module definition for " + name);
+ return m;
+ }
+
+ private Set<Module> getModuleDependences(Module m) {
+ return m.requires().stream()
+ .map(d -> d.name())
+ .map(this::nameToModule)
+ .collect(Collectors.toSet());
+ }
+ }
+
+ private List<String> resolve(Set<String> mods ) {
+ return (new SimpleResolver(mods, moduleGraph)).resolve();
+ }
+
+ /**
+ * chmod ugo+x file
+ */
+ private void setExecutable(Path file) {
+ try {
+ Set<PosixFilePermission> perms = Files.getPosixFilePermissions(file);
+ perms.add(PosixFilePermission.OWNER_EXECUTE);
+ perms.add(PosixFilePermission.GROUP_EXECUTE);
+ perms.add(PosixFilePermission.OTHERS_EXECUTE);
+ Files.setPosixFilePermissions(file, perms);
+ } catch (IOException ioe) {
+ throw new UncheckedIOException(ioe);
+ }
+ }
+
+ private void createImage() throws IOException {
+ Collection<String> modules = resolve(options.mods);
+ log.print(modules.stream().collect(Collectors.joining(" ")));
+ ImageFileHelper imageHelper = new ImageFileHelper(modules);
+ imageHelper.createModularImage(options.output);
+
+ // jspawnhelper, might be in lib or lib/ARCH
+ Path jspawnhelper = Paths.get("jspawnhelper");
+ Path lib = options.output.resolve("lib");
+ Optional<Path> helper = Files.walk(lib, 2)
+ .filter(f -> f.getFileName().equals(jspawnhelper))
+ .findFirst();
+ if (helper.isPresent())
+ setExecutable(helper.get());
+ }
+
+ private class ImageFileHelper {
+ final Collection<String> modules;
+ final Set<String> bootModules;
+ final Set<String> extModules;
+ final Set<String> appModules;
+ final ImageModules imf;
+
+ ImageFileHelper(Collection<String> modules) throws IOException {
+ this.modules = modules;
+ this.bootModules = modulesFor(BOOT_MODULES).stream()
+ .filter(modules::contains)
+ .collect(Collectors.toSet());
+ this.extModules = modulesFor(EXT_MODULES).stream()
+ .filter(modules::contains)
+ .collect(Collectors.toSet());
+ this.appModules = modules.stream()
+ .filter(m -> !bootModules.contains(m) && !extModules.contains(m))
+ .collect(Collectors.toSet());
+
+ this.imf = new ImageModules(bootModules, extModules, appModules);
+ }
+
+ void createModularImage(Path output) throws IOException {
+ Set<Archive> archives = modules.stream()
+ .map(this::toModuleArchive)
+ .collect(Collectors.toSet());
+ ImageFile.create(output, archives, imf, options.endian);
+ }
+
+ ModuleArchive toModuleArchive(String mn) {
+ return new ModuleArchive(mn,
+ moduleToPath(mn, options.classes, false/*true*/),
+ moduleToPath(mn, options.cmds, false),
+ moduleToPath(mn, options.libs, false),
+ moduleToPath(mn, options.configs, false));
+ }
+
+ private Path moduleToPath(String name, List<Path> paths, boolean expect) {
+ Set<Path> foundPaths = new HashSet<>();
+ if (paths != null) {
+ for (Path p : paths) {
+ Path rp = p.resolve(name);
+ if (Files.exists(rp))
+ foundPaths.add(rp);
+ }
+ }
+ if (foundPaths.size() > 1)
+ throw new RuntimeException("Found more that one path for " + name);
+ if (expect && foundPaths.size() != 1)
+ throw new RuntimeException("Expected to find classes path for " + name);
+ return foundPaths.size() == 0 ? null : foundPaths.iterator().next();
+ }
+
+ private List<String> modulesFor(String name) throws IOException {
+ try (InputStream is = ImageBuilder.class.getResourceAsStream(name);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
+ return reader.lines().collect(Collectors.toList());
+ }
+ }
+ }
+
+ public void handleOptions(String[] args) throws BadArgs {
+ // process options
+ for (int i=0; i < args.length; i++) {
+ if (args[i].charAt(0) == '-') {
+ String name = args[i];
+ Option option = getOption(name);
+ String param = null;
+ if (option.hasArg) {
+ if (name.startsWith("--") && name.indexOf('=') > 0) {
+ param = name.substring(name.indexOf('=') + 1, name.length());
+ } else if (i + 1 < args.length) {
+ param = args[++i];
+ }
+ if (param == null || param.isEmpty() || param.charAt(0) == '-') {
+ throw new BadArgs("Missing arg for %n", name).showUsage(true);
+ }
+ }
+ option.process(this, name, param);
+ if (option.ignoreRest()) {
+ i = args.length;
+ }
+ } else {
+ // process rest of the input arguments
+ Path p = Paths.get(args[i]);
+ try {
+ moduleGraph.addAll(ModulesXmlReader.readModules(p)
+ .stream()
+ .collect(Collectors.toSet()));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ private Option getOption(String name) throws BadArgs {
+ for (Option o : recognizedOptions) {
+ if (o.matches(name)) {
+ return o;
+ }
+ }
+ throw new BadArgs("Unknown option %s", name).showUsage(true);
+ }
+
+ private void reportError(String format, Object... args) {
+ log.format("Error: " + format + "%n", args);
+ }
+
+ private void warning(String format, Object... args) {
+ log.format("Warning: " + format + "%n", args);
+ }
+
+ private static final String USAGE =
+ "ImageBuilder <options> --output <path> path-to-modules-xml\n";
+
+ private static final String USAGE_SUMMARY =
+ USAGE + "Use --help for a list of possible options.";
+
+ private void showHelp() {
+ log.format(USAGE);
+ log.format("Possible options are:%n");
+ for (Option o : recognizedOptions) {
+ String name = o.aliases[0].substring(1); // there must always be at least one name
+ name = name.charAt(0) == '-' ? name.substring(1) : name;
+ if (o.isHidden() || name.equals("h"))
+ continue;
+
+ log.format(" --%s\t\t\t%s%n", name, o.description());
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/src/classes/build/tools/module/ModuleArchive.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package build.tools.module;
+
+import jdk.internal.jimage.Archive;
+import jdk.internal.jimage.Resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.function.Consumer;
+
+/**
+ * An Archive backed by an exploded representation on disk.
+ */
+public class ModuleArchive implements Archive {
+ private final Path classes;
+ private final Path cmds;
+ private final Path libs;
+ private final Path configs;
+ private final String moduleName;
+
+ public ModuleArchive(String moduleName, Path classes, Path cmds,
+ Path libs, Path configs) {
+ this.moduleName = moduleName;
+ this.classes = classes;
+ this.cmds = cmds;
+ this.libs = libs;
+ this.configs = configs;
+ }
+
+ @Override
+ public String moduleName() {
+ return moduleName;
+ }
+
+ @Override
+ public void visitResources(Consumer<Resource> consumer) {
+ if (classes == null)
+ return;
+ try{
+ Files.walk(classes)
+ .sorted()
+ .filter(p -> !Files.isDirectory(p)
+ && !classes.relativize(p).toString().startsWith("_the.")
+ && !classes.relativize(p).toString().equals("javac_state"))
+ .map(this::toResource)
+ .forEach(consumer::accept);
+ } catch (IOException ioe) {
+ throw new UncheckedIOException(ioe);
+ }
+ }
+
+ private Resource toResource(Path path) {
+ try {
+ return new Resource(classes.relativize(path).toString().replace('\\','/'),
+ Files.size(path),
+ 0 /* no compression support yet */);
+ } catch (IOException ioe) {
+ throw new UncheckedIOException(ioe);
+ }
+ }
+
+ private enum Section {
+ CLASSES,
+ CMDS,
+ LIBS,
+ CONFIGS
+ }
+
+ @Override
+ public void visitEntries(Consumer<Entry> consumer) {
+ try{
+ if (classes != null)
+ Files.walk(classes)
+ .sorted()
+ .filter(p -> !Files.isDirectory(p)
+ && !classes.relativize(p).toString().startsWith("_the.")
+ && !classes.relativize(p).toString().equals("javac_state"))
+ .map(p -> toEntry(p, classes, Section.CLASSES))
+ .forEach(consumer::accept);
+ if (cmds != null)
+ Files.walk(cmds)
+ .filter(p -> !Files.isDirectory(p))
+ .map(p -> toEntry(p, cmds, Section.CMDS))
+ .forEach(consumer::accept);
+ if (libs != null)
+ Files.walk(libs)
+ .filter(p -> !Files.isDirectory(p))
+ .map(p -> toEntry(p, libs, Section.LIBS))
+ .forEach(consumer::accept);
+ if (configs != null)
+ Files.walk(configs)
+ .filter(p -> !Files.isDirectory(p))
+ .map(p -> toEntry(p, configs, Section.CONFIGS))
+ .forEach(consumer::accept);
+ } catch (IOException ioe) {
+ throw new UncheckedIOException(ioe);
+ }
+ }
+
+ private static class FileEntry implements Entry {
+ private final String name;
+ private final InputStream is;
+ private final boolean isDirectory;
+ private final Section section;
+ FileEntry(String name, InputStream is,
+ boolean isDirectory, Section section) {
+ this.name = name;
+ this.is = is;
+ this.isDirectory = isDirectory;
+ this.section = section;
+ }
+ public String getName() {
+ return name;
+ }
+ public Section getSection() {
+ return section;
+ }
+ public InputStream getInputStream() {
+ return is;
+ }
+ public boolean isDirectory() {
+ return isDirectory;
+ }
+ }
+
+ private Entry toEntry(Path entryPath, Path basePath, Section section) {
+ try {
+ return new FileEntry(basePath.relativize(entryPath).toString().replace('\\', '/'),
+ Files.newInputStream(entryPath), false,
+ section);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
+ @Override
+ public Consumer<Entry> defaultImageWriter(Path path, OutputStream out) {
+ return new DefaultEntryWriter(path, out);
+ }
+
+ private static class DefaultEntryWriter implements Consumer<Archive.Entry> {
+ private final Path root;
+ private final OutputStream out;
+
+ DefaultEntryWriter(Path root, OutputStream out) {
+ this.root = root;
+ this.out = out;
+ }
+
+ @Override
+ public void accept(Archive.Entry entry) {
+ try {
+ FileEntry e = (FileEntry)entry;
+ Section section = e.getSection();
+ String filename = e.getName();
+
+ try (InputStream in = entry.getInputStream()) {
+ switch (section) {
+ case CLASSES:
+ if (!filename.startsWith("_the.") && !filename.equals("javac_state"))
+ writeEntry(in);
+ break;
+ case LIBS:
+ writeEntry(in, destFile(nativeDir(filename), filename));
+ break;
+ case CMDS:
+ Path path = destFile("bin", filename);
+ writeEntry(in, path);
+ path.toFile().setExecutable(true);
+ break;
+ case CONFIGS:
+ writeEntry(in, destFile("conf", filename));
+ break;
+ default:
+ throw new InternalError("unexpected entry: " + filename);
+ }
+ }
+ } catch (IOException x) {
+ throw new UncheckedIOException(x);
+ }
+ }
+
+ private Path destFile(String dir, String filename) {
+ return root.resolve(dir).resolve(filename);
+ }
+
+ private static void writeEntry(InputStream in, Path dstFile) throws IOException {
+ if (Files.notExists(dstFile.getParent()))
+ Files.createDirectories(dstFile.getParent());
+ Files.copy(in, dstFile);
+ }
+
+ private void writeEntry(InputStream in) throws IOException {
+ byte[] buf = new byte[8192];
+ int n;
+ while ((n = in.read(buf)) > 0)
+ out.write(buf, 0, n);
+ }
+
+ private static String nativeDir(String filename) {
+ if (System.getProperty("os.name").startsWith("Windows")) {
+ if (filename.endsWith(".dll"))
+ return "bin";
+ else
+ return "lib";
+ } else {
+ return "lib";
+ }
+ }
+ }
+}
+
--- a/jdk/make/src/classes/build/tools/module/ModulesXmlReader.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/src/classes/build/tools/module/ModulesXmlReader.java Wed Jul 05 20:08:34 2017 +0200
@@ -60,7 +60,6 @@
private static final String DEPEND = "depend";
private static final String EXPORT = "export";
private static final String TO = "to";
- private static final String INCLUDE = "include";
private static final QName REEXPORTS = new QName("re-exports");
private static Set<Module> load(InputStream in)
throws XMLStreamException, IOException
@@ -102,8 +101,6 @@
}
mb.require(getData(stream), reexports);
break;
- case INCLUDE:
- throw new RuntimeException("unexpected " + event);
case EXPORT:
pkg = getNextTag(stream, NAME);
break;
--- a/jdk/make/src/classes/build/tools/module/ModulesXmlWriter.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/make/src/classes/build/tools/module/ModulesXmlWriter.java Wed Jul 05 20:08:34 2017 +0200
@@ -54,7 +54,6 @@
private static final String DEPEND = "depend";
private static final String EXPORT = "export";
private static final String TO = "to";
- private static final String INCLUDE = "include";
private static final QName REEXPORTS = new QName("re-exports");
private static void writeXML(Set<Module> modules, Path path)
@@ -143,8 +142,6 @@
.filter(e -> !e.getValue().isEmpty())
.sorted(Map.Entry.comparingByKey())
.forEach(e -> writeExportElement(xtw, e.getKey(), e.getValue(), depth+1));
- m.packages().stream().sorted()
- .forEach(p -> writeElement(xtw, INCLUDE, p, depth+1));
writeEndElement(xtw, depth);
} catch (XMLStreamException e) {
throw new RuntimeException(e);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/src/classes/build/tools/module/boot.modules Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,35 @@
+java.base
+java.desktop
+java.activation
+java.annotations.common
+java.compiler
+java.corba
+java.instrument
+java.logging
+java.management
+java.naming
+java.prefs
+java.rmi
+java.scripting
+java.security.acl
+java.security.jgss
+java.security.sasl
+java.smartcardio
+java.sql
+java.sql.rowset
+java.xml
+java.xml.bind
+java.xml.crypto
+java.xml.soap
+java.xml.ws
+jdk.charsets
+jdk.deploy
+jdk.deploy.osx
+jdk.hprof.agent
+jdk.httpserver
+jdk.naming.rmi
+jdk.sctp
+jdk.security.auth
+jdk.security.jgss
+jdk.jfr
+jdk.snmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/src/classes/build/tools/module/ext.modules Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,9 @@
+jdk.crypto.ec
+jdk.crypto.mscapi
+jdk.crypto.pkcs11
+jdk.crypto.ucrypto
+jdk.localedata
+jdk.naming.dns
+jdk.scripting.nashorn
+jdk.zipfs
+oracle.accessbridge
--- a/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/ResultSet.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/ResultSet.java Wed Jul 05 20:08:34 2017 +0200
@@ -81,8 +81,6 @@
"java.class.path",
"java.library.path",
"java.io.tmpdir",
- "java.ext.dirs",
- "java.endorsed.dirs",
"java.util.prefs.PreferencesFactory",
"sun.java2d.fontpath",
"sun.boot.library.path",
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/META-INF/services/java.nio.file.spi.FileSystemProvider Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,1 @@
+jdk.internal.jrtfs.JrtFileSystemProvider
--- a/jdk/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -130,7 +130,7 @@
* this class and all the SPI classes in javax.crypto are
* loaded by the same class loader.) That is, unless they
* give us a SPI class that doesn't exist, say SSLFoo,
- * or someone has removed classes from the jsse.jar file.
+ * or someone has removed classes from the java.base module.
*/
Class<?> typeClassJavax;
--- a/jdk/src/java.base/share/classes/java/lang/System.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/System.java Wed Jul 05 20:08:34 2017 +0200
@@ -582,8 +582,6 @@
* <td>Default temp file path</td></tr>
* <tr><td><code>java.compiler</code></td>
* <td>Name of JIT compiler to use</td></tr>
- * <tr><td><code>java.ext.dirs</code></td>
- * <td>Path of extension directory or directories</td></tr>
* <tr><td><code>os.name</code></td>
* <td>Operating system name</td></tr>
* <tr><td><code>os.arch</code></td>
--- a/jdk/src/java.base/share/classes/java/net/URL.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/java/net/URL.java Wed Jul 05 20:08:34 2017 +0200
@@ -1106,6 +1106,11 @@
security.checkSetFactory();
}
handlers.clear();
+
+ // ensure the core protocol handlers are loaded before setting
+ // a custom URLStreamHandlerFactory
+ ensureHandlersLoaded("jrt", "jar", "file");
+
// safe publication of URLStreamHandlerFactory with volatile write
factory = fac;
}
@@ -1220,6 +1225,16 @@
}
/**
+ * Ensures that the given protocol handlers are loaded
+ */
+ private static void ensureHandlersLoaded(String... protocols) {
+ for (String protocol: protocols) {
+ getURLStreamHandler(protocol);
+ }
+ }
+
+
+ /**
* WriteObject is called to save the state of the URL to an
* ObjectOutputStream. The handler is not saved since it is
* specific to this system.
--- a/jdk/src/java.base/share/classes/java/nio/charset/spi/CharsetProvider.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/java/nio/charset/spi/CharsetProvider.java Wed Jul 05 20:08:34 2017 +0200
@@ -35,8 +35,7 @@
* <p> A charset provider is a concrete subclass of this class that has a
* zero-argument constructor and some number of associated charset
* implementation classes. Charset providers may be installed in an instance
- * of the Java platform as extensions, that is, jar files placed into any of
- * the usual extension directories. Providers may also be made available by
+ * of the Java platform as extensions. Providers may also be made available by
* adding them to the applet or application class path or by some other
* platform-specific means. Charset providers are looked up via the current
* thread's {@link java.lang.Thread#getContextClassLoader() context class
--- a/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java Wed Jul 05 20:08:34 2017 +0200
@@ -54,7 +54,7 @@
* system class loader cannot be found then the extension class loader is used;
* if there is no extension class loader then the bootstrap class loader is used.
* Providers are typically installed by placing them in a JAR file on the
- * application class path or in the extension directory, the JAR file contains a
+ * application class path, the JAR file contains a
* provider-configuration file named {@code java.nio.file.spi.FileSystemProvider}
* in the resource directory {@code META-INF/services}, and the file lists one or
* more fully-qualified names of concrete subclass of {@link FileSystemProvider}
--- a/jdk/src/java.base/share/classes/java/nio/file/Files.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/java/nio/file/Files.java Wed Jul 05 20:08:34 2017 +0200
@@ -1581,8 +1581,8 @@
* loader. If the system class loader cannot be found then the extension class
* loader is used; If the extension class loader cannot be found then the
* bootstrap class loader is used. File type detectors are typically installed
- * by placing them in a JAR file on the application class path or in the
- * extension directory, the JAR file contains a provider-configuration file
+ * by placing them in a JAR file on the application class path,
+ * the JAR file contains a provider-configuration file
* named {@code java.nio.file.spi.FileTypeDetector} in the resource directory
* {@code META-INF/services}, and the file lists one or more fully-qualified
* names of concrete subclass of {@code FileTypeDetector } that have a zero
--- a/jdk/src/java.base/share/classes/java/security/Security.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/java/security/Security.java Wed Jul 05 20:08:34 2017 +0200
@@ -212,7 +212,7 @@
// maybe check for a system property which will specify where to
// look. Someday.
String sep = File.separator;
- return new File(System.getProperty("java.home") + sep + "lib" + sep +
+ return new File(System.getProperty("java.home") + sep + "conf" + sep +
"security" + sep + filename);
}
--- a/jdk/src/java.base/share/classes/java/util/Currency.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Currency.java Wed Jul 05 20:08:34 2017 +0200
@@ -30,6 +30,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
+import java.io.InputStream;
import java.io.IOException;
import java.io.Serializable;
import java.security.AccessController;
@@ -213,8 +214,11 @@
@Override
public Void run() {
try {
- try (DataInputStream dis = new DataInputStream(
- new BufferedInputStream(getClass().getResourceAsStream("/java/util/currency.data")))) {
+ try (InputStream in = getClass().getResourceAsStream("/java/util/currency.data")) {
+ if (in == null) {
+ throw new InternalError("Currency data not found");
+ }
+ DataInputStream dis = new DataInputStream(new BufferedInputStream(in));
if (dis.readInt() != MAGIC_NUMBER) {
throw new InternalError("Currency data is possibly corrupted");
}
--- a/jdk/src/java.base/share/classes/java/util/ServiceLoader.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/java/util/ServiceLoader.java Wed Jul 05 20:08:34 2017 +0200
@@ -46,10 +46,8 @@
* <p> A <i>service</i> is a well-known set of interfaces and (usually
* abstract) classes. A <i>service provider</i> is a specific implementation
* of a service. The classes in a provider typically implement the interfaces
- * and subclass the classes defined in the service itself. Service providers
- * can be installed in an implementation of the Java platform in the form of
- * extensions, that is, jar files placed into any of the usual extension
- * directories. Providers can also be made available by adding them to the
+ * and subclass the classes defined in the service itself.
+ * Providers can be made available by adding them to the
* application's class path or by some other platform-specific means.
*
* <p> For the purpose of loading, a service is represented by a single type,
--- a/jdk/src/java.base/share/classes/java/util/jar/Attributes.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/java/util/jar/Attributes.java Wed Jul 05 20:08:34 2017 +0200
@@ -544,10 +544,9 @@
/**
* <code>Name</code> object for <code>Class-Path</code>
- * manifest attribute. Bundled extensions can use this attribute
- * to find other JAR files containing needed classes.
- * @see <a href="../../../../technotes/guides/extensions/spec.html#bundled">
- * Extensions Specification</a>
+ * manifest attribute.
+ * @see <a href="../../../../technotes/guides/jar/jar.html#classpath">
+ * JAR file specification</a>
*/
public static final Name CLASS_PATH = new Name("Class-Path");
@@ -563,96 +562,82 @@
/**
* <code>Name</code> object for <code>Sealed</code> manifest attribute
* used for sealing.
- * @see <a href="../../../../technotes/guides/extensions/spec.html#sealing">
- * Extension Sealing</a>
+ * @see <a href="../../../../technotes/guides/jar/jar.html#sealing">
+ * Package Sealing</a>
*/
public static final Name SEALED = new Name("Sealed");
/**
* <code>Name</code> object for <code>Extension-List</code> manifest attribute
- * used for declaring dependencies on installed extensions.
- * @see <a href="../../../../technotes/guides/extensions/spec.html#dependency">
- * Installed extension dependency</a>
+ * used for the extension mechanism that is no longer supported.
*/
public static final Name EXTENSION_LIST = new Name("Extension-List");
/**
- * <code>Name</code> object for <code>Extension-Name</code> manifest attribute
- * used for declaring dependencies on installed extensions.
- * @see <a href="../../../../technotes/guides/extensions/spec.html#dependency">
- * Installed extension dependency</a>
+ * <code>Name</code> object for <code>Extension-Name</code> manifest attribute.
+ * used for the extension mechanism that is no longer supported.
*/
public static final Name EXTENSION_NAME = new Name("Extension-Name");
/**
- * <code>Name</code> object for <code>Extension-Name</code> manifest attribute
- * used for declaring dependencies on installed extensions.
- * @see <a href="../../../../technotes/guides/extensions/spec.html#dependency">
- * Installed extension dependency</a>
+ * <code>Name</code> object for <code>Extension-Installation</code> manifest attribute.
+ *
+ * @deprecated Extension mechanism is no longer supported.
*/
+ @Deprecated
public static final Name EXTENSION_INSTALLATION = new Name("Extension-Installation");
/**
* <code>Name</code> object for <code>Implementation-Title</code>
* manifest attribute used for package versioning.
- * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
- * Java Product Versioning Specification</a>
*/
public static final Name IMPLEMENTATION_TITLE = new Name("Implementation-Title");
/**
* <code>Name</code> object for <code>Implementation-Version</code>
* manifest attribute used for package versioning.
- * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
- * Java Product Versioning Specification</a>
*/
public static final Name IMPLEMENTATION_VERSION = new Name("Implementation-Version");
/**
* <code>Name</code> object for <code>Implementation-Vendor</code>
* manifest attribute used for package versioning.
- * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
- * Java Product Versioning Specification</a>
*/
public static final Name IMPLEMENTATION_VENDOR = new Name("Implementation-Vendor");
/**
* <code>Name</code> object for <code>Implementation-Vendor-Id</code>
- * manifest attribute used for package versioning.
- * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
- * Java Product Versioning Specification</a>
+ * manifest attribute.
+ *
+ * @deprecated Extension mechanism is no longer supported.
*/
+ @Deprecated
public static final Name IMPLEMENTATION_VENDOR_ID = new Name("Implementation-Vendor-Id");
/**
* <code>Name</code> object for <code>Implementation-URL</code>
- * manifest attribute used for package versioning.
- * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
- * Java Product Versioning Specification</a>
+ * manifest attribute.
+ *
+ * @deprecated Extension mechanism is no longer supported.
*/
+ @Deprecated
public static final Name IMPLEMENTATION_URL = new Name("Implementation-URL");
/**
* <code>Name</code> object for <code>Specification-Title</code>
* manifest attribute used for package versioning.
- * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
- * Java Product Versioning Specification</a>
*/
public static final Name SPECIFICATION_TITLE = new Name("Specification-Title");
/**
* <code>Name</code> object for <code>Specification-Version</code>
* manifest attribute used for package versioning.
- * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
- * Java Product Versioning Specification</a>
*/
public static final Name SPECIFICATION_VERSION = new Name("Specification-Version");
/**
* <code>Name</code> object for <code>Specification-Vendor</code>
* manifest attribute used for package versioning.
- * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
- * Java Product Versioning Specification</a>
*/
public static final Name SPECIFICATION_VENDOR = new Name("Specification-Vendor");
}
--- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Wed Jul 05 20:08:34 2017 +0200
@@ -548,58 +548,15 @@
*/
private void checkForSpecialAttributes() throws IOException {
if (hasCheckedSpecialAttributes) return;
- if (!isKnownNotToHaveSpecialAttributes()) {
- JarEntry manEntry = getManEntry();
- if (manEntry != null) {
- byte[] b = getBytes(manEntry);
- if (match(CLASSPATH_CHARS, b, CLASSPATH_LASTOCC, CLASSPATH_OPTOSFT))
- hasClassPathAttribute = true;
- }
+ JarEntry manEntry = getManEntry();
+ if (manEntry != null) {
+ byte[] b = getBytes(manEntry);
+ if (match(CLASSPATH_CHARS, b, CLASSPATH_LASTOCC, CLASSPATH_OPTOSFT))
+ hasClassPathAttribute = true;
}
hasCheckedSpecialAttributes = true;
}
- private static String javaHome;
- private static volatile String[] jarNames;
- private boolean isKnownNotToHaveSpecialAttributes() {
- // Optimize away even scanning of manifest for jar files we
- // deliver which don't have a class-path attribute. If one of
- // these jars is changed to include such an attribute this code
- // must be changed.
- if (javaHome == null) {
- javaHome = AccessController.doPrivileged(
- new GetPropertyAction("java.home"));
- }
- if (jarNames == null) {
- String[] names = new String[11];
- String fileSep = File.separator;
- int i = 0;
- names[i++] = fileSep + "rt.jar";
- names[i++] = fileSep + "jsse.jar";
- names[i++] = fileSep + "jce.jar";
- names[i++] = fileSep + "charsets.jar";
- names[i++] = fileSep + "dnsns.jar";
- names[i++] = fileSep + "zipfs.jar";
- names[i++] = fileSep + "localedata.jar";
- names[i++] = fileSep = "cldrdata.jar";
- names[i++] = fileSep + "sunjce_provider.jar";
- names[i++] = fileSep + "sunpkcs11.jar";
- names[i++] = fileSep + "sunec.jar";
- jarNames = names;
- }
-
- String name = getName();
- if (name.startsWith(javaHome)) {
- String[] names = jarNames;
- for (String jarName : names) {
- if (name.endsWith(jarName)) {
- return true;
- }
- }
- }
- return false;
- }
-
private synchronized void ensureInitialization() {
try {
maybeInstantiateVerifier();
--- a/jdk/src/java.base/share/classes/javax/crypto/JceSecurityManager.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/javax/crypto/JceSecurityManager.java Wed Jul 05 20:08:34 2017 +0200
@@ -229,6 +229,11 @@
// See bug 4341369 & 4334690 for more info.
boolean isCallerTrusted(Provider provider) {
+ if (ProviderVerifier.isTrustedCryptoProvider(provider)) {
+ // fast path
+ return true;
+ }
+
// Get the caller and its codebase.
Class<?>[] context = getClassContext();
URL callerCodeBase = null;
--- a/jdk/src/java.base/share/classes/javax/crypto/ProviderVerifier.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/javax/crypto/ProviderVerifier.java Wed Jul 05 20:08:34 2017 +0200
@@ -157,6 +157,14 @@
}
/**
+ * Returns true if the given provider is JDK trusted crypto provider
+ * if the implementation supports fast-path verification.
+ */
+ static boolean isTrustedCryptoProvider(Provider provider) {
+ return false;
+ }
+
+ /**
* Returns the permissions which are bundled with the JAR file,
* aka the "cryptoperms" file.
*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/Archive.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.jimage;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Path;
+import java.util.function.Consumer;
+
+/**
+ * An Archive of all content, classes, resources, configuration files, and
+ * other, for a module.
+ */
+public interface Archive {
+ /**
+ * The module name.
+ */
+ String moduleName();
+
+ /**
+ * Visits all classes and resources.
+ */
+ void visitResources(Consumer<Resource> consumer);
+
+ /**
+ * Visits all entries in the Archive.
+ */
+ void visitEntries(Consumer<Entry> consumer) ;
+
+ /**
+ * An entries in the Archive.
+ */
+ interface Entry {
+ String getName();
+ InputStream getInputStream();
+ boolean isDirectory();
+ }
+
+ /**
+ * A Consumer suitable for writing Entries from this Archive.
+ */
+ Consumer<Entry> defaultImageWriter(Path path, OutputStream out);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.jimage;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.IntBuffer;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class BasicImageReader {
+ private final String imagePath;
+ private final PReader preader;
+ private final ByteOrder byteOrder;
+ private final ImageHeader header;
+ private final int indexSize;
+ private final IntBuffer redirectBuffer;
+ private final IntBuffer offsetsBuffer;
+ private final ByteBuffer locationsBuffer;
+ private final ByteBuffer stringsBuffer;
+ private final ImageStrings strings;
+
+ protected BasicImageReader(String imagePath, ByteOrder byteOrder) throws IOException {
+ this.imagePath = imagePath;
+ this.preader = PReader.open(imagePath);
+ this.byteOrder = byteOrder;
+ this.header = ImageHeader.readFrom(byteOrder, getIntBuffer(0, ImageHeader.getHeaderSize()));
+ this.indexSize = header.getIndexSize();
+ this.redirectBuffer = getIntBuffer(header.getRedirectOffset(), header.getRedirectSize());
+ this.offsetsBuffer = getIntBuffer(header.getOffsetsOffset(), header.getOffsetsSize());
+ this.locationsBuffer = getByteBuffer(header.getLocationsOffset(), header.getLocationsSize());
+ this.stringsBuffer = getByteBuffer(header.getStringsOffset(), header.getStringsSize());
+ this.strings = new ImageStrings(new ImageStream(stringsBuffer));
+ }
+
+ protected BasicImageReader(String imagePath) throws IOException {
+ this(imagePath, ByteOrder.nativeOrder());
+ }
+
+ public static BasicImageReader open(String imagePath) throws IOException {
+ return new BasicImageReader(imagePath, ByteOrder.nativeOrder());
+ }
+
+ public String imagePath() {
+ return imagePath;
+ }
+
+ public boolean isOpen() {
+ return preader.isOpen();
+ }
+
+ public void close() throws IOException {
+ preader.close();
+ }
+
+ public ImageHeader getHeader() {
+ return header;
+ }
+
+ public ImageLocation findLocation(String name) {
+ return findLocation(new UTF8String(name));
+ }
+
+ public ImageLocation findLocation(byte[] name) {
+ return findLocation(new UTF8String(name));
+ }
+
+ public synchronized ImageLocation findLocation(UTF8String name) {
+ int count = header.getLocationCount();
+ int hash = name.hashCode() % count;
+ int redirect = getRedirect(hash);
+
+ if (redirect == 0) {
+ return null;
+ }
+
+ int index;
+
+ if (redirect < 0) {
+ // If no collision.
+ index = -redirect - 1;
+ } else {
+ // If collision, recompute hash code.
+ index = name.hashCode(redirect) % count;
+ }
+
+ int offset = getOffset(index);
+
+ if (offset == 0) {
+ return null;
+ }
+
+ ImageLocation location = getLocation(offset);
+
+ return location.verify(name) ? location : null;
+ }
+
+ public String[] getEntryNames() {
+ return getEntryNames(true);
+ }
+
+ public String[] getEntryNames(boolean sorted) {
+ int count = header.getLocationCount();
+ List<String> list = new ArrayList<>();
+
+ for (int i = 0; i < count; i++) {
+ int offset = getOffset(i);
+
+ if (offset != 0) {
+ ImageLocation location = ImageLocation.readFrom(locationsBuffer, offset, strings);
+ list.add(location.getFullnameString());
+ }
+ }
+
+ String[] array = list.toArray(new String[0]);
+
+ if (sorted) {
+ Arrays.sort(array);
+ }
+
+ return array;
+ }
+
+ protected ImageLocation[] getAllLocations(boolean sorted) {
+ int count = header.getLocationCount();
+ List<ImageLocation> list = new ArrayList<>();
+
+ for (int i = 0; i < count; i++) {
+ int offset = getOffset(i);
+
+ if (offset != 0) {
+ ImageLocation location = ImageLocation.readFrom(locationsBuffer, offset, strings);
+ list.add(location);
+ }
+ }
+
+ ImageLocation[] array = list.toArray(new ImageLocation[0]);
+
+ if (sorted) {
+ Arrays.sort(array, (ImageLocation loc1, ImageLocation loc2) ->
+ loc1.getFullnameString().compareTo(loc2.getFullnameString()));
+ }
+
+ return array;
+ }
+
+ private IntBuffer getIntBuffer(long offset, long size) throws IOException {
+ MappedByteBuffer buffer = preader.channel().map(FileChannel.MapMode.READ_ONLY, offset, size);
+ buffer.order(byteOrder);
+
+ return buffer.asIntBuffer();
+ }
+
+ private ByteBuffer getByteBuffer(long offset, long size) throws IOException {
+ MappedByteBuffer buffer = preader.channel().map(FileChannel.MapMode.READ_ONLY, offset, size);
+ // order is not copied into the readonly copy.
+ ByteBuffer readOnly = buffer.asReadOnlyBuffer();
+ readOnly.order(byteOrder);
+ return readOnly;
+ }
+
+ private int getRedirect(int index) {
+ return redirectBuffer.get(index);
+ }
+
+ private int getOffset(int index) {
+ return offsetsBuffer.get(index);
+ }
+
+ private ImageLocation getLocation(int offset) {
+ return ImageLocation.readFrom(locationsBuffer, offset, strings);
+ }
+
+ public String getString(int offset) {
+ return strings.get(offset).toString();
+ }
+
+ public byte[] getResource(ImageLocation loc) throws IOException {
+ long compressedSize = loc.getCompressedSize();
+ assert compressedSize < Integer.MAX_VALUE;
+
+ if (compressedSize == 0) {
+ return preader.read((int)loc.getUncompressedSize(),
+ indexSize + loc.getContentOffset());
+ } else {
+ byte[] buf = preader.read((int)compressedSize,
+ indexSize + loc.getContentOffset());
+ return ImageFile.Compressor.decompress(buf);
+ }
+ }
+
+ public byte[] getResource(String name) throws IOException {
+ ImageLocation location = findLocation(name);
+
+ return location != null ? getResource(location) : null;
+ }
+
+ public List<String> getNames(String name) throws IOException {
+ return getNames(getResource(name));
+ }
+
+ public List<String> getNames(byte[] bytes) {
+ IntBuffer buffer = ByteBuffer.wrap(bytes).asIntBuffer();
+ List<String> names = new ArrayList<>();
+
+ while (buffer.hasRemaining()) {
+ int offset = buffer.get();
+ names.add(getString(offset));
+ }
+
+ return names;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageWriter.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,300 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+*/
+
+package jdk.internal.jimage;
+
+import java.io.PrintStream;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public final class BasicImageWriter {
+ private final static int RETRY_LIMIT = 1000;
+
+ private ByteOrder byteOrder;
+ private ImageStrings strings;
+ private int count;
+ private int[] redirect;
+ private ImageLocation[] locations;
+ private List<ImageLocation> input;
+ private ImageStream headerStream;
+ private ImageStream redirectStream;
+ private ImageStream locationOffsetStream;
+ private ImageStream locationStream;
+ private ImageStream allIndexStream;
+
+ static class ImageBucket implements Comparable<ImageBucket> {
+ final List<ImageLocation> list;
+
+ ImageBucket() {
+ this.list = new ArrayList<>();
+ }
+
+ void add(ImageLocation location) {
+ list.add(location);
+ }
+
+ int getSize() {
+ return list.size();
+ }
+
+ List<ImageLocation> getList() {
+ return list;
+ }
+
+ ImageLocation getFirst() {
+ assert !list.isEmpty() : "bucket should never be empty";
+ return list.get(0);
+ }
+
+ @Override
+ public int hashCode() {
+ return getFirst().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return this == obj;
+ }
+
+ @Override
+ public int compareTo(ImageBucket o) {
+ return o.getSize() - getSize();
+ }
+ }
+
+ public BasicImageWriter() {
+ this(ByteOrder.nativeOrder());
+ }
+
+ public BasicImageWriter(ByteOrder byteOrder) {
+ this.byteOrder = byteOrder;
+ this.input = new ArrayList<>();
+ this.strings = new ImageStrings();
+ this.headerStream = new ImageStream(byteOrder);
+ this.redirectStream = new ImageStream(byteOrder);
+ this.locationOffsetStream = new ImageStream(byteOrder);
+ this.locationStream = new ImageStream(byteOrder);
+ this.allIndexStream = new ImageStream(byteOrder);
+ }
+
+ public int addString(String string) {
+ return addString(new UTF8String(string));
+ }
+
+ public int addString(UTF8String string) {
+ return strings.add(string);
+ }
+
+ public void addLocation(String fullname, long contentOffset, long compressedSize, long uncompressedSize) {
+ ImageLocation location = ImageLocation.newLocation(new UTF8String(fullname), strings, contentOffset, compressedSize, uncompressedSize);
+ input.add(location);
+ count++;
+ }
+
+ private void generatePerfectHash() {
+ redo:
+ while(true) {
+ redirect = new int[count];
+ locations = new ImageLocation[count];
+
+ ImageBucket[] sorted = createBuckets();
+
+ int free = 0;
+
+ for (ImageBucket bucket : sorted) {
+ if (bucket.getSize() != 1) {
+ if (!packCollidedEntries(bucket, count)) {
+ count = (count + 1) | 1;
+
+ continue redo;
+ }
+ } else {
+ for ( ; free < count && locations[free] != null; free++) {}
+ assert free < count : "no free slots";
+ locations[free] = bucket.getFirst();
+ redirect[bucket.hashCode() % count] = -1 - free;
+ free++;
+ }
+ }
+
+ break;
+ }
+ }
+
+ private ImageBucket[] createBuckets() {
+ ImageBucket[] buckets = new ImageBucket[count];
+
+ input.stream().forEach((location) -> {
+ int index = location.hashCode() % count;
+ ImageBucket bucket = buckets[index];
+
+ if (bucket == null) {
+ buckets[index] = bucket = new ImageBucket();
+ }
+
+ bucket.add(location);
+ });
+
+ ImageBucket[] sorted = Arrays.asList(buckets).stream()
+ .filter((bucket) -> (bucket != null))
+ .sorted()
+ .toArray(ImageBucket[]::new);
+
+ return sorted;
+ }
+
+ private boolean packCollidedEntries(ImageBucket bucket, int count) {
+ List<Integer> undo = new ArrayList<>();
+ int base = UTF8String.HASH_MULTIPLIER + 1;
+
+ int retry = 0;
+
+ redo:
+ while (true) {
+ for (ImageLocation location : bucket.getList()) {
+ int index = location.hashCode(base) % count;
+
+ if (locations[index] != null) {
+ undo.stream().forEach((i) -> {
+ locations[i] = null;
+ });
+
+ undo.clear();
+ base++;
+
+ if (base == 0) {
+ base = 1;
+ }
+
+ if (++retry > RETRY_LIMIT) {
+ return false;
+ }
+
+ continue redo;
+ }
+
+ locations[index] = location;
+ undo.add(index);
+ }
+
+ redirect[bucket.hashCode() % count] = base;
+
+ break;
+ }
+
+ return true;
+ }
+
+ private void prepareStringBytes() {
+ strings.getStream().align(2);
+ }
+
+ private void prepareRedirectBytes() {
+ for (int i = 0; i < count; i++) {
+ redirectStream.putInt(redirect[i]);
+ }
+ }
+
+ private void prepareLocationBytes() {
+ // Reserve location offset zero for empty locations
+ locationStream.put(ImageLocation.ATTRIBUTE_END << 3);
+
+ for (int i = 0; i < count; i++) {
+ ImageLocation location = locations[i];
+
+ if (location != null) {
+ location.writeTo(locationStream);
+ }
+ }
+
+ locationStream.align(2);
+ }
+
+ private void prepareOffsetBytes() {
+ for (int i = 0; i < count; i++) {
+ ImageLocation location = locations[i];
+ locationOffsetStream.putInt(location != null ? location.getLocationOffset() : 0);
+ }
+ }
+
+ private void prepareHeaderBytes() {
+ ImageHeader header = new ImageHeader(count, locationStream.getSize(), strings.getSize());
+ header.writeTo(headerStream);
+ }
+
+ private void prepareTableBytes() {
+ allIndexStream.put(headerStream);
+ allIndexStream.put(redirectStream);
+ allIndexStream.put(locationOffsetStream);
+ allIndexStream.put(locationStream);
+ allIndexStream.put(strings.getStream());
+ }
+
+ public byte[] getBytes() {
+ if (allIndexStream.getSize() == 0) {
+ generatePerfectHash();
+ prepareStringBytes();
+ prepareRedirectBytes();
+ prepareLocationBytes();
+ prepareOffsetBytes();
+ prepareHeaderBytes();
+ prepareTableBytes();
+ }
+
+ return allIndexStream.toArray();
+ }
+
+ ImageLocation find(UTF8String key) {
+ int index = key.hashCode() % count;
+ index = redirect[index];
+
+ if (index < 0) {
+ index = -index - 1;
+ ImageLocation location = locations[index];
+
+ return location;
+ } else {
+ index = key.hashCode(index) % count;
+ ImageLocation location = locations[index];
+
+ return location;
+ }
+ }
+
+ public void statistics() {
+ getBytes();
+ PrintStream out = System.out;
+ out.println("Count: " + count);
+ out.println("Header bytes size: " + headerStream.getSize());
+ out.println("Redirect bytes size: " + redirectStream.getSize());
+ out.println("Offset bytes size: " + locationOffsetStream.getSize());
+ out.println("Location bytes size: " + locationStream.getSize());
+ out.println("String count: " + strings.getCount());
+ out.println("String bytes size: " + strings.getSize());
+ out.println("Total bytes size: " + allIndexStream.getSize());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageFile.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.jimage;
+
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteOrder;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.zip.DataFormatException;
+import java.util.zip.Deflater;
+import java.util.zip.Inflater;
+import jdk.internal.jimage.ImageModules.Loader;
+import jdk.internal.jimage.ImageModules.ModuleIndex;
+
+/**
+ * An image (native endian.)
+ * <pre>{@code
+ * {
+ * u4 magic;
+ * u2 major_version;
+ * u2 minor_version;
+ * u4 location_count;
+ * u4 location_attributes_size;
+ * u4 strings_size;
+ * u4 redirect[location_count];
+ * u4 offsets[location_count];
+ * u1 location_attributes[location_attributes_size];
+ * u1 strings[strings_size];
+ * u1 content[if !EOF];
+ * }
+ * }</pre>
+ */
+public final class ImageFile {
+ private static final String JAVA_BASE = "java.base";
+ private static final String IMAGE_EXT = ".jimage";
+ private static final String JAR_EXT = ".jar";
+ private final Path root;
+ private final Path mdir;
+ private final Map<String, List<Resource>> resourcesForModule = new HashMap<>();
+
+ private ImageFile(Path path) {
+ this.root = path;
+ this.mdir = root.resolve(path.getFileSystem().getPath("lib", "modules"));
+ }
+
+ public static ImageFile open(Path path) throws IOException {
+ ImageFile lib = new ImageFile(path);
+ return lib.open();
+ }
+
+ private ImageFile open() throws IOException {
+ Path path = mdir.resolve("bootmodules" + IMAGE_EXT);
+
+ ImageReader reader = new ImageReader(path.toString());
+ ImageHeader header = reader.getHeader();
+
+ if (header.getMagic() != ImageHeader.MAGIC) {
+ if (header.getMagic() == ImageHeader.BADMAGIC) {
+ throw new IOException(path + ": Image may be not be native endian");
+ } else {
+ throw new IOException(path + ": Invalid magic number");
+ }
+ }
+
+ if (header.getMajorVersion() > ImageHeader.MAJOR_VERSION ||
+ (header.getMajorVersion() == ImageHeader.MAJOR_VERSION &&
+ header.getMinorVersion() > ImageHeader.MINOR_VERSION)) {
+ throw new IOException("invalid version number");
+ }
+
+ return this;
+ }
+
+ public static ImageFile create(Path output,
+ Set<Archive> archives,
+ ImageModules modules)
+ throws IOException
+ {
+ return ImageFile.create(output, archives, modules, ByteOrder.nativeOrder());
+ }
+
+ public static ImageFile create(Path output,
+ Set<Archive> archives,
+ ImageModules modules,
+ ByteOrder byteOrder)
+ throws IOException
+ {
+ ImageFile lib = new ImageFile(output);
+ // get all resources
+ lib.readModuleEntries(modules, archives);
+ // write to modular image
+ lib.writeImage(modules, archives, byteOrder);
+ return lib;
+ }
+
+ private void writeImage(ImageModules modules,
+ Set<Archive> archives,
+ ByteOrder byteOrder)
+ throws IOException
+ {
+ // name to Archive file
+ Map<String, Archive> nameToArchive =
+ archives.stream()
+ .collect(Collectors.toMap(Archive::moduleName, Function.identity()));
+
+ Files.createDirectories(mdir);
+ for (Loader l : Loader.values()) {
+ Set<String> mods = modules.getModules(l);
+
+ try (OutputStream fos = Files.newOutputStream(mdir.resolve(l.getName() + IMAGE_EXT));
+ BufferedOutputStream bos = new BufferedOutputStream(fos);
+ DataOutputStream out = new DataOutputStream(bos)) {
+ // store index in addition of the class loader map for boot loader
+ BasicImageWriter writer = new BasicImageWriter(byteOrder);
+ Set<String> duplicates = new HashSet<>();
+
+ // build package map for modules and add as resources
+ ModuleIndex mindex = modules.buildModuleIndex(l, writer);
+ long offset = mindex.size();
+
+ // the order of traversing the resources and the order of
+ // the module content being written must be the same
+ for (String mn : mods) {
+ for (Resource res : resourcesForModule.get(mn)) {
+ String path = res.name();
+ long uncompressedSize = res.size();
+ long compressedSize = res.csize();
+ long onFileSize = compressedSize != 0 ? compressedSize : uncompressedSize;
+
+ if (duplicates.contains(path)) {
+ System.err.format("duplicate resource \"%s\", skipping%n", path);
+ // TODO Need to hang bytes on resource and write from resource not zip.
+ // Skipping resource throws off writing from zip.
+ offset += onFileSize;
+ continue;
+ }
+ duplicates.add(path);
+ writer.addLocation(path, offset, compressedSize, uncompressedSize);
+ offset += onFileSize;
+ }
+ }
+
+ // write header and indices
+ byte[] bytes = writer.getBytes();
+ out.write(bytes, 0, bytes.length);
+
+ // write module table and packages
+ mindex.writeTo(out);
+
+ // write module content
+ for (String mn : mods) {
+ writeModule(nameToArchive.get(mn), out);
+ }
+ }
+ }
+ }
+
+ private void readModuleEntries(ImageModules modules,
+ Set<Archive> archives)
+ throws IOException
+ {
+ for (Archive archive : archives) {
+ List<Resource> res = new ArrayList<>();
+ archive.visitResources(x-> res.add(x));
+
+ String mn = archive.moduleName();
+ resourcesForModule.put(mn, res);
+
+ Set<String> pkgs = res.stream().map(Resource::name)
+ .filter(n -> n.endsWith(".class"))
+ .map(this::toPackage)
+ .distinct()
+ .collect(Collectors.toSet());
+ modules.setPackages(mn, pkgs);
+ }
+ }
+
+ private String toPackage(String name) {
+ int index = name.lastIndexOf('/');
+ if (index > 0) {
+ return name.substring(0, index).replace('/', '.');
+ } else {
+ // ## unnamed package
+ System.err.format("Warning: %s in unnamed package%n", name);
+ return "";
+ }
+ }
+
+ private void writeModule(Archive archive,
+ OutputStream out)
+ throws IOException
+ {
+ Consumer<Archive.Entry> consumer = archive.defaultImageWriter(root, out);
+ archive.visitEntries(consumer);
+ }
+
+
+ static class Compressor {
+ public static byte[] compress(byte[] bytesIn) {
+ Deflater deflater = new Deflater();
+ deflater.setInput(bytesIn);
+ ByteArrayOutputStream stream = new ByteArrayOutputStream(bytesIn.length);
+ byte[] buffer = new byte[1024];
+
+ deflater.finish();
+ while (!deflater.finished()) {
+ int count = deflater.deflate(buffer);
+ stream.write(buffer, 0, count);
+ }
+
+ try {
+ stream.close();
+ } catch (IOException ex) {
+ return bytesIn;
+ }
+
+ byte[] bytesOut = stream.toByteArray();
+ deflater.end();
+
+ return bytesOut;
+ }
+
+ public static byte[] decompress(byte[] bytesIn) {
+ Inflater inflater = new Inflater();
+ inflater.setInput(bytesIn);
+ ByteArrayOutputStream stream = new ByteArrayOutputStream(bytesIn.length);
+ byte[] buffer = new byte[1024];
+
+ while (!inflater.finished()) {
+ int count;
+
+ try {
+ count = inflater.inflate(buffer);
+ } catch (DataFormatException ex) {
+ return null;
+ }
+
+ stream.write(buffer, 0, count);
+ }
+
+ try {
+ stream.close();
+ } catch (IOException ex) {
+ return null;
+ }
+
+ byte[] bytesOut = stream.toByteArray();
+ inflater.end();
+
+ return bytesOut;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageHeader.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+*/
+
+package jdk.internal.jimage;
+
+import java.nio.ByteOrder;
+import java.nio.IntBuffer;
+
+public final class ImageHeader {
+ public static final int MAGIC = 0xCAFEDADA;
+ public static final int BADMAGIC = 0xDADAFECA;
+ public static final short MAJOR_VERSION = 0;
+ public static final short MINOR_VERSION = 1;
+
+ private final int magic;
+ private final short majorVersion;
+ private final short minorVersion;
+ private final int locationCount;
+ private final int locationsSize;
+ private final int stringsSize;
+
+ ImageHeader(int locationCount, int locationsSize, int stringsSize) {
+ this(MAGIC, MAJOR_VERSION, MINOR_VERSION, locationCount, locationsSize, stringsSize);
+ }
+
+ ImageHeader(int magic, short majorVersion, short minorVersion, int locationCount,
+ int locationsSize, int stringsSize)
+ {
+ this.magic = magic;
+ this.majorVersion = majorVersion;
+ this.minorVersion = minorVersion;
+ this.locationCount = locationCount;
+ this.locationsSize = locationsSize;
+ this.stringsSize = stringsSize;
+ }
+
+ static int getHeaderSize() {
+ return 4 +
+ 2 + 2 +
+ 4 +
+ 4 +
+ 4;
+ }
+
+ static ImageHeader readFrom(ByteOrder byteOrder, IntBuffer buffer) {
+ int magic = buffer.get(0);
+ int version = buffer.get(1);
+ short majorVersion = (short)(byteOrder == ByteOrder.BIG_ENDIAN ?
+ version >>> 16 : (version & 0xFFFF));
+ short minorVersion = (short)(byteOrder == ByteOrder.BIG_ENDIAN ?
+ (version & 0xFFFF) : version >>> 16);
+ int locationCount = buffer.get(2);
+ int locationsSize = buffer.get(3);
+ int stringsSize = buffer.get(4);
+
+ return new ImageHeader(magic, majorVersion, minorVersion, locationCount,
+ locationsSize, stringsSize);
+ }
+
+ void writeTo(ImageStream stream) {
+ stream.putInt(magic);
+ stream.putShort(majorVersion);
+ stream.putShort(minorVersion);
+ stream.putInt(locationCount);
+ stream.putInt(locationsSize);
+ stream.putInt(stringsSize);
+ }
+
+ public int getMagic() {
+ return magic;
+ }
+
+ public int getMajorVersion() {
+ return majorVersion;
+ }
+
+ public int getMinorVersion() {
+ return minorVersion;
+ }
+
+ public int getLocationCount() {
+ return locationCount;
+ }
+
+ public int getRedirectSize() {
+ return locationCount* 4;
+ }
+
+ public int getOffsetsSize() {
+ return locationCount* 4;
+ }
+
+ public int getLocationsSize() {
+ return locationsSize;
+ }
+
+ public int getStringsSize() {
+ return stringsSize;
+ }
+
+ public int getIndexSize() {
+ return getHeaderSize() +
+ getRedirectSize() +
+ getOffsetsSize() +
+ getLocationsSize() +
+ getStringsSize();
+ }
+
+ int getRedirectOffset() {
+ return getHeaderSize();
+ }
+
+ int getOffsetsOffset() {
+ return getRedirectOffset() +
+ getRedirectSize();
+ }
+
+ int getLocationsOffset() {
+ return getOffsetsOffset() +
+ getOffsetsSize();
+ }
+
+ int getStringsOffset() {
+ return getLocationsOffset() +
+ getLocationsSize();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageLocation.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,393 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage;
+
+import java.nio.ByteBuffer;
+
+public final class ImageLocation {
+ final static int ATTRIBUTE_END = 0;
+ final static int ATTRIBUTE_BASE = 1;
+ final static int ATTRIBUTE_PARENT = 2;
+ final static int ATTRIBUTE_EXTENSION = 3;
+ final static int ATTRIBUTE_OFFSET = 4;
+ final static int ATTRIBUTE_COMPRESSED = 5;
+ final static int ATTRIBUTE_UNCOMPRESSED = 6;
+ final static int ATTRIBUTE_COUNT = 7;
+
+ private int locationOffset;
+ private long[] attributes;
+ private byte[] bytes;
+ private final ImageStrings strings;
+
+ private ImageLocation(ImageStrings strings) {
+ this.strings = strings;
+ }
+
+ void writeTo(ImageStream stream) {
+ compress();
+ locationOffset = stream.getPosition();
+ stream.put(bytes, 0, bytes.length);
+ }
+
+ static ImageLocation readFrom(ByteBuffer locationsBuffer, int offset, ImageStrings strings) {
+ final long[] attributes = new long[ATTRIBUTE_COUNT];
+
+ for (int i = offset; true; ) {
+ int data = locationsBuffer.get(i++) & 0xFF;
+ int kind = attributeKind(data);
+ assert ATTRIBUTE_END <= kind && kind < ATTRIBUTE_COUNT : "Invalid attribute kind";
+
+ if (kind == ATTRIBUTE_END) {
+ break;
+ }
+
+ int length = attributeLength(data);
+ long value = 0;
+
+ for (int j = 0; j < length; j++) {
+ value <<= 8;
+ value |= locationsBuffer.get(i++) & 0xFF;
+ }
+
+ attributes[kind] = value;
+ }
+
+ ImageLocation location = new ImageLocation(strings);
+ location.attributes = attributes;
+
+ return location;
+ }
+
+ private static int attributeLength(int data) {
+ return (data & 0x7) + 1;
+ }
+
+ private static int attributeKind(int data) {
+ return data >>> 3;
+ }
+
+ public boolean verify(UTF8String name) {
+ UTF8String match = UTF8String.match(name, getParent());
+
+ if (match == null) {
+ return false;
+ }
+
+ match = UTF8String.match(match, getBase());
+
+ if (match == null) {
+ return false;
+ }
+
+ match = UTF8String.match(match, getExtension());
+
+ return match != null && match.length() == 0;
+ }
+
+
+ long getAttribute(int kind) {
+ assert ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT : "Invalid attribute kind";
+ decompress();
+
+ return attributes[kind];
+ }
+
+ UTF8String getAttributeUTF8String(int kind) {
+ assert ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT : "Invalid attribute kind";
+ decompress();
+
+ return strings.get((int)attributes[kind]);
+ }
+
+ String getAttributeString(int kind) {
+ return getAttributeUTF8String(kind).toString();
+ }
+
+ ImageLocation addAttribute(int kind, long value) {
+ assert ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT : "Invalid attribute kind";
+ decompress();
+ attributes[kind] = value;
+ return this;
+ }
+
+ private void decompress() {
+ if (attributes == null) {
+ attributes = new long[ATTRIBUTE_COUNT];
+ }
+
+ if (bytes != null) {
+ for (int i = 0; i < bytes.length; ) {
+ int data = bytes[i++] & 0xFF;
+ int kind = attributeKind(data);
+
+ if (kind == ATTRIBUTE_END) {
+ break;
+ }
+
+ assert ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT : "Invalid attribute kind";
+ int length = attributeLength(data);
+ long value = 0;
+
+ for (int j = 0; j < length; j++) {
+ value <<= 8;
+ value |= bytes[i++] & 0xFF;
+ }
+
+ attributes[kind] = value;
+ }
+
+ bytes = null;
+ }
+ }
+
+ private void compress() {
+ if (bytes == null) {
+ ImageStream stream = new ImageStream(16);
+
+ for (int kind = ATTRIBUTE_END + 1; kind < ATTRIBUTE_COUNT; kind++) {
+ long value = attributes[kind];
+
+ if (value != 0) {
+ int n = (63 - Long.numberOfLeadingZeros(value)) >> 3;
+ stream.put((kind << 3) | n);
+
+ for (int i = n; i >= 0; i--) {
+ stream.put((int)(value >> (i << 3)));
+ }
+ }
+ }
+
+ stream.put(ATTRIBUTE_END << 3);
+ bytes = stream.toArray();
+ attributes = null;
+ }
+ }
+
+ static ImageLocation newLocation(UTF8String fullname, ImageStrings strings, long contentOffset, long compressedSize, long uncompressedSize) {
+ UTF8String base;
+ UTF8String extension = extension(fullname);
+ int parentOffset = ImageStrings.EMPTY_OFFSET;
+ int extensionOffset = ImageStrings.EMPTY_OFFSET;
+ int baseOffset;
+
+ if (extension.length() != 0) {
+ UTF8String parent = parent(fullname);
+ base = base(fullname);
+ parentOffset = strings.add(parent);
+ extensionOffset = strings.add(extension);
+ } else {
+ base = fullname;
+ }
+
+ baseOffset = strings.add(base);
+
+ return new ImageLocation(strings)
+ .addAttribute(ATTRIBUTE_BASE, baseOffset)
+ .addAttribute(ATTRIBUTE_PARENT, parentOffset)
+ .addAttribute(ATTRIBUTE_EXTENSION, extensionOffset)
+ .addAttribute(ATTRIBUTE_OFFSET, contentOffset)
+ .addAttribute(ATTRIBUTE_COMPRESSED, compressedSize)
+ .addAttribute(ATTRIBUTE_UNCOMPRESSED, uncompressedSize);
+ }
+
+ @Override
+ public int hashCode() {
+ return getExtension().hashCode(getBase().hashCode(getParent().hashCode()));
+ }
+
+ int hashCode(int base) {
+ return getExtension().hashCode(getBase().hashCode(getParent().hashCode(base)));
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (!(obj instanceof ImageLocation)) {
+ return false;
+ }
+
+ ImageLocation other = (ImageLocation)obj;
+
+ return getBaseOffset() == other.getBaseOffset() &&
+ getParentOffset() == other.getParentOffset() &&
+ getExtensionOffset() == other.getExtensionOffset();
+ }
+
+ static UTF8String parent(UTF8String fullname) {
+ int slash = fullname.lastIndexOf('/');
+
+ return slash == UTF8String.NOT_FOUND ? UTF8String.EMPTY_STRING : fullname.substring(0, slash + 1);
+ }
+
+ static UTF8String extension(UTF8String fullname) {
+ int dot = fullname.lastIndexOf('.');
+
+ return dot == UTF8String.NOT_FOUND ? UTF8String.EMPTY_STRING : fullname.substring(dot);
+ }
+
+ static UTF8String base(UTF8String fullname) {
+ int slash = fullname.lastIndexOf('/');
+
+ if (slash != UTF8String.NOT_FOUND) {
+ fullname = fullname.substring(slash + 1);
+ }
+
+ int dot = fullname.lastIndexOf('.');
+
+ if (dot != UTF8String.NOT_FOUND) {
+ fullname = fullname.substring(0, dot);
+ }
+
+ return fullname;
+ }
+
+ int getLocationOffset() {
+ return locationOffset;
+ }
+
+ UTF8String getBase() {
+ return getAttributeUTF8String(ATTRIBUTE_BASE);
+ }
+
+ public String getBaseString() {
+ return getBase().toString();
+ }
+
+ int getBaseOffset() {
+ return (int)getAttribute(ATTRIBUTE_BASE);
+ }
+
+ UTF8String getParent() {
+ return getAttributeUTF8String(ATTRIBUTE_PARENT);
+ }
+
+ public String getParentString() {
+ return getParent().toString();
+ }
+
+ int getParentOffset() {
+ return (int)getAttribute(ATTRIBUTE_PARENT);
+ }
+
+ UTF8String getExtension() {
+ return getAttributeUTF8String(ATTRIBUTE_EXTENSION);
+ }
+
+ public String getExtensionString() {
+ return getExtension().toString();
+ }
+
+ int getExtensionOffset() {
+ return (int)getAttribute(ATTRIBUTE_EXTENSION);
+ }
+
+ UTF8String getName() {
+ return getBase().concat(getExtension());
+ }
+
+ String getNameString() {
+ return getName().toString();
+ }
+
+ UTF8String getFullname() {
+ return getParent().concat(getBase(), getExtension());
+ }
+
+ String getFullnameString() {
+ return getFullname().toString();
+ }
+
+ public long getContentOffset() {
+ return getAttribute(ATTRIBUTE_OFFSET);
+ }
+
+ public long getCompressedSize() {
+ return getAttribute(ATTRIBUTE_COMPRESSED);
+ }
+
+ public long getUncompressedSize() {
+ return getAttribute(ATTRIBUTE_UNCOMPRESSED);
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ decompress();
+
+ for (int kind = ATTRIBUTE_END + 1; kind < ATTRIBUTE_COUNT; kind++) {
+ long value = attributes[kind];
+
+ if (value == 0) {
+ continue;
+ }
+
+ switch (kind) {
+ case ATTRIBUTE_BASE:
+ sb.append("Base: ");
+ sb.append(value);
+ sb.append(' ');
+ sb.append(strings.get((int)value).toString());
+ break;
+
+ case ATTRIBUTE_PARENT:
+ sb.append("Parent: ");
+ sb.append(value);
+ sb.append(' ');
+ sb.append(strings.get((int)value).toString());
+ break;
+
+ case ATTRIBUTE_EXTENSION:
+ sb.append("Extension: ");
+ sb.append(value);
+ sb.append(' ');
+ sb.append(strings.get((int)value).toString());
+ break;
+
+ case ATTRIBUTE_OFFSET:
+ sb.append("Offset: ");
+ sb.append(value);
+ break;
+
+ case ATTRIBUTE_COMPRESSED:
+ sb.append("Compressed: ");
+ sb.append(value);
+ break;
+
+ case ATTRIBUTE_UNCOMPRESSED:
+ sb.append("Uncompressed: ");
+ sb.append(value);
+ break;
+ }
+
+ sb.append("; ");
+ }
+
+ return sb.toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageModules.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import static jdk.internal.jimage.PackageModuleMap.*;
+
+public class ImageModules {
+ protected final Map<Loader, LoaderModuleData> loaders = new LinkedHashMap<>();
+ protected final Map<String, Set<String>> localPkgs = new HashMap<>();
+
+ protected ImageModules() {}
+
+ public ImageModules(Set<String> bootModules,
+ Set<String> extModules,
+ Set<String> appModules) throws IOException {
+ mapModulesToLoader(Loader.BOOT_LOADER, bootModules);
+ mapModulesToLoader(Loader.EXT_LOADER, extModules);
+ mapModulesToLoader(Loader.APP_LOADER, appModules);
+ }
+
+ public Map<String, Set<String>> packages() {
+ return localPkgs;
+ }
+
+ // ## FIXME: should be package-private
+ // When jlink legacy format support is removed, it should
+ // use the package table in the jimage.
+ public void setPackages(String mn, Set<String> pkgs) {
+ localPkgs.put(mn, pkgs);
+ }
+
+ /*
+ * Returns the name of modules mapped to a given class loader in the image
+ */
+ public Set<String> getModules(Loader type) {
+ if (loaders.containsKey(type)) {
+ return loaders.get(type).modules();
+ } else {
+ return Collections.emptySet();
+ }
+ }
+
+ private void mapModulesToLoader(Loader loader, Set<String> modules) {
+ if (modules.isEmpty())
+ return;
+
+ // put java.base first
+ Set<String> mods = new LinkedHashSet<>();
+ modules.stream()
+ .filter(m -> m.equals("java.base"))
+ .forEach(mods::add);
+ modules.stream().sorted()
+ .filter(m -> !m.equals("java.base"))
+ .forEach(mods::add);
+ loaders.put(loader, new LoaderModuleData(loader, mods));
+ }
+
+ enum Loader {
+ BOOT_LOADER(0, "bootmodules"),
+ EXT_LOADER(1, "extmodules"),
+ APP_LOADER(2, "appmodules"); // ## may be more than 1 loader
+
+ final int id;
+ final String name;
+ Loader(int id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ String getName() {
+ return name;
+ }
+ static Loader get(int id) {
+ switch (id) {
+ case 0: return BOOT_LOADER;
+ case 1: return EXT_LOADER;
+ case 2: return APP_LOADER;
+ default:
+ throw new IllegalArgumentException("invalid loader id: " + id);
+ }
+ }
+ public int id() { return id; }
+ }
+
+ public class LoaderModuleData {
+ private final Loader loader;
+ private final Set<String> modules;
+ LoaderModuleData(Loader loader, Set<String> modules) {
+ this.loader = loader;
+ this.modules = Collections.unmodifiableSet(modules);
+ }
+
+ Set<String> modules() {
+ return modules;
+ }
+ Loader loader() { return loader; }
+ }
+
+ ModuleIndex buildModuleIndex(Loader type, BasicImageWriter writer) {
+ return new ModuleIndex(getModules(type), writer);
+ }
+
+ /*
+ * Generate module name table and the package map as resources
+ * in the modular image
+ */
+ public class ModuleIndex {
+ final Map<String, Integer> moduleOffsets = new LinkedHashMap<>();
+ final Map<String, List<Integer>> packageOffsets = new HashMap<>();
+ final int size;
+ public ModuleIndex(Set<String> mods, BasicImageWriter writer) {
+ // module name offsets
+ writer.addLocation(MODULES_ENTRY, 0, 0, mods.size() * 4);
+ long offset = mods.size() * 4;
+ for (String mn : mods) {
+ moduleOffsets.put(mn, writer.addString(mn));
+ List<Integer> poffsets = localPkgs.get(mn).stream()
+ .map(pn -> pn.replace('.', '/'))
+ .map(writer::addString)
+ .collect(Collectors.toList());
+ // package name offsets per module
+ String entry = mn + "/" + PACKAGES_ENTRY;
+ int bytes = poffsets.size() * 4;
+ writer.addLocation(entry, offset, 0, bytes);
+ offset += bytes;
+ packageOffsets.put(mn, poffsets);
+ }
+ this.size = (int) offset;
+ }
+
+ void writeTo(DataOutputStream out) throws IOException {
+ for (int moffset : moduleOffsets.values()) {
+ out.writeInt(moffset);
+ }
+ for (String mn : moduleOffsets.keySet()) {
+ for (int poffset : packageOffsets.get(mn)) {
+ out.writeInt(poffset);
+ }
+ }
+ }
+
+ int size() {
+ return size;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,502 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.jimage;
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.net.URI;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.IntBuffer;
+import java.nio.file.Files;
+import java.nio.file.FileSystem;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.attribute.FileTime;
+import java.nio.file.Paths;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
+public class ImageReader extends BasicImageReader {
+ // well-known strings needed for image file system.
+ static final UTF8String ROOT = new UTF8String("/");
+ static final UTF8String META_INF = new UTF8String("/META-INF");
+ static final UTF8String PACKAGES_OFFSETS = new UTF8String("packages.offsets");
+
+ // attributes of the .jimage file. jimage file does not contain
+ // attributes for the individual resources (yet). We use attributes
+ // of the jimage file itself (creation, modification, access times).
+ // Iniitalized lazily, see {@link #imageFileAttributes()}.
+ private BasicFileAttributes imageFileAttributes;
+
+ private final Map<String, String> packageMap;
+
+ // directory management implementation
+ private final Map<UTF8String, Node> nodes;
+ private volatile Directory rootDir;
+
+ ImageReader(String imagePath, ByteOrder byteOrder) throws IOException {
+ super(imagePath, byteOrder);
+ this.packageMap = PackageModuleMap.readFrom(this);
+ this.nodes = Collections.synchronizedMap(new HashMap<>());
+ }
+
+ ImageReader(String imagePath) throws IOException {
+ this(imagePath, ByteOrder.nativeOrder());
+ }
+
+ public static ImageReader open(String imagePath, ByteOrder byteOrder) throws IOException {
+ return new ImageReader(imagePath, byteOrder);
+ }
+
+ /**
+ * Opens the given file path as an image file, returning an {@code ImageReader}.
+ */
+ public static ImageReader open(String imagePath) throws IOException {
+ return open(imagePath, ByteOrder.nativeOrder());
+ }
+
+ @Override
+ public synchronized void close() throws IOException {
+ super.close();
+ clearNodes();
+ }
+
+ /**
+ * Return the module name that contains the given package name.
+ */
+ public String getModule(String pkg) {
+ return packageMap.get(pkg);
+ }
+
+ // jimage file does not store directory structure. We build nodes
+ // using the "path" strings found in the jimage file.
+ // Node can be a directory or a resource
+ public static abstract class Node {
+ private static final int ROOT_DIR = 0b0000_0000_0000_0001;
+ private static final int MODULE_DIR = 0b0000_0000_0000_0010;
+ private static final int METAINF_DIR = 0b0000_0000_0000_0100;
+ private static final int TOPLEVEL_PKG_DIR = 0b0000_0000_0000_1000;
+ private static final int HIDDEN = 0b0000_0000_0001_0000;
+
+ private int flags;
+ private final UTF8String name;
+ private final BasicFileAttributes fileAttrs;
+
+ Node(UTF8String name, BasicFileAttributes fileAttrs) {
+ assert name != null;
+ assert fileAttrs != null;
+ this.name = name;
+ this.fileAttrs = fileAttrs;
+ }
+
+ public final void setIsRootDir() {
+ flags |= ROOT_DIR;
+ }
+
+ public final boolean isRootDir() {
+ return (flags & ROOT_DIR) != 0;
+ }
+
+ public final void setIsModuleDir() {
+ flags |= MODULE_DIR;
+ }
+
+ public final boolean isModuleDir() {
+ return (flags & MODULE_DIR) != 0;
+ }
+
+ public final void setIsMetaInfDir() {
+ flags |= METAINF_DIR;
+ }
+
+ public final boolean isMetaInfDir() {
+ return (flags & METAINF_DIR) != 0;
+ }
+
+ public final void setIsTopLevelPackageDir() {
+ flags |= TOPLEVEL_PKG_DIR;
+ }
+
+ public final boolean isTopLevelPackageDir() {
+ return (flags & TOPLEVEL_PKG_DIR) != 0;
+ }
+
+ public final void setIsHidden() {
+ flags |= HIDDEN;
+ }
+
+ public final boolean isHidden() {
+ return (flags & HIDDEN) != 0;
+ }
+
+ public final boolean isVisible() {
+ return !isHidden();
+ }
+
+ public final UTF8String getName() {
+ return name;
+ }
+
+ public final BasicFileAttributes getFileAttributes() {
+ return fileAttrs;
+ }
+
+ public boolean isDirectory() {
+ return false;
+ }
+
+ public List<Node> getChildren() {
+ throw new IllegalArgumentException("not a directory: " + getNameString());
+ }
+
+ public boolean isResource() {
+ return false;
+ }
+
+ public ImageLocation getLocation() {
+ throw new IllegalArgumentException("not a resource: " + getNameString());
+ }
+
+ public long size() {
+ return 0L;
+ }
+
+ public long compressedSize() {
+ return 0L;
+ }
+
+ public String extension() {
+ return null;
+ }
+
+ public long contentOffset() {
+ return 0L;
+ }
+
+ public final FileTime creationTime() {
+ return fileAttrs.creationTime();
+ }
+
+ public final FileTime lastAccessTime() {
+ return fileAttrs.lastAccessTime();
+ }
+
+ public final FileTime lastModifiedTime() {
+ return fileAttrs.lastModifiedTime();
+ }
+
+ public final String getNameString() {
+ return name.toString();
+ }
+
+ @Override
+ public final String toString() {
+ return getNameString();
+ }
+
+ @Override
+ public final int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public final boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+
+ if (other instanceof Node) {
+ return name.equals(((Node) other).name);
+ }
+
+ return false;
+ }
+ }
+
+ // directory node - directory has full path name without '/' at end.
+ public static final class Directory extends Node {
+ private final List<Node> children;
+
+ @SuppressWarnings("LeakingThisInConstructor")
+ Directory(Directory parent, UTF8String name, BasicFileAttributes fileAttrs) {
+ super(name, fileAttrs);
+ children = new ArrayList<>();
+ if (parent != null) {
+ parent.addChild(this);
+ }
+ }
+
+ @Override
+ public boolean isDirectory() {
+ return true;
+ }
+
+ public List<Node> getChildren() {
+ return Collections.unmodifiableList(children);
+ }
+
+ void addChild(Node node) {
+ children.add(node);
+ }
+
+ public void walk(Consumer<? super Node> consumer) {
+ consumer.accept(this);
+ for ( Node child : children ) {
+ if (child.isDirectory()) {
+ ((Directory)child).walk(consumer);
+ } else {
+ consumer.accept(child);
+ }
+ }
+ }
+ }
+
+ // "resource" is .class or any other resource (compressed/uncompressed) in a jimage.
+ // full path of the resource is the "name" of the resource.
+ public static class Resource extends Node {
+ private final ImageLocation loc;
+
+ @SuppressWarnings("LeakingThisInConstructor")
+ Resource(Directory parent, ImageLocation loc, BasicFileAttributes fileAttrs) {
+ this(parent, ROOT.concat(loc.getFullname()), loc, fileAttrs);
+ }
+
+ @SuppressWarnings("LeakingThisInConstructor")
+ Resource(Directory parent, UTF8String name, ImageLocation loc, BasicFileAttributes fileAttrs) {
+ super(name, fileAttrs);
+ this.loc = loc;
+ parent.addChild(this);
+ }
+
+ @Override
+ public boolean isResource() {
+ return true;
+ }
+
+ @Override
+ public ImageLocation getLocation() {
+ return loc;
+ }
+
+ @Override
+ public long size() {
+ return loc.getUncompressedSize();
+ }
+
+ @Override
+ public long compressedSize() {
+ return loc.getCompressedSize();
+ }
+
+ @Override
+ public String extension() {
+ return loc.getExtensionString();
+ }
+
+ @Override
+ public long contentOffset() {
+ return loc.getContentOffset();
+ }
+ }
+
+ // directory management interface
+ public Directory getRootDirectory() {
+ return buildRootDirectory();
+ }
+
+ public Node findNode(String name) {
+ return findNode(new UTF8String(name));
+ }
+
+ public Node findNode(byte[] name) {
+ return findNode(new UTF8String(name));
+ }
+
+ public synchronized Node findNode(UTF8String name) {
+ buildRootDirectory();
+ return nodes.get(name);
+ }
+
+ private synchronized void clearNodes() {
+ nodes.clear();
+ rootDir = null;
+ }
+
+ /**
+ * Returns the file attributes of the image file.
+ */
+ private BasicFileAttributes imageFileAttributes() {
+ BasicFileAttributes attrs = imageFileAttributes;
+ if (attrs == null) {
+ try {
+ Path file = Paths.get(imagePath());
+ attrs = Files.readAttributes(file, BasicFileAttributes.class);
+ } catch (IOException ioe) {
+ throw new UncheckedIOException(ioe);
+ }
+ imageFileAttributes = attrs;
+ }
+ return attrs;
+ }
+
+ private synchronized Directory buildRootDirectory() {
+ if (rootDir != null) {
+ return rootDir;
+ }
+
+ // FIXME no time information per resource in jimage file (yet?)
+ // we use file attributes of jimage itself.
+ // root directory
+ rootDir = new Directory(null, ROOT, imageFileAttributes());
+ rootDir.setIsRootDir();
+ nodes.put(rootDir.getName(), rootDir);
+
+ ImageLocation[] locs = getAllLocations(true);
+ for (ImageLocation loc : locs) {
+ UTF8String parent = loc.getParent();
+ // directory where this location goes as child
+ Directory dir;
+ if (parent == null || parent.isEmpty()) {
+ // top level entry under root
+ dir = rootDir;
+ } else {
+ int idx = parent.lastIndexOf('/');
+ assert idx != -1 : "invalid parent string";
+ UTF8String name = ROOT.concat(parent.substring(0, idx));
+ dir = (Directory) nodes.get(name);
+ if (dir == null) {
+ // make all parent directories (as needed)
+ dir = makeDirectories(parent);
+ }
+ }
+ Resource entry = new Resource(dir, loc, imageFileAttributes());
+ nodes.put(entry.getName(), entry);
+ }
+
+ Node metaInf = nodes.get(META_INF);
+ if (metaInf instanceof Directory) {
+ metaInf.setIsMetaInfDir();
+ ((Directory)metaInf).walk(Node::setIsHidden);
+ }
+
+ fillPackageModuleInfo();
+
+ return rootDir;
+ }
+
+ private Directory newDirectory(Directory parent, UTF8String name) {
+ Directory dir = new Directory(parent, name, imageFileAttributes());
+ nodes.put(dir.getName(), dir);
+ return dir;
+ }
+
+ private Directory makeDirectories(UTF8String parent) {
+ assert !parent.isEmpty() : "non empty parent expected";
+
+ int idx = parent.indexOf('/');
+ assert idx != -1 : "invalid parent string";
+ UTF8String name = ROOT.concat(parent.substring(0, idx));
+ Directory top = (Directory) nodes.get(name);
+ if (top == null) {
+ top = newDirectory(rootDir, name);
+ }
+ Directory last = top;
+ while ((idx = parent.indexOf('/', idx + 1)) != -1) {
+ name = ROOT.concat(parent.substring(0, idx));
+ Directory nextDir = (Directory) nodes.get(name);
+ if (nextDir == null) {
+ nextDir = newDirectory(last, name);
+ }
+ last = nextDir;
+ }
+
+ return last;
+ }
+
+ private void fillPackageModuleInfo() {
+ assert rootDir != null;
+
+ packageMap.entrySet().stream().sorted((x, y)->x.getKey().compareTo(y.getKey())).forEach((entry) -> {
+ UTF8String moduleName = new UTF8String("/" + entry.getValue());
+ UTF8String fullName = moduleName.concat(new UTF8String(entry.getKey() + "/"));
+ if (! nodes.containsKey(fullName)) {
+ Directory module = (Directory) nodes.get(moduleName);
+ assert module != null : "module directory missing " + moduleName;
+ module.setIsModuleDir();
+
+ // hide "packages.offsets" in module directories
+ Node packagesOffsets = nodes.get(moduleName.concat(ROOT, PACKAGES_OFFSETS));
+ if (packagesOffsets != null) {
+ packagesOffsets.setIsHidden();
+ }
+
+ // package name without front '/'
+ UTF8String pkgName = new UTF8String(entry.getKey() + "/");
+ int idx = -1;
+ Directory moduleSubDir = module;
+ while ((idx = pkgName.indexOf('/', idx + 1)) != -1) {
+ UTF8String subPkg = pkgName.substring(0, idx);
+ UTF8String moduleSubDirName = moduleName.concat(ROOT, subPkg);
+ Directory tmp = (Directory) nodes.get(moduleSubDirName);
+ if (tmp == null) {
+ moduleSubDir = newDirectory(moduleSubDir, moduleSubDirName);
+ } else {
+ moduleSubDir = tmp;
+ }
+ }
+ // copy pkgDir "resources"
+ Directory pkgDir = (Directory) nodes.get(ROOT.concat(pkgName.substring(0, pkgName.length() - 1)));
+ pkgDir.setIsTopLevelPackageDir();
+ pkgDir.walk(n -> n.setIsHidden());
+ for (Node child : pkgDir.getChildren()) {
+ if (child.isResource()) {
+ ImageLocation loc = child.getLocation();
+ BasicFileAttributes imageFileAttrs = child.getFileAttributes();
+ UTF8String rsName = moduleName.concat(child.getName());
+ Resource rs = new Resource(moduleSubDir, rsName, loc, imageFileAttrs);
+ nodes.put(rs.getName(), rs);
+ }
+ }
+ }
+ });
+ }
+
+ public byte[] getResource(Node node) throws IOException {
+ if (node.isResource()) {
+ return super.getResource(node.getLocation());
+ }
+ throw new IOException("Not a resource: " + node);
+ }
+
+ public byte[] getResource(Resource rs) throws IOException {
+ return super.getResource(rs.getLocation());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStream.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.Arrays;
+
+class ImageStream {
+ private ByteBuffer buffer;
+
+ ImageStream() {
+ this(1024, ByteOrder.nativeOrder());
+ }
+
+ ImageStream(int size) {
+ this(size, ByteOrder.nativeOrder());
+ }
+
+ ImageStream(byte[] bytes) {
+ this(bytes, ByteOrder.nativeOrder());
+ }
+
+ ImageStream(ByteOrder byteOrder) {
+ this(1024, byteOrder);
+ }
+
+ ImageStream(int size, ByteOrder byteOrder) {
+ buffer = ByteBuffer.allocate(size);
+ buffer.order(byteOrder);
+ }
+
+ ImageStream(byte[] bytes, ByteOrder byteOrder) {
+ buffer = ByteBuffer.wrap(bytes);
+ buffer.order(byteOrder);
+ }
+
+ ImageStream(ByteBuffer buffer) {
+ this.buffer = buffer;
+ }
+
+ ImageStream align(int alignment) {
+ int padding = (getSize() - 1) & ((1 << alignment) - 1);
+
+ for (int i = 0; i < padding; i++) {
+ put((byte)0);
+ }
+
+ return this;
+ }
+
+ private void ensure(int needs) {
+ assert 0 <= needs : "Negative needs";
+
+ if (needs > buffer.remaining()) {
+ byte[] bytes = buffer.array();
+ ByteOrder byteOrder = buffer.order();
+ int position = buffer.position();
+ int newSize = needs <= bytes.length ? bytes.length << 1 : position + needs;
+ buffer = ByteBuffer.allocate(newSize);
+ buffer.order(byteOrder);
+ buffer.put(bytes, 0, position);
+ }
+ }
+
+ boolean hasByte() {
+ return buffer.remaining() != 0;
+ }
+
+ boolean hasBytes(int needs) {
+ return needs <= buffer.remaining();
+ }
+
+ void skip(int n) {
+ assert 0 <= n : "Negative offset";
+ buffer.position(buffer.position() + n);
+ }
+
+ int get() {
+ return buffer.get() & 0xFF;
+ }
+
+ void get(byte bytes[], int offset, int size) {
+ buffer.get(bytes, offset, size);
+ }
+
+ int getShort() {
+ return buffer.getShort();
+ }
+
+ int getInt() {
+ return buffer.getInt();
+ }
+
+ long getLong() {
+ return buffer.getLong();
+ }
+
+ ImageStream put(byte byt) {
+ ensure(1);
+ buffer.put(byt);
+
+ return this;
+ }
+
+ ImageStream put(int byt) {
+ return put((byte)byt);
+ }
+
+ ImageStream put(byte bytes[], int offset, int size) {
+ ensure(size);
+ buffer.put(bytes, offset, size);
+
+ return this;
+ }
+
+ ImageStream put(ImageStream stream) {
+ put(stream.buffer.array(), 0, stream.buffer.position());
+
+ return this;
+ }
+
+ ImageStream putShort(short value) {
+ ensure(2);
+ buffer.putShort(value);
+
+ return this;
+ }
+
+ ImageStream putShort(int value) {
+ return putShort((short)value);
+ }
+
+ ImageStream putInt(int value) {
+ ensure(4);
+ buffer.putInt(value);
+
+ return this;
+ }
+
+ ImageStream putLong(long value) {
+ ensure(8);
+ buffer.putLong(value);
+
+ return this;
+ }
+
+ ByteBuffer getBuffer() {
+ return buffer;
+ }
+
+ int getPosition() {
+ return buffer.position();
+ }
+
+ int getSize() {
+ return buffer.position();
+ }
+
+ byte[] getBytes() {
+ return buffer.array();
+ }
+
+ void setPosition(int offset) {
+ buffer.position(offset);
+ }
+
+ byte[] toArray() {
+ return Arrays.copyOf(buffer.array(), buffer.position());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStrings.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage;
+
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+
+class ImageStrings {
+ private static final int NOT_FOUND = -1;
+ static final int EMPTY_OFFSET = 0;
+
+ private final HashMap<UTF8String, Integer> stringToOffsetMap;
+ private final ImageStream stream;
+
+ ImageStrings() {
+ this.stringToOffsetMap = new HashMap<>();
+ this.stream = new ImageStream();
+
+ // Reserve 0 offset for empty string.
+ int offset = addString(UTF8String.EMPTY_STRING);
+ assert offset == 0 : "Empty string not zero offset";
+ // Reserve 1 offset for frequently used ".class".
+ addString(UTF8String.CLASS_STRING);
+ }
+
+ ImageStrings(ImageStream stream) {
+ this.stringToOffsetMap = new HashMap<>();
+ this.stream = stream;
+ }
+
+ private int addString(final UTF8String string) {
+ int offset = stream.getPosition();
+ string.writeTo(stream);
+ stream.put('\0');
+ stringToOffsetMap.put(string, offset);
+
+ return offset;
+ }
+
+ int add(final UTF8String string) {
+ int offset = find(string);
+
+ return offset == NOT_FOUND ? addString(string) : offset;
+ }
+
+ int find(final UTF8String string) {
+ Integer offset = stringToOffsetMap.get(string);
+
+ return offset != null ? offset : NOT_FOUND;
+ }
+
+ UTF8String get(int offset) {
+ ByteBuffer buffer = stream.getBuffer();
+ assert 0 <= offset && offset < buffer.capacity() : "String buffer offset out of range";
+ int zero = NOT_FOUND;
+ for (int i = offset; i < buffer.capacity(); i++) {
+ if (buffer.get(i) == '\0') {
+ zero = i;
+ break;
+ }
+ }
+ assert zero != UTF8String.NOT_FOUND;
+ int length = zero - offset;
+ byte[] bytes = new byte[length];
+ int mark = buffer.position();
+ buffer.position(offset);
+ buffer.get(bytes);
+ buffer.position(mark);
+
+ return new UTF8String(bytes, 0, length);
+ }
+
+ ImageStream getStream() {
+ return stream;
+ }
+
+ int getSize() {
+ return stream.getSize();
+ }
+
+ int getCount() {
+ return stringToOffsetMap.size();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/PReader.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.channels.FileChannel;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Supports reading a file from given positions (offsets) in the file.
+ */
+
+public abstract class PReader implements Closeable {
+ private final FileChannel fc;
+
+ protected PReader(FileChannel fc) {
+ this.fc = fc;
+ }
+
+ /**
+ * Returns the {@code FileChannel}.
+ */
+ final FileChannel channel() {
+ return fc;
+ }
+
+ /**
+ * Closes this {@code PReader} and the underlying file.
+ */
+ @Override
+ public final void close() throws IOException {
+ fc.close();
+ }
+
+ /**
+ * Returns {@code true} if this {@code PReader} and the underlying file is
+ * open.
+ */
+ public final boolean isOpen() {
+ return fc.isOpen();
+ }
+
+ /**
+ * Returns {@code len} bytes from a given position in the file. The bytes
+ * are returned as a byte array.
+ *
+ * @throws IOException if an I/O error occurs
+ */
+ public abstract byte[] read(int len, long position) throws IOException;
+
+ /**
+ * Opens the given file, returning a {@code PReader} to read from the file.
+ *
+ * @implNote Returns a {@code PReader} that supports concurrent pread operations
+ * if possible, otherwise a simple {@code PReader} that doesn't support
+ * concurrent operations.
+ */
+ static PReader open(String file) throws IOException {
+ Class<?> clazz;
+ try {
+ clazz = Class.forName("jdk.internal.jimage.concurrent.ConcurrentPReader");
+ } catch (ClassNotFoundException e) {
+ return new SimplePReader(file);
+ }
+ try {
+ Constructor<?> ctor = clazz.getConstructor(String.class);
+ return (PReader) ctor.newInstance(file);
+ } catch (InvocationTargetException e) {
+ Throwable cause = e.getCause();
+ if (cause instanceof IOException)
+ throw (IOException) cause;
+ if (cause instanceof Error)
+ throw (Error) cause;
+ if (cause instanceof RuntimeException)
+ throw (RuntimeException) cause;
+ throw new Error(e);
+ } catch (NoSuchMethodException | IllegalAccessException |
+ InstantiationException e) {
+ throw new InternalError(e);
+ }
+ }
+}
+
+/**
+ * Simple PReader implementation based on {@code RandomAccessFile}.
+ *
+ * @implNote This class cannot use FileChannel read methods to do the
+ * positional reads because FileChannel is interruptible.
+ */
+class SimplePReader extends PReader {
+ private final RandomAccessFile raf;
+
+ private SimplePReader(RandomAccessFile raf) throws IOException {
+ super(raf.getChannel());
+ this.raf = raf;
+ }
+
+ SimplePReader(String file) throws IOException {
+ this(new RandomAccessFile(file, "r"));
+ }
+
+ @Override
+ public byte[] read(int len, long position) throws IOException {
+ synchronized (this) {
+ byte[] bytes = new byte[len];
+ raf.seek(position);
+ int n = raf.read(bytes);
+ if (n != len)
+ throw new InternalError("short read, not handled yet");
+ return bytes;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/PackageModuleMap.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+// Utility to read module info from .jimage file.
+
+public final class PackageModuleMap {
+ private PackageModuleMap() {}
+
+ public static final String MODULES_ENTRY = "module/modules.offsets";
+ public static final String PACKAGES_ENTRY = "packages.offsets";
+
+ /*
+ * Returns a package-to-module map.
+ *
+ * The package name is in binary name format.
+ */
+ static Map<String,String> readFrom(ImageReader reader) throws IOException {
+ Map<String,String> result = new HashMap<>();
+ List<String> moduleNames = reader.getNames(MODULES_ENTRY);
+
+ for (String moduleName : moduleNames) {
+ List<String> packageNames = reader.getNames(moduleName + "/" + PACKAGES_ENTRY);
+
+ for (String packageName : packageNames) {
+ result.put(packageName, moduleName);
+ }
+ }
+ return result;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/Resource.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.jimage;
+
+/**
+ * Resource is a class or resource file.
+ */
+public class Resource {
+ private final String name;
+ private final long size;
+ private final long csize;
+
+ public Resource(String name, long size, long csize) {
+ this.name = name;
+ this.size = size;
+ this.csize = csize;
+ }
+
+ /**
+ * Returns the name of this entry.
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
+ * Returns the number of uncompressed bytes for this entry.
+ */
+ public long size() {
+ return size;
+ }
+
+ /**
+ * Returns the number of compressed bytes for this entry; 0 if
+ * uncompressed.
+ */
+ public long csize() {
+ return csize;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s uncompressed size %d compressed size %d", name, size, csize);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/UTF8String.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage;
+
+import java.nio.charset.Charset;
+import java.util.Arrays;
+
+public final class UTF8String implements CharSequence {
+
+ // Same as StandardCharsets.UTF_8 without loading all of the standard charsets
+ static final Charset UTF_8 = Charset.forName("UTF-8");
+
+ static final int NOT_FOUND = -1;
+ static final int HASH_MULTIPLIER = 0x01000193;
+ static final UTF8String EMPTY_STRING = new UTF8String("");
+ static final UTF8String CLASS_STRING = new UTF8String(".class");
+
+ final byte[] bytes;
+ final int offset;
+ final int count;
+ int hashcode;
+
+ public UTF8String(byte[] bytes, int offset, int count) {
+ if (offset < 0 || count < 0 || (offset + count) > bytes.length) {
+ throw new IndexOutOfBoundsException("offset/count out of range");
+ }
+ this.bytes = bytes;
+ this.offset = offset;
+ this.count = count;
+ this.hashcode = -1;
+ }
+
+ public UTF8String(byte[] bytes, int offset) {
+ this(bytes, offset, bytes.length - offset);
+ }
+
+ public UTF8String(byte[] bytes) {
+ this(bytes, 0, bytes.length);
+ }
+
+ public UTF8String(String string) {
+ this(stringToBytes(string));
+ }
+
+ @Override
+ public int length() {
+ return count;
+ }
+
+ public boolean isEmpty() {
+ return count == 0;
+ }
+
+ public int byteAt(int index) {
+ return bytes[offset + index] & 0xFF;
+ }
+
+ public UTF8String concat(UTF8String s) {
+ int total = count + s.count;
+ byte[] combined = new byte[total];
+ System.arraycopy(bytes, offset, combined, 0, count);
+ System.arraycopy(s.bytes, s.offset, combined, count, s.count);
+
+ return new UTF8String(combined, 0, total);
+ }
+
+ public UTF8String concat(UTF8String... s) {
+ int total = count;
+
+ for (UTF8String i : s) {
+ total += i.count;
+ }
+
+ byte[] combined = new byte[total];
+ System.arraycopy(bytes, offset, combined, 0, count);
+ int next = count;
+
+ for (UTF8String i : s) {
+ System.arraycopy(i.bytes, i.offset, combined, next, i.count);
+ next += i.count;
+ }
+
+ return new UTF8String(combined, 0, total);
+ }
+
+ public UTF8String substring(int offset) {
+ return substring(offset, this.count - offset);
+ }
+
+ public UTF8String substring(int offset, int count) {
+ int newOffset = this.offset + offset;
+ return new UTF8String(bytes, newOffset, count);
+ }
+
+ public UTF8String trimToSize() {
+ return offset == 0 && bytes.length == count ? this :
+ new UTF8String(Arrays.copyOfRange(bytes, offset, offset + count));
+ }
+
+ public int indexOf(int ch) {
+ return indexOf(ch, 0);
+ }
+
+ public int indexOf(int ch, int start) {
+ for (int i = Math.max(start, 0); i < count; i++) {
+ if (byteAt(i) == ch) {
+ return i;
+ }
+ }
+
+ return NOT_FOUND;
+ }
+
+ public int lastIndexOf(int ch) {
+ return lastIndexOf(ch, count - 1);
+ }
+
+ public int lastIndexOf(int ch, int start) {
+ for (int i = Math.min(start, count); i > 0; i--) {
+ if (byteAt(i) == ch) {
+ return i;
+ }
+ }
+
+ return NOT_FOUND;
+ }
+
+ void writeTo(ImageStream buffer) {
+ buffer.put(bytes, offset, count);
+ }
+
+ static int hashCode(int seed, byte[] bytes, int offset, int count) {
+ for (int i = offset, limit = offset + count; i < limit; i++) {
+ seed = (seed * HASH_MULTIPLIER) ^ (bytes[i] & 0xFF);
+ }
+
+ return seed & 0x7FFFFFFF;
+ }
+
+ int hashCode(int base) {
+ return hashCode(base, bytes, offset, count);
+ }
+
+ @Override
+ public int hashCode() {
+ if (hashcode < 0) {
+ hashcode = hashCode(HASH_MULTIPLIER, bytes, offset, count);
+ }
+
+ return hashcode;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ return equals(this, (UTF8String)obj);
+ }
+
+ private static boolean equals(UTF8String a, UTF8String b) {
+ if (a == b) {
+ return true;
+ }
+
+ int count = a.count;
+
+ if (count != b.count) {
+ return false;
+ }
+
+ byte[] aBytes = a.bytes;
+ byte[] bBytes = b.bytes;
+ int aOffset = a.offset;
+ int bOffset = b.offset;
+
+ for (int i = 0; i < count; i++) {
+ if (aBytes[aOffset + i] != bBytes[bOffset + i]) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ byte[] getBytes() {
+ if (offset != 0 || bytes.length != count) {
+ return Arrays.copyOfRange(bytes, offset, offset + count);
+ }
+
+ return bytes;
+ }
+
+ private static byte[] stringToBytes(String string) {
+ return string.getBytes(UTF_8);
+ }
+
+ @Override
+ public String toString() {
+ return new String(bytes, offset, count, UTF_8);
+ }
+
+ @Override
+ public char charAt(int index) {
+ int ch = byteAt(index);
+
+ return (ch & 0x80) != 0 ? (char)ch : '\0';
+ }
+
+ @Override
+ public CharSequence subSequence(int start, int end) {
+ return (CharSequence)substring(start, end - start);
+ }
+
+ static UTF8String match(UTF8String a, UTF8String b) {
+ int aCount = a.count;
+ int bCount = b.count;
+
+ if (aCount < bCount) {
+ return null;
+ }
+
+ byte[] aBytes = a.bytes;
+ byte[] bBytes = b.bytes;
+ int aOffset = a.offset;
+ int bOffset = b.offset;
+
+ for (int i = 0; i < bCount; i++) {
+ if (aBytes[aOffset + i] != bBytes[bOffset + i]) {
+ return null;
+ }
+ }
+
+ return new UTF8String(aBytes, aOffset + bCount, aCount - bCount);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/concurrent/ConcurrentPReader.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage.concurrent;
+
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import jdk.internal.jimage.PReader;
+
+import sun.misc.Unsafe;
+
+/**
+ * A PReader implementation that supports concurrent pread operations.
+ */
+public class ConcurrentPReader extends PReader {
+
+ private static final Unsafe UNSAFE = Unsafe.getUnsafe();
+ private static final long BA_OFFSET = (long) UNSAFE.arrayBaseOffset(byte[].class);
+
+ /**
+ * A temporary buffer that is cached on a per-thread basis.
+ */
+ private static class TemporaryBuffer {
+ static final ThreadLocal<TemporaryBuffer> CACHED_BUFFER =
+ new ThreadLocal<TemporaryBuffer>() {
+ @Override
+ protected TemporaryBuffer initialValue() { return null; }
+ };
+
+ static final TemporaryBuffer NOT_AVAILABLE = new TemporaryBuffer(0L, 0);
+
+ final long address;
+ final int size;
+
+ TemporaryBuffer(long address, int size) {
+ this.address = address;
+ this.size = size;
+ }
+
+ long address() { return address; }
+ int size() { return size; }
+
+ /**
+ * Returns the {@code TemporaryBuffer} for the current thread. The buffer
+ * is guaranteed to be of at least the given size. Returns {@code null}
+ * if a buffer cannot be cached for this thread.
+ */
+ static TemporaryBuffer get(int len) {
+ TemporaryBuffer buffer = CACHED_BUFFER.get();
+
+ // cached buffer large enough?
+ if (buffer != null && buffer.size() >= len) {
+ return buffer;
+ }
+
+ // if this is an InnocuousThread then don't return anything
+ if (buffer == NOT_AVAILABLE)
+ return null;
+
+ if (buffer != null) {
+ // replace buffer in cache with a larger buffer
+ long originalAddress = buffer.address();
+ long address = UNSAFE.allocateMemory(len);
+ buffer = new TemporaryBuffer(address, len);
+ CACHED_BUFFER.set(buffer);
+ UNSAFE.freeMemory(originalAddress);
+ } else {
+ // first usage.
+ if (Thread.currentThread() instanceof sun.misc.InnocuousThread) {
+ buffer = NOT_AVAILABLE;
+ } else {
+ long address = UNSAFE.allocateMemory(len);
+ buffer = new TemporaryBuffer(address, len);
+ }
+ CACHED_BUFFER.set(buffer);
+ }
+ return buffer;
+ }
+ }
+
+ private final FileDescriptor fd;
+
+ private ConcurrentPReader(FileInputStream fis) throws IOException {
+ super(fis.getChannel());
+ this.fd = fis.getFD();
+ }
+
+ public ConcurrentPReader(String file) throws IOException {
+ this(new FileInputStream(file));
+ }
+
+ @Override
+ public byte[] read(int len, long position) throws IOException {
+ // need a temporary area of memory to read into
+ TemporaryBuffer buffer = TemporaryBuffer.get(len);
+ long address;
+ if (buffer == null) {
+ address = UNSAFE.allocateMemory(len);
+ } else {
+ address = buffer.address();
+ }
+ try {
+ int n = pread(fd, address, len, position);
+ if (n != len)
+ throw new InternalError("short read, not handled yet");
+ byte[] result = new byte[n];
+ UNSAFE.copyMemory(null, address, result, BA_OFFSET, len);
+ return result;
+ } finally {
+ if (buffer == null) {
+ UNSAFE.freeMemory(address);
+ }
+ }
+ }
+
+ private static native int pread(FileDescriptor fd, long address, int len, long pos)
+ throws IOException;
+
+ private static native void initIDs();
+
+ static {
+ System.loadLibrary("java");
+ initIDs();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtDirectoryStream.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.nio.file.DirectoryStream;
+import java.nio.file.ClosedDirectoryStreamException;
+import java.nio.file.DirectoryIteratorException;
+import java.nio.file.NotDirectoryException;
+import java.nio.file.Path;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.io.IOException;
+
+final class JrtDirectoryStream implements DirectoryStream<Path> {
+ private final JrtFileSystem jrtfs;
+ private final byte[] path;
+ // prefix to be used for children of this directory
+ // so that child path are reported relatively (if needed)
+ private final String childPrefix;
+ private final DirectoryStream.Filter<? super Path> filter;
+ private volatile boolean isClosed;
+ private volatile Iterator<Path> itr;
+
+ JrtDirectoryStream(JrtPath jrtPath,
+ DirectoryStream.Filter<? super java.nio.file.Path> filter)
+ throws IOException
+ {
+ this.jrtfs = jrtPath.getFileSystem();
+ this.path = jrtPath.getResolvedPath();
+ // sanity check
+ if (!jrtfs.isDirectory(path))
+ throw new NotDirectoryException(jrtPath.toString());
+
+ // absolute path and does not have funky chars in front like /./java.base
+ if (jrtPath.isAbsolute() && (path.length == jrtPath.getPathLength())) {
+ childPrefix = null;
+ } else {
+ // cases where directory content needs to modified with prefix
+ // like ./java.base, /./java.base, java.base and so on.
+ String dirName = jrtPath.toString();
+ int idx = dirName.indexOf(JrtFileSystem.getString(path).substring(1));
+ childPrefix = dirName.substring(0, idx);
+ }
+ this.filter = filter;
+ }
+
+ @Override
+ public synchronized Iterator<Path> iterator() {
+ if (isClosed)
+ throw new ClosedDirectoryStreamException();
+ if (itr != null)
+ throw new IllegalStateException("Iterator has already been returned");
+
+ try {
+ itr = jrtfs.iteratorOf(path, childPrefix);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+ return new Iterator<Path>() {
+ /*
+ * next Path value to return from this iterator.
+ * null value means hasNext() not called yet
+ * or last hasNext() returned false or resulted
+ * in exception. If last hasNext() returned true,
+ * then this field has non-null value.
+ */
+ private Path next;
+
+ // get-and-clear and set-next by these methods
+ private Path getAndClearNext() {
+ assert next != null;
+ Path result = this.next;
+ this.next = null;
+ return result;
+ }
+
+ private void setNext(Path path) {
+ assert path != null;
+ this.next = path;
+ }
+
+ // if hasNext() returns true, 'next' field has non-null Path
+ @Override
+ public synchronized boolean hasNext() {
+ if (next != null) {
+ return true;
+ }
+
+ if (isClosed) {
+ return false;
+ }
+
+ if (filter == null) {
+ if (itr.hasNext()) {
+ setNext(itr.next());
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ while (itr.hasNext()) {
+ Path tmpPath = itr.next();
+ try {
+ if (filter.accept(tmpPath)) {
+ setNext(tmpPath);
+ return true;
+ }
+ } catch (IOException ioe) {
+ throw new DirectoryIteratorException(ioe);
+ }
+ }
+
+ return false;
+ }
+ }
+
+ @Override
+ public synchronized Path next() {
+ if (next != null) {
+ return getAndClearNext();
+ }
+
+ if (isClosed) {
+ throw new NoSuchElementException();
+ }
+
+ if (next == null && itr.hasNext()) {
+ // missing hasNext() between next() calls.
+ if (hasNext()) {
+ return getAndClearNext();
+ }
+ }
+
+ throw new NoSuchElementException();
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+
+ @Override
+ public synchronized void close() throws IOException {
+ isClosed = true;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileAttributeView.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.nio.file.attribute.*;
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+final class JrtFileAttributeView implements BasicFileAttributeView
+{
+ private static enum AttrID {
+ size,
+ creationTime,
+ lastAccessTime,
+ lastModifiedTime,
+ isDirectory,
+ isRegularFile,
+ isSymbolicLink,
+ isOther,
+ fileKey,
+ compressedSize,
+ extension
+ };
+
+ private final JrtPath path;
+ private final boolean isJrtView;
+
+ private JrtFileAttributeView(JrtPath path, boolean isJrtView) {
+ this.path = path;
+ this.isJrtView = isJrtView;
+ }
+
+ @SuppressWarnings("unchecked") // Cast to V
+ static <V extends FileAttributeView> V get(JrtPath path, Class<V> type) {
+ if (type == null)
+ throw new NullPointerException();
+ if (type == BasicFileAttributeView.class)
+ return (V)new JrtFileAttributeView(path, false);
+ if (type == JrtFileAttributeView.class)
+ return (V)new JrtFileAttributeView(path, true);
+ return null;
+ }
+
+ static JrtFileAttributeView get(JrtPath path, String type) {
+ if (type == null)
+ throw new NullPointerException();
+ if (type.equals("basic"))
+ return new JrtFileAttributeView(path, false);
+ if (type.equals("jjrt"))
+ return new JrtFileAttributeView(path, true);
+ return null;
+ }
+
+ @Override
+ public String name() {
+ return isJrtView ? "jjrt" : "basic";
+ }
+
+ @Override
+ public JrtFileAttributes readAttributes() throws IOException
+ {
+ return path.getAttributes();
+ }
+
+ @Override
+ public void setTimes(FileTime lastModifiedTime,
+ FileTime lastAccessTime,
+ FileTime createTime)
+ throws IOException
+ {
+ path.setTimes(lastModifiedTime, lastAccessTime, createTime);
+ }
+
+ void setAttribute(String attribute, Object value)
+ throws IOException
+ {
+ try {
+ if (AttrID.valueOf(attribute) == AttrID.lastModifiedTime)
+ setTimes ((FileTime)value, null, null);
+ if (AttrID.valueOf(attribute) == AttrID.lastAccessTime)
+ setTimes (null, (FileTime)value, null);
+ if (AttrID.valueOf(attribute) == AttrID.creationTime)
+ setTimes (null, null, (FileTime)value);
+ return;
+ } catch (IllegalArgumentException x) {}
+ throw new UnsupportedOperationException("'" + attribute +
+ "' is unknown or read-only attribute");
+ }
+
+ Map<String, Object> readAttributes(String attributes)
+ throws IOException
+ {
+ JrtFileAttributes jrtfas = readAttributes();
+ LinkedHashMap<String, Object> map = new LinkedHashMap<>();
+ if ("*".equals(attributes)) {
+ for (AttrID id : AttrID.values()) {
+ try {
+ map.put(id.name(), attribute(id, jrtfas));
+ } catch (IllegalArgumentException x) {}
+ }
+ } else {
+ String[] as = attributes.split(",");
+ for (String a : as) {
+ try {
+ map.put(a, attribute(AttrID.valueOf(a), jrtfas));
+ } catch (IllegalArgumentException x) {}
+ }
+ }
+ return map;
+ }
+
+ Object attribute(AttrID id, JrtFileAttributes jrtfas) {
+ switch (id) {
+ case size:
+ return jrtfas.size();
+ case creationTime:
+ return jrtfas.creationTime();
+ case lastAccessTime:
+ return jrtfas.lastAccessTime();
+ case lastModifiedTime:
+ return jrtfas.lastModifiedTime();
+ case isDirectory:
+ return jrtfas.isDirectory();
+ case isRegularFile:
+ return jrtfas.isRegularFile();
+ case isSymbolicLink:
+ return jrtfas.isSymbolicLink();
+ case isOther:
+ return jrtfas.isOther();
+ case fileKey:
+ return jrtfas.fileKey();
+ case compressedSize:
+ if (isJrtView)
+ return jrtfas.compressedSize();
+ break;
+ case extension:
+ if (isJrtView) {
+ return jrtfas.extension();
+ }
+ break;
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileAttributes.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.attribute.FileTime;
+import java.util.Formatter;
+import jdk.internal.jimage.ImageReader.Node;
+
+final class JrtFileAttributes implements BasicFileAttributes
+{
+ private final Node node;
+
+ JrtFileAttributes(Node node) {
+ this.node = node;
+ }
+
+ ///////// basic attributes ///////////
+ @Override
+ public FileTime creationTime() {
+ return node.creationTime();
+ }
+
+ @Override
+ public boolean isDirectory() {
+ return node.isDirectory();
+ }
+
+ @Override
+ public boolean isOther() {
+ return false;
+ }
+
+ @Override
+ public boolean isRegularFile() {
+ return !isDirectory();
+ }
+
+ @Override
+ public FileTime lastAccessTime() {
+ return node.lastAccessTime();
+ }
+
+ @Override
+ public FileTime lastModifiedTime() {
+ return node.lastModifiedTime();
+ }
+
+ @Override
+ public long size() {
+ return node.size();
+ }
+
+ @Override
+ public boolean isSymbolicLink() {
+ return false;
+ }
+
+ @Override
+ public Object fileKey() {
+ return null;
+ }
+
+ ///////// jrt entry attributes ///////////
+ public long compressedSize() {
+ return node.compressedSize();
+ }
+
+ public String extension() {
+ return node.extension();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder(1024);
+ try (Formatter fm = new Formatter(sb)) {
+ if (creationTime() != null)
+ fm.format(" creationTime : %tc%n", creationTime().toMillis());
+ else
+ fm.format(" creationTime : null%n");
+
+ if (lastAccessTime() != null)
+ fm.format(" lastAccessTime : %tc%n", lastAccessTime().toMillis());
+ else
+ fm.format(" lastAccessTime : null%n");
+ fm.format(" lastModifiedTime: %tc%n", lastModifiedTime().toMillis());
+ fm.format(" isRegularFile : %b%n", isRegularFile());
+ fm.format(" isDirectory : %b%n", isDirectory());
+ fm.format(" isSymbolicLink : %b%n", isSymbolicLink());
+ fm.format(" isOther : %b%n", isOther());
+ fm.format(" fileKey : %s%n", fileKey());
+ fm.format(" size : %d%n", size());
+ fm.format(" compressedSize : %d%n", compressedSize());
+ fm.format(" extension : %s%n", extension());
+ }
+ return sb.toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileStore.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.FileStore;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.attribute.FileAttributeView;
+import java.nio.file.attribute.FileStoreAttributeView;
+import java.nio.file.attribute.BasicFileAttributeView;
+
+final class JrtFileStore extends FileStore {
+
+ private final JrtFileSystem jrtfs;
+
+ JrtFileStore(JrtPath jrtPath) {
+ this.jrtfs = jrtPath.getFileSystem();
+ }
+
+ @Override
+ public String name() {
+ return jrtfs.toString() + "/";
+ }
+
+ @Override
+ public String type() {
+ return "jrtfs";
+ }
+
+ @Override
+ public boolean isReadOnly() {
+ return jrtfs.isReadOnly();
+ }
+
+ @Override
+ public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) {
+ return (type == BasicFileAttributeView.class ||
+ type == JrtFileAttributeView.class);
+ }
+
+ @Override
+ public boolean supportsFileAttributeView(String name) {
+ return name.equals("basic") || name.equals("jrt");
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type) {
+ if (type == null)
+ throw new NullPointerException();
+ return (V)null;
+ }
+
+ @Override
+ public long getTotalSpace() throws IOException {
+ throw new UnsupportedOperationException("getTotalSpace");
+ }
+
+ @Override
+ public long getUsableSpace() throws IOException {
+ throw new UnsupportedOperationException("getUsableSpace");
+ }
+
+ @Override
+ public long getUnallocatedSpace() throws IOException {
+ throw new UnsupportedOperationException("getUnallocatedSpace");
+ }
+
+ @Override
+ public Object getAttribute(String attribute) throws IOException {
+ throw new UnsupportedOperationException("does not support " + attribute);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,535 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.jrtfs;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.*;
+import java.nio.charset.Charset;
+import java.nio.file.AccessMode;
+import java.nio.file.ClosedFileSystemException;
+import java.nio.file.CopyOption;
+import java.nio.file.FileStore;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystemException;
+import java.nio.file.FileSystemNotFoundException;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.NotDirectoryException;
+import java.nio.file.OpenOption;
+import java.nio.file.Path;
+import java.nio.file.PathMatcher;
+import java.nio.file.ReadOnlyFileSystemException;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.StandardOpenOption;
+import java.nio.file.WatchService;
+import java.nio.file.attribute.FileAttribute;
+import java.nio.file.attribute.FileTime;
+import java.nio.file.attribute.UserPrincipalLookupService;
+import java.nio.file.spi.FileSystemProvider;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import jdk.internal.jimage.ImageReader;
+import jdk.internal.jimage.ImageReader.Node;
+import jdk.internal.jimage.UTF8String;
+
+/**
+ * A FileSystem built on System jimage files.
+ */
+class JrtFileSystem extends FileSystem {
+ private static final Charset UTF_8 = Charset.forName("UTF-8");
+ private final JrtFileSystemProvider provider;
+ // System image readers
+ private ImageReader bootImage;
+ private ImageReader extImage;
+ private ImageReader appImage;
+ // root path
+ private final JrtPath rootPath;
+ private volatile boolean isOpen;
+
+ private static void checkExists(Path path) {
+ if (Files.notExists(path)) {
+ throw new FileSystemNotFoundException(path.toString());
+ }
+ }
+
+ // open a .jimage and build directory structure
+ private static ImageReader openImage(Path path) throws IOException {
+ ImageReader image = ImageReader.open(path.toString());
+ image.getRootDirectory();
+ return image;
+ }
+
+ JrtFileSystem(JrtFileSystemProvider provider,
+ Map<String, ?> env)
+ throws IOException {
+ this.provider = provider;
+ checkExists(SystemImages.bootImagePath);
+ checkExists(SystemImages.extImagePath);
+ checkExists(SystemImages.appImagePath);
+
+ // open image files
+ this.bootImage = openImage(SystemImages.bootImagePath);
+ this.extImage = openImage(SystemImages.extImagePath);
+ this.appImage = openImage(SystemImages.appImagePath);
+
+ rootPath = new JrtPath(this, new byte[]{'/'});
+ isOpen = true;
+ }
+
+ @Override
+ public FileSystemProvider provider() {
+ return provider;
+ }
+
+ @Override
+ public String getSeparator() {
+ return "/";
+ }
+
+ @Override
+ public boolean isOpen() {
+ return isOpen;
+ }
+
+ @Override
+ public void close() throws IOException {
+ cleanup();
+ }
+
+ @Override
+ protected void finalize() {
+ try {
+ cleanup();
+ } catch (IOException ignored) {}
+ }
+
+ // clean up this file system - called from finalize and close
+ private void cleanup() throws IOException {
+ if (!isOpen) {
+ return;
+ }
+
+ synchronized(this) {
+ isOpen = false;
+
+ // close all image readers and null out
+ bootImage.close();
+ extImage.close();
+ appImage.close();
+ bootImage = null;
+ extImage = null;
+ appImage = null;
+ }
+ }
+
+ private void ensureOpen() throws IOException {
+ if (!isOpen) {
+ throw new ClosedFileSystemException();
+ }
+ }
+
+ @Override
+ public boolean isReadOnly() {
+ return true;
+ }
+
+ private ReadOnlyFileSystemException readOnly() {
+ return new ReadOnlyFileSystemException();
+ }
+
+ @Override
+ public Iterable<Path> getRootDirectories() {
+ ArrayList<Path> pathArr = new ArrayList<>();
+ pathArr.add(rootPath);
+ return pathArr;
+ }
+
+ JrtPath getRootPath() {
+ return rootPath;
+ }
+
+ @Override
+ public JrtPath getPath(String first, String... more) {
+ String path;
+ if (more.length == 0) {
+ path = first;
+ } else {
+ StringBuilder sb = new StringBuilder();
+ sb.append(first);
+ for (String segment : more) {
+ if (segment.length() > 0) {
+ if (sb.length() > 0) {
+ sb.append('/');
+ }
+ sb.append(segment);
+ }
+ }
+ path = sb.toString();
+ }
+ return new JrtPath(this, getBytes(path));
+ }
+
+ @Override
+ public UserPrincipalLookupService getUserPrincipalLookupService() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public WatchService newWatchService() {
+ throw new UnsupportedOperationException();
+ }
+
+ FileStore getFileStore(JrtPath path) {
+ return new JrtFileStore(path);
+ }
+
+ @Override
+ public Iterable<FileStore> getFileStores() {
+ ArrayList<FileStore> list = new ArrayList<>(1);
+ list.add(new JrtFileStore(new JrtPath(this, new byte[]{'/'})));
+ return list;
+ }
+
+ private static final Set<String> supportedFileAttributeViews
+ = Collections.unmodifiableSet(
+ new HashSet<String>(Arrays.asList("basic", "jrt")));
+
+ @Override
+ public Set<String> supportedFileAttributeViews() {
+ return supportedFileAttributeViews;
+ }
+
+ @Override
+ public String toString() {
+ return "jrt:/";
+ }
+
+ private static final String GLOB_SYNTAX = "glob";
+ private static final String REGEX_SYNTAX = "regex";
+
+ @Override
+ public PathMatcher getPathMatcher(String syntaxAndInput) {
+ int pos = syntaxAndInput.indexOf(':');
+ if (pos <= 0 || pos == syntaxAndInput.length()) {
+ throw new IllegalArgumentException();
+ }
+ String syntax = syntaxAndInput.substring(0, pos);
+ String input = syntaxAndInput.substring(pos + 1);
+ String expr;
+ if (syntax.equals(GLOB_SYNTAX)) {
+ expr = JrtUtils.toRegexPattern(input);
+ } else {
+ if (syntax.equals(REGEX_SYNTAX)) {
+ expr = input;
+ } else {
+ throw new UnsupportedOperationException("Syntax '" + syntax
+ + "' not recognized");
+ }
+ }
+ // return matcher
+ final Pattern pattern = Pattern.compile(expr);
+ return (Path path) -> pattern.matcher(path.toString()).matches();
+ }
+
+ static byte[] getBytes(String name) {
+ return name.getBytes(UTF_8);
+ }
+
+ static String getString(byte[] name) {
+ return new String(name, UTF_8);
+ }
+
+ private static class NodeAndImage {
+ final Node node;
+ final ImageReader image;
+
+ NodeAndImage(Node node, ImageReader image) {
+ this.node = node; this.image = image;
+ }
+
+ byte[] getResource() throws IOException {
+ return image.getResource(node);
+ }
+ }
+
+ private NodeAndImage findNode(byte[] path) throws IOException {
+ ImageReader image = bootImage;
+ Node node = bootImage.findNode(path);
+ if (node == null) {
+ image = extImage;
+ node = extImage.findNode(path);
+ }
+ if (node == null) {
+ image = appImage;
+ node = appImage.findNode(path);
+ }
+ if (node == null || node.isHidden()) {
+ throw new NoSuchFileException(getString(path));
+ }
+ return new NodeAndImage(node, image);
+ }
+
+ private NodeAndImage checkNode(byte[] path) throws IOException {
+ ensureOpen();
+ return findNode(path);
+ }
+
+ private NodeAndImage checkResource(byte[] path) throws IOException {
+ NodeAndImage ni = checkNode(path);
+ if (ni.node.isDirectory()) {
+ throw new FileSystemException(getString(path) + " is a directory");
+ }
+
+ assert ni.node.isResource() : "resource node expected here";
+ return ni;
+ }
+
+ // package private helpers
+ JrtFileAttributes getFileAttributes(byte[] path)
+ throws IOException {
+ NodeAndImage ni = checkNode(path);
+ return new JrtFileAttributes(ni.node);
+ }
+
+ void setTimes(byte[] path, FileTime mtime, FileTime atime, FileTime ctime)
+ throws IOException {
+ throw readOnly();
+ }
+
+ boolean exists(byte[] path) throws IOException {
+ ensureOpen();
+ try {
+ findNode(path);
+ } catch (NoSuchFileException exp) {
+ return false;
+ }
+ return true;
+ }
+
+ boolean isDirectory(byte[] path)
+ throws IOException {
+ ensureOpen();
+ NodeAndImage ni = checkNode(path);
+ return ni.node.isDirectory();
+ }
+
+ JrtPath toJrtPath(String path) {
+ return toJrtPath(getBytes(path));
+ }
+
+ JrtPath toJrtPath(byte[] path) {
+ return new JrtPath(this, path);
+ }
+
+ /**
+ * returns the list of child paths of the given directory "path"
+ *
+ * @param path name of the directory whose content is listed
+ * @param childPrefix prefix added to returned children names - may be null
+ in which case absolute child paths are returned
+ * @return iterator for child paths of the given directory path
+ */
+ Iterator<Path> iteratorOf(byte[] path, String childPrefix)
+ throws IOException {
+ NodeAndImage ni = checkNode(path);
+ if (!ni.node.isDirectory()) {
+ throw new NotDirectoryException(getString(path));
+ }
+
+ if (ni.node.isRootDir()) {
+ return rootDirIterator(path, childPrefix);
+ }
+
+ return nodesToIterator(toJrtPath(path), childPrefix, ni.node.getChildren());
+ }
+
+ private Iterator<Path> nodesToIterator(Path path, String childPrefix, List<Node> childNodes) {
+ List<Path> childPaths;
+ if (childPrefix == null) {
+ childPaths = childNodes.stream()
+ .filter(Node::isVisible)
+ .map(child -> toJrtPath(child.getNameString()))
+ .collect(Collectors.toCollection(ArrayList::new));
+ } else {
+ childPaths = childNodes.stream()
+ .filter(Node::isVisible)
+ .map(child -> toJrtPath(childPrefix + child.getNameString().substring(1)))
+ .collect(Collectors.toCollection(ArrayList::new));
+ }
+ return childPaths.iterator();
+ }
+
+ private List<Node> rootChildren;
+ private static void addRootDirContent(List<Node> dest, List<Node> src) {
+ for (Node n : src) {
+ // only module directories at the top level. Filter other stuff!
+ if (n.isModuleDir()) {
+ dest.add(n);
+ }
+ }
+ }
+
+ private synchronized void initRootChildren(byte[] path) {
+ if (rootChildren == null) {
+ rootChildren = new ArrayList<>();
+ addRootDirContent(rootChildren, bootImage.findNode(path).getChildren());
+ addRootDirContent(rootChildren, extImage.findNode(path).getChildren());
+ addRootDirContent(rootChildren, appImage.findNode(path).getChildren());
+ }
+ }
+
+ private Iterator<Path> rootDirIterator(byte[] path, String childPrefix) throws IOException {
+ initRootChildren(path);
+ return nodesToIterator(rootPath, childPrefix, rootChildren);
+ }
+
+ void createDirectory(byte[] dir, FileAttribute<?>... attrs)
+ throws IOException {
+ throw readOnly();
+ }
+
+ void copyFile(boolean deletesrc, byte[] src, byte[] dst, CopyOption... options)
+ throws IOException {
+ throw readOnly();
+ }
+
+ public void deleteFile(byte[] path, boolean failIfNotExists)
+ throws IOException {
+ throw readOnly();
+ }
+
+ OutputStream newOutputStream(byte[] path, OpenOption... options)
+ throws IOException {
+ throw readOnly();
+ }
+
+ private void checkOptions(Set<? extends OpenOption> options) {
+ // check for options of null type and option is an intance of StandardOpenOption
+ for (OpenOption option : options) {
+ if (option == null) {
+ throw new NullPointerException();
+ }
+ if (!(option instanceof StandardOpenOption)) {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+
+ // Returns an input stream for reading the contents of the specified
+ // file entry.
+ InputStream newInputStream(byte[] path) throws IOException {
+ final NodeAndImage ni = checkResource(path);
+ return new ByteArrayInputStream(ni.getResource());
+ }
+
+ SeekableByteChannel newByteChannel(byte[] path,
+ Set<? extends OpenOption> options,
+ FileAttribute<?>... attrs)
+ throws IOException {
+ checkOptions(options);
+ if (options.contains(StandardOpenOption.WRITE)
+ || options.contains(StandardOpenOption.APPEND)) {
+ throw readOnly();
+ }
+
+ NodeAndImage ni = checkResource(path);
+ byte[] buf = ni.getResource();
+ final ReadableByteChannel rbc
+ = Channels.newChannel(new ByteArrayInputStream(buf));
+ final long size = buf.length;
+ return new SeekableByteChannel() {
+ long read = 0;
+
+ @Override
+ public boolean isOpen() {
+ return rbc.isOpen();
+ }
+
+ @Override
+ public long position() throws IOException {
+ return read;
+ }
+
+ @Override
+ public SeekableByteChannel position(long pos)
+ throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int read(ByteBuffer dst) throws IOException {
+ int n = rbc.read(dst);
+ if (n > 0) {
+ read += n;
+ }
+ return n;
+ }
+
+ @Override
+ public SeekableByteChannel truncate(long size)
+ throws IOException {
+ throw new NonWritableChannelException();
+ }
+
+ @Override
+ public int write(ByteBuffer src) throws IOException {
+ throw new NonWritableChannelException();
+ }
+
+ @Override
+ public long size() throws IOException {
+ return size;
+ }
+
+ @Override
+ public void close() throws IOException {
+ rbc.close();
+ }
+ };
+ }
+
+ // Returns a FileChannel of the specified path.
+ FileChannel newFileChannel(byte[] path,
+ Set<? extends OpenOption> options,
+ FileAttribute<?>... attrs)
+ throws IOException {
+ throw new UnsupportedOperationException("newFileChannel");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystemProvider.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.io.*;
+import java.nio.channels.*;
+import java.nio.file.*;
+import java.nio.file.DirectoryStream.Filter;
+import java.nio.file.attribute.*;
+import java.nio.file.spi.FileSystemProvider;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+
+public final class JrtFileSystemProvider extends FileSystemProvider {
+ private volatile FileSystem theFileSystem;
+
+ public JrtFileSystemProvider() { }
+
+ @Override
+ public String getScheme() {
+ return "jrt";
+ }
+
+ /**
+ * Need FilePermission ${java.home}/-", "read" to create or get jrt:/
+ */
+ private void checkPermission() {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ String home = SystemImages.RUNTIME_HOME;
+ FilePermission perm =
+ new FilePermission(home + File.separator + "-", "read");
+ sm.checkPermission(perm);
+ }
+ }
+
+ private void checkUri(URI uri) {
+ if (!uri.getScheme().equalsIgnoreCase(getScheme()))
+ throw new IllegalArgumentException("URI does not match this provider");
+ if (uri.getAuthority() != null)
+ throw new IllegalArgumentException("Authority component present");
+ if (uri.getPath() == null)
+ throw new IllegalArgumentException("Path component is undefined");
+ if (!uri.getPath().equals("/"))
+ throw new IllegalArgumentException("Path component should be '/'");
+ if (uri.getQuery() != null)
+ throw new IllegalArgumentException("Query component present");
+ if (uri.getFragment() != null)
+ throw new IllegalArgumentException("Fragment component present");
+ }
+
+ @Override
+ public FileSystem newFileSystem(URI uri, Map<String, ?> env)
+ throws IOException
+ {
+ checkPermission();
+ checkUri(uri);
+ return new JrtFileSystem(this, env);
+ }
+
+ @Override
+ public Path getPath(URI uri) {
+ checkPermission();
+ if (!uri.getScheme().equalsIgnoreCase(getScheme()))
+ throw new IllegalArgumentException("URI does not match this provider");
+ if (uri.getAuthority() != null)
+ throw new IllegalArgumentException("Authority component present");
+ if (uri.getQuery() != null)
+ throw new IllegalArgumentException("Query component present");
+ if (uri.getFragment() != null)
+ throw new IllegalArgumentException("Fragment component present");
+ String path = uri.getPath();
+ if (path == null || path.charAt(0) != '/')
+ throw new IllegalArgumentException("Invalid path component");
+ return getTheFileSystem().getPath(path);
+ }
+
+ private FileSystem getTheFileSystem() {
+ checkPermission();
+ FileSystem fs = this.theFileSystem;
+ if (fs == null) {
+ synchronized (this) {
+ fs = this.theFileSystem;
+ if (fs == null) {
+ try {
+ this.theFileSystem = fs = new JrtFileSystem(this, null) {
+ @Override public void close() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ } catch (IOException ioe) {
+ throw new InternalError(ioe);
+ }
+ }
+ }
+ }
+ return fs;
+ }
+
+ @Override
+ public FileSystem getFileSystem(URI uri) {
+ checkPermission();
+ checkUri(uri);
+ return getTheFileSystem();
+ }
+
+ // Checks that the given file is a JrtPath
+ static final JrtPath toJrtPath(Path path) {
+ if (path == null)
+ throw new NullPointerException();
+ if (!(path instanceof JrtPath))
+ throw new ProviderMismatchException();
+ return (JrtPath)path;
+ }
+
+ @Override
+ public void checkAccess(Path path, AccessMode... modes) throws IOException {
+ toJrtPath(path).checkAccess(modes);
+ }
+
+ @Override
+ public void copy(Path src, Path target, CopyOption... options)
+ throws IOException
+ {
+ toJrtPath(src).copy(toJrtPath(target), options);
+ }
+
+ @Override
+ public void createDirectory(Path path, FileAttribute<?>... attrs)
+ throws IOException
+ {
+ toJrtPath(path).createDirectory(attrs);
+ }
+
+ @Override
+ public final void delete(Path path) throws IOException {
+ toJrtPath(path).delete();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <V extends FileAttributeView> V
+ getFileAttributeView(Path path, Class<V> type, LinkOption... options)
+ {
+ return JrtFileAttributeView.get(toJrtPath(path), type);
+ }
+
+ @Override
+ public FileStore getFileStore(Path path) throws IOException {
+ return toJrtPath(path).getFileStore();
+ }
+
+ @Override
+ public boolean isHidden(Path path) {
+ return toJrtPath(path).isHidden();
+ }
+
+ @Override
+ public boolean isSameFile(Path path, Path other) throws IOException {
+ return toJrtPath(path).isSameFile(other);
+ }
+
+ @Override
+ public void move(Path src, Path target, CopyOption... options)
+ throws IOException
+ {
+ toJrtPath(src).move(toJrtPath(target), options);
+ }
+
+ @Override
+ public AsynchronousFileChannel newAsynchronousFileChannel(Path path,
+ Set<? extends OpenOption> options,
+ ExecutorService exec,
+ FileAttribute<?>... attrs)
+ throws IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public SeekableByteChannel newByteChannel(Path path,
+ Set<? extends OpenOption> options,
+ FileAttribute<?>... attrs)
+ throws IOException
+ {
+ return toJrtPath(path).newByteChannel(options, attrs);
+ }
+
+ @Override
+ public DirectoryStream<Path> newDirectoryStream(
+ Path path, Filter<? super Path> filter) throws IOException
+ {
+ return toJrtPath(path).newDirectoryStream(filter);
+ }
+
+ @Override
+ public FileChannel newFileChannel(Path path,
+ Set<? extends OpenOption> options,
+ FileAttribute<?>... attrs)
+ throws IOException
+ {
+ return toJrtPath(path).newFileChannel(options, attrs);
+ }
+
+ @Override
+ public InputStream newInputStream(Path path, OpenOption... options)
+ throws IOException
+ {
+ return toJrtPath(path).newInputStream(options);
+ }
+
+ @Override
+ public OutputStream newOutputStream(Path path, OpenOption... options)
+ throws IOException
+ {
+ return toJrtPath(path).newOutputStream(options);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked") // Cast to A
+ public <A extends BasicFileAttributes> A
+ readAttributes(Path path, Class<A> type, LinkOption... options)
+ throws IOException
+ {
+ if (type == BasicFileAttributes.class || type == JrtFileAttributes.class)
+ return (A)toJrtPath(path).getAttributes();
+ return null;
+ }
+
+ @Override
+ public Map<String, Object>
+ readAttributes(Path path, String attribute, LinkOption... options)
+ throws IOException
+ {
+ return toJrtPath(path).readAttributes(attribute, options);
+ }
+
+ @Override
+ public void setAttribute(Path path, String attribute,
+ Object value, LinkOption... options)
+ throws IOException
+ {
+ toJrtPath(path).setAttribute(attribute, value, options);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,855 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.io.*;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.channels.*;
+import java.nio.file.*;
+import java.nio.file.DirectoryStream.Filter;
+import java.nio.file.attribute.*;
+import java.util.*;
+import static java.nio.file.StandardOpenOption.*;
+import static java.nio.file.StandardCopyOption.*;
+
+final class JrtPath implements Path {
+
+ private final JrtFileSystem jrtfs;
+ private final byte[] path;
+ private volatile int[] offsets;
+ private int hashcode = 0; // cached hashcode (created lazily)
+
+ JrtPath(JrtFileSystem jrtfs, byte[] path) {
+ this(jrtfs, path, false);
+ }
+
+ JrtPath(JrtFileSystem jrtfs, byte[] path, boolean normalized) {
+ this.jrtfs = jrtfs;
+ if (normalized)
+ this.path = path;
+ else
+ this.path = normalize(path);
+ }
+
+ @Override
+ public JrtPath getRoot() {
+ if (this.isAbsolute())
+ return jrtfs.getRootPath();
+ else
+ return null;
+ }
+
+ @Override
+ public Path getFileName() {
+ initOffsets();
+ int count = offsets.length;
+ if (count == 0)
+ return null; // no elements so no name
+ if (count == 1 && path[0] != '/')
+ return this;
+ int lastOffset = offsets[count-1];
+ int len = path.length - lastOffset;
+ byte[] result = new byte[len];
+ System.arraycopy(path, lastOffset, result, 0, len);
+ return new JrtPath(jrtfs, result);
+ }
+
+ @Override
+ public JrtPath getParent() {
+ initOffsets();
+ int count = offsets.length;
+ if (count == 0) // no elements so no parent
+ return null;
+ int len = offsets[count-1] - 1;
+ if (len <= 0) // parent is root only (may be null)
+ return getRoot();
+ byte[] result = new byte[len];
+ System.arraycopy(path, 0, result, 0, len);
+ return new JrtPath(jrtfs, result);
+ }
+
+ @Override
+ public int getNameCount() {
+ initOffsets();
+ return offsets.length;
+ }
+
+ @Override
+ public JrtPath getName(int index) {
+ initOffsets();
+ if (index < 0 || index >= offsets.length)
+ throw new IllegalArgumentException();
+ int begin = offsets[index];
+ int len;
+ if (index == (offsets.length-1))
+ len = path.length - begin;
+ else
+ len = offsets[index+1] - begin - 1;
+ // construct result
+ byte[] result = new byte[len];
+ System.arraycopy(path, begin, result, 0, len);
+ return new JrtPath(jrtfs, result);
+ }
+
+ @Override
+ public JrtPath subpath(int beginIndex, int endIndex) {
+ initOffsets();
+ if (beginIndex < 0 ||
+ beginIndex >= offsets.length ||
+ endIndex > offsets.length ||
+ beginIndex >= endIndex)
+ throw new IllegalArgumentException();
+
+ // starting offset and length
+ int begin = offsets[beginIndex];
+ int len;
+ if (endIndex == offsets.length)
+ len = path.length - begin;
+ else
+ len = offsets[endIndex] - begin - 1;
+ // construct result
+ byte[] result = new byte[len];
+ System.arraycopy(path, begin, result, 0, len);
+ return new JrtPath(jrtfs, result);
+ }
+
+ @Override
+ public JrtPath toRealPath(LinkOption... options) throws IOException {
+ JrtPath realPath = new JrtPath(jrtfs, getResolvedPath()).toAbsolutePath();
+ realPath.checkAccess();
+ return realPath;
+ }
+
+ boolean isHidden() {
+ return false;
+ }
+
+ @Override
+ public JrtPath toAbsolutePath() {
+ if (isAbsolute()) {
+ return this;
+ } else {
+ //add / bofore the existing path
+ byte[] tmp = new byte[path.length + 1];
+ tmp[0] = '/';
+ System.arraycopy(path, 0, tmp, 1, path.length);
+ return (JrtPath) new JrtPath(jrtfs, tmp).normalize();
+ }
+ }
+
+ @Override
+ public URI toUri() {
+ try {
+ return new URI("jrt",
+ JrtFileSystem.getString(toAbsolutePath().path),
+ null);
+ } catch (URISyntaxException ex) {
+ throw new AssertionError(ex);
+ }
+ }
+
+ private boolean equalsNameAt(JrtPath other, int index) {
+ int mbegin = offsets[index];
+ int mlen;
+ if (index == (offsets.length-1))
+ mlen = path.length - mbegin;
+ else
+ mlen = offsets[index + 1] - mbegin - 1;
+ int obegin = other.offsets[index];
+ int olen;
+ if (index == (other.offsets.length - 1))
+ olen = other.path.length - obegin;
+ else
+ olen = other.offsets[index + 1] - obegin - 1;
+ if (mlen != olen)
+ return false;
+ int n = 0;
+ while(n < mlen) {
+ if (path[mbegin + n] != other.path[obegin + n])
+ return false;
+ n++;
+ }
+ return true;
+ }
+
+ @Override
+ public Path relativize(Path other) {
+ final JrtPath o = checkPath(other);
+ if (o.equals(this))
+ return new JrtPath(getFileSystem(), new byte[0], true);
+ if (/* this.getFileSystem() != o.getFileSystem() || */
+ this.isAbsolute() != o.isAbsolute()) {
+ throw new IllegalArgumentException();
+ }
+ int mc = this.getNameCount();
+ int oc = o.getNameCount();
+ int n = Math.min(mc, oc);
+ int i = 0;
+ while (i < n) {
+ if (!equalsNameAt(o, i))
+ break;
+ i++;
+ }
+ int dotdots = mc - i;
+ int len = dotdots * 3 - 1;
+ if (i < oc)
+ len += (o.path.length - o.offsets[i] + 1);
+ byte[] result = new byte[len];
+
+ int pos = 0;
+ while (dotdots > 0) {
+ result[pos++] = (byte)'.';
+ result[pos++] = (byte)'.';
+ if (pos < len) // no tailing slash at the end
+ result[pos++] = (byte)'/';
+ dotdots--;
+ }
+ if (i < oc)
+ System.arraycopy(o.path, o.offsets[i],
+ result, pos,
+ o.path.length - o.offsets[i]);
+ return new JrtPath(getFileSystem(), result);
+ }
+
+ @Override
+ public JrtFileSystem getFileSystem() {
+ return jrtfs;
+ }
+
+ @Override
+ public boolean isAbsolute() {
+ return (this.path.length > 0 && path[0] == '/');
+ }
+
+ @Override
+ public JrtPath resolve(Path other) {
+ final JrtPath o = checkPath(other);
+ if (o.isAbsolute())
+ return o;
+ byte[] res;
+ if (this.path[path.length - 1] == '/') {
+ res = new byte[path.length + o.path.length];
+ System.arraycopy(path, 0, res, 0, path.length);
+ System.arraycopy(o.path, 0, res, path.length, o.path.length);
+ } else {
+ res = new byte[path.length + 1 + o.path.length];
+ System.arraycopy(path, 0, res, 0, path.length);
+ res[path.length] = '/';
+ System.arraycopy(o.path, 0, res, path.length + 1, o.path.length);
+ }
+ return new JrtPath(jrtfs, res);
+ }
+
+ @Override
+ public Path resolveSibling(Path other) {
+ if (other == null)
+ throw new NullPointerException();
+ Path parent = getParent();
+ return (parent == null) ? other : parent.resolve(other);
+ }
+
+ @Override
+ public boolean startsWith(Path other) {
+ final JrtPath o = checkPath(other);
+ if (o.isAbsolute() != this.isAbsolute() ||
+ o.path.length > this.path.length)
+ return false;
+ int olast = o.path.length;
+ for (int i = 0; i < olast; i++) {
+ if (o.path[i] != this.path[i])
+ return false;
+ }
+ olast--;
+ return o.path.length == this.path.length ||
+ o.path[olast] == '/' ||
+ this.path[olast + 1] == '/';
+ }
+
+ @Override
+ public boolean endsWith(Path other) {
+ final JrtPath o = checkPath(other);
+ int olast = o.path.length - 1;
+ if (olast > 0 && o.path[olast] == '/')
+ olast--;
+ int last = this.path.length - 1;
+ if (last > 0 && this.path[last] == '/')
+ last--;
+ if (olast == -1) // o.path.length == 0
+ return last == -1;
+ if ((o.isAbsolute() &&(!this.isAbsolute() || olast != last)) ||
+ (last < olast))
+ return false;
+ for (; olast >= 0; olast--, last--) {
+ if (o.path[olast] != this.path[last])
+ return false;
+ }
+ return o.path[olast + 1] == '/' ||
+ last == -1 || this.path[last] == '/';
+ }
+
+ @Override
+ public JrtPath resolve(String other) {
+ return resolve(getFileSystem().getPath(other));
+ }
+
+ @Override
+ public final Path resolveSibling(String other) {
+ return resolveSibling(getFileSystem().getPath(other));
+ }
+
+ @Override
+ public final boolean startsWith(String other) {
+ return startsWith(getFileSystem().getPath(other));
+ }
+
+ @Override
+ public final boolean endsWith(String other) {
+ return endsWith(getFileSystem().getPath(other));
+ }
+
+ @Override
+ public Path normalize() {
+ byte[] res = getResolved();
+ if (res == path) // no change
+ return this;
+ return new JrtPath(jrtfs, res, true);
+ }
+
+ private JrtPath checkPath(Path path) {
+ if (path == null)
+ throw new NullPointerException();
+ if (!(path instanceof JrtPath))
+ throw new ProviderMismatchException();
+ return (JrtPath) path;
+ }
+
+ // create offset list if not already created
+ private void initOffsets() {
+ if (offsets == null) {
+ int count, index;
+ // count names
+ count = 0;
+ index = 0;
+ while (index < path.length) {
+ byte c = path[index++];
+ if (c != '/') {
+ count++;
+ while (index < path.length && path[index] != '/')
+ index++;
+ }
+ }
+ // populate offsets
+ int[] result = new int[count];
+ count = 0;
+ index = 0;
+ while (index < path.length) {
+ byte c = path[index];
+ if (c == '/') {
+ index++;
+ } else {
+ result[count++] = index++;
+ while (index < path.length && path[index] != '/')
+ index++;
+ }
+ }
+ synchronized (this) {
+ if (offsets == null)
+ offsets = result;
+ }
+ }
+ }
+
+ // resolved path for locating jrt entry inside the jrt file,
+ // the result path does not contain ./ and .. components
+ // resolved bytes will always start with '/'
+ private volatile byte[] resolved = null;
+ byte[] getResolvedPath() {
+ byte[] r = resolved;
+ if (r == null) {
+ if (isAbsolute())
+ r = getResolved();
+ else
+ r = toAbsolutePath().getResolvedPath();
+ resolved = r;
+ }
+ return resolved;
+ }
+
+ // removes redundant slashs, replace "\" to separator "/"
+ // and check for invalid characters
+ private static byte[] normalize(byte[] path) {
+ if (path.length == 0)
+ return path;
+ byte prevC = 0;
+ for (int i = 0; i < path.length; i++) {
+ byte c = path[i];
+ if (c == '\\')
+ return normalize(path, i);
+ if (c == (byte)'/' && prevC == '/')
+ return normalize(path, i - 1);
+ if (c == '\u0000')
+ throw new InvalidPathException(JrtFileSystem.getString(path),
+ "Path: nul character not allowed");
+ prevC = c;
+ }
+
+ if (path.length > 1 && path[path.length - 1] == '/') {
+ return Arrays.copyOf(path, path.length - 1);
+ }
+
+ return path;
+ }
+
+ private static byte[] normalize(byte[] path, int off) {
+ byte[] to = new byte[path.length];
+ int n = 0;
+ while (n < off) {
+ to[n] = path[n];
+ n++;
+ }
+ int m = n;
+ byte prevC = 0;
+ while (n < path.length) {
+ byte c = path[n++];
+ if (c == (byte)'\\')
+ c = (byte)'/';
+ if (c == (byte)'/' && prevC == (byte)'/')
+ continue;
+ if (c == '\u0000')
+ throw new InvalidPathException(JrtFileSystem.getString(path),
+ "Path: nul character not allowed");
+ to[m++] = c;
+ prevC = c;
+ }
+ if (m > 1 && to[m - 1] == '/')
+ m--;
+ return (m == to.length)? to : Arrays.copyOf(to, m);
+ }
+
+ // Remove DotSlash(./) and resolve DotDot (..) components
+ private byte[] getResolved() {
+ if (path.length == 0)
+ return path;
+ for (int i = 0; i < path.length; i++) {
+ byte c = path[i];
+ if (c == (byte)'.')
+ return resolve0();
+ }
+
+ return path;
+ }
+
+ // TBD: performance, avoid initOffsets
+ private byte[] resolve0() {
+ byte[] to = new byte[path.length];
+ int nc = getNameCount();
+ int[] lastM = new int[nc];
+ int lastMOff = -1;
+ int m = 0;
+ for (int i = 0; i < nc; i++) {
+ int n = offsets[i];
+ int len = (i == offsets.length - 1)?
+ (path.length - n):(offsets[i + 1] - n - 1);
+ if (len == 1 && path[n] == (byte)'.') {
+ if (m == 0 && path[0] == '/') // absolute path
+ to[m++] = '/';
+ continue;
+ }
+ if (len == 2 && path[n] == '.' && path[n + 1] == '.') {
+ if (lastMOff >= 0) {
+ m = lastM[lastMOff--]; // retreat
+ continue;
+ }
+ if (path[0] == '/') { // "/../xyz" skip
+ if (m == 0)
+ to[m++] = '/';
+ } else { // "../xyz" -> "../xyz"
+ if (m != 0 && to[m-1] != '/')
+ to[m++] = '/';
+ while (len-- > 0)
+ to[m++] = path[n++];
+ }
+ continue;
+ }
+ if (m == 0 && path[0] == '/' || // absolute path
+ m != 0 && to[m-1] != '/') { // not the first name
+ to[m++] = '/';
+ }
+ lastM[++lastMOff] = m;
+ while (len-- > 0)
+ to[m++] = path[n++];
+ }
+ if (m > 1 && to[m - 1] == '/')
+ m--;
+ return (m == to.length)? to : Arrays.copyOf(to, m);
+ }
+
+ @Override
+ public String toString() {
+ return JrtFileSystem.getString(path);
+ }
+
+ @Override
+ public int hashCode() {
+ int h = hashcode;
+ if (h == 0)
+ hashcode = h = Arrays.hashCode(path);
+ return h;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return obj != null &&
+ obj instanceof JrtPath &&
+ this.jrtfs == ((JrtPath)obj).jrtfs &&
+ compareTo((Path) obj) == 0;
+ }
+
+ @Override
+ public int compareTo(Path other) {
+ final JrtPath o = checkPath(other);
+ int len1 = this.path.length;
+ int len2 = o.path.length;
+
+ int n = Math.min(len1, len2);
+ byte v1[] = this.path;
+ byte v2[] = o.path;
+
+ int k = 0;
+ while (k < n) {
+ int c1 = v1[k] & 0xff;
+ int c2 = v2[k] & 0xff;
+ if (c1 != c2)
+ return c1 - c2;
+ k++;
+ }
+ return len1 - len2;
+ }
+
+ @Override
+ public WatchKey register(
+ WatchService watcher,
+ WatchEvent.Kind<?>[] events,
+ WatchEvent.Modifier... modifiers) {
+ if (watcher == null || events == null || modifiers == null) {
+ throw new NullPointerException();
+ }
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public WatchKey register(WatchService watcher, WatchEvent.Kind<?>... events) {
+ return register(watcher, events, new WatchEvent.Modifier[0]);
+ }
+
+ @Override
+ public final File toFile() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Iterator<Path> iterator() {
+ return new Iterator<Path>() {
+ private int i = 0;
+
+ @Override
+ public boolean hasNext() {
+ return (i < getNameCount());
+ }
+
+ @Override
+ public Path next() {
+ if (i < getNameCount()) {
+ Path result = getName(i);
+ i++;
+ return result;
+ } else {
+ throw new NoSuchElementException();
+ }
+ }
+
+ @Override
+ public void remove() {
+ throw new ReadOnlyFileSystemException();
+ }
+ };
+ }
+
+ /////////////////////////////////////////////////////////////////////
+ // Helpers for JrtFileSystemProvider and JrtFileSystem
+
+ int getPathLength() {
+ return path.length;
+ }
+
+
+ void createDirectory(FileAttribute<?>... attrs)
+ throws IOException
+ {
+ jrtfs.createDirectory(getResolvedPath(), attrs);
+ }
+
+ InputStream newInputStream(OpenOption... options) throws IOException
+ {
+ if (options.length > 0) {
+ for (OpenOption opt : options) {
+ if (opt != READ)
+ throw new UnsupportedOperationException("'" + opt + "' not allowed");
+ }
+ }
+ return jrtfs.newInputStream(getResolvedPath());
+ }
+
+ DirectoryStream<Path> newDirectoryStream(Filter<? super Path> filter)
+ throws IOException
+ {
+ return new JrtDirectoryStream(this, filter);
+ }
+
+ void delete() throws IOException {
+ jrtfs.deleteFile(getResolvedPath(), true);
+ }
+
+ void deleteIfExists() throws IOException {
+ jrtfs.deleteFile(getResolvedPath(), false);
+ }
+
+ JrtFileAttributes getAttributes() throws IOException
+ {
+ JrtFileAttributes zfas = jrtfs.getFileAttributes(getResolvedPath());
+ if (zfas == null)
+ throw new NoSuchFileException(toString());
+ return zfas;
+ }
+
+ void setAttribute(String attribute, Object value, LinkOption... options)
+ throws IOException
+ {
+ String type;
+ String attr;
+ int colonPos = attribute.indexOf(':');
+ if (colonPos == -1) {
+ type = "basic";
+ attr = attribute;
+ } else {
+ type = attribute.substring(0, colonPos++);
+ attr = attribute.substring(colonPos);
+ }
+ JrtFileAttributeView view = JrtFileAttributeView.get(this, type);
+ if (view == null)
+ throw new UnsupportedOperationException("view <" + view + "> is not supported");
+ view.setAttribute(attr, value);
+ }
+
+ void setTimes(FileTime mtime, FileTime atime, FileTime ctime)
+ throws IOException
+ {
+ jrtfs.setTimes(getResolvedPath(), mtime, atime, ctime);
+ }
+
+ Map<String, Object> readAttributes(String attributes, LinkOption... options)
+ throws IOException
+
+ {
+ String view;
+ String attrs;
+ int colonPos = attributes.indexOf(':');
+ if (colonPos == -1) {
+ view = "basic";
+ attrs = attributes;
+ } else {
+ view = attributes.substring(0, colonPos++);
+ attrs = attributes.substring(colonPos);
+ }
+ JrtFileAttributeView jrtfv = JrtFileAttributeView.get(this, view);
+ if (jrtfv == null) {
+ throw new UnsupportedOperationException("view not supported");
+ }
+ return jrtfv.readAttributes(attrs);
+ }
+
+ FileStore getFileStore() throws IOException {
+ // each JrtFileSystem only has one root (as requested for now)
+ if (exists())
+ return jrtfs.getFileStore(this);
+ throw new NoSuchFileException(JrtFileSystem.getString(path));
+ }
+
+ boolean isSameFile(Path other) throws IOException {
+ if (this.equals(other))
+ return true;
+ if (other == null ||
+ this.getFileSystem() != other.getFileSystem())
+ return false;
+ this.checkAccess();
+ ((JrtPath)other).checkAccess();
+ return Arrays.equals(this.getResolvedPath(),
+ ((JrtPath)other).getResolvedPath());
+ }
+
+ SeekableByteChannel newByteChannel(Set<? extends OpenOption> options,
+ FileAttribute<?>... attrs)
+ throws IOException
+ {
+ return jrtfs.newByteChannel(getResolvedPath(), options, attrs);
+ }
+
+
+ FileChannel newFileChannel(Set<? extends OpenOption> options,
+ FileAttribute<?>... attrs)
+ throws IOException
+ {
+ return jrtfs.newFileChannel(getResolvedPath(), options, attrs);
+ }
+
+ void checkAccess(AccessMode... modes) throws IOException {
+ boolean w = false;
+ boolean x = false;
+ for (AccessMode mode : modes) {
+ switch (mode) {
+ case READ:
+ break;
+ case WRITE:
+ w = true;
+ break;
+ case EXECUTE:
+ x = true;
+ break;
+ default:
+ throw new UnsupportedOperationException();
+ }
+ }
+ JrtFileAttributes attrs = jrtfs.getFileAttributes(getResolvedPath());
+ if (attrs == null && (path.length != 1 || path[0] != '/'))
+ throw new NoSuchFileException(toString());
+ if (w) {
+ if (jrtfs.isReadOnly())
+ throw new AccessDeniedException(toString());
+ }
+ if (x)
+ throw new AccessDeniedException(toString());
+ }
+
+ boolean exists() {
+ if (isAbsolute())
+ return true;
+ try {
+ return jrtfs.exists(getResolvedPath());
+ } catch (IOException x) {}
+ return false;
+ }
+
+ OutputStream newOutputStream(OpenOption... options) throws IOException
+ {
+ if (options.length == 0)
+ return jrtfs.newOutputStream(getResolvedPath(),
+ CREATE_NEW, WRITE);
+ return jrtfs.newOutputStream(getResolvedPath(), options);
+ }
+
+ void move(JrtPath target, CopyOption... options)
+ throws IOException
+ {
+ if (this.jrtfs == target.jrtfs)
+ {
+ jrtfs.copyFile(true,
+ getResolvedPath(), target.getResolvedPath(),
+ options);
+ } else {
+ copyToTarget(target, options);
+ delete();
+ }
+ }
+
+ void copy(JrtPath target, CopyOption... options)
+ throws IOException
+ {
+ if (this.jrtfs == target.jrtfs)
+ jrtfs.copyFile(false,
+ getResolvedPath(), target.getResolvedPath(),
+ options);
+ else
+ copyToTarget(target, options);
+ }
+
+ private void copyToTarget(JrtPath target, CopyOption... options)
+ throws IOException
+ {
+ boolean replaceExisting = false;
+ boolean copyAttrs = false;
+ for (CopyOption opt : options) {
+ if (opt == REPLACE_EXISTING)
+ replaceExisting = true;
+ else if (opt == COPY_ATTRIBUTES)
+ copyAttrs = true;
+ }
+ // attributes of source file
+ JrtFileAttributes jrtfas = getAttributes();
+ // check if target exists
+ boolean exists;
+ if (replaceExisting) {
+ try {
+ target.deleteIfExists();
+ exists = false;
+ } catch (DirectoryNotEmptyException x) {
+ exists = true;
+ }
+ } else {
+ exists = target.exists();
+ }
+ if (exists)
+ throw new FileAlreadyExistsException(target.toString());
+
+ if (jrtfas.isDirectory()) {
+ // create directory or file
+ target.createDirectory();
+ } else {
+ try (InputStream is = jrtfs.newInputStream(getResolvedPath()); OutputStream os = target.newOutputStream()) {
+ byte[] buf = new byte[8192];
+ int n;
+ while ((n = is.read(buf)) != -1) {
+ os.write(buf, 0, n);
+ }
+ }
+ }
+ if (copyAttrs) {
+ BasicFileAttributeView view =
+ JrtFileAttributeView.get(target, BasicFileAttributeView.class);
+ try {
+ view.setTimes(jrtfas.lastModifiedTime(),
+ jrtfas.lastAccessTime(),
+ jrtfas.creationTime());
+ } catch (IOException x) {
+ // rollback?
+ try {
+ target.delete();
+ } catch (IOException ignore) { }
+ throw x;
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtUtils.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.util.regex.PatternSyntaxException;
+
+final class JrtUtils {
+ private JrtUtils() {}
+
+ private static final String regexMetaChars = ".^$+{[]|()";
+ private static final String globMetaChars = "\\*?[{";
+ private static boolean isRegexMeta(char c) {
+ return regexMetaChars.indexOf(c) != -1;
+ }
+ private static boolean isGlobMeta(char c) {
+ return globMetaChars.indexOf(c) != -1;
+ }
+ private static final char EOL = 0; //TBD
+ private static char next(String glob, int i) {
+ if (i < glob.length()) {
+ return glob.charAt(i);
+ }
+ return EOL;
+ }
+
+ /*
+ * Creates a regex pattern from the given glob expression.
+ *
+ * @throws PatternSyntaxException
+ */
+ public static String toRegexPattern(String globPattern) {
+ boolean inGroup = false;
+ StringBuilder regex = new StringBuilder("^");
+
+ int i = 0;
+ while (i < globPattern.length()) {
+ char c = globPattern.charAt(i++);
+ switch (c) {
+ case '\\':
+ // escape special characters
+ if (i == globPattern.length()) {
+ throw new PatternSyntaxException("No character to escape",
+ globPattern, i - 1);
+ }
+ char next = globPattern.charAt(i++);
+ if (isGlobMeta(next) || isRegexMeta(next)) {
+ regex.append('\\');
+ }
+ regex.append(next);
+ break;
+ case '/':
+ regex.append(c);
+ break;
+ case '[':
+ // don't match name separator in class
+ regex.append("[[^/]&&[");
+ if (next(globPattern, i) == '^') {
+ // escape the regex negation char if it appears
+ regex.append("\\^");
+ i++;
+ } else {
+ // negation
+ if (next(globPattern, i) == '!') {
+ regex.append('^');
+ i++;
+ }
+ // hyphen allowed at start
+ if (next(globPattern, i) == '-') {
+ regex.append('-');
+ i++;
+ }
+ }
+ boolean hasRangeStart = false;
+ char last = 0;
+ while (i < globPattern.length()) {
+ c = globPattern.charAt(i++);
+ if (c == ']') {
+ break;
+ }
+ if (c == '/') {
+ throw new PatternSyntaxException("Explicit 'name separator' in class",
+ globPattern, i - 1);
+ }
+ // TBD: how to specify ']' in a class?
+ if (c == '\\' || c == '[' ||
+ c == '&' && next(globPattern, i) == '&') {
+ // escape '\', '[' or "&&" for regex class
+ regex.append('\\');
+ }
+ regex.append(c);
+
+ if (c == '-') {
+ if (!hasRangeStart) {
+ throw new PatternSyntaxException("Invalid range",
+ globPattern, i - 1);
+ }
+ if ((c = next(globPattern, i++)) == EOL || c == ']') {
+ break;
+ }
+ if (c < last) {
+ throw new PatternSyntaxException("Invalid range",
+ globPattern, i - 3);
+ }
+ regex.append(c);
+ hasRangeStart = false;
+ } else {
+ hasRangeStart = true;
+ last = c;
+ }
+ }
+ if (c != ']') {
+ throw new PatternSyntaxException("Missing ']", globPattern, i - 1);
+ }
+ regex.append("]]");
+ break;
+ case '{':
+ if (inGroup) {
+ throw new PatternSyntaxException("Cannot nest groups",
+ globPattern, i - 1);
+ }
+ regex.append("(?:(?:");
+ inGroup = true;
+ break;
+ case '}':
+ if (inGroup) {
+ regex.append("))");
+ inGroup = false;
+ } else {
+ regex.append('}');
+ }
+ break;
+ case ',':
+ if (inGroup) {
+ regex.append(")|(?:");
+ } else {
+ regex.append(',');
+ }
+ break;
+ case '*':
+ if (next(globPattern, i) == '*') {
+ // crosses directory boundaries
+ regex.append(".*");
+ i++;
+ } else {
+ // within directory boundary
+ regex.append("[^/]*");
+ }
+ break;
+ case '?':
+ regex.append("[^/]");
+ break;
+ default:
+ if (isRegexMeta(c)) {
+ regex.append('\\');
+ }
+ regex.append(c);
+ }
+ }
+ if (inGroup) {
+ throw new PatternSyntaxException("Missing '}", globPattern, i - 1);
+ }
+ return regex.append('$').toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/SystemImages.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.security.AccessController;
+import java.security.CodeSource;
+import java.security.PrivilegedAction;
+
+final class SystemImages {
+ private SystemImages() {}
+
+ static final String RUNTIME_HOME;
+ static final Path bootImagePath;
+ static final Path extImagePath;
+ static final Path appImagePath;
+ static {
+ PrivilegedAction<String> pa = SystemImages::findHome;
+ RUNTIME_HOME = AccessController.doPrivileged(pa);
+
+ FileSystem fs = FileSystems.getDefault();
+ bootImagePath = fs.getPath(RUNTIME_HOME, "lib", "modules", "bootmodules.jimage");
+ extImagePath = fs.getPath(RUNTIME_HOME, "lib", "modules", "extmodules.jimage");
+ appImagePath = fs.getPath(RUNTIME_HOME, "lib", "modules", "appmodules.jimage");
+ }
+
+ /**
+ * Returns the appropriate JDK home for this usage of the FileSystemProvider.
+ * When the CodeSource is null (null loader) then jrt:/ is the current runtime,
+ * otherwise the JDK home is located relative to jrt-fs.jar.
+ */
+ private static String findHome() {
+ CodeSource cs = SystemImages.class.getProtectionDomain().getCodeSource();
+ if (cs == null)
+ return System.getProperty("java.home");
+
+ // assume loaded from $TARGETJDK/jrt-fs.jar
+ URL url = cs.getLocation();
+ if (!url.getProtocol().equalsIgnoreCase("file"))
+ throw new RuntimeException(url + " loaded in unexpected way");
+ try {
+ return Paths.get(url.toURI()).getParent().toString();
+ } catch (URISyntaxException e) {
+ throw new InternalError(e);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/jrtfsviewer.js Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,111 @@
+#// Usage: jjs -fx jrtfsviewer.js
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+function usage() {
+ print("Usage:");
+ print("jdk9+: jjs -fx jrtfsviewer.js");
+ print("jdk8+: jjs -fx -cp <path-of jrt-fs.jar> jrtfsviewer.js");
+ exit(1);
+}
+
+if (! $OPTIONS._fx) {
+ usage();
+}
+
+// shows the jrt file system as a JavaFX tree view.
+
+// Using JavaFX from Nashorn. See also:
+// http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/javafx.html
+
+// Java classes used
+var FileSystems = Java.type("java.nio.file.FileSystems");
+var Files = Java.type("java.nio.file.Files");
+var System = Java.type("java.lang.System");
+var URI = Java.type("java.net.URI");
+
+// JavaFX classes used
+var StackPane = Java.type("javafx.scene.layout.StackPane");
+var Scene = Java.type("javafx.scene.Scene");
+var TreeItem = Java.type("javafx.scene.control.TreeItem");
+var TreeView = Java.type("javafx.scene.control.TreeView");
+
+// Create a javafx TreeItem to view nio Path
+function treeItemForPath(path) {
+ var item = new TreeItem(path.toString());
+
+ if (Files.isDirectory(path)) {
+ var stream = Files.newDirectoryStream(path);
+ try {
+ var itr = stream.iterator();
+ while (itr.hasNext()) {
+ var childPath = itr.next();
+ if (Files.isDirectory(childPath)) {
+ var subitem = treeItemForPath(childPath);
+ } else {
+ var subitem = new TreeItem(childPath.toString());
+ }
+ item.children.add(subitem);
+ }
+ } finally {
+ stream.close();
+ }
+ }
+ return item;
+}
+
+function getJrtFileSystem() {
+ var isJdk9 = System.getProperty("java.version").startsWith("1.9.0");
+ var uri = URI.create("jrt:/");
+
+ if (isJdk9) {
+ return FileSystems.getFileSystem(uri);
+ } else {
+ // pass jrt-fs.jar in -classpath but running on jdk8+
+ var cls;
+ try {
+ cls = Java.type("jdk.internal.jrtfs.JrtFileSystem").class;
+ } catch (e) {
+ print(e);
+ print("did you miss specifying jrt-fs.jar with -cp option?");
+ usage();
+ }
+ return FileSystems.newFileSystem(uri, null, cls.classLoader);
+ }
+}
+
+// JavaFX start method
+function start(stage) {
+ var jrtfs = getJrtFileSystem();
+ var root = jrtfs.getPath('/');
+ stage.title = "jrt fs viewer";
+ var rootItem = treeItemForPath(root);
+ var tree = new TreeView(rootItem);
+ var root = new StackPane();
+ root.children.add(tree);
+ stage.scene = new Scene(root, 300, 450);
+ stage.show();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/jrtls.js Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Usage: jjs jrtls.js
+ *
+ * Recursively list the content of / directory of the jrt fs.
+ */
+
+// classes used
+var Files = Java.type("java.nio.file.Files");
+var FileSystems = Java.type("java.nio.file.FileSystems");
+var URI = Java.type("java.net.URI");
+
+var fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+var root = fs.getPath('/');
+Files.walk(root).forEach(print);
--- a/jdk/src/java.base/share/classes/sun/misc/ExtensionDependency.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/ExtensionDependency.java Wed Jul 05 20:08:34 2017 +0200
@@ -65,8 +65,11 @@
* This class also maintain versioning consistency of installed
* extensions dependencies declared in jar file manifest.
* </p>
+ *
+ * @deprecated this class will be removed in a future release.
* @author Jerome Dochez
*/
+@Deprecated
public class ExtensionDependency {
/* Callbak interfaces to delegate installation of missing extensions */
--- a/jdk/src/java.base/share/classes/sun/misc/ExtensionInfo.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/ExtensionInfo.java Wed Jul 05 20:08:34 2017 +0200
@@ -38,8 +38,10 @@
* This class holds all necessary information to install or
* upgrade a extension on the user's disk
*
+ * @deprecated this class will be removed in a future release.
* @author Jerome Dochez
*/
+@Deprecated
public class ExtensionInfo {
/**
--- a/jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationException.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationException.java Wed Jul 05 20:08:34 2017 +0200
@@ -29,9 +29,10 @@
* Exception when installation of an extension has failed for
* any reason
*
+ * @deprecated this class will be removed in a future release.
* @author Jerome Dochez
*/
-
+@Deprecated
public class ExtensionInstallationException extends Exception {
static final long serialVersionUID = 3139688306909345924L;
--- a/jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationProvider.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationProvider.java Wed Jul 05 20:08:34 2017 +0200
@@ -30,8 +30,10 @@
* provided to the extension installation dependency mechanism to
* install new extensions on the user's disk
*
+ * @deprecated this class will be removed in a future release.
* @author Jerome Dochez
*/
+@Deprecated
public interface ExtensionInstallationProvider {
/*
--- a/jdk/src/java.base/share/classes/sun/misc/JarFilter.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/JarFilter.java Wed Jul 05 20:08:34 2017 +0200
@@ -34,8 +34,10 @@
* This class is used in extension installation support (ExtensionDependency).
* <p>
*
+ * @deprecated this class will be removed in a future release.
* @author Michael Colburn
*/
+@Deprecated
public class JarFilter implements FilenameFilter {
public boolean accept(File dir, String name) {
--- a/jdk/src/java.base/share/classes/sun/misc/Launcher.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/Launcher.java Wed Jul 05 20:08:34 2017 +0200
@@ -26,17 +26,13 @@
package sun.misc;
import java.io.File;
+import java.io.FilePermission;
import java.io.IOException;
-import java.io.FilePermission;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.MalformedURLException;
import java.net.URLStreamHandler;
import java.net.URLStreamHandlerFactory;
-import java.util.HashSet;
-import java.util.StringTokenizer;
-import java.util.Set;
-import java.util.Vector;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
@@ -46,17 +42,26 @@
import java.security.Permission;
import java.security.ProtectionDomain;
import java.security.CodeSource;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import sun.net.www.ParseUtil;
import sun.security.util.SecurityConstants;
-import sun.net.www.ParseUtil;
/**
* This class is used by the system to launch the main application.
Launcher */
public class Launcher {
+
+ // ensure URLClassPath for boot loader is initialized first
+ static {
+ URLClassPath ucp = BootClassPathHolder.bcp;
+ }
+
private static URLStreamHandlerFactory factory = new Factory();
private static Launcher launcher = new Launcher();
- private static String bootClassPath =
- System.getProperty("sun.boot.class.path");
public static Launcher getLauncher() {
return launcher;
@@ -129,10 +134,7 @@
* create an ExtClassLoader. The ExtClassLoader is created
* within a context that limits which files it can read
*/
- public static ExtClassLoader getExtClassLoader() throws IOException
- {
- final File[] dirs = getExtDirs();
-
+ public static ExtClassLoader getExtClassLoader() throws IOException {
try {
// Prior implementations of this doPrivileged() block supplied
// aa synthesized ACC via a call to the private method
@@ -141,11 +143,15 @@
return AccessController.doPrivileged(
new PrivilegedExceptionAction<ExtClassLoader>() {
public ExtClassLoader run() throws IOException {
- int len = dirs.length;
- for (int i = 0; i < len; i++) {
- MetaIndex.registerDirectory(dirs[i]);
- }
- return new ExtClassLoader(dirs);
+ // ext modules linked into image
+ String home = System.getProperty("java.home");
+ File dir = new File(new File(home, "lib"), "modules");
+ File jimage = new File(dir, "extmodules.jimage");
+
+ File jfxrt = new File(new File(home, "lib"), "jfxrt.jar");
+ File[] files = jfxrt.exists() ? new File[] {jimage, jfxrt}
+ : new File[] {jimage};
+ return new ExtClassLoader(files);
}
});
} catch (java.security.PrivilegedActionException e) {
@@ -160,87 +166,17 @@
/*
* Creates a new ExtClassLoader for the specified directories.
*/
- public ExtClassLoader(File[] dirs) throws IOException {
- super(getExtURLs(dirs), null, factory);
- }
-
- private static File[] getExtDirs() {
- String s = System.getProperty("java.ext.dirs");
- File[] dirs;
- if (s != null) {
- StringTokenizer st =
- new StringTokenizer(s, File.pathSeparator);
- int count = st.countTokens();
- dirs = new File[count];
- for (int i = 0; i < count; i++) {
- dirs[i] = new File(st.nextToken());
- }
- } else {
- dirs = new File[0];
- }
- return dirs;
- }
-
- private static URL[] getExtURLs(File[] dirs) throws IOException {
- Vector<URL> urls = new Vector<URL>();
- for (int i = 0; i < dirs.length; i++) {
- String[] files = dirs[i].list();
- if (files != null) {
- for (int j = 0; j < files.length; j++) {
- if (!files[j].equals("meta-index")) {
- File f = new File(dirs[i], files[j]);
- urls.add(getFileURL(f));
- }
- }
- }
- }
- URL[] ua = new URL[urls.size()];
- urls.copyInto(ua);
- return ua;
+ public ExtClassLoader(File[] files) throws IOException {
+ super(getExtURLs(files), null, factory);
}
- /*
- * Searches the installed extension directories for the specified
- * library name. For each extension directory, we first look for
- * the native library in the subdirectory whose name is the value
- * of the system property <code>os.arch</code>. Failing that, we
- * look in the extension directory itself.
- */
- public String findLibrary(String name) {
- final String libname = System.mapLibraryName(name);
- URL[] urls = super.getURLs();
- File prevDir = null;
- for (int i = 0; i < urls.length; i++) {
- // Get the ext directory from the URL
- File dir = new File(urls[i].getPath()).getParentFile();
- if (dir != null && !dir.equals(prevDir)) {
- // Look in architecture-specific subdirectory first
- // Read from the saved system properties to avoid deadlock
- final String arch = VM.getSavedProperty("os.arch");
- String pathname = AccessController.doPrivileged(
- new PrivilegedAction<String>() {
- public String run() {
- if (arch != null) {
- File file = new File(new File(dir, arch), libname);
- if (file.exists()) {
- return file.getAbsolutePath();
- }
- }
- // Then check the extension directory
- File file = new File(dir, libname);
- if (file.exists()) {
- return file.getAbsolutePath();
- }
- return null;
- }
- });
- if (pathname != null) {
- return pathname;
- }
- }
- prevDir = dir;
+ private static URL[] getExtURLs(File[] files) throws IOException {
+ int len = files.length;
+ URL[] urls = new URL[len];
+ for (int i=0; i<len; i++) {
+ urls[i] = getFileURL(files[i]);
}
- return null;
+ return urls;
}
private static AccessControlContext getContext(File[] dirs)
@@ -274,8 +210,18 @@
public static ClassLoader getAppClassLoader(final ClassLoader extcl)
throws IOException
{
- final String s = System.getProperty("java.class.path");
- final File[] path = (s == null) ? new File[0] : getClassPath(s, true);
+ // modules linked into image are prepended to class path
+ String home = System.getProperty("java.home");
+ File dir = new File(new File(home, "lib"), "modules");
+ String jimage = new File(dir, "appmodules.jimage").getPath();
+
+ String cp = System.getProperty("java.class.path");
+ if (cp == null) {
+ cp = jimage;
+ } else {
+ cp = jimage + File.pathSeparator + cp;
+ }
+ final File[] path = getClassPath(cp, true);
// Note: on bugid 4256530
// Prior implementations of this doPrivileged() block supplied
@@ -287,9 +233,8 @@
return AccessController.doPrivileged(
new PrivilegedAction<AppClassLoader>() {
public AppClassLoader run() {
- URL[] urls =
- (s == null) ? new URL[0] : pathToURLs(path);
- return new AppClassLoader(urls, extcl);
+ URL[] urls = pathToURLs(path);
+ return new AppClassLoader(urls, extcl);
}
});
}
@@ -320,8 +265,7 @@
/**
* allow any classes loaded from classpath to exit the VM.
*/
- protected PermissionCollection getPermissions(CodeSource codesource)
- {
+ protected PermissionCollection getPermissions(CodeSource codesource) {
PermissionCollection perms = super.getPermissions(codesource);
perms.add(new RuntimePermission("exitVM"));
return perms;
@@ -368,11 +312,12 @@
private static class BootClassPathHolder {
static final URLClassPath bcp;
static {
- URL[] urls;
- if (bootClassPath != null) {
- urls = AccessController.doPrivileged(
+ URL[] urls = AccessController.doPrivileged(
new PrivilegedAction<URL[]>() {
public URL[] run() {
+ String bootClassPath = System.getProperty("sun.boot.class.path");
+ if (bootClassPath == null)
+ return new URL[0];
// Skip empty path in boot class path i.e. not default to use CWD
File[] classPath = getClassPath(bootClassPath, false);
int len = classPath.length;
@@ -392,9 +337,6 @@
}
}
);
- } else {
- urls = new URL[0];
- }
bcp = new URLClassPath(urls, factory);
}
}
--- a/jdk/src/java.base/share/classes/sun/misc/URLClassPath.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/URLClassPath.java Wed Jul 05 20:08:34 2017 +0200
@@ -25,33 +25,51 @@
package sun.misc;
-import java.util.*;
+import java.io.ByteArrayInputStream;
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.JarURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+import java.net.URLStreamHandlerFactory;
+import java.security.AccessControlException;
+import java.security.AccessController;
+import java.security.CodeSigner;
+import java.security.Permission;
+import java.security.PrivilegedExceptionAction;
+import java.security.cert.Certificate;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.Stack;
+import java.util.StringTokenizer;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.jar.JarFile;
-import sun.misc.JarIndex;
-import sun.misc.InvalidJarIndexException;
-import sun.net.www.ParseUtil;
import java.util.zip.ZipEntry;
import java.util.jar.JarEntry;
import java.util.jar.Manifest;
import java.util.jar.Attributes;
import java.util.jar.Attributes.Name;
-import java.net.JarURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.HttpURLConnection;
-import java.net.URLStreamHandler;
-import java.net.URLStreamHandlerFactory;
-import java.io.*;
-import java.security.AccessController;
-import java.security.AccessControlException;
-import java.security.CodeSigner;
-import java.security.Permission;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-import java.security.cert.Certificate;
-import sun.misc.FileURLMapper;
+
+import jdk.internal.jimage.ImageLocation;
+import jdk.internal.jimage.ImageReader;
+
import sun.net.util.URLUtil;
+import sun.net.www.ParseUtil;
+import sun.net.www.protocol.jrt.JavaRuntimeURLConnection;
/**
* This class is used to maintain a search path of URLs for loading classes
@@ -60,12 +78,15 @@
* @author David Connelly
*/
public class URLClassPath {
- final static String USER_AGENT_JAVA_VERSION = "UA-Java-Version";
- final static String JAVA_VERSION;
+ private static final String USER_AGENT_JAVA_VERSION = "UA-Java-Version";
+ private static final String JAVA_HOME;
+ private static final String JAVA_VERSION;
private static final boolean DEBUG;
private static final boolean DISABLE_JAR_CHECKING;
static {
+ JAVA_HOME = java.security.AccessController.doPrivileged(
+ new sun.security.action.GetPropertyAction("java.home"));
JAVA_VERSION = java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("java.version"));
DEBUG = (java.security.AccessController.doPrivileged(
@@ -363,6 +384,10 @@
return new Loader(url);
}
} else {
+ if (file != null && "file".equals(url.getProtocol())) {
+ if (file.endsWith(".jimage"))
+ return new JImageLoader(url);
+ }
return new JarLoader(url, jarHandler, lmap);
}
}
@@ -980,7 +1005,6 @@
}
ensureOpen();
- parseExtensionsDependencies();
if (SharedSecrets.javaUtilJarAccess().jarFileHasClassPathAttribute(jar)) { // Only get manifest when necessary
Manifest man = jar.getManifest();
@@ -998,13 +1022,6 @@
}
/*
- * parse the standard extension dependencies
- */
- private void parseExtensionsDependencies() throws IOException {
- ExtensionDependency.checkExtensionsDependencies(jar);
- }
-
- /*
* Parses value of the Class-Path manifest attribute and returns
* an array of URLs relative to the specified base URL.
*/
@@ -1095,4 +1112,132 @@
return null;
}
}
+
+ /**
+ * A Loader of classes and resources from a jimage file located in the
+ * runtime image.
+ */
+ private static class JImageLoader
+ extends Loader implements JavaRuntimeURLConnection.ResourceFinder
+ {
+ private static final AtomicInteger NEXT_INDEX = new AtomicInteger();
+
+ private final ImageReader jimage;
+ private final int index;
+
+ JImageLoader(URL url) throws IOException {
+ super(url);
+
+ // get path to image file and check that it's in the runtime
+ String urlPath = url.getFile().replace('/', File.separatorChar);
+
+ File filePath = new File(ParseUtil.decode(urlPath));
+ File home = new File(JAVA_HOME).getCanonicalFile();
+ File parent = filePath.getParentFile();
+ while (parent != null) {
+ if (parent.equals(home))
+ break;
+ parent = parent.getParentFile();
+ }
+ if (parent == null)
+ throw new IOException(filePath + " not in runtime image");
+
+ this.jimage = ImageReader.open(filePath.toString());
+ this.index = NEXT_INDEX.getAndIncrement();
+
+ // register with the jimage protocol handler
+ JavaRuntimeURLConnection.register(this);
+ }
+
+ /**
+ * Maps the given resource name to a module.
+ */
+ private String nameToModule(String name) {
+ int pos = name.lastIndexOf('/');
+ if (pos > 0) {
+ String pkg = name.substring(0, pos);
+ String module = jimage.getModule(pkg);
+ if (module != null)
+ return module;
+ }
+ // cannot map to module
+ return "UNNAMED" + index;
+ }
+
+ /**
+ * Constructs a URL for the resource name.
+ */
+ private URL toURL(String name) {
+ String module = nameToModule(name);
+ String encodedName = ParseUtil.encodePath(name, false);
+ try {
+ return new URL("jrt:/" + module + "/" + encodedName);
+ } catch (MalformedURLException e) {
+ throw new InternalError(e);
+ }
+ }
+
+ @Override
+ URL findResource(String name, boolean check) {
+ ImageLocation location = jimage.findLocation(name);
+ if (location == null)
+ return null;
+ URL url = toURL(name);
+ if (check) {
+ try {
+ URLClassPath.check(url);
+ } catch (IOException | SecurityException e) {
+ return null;
+ }
+ }
+ return url;
+ }
+
+ @Override
+ Resource getResource(String name, boolean check) {
+ ImageLocation location = jimage.findLocation(name);
+ if (location == null)
+ return null;
+ URL url = toURL(name);
+ if (check) {
+ try {
+ URLClassPath.check(url);
+ } catch (IOException | SecurityException e) {
+ return null;
+ }
+ }
+ return new Resource() {
+ @Override
+ public String getName() { return name; }
+ @Override
+ public URL getURL() { return url; }
+ @Override
+ public URL getCodeSourceURL() {
+ try {
+ return new URL("jrt:/" + nameToModule(name));
+ } catch (MalformedURLException e) {
+ throw new InternalError(e);
+ }
+ }
+ @Override
+ public InputStream getInputStream() throws IOException {
+ byte[] resource = jimage.getResource(location);
+ return new ByteArrayInputStream(resource);
+ }
+ public int getContentLength() {
+ long size = location.getUncompressedSize();
+ return (size > Integer.MAX_VALUE) ? -1 : (int)size;
+ }
+ };
+ }
+
+ @Override
+ public Resource find(String module, String name) throws IOException {
+ String m = nameToModule(name);
+ if (!m.equals(module))
+ return null;
+ // URLConnection will do the permission check
+ return getResource(name, false);
+ }
+ }
}
--- a/jdk/src/java.base/share/classes/sun/misc/Version.java.template Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/Version.java.template Wed Jul 05 20:08:34 2017 +0200
@@ -38,9 +38,6 @@
private static final String java_runtime_name =
"@@java_runtime_name@@";
- private static final String java_profile_name =
- "@@java_profile_name@@";
-
private static final String java_runtime_version =
"@@java_runtime_version@@";
@@ -105,11 +102,6 @@
ps.print(java_runtime_name + " (build " + java_runtime_version);
- if (java_profile_name.length() > 0) {
- // profile name
- ps.print(", profile " + java_profile_name);
- }
-
if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
// embedded builds report headless state
ps.print(", headless");
--- a/jdk/src/java.base/share/classes/sun/net/NetProperties.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/net/NetProperties.java Wed Jul 05 20:08:34 2017 +0200
@@ -62,7 +62,7 @@
throw new Error("Can't find java.home ??");
}
try {
- File f = new File(fname, "lib");
+ File f = new File(fname, "conf");
f = new File(f, "net.properties");
fname = f.getCanonicalPath();
InputStream in = new FileInputStream(fname);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/Handler.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.net.www.protocol.jrt;
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+
+/**
+ * Protocol handler for accessing resources in the runtime image.
+ */
+
+public class Handler extends URLStreamHandler {
+ public Handler() { }
+
+ @Override
+ protected URLConnection openConnection(URL url) throws IOException {
+ return new JavaRuntimeURLConnection(url);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.net.www.protocol.jrt;
+
+import java.io.File;
+import java.io.FilePermission;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.Permission;
+import java.security.PrivilegedAction;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import sun.misc.Resource;
+import sun.net.www.ParseUtil;
+import sun.net.www.URLConnection;
+
+/**
+ * URLConnection implementation that can be used to connect to resources
+ * contained in the runtime image.
+ */
+public class JavaRuntimeURLConnection extends URLConnection {
+
+ /**
+ * Finds resource {@code name} in module {@code module}.
+ */
+ public interface ResourceFinder {
+ Resource find(String module, String name) throws IOException;
+ }
+
+ /**
+ * The list of resource finders for jimages in the runtime image.
+ */
+ private static final List<ResourceFinder> finders = new CopyOnWriteArrayList<>();
+
+ /**
+ * Called on behalf of the boot, extension and system class loaders to
+ * register a resource finder.
+ */
+ public static void register(ResourceFinder finder) {
+ finders.add(finder);
+ }
+
+ private static Resource find(String module, String name) throws IOException {
+ for (ResourceFinder finder: finders) {
+ Resource r = finder.find(module, name);
+ if (r != null) return r;
+ }
+ return null;
+ }
+
+ // the module and resource name in the URL
+ private final String module;
+ private final String name;
+
+ // the Resource when connected
+ private volatile Resource resource;
+
+ // the permission to access resources in the runtime image, created lazily
+ private static volatile Permission permission;
+
+ JavaRuntimeURLConnection(URL url) throws IOException {
+ super(url);
+ String path = url.getPath();
+ if (path.length() == 0 || path.charAt(0) != '/')
+ throw new MalformedURLException(url + " missing path or /");
+ if (path.length() == 1) {
+ this.module = null;
+ this.name = null;
+ } else {
+ int pos = path.indexOf('/', 1);
+ if (pos == -1) {
+ this.module = path.substring(1);
+ this.name = null;
+ } else {
+ this.module = path.substring(1, pos);
+ this.name = ParseUtil.decode(path.substring(pos+1));
+ }
+ }
+ }
+
+ @Override
+ public synchronized void connect() throws IOException {
+ if (!connected) {
+ if (name == null) {
+ String s = (module == null) ? "" : module;
+ throw new IOException("cannot connect to jrt:/" + s);
+ }
+ resource = find(module, name);
+ if (resource == null)
+ throw new IOException(module + "/" + name + " not found");
+ connected = true;
+ }
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ connect();
+ return resource.getInputStream();
+ }
+
+ @Override
+ public long getContentLengthLong() {
+ try {
+ connect();
+ return resource.getContentLength();
+ } catch (IOException ioe) {
+ return -1L;
+ }
+ }
+
+ @Override
+ public int getContentLength() {
+ long len = getContentLengthLong();
+ return len > Integer.MAX_VALUE ? -1 : (int)len;
+ }
+
+ @Override
+ public Permission getPermission() throws IOException {
+ Permission p = permission;
+ if (p == null) {
+ // using lambda expression here leads to recursive initialization
+ PrivilegedAction<String> pa = new PrivilegedAction<String>() {
+ public String run() { return System.getProperty("java.home"); }
+ };
+ String home = AccessController.doPrivileged(pa);
+ p = new FilePermission(home + File.separator + "-", "read");
+ permission = p;
+ }
+ return p;
+ }
+}
--- a/jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java Wed Jul 05 20:08:34 2017 +0200
@@ -51,7 +51,7 @@
// config file argument of the SunPKCS11-Solaris provider
private static final String P11_SOL_ARG =
- "${java.home}/lib/security/sunpkcs11-solaris.cfg";
+ "${java.home}/conf/security/sunpkcs11-solaris.cfg";
// maximum number of times to try loading a provider before giving up
private final static int MAX_LOAD_TRIES = 30;
--- a/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java Wed Jul 05 20:08:34 2017 +0200
@@ -77,7 +77,7 @@
* <i>auth.policy.url.1</i>, <i>auth.policy.url.2</i>, ...,
* <i>auth.policy.url.X</i>". These properties are set
* in the Java security properties file, which is located in the file named
- * <JAVA_HOME>/lib/security/java.security.
+ * <JAVA_HOME>/conf/security/java.security.
* <JAVA_HOME> refers to the value of the java.home system property,
* and specifies the directory where the JRE is installed.
* Each property value specifies a <code>URL</code> pointing to a
@@ -318,7 +318,7 @@
* you don't find one. Each of these specify a policy file.
*
* if none of these could be loaded, use a builtin static policy
- * equivalent to the default lib/security/java.policy file.
+ * equivalent to the default conf/security/java.policy file.
*
* if the system property "java.policy" or "java.auth.policy" is defined
* (which is the
@@ -468,7 +468,7 @@
* Caller did not specify URL via Policy.getInstance.
* Read from URLs listed in the java.security properties file.
*
- * We call initPolicyFile with POLICY , POLICY_URL and then
+ * We call initPolicyFile with POLICY, POLICY_URL and then
* call it with AUTH_POLICY and AUTH_POLICY_URL
* So first we will process the JAVA standard policy
* and then process the JAVA AUTH Policy.
@@ -709,26 +709,6 @@
// No need to sync because noone has access to newInfo yet
newInfo.policyEntries.add(pe);
- // Add AllPermissions for standard extensions
- String[] extCodebases = PolicyParser.parseExtDirs(
- PolicyParser.EXTDIRS_EXPANSION, 0);
- if (extCodebases != null && extCodebases.length > 0) {
- for (int i = 0; i < extCodebases.length; i++) {
- try {
- pe = new PolicyEntry(canonicalizeCodebase(
- new CodeSource(new URL(extCodebases[i]),
- (Certificate[]) null), false ));
- pe.add(SecurityConstants.ALL_PERMISSION);
-
- // No need to sync because noone has access to
- // newInfo yet
- newInfo.policyEntries.add(pe);
- } catch (Exception e) {
- // this is probably bad (though not dangerous).
- // What should we do?
- }
- }
- }
return null;
}
});
--- a/jdk/src/java.base/share/classes/sun/security/provider/PolicyParser.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/provider/PolicyParser.java Wed Jul 05 20:08:34 2017 +0200
@@ -83,14 +83,6 @@
public class PolicyParser {
- private static final String EXTDIRS_PROPERTY = "java.ext.dirs";
- private static final String OLD_EXTDIRS_EXPANSION =
- "${" + EXTDIRS_PROPERTY + "}";
-
- // package-private: used by PolicyFile for static policy
- static final String EXTDIRS_EXPANSION = "${{" + EXTDIRS_PROPERTY + "}}";
-
-
private Vector<GrantEntry> grantEntries;
private Map<String, DomainEntry> domainEntries;
@@ -576,35 +568,8 @@
try {
if (e.signedBy != null) e.signedBy = expand(e.signedBy);
if (e.codeBase != null) {
-
- // For backward compatibility with 1.4
- if (e.codeBase.equals(OLD_EXTDIRS_EXPANSION)) {
- e.codeBase = EXTDIRS_EXPANSION;
- }
- int es;
- if ((es=e.codeBase.indexOf(EXTDIRS_EXPANSION)) < 0) {
- e.codeBase = expand(e.codeBase, true).replace
- (File.separatorChar, '/');
- } else {
- // expand the system property "java.ext.dirs",
- // parse it into its path components,
- // and then create a grant entry for each component
- String[] extDirs = parseExtDirs(e.codeBase, es);
- if (extDirs != null && extDirs.length > 0) {
- for (int i = 0; i < extDirs.length; i++) {
- GrantEntry newGe = (GrantEntry)e.clone();
- newGe.codeBase = extDirs[i];
- add(newGe);
-
- if (debug != null) {
- debug.println("creating policy entry for " +
- "expanded java.ext.dirs path:\n\t\t" +
- extDirs[i]);
- }
- }
- }
- ignoreEntry = true;
- }
+ e.codeBase = expand(e.codeBase, true).replace
+ (File.separatorChar, '/');
}
} catch (PropertyExpander.ExpandException peee) {
if (debug != null) {
@@ -713,41 +678,6 @@
return properties;
}
- // package-private: used by PolicyFile for static policy
- static String[] parseExtDirs(String codebase, int start) {
-
- String s = System.getProperty(EXTDIRS_PROPERTY);
- String globalPrefix = (start > 0 ? codebase.substring(0, start) : "file:");
- int end = start + EXTDIRS_EXPANSION.length();
- String globalSuffix = (end < codebase.length() ? codebase.substring(end) :
- (String) null);
-
- String[] dirs = null;
- String localSuffix;
- if (s != null) {
- StringTokenizer st =
- new StringTokenizer(s, File.pathSeparator);
- int count = st.countTokens();
- dirs = new String[count];
- for (int i = 0; i < count; i++) {
- File file = new File(st.nextToken());
- dirs[i] = sun.net.www.ParseUtil.encodePath
- (file.getAbsolutePath());
-
- if (!dirs[i].startsWith("/")) {
- dirs[i] = "/" + dirs[i];
- }
-
- localSuffix = (globalSuffix == null ?
- (dirs[i].endsWith("/") ? "*" : "/*") :
- globalSuffix);
-
- dirs[i] = globalPrefix + dirs[i] + localSuffix;
- }
- }
- return dirs;
- }
-
private boolean peekAndMatch(String expect)
throws ParsingException, IOException
{
--- a/jdk/src/java.base/share/classes/sun/util/logging/PlatformLogger.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/util/logging/PlatformLogger.java Wed Jul 05 20:08:34 2017 +0200
@@ -71,10 +71,10 @@
* java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
*
* Limitation:
- * <JAVA_HOME>/lib/logging.properties is the system-wide logging
+ * <JAVA_HOME>/conf/logging.properties is the system-wide logging
* configuration defined in the specification and read in the
* default case to configure any java.util.logging.Logger instances.
- * Platform loggers will not detect if <JAVA_HOME>/lib/logging.properties
+ * Platform loggers will not detect if <JAVA_HOME>/conf/logging.properties
* is modified. In other words, unless the java.util.logging API
* is used at runtime or the logging system properties is set,
* the platform loggers will use the default setting described above.
--- a/jdk/src/java.base/share/conf/security/java.policy Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/conf/security/java.policy Wed Jul 05 20:08:34 2017 +0200
@@ -1,31 +1,25 @@
// permissions required by each component
-grant codeBase "file:${java.home}/lib/ext/zipfs.jar" {
+grant codeBase "jrt:/jdk.zipfs" {
permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
permission java.lang.RuntimePermission "fileSystemProvider";
permission java.util.PropertyPermission "*", "read";
};
-grant codeBase "file:${java.home}/lib/ext/cldrdata.jar" {
+grant codeBase "jrt:/jdk.localedata" {
permission java.lang.RuntimePermission "accessClassInPackage.sun.text.*";
permission java.lang.RuntimePermission "accessClassInPackage.sun.util.*";
permission java.util.PropertyPermission "*", "read";
};
-grant codeBase "file:${java.home}/lib/ext/localedata.jar" {
- permission java.lang.RuntimePermission "accessClassInPackage.sun.text.*";
- permission java.lang.RuntimePermission "accessClassInPackage.sun.util.*";
- permission java.util.PropertyPermission "*", "read";
-};
-
-grant codeBase "file:${java.home}/lib/ext/dnsns.jar" {
+grant codeBase "jrt:/jdk.naming.dns" {
permission java.security.AllPermission;
};
-grant codeBase "file:${java.home}/lib/ext/nashorn.jar" {
+grant codeBase "jrt:/jdk.scripting.nashorn" {
permission java.security.AllPermission;
};
-grant codeBase "file:${java.home}/lib/ext/ucrypto.jar" {
+grant codeBase "jrt:/jdk.crypto.ucrypto" {
permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
permission java.lang.RuntimePermission "loadLibrary.j2ucrypto";
@@ -34,10 +28,10 @@
permission java.security.SecurityPermission "putProviderProperty.OracleUcrypto";
permission java.security.SecurityPermission "clearProviderProperties.OracleUcrypto";
permission java.security.SecurityPermission "removeProviderProperty.OracleUcrypto";
- permission java.io.FilePermission "${java.home}/lib/security/ucrypto-solaris.cfg", "read";
+ permission java.io.FilePermission "${java.home}/conf/security/ucrypto-solaris.cfg", "read";
};
-grant codeBase "file:${java.home}/lib/ext/sunec.jar" {
+grant codeBase "jrt:/jdk.crypto.ec" {
permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
permission java.lang.RuntimePermission "loadLibrary.sunec";
permission java.util.PropertyPermission "*", "read";
@@ -46,16 +40,7 @@
permission java.security.SecurityPermission "removeProviderProperty.SunEC";
};
-grant codeBase "file:${java.home}/lib/ext/sunjce_provider.jar" {
- permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
- permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
- permission java.util.PropertyPermission "*", "read";
- permission java.security.SecurityPermission "putProviderProperty.SunJCE";
- permission java.security.SecurityPermission "clearProviderProperties.SunJCE";
- permission java.security.SecurityPermission "removeProviderProperty.SunJCE";
-};
-
-grant codeBase "file:${java.home}/lib/ext/sunpkcs11.jar" {
+grant codeBase "jrt:/jdk.crypto.pkcs11" {
permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
permission java.lang.RuntimePermission "loadLibrary.j2pkcs11";
--- a/jdk/src/java.base/share/conf/security/java.security Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/conf/security/java.security Wed Jul 05 20:08:34 2017 +0200
@@ -66,8 +66,8 @@
# List of providers and their preference orders (see above):
#
#ifdef solaris
-security.provider.tbd=com.oracle.security.ucrypto.UcryptoProvider ${java.home}/lib/security/ucrypto-solaris.cfg
-security.provider.tbd=sun.security.pkcs11.SunPKCS11 ${java.home}/lib/security/sunpkcs11-solaris.cfg
+security.provider.tbd=com.oracle.security.ucrypto.UcryptoProvider ${java.home}/conf/security/ucrypto-solaris.cfg
+security.provider.tbd=sun.security.pkcs11.SunPKCS11 ${java.home}/conf/security/sunpkcs11-solaris.cfg
#endif
security.provider.tbd=sun.security.provider.Sun
security.provider.tbd=sun.security.rsa.SunRsaSign
@@ -162,7 +162,7 @@
# The default is to have a single system-wide policy file,
# and a policy file in the user's home directory.
-policy.url.1=file:${java.home}/lib/security/java.policy
+policy.url.1=file:${java.home}/conf/security/java.policy
policy.url.2=file:${user.home}/.java.policy
# whether or not we expand properties in the policy file
@@ -219,12 +219,14 @@
com.sun.org.apache.xml.internal.serializer.utils.,\
com.sun.org.apache.xml.internal.utils.,\
com.sun.org.glassfish.,\
+ com.sun.tools.script.,\
com.oracle.xmlns.internal.,\
com.oracle.webservices.internal.,\
org.jcp.xml.dsig.internal.,\
jdk.internal.,\
jdk.nashorn.internal.,\
jdk.nashorn.tools.,\
+ jdk.tools.jimage.,\
com.sun.activation.registries.,\
#ifdef macosx
apple.,\
@@ -268,12 +270,14 @@
com.sun.org.apache.xml.internal.serializer.utils.,\
com.sun.org.apache.xml.internal.utils.,\
com.sun.org.glassfish.,\
+ com.sun.tools.script.,\
com.oracle.xmlns.internal.,\
com.oracle.webservices.internal.,\
org.jcp.xml.dsig.internal.,\
jdk.internal.,\
jdk.nashorn.internal.,\
jdk.nashorn.tools.,\
+ jdk.tools.jimage.,\
com.sun.activation.registries.,\
#ifdef macosx
apple.,\
--- a/jdk/src/java.base/share/native/libjava/System.c Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/native/libjava/System.c Wed Jul 05 20:08:34 2017 +0200
@@ -314,7 +314,6 @@
// to all protocols
if (sprops->exceptionList) {
PUTPROP(props, "http.nonProxyHosts", sprops->exceptionList);
- // HTTPS: implementation in jsse.jar uses http.nonProxyHosts
PUTPROP(props, "ftp.nonProxyHosts", sprops->exceptionList);
PUTPROP(props, "socksNonProxyHosts", sprops->exceptionList);
}
--- a/jdk/src/java.base/share/native/libzip/zip_util.c Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/native/libzip/zip_util.c Wed Jul 05 20:08:34 2017 +0200
@@ -1411,6 +1411,7 @@
}
} while (strm.avail_in > 0);
}
+
inflateEnd(&strm);
return JNI_TRUE;
}
@@ -1482,3 +1483,52 @@
return JNI_TRUE;
}
+
+jboolean JNICALL
+ZIP_InflateFully(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg)
+{
+ z_stream strm;
+ int i = 0;
+ memset(&strm, 0, sizeof(z_stream));
+
+ *pmsg = 0; /* Reset error message */
+
+ if (inflateInit2(&strm, MAX_WBITS) != Z_OK) {
+ *pmsg = strm.msg;
+ return JNI_FALSE;
+ }
+
+ strm.next_out = (Bytef *) outBuf;
+ strm.avail_out = (uInt)outLen;
+ strm.next_in = (Bytef *) inBuf;
+ strm.avail_in = (uInt)inLen;
+
+ do {
+ switch (inflate(&strm, Z_PARTIAL_FLUSH)) {
+ case Z_OK:
+ break;
+ case Z_STREAM_END:
+ if (strm.total_out != outLen) {
+ *pmsg = "INFLATER_inflateFully: Unexpected end of stream";
+ inflateEnd(&strm);
+ return JNI_FALSE;
+ }
+ break;
+ case Z_DATA_ERROR:
+ *pmsg = "INFLATER_inflateFully: Compressed data corrupted";
+ inflateEnd(&strm);
+ return JNI_FALSE;
+ case Z_MEM_ERROR:
+ *pmsg = "INFLATER_inflateFully: out of memory";
+ inflateEnd(&strm);
+ return JNI_FALSE;
+ default:
+ *pmsg = "INFLATER_inflateFully: internal error";
+ inflateEnd(&strm);
+ return JNI_FALSE;
+ }
+ } while (strm.avail_in > 0);
+
+ inflateEnd(&strm);
+ return JNI_TRUE;
+}
--- a/jdk/src/java.base/share/native/libzip/zip_util.h Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/share/native/libzip/zip_util.h Wed Jul 05 20:08:34 2017 +0200
@@ -272,4 +272,8 @@
void ZIP_FreeEntry(jzfile *zip, jzentry *ze);
jlong ZIP_GetEntryDataOffset(jzfile *zip, jzentry *entry);
jzentry * ZIP_GetEntry2(jzfile *zip, char *name, jint ulen, jboolean addSlash);
+
+jboolean JNICALL
+ZIP_InflateFully(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg);
+
#endif /* !_ZIP_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/unix/native/libjava/ConcurrentPReader_md.c Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <unistd.h>
+#include <errno.h>
+
+#include "jni.h"
+#include "jni_util.h"
+#include "jlong.h"
+#include "jdk_internal_jimage_concurrent_ConcurrentPReader.h"
+
+#ifdef _ALLBSD_SOURCE
+ #define pread64 pread
+#endif
+
+#define RESTARTABLE(_cmd, _result) do { \
+ do { \
+ _result = _cmd; \
+ } while((_result == -1) && (errno == EINTR)); \
+} while(0)
+
+static jfieldID fd_fdID;
+
+JNIEXPORT void JNICALL
+Java_jdk_internal_jimage_concurrent_ConcurrentPReader_initIDs(JNIEnv *env, jclass clazz)
+{
+ CHECK_NULL(clazz = (*env)->FindClass(env, "java/io/FileDescriptor"));
+ CHECK_NULL(fd_fdID = (*env)->GetFieldID(env, clazz, "fd", "I"));
+}
+
+JNIEXPORT jint JNICALL
+Java_jdk_internal_jimage_concurrent_ConcurrentPReader_pread(JNIEnv *env, jclass clazz,
+ jobject fdo, jlong address,
+ jint len, jlong offset)
+{
+ jint fd = (*env)->GetIntField(env, fdo, fd_fdID);
+ void *buf = (void *)jlong_to_ptr(address);
+ int res;
+ RESTARTABLE(pread64(fd, buf, len, offset), res);
+ if (res == -1) {
+ JNU_ThrowIOExceptionWithLastError(env, "pread failed");
+ }
+ return res;
+}
--- a/jdk/src/java.base/windows/conf/security/java.policy Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.base/windows/conf/security/java.policy Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
-grant codeBase "file:${java.home}/lib/ext/sunmscapi.jar" {
- Permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+grant codeBase "jrt:/jdk.crypto.mscapi" {
+ permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
permission java.lang.RuntimePermission "loadLibrary.sunmscapi";
permission java.util.PropertyPermission "*", "read";
permission java.security.SecurityPermission "putProviderProperty.SunMSCAPI";
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/windows/native/libjava/ConcurrentPReader_md.c Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <windows.h>
+
+#include "jni_util.h"
+#include "jlong.h"
+#include "jdk_internal_jimage_concurrent_ConcurrentPReader.h"
+
+static jfieldID handle_fdID;
+
+JNIEXPORT void JNICALL
+Java_jdk_internal_jimage_concurrent_ConcurrentPReader_initIDs(JNIEnv *env, jclass clazz)
+{
+ CHECK_NULL(clazz = (*env)->FindClass(env, "java/io/FileDescriptor"));
+ CHECK_NULL(handle_fdID = (*env)->GetFieldID(env, clazz, "handle", "J"));
+}
+
+JNIEXPORT jint JNICALL
+Java_jdk_internal_jimage_concurrent_ConcurrentPReader_pread(JNIEnv *env, jclass clazz,
+ jobject fdo, jlong address,
+ jint len, jlong offset)
+{
+ OVERLAPPED ov;
+ DWORD nread;
+ BOOL result;
+
+ jlong handle = (*env)->GetLongField(env, fdo, handle_fdID);
+ void *buf = (void *)jlong_to_ptr(address);
+
+ ZeroMemory(&ov, sizeof(ov));
+ ov.Offset = (DWORD)offset;
+ ov.OffsetHigh = (DWORD)(offset >> 32);
+
+ result = ReadFile(handle, (LPVOID)buf, len, &nread, &ov);
+ if (result == 0) {
+ JNU_ThrowIOExceptionWithLastError(env, "ReadFile failed");
+ }
+
+ return nread;
+}
+
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JDK13Services.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JDK13Services.java Wed Jul 05 20:08:34 2017 +0200
@@ -64,7 +64,7 @@
/**
* Filename of the properties file for default provider properties. This
- * file is searched in the subdirectory "lib" of the JRE directory (this
+ * file is searched in the subdirectory "conf" of the JRE directory (this
* behaviour is hardcoded).
*/
private static final String PROPERTIES_FILENAME = "sound.properties";
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java Wed Jul 05 20:08:34 2017 +0200
@@ -81,7 +81,7 @@
@param properties The properties bundle to store the values of the
properties file.
@param filename The filename of the properties file to load. This
- filename is interpreted as relative to the subdirectory "lib" in
+ filename is interpreted as relative to the subdirectory "conf" in
the JRE directory.
*/
static void loadProperties(final Properties properties,
@@ -117,7 +117,7 @@
if (fname == null) {
throw new Error("Can't find java.home ??");
}
- File f = new File(fname, "lib");
+ File f = new File(fname, "conf");
f = new File(f, filename);
fname = f.getCanonicalPath();
InputStream in = new FileInputStream(fname);
--- a/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java Wed Jul 05 20:08:34 2017 +0200
@@ -730,7 +730,7 @@
if (properties.size() == 0) {
try {
File propsFile = new File(
- System.getProperty("java.home") + sep + "lib" +
+ System.getProperty("java.home") + sep + "conf" +
sep + "accessibility.properties");
FileInputStream in =
new FileInputStream(propsFile);
--- a/jdk/src/java.desktop/share/classes/javax/imageio/spi/IIORegistry.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/spi/IIORegistry.java Wed Jul 05 20:08:34 2017 +0200
@@ -64,10 +64,8 @@
* <code>ImageWriter</code>, <code>ImageTranscoder</code>,
* <code>ImageInputStream</code>, and <code>ImageOutputStream</code>.
*
- * <p> Service providers found on the system classpath (typically
- * the <code>lib/ext</code> directory in the Java
- * installation directory) are automatically loaded as soon as this class is
- * instantiated.
+ * Service providers found from the Java platform are automatically
+ * loaded as soon as this class is instantiated.
*
* <p> When the <code>registerApplicationClasspathSpis</code> method
* is called, service provider instances declared in the
@@ -227,9 +225,7 @@
private void registerInstalledProviders() {
/*
- We need to load installed providers from the
- system classpath (typically the <code>lib/ext</code>
- directory in in the Java installation directory)
+ We need to load installed providers
in the privileged mode in order to
be able read corresponding jar files even if
file read capability is restricted (like the
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiSystem.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiSystem.java Wed Jul 05 20:08:34 2017 +0200
@@ -65,7 +65,7 @@
* Properties can be used to specify default MIDI devices. Both system
* properties and a properties file are considered. The "sound.properties"
* properties file is read from an implementation-specific location (typically
- * it is the {@code lib} directory in the Java installation directory). If a
+ * it is the {@code conf} directory in the Java installation directory). If a
* property exists both as a system property and in the properties file, the
* system property takes precedence. If none is specified, a suitable default is
* chosen among the available devices. The syntax of the properties file is
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java Wed Jul 05 20:08:34 2017 +0200
@@ -61,7 +61,7 @@
* Properties can be used to specify the default mixer for specific line types.
* Both system properties and a properties file are considered. The
* "sound.properties" properties file is read from an implementation-specific
- * location (typically it is the {@code lib} directory in the Java installation
+ * location (typically it is the {@code conf} directory in the Java installation
* directory). If a property exists both as a system property and in the
* properties file, the system property takes precedence. If none is specified,
* a suitable default is chosen among the available devices. The syntax of the
--- a/jdk/src/java.desktop/share/classes/javax/swing/UIManager.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/UIManager.java Wed Jul 05 20:08:34 2017 +0200
@@ -106,7 +106,7 @@
* use its value as the default look and feel class name. The location
* that is checked for <code>swing.properties</code> may vary depending
* upon the implementation of the Java platform. Typically the
- * <code>swing.properties</code> file is located in the <code>lib</code>
+ * <code>swing.properties</code> file is located in the <code>conf</code>
* subdirectory of the Java installation directory.
* Refer to the release notes of the implementation being used for
* further details.
@@ -281,7 +281,7 @@
/**
* The location of the <code>swing.properties</code> property file is
* implementation-specific.
- * It is typically located in the <code>lib</code> subdirectory of the Java
+ * It is typically located in the <code>conf</code> subdirectory of the Java
* installation directory. This method returns a bogus filename
* if <code>java.home</code> isn't defined.
*/
@@ -293,7 +293,7 @@
if (javaHome == null) {
javaHome = "<java.home undefined>";
}
- return javaHome + sep + "lib" + sep + "swing.properties";
+ return javaHome + sep + "conf" + sep + "swing.properties";
}
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html Wed Jul 05 20:08:34 2017 +0200
@@ -153,7 +153,7 @@
<p>
It's easy to use auxiliary look and feels with Swing. To instruct
Swing to use the Multiplexing look and feel, all an application
-has to do is modify the <code>$JDKHOME/lib/swing.properties</code>
+has to do is modify the <code>$JDKHOME/conf/swing.properties</code>
file to include a definition of the <code>swing.auxiliarylaf</code>
property. Swing treats the <code>swing.auxiliarylaf</code>
property as a comma-separated list of <code>LookAndFeel</code>
@@ -179,7 +179,7 @@
<p>
To tell Swing to use both these look and feels
-- and to use a default look and feel at the same time -- your application
-could simply add the following line to the <code>$JDKHOME/lib/swing.properties</code> file:
+could simply add the following line to the <code>$JDKHOME/conf/swing.properties</code> file:
</p>
<p>
@@ -472,7 +472,7 @@
</p>
<p> To do that, all the user has to do is modify
- the <code>$JDKHOME/lib/swing.properties</code>
+ the <code>$JDKHOME/conf/swing.properties</code>
file to include a definition of the <code>swing.plaf.multiplexinglaf</code>
property. Swing then treats the <code>swing.plaf.multiplexinglaf</code>
property as a <code>LookAndFeel</code>
@@ -483,7 +483,7 @@
that is a better match for their needs than the Multiplexing
look and feel
(<code>javax.swing.plaf.multi.MultiLookAndFeel</code>),
- the user could include the following line in <code>$JDKHOME/lib/swing.properties</code>:
+ the user could include the following line in <code>$JDKHOME/conf/swing.properties</code>:
</p>
<p>
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java Wed Jul 05 20:08:34 2017 +0200
@@ -78,7 +78,7 @@
* <p>
* If neither of these properties is defined then the LogManager uses its
* default configuration. The default configuration is typically loaded from the
- * properties file "{@code lib/logging.properties}" in the Java installation
+ * properties file "{@code conf/logging.properties}" in the Java installation
* directory.
* <p>
* The properties for loggers and Handlers will have names starting
@@ -1210,7 +1210,7 @@
if (fname == null) {
throw new Error("Can't find java.home ??");
}
- File f = new File(fname, "lib");
+ File f = new File(fname, "conf");
f = new File(f, "logging.properties");
fname = f.getCanonicalPath();
}
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/security/FileLoginModule.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/remote/security/FileLoginModule.java Wed Jul 05 20:08:34 2017 +0200
@@ -65,7 +65,7 @@
* associated cleartext password. By default, the following password file is
* used:
* <pre>
- * ${java.home}/lib/management/jmxremote.password
+ * ${java.home}/conf/management/jmxremote.password
* </pre>
* A different password file can be specified via the <code>passwordFile</code>
* configuration option.
@@ -113,7 +113,7 @@
// Location of the default password file
private static final String DEFAULT_PASSWORD_FILE_NAME =
AccessController.doPrivileged(new GetPropertyAction("java.home")) +
- File.separatorChar + "lib" +
+ File.separatorChar + "conf" +
File.separatorChar + "management" + File.separatorChar +
ConnectorBootstrap.DefaultValues.PASSWORD_FILE_NAME;
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/security/JMXPluggableAuthenticator.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/remote/security/JMXPluggableAuthenticator.java Wed Jul 05 20:08:34 2017 +0200
@@ -66,7 +66,7 @@
*
* <p>To override the default configuration use the
* <code>com.sun.management.jmxremote.login.config</code> management property
- * described in the JRE/lib/management/management.properties file.
+ * described in the JRE/conf/management/management.properties file.
* Set this property to the name of a JAAS configuration entry and ensure that
* the entry is loaded by the installed {@link Configuration}. In addition,
* ensure that the authentication mechanisms specified in the entry acquire
--- a/jdk/src/java.management/share/classes/sun/management/Agent.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.management/share/classes/sun/management/Agent.java Wed Jul 05 20:08:34 2017 +0200
@@ -165,7 +165,7 @@
// Load the management properties from the config file
// if config file is not specified readConfiguration implicitly
- // reads <java.home>/lib/management/management.properties
+ // reads <java.home>/conf/management/management.properties
String fname = System.getProperty(CONFIG_FILE);
readConfiguration(fname, configProps);
@@ -404,7 +404,7 @@
throw new Error("Can't find java.home ??");
}
StringBuilder defaultFileName = new StringBuilder(home);
- defaultFileName.append(File.separator).append("lib");
+ defaultFileName.append(File.separator).append("conf");
defaultFileName.append(File.separator).append("management");
defaultFileName.append(File.separator).append("management.properties");
// Set file name
--- a/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java Wed Jul 05 20:08:34 2017 +0200
@@ -615,11 +615,11 @@
/**
* Compute the full path name for a default file.
* @param basename basename (with extension) of the default file.
- * @return ${JRE}/lib/management/${basename}
+ * @return ${JRE}/conf/management/${basename}
**/
private static String getDefaultFileName(String basename) {
final String fileSeparator = File.separator;
- return System.getProperty("java.home") + fileSeparator + "lib" +
+ return System.getProperty("java.home") + fileSeparator + "conf" +
fileSeparator + "management" + fileSeparator +
basename;
}
--- a/jdk/src/java.management/share/conf/jmxremote.access Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.management/share/conf/jmxremote.access Wed Jul 05 20:08:34 2017 +0200
@@ -8,9 +8,9 @@
# passwords. To be functional, a role must have an entry in
# both the password and the access files.
#
-# The default location of this file is $JRE/lib/management/jmxremote.access
-# You can specify an alternate location by specifying a property in
-# the management config file $JRE/lib/management/management.properties
+# The default location of this file is $JRE/conf/management/jmxremote.access
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/conf/management/management.properties
# (See that file for details)
#
# The file format for password and access files is syntactically the same
@@ -69,7 +69,7 @@
#
#
# Default access control entries:
-# o The "monitorRole" role has readonly access.
+# o The "monitorRole" role has readonly access.
# o The "controlRole" role has readwrite access and can create the standard
# Timer and Monitor MBeans defined by the JMX API.
--- a/jdk/src/java.management/share/conf/jmxremote.password.template Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.management/share/conf/jmxremote.password.template Wed Jul 05 20:08:34 2017 +0200
@@ -19,9 +19,9 @@
# access for each role. To be functional, a role must have an entry
# in both the password and the access files.
#
-# Default location of this file is $JRE/lib/management/jmxremote.password
-# You can specify an alternate location by specifying a property in
-# the management config file $JRE/lib/management/management.properties
+# Default location of this file is $JRE/conf/management/jmxremote.password
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/conf/management/management.properties
# or by specifying a system property (See that file for details).
@@ -30,7 +30,7 @@
##############################################################
# Since there are cleartext passwords stored in this file,
# this file must be readable by ONLY the owner,
-# otherwise the program will exit with an error.
+# otherwise the program will exit with an error.
#
# The file format for password and access files is syntactically the same
# as the Properties file format. The syntax is described in the Javadoc
--- a/jdk/src/java.management/share/conf/management.properties Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.management/share/conf/management.properties Wed Jul 05 20:08:34 2017 +0200
@@ -10,7 +10,7 @@
#
# The default Management Configuration file is:
#
-# $JRE/lib/management/management.properties
+# $JRE/conf/management/management.properties
#
# Another location for the Management Configuration File can be specified
# by the following property on the Java command line:
@@ -110,7 +110,7 @@
# com.sun.management.snmp.acl.file=filepath
# Specifies location for ACL file
# This is optional - default location is
-# $JRE/lib/management/snmp.acl
+# $JRE/conf/management/snmp.acl
#
# If the property "com.sun.management.snmp.acl" is set to false,
# then this property and the ACL file are ignored.
@@ -289,7 +289,7 @@
# com.sun.management.jmxremote.password.file=filepath
# Specifies location for password file
# This is optional - default location is
-# $JRE/lib/management/jmxremote.password
+# $JRE/conf/management/jmxremote.password
#
# If the property "com.sun.management.jmxremote.authenticate" is set to
# false, then this property and the password & access files are ignored.
@@ -306,7 +306,7 @@
# com.sun.management.jmxremote.access.file=filepath
# Specifies location for access file
# This is optional - default location is
-# $JRE/lib/management/jmxremote.access
+# $JRE/conf/management/jmxremote.access
#
# If the property "com.sun.management.jmxremote.authenticate" is set to
# false, then this property and the password & access files are ignored.
--- a/jdk/src/java.management/share/conf/snmp.acl.template Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.management/share/conf/snmp.acl.template Wed Jul 05 20:08:34 2017 +0200
@@ -10,12 +10,12 @@
# ----------------------------------------------------------------------
############################################################
-# SNMP Access Control List File
+# SNMP Access Control List File
############################################################
#
-# Default location of this file is $JRE/lib/management/snmp.acl.
-# You can specify an alternate location by specifying a property in
-# the management config file $JRE/lib/management/management.properties
+# Default location of this file is $JRE/conf/management/snmp.acl.
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/conf/management/management.properties
# or by specifying a system property (See that file for details).
#
@@ -23,10 +23,10 @@
##############################################################
# File permissions of the snmp.acl file
##############################################################
-#
+#
# Since there are cleartext community strings stored in this file,
# this ACL file must be readable by ONLY the owner,
-# otherwise the program will exit with an error.
+# otherwise the program will exit with an error.
#
##############################################################
# Format of the acl group
@@ -41,8 +41,8 @@
# Each can be expressed as any one of the following:
# - hostname: hubble
# - ip v4 and v6 addresses: 123.456.789.12 , fe80::a00:20ff:fe9b:ea82
-# - ip v4 and v6 netmask prefix notation: 123.456.789.0/24,
-# fe80::a00:20ff:fe9b:ea82/64
+# - ip v4 and v6 netmask prefix notation: 123.456.789.0/24,
+# fe80::a00:20ff:fe9b:ea82/64
# see RFC 2373 (http://www.ietf.org/rfc/rfc2373.txt)
#
# An example of two community groups for multiple hosts:
@@ -58,7 +58,7 @@
# managers = hubble, telescope
# }
# }
-#
+#
##############################################################
# Format of the trap group
##############################################################
@@ -84,7 +84,7 @@
#
# Update the community strings (public and private) below
# before copying this template file
-#
+#
# Common SNMP ACL Example
# ------------------------
#
@@ -100,11 +100,11 @@
# managers = localhost
# }
# }
-#
-#
+#
+#
# trap = {
# {
# trap-community = public
-# hosts = localhost
+# hosts = localhost
# }
# }
--- a/jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java Wed Jul 05 20:08:34 2017 +0200
@@ -60,9 +60,9 @@
private static final String APP_RESOURCE_FILE_NAME = "jndi.properties";
/*
- * Name of properties file in <java.home>/lib.
+ * Name of properties file in <java.home>/conf.
*/
- private static final String JRELIB_PROPERTY_FILE_NAME = "jndi.properties";
+ private static final String JRE_CONF_PROPERTY_FILE_NAME = "jndi.properties";
/*
* Internal environment property, that when set to "true", disables
@@ -474,7 +474,7 @@
/*
* Returns the Hashtable (never null) that results from merging
* all application resource files available to this thread's
- * context class loader. The properties file in <java.home>/lib
+ * context class loader. The properties file in <java.home>/conf
* is also merged in. The results are cached.
*
* SECURITY NOTES:
@@ -523,9 +523,9 @@
}
}
- // Merge in properties from file in <java.home>/lib.
+ // Merge in properties from file in <java.home>/conf.
InputStream istream =
- helper.getJavaHomeLibStream(JRELIB_PROPERTY_FILE_NAME);
+ helper.getJavaHomeConfStream(JRE_CONF_PROPERTY_FILE_NAME);
if (istream != null) {
try {
Properties props = new Properties();
--- a/jdk/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java Wed Jul 05 20:08:34 2017 +0200
@@ -159,12 +159,12 @@
}
/*
- * Returns an input stream for a file in <java.home>/lib,
+ * Returns an input stream for a file in <java.home>/conf,
* or null if it cannot be located or opened.
*
* @param filename The file name, sans directory.
*/
- InputStream getJavaHomeLibStream(String filename) {
+ InputStream getJavaHomeConfStream(String filename) {
PrivilegedAction<InputStream> act = () -> {
try {
String javahome = System.getProperty("java.home");
@@ -172,7 +172,7 @@
return null;
}
String pathname = javahome + File.separator +
- "lib" + File.separator + filename;
+ "conf" + File.separator + filename;
return new FileInputStream(pathname);
} catch (Exception e) {
return null;
--- a/jdk/src/java.naming/share/classes/javax/naming/Context.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.naming/share/classes/javax/naming/Context.java Wed Jul 05 20:08:34 2017 +0200
@@ -207,11 +207,9 @@
* {@link ClassLoader#getResources <tt>ClassLoader.getResources()</tt>})
* all <em>application resource files</em> named <tt>jndi.properties</tt>
* in the classpath.
- * In addition, if the file <i>java.home</i><tt>/lib/jndi.properties</tt>
- * exists and is readable,
+ * In addition, if the Java installation directory contains a built-in
+ * properties file, typically <tt>conf/jndi.properties</tt>,
* JNDI treats it as an additional application resource file.
- * (<i>java.home</i> indicates the
- * directory named by the <tt>java.home</tt> system property.)
* All of the properties contained in these files are placed
* into the environment of the initial context. This environment
* is then inherited by other contexts.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.scripting/share/classes/com/sun/tools/script/shell/Main.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,586 @@
+/*
+ * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.script.shell;
+
+import java.io.*;
+import java.net.*;
+import java.text.*;
+import java.util.*;
+import javax.script.*;
+
+/**
+ * This is the main class for Java script shell.
+ */
+public class Main {
+ /**
+ * main entry point to the command line tool
+ * @param args command line argument array
+ */
+ public static void main(String[] args) {
+ // parse command line options
+ String[] scriptArgs = processOptions(args);
+
+ // process each script command
+ for (Command cmd : scripts) {
+ cmd.run(scriptArgs);
+ }
+
+ System.exit(EXIT_SUCCESS);
+ }
+
+ // Each -e or -f or interactive mode is represented
+ // by an instance of Command.
+ private static interface Command {
+ public void run(String[] arguments);
+ }
+
+ /**
+ * Parses and processes command line options.
+ * @param args command line argument array
+ */
+ private static String[] processOptions(String[] args) {
+ // current scripting language selected
+ String currentLanguage = DEFAULT_LANGUAGE;
+ // current script file encoding selected
+ String currentEncoding = null;
+
+ // check for -classpath or -cp first
+ checkClassPath(args);
+
+ // have we seen -e or -f ?
+ boolean seenScript = false;
+ // have we seen -f - already?
+ boolean seenStdin = false;
+ for (int i=0; i < args.length; i++) {
+ String arg = args[i];
+ if (arg.equals("-classpath") ||
+ arg.equals("-cp")) {
+ // handled already, just continue
+ i++;
+ continue;
+ }
+
+ // collect non-option arguments and pass these as script arguments
+ if (!arg.startsWith("-")) {
+ int numScriptArgs;
+ int startScriptArg;
+ if (seenScript) {
+ // if we have seen -e or -f already all non-option arguments
+ // are passed as script arguments
+ numScriptArgs = args.length - i;
+ startScriptArg = i;
+ } else {
+ // if we have not seen -e or -f, first non-option argument
+ // is treated as script file name and rest of the non-option
+ // arguments are passed to script as script arguments
+ numScriptArgs = args.length - i - 1;
+ startScriptArg = i + 1;
+ ScriptEngine se = getScriptEngine(currentLanguage);
+ addFileSource(se, args[i], currentEncoding);
+ }
+ // collect script arguments and return to main
+ String[] result = new String[numScriptArgs];
+ System.arraycopy(args, startScriptArg, result, 0, numScriptArgs);
+ return result;
+ }
+
+ if (arg.startsWith("-D")) {
+ String value = arg.substring(2);
+ int eq = value.indexOf('=');
+ if (eq != -1) {
+ System.setProperty(value.substring(0, eq),
+ value.substring(eq + 1));
+ } else {
+ if (!value.equals("")) {
+ System.setProperty(value, "");
+ } else {
+ // do not allow empty property name
+ usage(EXIT_CMD_NO_PROPNAME);
+ }
+ }
+ continue;
+ } else if (arg.equals("-?") || arg.equals("-help")) {
+ usage(EXIT_SUCCESS);
+ } else if (arg.equals("-e")) {
+ seenScript = true;
+ if (++i == args.length)
+ usage(EXIT_CMD_NO_SCRIPT);
+
+ ScriptEngine se = getScriptEngine(currentLanguage);
+ addStringSource(se, args[i]);
+ continue;
+ } else if (arg.equals("-encoding")) {
+ if (++i == args.length)
+ usage(EXIT_CMD_NO_ENCODING);
+ currentEncoding = args[i];
+ continue;
+ } else if (arg.equals("-f")) {
+ seenScript = true;
+ if (++i == args.length)
+ usage(EXIT_CMD_NO_FILE);
+ ScriptEngine se = getScriptEngine(currentLanguage);
+ if (args[i].equals("-")) {
+ if (seenStdin) {
+ usage(EXIT_MULTIPLE_STDIN);
+ } else {
+ seenStdin = true;
+ }
+ addInteractiveMode(se);
+ } else {
+ addFileSource(se, args[i], currentEncoding);
+ }
+ continue;
+ } else if (arg.equals("-l")) {
+ if (++i == args.length)
+ usage(EXIT_CMD_NO_LANG);
+ currentLanguage = args[i];
+ continue;
+ } else if (arg.equals("-q")) {
+ listScriptEngines();
+ }
+ // some unknown option...
+ usage(EXIT_UNKNOWN_OPTION);
+ }
+
+ if (! seenScript) {
+ ScriptEngine se = getScriptEngine(currentLanguage);
+ addInteractiveMode(se);
+ }
+ return new String[0];
+ }
+
+ /**
+ * Adds interactive mode Command
+ * @param se ScriptEngine to use in interactive mode.
+ */
+ private static void addInteractiveMode(final ScriptEngine se) {
+ scripts.add(new Command() {
+ public void run(String[] args) {
+ setScriptArguments(se, args);
+ processSource(se, "-", null);
+ }
+ });
+ }
+
+ /**
+ * Adds script source file Command
+ * @param se ScriptEngine used to evaluate the script file
+ * @param fileName script file name
+ * @param encoding script file encoding
+ */
+ private static void addFileSource(final ScriptEngine se,
+ final String fileName,
+ final String encoding) {
+ scripts.add(new Command() {
+ public void run(String[] args) {
+ setScriptArguments(se, args);
+ processSource(se, fileName, encoding);
+ }
+ });
+ }
+
+ /**
+ * Adds script string source Command
+ * @param se ScriptEngine to be used to evaluate the script string
+ * @param source Script source string
+ */
+ private static void addStringSource(final ScriptEngine se,
+ final String source) {
+ scripts.add(new Command() {
+ public void run(String[] args) {
+ setScriptArguments(se, args);
+ String oldFile = setScriptFilename(se, "<string>");
+ try {
+ evaluateString(se, source);
+ } finally {
+ setScriptFilename(se, oldFile);
+ }
+ }
+ });
+ }
+
+ /**
+ * Prints list of script engines available and exits.
+ */
+ private static void listScriptEngines() {
+ List<ScriptEngineFactory> factories = engineManager.getEngineFactories();
+ for (ScriptEngineFactory factory: factories) {
+ getError().println(getMessage("engine.info",
+ new Object[] { factory.getLanguageName(),
+ factory.getLanguageVersion(),
+ factory.getEngineName(),
+ factory.getEngineVersion()
+ }));
+ }
+ System.exit(EXIT_SUCCESS);
+ }
+
+ /**
+ * Processes a given source file or standard input.
+ * @param se ScriptEngine to be used to evaluate
+ * @param filename file name, can be null
+ * @param encoding script file encoding, can be null
+ */
+ private static void processSource(ScriptEngine se, String filename,
+ String encoding) {
+ if (filename.equals("-")) {
+ BufferedReader in = new BufferedReader
+ (new InputStreamReader(getIn()));
+ boolean hitEOF = false;
+ String prompt = getPrompt(se);
+ se.put(ScriptEngine.FILENAME, "<STDIN>");
+ while (!hitEOF) {
+ getError().print(prompt);
+ String source = "";
+ try {
+ source = in.readLine();
+ } catch (IOException ioe) {
+ getError().println(ioe.toString());
+ }
+ if (source == null) {
+ hitEOF = true;
+ break;
+ }
+ Object res = evaluateString(se, source, false);
+ if (res != null) {
+ res = res.toString();
+ if (res == null) {
+ res = "null";
+ }
+ getError().println(res);
+ }
+ }
+ } else {
+ FileInputStream fis = null;
+ try {
+ fis = new FileInputStream(filename);
+ } catch (FileNotFoundException fnfe) {
+ getError().println(getMessage("file.not.found",
+ new Object[] { filename }));
+ System.exit(EXIT_FILE_NOT_FOUND);
+ }
+ evaluateStream(se, fis, filename, encoding);
+ }
+ }
+
+ /**
+ * Evaluates given script source
+ * @param se ScriptEngine to evaluate the string
+ * @param script Script source string
+ * @param exitOnError whether to exit the process on script error
+ */
+ private static Object evaluateString(ScriptEngine se,
+ String script, boolean exitOnError) {
+ try {
+ return se.eval(script);
+ } catch (ScriptException sexp) {
+ getError().println(getMessage("string.script.error",
+ new Object[] { sexp.getMessage() }));
+ if (exitOnError)
+ System.exit(EXIT_SCRIPT_ERROR);
+ } catch (Exception exp) {
+ exp.printStackTrace(getError());
+ if (exitOnError)
+ System.exit(EXIT_SCRIPT_ERROR);
+ }
+
+ return null;
+ }
+
+ /**
+ * Evaluate script string source and exit on script error
+ * @param se ScriptEngine to evaluate the string
+ * @param script Script source string
+ */
+ private static void evaluateString(ScriptEngine se, String script) {
+ evaluateString(se, script, true);
+ }
+
+ /**
+ * Evaluates script from given reader
+ * @param se ScriptEngine to evaluate the string
+ * @param reader Reader from which is script is read
+ * @param name file name to report in error.
+ */
+ private static Object evaluateReader(ScriptEngine se,
+ Reader reader, String name) {
+ String oldFilename = setScriptFilename(se, name);
+ try {
+ return se.eval(reader);
+ } catch (ScriptException sexp) {
+ getError().println(getMessage("file.script.error",
+ new Object[] { name, sexp.getMessage() }));
+ System.exit(EXIT_SCRIPT_ERROR);
+ } catch (Exception exp) {
+ exp.printStackTrace(getError());
+ System.exit(EXIT_SCRIPT_ERROR);
+ } finally {
+ setScriptFilename(se, oldFilename);
+ }
+ return null;
+ }
+
+ /**
+ * Evaluates given input stream
+ * @param se ScriptEngine to evaluate the string
+ * @param is InputStream from which script is read
+ * @param name file name to report in error
+ */
+ private static Object evaluateStream(ScriptEngine se,
+ InputStream is, String name,
+ String encoding) {
+ BufferedReader reader = null;
+ if (encoding != null) {
+ try {
+ reader = new BufferedReader(new InputStreamReader(is,
+ encoding));
+ } catch (UnsupportedEncodingException uee) {
+ getError().println(getMessage("encoding.unsupported",
+ new Object[] { encoding }));
+ System.exit(EXIT_NO_ENCODING_FOUND);
+ }
+ } else {
+ reader = new BufferedReader(new InputStreamReader(is));
+ }
+ return evaluateReader(se, reader, name);
+ }
+
+ /**
+ * Prints usage message and exits
+ * @param exitCode process exit code
+ */
+ private static void usage(int exitCode) {
+ getError().println(getMessage("main.usage",
+ new Object[] { PROGRAM_NAME }));
+ System.exit(exitCode);
+ }
+
+ /**
+ * Gets prompt for interactive mode
+ * @return prompt string to use
+ */
+ private static String getPrompt(ScriptEngine se) {
+ List<String> names = se.getFactory().getNames();
+ return names.get(0) + "> ";
+ }
+
+ /**
+ * Get formatted, localized error message
+ */
+ private static String getMessage(String key, Object[] params) {
+ return MessageFormat.format(msgRes.getString(key), params);
+ }
+
+ // input stream from where we will read
+ private static InputStream getIn() {
+ return System.in;
+ }
+
+ // stream to print error messages
+ private static PrintStream getError() {
+ return System.err;
+ }
+
+ // get current script engine
+ private static ScriptEngine getScriptEngine(String lang) {
+ ScriptEngine se = engines.get(lang);
+ if (se == null) {
+ se = engineManager.getEngineByName(lang);
+ if (se == null) {
+ getError().println(getMessage("engine.not.found",
+ new Object[] { lang }));
+ System.exit(EXIT_ENGINE_NOT_FOUND);
+ }
+
+ // initialize the engine
+ initScriptEngine(se);
+ // to avoid re-initialization of engine, store it in a map
+ engines.put(lang, se);
+ }
+ return se;
+ }
+
+ // initialize a given script engine
+ private static void initScriptEngine(ScriptEngine se) {
+ // put engine global variable
+ se.put("engine", se);
+
+ // load init.<ext> file from resource
+ List<String> exts = se.getFactory().getExtensions();
+ InputStream sysIn = null;
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ for (String ext : exts) {
+ sysIn = cl.getResourceAsStream("com/sun/tools/script/shell/init." +
+ ext);
+ if (sysIn != null) break;
+ }
+ if (sysIn != null) {
+ evaluateStream(se, sysIn, "<system-init>", null);
+ }
+ }
+
+ /**
+ * Checks for -classpath, -cp in command line args. Creates a ClassLoader
+ * and sets it as Thread context loader for current thread.
+ *
+ * @param args command line argument array
+ */
+ private static void checkClassPath(String[] args) {
+ String classPath = null;
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].equals("-classpath") ||
+ args[i].equals("-cp")) {
+ if (++i == args.length) {
+ // just -classpath or -cp with no value
+ usage(EXIT_CMD_NO_CLASSPATH);
+ } else {
+ classPath = args[i];
+ }
+ }
+ }
+
+ if (classPath != null) {
+ /* We create a class loader, configure it with specified
+ * classpath values and set the same as context loader.
+ * Note that ScriptEngineManager uses context loader to
+ * load script engines. So, this ensures that user defined
+ * script engines will be loaded. For classes referred
+ * from scripts, Rhino engine uses thread context loader
+ * but this is script engine dependent. We don't have
+ * script engine independent solution anyway. Unless we
+ * know the class loader used by a specific engine, we
+ * can't configure correct loader.
+ */
+ URL[] urls = pathToURLs(classPath);
+ URLClassLoader loader = new URLClassLoader(urls);
+ Thread.currentThread().setContextClassLoader(loader);
+ }
+
+ // now initialize script engine manager. Note that this has to
+ // be done after setting the context loader so that manager
+ // will see script engines from user specified classpath
+ engineManager = new ScriptEngineManager();
+ }
+
+ /**
+ * Utility method for converting a search path string to an array
+ * of directory and JAR file URLs.
+ *
+ * @param path the search path string
+ * @return the resulting array of directory and JAR file URLs
+ */
+ private static URL[] pathToURLs(String path) {
+ String[] components = path.split(File.pathSeparator);
+ URL[] urls = new URL[components.length];
+ int count = 0;
+ while(count < components.length) {
+ URL url = fileToURL(new File(components[count]));
+ if (url != null) {
+ urls[count++] = url;
+ }
+ }
+ if (urls.length != count) {
+ URL[] tmp = new URL[count];
+ System.arraycopy(urls, 0, tmp, 0, count);
+ urls = tmp;
+ }
+ return urls;
+ }
+
+ /**
+ * Returns the directory or JAR file URL corresponding to the specified
+ * local file name.
+ *
+ * @param file the File object
+ * @return the resulting directory or JAR file URL, or null if unknown
+ */
+ private static URL fileToURL(File file) {
+ String name;
+ try {
+ name = file.getCanonicalPath();
+ } catch (IOException e) {
+ name = file.getAbsolutePath();
+ }
+ name = name.replace(File.separatorChar, '/');
+ if (!name.startsWith("/")) {
+ name = "/" + name;
+ }
+ // If the file does not exist, then assume that it's a directory
+ if (!file.isFile()) {
+ name = name + "/";
+ }
+ try {
+ return new URL("file", "", name);
+ } catch (MalformedURLException e) {
+ throw new IllegalArgumentException("file");
+ }
+ }
+
+ private static void setScriptArguments(ScriptEngine se, String[] args) {
+ se.put("arguments", args);
+ se.put(ScriptEngine.ARGV, args);
+ }
+
+ private static String setScriptFilename(ScriptEngine se, String name) {
+ String oldName = (String) se.get(ScriptEngine.FILENAME);
+ se.put(ScriptEngine.FILENAME, name);
+ return oldName;
+ }
+
+ // exit codes
+ private static final int EXIT_SUCCESS = 0;
+ private static final int EXIT_CMD_NO_CLASSPATH = 1;
+ private static final int EXIT_CMD_NO_FILE = 2;
+ private static final int EXIT_CMD_NO_SCRIPT = 3;
+ private static final int EXIT_CMD_NO_LANG = 4;
+ private static final int EXIT_CMD_NO_ENCODING = 5;
+ private static final int EXIT_CMD_NO_PROPNAME = 6;
+ private static final int EXIT_UNKNOWN_OPTION = 7;
+ private static final int EXIT_ENGINE_NOT_FOUND = 8;
+ private static final int EXIT_NO_ENCODING_FOUND = 9;
+ private static final int EXIT_SCRIPT_ERROR = 10;
+ private static final int EXIT_FILE_NOT_FOUND = 11;
+ private static final int EXIT_MULTIPLE_STDIN = 12;
+
+ // default scripting language
+ private static final String DEFAULT_LANGUAGE = "js";
+ // list of scripts to process
+ private static List<Command> scripts;
+ // the script engine manager
+ private static ScriptEngineManager engineManager;
+ // map of engines we loaded
+ private static Map<String, ScriptEngine> engines;
+ // error messages resource
+ private static ResourceBundle msgRes;
+ private static String BUNDLE_NAME = "com.sun.tools.script.shell.messages";
+ private static String PROGRAM_NAME = "jrunscript";
+
+ static {
+ scripts = new ArrayList<Command>();
+ engines = new HashMap<String, ScriptEngine>();
+ msgRes = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.scripting/share/classes/com/sun/tools/script/shell/init.js Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,927 @@
+/*
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * jrunscript JavaScript built-in functions and objects.
+ */
+
+/**
+ * Creates an object that delegates all method calls on
+ * it to the 'invoke' method on the given delegate object.<br>
+ *
+ * Example:
+ * <pre>
+ * <code>
+ * var x = { invoke: function(name, args) { //code...}
+ * var y = new JSInvoker(x);
+ * y.func(3, 3); // calls x.invoke('func', args); where args is array of arguments
+ * </code>
+ * </pre>
+ * @param obj object to be wrapped by JSInvoker
+ * @constructor
+ */
+function JSInvoker(obj) {
+ return new JSAdapter({
+ __get__ : function(name) {
+ return function() {
+ return obj.invoke(name, arguments);
+ }
+ }
+ });
+}
+
+/**
+ * This variable represents OS environment. Environment
+ * variables can be accessed as fields of this object. For
+ * example, env.PATH will return PATH value configured.
+ */
+var env = new JSAdapter({
+ __get__ : function (name) {
+ return java.lang.System.getenv(name);
+ },
+ __has__ : function (name) {
+ return java.lang.System.getenv().containsKey(name);
+ },
+ __getIds__ : function() {
+ return java.lang.System.getenv().keySet().toArray();
+ },
+ __delete__ : function(name) {
+ println("can't delete env item");
+ },
+ __put__ : function (name, value) {
+ println("can't change env item");
+ },
+ toString: function() {
+ return java.lang.System.getenv().toString();
+ }
+});
+
+/**
+ * Creates a convenient script object to deal with java.util.Map instances.
+ * The result script object's field names are keys of the Map. For example,
+ * scriptObj.keyName can be used to access value associated with given key.<br>
+ * Example:
+ * <pre>
+ * <code>
+ * var x = java.lang.SystemProperties();
+ * var y = jmap(x);
+ * println(y['java.class.path']); // prints java.class.path System property
+ * delete y['java.class.path']; // remove java.class.path System property
+ * </code>
+ * </pre>
+ *
+ * @param map java.util.Map instance that will be wrapped
+ * @constructor
+ */
+function jmap(map) {
+ return new JSAdapter({
+ __get__ : function(name) {
+ if (map.containsKey(name)) {
+ return map.get(name);
+ } else {
+ return undefined;
+ }
+ },
+ __has__ : function(name) {
+ return map.containsKey(name);
+ },
+
+ __delete__ : function (name) {
+ return map.remove(name);
+ },
+ __put__ : function(name, value) {
+ map.put(name, value);
+ },
+ __getIds__ : function() {
+ return map.keySet().toArray();
+ },
+ toString: function() {
+ return map.toString();
+ }
+ });
+}
+
+/**
+ * Creates a convenient script object to deal with java.util.List instances.
+ * The result script object behaves like an array. For example,
+ * scriptObj[index] syntax can be used to access values in the List instance.
+ * 'length' field gives size of the List. <br>
+ *
+ * Example:
+ * <pre>
+ * <code>
+ * var x = new java.util.ArrayList(4);
+ * x.add('Java');
+ * x.add('JavaScript');
+ * x.add('SQL');
+ * x.add('XML');
+ *
+ * var y = jlist(x);
+ * println(y[2]); // prints third element of list
+ * println(y.length); // prints size of the list
+ *
+ * @param map java.util.List instance that will be wrapped
+ * @constructor
+ */
+function jlist(list) {
+ function isValid(index) {
+ return typeof(index) == 'number' &&
+ index > -1 && index < list.size();
+ }
+ return new JSAdapter({
+ __get__ : function(name) {
+ if (isValid(name)) {
+ return list.get(name);
+ } else if (name == 'length') {
+ return list.size();
+ } else {
+ return undefined;
+ }
+ },
+ __has__ : function (name) {
+ return isValid(name) || name == 'length';
+ },
+ __delete__ : function(name) {
+ if (isValid(name)) {
+ list.remove(name);
+ }
+ },
+ __put__ : function(name, value) {
+ if (isValid(name)) {
+ list.set(name, value);
+ }
+ },
+ __getIds__: function() {
+ var res = new Array(list.size());
+ for (var i = 0; i < res.length; i++) {
+ res[i] = i;
+ }
+ return res;
+ },
+ toString: function() {
+ return list.toString();
+ }
+ });
+}
+
+/**
+ * This is java.lang.System properties wrapped by JSAdapter.
+ * For eg. to access java.class.path property, you can use
+ * the syntax sysProps["java.class.path"]
+ */
+var sysProps = new JSAdapter({
+ __get__ : function (name) {
+ return java.lang.System.getProperty(name);
+ },
+ __has__ : function (name) {
+ return java.lang.System.getProperty(name) != null;
+ },
+ __getIds__ : function() {
+ return java.lang.System.getProperties().keySet().toArray();
+ },
+ __delete__ : function(name) {
+ java.lang.System.clearProperty(name);
+ return true;
+ },
+ __put__ : function (name, value) {
+ java.lang.System.setProperty(name, value);
+ },
+ toString: function() {
+ return "<system properties>";
+ }
+});
+
+// stdout, stderr & stdin
+var out = java.lang.System.out;
+var err = java.lang.System.err;
+// can't use 'in' because it is a JavaScript keyword :-(
+var inp = java.lang.System["in"];
+
+var BufferedInputStream = java.io.BufferedInputStream;
+var BufferedOutputStream = java.io.BufferedOutputStream;
+var BufferedReader = java.io.BufferedReader;
+var DataInputStream = java.io.DataInputStream;
+var File = java.io.File;
+var FileInputStream = java.io.FileInputStream;
+var FileOutputStream = java.io.FileOutputStream;
+var InputStream = java.io.InputStream;
+var InputStreamReader = java.io.InputStreamReader;
+var OutputStream = java.io.OutputStream;
+var Reader = java.io.Reader;
+var URL = java.net.URL;
+
+/**
+ * Generic any object to input stream mapper
+ * @param str input file name, URL or InputStream
+ * @return InputStream object
+ * @private
+ */
+function inStream(str) {
+ if (typeof(str) == "string") {
+ // '-' means standard input
+ if (str == '-') {
+ return java.lang.System["in"];
+ }
+ // try file first
+ var file = null;
+ try {
+ file = pathToFile(str);
+ } catch (e) {
+ }
+ if (file && file.exists()) {
+ return new FileInputStream(file);
+ } else {
+ try {
+ // treat the string as URL
+ return new URL(str).openStream();
+ } catch (e) {
+ throw 'file or URL ' + str + ' not found';
+ }
+ }
+ } else {
+ if (str instanceof InputStream) {
+ return str;
+ } else if (str instanceof URL) {
+ return str.openStream();
+ } else if (str instanceof File) {
+ return new FileInputStream(str);
+ }
+ }
+ // everything failed, just give input stream
+ return java.lang.System["in"];
+}
+
+/**
+ * Generic any object to output stream mapper
+ *
+ * @param out output file name or stream
+ * @return OutputStream object
+ * @private
+ */
+function outStream(out) {
+ if (typeof(out) == "string") {
+ if (out == '>') {
+ return java.lang.System.out;
+ } else {
+ // treat it as file
+ return new FileOutputStream(pathToFile(out));
+ }
+ } else {
+ if (out instanceof OutputStream) {
+ return out;
+ } else if (out instanceof File) {
+ return new FileOutputStream(out);
+ }
+ }
+
+ // everything failed, just return System.out
+ return java.lang.System.out;
+}
+
+/**
+ * stream close takes care not to close stdin, out & err.
+ * @private
+ */
+function streamClose(stream) {
+ if (stream) {
+ if (stream != java.lang.System["in"] &&
+ stream != java.lang.System.out &&
+ stream != java.lang.System.err) {
+ try {
+ stream.close();
+ } catch (e) {
+ println(e);
+ }
+ }
+ }
+}
+
+/**
+ * Loads and evaluates JavaScript code from a stream or file or URL<br>
+ *
+ * Examples:
+ * <pre>
+ * <code>
+ * load('test.js'); // load script file 'test.js'
+ * load('http://java.sun.com/foo.js'); // load from a URL
+ * </code>
+ * </pre>
+ *
+ * @param str input from which script is loaded and evaluated
+ */
+if (typeof(load) == 'undefined') {
+ this.load = function(str) {
+ var stream = inStream(str);
+ var bstream = new BufferedInputStream(stream);
+ var reader = new BufferedReader(new InputStreamReader(bstream));
+ var oldFilename = engine.get(engine.FILENAME);
+ engine.put(engine.FILENAME, str);
+ try {
+ engine.eval(reader);
+ } finally {
+ engine.put(engine.FILENAME, oldFilename);
+ streamClose(stream);
+ }
+ }
+}
+
+// file system utilities
+
+/**
+ * Creates a Java byte[] of given length
+ * @param len size of the array to create
+ * @private
+ */
+function javaByteArray(len) {
+ return java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, len);
+}
+
+var curDir = new File('.');
+
+/**
+ * Print present working directory
+ */
+function pwd() {
+ println(curDir.getAbsolutePath());
+}
+
+/**
+ * Changes present working directory to given directory
+ * @param target directory to change to. optional, defaults to user's HOME
+ */
+function cd(target) {
+ if (target == undefined) {
+ target = sysProps["user.home"];
+ }
+ if (!(target instanceof File)) {
+ target = pathToFile(target);
+ }
+ if (target.exists() && target.isDirectory()) {
+ curDir = target;
+ } else {
+ println(target + " is not a directory");
+ }
+}
+
+/**
+ * Converts path to java.io.File taking care of shell present working dir
+ *
+ * @param pathname file path to be converted
+ * @private
+ */
+function pathToFile(pathname) {
+ var tmp = pathname;
+ if (!(tmp instanceof File)) {
+ tmp = new File(tmp);
+ }
+ if (!tmp.isAbsolute()) {
+ return new File(curDir, pathname);
+ } else {
+ return tmp;
+ }
+}
+
+/**
+ * Copies a file or URL or stream to another file or stream
+ *
+ * @param from input file or URL or stream
+ * @param to output stream or file
+ */
+function cp(from, to) {
+ if (from == to) {
+ println("file " + from + " cannot be copied onto itself!");
+ return;
+ }
+ var inp = inStream(from);
+ var out = outStream(to);
+ var binp = new BufferedInputStream(inp);
+ var bout = new BufferedOutputStream(out);
+ var buff = javaByteArray(1024);
+ var len;
+ while ((len = binp.read(buff)) > 0 )
+ bout.write(buff, 0, len);
+
+ bout.flush();
+ streamClose(inp);
+ streamClose(out);
+}
+
+/**
+ * Shows the content of a file or URL or any InputStream<br>
+ * Examples:
+ * <pre>
+ * <code>
+ * cat('test.txt'); // show test.txt file contents
+ * cat('http://java.net'); // show the contents from the URL http://java.net
+ * </code>
+ * </pre>
+ * @param obj input to show
+ * @param pattern optional. show only the lines matching the pattern
+ */
+function cat(obj, pattern) {
+ if (obj instanceof File && obj.isDirectory()) {
+ ls(obj);
+ return;
+ }
+
+ var inp = null;
+ if (!(obj instanceof Reader)) {
+ inp = inStream(obj);
+ obj = new BufferedReader(new InputStreamReader(inp));
+ }
+ var line;
+ if (pattern) {
+ var count = 1;
+ while ((line=obj.readLine()) != null) {
+ if (line.match(pattern)) {
+ println(count + "\t: " + line);
+ }
+ count++;
+ }
+ } else {
+ while ((line=obj.readLine()) != null) {
+ println(line);
+ }
+ }
+}
+
+/**
+ * Returns directory part of a filename
+ *
+ * @param pathname input path name
+ * @return directory part of the given file name
+ */
+function dirname(pathname) {
+ var dirName = ".";
+ // Normalize '/' to local file separator before work.
+ var i = pathname.replace('/', File.separatorChar ).lastIndexOf(
+ File.separator );
+ if ( i != -1 )
+ dirName = pathname.substring(0, i);
+ return dirName;
+}
+
+/**
+ * Creates a new dir of given name
+ *
+ * @param dir name of the new directory
+ */
+function mkdir(dir) {
+ dir = pathToFile(dir);
+ println(dir.mkdir()? "created" : "can not create dir");
+}
+
+/**
+ * Creates the directory named by given pathname, including
+ * any necessary but nonexistent parent directories.
+ *
+ * @param dir input path name
+ */
+function mkdirs(dir) {
+ dir = pathToFile(dir);
+ println(dir.mkdirs()? "created" : "can not create dirs");
+}
+
+/**
+ * Removes a given file
+ *
+ * @param pathname name of the file
+ */
+function rm(pathname) {
+ var file = pathToFile(pathname);
+ if (!file.exists()) {
+ println("file not found: " + pathname);
+ return false;
+ }
+ // note that delete is a keyword in JavaScript!
+ println(file["delete"]()? "deleted" : "can not delete");
+}
+
+/**
+ * Removes a given directory
+ *
+ * @param pathname name of the directory
+ */
+function rmdir(pathname) {
+ rm(pathname);
+}
+
+/**
+ * Synonym for 'rm'
+ */
+function del(pathname) {
+ rm(pathname);
+}
+
+/**
+ * Moves a file to another
+ *
+ * @param from original name of the file
+ * @param to new name for the file
+ */
+function mv(from, to) {
+ println(pathToFile(from).renameTo(pathToFile(to))?
+ "moved" : "can not move");
+}
+
+/**
+ * Synonym for 'mv'.
+ */
+function ren(from, to) {
+ mv(from, to);
+}
+
+var months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
+
+/**
+ * Helper function called by ls
+ * @private
+ */
+function printFile(f) {
+ var sb = new java.lang.StringBuffer();
+ sb.append(f.isDirectory()? "d" : "-");
+ sb.append(f.canRead() ? "r": "-" );
+ sb.append(f.canWrite() ? "w": "-" );
+ sb.append(" ");
+
+ var d = new java.util.Date(f.lastModified());
+ var c = new java.util.GregorianCalendar();
+ c.setTime(d);
+ var day = c.get(java.util.Calendar.DAY_OF_MONTH);
+ sb.append(months[c.get(java.util.Calendar.MONTH)]
+ + " " + day );
+ if (day < 10) {
+ sb.append(" ");
+ }
+
+ // to get fixed length 'length' field
+ var fieldlen = 8;
+ var len = new java.lang.StringBuffer();
+ for(var j=0; j<fieldlen; j++)
+ len.append(" ");
+ len.insert(0, java.lang.Long.toString(f.length()));
+ len.setLength(fieldlen);
+ // move the spaces to the front
+ var si = len.toString().indexOf(" ");
+ if ( si != -1 ) {
+ var pad = len.toString().substring(si);
+ len.setLength(si);
+ len.insert(0, pad);
+ }
+ sb.append(len.toString());
+ sb.append(" ");
+ sb.append(f.getName());
+ if (f.isDirectory()) {
+ sb.append('/');
+ }
+ println(sb.toString());
+}
+
+/**
+ * Lists the files in a directory
+ *
+ * @param dir directory from which to list the files. optional, default to pwd
+ * @param filter pattern to filter the files listed. optional, default is '.'.
+ */
+function ls(dir, filter) {
+ if (dir) {
+ dir = pathToFile(dir);
+ } else {
+ dir = curDir;
+ }
+ if (dir.isDirectory()) {
+ var files = dir.listFiles();
+ for (var i in files) {
+ var f = files[i];
+ if (filter) {
+ if(!f.getName().match(filter)) {
+ continue;
+ }
+ }
+ printFile(f);
+ }
+ } else {
+ printFile(dir);
+ }
+}
+
+/**
+ * Synonym for 'ls'.
+ */
+function dir(d, filter) {
+ ls(d, filter);
+}
+
+/**
+ * Unix-like grep, but accepts JavaScript regex patterns
+ *
+ * @param pattern to search in files
+ * @param files one or more files
+ */
+function grep(pattern, files /*, one or more files */) {
+ if (arguments.length < 2) return;
+ for (var i = 1; i < arguments.length; i++) {
+ println(arguments[i] + ":");
+ cat(arguments[i], pattern);
+ }
+}
+
+/**
+ * Find in files. Calls arbitrary callback function
+ * for each matching file.<br>
+ *
+ * Examples:
+ * <pre>
+ * <code>
+ * find('.')
+ * find('.', '.*\.class', rm); // remove all .class files
+ * find('.', '.*\.java'); // print fullpath of each .java file
+ * find('.', '.*\.java', cat); // print all .java files
+ * </code>
+ * </pre>
+ *
+ * @param dir directory to search files
+ * @param pattern to search in the files
+ * @param callback function to call for matching files
+ */
+function find(dir, pattern, callback) {
+ dir = pathToFile(dir);
+ if (!callback) callback = print;
+ var files = dir.listFiles();
+ for (var f in files) {
+ var file = files[f];
+ if (file.isDirectory()) {
+ find(file, pattern, callback);
+ } else {
+ if (pattern) {
+ if (file.getName().match(pattern)) {
+ callback(file);
+ }
+ } else {
+ callback(file);
+ }
+ }
+ }
+}
+
+// process utilities
+
+/**
+ * Exec's a child process, waits for completion & returns exit code
+ *
+ * @param cmd command to execute in child process
+ */
+function exec(cmd) {
+ var process = java.lang.Runtime.getRuntime().exec(cmd);
+ var inp = new DataInputStream(process.getInputStream());
+ var line = null;
+ while ((line = inp.readLine()) != null) {
+ println(line);
+ }
+ process.waitFor();
+ $exit = process.exitValue();
+}
+
+if (typeof(exit) == 'undefined') {
+ /**
+ * Exit the shell program.
+ *
+ * @param exitCode integer code returned to OS shell.
+ * optional, defaults to 0
+ */
+ this.exit = function (code) {
+ if (code) {
+ java.lang.System.exit(code + 0);
+ } else {
+ java.lang.System.exit(0);
+ }
+ }
+}
+
+if (typeof(quit) == 'undefined') {
+ /**
+ * synonym for exit
+ */
+ this.quit = function (code) {
+ exit(code);
+ }
+}
+
+// XML utilities
+
+/**
+ * Converts input to DOM Document object
+ *
+ * @param inp file or reader. optional, without this param,
+ * this function returns a new DOM Document.
+ * @return returns a DOM Document object
+ */
+function XMLDocument(inp) {
+ var factory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
+ var builder = factory.newDocumentBuilder();
+ if (inp) {
+ if (typeof(inp) == "string") {
+ return builder.parse(pathToFile(inp));
+ } else {
+ return builder.parse(inp);
+ }
+ } else {
+ return builder.newDocument();
+ }
+}
+
+/**
+ * Converts arbitrary stream, file, URL to XMLSource
+ *
+ * @param inp input stream or file or URL
+ * @return XMLSource object
+ */
+function XMLSource(inp) {
+ if (inp instanceof javax.xml.transform.Source) {
+ return inp;
+ } else if (inp instanceof Packages.org.w3c.dom.Document) {
+ return new javax.xml.transform.dom.DOMSource(inp);
+ } else {
+ inp = new BufferedInputStream(inStream(inp));
+ return new javax.xml.transform.stream.StreamSource(inp);
+ }
+}
+
+/**
+ * Converts arbitrary stream, file to XMLResult
+ *
+ * @param inp output stream or file
+ * @return XMLResult object
+ */
+function XMLResult(out) {
+ if (out instanceof javax.xml.transform.Result) {
+ return out;
+ } else if (out instanceof Packages.org.w3c.dom.Document) {
+ return new javax.xml.transform.dom.DOMResult(out);
+ } else {
+ out = new BufferedOutputStream(outStream(out));
+ return new javax.xml.transform.stream.StreamResult(out);
+ }
+}
+
+/**
+ * Perform XSLT transform
+ *
+ * @param inp Input XML to transform (URL, File or InputStream)
+ * @param style XSL Stylesheet to be used (URL, File or InputStream). optional.
+ * @param out Output XML (File or OutputStream
+ */
+function XSLTransform(inp, style, out) {
+ switch (arguments.length) {
+ case 2:
+ inp = arguments[0];
+ out = arguments[1];
+ break;
+ case 3:
+ inp = arguments[0];
+ style = arguments[1];
+ out = arguments[2];
+ break;
+ default:
+ println("XSL transform requires 2 or 3 arguments");
+ return;
+ }
+
+ var factory = javax.xml.transform.TransformerFactory.newInstance();
+ var transformer;
+ if (style) {
+ transformer = factory.newTransformer(XMLSource(style));
+ } else {
+ transformer = factory.newTransformer();
+ }
+ var source = XMLSource(inp);
+ var result = XMLResult(out);
+ transformer.transform(source, result);
+ if (source.getInputStream) {
+ streamClose(source.getInputStream());
+ }
+ if (result.getOutputStream) {
+ streamClose(result.getOutputStream());
+ }
+}
+
+// miscellaneous utilities
+
+/**
+ * Prints which command is selected from PATH
+ *
+ * @param cmd name of the command searched from PATH
+ */
+function which(cmd) {
+ var st = new java.util.StringTokenizer(env.PATH, File.pathSeparator);
+ while (st.hasMoreTokens()) {
+ var file = new File(st.nextToken(), cmd);
+ if (file.exists()) {
+ println(file.getAbsolutePath());
+ return;
+ }
+ }
+}
+
+/**
+ * Prints IP addresses of given domain name
+ *
+ * @param name domain name
+ */
+function ip(name) {
+ var addrs = InetAddress.getAllByName(name);
+ for (var i in addrs) {
+ println(addrs[i]);
+ }
+}
+
+/**
+ * Prints current date in current locale
+ */
+function date() {
+ println(new Date().toLocaleString());
+}
+
+/**
+ * Echoes the given string arguments
+ */
+function echo(x) {
+ for (var i = 0; i < arguments.length; i++) {
+ println(arguments[i]);
+ }
+}
+
+if (typeof(printf) == 'undefined') {
+ /**
+ * This is C-like printf
+ *
+ * @param format string to format the rest of the print items
+ * @param args variadic argument list
+ */
+ this.printf = function (format, args/*, more args*/) {
+ var array = java.lang.reflect.Array.newInstance(java.lang.Object,
+ arguments.length - 1);
+ for (var i = 0; i < array.length; i++) {
+ array[i] = arguments[i+1];
+ }
+ java.lang.System.out.printf(format, array);
+ }
+}
+
+/**
+ * Reads one or more lines from stdin after printing prompt
+ *
+ * @param prompt optional, default is '>'
+ * @param multiline to tell whether to read single line or multiple lines
+ */
+function read(prompt, multiline) {
+ if (!prompt) {
+ prompt = '>';
+ }
+ var inp = java.lang.System["in"];
+ var reader = new BufferedReader(new InputStreamReader(inp));
+ if (multiline) {
+ var line = '';
+ while (true) {
+ java.lang.System.err.print(prompt);
+ java.lang.System.err.flush();
+ var tmp = reader.readLine();
+ if (tmp == '' || tmp == null) break;
+ line += tmp + '\n';
+ }
+ return line;
+ } else {
+ java.lang.System.err.print(prompt);
+ java.lang.System.err.flush();
+ return reader.readLine();
+ }
+}
+
+if (typeof(println) == 'undefined') {
+ // just synonym to print
+ this.println = print;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.scripting/share/classes/com/sun/tools/script/shell/messages.properties Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+string.script.error=\
+ script error: {0}
+
+file.script.error=\
+ script error in file {0} : {1}
+
+file.not.found=\
+ script file {0} is not found
+
+engine.not.found=\
+ script engine for language {0} can not be found
+
+engine.info=\
+ Language {0} {1} implementation "{2}" {3}
+
+encoding.unsupported=\
+ encoding {0} is not supported
+
+main.usage=\
+Usage: {0} [options] [arguments...]\n\
+\n\
+where [options] include:\n\
+\ \-classpath <path> Specify where to find user class files \n\
+\ \-cp <path> Specify where to find user class files \n\
+\ \-D<name>=<value> Set a system property \n\
+\ \-J<flag> Pass <flag> directly to the runtime system \n\
+\ \-l <language> Use specified scripting language \n\
+\ \-e <script> Evaluate given script \n\
+\ \-encoding <encoding> Specify character encoding used by script files \n\
+\ \-f <script file> Evaluate given script file \n\
+\ \-f - Interactive mode, read script from standard input \n\
+\ \ If this is used, this should be the last -f option \n\
+\ \-help Print this usage message and exit \n\
+\ \-? Print this usage message and exit \n\
+\ \-q List all scripting engines available and exit \n\
+\ \n\
+If [arguments..] are present and if no -e or -f option is used, then first\n\
+argument is script file and the rest of the arguments, if any, are passed\n\
+as script arguments. If [arguments..] and -e or -f option is used, then all\n\
+[arguments..] are passed as script arguments. If [arguments..], -e, -f are\n\
+missing, then interactive mode is used.
--- a/jdk/src/java.scripting/share/classes/javax/script/ScriptEngineManager.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.scripting/share/classes/javax/script/ScriptEngineManager.java Wed Jul 05 20:08:34 2017 +0200
@@ -66,8 +66,7 @@
* <code>ScriptEngineFactory</code> visible to the given
* <code>ClassLoader</code> using the <a href="../../../technotes/guides/jar/jar.html#Service%20Provider">service provider</a> mechanism.<br><br>
* If loader is <code>null</code>, the script engine factories that are
- * bundled with the platform and that are in the usual extension
- * directories (installed extensions) are loaded. <br><br>
+ * bundled with the platform are loaded. <br>
*
* @param loader ClassLoader used to discover script engine factories.
*/
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/package-info.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/package-info.java Wed Jul 05 20:08:34 2017 +0200
@@ -45,7 +45,7 @@
* file. If none of these system properties are set, the {@code krb5.conf}
* file is searched for in an implementation-specific manner. Typically,
* an implementation will first look for a {@code krb5.conf} file in
- * {@code <java-home>/lib/security} and failing that, in an OS-specific
+ * {@code <java-home>/conf/security} and failing that, in an OS-specific
* location.<p>
*
* The {@code krb5.conf} file is formatted in the Windows INI file style,
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java Wed Jul 05 20:08:34 2017 +0200
@@ -737,7 +737,7 @@
*
* If the system property "java.security.krb5.conf" is defined, we'll
* use its value, no matter if the file exists or not. Otherwise, we
- * will look at $JAVA_HOME/lib/security directory with "krb5.conf" name,
+ * will look at $JAVA_HOME/conf/security directory with "krb5.conf" name,
* and return it if the file exists.
*
* The method returns null if it cannot find a Java config file.
@@ -746,7 +746,7 @@
String name = getProperty("java.security.krb5.conf");
if (name == null) {
name = getProperty("java.home") + File.separator +
- "lib" + File.separator + "security" +
+ "conf" + File.separator + "security" +
File.separator + "krb5.conf";
if (!fileExists(name)) {
name = null;
--- a/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/SunEC.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/SunEC.java Wed Jul 05 20:08:34 2017 +0200
@@ -37,12 +37,11 @@
* IMPLEMENTATION NOTE:
* The Java classes in this provider access a native ECC implementation
* via JNI to a C++ wrapper class which in turn calls C functions.
- * The Java classes are packaged into the signed sunec.jar in the JRE
- * extensions directory and the C++ and C functions are packaged into
- * libsunec.so or sunec.dll in the JRE native libraries directory.
- * If the native library is not present then this provider is registered
- * with support for fewer ECC algorithms (KeyPairGenerator, Signature and
- * KeyAgreement are omitted).
+ * The Java classes are packaged into the jdk.crypto.sunec module and the
+ * C++ and C functions are packaged into libsunec.so or sunec.dll in the
+ * JRE native libraries directory. If the native library is not present
+ * then this provider is registered with support for fewer ECC algorithms
+ * (KeyPairGenerator, Signature and KeyAgreement are omitted).
*
* @since 1.7
*/
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/Config.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/Config.java Wed Jul 05 20:08:34 2017 +0200
@@ -35,8 +35,6 @@
import sun.security.action.GetPropertyAction;
import sun.security.util.PropertyExpander;
-import sun.security.pkcs11.wrapper.*;
-
/**
* Configuration container and file parsing.
*
--- a/jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell/Main.java Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,587 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.script.shell;
-
-import java.io.*;
-import java.net.*;
-import java.text.*;
-import java.util.*;
-import javax.script.*;
-
-/**
- * This is the main class for Java script shell.
- */
-public class Main {
- /**
- * main entry point to the command line tool
- * @param args command line argument array
- */
- public static void main(String[] args) {
- // parse command line options
- String[] scriptArgs = processOptions(args);
-
- // process each script command
- for (Command cmd : scripts) {
- cmd.run(scriptArgs);
- }
-
- System.exit(EXIT_SUCCESS);
- }
-
- // Each -e or -f or interactive mode is represented
- // by an instance of Command.
- private static interface Command {
- public void run(String[] arguments);
- }
-
- /**
- * Parses and processes command line options.
- * @param args command line argument array
- */
- private static String[] processOptions(String[] args) {
- // current scripting language selected
- String currentLanguage = DEFAULT_LANGUAGE;
- // current script file encoding selected
- String currentEncoding = null;
-
- // check for -classpath or -cp first
- checkClassPath(args);
-
- // have we seen -e or -f ?
- boolean seenScript = false;
- // have we seen -f - already?
- boolean seenStdin = false;
- for (int i=0; i < args.length; i++) {
- String arg = args[i];
- if (arg.equals("-classpath") ||
- arg.equals("-cp")) {
- // handled already, just continue
- i++;
- continue;
- }
-
- // collect non-option arguments and pass these as script arguments
- if (!arg.startsWith("-")) {
- int numScriptArgs;
- int startScriptArg;
- if (seenScript) {
- // if we have seen -e or -f already all non-option arguments
- // are passed as script arguments
- numScriptArgs = args.length - i;
- startScriptArg = i;
- } else {
- // if we have not seen -e or -f, first non-option argument
- // is treated as script file name and rest of the non-option
- // arguments are passed to script as script arguments
- numScriptArgs = args.length - i - 1;
- startScriptArg = i + 1;
- ScriptEngine se = getScriptEngine(currentLanguage);
- addFileSource(se, args[i], currentEncoding);
- }
- // collect script arguments and return to main
- String[] result = new String[numScriptArgs];
- System.arraycopy(args, startScriptArg, result, 0, numScriptArgs);
- return result;
- }
-
- if (arg.startsWith("-D")) {
- String value = arg.substring(2);
- int eq = value.indexOf('=');
- if (eq != -1) {
- System.setProperty(value.substring(0, eq),
- value.substring(eq + 1));
- } else {
- if (!value.equals("")) {
- System.setProperty(value, "");
- } else {
- // do not allow empty property name
- usage(EXIT_CMD_NO_PROPNAME);
- }
- }
- continue;
- } else if (arg.equals("-?") || arg.equals("-help")) {
- usage(EXIT_SUCCESS);
- } else if (arg.equals("-e")) {
- seenScript = true;
- if (++i == args.length)
- usage(EXIT_CMD_NO_SCRIPT);
-
- ScriptEngine se = getScriptEngine(currentLanguage);
- addStringSource(se, args[i]);
- continue;
- } else if (arg.equals("-encoding")) {
- if (++i == args.length)
- usage(EXIT_CMD_NO_ENCODING);
- currentEncoding = args[i];
- continue;
- } else if (arg.equals("-f")) {
- seenScript = true;
- if (++i == args.length)
- usage(EXIT_CMD_NO_FILE);
- ScriptEngine se = getScriptEngine(currentLanguage);
- if (args[i].equals("-")) {
- if (seenStdin) {
- usage(EXIT_MULTIPLE_STDIN);
- } else {
- seenStdin = true;
- }
- addInteractiveMode(se);
- } else {
- addFileSource(se, args[i], currentEncoding);
- }
- continue;
- } else if (arg.equals("-l")) {
- if (++i == args.length)
- usage(EXIT_CMD_NO_LANG);
- currentLanguage = args[i];
- continue;
- } else if (arg.equals("-q")) {
- listScriptEngines();
- }
- // some unknown option...
- usage(EXIT_UNKNOWN_OPTION);
- }
-
- if (! seenScript) {
- ScriptEngine se = getScriptEngine(currentLanguage);
- addInteractiveMode(se);
- }
- return new String[0];
- }
-
- /**
- * Adds interactive mode Command
- * @param se ScriptEngine to use in interactive mode.
- */
- private static void addInteractiveMode(final ScriptEngine se) {
- scripts.add(new Command() {
- public void run(String[] args) {
- setScriptArguments(se, args);
- processSource(se, "-", null);
- }
- });
- }
-
- /**
- * Adds script source file Command
- * @param se ScriptEngine used to evaluate the script file
- * @param fileName script file name
- * @param encoding script file encoding
- */
- private static void addFileSource(final ScriptEngine se,
- final String fileName,
- final String encoding) {
- scripts.add(new Command() {
- public void run(String[] args) {
- setScriptArguments(se, args);
- processSource(se, fileName, encoding);
- }
- });
- }
-
- /**
- * Adds script string source Command
- * @param se ScriptEngine to be used to evaluate the script string
- * @param source Script source string
- */
- private static void addStringSource(final ScriptEngine se,
- final String source) {
- scripts.add(new Command() {
- public void run(String[] args) {
- setScriptArguments(se, args);
- String oldFile = setScriptFilename(se, "<string>");
- try {
- evaluateString(se, source);
- } finally {
- setScriptFilename(se, oldFile);
- }
- }
- });
- }
-
- /**
- * Prints list of script engines available and exits.
- */
- private static void listScriptEngines() {
- List<ScriptEngineFactory> factories = engineManager.getEngineFactories();
- for (ScriptEngineFactory factory: factories) {
- getError().println(getMessage("engine.info",
- new Object[] { factory.getLanguageName(),
- factory.getLanguageVersion(),
- factory.getEngineName(),
- factory.getEngineVersion()
- }));
- }
- System.exit(EXIT_SUCCESS);
- }
-
- /**
- * Processes a given source file or standard input.
- * @param se ScriptEngine to be used to evaluate
- * @param filename file name, can be null
- * @param encoding script file encoding, can be null
- */
- private static void processSource(ScriptEngine se, String filename,
- String encoding) {
- if (filename.equals("-")) {
- BufferedReader in = new BufferedReader
- (new InputStreamReader(getIn()));
- boolean hitEOF = false;
- String prompt = getPrompt(se);
- se.put(ScriptEngine.FILENAME, "<STDIN>");
- while (!hitEOF) {
- getError().print(prompt);
- String source = "";
- try {
- source = in.readLine();
- } catch (IOException ioe) {
- getError().println(ioe.toString());
- }
- if (source == null) {
- hitEOF = true;
- break;
- }
- Object res = evaluateString(se, source, false);
- if (res != null) {
- res = res.toString();
- if (res == null) {
- res = "null";
- }
- getError().println(res);
- }
- }
- } else {
- FileInputStream fis = null;
- try {
- fis = new FileInputStream(filename);
- } catch (FileNotFoundException fnfe) {
- getError().println(getMessage("file.not.found",
- new Object[] { filename }));
- System.exit(EXIT_FILE_NOT_FOUND);
- }
- evaluateStream(se, fis, filename, encoding);
- }
- }
-
- /**
- * Evaluates given script source
- * @param se ScriptEngine to evaluate the string
- * @param script Script source string
- * @param exitOnError whether to exit the process on script error
- */
- private static Object evaluateString(ScriptEngine se,
- String script, boolean exitOnError) {
- try {
- return se.eval(script);
- } catch (ScriptException sexp) {
- getError().println(getMessage("string.script.error",
- new Object[] { sexp.getMessage() }));
- if (exitOnError)
- System.exit(EXIT_SCRIPT_ERROR);
- } catch (Exception exp) {
- exp.printStackTrace(getError());
- if (exitOnError)
- System.exit(EXIT_SCRIPT_ERROR);
- }
-
- return null;
- }
-
- /**
- * Evaluate script string source and exit on script error
- * @param se ScriptEngine to evaluate the string
- * @param script Script source string
- */
- private static void evaluateString(ScriptEngine se, String script) {
- evaluateString(se, script, true);
- }
-
- /**
- * Evaluates script from given reader
- * @param se ScriptEngine to evaluate the string
- * @param reader Reader from which is script is read
- * @param name file name to report in error.
- */
- private static Object evaluateReader(ScriptEngine se,
- Reader reader, String name) {
- String oldFilename = setScriptFilename(se, name);
- try {
- return se.eval(reader);
- } catch (ScriptException sexp) {
- getError().println(getMessage("file.script.error",
- new Object[] { name, sexp.getMessage() }));
- System.exit(EXIT_SCRIPT_ERROR);
- } catch (Exception exp) {
- exp.printStackTrace(getError());
- System.exit(EXIT_SCRIPT_ERROR);
- } finally {
- setScriptFilename(se, oldFilename);
- }
- return null;
- }
-
- /**
- * Evaluates given input stream
- * @param se ScriptEngine to evaluate the string
- * @param is InputStream from which script is read
- * @param name file name to report in error
- */
- private static Object evaluateStream(ScriptEngine se,
- InputStream is, String name,
- String encoding) {
- BufferedReader reader = null;
- if (encoding != null) {
- try {
- reader = new BufferedReader(new InputStreamReader(is,
- encoding));
- } catch (UnsupportedEncodingException uee) {
- getError().println(getMessage("encoding.unsupported",
- new Object[] { encoding }));
- System.exit(EXIT_NO_ENCODING_FOUND);
- }
- } else {
- reader = new BufferedReader(new InputStreamReader(is));
- }
- return evaluateReader(se, reader, name);
- }
-
- /**
- * Prints usage message and exits
- * @param exitCode process exit code
- */
- private static void usage(int exitCode) {
- getError().println(getMessage("main.usage",
- new Object[] { PROGRAM_NAME }));
- System.exit(exitCode);
- }
-
- /**
- * Gets prompt for interactive mode
- * @return prompt string to use
- */
- private static String getPrompt(ScriptEngine se) {
- List<String> names = se.getFactory().getNames();
- return names.get(0) + "> ";
- }
-
- /**
- * Get formatted, localized error message
- */
- private static String getMessage(String key, Object[] params) {
- return MessageFormat.format(msgRes.getString(key), params);
- }
-
- // input stream from where we will read
- private static InputStream getIn() {
- return System.in;
- }
-
- // stream to print error messages
- private static PrintStream getError() {
- return System.err;
- }
-
- // get current script engine
- private static ScriptEngine getScriptEngine(String lang) {
- ScriptEngine se = engines.get(lang);
- if (se == null) {
- se = engineManager.getEngineByName(lang);
- if (se == null) {
- getError().println(getMessage("engine.not.found",
- new Object[] { lang }));
- System.exit(EXIT_ENGINE_NOT_FOUND);
- }
-
- // initialize the engine
- initScriptEngine(se);
- // to avoid re-initialization of engine, store it in a map
- engines.put(lang, se);
- }
- return se;
- }
-
- // initialize a given script engine
- private static void initScriptEngine(ScriptEngine se) {
- // put engine global variable
- se.put("engine", se);
-
- // load init.<ext> file from resource
- List<String> exts = se.getFactory().getExtensions();
- InputStream sysIn = null;
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- for (String ext : exts) {
- sysIn = cl.getResourceAsStream("com/sun/tools/script/shell/init." +
- ext);
- if (sysIn != null) break;
- }
- if (sysIn != null) {
- evaluateStream(se, sysIn, "<system-init>", null);
- }
- }
-
- /**
- * Checks for -classpath, -cp in command line args. Creates a ClassLoader
- * and sets it as Thread context loader for current thread.
- *
- * @param args command line argument array
- */
- private static void checkClassPath(String[] args) {
- String classPath = null;
- for (int i = 0; i < args.length; i++) {
- if (args[i].equals("-classpath") ||
- args[i].equals("-cp")) {
- if (++i == args.length) {
- // just -classpath or -cp with no value
- usage(EXIT_CMD_NO_CLASSPATH);
- } else {
- classPath = args[i];
- }
- }
- }
-
- if (classPath != null) {
- /* We create a class loader, configure it with specified
- * classpath values and set the same as context loader.
- * Note that ScriptEngineManager uses context loader to
- * load script engines. So, this ensures that user defined
- * script engines will be loaded. For classes referred
- * from scripts, Rhino engine uses thread context loader
- * but this is script engine dependent. We don't have
- * script engine independent solution anyway. Unless we
- * know the class loader used by a specific engine, we
- * can't configure correct loader.
- */
- ClassLoader parent = Main.class.getClassLoader();
- URL[] urls = pathToURLs(classPath);
- URLClassLoader loader = new URLClassLoader(urls, parent);
- Thread.currentThread().setContextClassLoader(loader);
- }
-
- // now initialize script engine manager. Note that this has to
- // be done after setting the context loader so that manager
- // will see script engines from user specified classpath
- engineManager = new ScriptEngineManager();
- }
-
- /**
- * Utility method for converting a search path string to an array
- * of directory and JAR file URLs.
- *
- * @param path the search path string
- * @return the resulting array of directory and JAR file URLs
- */
- private static URL[] pathToURLs(String path) {
- String[] components = path.split(File.pathSeparator);
- URL[] urls = new URL[components.length];
- int count = 0;
- while(count < components.length) {
- URL url = fileToURL(new File(components[count]));
- if (url != null) {
- urls[count++] = url;
- }
- }
- if (urls.length != count) {
- URL[] tmp = new URL[count];
- System.arraycopy(urls, 0, tmp, 0, count);
- urls = tmp;
- }
- return urls;
- }
-
- /**
- * Returns the directory or JAR file URL corresponding to the specified
- * local file name.
- *
- * @param file the File object
- * @return the resulting directory or JAR file URL, or null if unknown
- */
- private static URL fileToURL(File file) {
- String name;
- try {
- name = file.getCanonicalPath();
- } catch (IOException e) {
- name = file.getAbsolutePath();
- }
- name = name.replace(File.separatorChar, '/');
- if (!name.startsWith("/")) {
- name = "/" + name;
- }
- // If the file does not exist, then assume that it's a directory
- if (!file.isFile()) {
- name = name + "/";
- }
- try {
- return new URL("file", "", name);
- } catch (MalformedURLException e) {
- throw new IllegalArgumentException("file");
- }
- }
-
- private static void setScriptArguments(ScriptEngine se, String[] args) {
- se.put("arguments", args);
- se.put(ScriptEngine.ARGV, args);
- }
-
- private static String setScriptFilename(ScriptEngine se, String name) {
- String oldName = (String) se.get(ScriptEngine.FILENAME);
- se.put(ScriptEngine.FILENAME, name);
- return oldName;
- }
-
- // exit codes
- private static final int EXIT_SUCCESS = 0;
- private static final int EXIT_CMD_NO_CLASSPATH = 1;
- private static final int EXIT_CMD_NO_FILE = 2;
- private static final int EXIT_CMD_NO_SCRIPT = 3;
- private static final int EXIT_CMD_NO_LANG = 4;
- private static final int EXIT_CMD_NO_ENCODING = 5;
- private static final int EXIT_CMD_NO_PROPNAME = 6;
- private static final int EXIT_UNKNOWN_OPTION = 7;
- private static final int EXIT_ENGINE_NOT_FOUND = 8;
- private static final int EXIT_NO_ENCODING_FOUND = 9;
- private static final int EXIT_SCRIPT_ERROR = 10;
- private static final int EXIT_FILE_NOT_FOUND = 11;
- private static final int EXIT_MULTIPLE_STDIN = 12;
-
- // default scripting language
- private static final String DEFAULT_LANGUAGE = "js";
- // list of scripts to process
- private static List<Command> scripts;
- // the script engine manager
- private static ScriptEngineManager engineManager;
- // map of engines we loaded
- private static Map<String, ScriptEngine> engines;
- // error messages resource
- private static ResourceBundle msgRes;
- private static String BUNDLE_NAME = "com.sun.tools.script.shell.messages";
- private static String PROGRAM_NAME = "jrunscript";
-
- static {
- scripts = new ArrayList<Command>();
- engines = new HashMap<String, ScriptEngine>();
- msgRes = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault());
- }
-}
--- a/jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell/init.js Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,927 +0,0 @@
-/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * jrunscript JavaScript built-in functions and objects.
- */
-
-/**
- * Creates an object that delegates all method calls on
- * it to the 'invoke' method on the given delegate object.<br>
- *
- * Example:
- * <pre>
- * <code>
- * var x = { invoke: function(name, args) { //code...}
- * var y = new JSInvoker(x);
- * y.func(3, 3); // calls x.invoke('func', args); where args is array of arguments
- * </code>
- * </pre>
- * @param obj object to be wrapped by JSInvoker
- * @constructor
- */
-function JSInvoker(obj) {
- return new JSAdapter({
- __get__ : function(name) {
- return function() {
- return obj.invoke(name, arguments);
- }
- }
- });
-}
-
-/**
- * This variable represents OS environment. Environment
- * variables can be accessed as fields of this object. For
- * example, env.PATH will return PATH value configured.
- */
-var env = new JSAdapter({
- __get__ : function (name) {
- return java.lang.System.getenv(name);
- },
- __has__ : function (name) {
- return java.lang.System.getenv().containsKey(name);
- },
- __getIds__ : function() {
- return java.lang.System.getenv().keySet().toArray();
- },
- __delete__ : function(name) {
- println("can't delete env item");
- },
- __put__ : function (name, value) {
- println("can't change env item");
- },
- toString: function() {
- return java.lang.System.getenv().toString();
- }
-});
-
-/**
- * Creates a convenient script object to deal with java.util.Map instances.
- * The result script object's field names are keys of the Map. For example,
- * scriptObj.keyName can be used to access value associated with given key.<br>
- * Example:
- * <pre>
- * <code>
- * var x = java.lang.SystemProperties();
- * var y = jmap(x);
- * println(y['java.class.path']); // prints java.class.path System property
- * delete y['java.class.path']; // remove java.class.path System property
- * </code>
- * </pre>
- *
- * @param map java.util.Map instance that will be wrapped
- * @constructor
- */
-function jmap(map) {
- return new JSAdapter({
- __get__ : function(name) {
- if (map.containsKey(name)) {
- return map.get(name);
- } else {
- return undefined;
- }
- },
- __has__ : function(name) {
- return map.containsKey(name);
- },
-
- __delete__ : function (name) {
- return map.remove(name);
- },
- __put__ : function(name, value) {
- map.put(name, value);
- },
- __getIds__ : function() {
- return map.keySet().toArray();
- },
- toString: function() {
- return map.toString();
- }
- });
-}
-
-/**
- * Creates a convenient script object to deal with java.util.List instances.
- * The result script object behaves like an array. For example,
- * scriptObj[index] syntax can be used to access values in the List instance.
- * 'length' field gives size of the List. <br>
- *
- * Example:
- * <pre>
- * <code>
- * var x = new java.util.ArrayList(4);
- * x.add('Java');
- * x.add('JavaScript');
- * x.add('SQL');
- * x.add('XML');
- *
- * var y = jlist(x);
- * println(y[2]); // prints third element of list
- * println(y.length); // prints size of the list
- *
- * @param map java.util.List instance that will be wrapped
- * @constructor
- */
-function jlist(list) {
- function isValid(index) {
- return typeof(index) == 'number' &&
- index > -1 && index < list.size();
- }
- return new JSAdapter({
- __get__ : function(name) {
- if (isValid(name)) {
- return list.get(name);
- } else if (name == 'length') {
- return list.size();
- } else {
- return undefined;
- }
- },
- __has__ : function (name) {
- return isValid(name) || name == 'length';
- },
- __delete__ : function(name) {
- if (isValid(name)) {
- list.remove(name);
- }
- },
- __put__ : function(name, value) {
- if (isValid(name)) {
- list.set(name, value);
- }
- },
- __getIds__: function() {
- var res = new Array(list.size());
- for (var i = 0; i < res.length; i++) {
- res[i] = i;
- }
- return res;
- },
- toString: function() {
- return list.toString();
- }
- });
-}
-
-/**
- * This is java.lang.System properties wrapped by JSAdapter.
- * For eg. to access java.class.path property, you can use
- * the syntax sysProps["java.class.path"]
- */
-var sysProps = new JSAdapter({
- __get__ : function (name) {
- return java.lang.System.getProperty(name);
- },
- __has__ : function (name) {
- return java.lang.System.getProperty(name) != null;
- },
- __getIds__ : function() {
- return java.lang.System.getProperties().keySet().toArray();
- },
- __delete__ : function(name) {
- java.lang.System.clearProperty(name);
- return true;
- },
- __put__ : function (name, value) {
- java.lang.System.setProperty(name, value);
- },
- toString: function() {
- return "<system properties>";
- }
-});
-
-// stdout, stderr & stdin
-var out = java.lang.System.out;
-var err = java.lang.System.err;
-// can't use 'in' because it is a JavaScript keyword :-(
-var inp = java.lang.System["in"];
-
-var BufferedInputStream = java.io.BufferedInputStream;
-var BufferedOutputStream = java.io.BufferedOutputStream;
-var BufferedReader = java.io.BufferedReader;
-var DataInputStream = java.io.DataInputStream;
-var File = java.io.File;
-var FileInputStream = java.io.FileInputStream;
-var FileOutputStream = java.io.FileOutputStream;
-var InputStream = java.io.InputStream;
-var InputStreamReader = java.io.InputStreamReader;
-var OutputStream = java.io.OutputStream;
-var Reader = java.io.Reader;
-var URL = java.net.URL;
-
-/**
- * Generic any object to input stream mapper
- * @param str input file name, URL or InputStream
- * @return InputStream object
- * @private
- */
-function inStream(str) {
- if (typeof(str) == "string") {
- // '-' means standard input
- if (str == '-') {
- return java.lang.System["in"];
- }
- // try file first
- var file = null;
- try {
- file = pathToFile(str);
- } catch (e) {
- }
- if (file && file.exists()) {
- return new FileInputStream(file);
- } else {
- try {
- // treat the string as URL
- return new URL(str).openStream();
- } catch (e) {
- throw 'file or URL ' + str + ' not found';
- }
- }
- } else {
- if (str instanceof InputStream) {
- return str;
- } else if (str instanceof URL) {
- return str.openStream();
- } else if (str instanceof File) {
- return new FileInputStream(str);
- }
- }
- // everything failed, just give input stream
- return java.lang.System["in"];
-}
-
-/**
- * Generic any object to output stream mapper
- *
- * @param out output file name or stream
- * @return OutputStream object
- * @private
- */
-function outStream(out) {
- if (typeof(out) == "string") {
- if (out == '>') {
- return java.lang.System.out;
- } else {
- // treat it as file
- return new FileOutputStream(pathToFile(out));
- }
- } else {
- if (out instanceof OutputStream) {
- return out;
- } else if (out instanceof File) {
- return new FileOutputStream(out);
- }
- }
-
- // everything failed, just return System.out
- return java.lang.System.out;
-}
-
-/**
- * stream close takes care not to close stdin, out & err.
- * @private
- */
-function streamClose(stream) {
- if (stream) {
- if (stream != java.lang.System["in"] &&
- stream != java.lang.System.out &&
- stream != java.lang.System.err) {
- try {
- stream.close();
- } catch (e) {
- println(e);
- }
- }
- }
-}
-
-/**
- * Loads and evaluates JavaScript code from a stream or file or URL<br>
- *
- * Examples:
- * <pre>
- * <code>
- * load('test.js'); // load script file 'test.js'
- * load('http://java.sun.com/foo.js'); // load from a URL
- * </code>
- * </pre>
- *
- * @param str input from which script is loaded and evaluated
- */
-if (typeof(load) == 'undefined') {
- this.load = function(str) {
- var stream = inStream(str);
- var bstream = new BufferedInputStream(stream);
- var reader = new BufferedReader(new InputStreamReader(bstream));
- var oldFilename = engine.get(engine.FILENAME);
- engine.put(engine.FILENAME, str);
- try {
- engine.eval(reader);
- } finally {
- engine.put(engine.FILENAME, oldFilename);
- streamClose(stream);
- }
- }
-}
-
-// file system utilities
-
-/**
- * Creates a Java byte[] of given length
- * @param len size of the array to create
- * @private
- */
-function javaByteArray(len) {
- return java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, len);
-}
-
-var curDir = new File('.');
-
-/**
- * Print present working directory
- */
-function pwd() {
- println(curDir.getAbsolutePath());
-}
-
-/**
- * Changes present working directory to given directory
- * @param target directory to change to. optional, defaults to user's HOME
- */
-function cd(target) {
- if (target == undefined) {
- target = sysProps["user.home"];
- }
- if (!(target instanceof File)) {
- target = pathToFile(target);
- }
- if (target.exists() && target.isDirectory()) {
- curDir = target;
- } else {
- println(target + " is not a directory");
- }
-}
-
-/**
- * Converts path to java.io.File taking care of shell present working dir
- *
- * @param pathname file path to be converted
- * @private
- */
-function pathToFile(pathname) {
- var tmp = pathname;
- if (!(tmp instanceof File)) {
- tmp = new File(tmp);
- }
- if (!tmp.isAbsolute()) {
- return new File(curDir, pathname);
- } else {
- return tmp;
- }
-}
-
-/**
- * Copies a file or URL or stream to another file or stream
- *
- * @param from input file or URL or stream
- * @param to output stream or file
- */
-function cp(from, to) {
- if (from == to) {
- println("file " + from + " cannot be copied onto itself!");
- return;
- }
- var inp = inStream(from);
- var out = outStream(to);
- var binp = new BufferedInputStream(inp);
- var bout = new BufferedOutputStream(out);
- var buff = javaByteArray(1024);
- var len;
- while ((len = binp.read(buff)) > 0 )
- bout.write(buff, 0, len);
-
- bout.flush();
- streamClose(inp);
- streamClose(out);
-}
-
-/**
- * Shows the content of a file or URL or any InputStream<br>
- * Examples:
- * <pre>
- * <code>
- * cat('test.txt'); // show test.txt file contents
- * cat('http://java.net'); // show the contents from the URL http://java.net
- * </code>
- * </pre>
- * @param obj input to show
- * @param pattern optional. show only the lines matching the pattern
- */
-function cat(obj, pattern) {
- if (obj instanceof File && obj.isDirectory()) {
- ls(obj);
- return;
- }
-
- var inp = null;
- if (!(obj instanceof Reader)) {
- inp = inStream(obj);
- obj = new BufferedReader(new InputStreamReader(inp));
- }
- var line;
- if (pattern) {
- var count = 1;
- while ((line=obj.readLine()) != null) {
- if (line.match(pattern)) {
- println(count + "\t: " + line);
- }
- count++;
- }
- } else {
- while ((line=obj.readLine()) != null) {
- println(line);
- }
- }
-}
-
-/**
- * Returns directory part of a filename
- *
- * @param pathname input path name
- * @return directory part of the given file name
- */
-function dirname(pathname) {
- var dirName = ".";
- // Normalize '/' to local file separator before work.
- var i = pathname.replace('/', File.separatorChar ).lastIndexOf(
- File.separator );
- if ( i != -1 )
- dirName = pathname.substring(0, i);
- return dirName;
-}
-
-/**
- * Creates a new dir of given name
- *
- * @param dir name of the new directory
- */
-function mkdir(dir) {
- dir = pathToFile(dir);
- println(dir.mkdir()? "created" : "can not create dir");
-}
-
-/**
- * Creates the directory named by given pathname, including
- * any necessary but nonexistent parent directories.
- *
- * @param dir input path name
- */
-function mkdirs(dir) {
- dir = pathToFile(dir);
- println(dir.mkdirs()? "created" : "can not create dirs");
-}
-
-/**
- * Removes a given file
- *
- * @param pathname name of the file
- */
-function rm(pathname) {
- var file = pathToFile(pathname);
- if (!file.exists()) {
- println("file not found: " + pathname);
- return false;
- }
- // note that delete is a keyword in JavaScript!
- println(file["delete"]()? "deleted" : "can not delete");
-}
-
-/**
- * Removes a given directory
- *
- * @param pathname name of the directory
- */
-function rmdir(pathname) {
- rm(pathname);
-}
-
-/**
- * Synonym for 'rm'
- */
-function del(pathname) {
- rm(pathname);
-}
-
-/**
- * Moves a file to another
- *
- * @param from original name of the file
- * @param to new name for the file
- */
-function mv(from, to) {
- println(pathToFile(from).renameTo(pathToFile(to))?
- "moved" : "can not move");
-}
-
-/**
- * Synonym for 'mv'.
- */
-function ren(from, to) {
- mv(from, to);
-}
-
-var months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
-
-/**
- * Helper function called by ls
- * @private
- */
-function printFile(f) {
- var sb = new java.lang.StringBuffer();
- sb.append(f.isDirectory()? "d" : "-");
- sb.append(f.canRead() ? "r": "-" );
- sb.append(f.canWrite() ? "w": "-" );
- sb.append(" ");
-
- var d = new java.util.Date(f.lastModified());
- var c = new java.util.GregorianCalendar();
- c.setTime(d);
- var day = c.get(java.util.Calendar.DAY_OF_MONTH);
- sb.append(months[c.get(java.util.Calendar.MONTH)]
- + " " + day );
- if (day < 10) {
- sb.append(" ");
- }
-
- // to get fixed length 'length' field
- var fieldlen = 8;
- var len = new java.lang.StringBuffer();
- for(var j=0; j<fieldlen; j++)
- len.append(" ");
- len.insert(0, java.lang.Long.toString(f.length()));
- len.setLength(fieldlen);
- // move the spaces to the front
- var si = len.toString().indexOf(" ");
- if ( si != -1 ) {
- var pad = len.toString().substring(si);
- len.setLength(si);
- len.insert(0, pad);
- }
- sb.append(len.toString());
- sb.append(" ");
- sb.append(f.getName());
- if (f.isDirectory()) {
- sb.append('/');
- }
- println(sb.toString());
-}
-
-/**
- * Lists the files in a directory
- *
- * @param dir directory from which to list the files. optional, default to pwd
- * @param filter pattern to filter the files listed. optional, default is '.'.
- */
-function ls(dir, filter) {
- if (dir) {
- dir = pathToFile(dir);
- } else {
- dir = curDir;
- }
- if (dir.isDirectory()) {
- var files = dir.listFiles();
- for (var i in files) {
- var f = files[i];
- if (filter) {
- if(!f.getName().match(filter)) {
- continue;
- }
- }
- printFile(f);
- }
- } else {
- printFile(dir);
- }
-}
-
-/**
- * Synonym for 'ls'.
- */
-function dir(d, filter) {
- ls(d, filter);
-}
-
-/**
- * Unix-like grep, but accepts JavaScript regex patterns
- *
- * @param pattern to search in files
- * @param files one or more files
- */
-function grep(pattern, files /*, one or more files */) {
- if (arguments.length < 2) return;
- for (var i = 1; i < arguments.length; i++) {
- println(arguments[i] + ":");
- cat(arguments[i], pattern);
- }
-}
-
-/**
- * Find in files. Calls arbitrary callback function
- * for each matching file.<br>
- *
- * Examples:
- * <pre>
- * <code>
- * find('.')
- * find('.', '.*\.class', rm); // remove all .class files
- * find('.', '.*\.java'); // print fullpath of each .java file
- * find('.', '.*\.java', cat); // print all .java files
- * </code>
- * </pre>
- *
- * @param dir directory to search files
- * @param pattern to search in the files
- * @param callback function to call for matching files
- */
-function find(dir, pattern, callback) {
- dir = pathToFile(dir);
- if (!callback) callback = print;
- var files = dir.listFiles();
- for (var f in files) {
- var file = files[f];
- if (file.isDirectory()) {
- find(file, pattern, callback);
- } else {
- if (pattern) {
- if (file.getName().match(pattern)) {
- callback(file);
- }
- } else {
- callback(file);
- }
- }
- }
-}
-
-// process utilities
-
-/**
- * Exec's a child process, waits for completion & returns exit code
- *
- * @param cmd command to execute in child process
- */
-function exec(cmd) {
- var process = java.lang.Runtime.getRuntime().exec(cmd);
- var inp = new DataInputStream(process.getInputStream());
- var line = null;
- while ((line = inp.readLine()) != null) {
- println(line);
- }
- process.waitFor();
- $exit = process.exitValue();
-}
-
-if (typeof(exit) == 'undefined') {
- /**
- * Exit the shell program.
- *
- * @param exitCode integer code returned to OS shell.
- * optional, defaults to 0
- */
- this.exit = function (code) {
- if (code) {
- java.lang.System.exit(code + 0);
- } else {
- java.lang.System.exit(0);
- }
- }
-}
-
-if (typeof(quit) == 'undefined') {
- /**
- * synonym for exit
- */
- this.quit = function (code) {
- exit(code);
- }
-}
-
-// XML utilities
-
-/**
- * Converts input to DOM Document object
- *
- * @param inp file or reader. optional, without this param,
- * this function returns a new DOM Document.
- * @return returns a DOM Document object
- */
-function XMLDocument(inp) {
- var factory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
- var builder = factory.newDocumentBuilder();
- if (inp) {
- if (typeof(inp) == "string") {
- return builder.parse(pathToFile(inp));
- } else {
- return builder.parse(inp);
- }
- } else {
- return builder.newDocument();
- }
-}
-
-/**
- * Converts arbitrary stream, file, URL to XMLSource
- *
- * @param inp input stream or file or URL
- * @return XMLSource object
- */
-function XMLSource(inp) {
- if (inp instanceof javax.xml.transform.Source) {
- return inp;
- } else if (inp instanceof Packages.org.w3c.dom.Document) {
- return new javax.xml.transform.dom.DOMSource(inp);
- } else {
- inp = new BufferedInputStream(inStream(inp));
- return new javax.xml.transform.stream.StreamSource(inp);
- }
-}
-
-/**
- * Converts arbitrary stream, file to XMLResult
- *
- * @param inp output stream or file
- * @return XMLResult object
- */
-function XMLResult(out) {
- if (out instanceof javax.xml.transform.Result) {
- return out;
- } else if (out instanceof Packages.org.w3c.dom.Document) {
- return new javax.xml.transform.dom.DOMResult(out);
- } else {
- out = new BufferedOutputStream(outStream(out));
- return new javax.xml.transform.stream.StreamResult(out);
- }
-}
-
-/**
- * Perform XSLT transform
- *
- * @param inp Input XML to transform (URL, File or InputStream)
- * @param style XSL Stylesheet to be used (URL, File or InputStream). optional.
- * @param out Output XML (File or OutputStream
- */
-function XSLTransform(inp, style, out) {
- switch (arguments.length) {
- case 2:
- inp = arguments[0];
- out = arguments[1];
- break;
- case 3:
- inp = arguments[0];
- style = arguments[1];
- out = arguments[2];
- break;
- default:
- println("XSL transform requires 2 or 3 arguments");
- return;
- }
-
- var factory = javax.xml.transform.TransformerFactory.newInstance();
- var transformer;
- if (style) {
- transformer = factory.newTransformer(XMLSource(style));
- } else {
- transformer = factory.newTransformer();
- }
- var source = XMLSource(inp);
- var result = XMLResult(out);
- transformer.transform(source, result);
- if (source.getInputStream) {
- streamClose(source.getInputStream());
- }
- if (result.getOutputStream) {
- streamClose(result.getOutputStream());
- }
-}
-
-// miscellaneous utilities
-
-/**
- * Prints which command is selected from PATH
- *
- * @param cmd name of the command searched from PATH
- */
-function which(cmd) {
- var st = new java.util.StringTokenizer(env.PATH, File.pathSeparator);
- while (st.hasMoreTokens()) {
- var file = new File(st.nextToken(), cmd);
- if (file.exists()) {
- println(file.getAbsolutePath());
- return;
- }
- }
-}
-
-/**
- * Prints IP addresses of given domain name
- *
- * @param name domain name
- */
-function ip(name) {
- var addrs = InetAddress.getAllByName(name);
- for (var i in addrs) {
- println(addrs[i]);
- }
-}
-
-/**
- * Prints current date in current locale
- */
-function date() {
- println(new Date().toLocaleString());
-}
-
-/**
- * Echoes the given string arguments
- */
-function echo(x) {
- for (var i = 0; i < arguments.length; i++) {
- println(arguments[i]);
- }
-}
-
-if (typeof(printf) == 'undefined') {
- /**
- * This is C-like printf
- *
- * @param format string to format the rest of the print items
- * @param args variadic argument list
- */
- this.printf = function (format, args/*, more args*/) {
- var array = java.lang.reflect.Array.newInstance(java.lang.Object,
- arguments.length - 1);
- for (var i = 0; i < array.length; i++) {
- array[i] = arguments[i+1];
- }
- java.lang.System.out.printf(format, array);
- }
-}
-
-/**
- * Reads one or more lines from stdin after printing prompt
- *
- * @param prompt optional, default is '>'
- * @param multiline to tell whether to read single line or multiple lines
- */
-function read(prompt, multiline) {
- if (!prompt) {
- prompt = '>';
- }
- var inp = java.lang.System["in"];
- var reader = new BufferedReader(new InputStreamReader(inp));
- if (multiline) {
- var line = '';
- while (true) {
- java.lang.System.err.print(prompt);
- java.lang.System.err.flush();
- var tmp = reader.readLine();
- if (tmp == '' || tmp == null) break;
- line += tmp + '\n';
- }
- return line;
- } else {
- java.lang.System.err.print(prompt);
- java.lang.System.err.flush();
- return reader.readLine();
- }
-}
-
-if (typeof(println) == 'undefined') {
- // just synonym to print
- this.println = print;
-}
-
--- a/jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell/messages.properties Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-#
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-string.script.error=\
- script error: {0}
-
-file.script.error=\
- script error in file {0} : {1}
-
-file.not.found=\
- script file {0} is not found
-
-engine.not.found=\
- script engine for language {0} can not be found
-
-engine.info=\
- Language {0} {1} implementation "{2}" {3}
-
-encoding.unsupported=\
- encoding {0} is not supported
-
-main.usage=\
-Usage: {0} [options] [arguments...]\n\
-\n\
-where [options] include:\n\
-\ \-classpath <path> Specify where to find user class files \n\
-\ \-cp <path> Specify where to find user class files \n\
-\ \-D<name>=<value> Set a system property \n\
-\ \-J<flag> Pass <flag> directly to the runtime system \n\
-\ \-l <language> Use specified scripting language \n\
-\ \-e <script> Evaluate given script \n\
-\ \-encoding <encoding> Specify character encoding used by script files \n\
-\ \-f <script file> Evaluate given script file \n\
-\ \-f - Interactive mode, read script from standard input \n\
-\ \ If this is used, this should be the last -f option \n\
-\ \-help Print this usage message and exit \n\
-\ \-? Print this usage message and exit \n\
-\ \-q List all scripting engines available and exit \n\
-\ \n\
-If [arguments..] are present and if no -e or -f option is used, then first\n\
-argument is script file and the rest of the arguments, if any, are passed\n\
-as script arguments. If [arguments..] and -e or -f option is used, then all\n\
-[arguments..] are passed as script arguments. If [arguments..], -e, -f are\n\
-missing, then interactive mode is used.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/JImageTask.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,596 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.tools.jimage;
+
+import java.io.BufferedOutputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import jdk.internal.jimage.BasicImageReader;
+import jdk.internal.jimage.BasicImageWriter;
+import jdk.internal.jimage.ImageHeader;
+import jdk.internal.jimage.ImageLocation;
+import jdk.internal.jimage.PackageModuleMap;
+
+class JImageTask {
+ static class BadArgs extends Exception {
+ static final long serialVersionUID = 8765093759964640723L; // ## re-generate
+ final String key;
+ final Object[] args;
+ boolean showUsage;
+
+ BadArgs(String key, Object... args) {
+ super(JImageTask.getMessage(key, args));
+ this.key = key;
+ this.args = args;
+ }
+
+ BadArgs showUsage(boolean b) {
+ showUsage = b;
+ return this;
+ }
+ }
+
+ static abstract class Option {
+ final boolean hasArg;
+ final String[] aliases;
+
+ Option(boolean hasArg, String... aliases) {
+ this.hasArg = hasArg;
+ this.aliases = aliases;
+ }
+
+ boolean isHidden() {
+ return false;
+ }
+
+ boolean matches(String opt) {
+ for (String a : aliases) {
+ if (a.equals(opt)) {
+ return true;
+ } else if (opt.startsWith("--") && hasArg && opt.startsWith(a + "=")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ boolean ignoreRest() {
+ return false;
+ }
+
+ abstract void process(JImageTask task, String opt, String arg) throws BadArgs;
+ }
+
+ static abstract class HiddenOption extends Option {
+ HiddenOption(boolean hasArg, String... aliases) {
+ super(hasArg, aliases);
+ }
+
+ @Override
+ boolean isHidden() {
+ return true;
+ }
+ }
+
+ static Option[] recognizedOptions = {
+ new Option(true, "--dir") {
+ @Override
+ void process(JImageTask task, String opt, String arg) throws BadArgs {
+ task.options.directory = arg;
+ }
+ },
+ new HiddenOption(false, "--fullversion") {
+ @Override
+ void process(JImageTask task, String opt, String arg) {
+ task.options.fullVersion = true;
+ }
+ },
+ new Option(false, "--help") {
+ @Override
+ void process(JImageTask task, String opt, String arg) {
+ task.options.help = true;
+ }
+ },
+ new Option(false, "--verbose") {
+ @Override
+ void process(JImageTask task, String opt, String arg) throws BadArgs {
+ task.options.verbose = true;
+ }
+ },
+ new Option(false, "--version") {
+ @Override
+ void process(JImageTask task, String opt, String arg) {
+ task.options.version = true;
+ }
+ },
+ };
+
+ static class Options {
+ Task task = Task.LIST;
+ String directory = ".";
+ boolean fullVersion;
+ boolean help;
+ boolean verbose;
+ boolean version;
+ List<File> jimages = new LinkedList<>();
+ }
+
+ private static final String PROGNAME = "jimage";
+ private final Options options = new Options();
+
+ enum Task {
+ RECREATE,
+ EXTRACT,
+ INFO,
+ LIST,
+ VERIFY
+ };
+
+ private String pad(String string, int width, boolean justifyRight) {
+ int length = string.length();
+
+ if (length == width) {
+ return string;
+ }
+
+ if (length > width) {
+ return string.substring(0, width);
+ }
+
+ int padding = width - length;
+
+ StringBuilder sb = new StringBuilder(width);
+ if (justifyRight) {
+ for (int i = 0; i < padding; i++) {
+ sb.append(' ');
+ }
+ }
+
+ sb.append(string);
+
+ if (!justifyRight) {
+ for (int i = 0; i < padding; i++) {
+ sb.append(' ');
+ }
+ }
+
+ return sb.toString();
+ }
+
+ private String pad(String string, int width) {
+ return pad(string, width, false);
+ }
+
+ private String pad(long value, int width) {
+ return pad(Long.toString(value), width, true);
+ }
+
+ private static final int EXIT_OK = 0; // No errors.
+ private static final int EXIT_ERROR = 1; // Completed but reported errors.
+ private static final int EXIT_CMDERR = 2; // Bad command-line arguments and/or switches.
+ private static final int EXIT_SYSERR = 3; // System error or resource exhaustion.
+ private static final int EXIT_ABNORMAL = 4; // Terminated abnormally.
+
+ int run(String[] args) {
+ if (log == null) {
+ log = new PrintWriter(System.out);
+ }
+
+ try {
+ handleOptions(args);
+ if (options.help) {
+ showHelp();
+ }
+ if (options.version || options.fullVersion) {
+ showVersion(options.fullVersion);
+ }
+ boolean ok = run();
+ return ok ? EXIT_OK : EXIT_ERROR;
+ } catch (BadArgs e) {
+ reportError(e.key, e.args);
+ if (e.showUsage) {
+ log.println(getMessage("main.usage.summary", PROGNAME));
+ }
+ return EXIT_CMDERR;
+ } catch (Exception x) {
+ x.printStackTrace();
+ return EXIT_ABNORMAL;
+ } finally {
+ log.flush();
+ }
+ }
+
+ static final String MODULES_ENTRY = PackageModuleMap.MODULES_ENTRY;
+ static final String PACKAGES_ENTRY = "/" + PackageModuleMap.PACKAGES_ENTRY;
+
+ private void recreate() throws IOException, BadArgs {
+ File directory = new File(options.directory);
+ Path dirPath = directory.toPath();
+ int chop = dirPath.toString().length() + 1;
+
+ if (!directory.isDirectory()) {
+ throw new BadArgs("err.not.a.dir", directory.getAbsolutePath());
+ }
+
+ if (options.jimages.isEmpty()) {
+ throw new BadArgs("err.jimage.not.specified");
+ } else if (options.jimages.size() != 1) {
+ throw new BadArgs("err.only.one.jimage");
+ }
+
+ File jimage = options.jimages.get(0);
+ final List<File> files = new ArrayList<>();
+ final BasicImageWriter writer = new BasicImageWriter();
+ final Long longZero = 0L;
+
+ // Note: code sensitive to Netbeans parser crashing.
+ long total = Files.walk(dirPath).reduce(longZero, (Long offset, Path path) -> {
+ long size = 0;
+ String pathString = path.toString();
+
+ if (pathString.length() < chop || pathString.startsWith(".")) {
+ return 0L;
+ }
+
+ String name = pathString.substring(chop).replace('\\','/');
+
+ File file = path.toFile();
+
+ if (file.isFile()) {
+ if (options.verbose) {
+ log.println(name);
+ }
+
+ if (name.endsWith(MODULES_ENTRY) || name.endsWith(PACKAGES_ENTRY)) {
+ try {
+ try (Stream<String> lines = Files.lines(path)) {
+ size = lines.peek(s -> writer.addString(s)).count() * 4;
+ }
+ } catch (IOException ex) {
+ // Caught again when writing file.
+ size = 0;
+ }
+ } else {
+ size = file.length();
+ }
+
+ writer.addLocation(name, offset, 0L, size);
+ files.add(file);
+ }
+
+ return offset + size;
+ },
+ (Long offsetL, Long offsetR) -> { return longZero; } );
+
+ if (jimage.createNewFile()) {
+ try (OutputStream os = Files.newOutputStream(jimage.toPath());
+ BufferedOutputStream bos = new BufferedOutputStream(os);
+ DataOutputStream out = new DataOutputStream(bos)) {
+
+ byte[] index = writer.getBytes();
+ out.write(index, 0, index.length);
+
+ for (File file : files) {
+ try {
+ Path path = file.toPath();
+ String name = path.toString();
+
+ if (name.endsWith(MODULES_ENTRY) || name.endsWith(PACKAGES_ENTRY)) {
+ for (String line: Files.readAllLines(path)) {
+ int off = writer.addString(line);
+ out.writeInt(off);
+ }
+ } else {
+ Files.copy(path, out);
+ }
+ } catch (IOException ex) {
+ throw new BadArgs("err.cannot.read.file", file.getName());
+ }
+ }
+ }
+ } else {
+ throw new BadArgs("err.jimage.already.exists", jimage.getName());
+ }
+
+ }
+
+ private void title(File file, BasicImageReader reader) {
+ log.println("jimage: " + file.getName());
+ }
+
+ private void listTitle(File file, BasicImageReader reader) {
+ title(file, reader);
+
+ if (options.verbose) {
+ log.print(pad("Offset", OFFSET_WIDTH + 1));
+ log.print(pad("Size", SIZE_WIDTH + 1));
+ log.print(pad("Compressed", COMPRESSEDSIZE_WIDTH + 1));
+ log.println(" Entry");
+ }
+ }
+
+ private interface JImageAction {
+ public void apply(File file, BasicImageReader reader) throws IOException, BadArgs;
+ }
+
+ private interface ResourceAction {
+ public void apply(BasicImageReader reader, String name, ImageLocation location) throws IOException, BadArgs;
+ }
+
+ private void extract(BasicImageReader reader, String name, ImageLocation location) throws IOException, BadArgs {
+ File directory = new File(options.directory);
+ byte[] bytes = reader.getResource(location);
+ File resource = new File(directory, name);
+ File parent = resource.getParentFile();
+
+ if (parent.exists()) {
+ if (!parent.isDirectory()) {
+ throw new BadArgs("err.cannot.create.dir", parent.getAbsolutePath());
+ }
+ } else if (!parent.mkdirs()) {
+ throw new BadArgs("err.cannot.create.dir", parent.getAbsolutePath());
+ }
+
+ if (name.endsWith(MODULES_ENTRY) || name.endsWith(PACKAGES_ENTRY)) {
+ List<String> names = reader.getNames(bytes);
+ Files.write(resource.toPath(), names);
+ } else {
+ Files.write(resource.toPath(), bytes);
+ }
+ }
+
+ private static final int NAME_WIDTH = 40;
+ private static final int NUMBER_WIDTH = 12;
+ private static final int OFFSET_WIDTH = NUMBER_WIDTH;
+ private static final int SIZE_WIDTH = NUMBER_WIDTH;
+ private static final int COMPRESSEDSIZE_WIDTH = NUMBER_WIDTH;
+
+ private void print(String entry, ImageLocation location) {
+ log.print(pad(location.getContentOffset(), OFFSET_WIDTH) + " ");
+ log.print(pad(location.getUncompressedSize(), SIZE_WIDTH) + " ");
+ log.print(pad(location.getCompressedSize(), COMPRESSEDSIZE_WIDTH) + " ");
+ log.println(entry);
+ }
+
+ private void print(BasicImageReader reader, String entry) {
+ if (options.verbose) {
+ print(entry, reader.findLocation(entry));
+ } else {
+ log.println(entry);
+ }
+ }
+
+ private void info(File file, BasicImageReader reader) {
+ ImageHeader header = reader.getHeader();
+
+ log.println(" Major Version: " + header.getMajorVersion());
+ log.println(" Minor Version: " + header.getMinorVersion());
+ log.println(" Location Count: " + header.getLocationCount());
+ log.println(" Offsets Size: " + header.getOffsetsSize());
+ log.println(" Redirects Size: " + header.getRedirectSize());
+ log.println(" Locations Size: " + header.getLocationsSize());
+ log.println(" Strings Size: " + header.getStringsSize());
+ log.println(" Index Size: " + header.getIndexSize());
+ }
+
+ private void list(BasicImageReader reader, String name, ImageLocation location) {
+ print(reader, name);
+ }
+
+ void verify(BasicImageReader reader, String name, ImageLocation location) {
+ if (name.endsWith(".class")) {
+ byte[] bytes;
+ try {
+ bytes = reader.getResource(location);
+ } catch (IOException ex) {
+ log.println(ex);
+ bytes = null;
+ }
+
+ if (bytes == null || bytes.length <= 4 ||
+ (bytes[0] & 0xFF) != 0xCA ||
+ (bytes[1] & 0xFF) != 0xFE ||
+ (bytes[2] & 0xFF) != 0xBA ||
+ (bytes[3] & 0xFF) != 0xBE) {
+ log.print(" NOT A CLASS: ");
+ print(reader, name);
+ }
+ }
+ }
+
+ private void iterate(JImageAction jimageAction, ResourceAction resourceAction) throws IOException, BadArgs {
+ for (File file : options.jimages) {
+ if (!file.exists() || !file.isFile()) {
+ throw new BadArgs("err.not.a.jimage", file.getName());
+ }
+
+ String path = file.getCanonicalPath();
+ BasicImageReader reader = BasicImageReader.open(path);
+
+ if (jimageAction != null) {
+ jimageAction.apply(file, reader);
+ }
+
+ if (resourceAction != null) {
+ String[] entryNames = reader.getEntryNames(true);
+
+ for (String name : entryNames) {
+ ImageLocation location = reader.findLocation(name);
+ resourceAction.apply(reader, name, location);
+ }
+ }
+ }
+ }
+
+ private boolean run() throws IOException, BadArgs {
+ switch (options.task) {
+ case RECREATE:
+ recreate();
+ break;
+ case EXTRACT:
+ iterate(null, this::extract);
+ break;
+ case INFO:
+ iterate(this::info, null);
+ break;
+ case LIST:
+ iterate(this::listTitle, this::list);
+ break;
+ case VERIFY:
+ iterate(this::title, this::verify);
+ break;
+ default:
+ throw new BadArgs("err.invalid.task", options.task.name()).showUsage(true);
+ }
+ return true;
+ }
+
+ private PrintWriter log;
+ void setLog(PrintWriter out) {
+ log = out;
+ }
+ public void handleOptions(String[] args) throws BadArgs {
+ // process options
+ int first = 0;
+
+ if (args.length == 0) {
+ return;
+ }
+
+ String arg = args[first];
+
+ if (!arg.startsWith("-")) {
+ try {
+ options.task = Enum.valueOf(Task.class, arg.toUpperCase());
+ first++;
+ } catch (IllegalArgumentException e) {
+ throw new BadArgs("err.invalid.task", arg).showUsage(true);
+ }
+ }
+
+ for (int i = first; i < args.length; i++) {
+ arg = args[i];
+
+ if (arg.charAt(0) == '-') {
+ Option option = getOption(arg);
+ String param = null;
+
+ if (option.hasArg) {
+ if (arg.startsWith("--") && arg.indexOf('=') > 0) {
+ param = arg.substring(arg.indexOf('=') + 1, arg.length());
+ } else if (i + 1 < args.length) {
+ param = args[++i];
+ }
+
+ if (param == null || param.isEmpty() || param.charAt(0) == '-') {
+ throw new BadArgs("err.missing.arg", arg).showUsage(true);
+ }
+ }
+
+ option.process(this, arg, param);
+
+ if (option.ignoreRest()) {
+ i = args.length;
+ }
+ } else {
+ File file = new File(arg);
+ options.jimages.add(file);
+ }
+ }
+ }
+
+ private Option getOption(String name) throws BadArgs {
+ for (Option o : recognizedOptions) {
+ if (o.matches(name)) {
+ return o;
+ }
+ }
+ throw new BadArgs("err.unknown.option", name).showUsage(true);
+ }
+
+ private void reportError(String key, Object... args) {
+ log.println(getMessage("error.prefix") + " " + getMessage(key, args));
+ }
+
+ private void warning(String key, Object... args) {
+ log.println(getMessage("warn.prefix") + " " + getMessage(key, args));
+ }
+
+ private void showHelp() {
+ log.println(getMessage("main.usage", PROGNAME));
+ for (Option o : recognizedOptions) {
+ String name = o.aliases[0].substring(1); // there must always be at least one name
+ name = name.charAt(0) == '-' ? name.substring(1) : name;
+ if (o.isHidden() || name.equals("h")) {
+ continue;
+ }
+ log.println(getMessage("main.opt." + name));
+ }
+ }
+
+ private void showVersion(boolean full) {
+ log.println(version(full ? "full" : "release"));
+ }
+
+ private String version(String key) {
+ return System.getProperty("java.version");
+ }
+
+ static String getMessage(String key, Object... args) {
+ try {
+ return MessageFormat.format(ResourceBundleHelper.bundle.getString(key), args);
+ } catch (MissingResourceException e) {
+ throw new InternalError("Missing message: " + key);
+ }
+ }
+
+ private static class ResourceBundleHelper {
+ static final ResourceBundle bundle;
+
+ static {
+ Locale locale = Locale.getDefault();
+ try {
+ bundle = ResourceBundle.getBundle("jdk.tools.jimage.resources.jimage", locale);
+ } catch (MissingResourceException e) {
+ throw new InternalError("Cannot find jimage resource bundle for locale " + locale);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/Main.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.tools.jimage;
+
+import java.io.PrintWriter;
+
+
+public class Main {
+ public static void main(String[] args) throws Exception {
+ JImageTask t = new JImageTask();
+ int rc = t.run(args);
+ System.exit(rc);
+ }
+
+ /**
+ * Entry point that does <i>not</i> call System.exit.
+ *
+ * @param args command line arguments
+ * @param out output stream
+ * @return an exit code. 0 means success, non-zero means an error occurred.
+ */
+ public static int run(String[] args, PrintWriter out) {
+ JImageTask t = new JImageTask();
+ t.setLog(out);
+ return t.run(args);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/resources/jimage.properties Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,45 @@
+main.usage.summary=\
+Usage: {0} <extract|recreate|info|list|verify> <options> jimage...\n\
+use --help for a list of possible options
+
+main.usage=\
+Usage: {0} <extract|recreate|info|list|verify> <options> jimage...\n\
+\n\
+\ extract - Extract all jimage entries into separate files into the directory\n\
+\ specified by --dir=<directory> (default='.')\n\
+\ recreate - Reconstructs a jimage from an extracted directory (--dir)\n\
+\ info - Prints information specified in the jimage header.\n\
+\ list - Prints the names of all the entries in the jimage. When used with\n\
+\ --verbose will also print entry attributes ex. size and offset.\n\
+\ verify - Reports errors on any .class entries that don't verify as classes.\n\
+\n\
+Possible options include:
+
+error.prefix=Error:
+warn.prefix=Warning:
+
+main.opt.dir=\
+\ --dir Target directory for create/expand
+
+main.opt.verbose=\
+\ --verbose Verbose listing
+
+main.opt.help=\
+\ --help Print this usage message
+
+main.opt.version=\
+\ --version Version information
+
+err.invalid.task=task must be list|expand|info|verify: {0}
+err.not.a.dir=not a directory: {0}
+err.jimage.not.specified=no jimage specified
+err.only.one.jimage=only one jimage should be specified
+err.jimage.already.exists=jimage already exists: {0}
+err.cannot.read.file=cannot read file: {0}
+err.cannot.create.dir=cannot create directory: {0}
+err.not.a.jimage=not a jimage file: {0}
+err.unknown.option=unknown option: {0}
+err.missing.arg=no value given for {0}
+err.internal.error=internal error: {0} {1} {2}
+err.invalid.arg.for.option=invalid argument for option: {0}
+err.option.unsupported={0} not supported: {1}
--- a/jdk/src/jdk.localedata/META-INF/cldrdata-services/sun.util.locale.provider.LocaleDataMetaInfo Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo
--- a/jdk/src/jdk.localedata/META-INF/localedata-services/sun.util.locale.provider.LocaleDataMetaInfo Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-sun.util.resources.provider.NonEnLocaleDataMetaInfo
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.localedata/share/classes/META-INF/services/sun.util.locale.provider.LocaleDataMetaInfo Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,2 @@
+sun.util.resources.provider.NonEnLocaleDataMetaInfo
+sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo
--- a/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/BatchEnvironment.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/BatchEnvironment.java Wed Jul 05 20:08:34 2017 +0200
@@ -70,17 +70,16 @@
* Create a ClassPath object for rmic from a class path string.
*/
public static ClassPath createClassPath(String classPathString) {
- ClassPath[] paths = classPaths(null, classPathString, null, null);
+ ClassPath[] paths = classPaths(null, classPathString, null);
return paths[1];
}
/**
* Create a ClassPath object for rmic from the relevant command line
- * options for class path, boot class path, and extension directories.
+ * options for class path and boot class path.
*/
public static ClassPath createClassPath(String classPathString,
- String sysClassPathString,
- String extDirsString)
+ String sysClassPathString)
{
/**
* Previously, this method delegated to the
@@ -108,13 +107,6 @@
*/
path.expandJarClassPaths(true);
- if (extDirsString == null) {
- extDirsString = System.getProperty("java.ext.dirs");
- }
- if (extDirsString != null) {
- path.addDirectories(extDirsString);
- }
-
/*
* In the application class path, an empty element means
* the current working directory.
@@ -389,7 +381,8 @@
/* File is an ordinay file */
String arcname = file.toLowerCase();
if (! (arcname.endsWith(".zip") ||
- arcname.endsWith(".jar"))) {
+ arcname.endsWith(".jar") ||
+ arcname.endsWith(".jimage"))) {
/* File name don't have right extension */
// if (warn)
// log.warning(Position.NOPOS,
--- a/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/Main.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/Main.java Wed Jul 05 20:08:34 2017 +0200
@@ -68,7 +68,6 @@
public class Main implements sun.rmi.rmic.Constants {
String sourcePathArg;
String sysClassPathArg;
- String extDirsArg;
String classPathString;
File destDir;
int flags;
@@ -187,7 +186,6 @@
public boolean parseArgs(String argv[]) {
sourcePathArg = null;
sysClassPathArg = null;
- extDirsArg = null;
classPathString = null;
destDir = null;
@@ -300,21 +298,6 @@
usage();
return false;
}
- } else if (argv[i].equals("-extdirs")) {
- if ((i + 1) < argv.length) {
- if (extDirsArg != null) {
- error("rmic.option.already.seen", "-extdirs");
- usage();
- return false;
- }
- argv[i] = null;
- extDirsArg = argv[++i];
- argv[i] = null;
- } else {
- error("rmic.option.requires.argument", "-extdirs");
- usage();
- return false;
- }
} else if (argv[i].equals("-d")) {
if ((i + 1) < argv.length) {
if (destDir != null) {
@@ -499,8 +482,7 @@
ClassPath classPath =
BatchEnvironment.createClassPath(classPathString,
- sysClassPathArg,
- extDirsArg);
+ sysClassPathArg);
BatchEnvironment result = null;
try {
Class<?>[] ctorArgTypes = {OutputStream.class,ClassPath.class,Main.class};
@@ -659,7 +641,6 @@
sourcePathArg = null;
sysClassPathArg = null;
- extDirsArg = null;
classPathString = null;
destDir = null;
classes = null;
--- a/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/RMIGenerator.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/RMIGenerator.java Wed Jul 05 20:08:34 2017 +0200
@@ -140,7 +140,7 @@
if (env.verbose()) {
env.output(Main.getText("rmic.wrote", stubFile.getPath()));
}
- env.parseFile(new ClassFile(stubFile));
+ env.parseFile(ClassFile.newClassFile(stubFile));
} catch (IOException e) {
env.error(0, "cant.write", stubFile.toString());
return;
@@ -161,7 +161,7 @@
env.output(Main.getText("rmic.wrote",
skeletonFile.getPath()));
}
- env.parseFile(new ClassFile(skeletonFile));
+ env.parseFile(ClassFile.newClassFile(skeletonFile));
} catch (IOException e) {
env.error(0, "cant.write", stubFile.toString());
return;
--- a/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/resources/rmic.properties Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/resources/rmic.properties Wed Jul 05 20:08:34 2017 +0200
@@ -98,7 +98,6 @@
\n -verbose Output messages about what the compiler is doing\
\n -classpath <path> Specify where to find input class files\
\n -bootclasspath <path> Override location of bootstrap class files\
-\n -extdirs <path> Override location of installed extensions\
\n -d <directory> Specify where to place generated class files\
\n -J<runtime flag> Pass argument to the java interpreter\
\n
--- a/jdk/src/jdk.rmic/share/classes/sun/tools/java/ClassFile.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/java/ClassFile.java Wed Jul 05 20:08:34 2017 +0200
@@ -29,134 +29,93 @@
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.zip.*;
/**
- * This class is used to represent a file loaded from the class path, and
- * can either be a regular file or a zip file entry.
+ * Abstract class to represent a class file.
*
* WARNING: The contents of this source file are not part of any
* supported API. Code that depends on them does so at its own risk:
* they are subject to change or removal without notice.
*/
public
-class ClassFile {
- /*
- * Non-null if this represents a regular file
- */
- private File file;
-
- /*
- * Non-null if this represents a zip file entry
+abstract class ClassFile {
+ /**
+ * Factory method to create a ClassFile backed by a File.
+ *
+ * @param file a File object
+ * @return a new ClassFile
*/
- private ZipFile zipFile;
- private ZipEntry zipEntry;
-
- /**
- * Constructor for instance representing a regular file
- */
- public ClassFile(File file) {
- this.file = file;
+ public static ClassFile newClassFile(File file) {
+ return new FileClassFile(file);
}
/**
- * Constructor for instance representing a zip file entry
+ * Factory method to create a ClassFile backed by a ZipEntry.
+ *
+ * @param zf a ZipFile
+ * @param ze a ZipEntry within the zip file
+ * @return a new ClassFile
*/
- public ClassFile(ZipFile zf, ZipEntry ze) {
- this.zipFile = zf;
- this.zipEntry = ze;
+ public static ClassFile newClassFile(ZipFile zf, ZipEntry ze) {
+ return new ZipClassFile(zf, ze);
+ }
+
+ /**
+ * Factory method to create a ClassFile backed by a nio Path.
+ *
+ * @param path nio Path object
+ * @return a new ClassFile
+ */
+ public static ClassFile newClassFile(Path path) {
+ return Files.exists(path)? new PathClassFile(path) : null;
}
/**
* Returns true if this is zip file entry
*/
- public boolean isZipped() {
- return zipFile != null;
- }
+ public abstract boolean isZipped();
/**
* Returns input stream to either regular file or zip file entry
*/
- public InputStream getInputStream() throws IOException {
- if (file != null) {
- return new FileInputStream(file);
- } else {
- try {
- return zipFile.getInputStream(zipEntry);
- } catch (ZipException e) {
- throw new IOException(e.getMessage());
- }
- }
- }
+ public abstract InputStream getInputStream() throws IOException;
/**
* Returns true if file exists.
*/
- public boolean exists() {
- return file != null ? file.exists() : true;
- }
+ public abstract boolean exists();
/**
* Returns true if this is a directory.
*/
- public boolean isDirectory() {
- return file != null ? file.isDirectory() :
- zipEntry.getName().endsWith("/");
- }
+ public abstract boolean isDirectory();
/**
* Return last modification time
*/
- public long lastModified() {
- return file != null ? file.lastModified() : zipEntry.getTime();
- }
+ public abstract long lastModified();
/**
* Get file path. The path for a zip file entry will also include
* the zip file name.
*/
- public String getPath() {
- if (file != null) {
- return file.getPath();
- } else {
- return zipFile.getName() + "(" + zipEntry.getName() + ")";
- }
- }
+ public abstract String getPath();
/**
* Get name of file entry excluding directory name
*/
- public String getName() {
- return file != null ? file.getName() : zipEntry.getName();
- }
+ public abstract String getName();
-//JCOV
/**
* Get absolute name of file entry
*/
- public String getAbsoluteName() {
- String absoluteName;
- if (file != null) {
- try {
- absoluteName = file.getCanonicalPath();
- } catch (IOException e) {
- absoluteName = file.getAbsolutePath();
- }
- } else {
- absoluteName = zipFile.getName() + "(" + zipEntry.getName() + ")";
- }
- return absoluteName;
- }
-// end JCOV
+ public abstract String getAbsoluteName();
/**
* Get length of file
*/
- public long length() {
- return file != null ? file.length() : zipEntry.getSize();
- }
-
- public String toString() {
- return (file != null) ? file.toString() : zipEntry.toString();
- }
+ public abstract long length();
}
--- a/jdk/src/jdk.rmic/share/classes/sun/tools/java/ClassPath.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/java/ClassPath.java Wed Jul 05 20:08:34 2017 +0200
@@ -25,11 +25,23 @@
package sun.tools.java;
-import java.util.Enumeration;
-import java.util.Hashtable;
import java.io.File;
import java.io.IOException;
+import java.io.UncheckedIOException;
import java.util.zip.*;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Set;
+import java.util.LinkedHashSet;
+import java.net.URI;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.spi.FileSystemProvider;
/**
* This class is used to represent a class path, which can contain both
@@ -41,6 +53,11 @@
*/
public
class ClassPath {
+ private static final String JIMAGE_EXT = ".jimage";
+ private FileSystem getJrtFileSystem() {
+ return FileSystems.getFileSystem(URI.create("jrt:/"));
+ }
+
static final char dirSeparator = File.pathSeparatorChar;
/**
@@ -105,27 +122,33 @@
// Build the class path
ClassPathEntry[] path = new ClassPathEntry[n+1];
int len = pathstr.length();
+ boolean jrtAdded = false;
for (i = n = 0; i < len; i = j + 1) {
if ((j = pathstr.indexOf(dirSeparator, i)) == -1) {
j = len;
}
if (i == j) {
- path[n] = new ClassPathEntry();
- path[n++].dir = new File(".");
+ path[n++] = new DirClassPathEntry(new File("."));
} else {
- File file = new File(pathstr.substring(i, j));
+ String filename = pathstr.substring(i, j);
+ File file = new File(filename);
if (file.isFile()) {
- try {
- ZipFile zip = new ZipFile(file);
- path[n] = new ClassPathEntry();
- path[n++].zip = zip;
- } catch (ZipException e) {
- } catch (IOException e) {
- // Ignore exceptions, at least for now...
+ if (filename.endsWith(JIMAGE_EXT)) {
+ if (jrtAdded) continue;
+ FileSystem fs = getJrtFileSystem();
+ path[n++] = new JrtClassPathEntry(fs);
+ jrtAdded = true;
+ } else {
+ try {
+ ZipFile zip = new ZipFile(file);
+ path[n++] = new ZipClassPathEntry(zip);
+ } catch (ZipException e) {
+ } catch (IOException e) {
+ // Ignore exceptions, at least for now...
+ }
}
} else {
- path[n] = new ClassPathEntry();
- path[n++].dir = file;
+ path[n++] = new DirClassPathEntry(file);
}
}
}
@@ -150,20 +173,26 @@
// Build the class path
ClassPathEntry[] path = new ClassPathEntry[patharray.length];
int n = 0;
+ boolean jrtAdded = false;
for (String name : patharray) {
File file = new File(name);
if (file.isFile()) {
- try {
- ZipFile zip = new ZipFile(file);
- path[n] = new ClassPathEntry();
- path[n++].zip = zip;
- } catch (ZipException e) {
- } catch (IOException e) {
- // Ignore exceptions, at least for now...
- }
+ if (name.endsWith(JIMAGE_EXT)) {
+ if (jrtAdded) continue;
+ FileSystem fs = getJrtFileSystem();
+ path[n++] = new JrtClassPathEntry(fs);
+ jrtAdded = true;
+ } else {
+ try {
+ ZipFile zip = new ZipFile(file);
+ path[n++] = new ZipClassPathEntry(zip);
+ } catch (ZipException e) {
+ } catch (IOException e) {
+ // Ignore exceptions, at least for now...
+ }
+ }
} else {
- path[n] = new ClassPathEntry();
- path[n++].dir = file;
+ path[n++] = new DirClassPathEntry(file);
}
}
// Trim class path to exact size
@@ -202,29 +231,9 @@
name = subdir; // Note: isDirectory==true & basename==""
}
for (int i = 0; i < path.length; i++) {
- if (path[i].zip != null) {
- String newname = name.replace(File.separatorChar, '/');
- ZipEntry entry = path[i].zip.getEntry(newname);
- if (entry != null) {
- return new ClassFile(path[i].zip, entry);
- }
- } else {
- File file = new File(path[i].dir.getPath(), name);
- String list[] = path[i].getFiles(subdir);
- if (isDirectory) {
- if (list.length > 0) {
- return new ClassFile(file);
- }
- } else {
- for (int j = 0; j < list.length; j++) {
- if (basename.equals(list[j])) {
- // Don't bother checking !file.isDir,
- // since we only look for names which
- // cannot already be packages (foo.java, etc).
- return new ClassFile(file);
- }
- }
- }
+ ClassFile cf = path[i].getFile(name, subdir, basename, isDirectory);
+ if (cf != null) {
+ return cf;
}
}
return null;
@@ -236,27 +245,7 @@
public Enumeration<ClassFile> getFiles(String pkg, String ext) {
Hashtable<String, ClassFile> files = new Hashtable<>();
for (int i = path.length; --i >= 0; ) {
- if (path[i].zip != null) {
- Enumeration<? extends ZipEntry> e = path[i].zip.entries();
- while (e.hasMoreElements()) {
- ZipEntry entry = (ZipEntry)e.nextElement();
- String name = entry.getName();
- name = name.replace('/', File.separatorChar);
- if (name.startsWith(pkg) && name.endsWith(ext)) {
- files.put(name, new ClassFile(path[i].zip, entry));
- }
- }
- } else {
- String[] list = path[i].getFiles(pkg);
- for (int j = 0; j < list.length; j++) {
- String name = list[j];
- if (name.endsWith(ext)) {
- name = pkg + File.separatorChar + name;
- File file = new File(path[i].dir.getPath(), name);
- files.put(name, new ClassFile(file));
- }
- }
- }
+ path[i].fillFiles(pkg, ext, files);
}
return files.elements();
}
@@ -266,9 +255,7 @@
*/
public void close() throws IOException {
for (int i = path.length; --i >= 0; ) {
- if (path[i].zip != null) {
- path[i].zip.close();
- }
+ path[i].close();
}
}
@@ -281,34 +268,216 @@
}
/**
- * A class path entry, which can either be a directory or an open zip file.
+ * A class path entry, which can either be a directory or an open zip file or an open jimage filesystem.
*/
-class ClassPathEntry {
- File dir;
- ZipFile zip;
+abstract class ClassPathEntry {
+ abstract ClassFile getFile(String name, String subdir, String basename, boolean isDirectory);
+ abstract void fillFiles(String pkg, String ext, Hashtable<String, ClassFile> files);
+ abstract void close() throws IOException;
+}
- Hashtable<String, String[]> subdirs = new Hashtable<>(29); // cache of sub-directory listings:
- String[] getFiles(String subdir) {
+// a ClassPathEntry that represents a directory
+final class DirClassPathEntry extends ClassPathEntry {
+ private final File dir;
+
+ DirClassPathEntry(File dir) {
+ this.dir = dir;
+ }
+
+ private final Hashtable<String, String[]> subdirs = new Hashtable<>(29); // cache of sub-directory listings:
+ private String[] getFiles(String subdir) {
String files[] = subdirs.get(subdir);
if (files == null) {
- // search the directory, exactly once
- File sd = new File(dir.getPath(), subdir);
- if (sd.isDirectory()) {
- files = sd.list();
- if (files == null) {
- // should not happen, but just in case, fail silently
- files = new String[0];
- }
- if (files.length == 0) {
- String nonEmpty[] = { "" };
- files = nonEmpty;
- }
- } else {
- files = new String[0];
- }
+ files = computeFiles(subdir);
subdirs.put(subdir, files);
}
return files;
}
+ private String[] computeFiles(String subdir) {
+ File sd = new File(dir.getPath(), subdir);
+ String[] files = null;
+ if (sd.isDirectory()) {
+ files = sd.list();
+ if (files == null) {
+ // should not happen, but just in case, fail silently
+ files = new String[0];
+ }
+ if (files.length == 0) {
+ String nonEmpty[] = { "" };
+ files = nonEmpty;
+ }
+ } else {
+ files = new String[0];
+ }
+ return files;
+ }
+
+ ClassFile getFile(String name, String subdir, String basename, boolean isDirectory) {
+ File file = new File(dir.getPath(), name);
+ String list[] = getFiles(subdir);
+ if (isDirectory) {
+ if (list.length > 0) {
+ return ClassFile.newClassFile(file);
+ }
+ } else {
+ for (int j = 0; j < list.length; j++) {
+ if (basename.equals(list[j])) {
+ // Don't bother checking !file.isDir,
+ // since we only look for names which
+ // cannot already be packages (foo.java, etc).
+ return ClassFile.newClassFile(file);
+ }
+ }
+ }
+ return null;
+ }
+
+ void fillFiles(String pkg, String ext, Hashtable<String, ClassFile> files) {
+ String[] list = getFiles(pkg);
+ for (int j = 0; j < list.length; j++) {
+ String name = list[j];
+ if (name.endsWith(ext)) {
+ name = pkg + File.separatorChar + name;
+ File file = new File(dir.getPath(), name);
+ files.put(name, ClassFile.newClassFile(file));
+ }
+ }
+ }
+
+ void close() throws IOException {
+ }
}
+
+// a ClassPathEntry that represents a .zip or a .jar file
+final class ZipClassPathEntry extends ClassPathEntry {
+ private final ZipFile zip;
+
+ ZipClassPathEntry(ZipFile zip) {
+ this.zip = zip;
+ }
+
+ void close() throws IOException {
+ zip.close();
+ }
+
+ ClassFile getFile(String name, String subdir, String basename, boolean isDirectory) {
+ String newname = name.replace(File.separatorChar, '/');
+ ZipEntry entry = zip.getEntry(newname);
+ return entry != null? ClassFile.newClassFile(zip, entry) : null;
+ }
+
+ void fillFiles(String pkg, String ext, Hashtable<String, ClassFile> files) {
+ Enumeration<? extends ZipEntry> e = zip.entries();
+ while (e.hasMoreElements()) {
+ ZipEntry entry = (ZipEntry)e.nextElement();
+ String name = entry.getName();
+ name = name.replace('/', File.separatorChar);
+ if (name.startsWith(pkg) && name.endsWith(ext)) {
+ files.put(name, ClassFile.newClassFile(zip, entry));
+ }
+ }
+ }
+}
+
+// a ClassPathEntry that represents jrt file system
+final class JrtClassPathEntry extends ClassPathEntry {
+ private final FileSystem fs;
+ // module directory paths in jrt fs
+ private final Set<Path> jrtModules;
+ // package name to package directory path mapping (lazily filled)
+ private final Map<String, Path> pkgDirs;
+
+ JrtClassPathEntry(FileSystem fs) {
+ this.fs = fs;
+ this.jrtModules = new LinkedHashSet<>();
+ this.pkgDirs = new HashMap<>();
+
+ // fill in module directories at the root dir
+ Path root = fs.getPath("/");
+ try {
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(root)) {
+ for (Path entry: stream) {
+ if (Files.isDirectory(entry))
+ jrtModules.add(entry);
+ }
+ }
+ } catch (IOException ioExp) {
+ throw new UncheckedIOException(ioExp);
+ }
+ }
+
+ void close() throws IOException {
+ }
+
+ // from pkgName (internal separator '/') to it's Path in jrtfs
+ synchronized Path getPackagePath(String pkgName) throws IOException {
+ // check the cache first
+ if (pkgDirs.containsKey(pkgName)) {
+ return pkgDirs.get(pkgName);
+ }
+
+ for (Path modPath : jrtModules) {
+ Path pkgDir = fs.getPath(modPath.toString(), pkgName);
+ // check if package directory is under any of the known modules
+ if (Files.exists(pkgDir)) {
+ // it is a package directory only if contains atleast one .class file
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(pkgDir)) {
+ for (Path p : stream) {
+ if (Files.isRegularFile(p) && p.toString().endsWith(".class")) {
+ // cache package-to-package dir mapping for future
+ pkgDirs.put(pkgName, pkgDir);
+ return pkgDir;
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ // fully qualified (internal) class name to it's Path in jrtfs
+ Path getClassPath(String clsName) throws IOException {
+ int index = clsName.lastIndexOf('/');
+ if (index == -1) {
+ return null;
+ }
+ Path pkgPath = getPackagePath(clsName.substring(0, index));
+ return pkgPath == null? null : fs.getPath(pkgPath + "/" + clsName.substring(index + 1));
+ }
+
+ ClassFile getFile(String name, String subdir, String basename, boolean isDirectory) {
+ try {
+ name = name.replace(File.separatorChar, '/');
+ Path cp = getClassPath(name);
+ return cp == null? null : ClassFile.newClassFile(cp);
+ } catch (IOException ioExp) {
+ throw new UncheckedIOException(ioExp);
+ }
+ }
+
+ void fillFiles(String pkg, String ext, Hashtable<String, ClassFile> files) {
+ Path dir;
+ try {
+ dir = getPackagePath(pkg);
+ if (dir == null) {
+ return;
+ }
+ } catch (IOException ioExp) {
+ throw new UncheckedIOException(ioExp);
+ }
+
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
+ for (Path p : stream) {
+ String name = p.toString();
+ name = name.replace('/', File.separatorChar);
+ if (name.startsWith(pkg) && name.endsWith(ext)) {
+ files.put(name, ClassFile.newClassFile(p));
+ }
+ }
+ } catch (IOException ioExp) {
+ throw new UncheckedIOException(ioExp);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/java/FileClassFile.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.tools.java;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+/**
+ * This class is used to represent a file loaded from the class path, and
+ * is a regular file.
+ *
+ * WARNING: The contents of this source file are not part of any
+ * supported API. Code that depends on them does so at its own risk:
+ * they are subject to change or removal without notice.
+ */
+final
+class FileClassFile extends ClassFile {
+ private final File file;
+
+ /**
+ * Constructor for instance representing a regular file
+ */
+ public FileClassFile(File file) {
+ this.file = file;
+ }
+
+ @Override
+ public boolean isZipped() {
+ return false;
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return new FileInputStream(file);
+ }
+
+ @Override
+ public boolean exists() {
+ return file.exists();
+ }
+
+ @Override
+ public boolean isDirectory() {
+ return file.isDirectory();
+ }
+
+ @Override
+ public long lastModified() {
+ return file.lastModified();
+ }
+
+ @Override
+ public String getPath() {
+ return file.getPath();
+ }
+
+ @Override
+ public String getName() {
+ return file.getName();
+ }
+
+//JCOV
+ @Override
+ public String getAbsoluteName() {
+ String absoluteName;
+ try {
+ absoluteName = file.getCanonicalPath();
+ } catch (IOException e) {
+ absoluteName = file.getAbsolutePath();
+ }
+ return absoluteName;
+ }
+// end JCOV
+
+ @Override
+ public long length() {
+ return file.length();
+ }
+
+ @Override
+ public String toString() {
+ return file.toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/java/PathClassFile.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.tools.java;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+/**
+ * This class is used to represent a file loaded from the class path, and
+ * is represented by nio Path.
+ *
+ * WARNING: The contents of this source file are not part of any
+ * supported API. Code that depends on them does so at its own risk:
+ * they are subject to change or removal without notice.
+ */
+final
+class PathClassFile extends ClassFile {
+ private final Path path;
+ private final BasicFileAttributes attrs;
+
+ /**
+ * Constructor for instance representing a Path
+ */
+ public PathClassFile(Path path) {
+ this.path = path;
+ try {
+ this.attrs = Files.readAttributes(path, BasicFileAttributes.class);
+ } catch (IOException ioExp) {
+ throw new UncheckedIOException(ioExp);
+ }
+ }
+
+ @Override
+ public boolean isZipped() {
+ return false;
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return Files.newInputStream(path);
+ }
+
+ @Override
+ public boolean exists() {
+ return true;
+ }
+
+ @Override
+ public boolean isDirectory() {
+ return attrs.isDirectory();
+ }
+
+ @Override
+ public long lastModified() {
+ return attrs.lastModifiedTime().toMillis();
+ }
+
+ @Override
+ public String getPath() {
+ return path.toUri().toString();
+ }
+
+ @Override
+ public String getName() {
+ return path.getFileName().toString();
+ }
+
+//JCOV
+ @Override
+ public String getAbsoluteName() {
+ return path.toAbsolutePath().toUri().toString();
+ }
+// end JCOV
+
+ @Override
+ public long length() {
+ return attrs.size();
+ }
+
+ @Override
+ public String toString() {
+ return path.toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/java/ZipClassFile.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.tools.java;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.zip.*;
+
+/**
+ * This class is used to represent a file loaded from the class path, and
+ * is a zip file entry.
+ *
+ * WARNING: The contents of this source file are not part of any
+ * supported API. Code that depends on them does so at its own risk:
+ * they are subject to change or removal without notice.
+ */
+final
+class ZipClassFile extends ClassFile {
+ private final ZipFile zipFile;
+ private final ZipEntry zipEntry;
+
+ /**
+ * Constructor for instance representing a zip file entry
+ */
+ public ZipClassFile(ZipFile zf, ZipEntry ze) {
+ this.zipFile = zf;
+ this.zipEntry = ze;
+ }
+
+ @Override
+ public boolean isZipped() {
+ return true;
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ try {
+ return zipFile.getInputStream(zipEntry);
+ } catch (ZipException e) {
+ throw new IOException(e.getMessage());
+ }
+ }
+
+ @Override
+ public boolean exists() {
+ return true;
+ }
+
+ @Override
+ public boolean isDirectory() {
+ return zipEntry.getName().endsWith("/");
+ }
+
+ @Override
+ public long lastModified() {
+ return zipEntry.getTime();
+ }
+
+ @Override
+ public String getPath() {
+ return zipFile.getName() + "(" + zipEntry.getName() + ")";
+ }
+
+ @Override
+ public String getName() {
+ return zipEntry.getName();
+ }
+
+//JCOV
+ @Override
+ public String getAbsoluteName() {
+ return zipFile.getName() + "(" + zipEntry.getName() + ")";
+ }
+// end JCOV
+
+ @Override
+ public long length() {
+ return zipEntry.getSize();
+ }
+
+ @Override
+ public String toString() {
+ return zipEntry.toString();
+ }
+}
--- a/jdk/src/jdk.rmic/share/classes/sun/tools/javac/BatchEnvironment.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/javac/BatchEnvironment.java Wed Jul 05 20:08:34 2017 +0200
@@ -160,17 +160,15 @@
static BatchEnvironment create(OutputStream out,
String srcPathString,
String classPathString,
- String sysClassPathString,
- String extDirsString){
+ String sysClassPathString) {
ClassPath[] classPaths = classPaths(srcPathString, classPathString,
- sysClassPathString, extDirsString);
+ sysClassPathString);
return new BatchEnvironment(out, classPaths[0], classPaths[1]);
}
protected static ClassPath[] classPaths(String srcPathString,
String classPathString,
- String sysClassPathString,
- String extDirsString) {
+ String sysClassPathString) {
// Create our source classpath and our binary classpath
ClassPath sourcePath;
ClassPath binaryPath;
@@ -196,30 +194,6 @@
}
appendPath(binaryPathBuffer, sysClassPathString);
- if (extDirsString == null) {
- extDirsString = System.getProperty("java.ext.dirs");
- }
- if (extDirsString != null) {
- StringTokenizer st = new StringTokenizer(extDirsString,
- File.pathSeparator);
- while (st.hasMoreTokens()) {
- String dirName = st.nextToken();
- File dir = new File(dirName);
- if (!dirName.endsWith(File.separator)) {
- dirName += File.separator;
- }
- if (dir.isDirectory()) {
- String[] files = dir.list();
- for (int i = 0; i < files.length; ++i) {
- String name = files[i];
- if (name.endsWith(".jar")) {
- appendPath(binaryPathBuffer, dirName + name);
- }
- }
- }
- }
- }
-
appendPath(binaryPathBuffer, classPathString);
sourcePath = new ClassPath(srcPathString);
@@ -718,7 +692,7 @@
// Couldn't find the source, try the one mentioned in the binary
if (bc.getSource() != null) {
- srcfile = new ClassFile(new File((String)bc.getSource()));
+ srcfile = ClassFile.newClassFile(new File((String)bc.getSource()));
// Look for the source file
srcfile = pkg.getSourceFile(srcfile.getName());
if ((srcfile != null) && srcfile.exists()) {
@@ -863,7 +837,7 @@
}
if (srcfile == null) {
String fn = (String)c.getClassDefinition().getSource();
- srcfile = new ClassFile(new File(fn));
+ srcfile = ClassFile.newClassFile(new File(fn));
}
} else {
// Get a source file name from the package
--- a/jdk/src/jdk.rmic/share/classes/sun/tools/javac/Main.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/javac/Main.java Wed Jul 05 20:08:34 2017 +0200
@@ -197,7 +197,6 @@
String sourcePathArg = null;
String classPathArg = null;
String sysClassPathArg = null;
- String extDirsArg = null;
boolean verbosePath = false;
String targetArg = null;
@@ -342,17 +341,6 @@
usage_error();
return false; // Stop processing now
}
- } else if (argv[i].equals("-extdirs")) {
- if ((i + 1) < argv.length) {
- if (extDirsArg != null) {
- error("main.option.already.seen","-extdirs");
- }
- extDirsArg = argv[++i];
- } else {
- error("main.option.requires.argument","-extdirs");
- usage_error();
- return false; // Stop processing now
- }
} else if (argv[i].equals("-encoding")) {
if ((i + 1) < argv.length) {
if (encoding!=null)
@@ -475,8 +463,7 @@
BatchEnvironment env = BatchEnvironment.create(out,
sourcePathArg,
classPathArg,
- sysClassPathArg,
- extDirsArg);
+ sysClassPathArg);
if (verbosePath) {
output(getText("main.path.msg",
env.sourcePath.toString(),
@@ -503,7 +490,7 @@
for (Enumeration<String> e = v.elements() ; e.hasMoreElements() ;) {
File file = new File(e.nextElement());
try {
- env.parseFile(new ClassFile(file));
+ env.parseFile(ClassFile.newClassFile(file));
} catch (FileNotFoundException ee) {
env.error(0, "cant.read", file.getPath());
exitStatus = EXIT_CMDERR;
--- a/jdk/src/sample/share/jmx/jmx-scandir/index.html Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/sample/share/jmx/jmx-scandir/index.html Wed Jul 05 20:08:34 2017 +0200
@@ -36,9 +36,9 @@
<title>JMX(TM) "scandir" Example</title>
</head>
<body>
-
+
<h1><center>Java<font size="-1"><sup>TM</sup></font> Management Extensions (JMX<font size="-1"><sup>TM</sup></font>) <i>scandir</i> Example</center></h1>
-
+
<h2><a name="h2-Introduction">Introduction</a></h2>
<ul>
<p>The JMX <i>scandir</i> example is an application that
@@ -59,7 +59,7 @@
solutions used when implementing a monitoring and
management interface for an application with JMX
Technology.</p>
- <p>This example is an advanced JMX example, which presents
+ <p>This example is an advanced JMX example, which presents
advanced JMX concepts. It is assumed that the reader is already
familiar with the JMX API. Newcomers to JMX Technology are
invited to have a look at the <a
@@ -69,31 +69,31 @@
<p></p>
<hr>
<blockquote>
- <u>Note:</u> This example was developed using <a
+ <u>Note:</u> This example was developed using <a
href="http://www.netbeans.org">NetBeans 5.0 IDE</a>. The instructions
given in this document to build, run, and test the example assume that
you have at your disposal:
<ul><li>either <a href="http://www.netbeans.org">NetBeans 5.0 IDE</a>,</li>
- <li>or <a href="http://ant.apache.org/">Apache Ant 1.6.5</a> and
+ <li>or <a href="http://ant.apache.org/">Apache Ant 1.6.5</a> and
<a href="http://sourceforge.net/projects/junit/">JUnit 3.8.1 or
3.8.2</a><br>
(JUnit is only needed to run the example's unit tests).
</li>
</ul>
- <p><a name="setup">In order to build the example</a>,
+ <p><a name="setup">In order to build the example</a>,
<u>you may need to copy the jmx-scandir</u>
- directory to somewhere where you have write permissions.
+ directory to somewhere where you have write permissions.
<br>In that case, you will need to update the <i>nbjdk.home</i> variable
- in the copied <i><a href="build.properties">build.properties</a></i>
- file located at the root of the copied project directory.
+ in the copied <i><a href="build.properties">build.properties</a></i>
+ file located at the root of the copied project directory.
Please make sure that this variable points to the JDK 6 home directory.
</p>
- <p>If you wish to run the testsuite from within the <a
+ <p>If you wish to run the testsuite from within the <a
href="http://www.netbeans.org">NetBeans IDE</a> you will also have
- to set the <i>libs.junit.classpath</i> variable in
- <a href="build.properties">build.properties</a>.
+ to set the <i>libs.junit.classpath</i> variable in
+ <a href="build.properties">build.properties</a>.
The <i>libs.junit.classpath</i> variable should point to your
- <a href="http://sourceforge.net/projects/junit/">junit.jar</a>,
+ <a href="http://sourceforge.net/projects/junit/">junit.jar</a>,
version 3.8.1 or 3.8.2.
</p>
</blockquote>
@@ -116,22 +116,22 @@
<h2><a name="h2-Generating">Generating the Java Documentation</a></h2>
<ul>
- <p>Before reading further, you will need to generate the
+ <p>Before reading further, you will need to generate the
Java Documentation for the example's sources.</p>
- <p>In the example root directory (where the <code>build.xml</code>
+ <p>In the example root directory (where the <code>build.xml</code>
file is located) run the following command:
<pre>ant javadoc</pre>
</p>
- <p>Alternatively you can open the jmx-scandir project with the
+ <p>Alternatively you can open the jmx-scandir project with the
NetBeans IDE and generate the Javadoc from its <code>Build</code>
menu.
</p>
- <p>If building the documentation fails, please make sure to read the
- <a href="#setup">note</a> at the beginning of this document.</p>
+ <p>If building the documentation fails, please make sure to read the
+ <a href="#setup">note</a> at the beginning of this document.</p>
</ul>
-
+
<h2><a name="h2-Overview">Overview of the <i>scandir</i> Example</a></h2>
-
+
<ul>
<p>The JMX <i>scandir</i> example is built around the
following MBeans:</p>
@@ -184,9 +184,9 @@
load/save the configuration to/from an XML file. It
will also let you modify that configuration - by e.g.
creating new directory scanners in there.
- The corresponding MBeans will be created later, only
+ The corresponding MBeans will be created later, only
when you later
- ask the <code><a
+ ask the <code><a
href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a> </code> to apply the
@@ -220,14 +220,14 @@
The <code>ResultLogManagerMXBean</code> can be configured to log
such records to a flat file, or into a log held in memory, or
both. Both logs (file and memory) can be configured with a
- maximum capacity.
+ maximum capacity.
<br>When the maximum capacity of the memory
log is reached, its first entry (i.e. its oldest entry) is
removed to make place for the latest one.
<br>When the maximum
capacity of the file log is reached, the file is
renamed by appending a tilde '~' to its name and a
- new result log is created.
+ new result log is created.
<br>The <code>ResultLogManagerMXBean</code>
will let you interactively clear these result logs, change their
capacity, and decide where (memory or file) to log.
@@ -246,7 +246,7 @@
a single mail to each owner of matching files, containing
the list of files they should consider deleting).<br>
The <code>ResultLogManagerMXBean</code> is a singleton
- MBean created by the <code><a
+ MBean created by the <code><a
href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a> </code>
@@ -258,10 +258,10 @@
</li>
</ul>
<p>An application <code>main()</code> method is
- provided in the <a
+ provided in the <a
href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html"
- >ScanDirAgent</a> class. The <code>main()</code> simply registers
- a <code><a
+ >ScanDirAgent</a> class. The <code>main()</code> simply registers
+ a <code><a
href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a> </code> in the platform MBeanServer, and
@@ -281,15 +281,15 @@
<li>If the property <code>scandir.config.file</code> is
defined, the default application file will be the
file pointed to by this property. If that file
- doesn't exist, it will be created when
+ doesn't exist, it will be created when
<code>ScanDirConfigMXBean.save()</code> is
invoked.
</li>
<li>Otherwise the application config file is
assumed to be a file called <code>jmx-scandir.xml</code>,
located in the user's directory (as defined by
- the System property <code>user.home</code>).
- If that file doesn't exists, it will be created when
+ the System property <code>user.home</code>).
+ If that file doesn't exists, it will be created when
<code>ScanDirConfigMXBean.save()</code> is
invoked.
</li>
@@ -299,8 +299,8 @@
<pre>-Djava.util.logging.config.file=logging.properties</pre>
<pre>-Dscandir.config.file=src/etc/testconfig.xml</pre>
With <code>ScanDirAgent</code> defined as the project's
- main class. Hence when you invoke from the NetBeans IDE
- <i>Run Project</i> on the <i>jmx-scandir</i> project,
+ main class. Hence when you invoke from the NetBeans IDE
+ <i>Run Project</i> on the <i>jmx-scandir</i> project,
or <i>Run file</i> on the <code>ScanDirAgent</code>, the
application starts with the test configuration provided in
<a href="src/etc/testconfig.xml"
@@ -320,7 +320,7 @@
><code>src</code></a> subdirectory.</p>
</ul>
<h2><a name="h2-Patterns">Patterns, Best Practices, and Common Pitfalls</a></h2>
- <ul>
+ <ul>
<p>This section discusses some common patterns and
design choices that this example demonstrates, and some pitfalls that
it avoids.
@@ -392,14 +392,14 @@
title="Inter-MXBean references"
>Inter-MXBean References</a>.
</p>
- <blockquote><u>Hint:</u> In order to simplify the task of coding a
+ <blockquote><u>Hint:</u> In order to simplify the task of coding a
JMX programmatic client, we recommend that getters, setters, and
- operations defined in MBean and MXBean interfaces throw
+ operations defined in MBean and MXBean interfaces throw
<code>IOException</code>. Proxy objects will then be able
to rethrow directly any <code>IOException</code> received from
their underlying MBean Server connection, without wrapping
them into <code>UndeclaredThrowableExceptions</code>.<br>
- Since the life cycle of the proxy object is not directly tied to
+ Since the life cycle of the proxy object is not directly tied to
the life cycle of the MBean it proxies, you may also want to
have all methods in the MBean or MXBean interface throw
<code>InstanceNotFoundException</code> or more generally
@@ -510,7 +510,7 @@
the application MBeans are modeling objects
which are conceptually contained within
each other in a tree-like structure.
- <br>For instance, most MBean names defined by
+ <br>For instance, most MBean names defined by
<a href="http://jcp.org/en/jsr/detail?id=77"
>J2EE Management (JSR 77)</a> follow
this scheme.
@@ -519,7 +519,7 @@
return <code>ObjectName</code> or
<code>ObjectName[]</code> values</b>. The ObjectNames
point to the MBeans which are related to that
- object. For instance , <a
+ object. For instance , <a
href="http://glassfish.dev.java.net/"
title="Open Source Java EE 5 Application Server"
>GlassFish</a>
@@ -604,7 +604,7 @@
<p>
Sometimes also, an MBean may need to perform some
checks before being registered, or will need
- to carry out some actions right after it has been
+ to carry out some actions right after it has been
successfully registered in the MBeanServer.
</p>
<p>
@@ -617,13 +617,13 @@
for it is to implement the <code>MBeanRegistration</code>
interface.
</p>
- <p>The <code>MBeanRegistration</code> interface is a callback
- interface which defines pre and post registration and
+ <p>The <code>MBeanRegistration</code> interface is a callback
+ interface which defines pre and post registration and
unregistration callbacks.
</p>
<p>
When an MBean implementing this interface is created
- (with <code>createMBean</code>) or registered
+ (with <code>createMBean</code>) or registered
(with <code>registerMBean</code>) in an MBeanServer,
the MBeanServer will call the <code>preRegister</code>
and <code>postRegister</code> method implemented by
@@ -631,17 +631,17 @@
has an <code>MBeanServer</code> and <code>ObjectName</code>
parameter, which are passed by the MBeanServer to the
MBean. The MBean can store the reference it is being passed
- in a private instance variable for later use.
+ in a private instance variable for later use.
</p>
<p>
Most of the MXBeans we have defined in this example
implement the <code>MBeanRegistration</code> interface. The table
below show how our MBeans use this interface to control
- their own names, make sanity checks, perform
+ their own names, make sanity checks, perform
initialization steps or cleanup actions.
</p>
<p><br><center>
- <table border="1" cellpadding="4" cellspacing="2"
+ <table border="1" cellpadding="4" cellspacing="2"
bgcolor="#eeeeee" width="95%">
<thead>
<tr bgcolor="#cecece">
@@ -654,16 +654,16 @@
<tr>
<td bgcolor="#dedede">get a reference to the MBeanServer</td>
<td><code>preRegister</code></td>
- <td bgcolor="#fafafa">The <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a> needs a reference
to the MBeanServer in order to create and
- register other MBeans, such as the
+ register other MBeans, such as the
<a
href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
title="The ResultLogManagerMXBean is in charge of managing result logs"
- >ResultLogManagerMXBean</a>, and the
+ >ResultLogManagerMXBean</a>, and the
<a
href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
@@ -675,13 +675,13 @@
not met.
</td>
<td><code>preRegister</code></td>
- <td bgcolor="#fafafa">The <a
+ <td bgcolor="#fafafa">The <a
href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a> will throw
an IllegalArgumentException in <code>preRegister</code>
if the ObjectName it is being passed is
- illegal. Throwing an exception in
+ illegal. Throwing an exception in
<code>preRegister</code> makes the registration fail.
</td>
</tr>
@@ -692,9 +692,9 @@
href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
title="The ScanDirConfigMXBean is in charge of the configuration"
>ScanDirConfigMXBean</a> propagates the
- value of the <code>name=</code> property of
+ value of the <code>name=</code> property of
the ObjectName it is given into its
- ScanManagerConfig bean.
+ ScanManagerConfig bean.
</td>
</tr>
<tr>
@@ -704,19 +704,19 @@
<td><code>preRegister</code></td>
<td bgcolor="#fafafa">The name that is returned by <code>preRegister</code>
is the ObjectName with which the MBean will be
- eventually registered.
+ eventually registered.
The <a
href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
title="The ScanDirConfigMXBean is in charge of the configuration"
>ScanDirConfigMXBean</a> is able to suggest
a value for its own ObjectName if none was
- provided. Similarly, the <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ provided. Similarly, the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
- >ScanManagerMXBean</a>
+ >ScanManagerMXBean</a>
always returns its singleton ObjectName
- defined by <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html#SCAN_MANAGER_NAME"
+ defined by <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html#SCAN_MANAGER_NAME"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean.SCAN_MANAGER_NAME</a>.
</td>
@@ -736,7 +736,7 @@
known that the registration was successful.
</td>
<td><code>postRegister</code></td>
- <td bgcolor="#fafafa">The <code>postRegister</code> method
+ <td bgcolor="#fafafa">The <code>postRegister</code> method
can be used to implement
initialization steps that need to be done once it
is known that the registration was successful, or to
@@ -745,11 +745,11 @@
The <code>postRegister</code> method has a Boolean parameter
which tells the MBean whether it was or wasn't
successfully registered in the MBeanServer.
- The <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a> uses <code>postRegister</code> to create
- and register other MBeans, such as the
+ and register other MBeans, such as the
<a
href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
title="The ResultLogManagerMXBean is in charge of managing result logs"
@@ -766,19 +766,19 @@
<tr>
<td bgcolor="#dedede">check whether the MBean can be deregistered</td>
<td><code>preDeregister</code></td>
- <td bgcolor="#fafafa">The <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a> uses this method to verify
- that its state allows it to be deregistered.
+ that its state allows it to be deregistered.
In particular, it will refuse to be deregistered
if it is in the RUNNING or SCHEDULED state.
If <code>preDeregister</code> throws an exception, the unregisterMBean
call will fail and the MBean will remain registered in
- the MBeanServer.
+ the MBeanServer.
Take particular care when implementing business logic
- in this method: if the logic you implement has an
- unfortunate bug which makes it always throw an
+ in this method: if the logic you implement has an
+ unfortunate bug which makes it always throw an
exception, you will never be able to unregister
that MBean.
</td>
@@ -788,19 +788,19 @@
it fails
</td>
<td><code>preDeregister</code></td>
- <td bgcolor="#fafafa">The <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a> uses this method to unregister
all the other MBeans it has created and registered in the
MBeanServer. This includes the <a
href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
title="The ResultLogManagerMXBean is in charge of managing result logs"
- >ResultLogManagerMXBean</a>, the
+ >ResultLogManagerMXBean</a>, the
<a
href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
title="The ScanDirConfigMXBean is in charge of the configuration"
- >ScanDirConfigMXBeans</a> it has created, and the
+ >ScanDirConfigMXBeans</a> it has created, and the
<a
href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
@@ -816,8 +816,8 @@
<td><code>postDeregister</code></td>
<td bgcolor="#fafafa"><code>postDeregister</code> is only called if the MBean was succesfully
unregistered.
- The <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a> uses this method to cancel
its internal java.util.Timer.
@@ -834,25 +834,25 @@
instance registered in a given MBeanServer. <br>
A singleton MBean usually has a well-known name,
which can be defined as a constant. In that case,
- clients no longer need to call <code>new ObjectName(...)</code>
+ clients no longer need to call <code>new ObjectName(...)</code>
and catch the declared <code>MalformedObjectNameException</code>.
</p>
<p>There are already quite a few examples of singleton
- MBeans in the java.lang.management API. The
+ MBeans in the java.lang.management API. The
ThreadingMXBean, ClassLoadingMXBean, RuntimeMXBean, etc.
are all singleton MBeans.
</p>
<p>In this example, we have two singleton MBeans:
- The <code><a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ The <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
- >ScanManagerMXBean</a></code> and the
+ >ScanManagerMXBean</a></code> and the
<code><a
href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
title="The ResultLogManagerMXBean is in charge of managing result logs"
>ResultLogManagerMXBean</a></code>. But in fact,
- the only real singleton MBean is the
- <code>ScanManagerMXBean</code>. The
+ the only real singleton MBean is the
+ <code>ScanManagerMXBean</code>. The
<code>ResultLogManagerMXBean</code> just happens to
be a singleton MBean because it has a 1-1 relationship
with the <code>ScanManagerMXBean</code>.
@@ -861,15 +861,15 @@
singleton MBean pattern in this way:
</p>
<ul>
- <li>The <code>ScanManagerMXBean</code> name has a single
+ <li>The <code>ScanManagerMXBean</code> name has a single
key property: <code>type=ScanManagerMXBean</code>.</li>
<li>Its name is defined by an ObjectName constant called
<code>SCAN_MANAGER_NAME</code> in the <code>ScanManager</code> class</li>
- <li>The <code>ScanManagerMXBean</code> enforces its status of
+ <li>The <code>ScanManagerMXBean</code> enforces its status of
singleton MBean. It will refuse to be registered
with a name other than
the <code>SCAN_MANAGER_NAME</code>. You can therefore depend on
- the fact that the <code>ScanManagerMXBean</code> will always
+ the fact that the <code>ScanManagerMXBean</code> will always
be registered with its singleton <code>SCAN_MANAGER_NAME</code>
(see <code>preRegister</code>)
</li>
@@ -879,18 +879,18 @@
its singleton <code>SCAN_MANAGER_NAME</code>
(see <code>preRegister</code>).
</li>
- <li>The <code>ScanManager</code> class has a no-arg static
+ <li>The <code>ScanManager</code> class has a no-arg static
<code>register</code> method that will register
the singleton instance in the Platform MBeanServer.
This static <code>register</code> method returns
a proxy to the registered singleton.
</li>
- <li>The <code>ScanManager</code> class has also a static
+ <li>The <code>ScanManager</code> class has also a static
<code>register</code> method that will create
a singleton instance in a (possibly remote)
- MBeanServerConnection - using
+ MBeanServerConnection - using
<code>createMBean</code>.
- This static <code>register</code> method
+ This static <code>register</code> method
also returns a proxy to the registered singleton.
</li>
<li>Only the MBeanServer has a reference to the
@@ -906,7 +906,7 @@
>ResultLogManagerMXBean</a></code>
has a much more relaxed implementation of the pattern:
<br>It simply provides its own singleton name if it is
- registered with a null ObjectName, but will not enforce
+ registered with a null ObjectName, but will not enforce
the use of that name.
</p>
<p>Note that all singleton MBean names in this example
@@ -923,16 +923,16 @@
<p>In this example, we have decided to follow a simple
pattern:</p>
<ul>
- <li>The application is initialized simply
- by registering the singleton
- <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ <li>The application is initialized simply
+ by registering the singleton
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
- >ScanManagerMXBean</a> in
+ >ScanManagerMXBean</a> in
the MBeanServer.
</li>
<li>The <code>ScanManagerMXBean</code> will then
- in turn register any other MBean that the
+ in turn register any other MBean that the
application might need:
<ul>
<li>It creates and registers the singleton
@@ -948,14 +948,14 @@
>ScanDirConfigMXBean</a></code>
which loads the initial configuration
</li>
- <li>It creates as many
+ <li>It creates as many
<code><a
href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
>DirectoryScannerMXBeans</a></code> as
needed when the configuration is applied
</li>
- <li>It lets you create alternate
+ <li>It lets you create alternate
<code>ScanDirConfigMXBean</code>, to
which you can later switch in order
to apply a new alternate configuration.
@@ -963,7 +963,7 @@
</ul>
</li>
<li>When a new configuration is applied (or if the
- current configuration is reapplied), the
+ current configuration is reapplied), the
<code>ScanManagerMXBean</code> will unregister
any <code>DirectoryScannerMXBeans</code> it has
previously registered, and will re-create
@@ -984,11 +984,11 @@
method).
</p>
<p>You will note that the <code>ScanManagerMXBean</code>
- will only allow itself to be deregistered if it can be
+ will only allow itself to be deregistered if it can be
closed - that is if there's no other action in
- progress.
+ progress.
This is to make sure that the deregistration of
- dependent MBeans will work smoothly.
+ dependent MBeans will work smoothly.
<br>
The deregistration of related MBeans will happen
in the <code>ScanManager.preDeregister</code>
@@ -1007,13 +1007,13 @@
</p>
<p>Handling the LifeCycle of all the application's
MBeans in a single MBean is usually a good design
- pattern, especially if the application is a
+ pattern, especially if the application is a
module which is intended to share a JVM - or
an MBeanServer - with other modules.
</p>
<p>This is specially useful if the application needs to
- be loaded and unloaded on demand: in that
- case, simply registering or unregistering the top level
+ be loaded and unloaded on demand: in that
+ case, simply registering or unregistering the top level
MBean (in our example the <code>ScanManagerMXBean</code>) does
the trick.
</p>
@@ -1021,29 +1021,29 @@
<h3>Emitting Notifications</h3>
<ul>
<p>In order to emit notifications, an MBean must be
- an instance of <code>NotificationEmitter</code>.
- The <code>NotificationEmitter</code> interface defines methods
+ an instance of <code>NotificationEmitter</code>.
+ The <code>NotificationEmitter</code> interface defines methods
that the MBeanServer will call on the MBean in order
to register <code>NotificationListeners</code> with the MBean.
</p>
<p>It is worth noting that the MBean may not be
invoked each time a JMX client wants to register
a listener. For instance, the RMIConnectorServer
- registers <i>only once</i> a single listener with each MBean
+ registers <i>only once</i> a single listener with each MBean
which is a <code>NotificationEmitter</code>.
In that specific case, the listener may even be registered
with the MBean before any client has actually subscribed
for notifications from that particular MBean.
</p>
- <p>An MBean can therefore make no assumption about
+ <p>An MBean can therefore make no assumption about
which client or how many clients have registered for
notifications.
</p>
<p>It is also worth noting that the logic of the
methods defined in <code>NotificationEmitter</code> would not
be trivial to implement from scratch. Fortunately
- the JMX API defines a helper class, called
- <code>NotificationBroadcasterSupport</code>, which
+ the JMX API defines a helper class, called
+ <code>NotificationBroadcasterSupport</code>, which
provides an implementation for these methods.
</p>
<p>There are actually three ways for an MBean to
@@ -1061,7 +1061,7 @@
then override its <code>getNotificationInfo</code> method
which returns the <code>MBeanNotificationInfo[]</code> array
that should be included in your MBean's <code>MBeanInfo</code>
- and that's it.
+ and that's it.
<br>You just need to call the <code>sendNotification</code> method
inherited from <code>NotificationBroadcasterSupport</code> whenever
your MBean needs to send a notification.
@@ -1072,67 +1072,67 @@
>ScanDirConfigMXBean</a> and <a
href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
title="The ResultLogManagerMXBean is in charge of managing result logs"
- >ResultLogManagerMXBean</a> extend
+ >ResultLogManagerMXBean</a> extend
<code>NotificationBroadcasterSupport</code> in order
to send notifications.
</p>
</ul>
- <h4>The Delegation Pattern: delegating to a
+ <h4>The Delegation Pattern: delegating to a
NotificationBroadcasterSupport delegate</h4>
<ul>
<p>There may be cases however where delegating to a
- wrapped <code>NotificationBroadcasterSupport</code>
- object may be preferred to extending
+ wrapped <code>NotificationBroadcasterSupport</code>
+ object may be preferred to extending
<code>NotificationBroadcasterSupport</code>.
</p>
<p>For instance, if your MBeans already derive from
some base class, extending <code>NotificationBroadcasterSupport</code>
might not be an option.
</p>
- <p>Similarly, if you do not want to have the inherited
+ <p>Similarly, if you do not want to have the inherited
<code>public void sendNotification(Notification notification)</code>
method appear in the Javadoc of the concrete class of your
MBean, you may want to consider using the delegation
- pattern instead of extending
+ pattern instead of extending
<code>NotificationBroadcasterSupport</code>
</p>
- <p>In our example both the <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ <p>In our example both the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a> and the <a
href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
- >DirectoryScannerMXBean</a> use the delegation
- pattern rather than extending
+ >DirectoryScannerMXBean</a> use the delegation
+ pattern rather than extending
<code>NotificationBroadcasterSupport</code>.
In the end, choosing between one or the other method
- is more a question of taste, although the delegation
+ is more a question of taste, although the delegation
pattern could be considered more flexible since it
doesn't require extending any given superclass.
</p>
<p>It may be also worth noting that some tools like
- the JMX Module of <a
+ the JMX Module of <a
href="http://www.netbeans.org"
- >NetBeans IDE</a>, will be able to
+ >NetBeans IDE</a>, will be able to
generate for you all the code that delegates to a
wrapped <code>NotificationBroadcasterSupport</code>.
</p>
</ul>
-
+
<h4>Implementing NotificationEmitter from scratch</h4>
<ul>
<p>This is the last possibility for an MBean that
- needs to send notifications: simply implement
+ needs to send notifications: simply implement
<code>NotificationEmitter</code> from scratch. This is highly
- discouraged since that logic is not trivial, and
- already provided by
+ discouraged since that logic is not trivial, and
+ already provided by
<code>NotificationBroadcasterSupport</code> anyway.
</p>
</ul>
-
+
<h4>Beware of Synchronization Locks</h4>
<ul>
-
+
<p>One thing you must keep in mind when sending
notifications is not to send them from within
a synchronized block, or while holding a lock on
@@ -1140,10 +1140,10 @@
<p>Indeed, what happens when you send a notification
may vary greatly depending on whether the client
which has registered for notifications has done
- so through a <code>JMXConnector</code> (like the
+ so through a <code>JMXConnector</code> (like the
<code>JMXRMIConnector</code>)
or through a direct reference to the MBeanServer
- (by calling
+ (by calling
<code>MBeanServer.addNotificationListener</code>).
</p>
<p>In this latter case, the listener will be invoked
@@ -1152,7 +1152,7 @@
code of that listener now re-enters your MBean through a
call that flows through a JMXConnector, a deadlock
could occur. It is therefore very important to release
- any lock you may have before calling
+ any lock you may have before calling
<code>sendNotification</code>.</p>
<p>An easy way to do that is demonstrated in the
<code>ScanManager</code> class. The ScanManager
@@ -1160,20 +1160,20 @@
When a notification needs to be sent (e.g. because the
ScanManager state is being switched), the notification
is simply prepared and put into the pending notification
- queue.
- The notification queue is then processed later on,
+ queue.
+ The notification queue is then processed later on,
at the end of the method, when the processing is finally
completed and all the locks have been released.
<br>At this point the notification queue might already
have been emptied by another thread - in which case
the pending notifications will have already been
- removed from the queue. Which thread actually gets
- to send the notifications is of no importance. The
+ removed from the queue. Which thread actually gets
+ to send the notifications is of no importance. The
important point is that all the locks detained by
your MBean code in that thread were released before
the notification was sent.
</p>
- <p>In our example the <code>ScanManager</code> class
+ <p>In our example the <code>ScanManager</code> class
ensures this by:
<ul>
<li>Only calling <code>sendNotification</code>
@@ -1183,14 +1183,14 @@
<li>Only calling <code>sendQueuedNotifications</code>
when all locks have been released.
</li>
- <li>Never calling a method that calls
+ <li>Never calling a method that calls
<code>sendQueuedNotifications</code> from within
a synchronized block.</li>
</ul>
</p>
</ul>
-
-
+
+
<h4>Don't subclass Notification</h4>
<ul>
@@ -1202,23 +1202,23 @@
</p>
<p>Indeed, if you code your own subclass, a generic
client, like jconsole, will not be able to receive
- that notification unless it has that custom
+ that notification unless it has that custom
subclass in its classpath.
</p>
<p>
If you want your application to be interoperable, it is
therefore preferable not to subclass any of the standard
- Notification classes. You can define your own
+ Notification classes. You can define your own
Notification type string, and if you need to send
- additional data, you can put a CompositeData, or a
- HashMap of serializable standard types in the
+ additional data, you can put a CompositeData, or a
+ HashMap of serializable standard types in the
Notification's user data fields.
</p>
- <p>In this example, we are using directly the
+ <p>In this example, we are using directly the
standard notification classes:
<ul>
- <li>The <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ <li>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a> and the <a
href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
@@ -1236,7 +1236,7 @@
it finds a matching file.
<br>In that case, we simply use the base
<code>Notification</code>
- class with a new
+ class with a new
<b><code>com.sun.jmx.examples.scandir.filematch</code></b>
type.
</li>
@@ -1246,17 +1246,17 @@
>ScanDirConfigMXBean</a> and <a
href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
title="The ResultLogManagerMXBean is in charge of managing result logs"
- >ResultLogManagerMXBean</a> also both use the base
+ >ResultLogManagerMXBean</a> also both use the base
<code>Notification</code> class.
</li>
</ul>
- <p>Careful readers will have noted that the <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ <p>Careful readers will have noted that the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a> and the <a
href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
- >DirectoryScannerMXBean</a> both use the
+ >DirectoryScannerMXBean</a> both use the
<code>AttributeChangeNotification</code> class
to notify about their state change, whereas the
<a
@@ -1270,40 +1270,40 @@
both denote a state change:
<ul>
<p>In the case of <code>ScanManagerMXBean</code>
- and <code>DirectoryScannerMXBean</code>, the
+ and <code>DirectoryScannerMXBean</code>, the
notification which is emitted is more about a
state transition, from one state to another.
For instance, going from <code>RUNNING</code>
- to <code>STOPPED</code>, or from
+ to <code>STOPPED</code>, or from
<code>SCHEDULED</code> to <code>STOPPED</code>.
- <br>In that case, the
+ <br>In that case, the
<code>AttributeChangeNotification</code> was
more appropriate because it made it possible
- to send the previous and the new value of the
+ to send the previous and the new value of the
state attribute, thus reflecting the whole
state transition.
</p>
<p>In the case of the <code>ScanDirConfigMXBean</code>
however, what is of interest is the state in
which the MBean has arrived. Using the base
- <code>Notification</code> class with three different
- notification type strings -
+ <code>Notification</code> class with three different
+ notification type strings -
<b><code>com.sun.jmx.examples.scandir.config.loaded</code></b>,
<b><code>com.sun.jmx.examples.scandir.config.modified</code></b>,
and
- <b><code>com.sun.jmx.examples.scandir.config.saved</code></b> -
+ <b><code>com.sun.jmx.examples.scandir.config.saved</code></b> -
was therefore closer to what we wanted to model.
</p>
</ul>
</p>
</ul>
-
+
<h3>Configuration MBeans</h3>
<ul>
<p>A common practice when designing a management application is
- to have an MBean, or a set of MBeans, dedicated to configuration.
+ to have an MBean, or a set of MBeans, dedicated to configuration.
Separating configuration from control and monitoring allows
- more appropriate logic, and often simplifies the design and
+ more appropriate logic, and often simplifies the design and
implementation of the management interface.
</p>
<p>
@@ -1312,16 +1312,16 @@
title="The ScanDirConfigMXBean is in charge of the configuration"
>ScanDirConfigMXBean</a> is dedicated to the application configuration.
</p>
- <p>The <code>ScanDirConfigMXBean</code> will let you interactively
+ <p>The <code>ScanDirConfigMXBean</code> will let you interactively
modify, save, or load the application configuration. The modifications
will not be taken into account until it is applied, by invoking
- <code>applyConfiguration</code> on the <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ <code>applyConfiguration</code> on the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
- >ScanManagerMXBean</a>.
+ >ScanManagerMXBean</a>.
It is also possible to create many configurations, by creating as
many <code>ScanDirConfigMXBean</code>s, and then to choose and apply
- one of these configurations by calling
+ one of these configurations by calling
<code>ScanManagerMXBean.setConfigurationMBean</code> and then
<code>ScanManagerMXBean.applyConfiguration</code>.
</p>
@@ -1331,26 +1331,26 @@
</p>
<p>In order to save and store the application configuration data, the
<code>ScanDirConfigMXBean</code> uses a set of XML serializable Java beans
- defined in the <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/config/package-summary.html"
+ defined in the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/config/package-summary.html"
title="The com.sun.jmx.examples.scandir.config package defines XML serializable beans"
>com.sun.jmx.examples.scandir.config</a> package. These beans are very
simple Java beans which have been lightly annotated for XML binding.
</p>
<p>It is worth noting that these same beans can also be handled by the
- MXBean framework (our beans don't contain recursive data structures) and can
+ MXBean framework (our beans don't contain recursive data structures) and can
therefore be used directly as attributes and parameters of MXBeans, without
needing to be Java-serializable (the MXBean framework transform them in
CompositeData objects - which <b>are</b> serializable).
</p>
- <p>The same <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/config/ScanManagerConfig.html"
+ <p>The same <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/config/ScanManagerConfig.html"
title="The com.sun.jmx.examples.scandir.config package defines XML serializable beans"
>ScanManagerConfig</a> bean that we use to read from and write to the
XML configuration file is thus also used as attribute of the <a
href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
title="The ScanDirConfigMXBean is in charge of the configuration"
- >ScanDirConfigMXBean</a>. It is transformed into a <code>CompositeData</code>
+ >ScanDirConfigMXBean</a>. It is transformed into a <code>CompositeData</code>
by the MXBean framework, and can be easily introspected with
<a href="#JConsole">jconsole</a>.
</p>
@@ -1358,7 +1358,7 @@
<h3>MBeans Must Be Thread-Safe</h3>
<ul>
<p>A question often asked by newcomers to JMX technology
- is whether the MBeanServer is thread-safe. Well, the MBeanServer <b>is</b>
+ is whether the MBeanServer is thread-safe. Well, the MBeanServer <b>is</b>
thread safe, but it doesn't put any locks on the MBeans it contains. The
MBeans can be concurrently accessed by multiple threads, and must therefore
take care of their own thread safety.
@@ -1382,19 +1382,19 @@
MBean will have any side effect. Maybe that MBean will make
further calls to other MBeans which will in turn try to call
your MBean, or maybe it will emit a
- notification, and we'll be back to the considerations just
+ notification, and we'll be back to the considerations just
above.</li>
</ul>
</p>
<p>Another means of implementing thread-safe code is to use semaphores.
- The <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a> uses a semaphore called
<code>sequencer</code> to ensure
that critical code sections are not executed concurrently. In this
MBean, we use <code>Semaphore.tryAcquire</code> to lock the sequencer
- semaphore before entering the critical section. If the
+ semaphore before entering the critical section. If the
<code>Semaphore.tryAcquire</code> returns true then we enter the critical
section. If it returns false, we throw an IllegalStateException, stating
that we couldn't acquire the lock. The code looks like this:
@@ -1416,21 +1416,21 @@
the calling code will get the <code>IllegalStateException</code>
instead of being blocked on the deadlocked lock.
</p>
- <p>It is worth noting that each of these techniques has its own
+ <p>It is worth noting that each of these techniques has its own
advantages and disadvantages - which can make one of them more or less
appropriate depending on the inner logic of the MBean you're implementing.
</p>
- <p>Careful readers will also have noted that we used
- <code>IllegalStateException</code> directly, instead of defining
+ <p>Careful readers will also have noted that we used
+ <code>IllegalStateException</code> directly, instead of defining
our own subclass of RuntimeException, which could have had a more
precise semantics. If you define a new exception for your JMX application,
you must keep in mind that your client will need to have the class
- of your exception in its classpath to get that exception.
+ of your exception in its classpath to get that exception.
Otherwise your client will get a completely different exception, indicating a
deserialization issue.
</p>
</ul>
-
+
<h3>Waiting for Notifications</h3>
<ul>
<p>Implementing code that needs to wait for notifications is sometimes
@@ -1450,9 +1450,9 @@
is not always trivial. However, there's a very easy way to do that: use
a blocking queue of notifications.
<pre>
- final BlockingQueue<Notification> notifQueue =
+ final BlockingQueue<Notification> notifQueue =
new LinkedBlockingQueue<Notification>();
-
+
final NotificationListener listener = new NotificationListener() {
public void handleNotification(Notification notification,
Object handback) {
@@ -1482,13 +1482,13 @@
....
</pre>
</p>
- <p>You will note that this is a technique we've been using in the <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html"
+ <p>You will note that this is a technique we've been using in the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html"
title="The ScanDirAgent class defines a main method for the scandir application"
>ScanDirAgent</a> class and in the example unit tests.
</p>
</ul>
-
+
<h3>Holding hard references to other MBeans: proxy or direct reference?</h3>
<ul>
<p>We have seen that MXBeans will let you return proxy references to other
@@ -1500,7 +1500,7 @@
only held by the MBeanServer. It is a better design
to hold a reference to a proxy, rather than to hold
a hard reference to an MBean. However there are two cases
- when holding a hard reference might be preferred:
+ when holding a hard reference might be preferred:
<ol>
<li>When MBean A needs to call a method of method B which
is not part of its MBean interface</li>
@@ -1513,51 +1513,51 @@
and the application can ensure that the life cycle
of each MBean is consistent with regard to the other.
</p>
- <p>In our example, the <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ <p>In our example, the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
- >ScanManagerMXBean</a> holds only proxy references to the <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
- >ScanDirConfigMXBean</a> and the <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+ >ScanManagerMXBean</a> holds only proxy references to the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+ >ScanDirConfigMXBean</a> and the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
>DirectoryScannerMXBeans</a>. <br>
- However it holds a direct reference to the <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManager.html"
- >ResultLogManager</a>. This makes it possible to pass a direct
- reference to the <code>DirectoryScannerMXBeans</code>,
+ However it holds a direct reference to the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManager.html"
+ >ResultLogManager</a>. This makes it possible to pass a direct
+ reference to the <code>DirectoryScannerMXBeans</code>,
which can then log their results
more efficiently, and would also make it possible to remove
- the <code>log</code> method from the <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
- >ResultLogManagerMXBean</a> interface - leaving it in the
+ the <code>log</code> method from the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+ >ResultLogManagerMXBean</a> interface - leaving it in the
<code>ResultLogManager</code> class (possibly as a package method)
should we wish to do so.
</p>
-
+
</ul>
<h3>Agent Class</h3>
<ul>
- <p>The <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html"
+ <p>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html"
title="The ScanDirAgent class defines a main method for the scandir application"
>ScanDirAgent</a> is the Agent class for the <i>scandir</i> application.
- This class contains the <code>main</code> method to start a standalone
+ This class contains the <code>main</code> method to start a standalone
<i>scandir</i> application.
</p>
- <p>The <code>main</code> method simply registers a <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ <p>The <code>main</code> method simply registers a <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a> in the platform MBeanServer, and then waits
for someone to call <code>ScanManagerMXBean.close</code>.
</p>
<p>
- When the <code>ScanManagerMXBean</code> state is switched to
- <code>ScanManagerMXBean.ScanState.CLOSED</code>, the
+ When the <code>ScanManagerMXBean</code> state is switched to
+ <code>ScanManagerMXBean.ScanState.CLOSED</code>, the
<code>ScanManagerMXBean</code> is unregistered, and the application
terminates (i.e. the main thread completes).
</p>
- <p>Standalone JMX applications usually have an Agent class that contain
+ <p>Standalone JMX applications usually have an Agent class that contain
their <code>main</code> method, which performs all the MBean
registration steps.
However, it is usually not a bad idea if that class can
@@ -1566,19 +1566,19 @@
no longer be standalone and would no longer control the implementation
of <code>main</code>. In our example the Agent
class could be easily turned into an MBean, exposing its three
- <code>init</code>, <code>waitForClose</code> and <code>cleanup</code>
- method. However we didn't go as far as turning it into an MBean since
+ <code>init</code>, <code>waitForClose</code> and <code>cleanup</code>
+ method. However we didn't go as far as turning it into an MBean since
the application can be already easily started by registering an instance
- of <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+ of <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
title="The ScanManagerMXBean is the main MBean of the scandir application"
>ScanManagerMXBean</a>.
</p>
</ul>
<h3>Secure Client Class</h3>
<ul>
- <p>The <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirClient.html"
+ <p>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirClient.html"
title="The ScanDirClient class is a very short example of secure programmatic client"
>ScanDirClient</a> is an example class that shows how a
programmatic client can connect to a secured <i>scandir</i> application.
@@ -1596,18 +1596,18 @@
the example.
</p>
</ul>
-
+
<h2><a name="h2-Testing">Testing the <i>scandir</i> Example</a></h2>
<ul>
<p>Make sure that you have access to junit.jar (either 3.8.1 or 3.8.2).
- Make sure also that you have junit.jar in your
+ Make sure also that you have junit.jar in your
<code>CLASSPATH</code>.<br>
- Then in the example root directory (where the <code>build.xml</code>
+ Then in the example root directory (where the <code>build.xml</code>
file is located) run the following command:
<pre>ant test -Dlibs.junit.classpath=<i><u>path to junit jar (either 3.8.1 or 3.8.2)</u></i></pre>
</p>
- <p>Alternatively you can open the jmx-scandir project with the
- NetBeans IDE and test the jmx-scandir project from the
+ <p>Alternatively you can open the jmx-scandir project with the
+ NetBeans IDE and test the jmx-scandir project from the
<code>Run</code> menu.
</p>
@@ -1615,18 +1615,18 @@
<h2><a name="h2-Running">Running the <i>scandir</i> Example</a></h2>
<ul>
- <p>In the example root directory (where the <code>build.xml</code>
+ <p>In the example root directory (where the <code>build.xml</code>
file is located) run the following commands:
<pre>ant jar
ant run-single -Drun.class=com.sun.jmx.examples.scandir.ScanDirAgent -Djavac.includes=src</pre>
or simply <pre>ant run</pre>
</p>
-
+
<p>This will run the example using the configuration
file provided in the src/etc directory.
</p>
- <p>Alternatively you can open the jmx-scandir project with the
- NetBeans IDE. You can run the example by
+ <p>Alternatively you can open the jmx-scandir project with the
+ NetBeans IDE. You can run the example by
selecting the <code>ScanDirAgent</code> file
and run it with <code>Run File</code> in the
<code>Run</code> menu or simply
@@ -1639,10 +1639,10 @@
it with <a href="#JConsole">jconsole</a>.
</p>
<blockquote>
- <u>Note:</u> You can also run the <i>scandir</i>
- application directly from the <code>java</code>
+ <u>Note:</u> You can also run the <i>scandir</i>
+ application directly from the <code>java</code>
command line. Make sure to build the project jar
- first.
+ first.
<br>On Unix systems:
<pre>ant jar
java -Djava.util.logging.config.file=logging.properties \
@@ -1655,11 +1655,11 @@
-jar dist\jmx-scandir.jar</code></p>
</blockquote>
</ul>
-
+
<h2><a name="h2-Playing">Playing with JConsole</a></h2>
<ul>
<p>Run the example as explained in the previous section, so
- that it uses the provided <code>src/etc/testconfig.xml</code>
+ that it uses the provided <code>src/etc/testconfig.xml</code>
configuration file. Then start
jconsole. In the connection window choose the process that runs
<code>com.sun.jmx.examples.scandir.ScanDirAgent</code> or
@@ -1685,7 +1685,7 @@
</td></tr></table>
</center>
</p>
- <p>Open the MBeans tab, and look for the
+ <p>Open the MBeans tab, and look for the
<code>ScanDirConfigMXBean</code>.
Click on its <code>Attributes</code> node and double click on its
<code>Configuration</code> attribute, to look at
@@ -1694,79 +1694,79 @@
</p>
<p><center><a href="docfiles/scandir-config.jpg"
title="jconsole MBean tab: ScanDirConfigMXBean"
- ><img
+ ><img
src="docfiles/scandir-config.jpg"
alt="jconsole MBean tab: ScanDirConfigMXBean"
/></a></center>
</p>
<p>Now go to the <code>ScanManagerMXBean</code>, click on
its <code>Notifications</code> node, and subscribe
- for notifications. Then click on the
+ for notifications. Then click on the
<code>Operations</code> node and invoke the
<code>start()</code> operation:
</p>
<p><center><a href="docfiles/scandir-start.jpg"
title="jconsole MBean tab: ScanDirConfigMXBean"
- ><img
+ ><img
src="docfiles/scandir-start.jpg"
alt="jconsole MBean tab: ScanDirConfigMXBean"
/></a></center>
</p>
- <p>You can see that the notifications counter was
- incremented by three: you have just scheduled,
+ <p>You can see that the notifications counter was
+ incremented by three: you have just scheduled,
run, and completed a batch of directory scans.
</p>
<p>Now go to the <code>ResultLogManagerMXBean</code>,
- click on its <code>Attributes</code> node, and
+ click on its <code>Attributes</code> node, and
expand its <code>MemoryLog</code> attribute:
</p>
<p><center><a href="docfiles/scandir-result.jpg"
title="jconsole MBean tab: ScanDirConfigMXBean"
- ><img
+ ><img
src="docfiles/scandir-result.jpg"
alt="jconsole MBean tab: ScanDirConfigMXBean"
/></a></center>
</p>
<p>You can see that the directory scan results have
been logged.</p>
- <p>To make the application terminate go back to the
+ <p>To make the application terminate go back to the
<code>ScanManagerMXBean</code> and invoke
<code>close()</code>. The <code>ScanDirAgent</code>
- will receive the notification, step out of
+ will receive the notification, step out of
the application main thread, and the application
will terminate.
</p>
<p>This is of course a very limited scenario. Feel free
to improvise with all the features of the example, creating
- a new configuration -
+ a new configuration -
<code>ScanManagerMXBean.createOtherConfigurationMBean</code> -
adding multiple directory scanners to that configuration -
<code>ScanDirConfigMXBean.addDirectoryScanner</code> -
then switching the <code>ScanManagerMXBean</code> current
configuration by changing the value of the <i>ConfigurationMBean</i>
attribute - <code>ScanManagerMXBean.setConfigurationMBean</code>
- - then applying the new configuration -
- <code>ScanManagerMXBean.applyConfiguration(true)</code> -
- then scheduling repeated directory scans every 10 seconds -
- <code>ScanManagerMXBean.schedule(0,10000)</code> -
+ - then applying the new configuration -
+ <code>ScanManagerMXBean.applyConfiguration(true)</code> -
+ then scheduling repeated directory scans every 10 seconds -
+ <code>ScanManagerMXBean.schedule(0,10000)</code> -
subscribing for notifications, etc...
</p>
</ul>
-
+
<a name="secure"></a>
<h2><a name="h2-Turning">Turning the example into a Secure JMX Application</a></h2>
<ul>
<p>In this section, we will see how to configure and
start the <i>scandir</i> example so that the JVM agent
- is bootstrapped with a secure JMXConnectorServer. Indeed, until
- now we have only used the insecure local connection,
+ is bootstrapped with a secure JMXConnectorServer. Indeed, until
+ now we have only used the insecure local connection,
which can only be used as long as both the client and
the server run on the same machine. This section will
- explain how to start the <code>ScanDirAgent</code> so
+ explain how to start the <code>ScanDirAgent</code> so
that a real secure RMIConnectorServer is started at bootstrap.
</p>
<p>To achieve this we will: <a href="#management.properties"
- >provide our own management.properties</a>, <a
+ >provide our own management.properties</a>, <a
href="#password-access">create our own password and access files</a>,
<a href="#keystore-truststore">provide a keystore and truststore</a>,
<a href="#start-secure-agent">start the ScanDirAgent with the
@@ -1774,21 +1774,21 @@
</ul>
<h3>Configuring the JVM Agent for Secure Remote Connection</h3>
<ul>
- <p>The easiest way to <a name="management.properties">configure the
- JVM Agent</a> for Secure Remote
+ <p>The easiest way to <a name="management.properties">configure the
+ JVM Agent</a> for Secure Remote
Connection is to use your own <a
href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#properties"
title="This page describes the properties you can put in your management.properties file"
>management.properties</a> file.
- In this example, we have copied the default
- <code>$JRE/lib/management/management.properties</code>
+ In this example, we have copied the default
+ <code>$JRE/conf/management/management.properties</code>
file to the example's <code>src/etc</code> directory and
modified it in <a href="src/etc/management.properties"
title="our modified management.properties"
>this way</a>:
<ul>
- <li>We have set the RMI port to <u>4545</u> - this is just a
- random port number we have picked up. Feel free to use your
+ <li>We have set the RMI port to <u>4545</u> - this is just a
+ random port number we have picked up. Feel free to use your
own value suited to your environment.
<pre># For setting the JMX RMI agent port use the following line
com.sun.management.jmxremote.port=<b>4545</b></pre>
@@ -1801,26 +1801,26 @@
<pre># For using an SSL/TLS <b>protected</b> RMI Registry use the following line
com.sun.management.jmxremote.<b>registry.ssl</b>=<b>true</b></pre>
</li>
- <li>We have provided <a
+ <li>We have provided <a
href="src/etc/password.properties">our own password file</a>
<pre># For a non-default password file location use the following line
com.sun.management.jmxremote.password.file=<i>src/etc/password.properties</i></pre>
</li>
- <li>We have provided <a
+ <li>We have provided <a
href="src/etc/access.properties">our own access file</a>
<pre># For a non-default password file location use the following line
com.sun.management.jmxremote.access.file=<i>src/etc/access.properties</i></pre>
</li>
</ul>
<p>You will note that we haven't provided any value
- for the other security properties, like
+ for the other security properties, like
<code>com.sun.management.jmxremote.authenticate=true</code>,
because these properties already default to a value
- which enables security by default.
+ which enables security by default.
Note however that protecting the RMI Registry with SSL
improves the application security, but only as long as
mutual authentication is also switched on. Otherwise, just
- anybody would be able to connect to the registry and
+ anybody would be able to connect to the registry and
get the RMIServer stub.
</p>
<p>We do recommend that you <u>use the most secure configuration
@@ -1829,21 +1829,21 @@
mutual authentication</u>, as we show in this example.
</p>
<p>We will use the <code>com.sun.management.config.file</code>
- system property to pass our <a
+ system property to pass our <a
href="src/etc/management.properties">management.properties</a>
file to the <code>ScanDirAgent</code>.
</p>
</ul>
-
+
<h3>Creating a password and access file</h3>
<ul>
<p>As explained above, we have created our own
- <a href="src/etc/password.properties">password file</a>
- and <a href="src/etc/access.properties">access file</a>
+ <a href="src/etc/password.properties">password file</a>
+ and <a href="src/etc/access.properties">access file</a>
for <a name="password-access">access control and authorization</a>.
</p>
- <p>In the password file, we have defined two logins:
- <i>guest</i> and <i>admin</i>. The password for
+ <p>In the password file, we have defined two logins:
+ <i>guest</i> and <i>admin</i>. The password for
<i>guest</i> is <i>guestpasswd</i> and the password
for <i>admin</i> is <i>adminpasswd</i>.
</p>
@@ -1852,7 +1852,7 @@
access, while the <i>guest</i> login only has <i>read-only</i>.
</p>
<p>Before starting the <code>ScanDirAgent</code>, you will
- need to restrict access permission to the password file,
+ need to restrict access permission to the password file,
in such a way that nobody but you can read it. Otherwise, the
JVM Agent will refuse to start the JMXConnectorServer, as it will
fear that security can be compromised if other parties can
@@ -1863,7 +1863,7 @@
>here</a>.
</p>
<p>As we have seen above, the location
- of our access and password files is configured in our own <a
+ of our access and password files is configured in our own <a
href="src/etc/management.properties">management.properties</a>
file.
</p>
@@ -1874,17 +1874,17 @@
client and server will need a <a name="keystore-truststore"
>keystore and a truststore</a>
to store their own certificates, and the certificates of
- the parties they trust. Usually, client and server will
- have their own keystore and truststore.
+ the parties they trust. Usually, client and server will
+ have their own keystore and truststore.
</p>
<p>For the sake of simplicity - and to get you started
without the tedious necessity of creating your own keystore
- and truststore, we are providing a dummy keystore and
+ and truststore, we are providing a dummy keystore and
truststore, containing a certificate self-signed by duke.
The password for our keystore is <i>password</i>, and the
password for our truststore is <i>trustword</i>.
We suggest that you first get the example running with the
- keystore and truststore we are providing before attempting
+ keystore and truststore we are providing before attempting
to use your own keystore and truststore.
</p>
<p>A secure application will obviously need to use its own
@@ -1895,9 +1895,9 @@
in <a
href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#SSL_enabled"
title="Monitoring and Management Using JMX"
- >here</a>.
- As shown <a href="#start-secure-agent">later</a>,
- we will need to use <a
+ >here</a>.
+ As shown <a href="#start-secure-agent">later</a>,
+ we will need to use <a
href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#SSL_enabled"
>system properties</a> to pass our truststore
and keystore to the <code>ScanDirAgent</code>.
@@ -1923,7 +1923,7 @@
</p>
<p>On Windows Systems:
<p><code>ant jar<br>
-java
+java
-Djava.util.logging.config.file=logging.properties
-Djavax.net.ssl.keyStore=keystore
-Djavax.net.ssl.keyStorePassword=password
@@ -1934,10 +1934,10 @@
-jar dist\jmx-scandir.jar</code></p>
</p>
<p>If you start jconsole now, you will see that you
- are still able to connect to the agent using the
+ are still able to connect to the agent using the
local connection. However, if you try to connect
- through the remote connector, using
- <a href="docfiles/remote-connection.jpg">localhost:4545</a>,
+ through the remote connector, using
+ <a href="docfiles/remote-connection.jpg">localhost:4545</a>,
the connection will <a href="docfiles/remote-connection-failed.jpg"
>fail</a>, even if you provide a correct login/password
pair. Indeed, since the JMXConnectorServer is now protected with SSL,
@@ -1946,18 +1946,18 @@
server too as the SSL configuration of the server requires mutual
authentication.
</p>
- <p>The next section will discuss how to connect to the
+ <p>The next section will discuss how to connect to the
secure agent.
</p>
</ul>
-
+
<h2><a name="h2-Connecting">Connecting to the Secure JMX Application</a></h2>
<ul>
<p>We will now see how to connect to the secure agent,
using jconsole, and using a programmatic client.
</p>
</ul>
-
+
<h3>Using jconsole to connect to the secure agent</h3>
<ul>
<p>The only special thing you need to do in order to
@@ -1968,8 +1968,8 @@
In our example, we use the same keystore/truststore
pair on the client and server side - but this is
not what a real application would do.
- Indeed a real application would have different
- certificates for the client and the server, and
+ Indeed a real application would have different
+ certificates for the client and the server, and
thus use different keystores (and probably truststores).
More information on SSL authentication can be obtained from the <a
href="http://java.sun.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#HowSSLWorks"
@@ -1977,20 +1977,20 @@
>Java<sup>TM</sup> Secure Socket Extension (JSSE) Reference Guide</a>.
</p>
<p>To start jconsole with our provided keystore and
- truststore, go to the scandir example root directory and
+ truststore, go to the scandir example root directory and
type in the following command:
- <p><code>jconsole
- -J-Djava.util.logging.config.file=logging.properties
- -J-Djavax.net.ssl.keyStore=keystore
- -J-Djavax.net.ssl.keyStorePassword=password
- -J-Djavax.net.ssl.trustStore=truststore
+ <p><code>jconsole
+ -J-Djava.util.logging.config.file=logging.properties
+ -J-Djavax.net.ssl.keyStore=keystore
+ -J-Djavax.net.ssl.keyStorePassword=password
+ -J-Djavax.net.ssl.trustStore=truststore
-J-Djavax.net.ssl.trustStorePassword=trustword</code></p>
</p>
<p>The <code>-J-Djava.util.logging.config.file=logging.properties</code>
flag is not mandatory, but passing a <code>logging.properties</code>
may help you debug connection problems if anything goes wrong.
</p>
- <p>In jconsole connection window, choose to connect to a
+ <p>In jconsole connection window, choose to connect to a
remote process, using the address <i>localhost:4545</i>
and the guest login:
</p>
@@ -2006,9 +2006,9 @@
<p><u>Note:</u> if jconsole fails to connect and show
you <a href="docfiles/remote-connection-failed.jpg">this screen</a>
you have probably misspelled some of the properties on jconsole
- command line, or you didn't start jconsole from the
+ command line, or you didn't start jconsole from the
scandir example root directory where our <code>truststore</code>
- and <code>keystore</code> files are located. This article - <a
+ and <code>keystore</code> files are located. This article - <a
href="http://blogs.sun.com/roller/page/jmxetc?entry=troubleshooting_connection_problems_in_jconsole"
title="Troubleshooting connection problems in JConsole"
>Troubleshooting connection problems in JConsole</a> - may help
@@ -2016,28 +2016,28 @@
</p>
<hr>
</ul>
-
+
<h3>Writing a programmatic client to connect to the secure agent</h3>
<ul>
<p>
- In this section we will show the steps involved in writing
+ In this section we will show the steps involved in writing
a programmatic client that will connect to our secure agent.
</p>
- <p>The <a
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirClient.html"
+ <p>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirClient.html"
title="The ScanDirClient class is a very short example of secure programmatic client"
>ScanDirClient</a> is an example class that shows how a
programmatic client can connect to a secured <i>scandir</i> application.
This class contains a <code>main</code> method which creates and
configures a <code>JMXConnector</code> client to connect with
- the secured <i>scandir</i> agent.
+ the secured <i>scandir</i> agent.
</p>
<p>The secure client differs only from a non secure client in
so far as it needs to use SSL RMI Factories and credentials to
connect to the secure agent. The steps required mainly involve:
<ul>
<li>Creating an empty environment map:
- <pre>
+ <pre>
// Create an environment map to hold connection properties
// like credentials etc... We will later pass this map
// to the JMX Connector.
@@ -2048,7 +2048,7 @@
</li>
<li>Putting the client's credentials in that map:
<i>(here the client will log in as <b>guest</b>)</i>
- <pre>
+ <pre>
// Provide the credentials required by the server
// to successfully perform user authentication
//
@@ -2058,7 +2058,7 @@
</li>
<li>Providing an <code>SslRMIClientSocketFactory</code> to interact
with the secure RMI Registry:
- <pre>
+ <pre>
// Provide the SSL/TLS-based RMI Client Socket Factory required
// by the JNDI/RMI Registry Service Provider to communicate with
// the SSL/TLS-protected RMI Registry
@@ -2078,20 +2078,20 @@
System.out.println("\nCreate the RMI connector client and " +
"connect it to the RMI connector server");
final JMXServiceURL url = new JMXServiceURL(
- "service:jmx:rmi:///jndi/rmi://"+args[0]+":"+args[1]+
+ "service:jmx:rmi:///jndi/rmi://"+args[0]+":"+args[1]+
"/jmxrmi");
final JMXConnector jmxc = JMXConnectorFactory.connect(url, env);
</pre>
</li>
</ul>
<p>For this to work, we also need to start the <code>ScanDirClient</code>
- with the appropriate system properties that will point to our
- <code>keystore</code> and <code>truststore</code>. To start the secure
+ with the appropriate system properties that will point to our
+ <code>keystore</code> and <code>truststore</code>. To start the secure
client, go to the <i>scandir</i> example root directory and type
the following command:
<p><code>ant jar<br>
-java
- -Djava.util.logging.config.file=logging.properties
+java
+ -Djava.util.logging.config.file=logging.properties
-Djavax.net.ssl.keyStore=keystore
-Djavax.net.ssl.keyStorePassword=password
-Djavax.net.ssl.trustStore=truststore
@@ -2140,7 +2140,7 @@
Invoke 'close' on ScanManagerMXBean
-Got expected security exception: java.lang.SecurityException: Access denied!
+Got expected security exception: java.lang.SecurityException: Access denied!
Invalid access level for requested MBeanServer operation.
Close the connection to the server
@@ -2148,31 +2148,31 @@
Bye! Bye!
</pre>
</td></tr></table></center>
- <p>If the <code>ScanDirClient</code> fails to connect with
- the secure agent, then this article - <a
+ <p>If the <code>ScanDirClient</code> fails to connect with
+ the secure agent, then this article - <a
href="http://blogs.sun.com/roller/page/jmxetc?entry=troubleshooting_connection_problems_in_jconsole"
title="Troubleshooting connection problems in JConsole"
>Troubleshooting connection problems in JConsole</a> - may help
you figure out what is going wrong. Indeed the connection steps
performed by the <code>ScanDirClient</code> are very similar to
those performed by <code>jconsole</code>, and the problems you
- could encounter are identical. Just remember that
+ could encounter are identical. Just remember that
<code>jconsole</code> needs the extra <code>-J</code> flag to pass
system properties to the VM, which is not needed with regular
<code>java</code> launcher invocations.
</p>
</ul>
-
+
<h2><a name="h2-Conclusion">Conclusion</a></h2>
<ul>
<p>
- In this document, we have presented an advanced
- JMX example, and shown how to run a secure
- JMX agent in a production environment.
- We have also shown how to connect to such a
- secure agent with both jconsole and a programmatic
- client. We have also discuss various JMX
- design-patterns and best practices.
+ In this document, we have presented an advanced
+ JMX example, and shown how to run a secure
+ JMX agent in a production environment.
+ We have also shown how to connect to such a
+ secure agent with both jconsole and a programmatic
+ client. We have also discuss various JMX
+ design-patterns and best practices.
Readers who would wish to learn more about JMX, and
Monitoring and Management of the JVM, are invited
to follow the links given in reference below.
@@ -2184,26 +2184,26 @@
>JMX Best Practices</a>: This document describes best practices that
have been identified for modeling using the JMX API. </li>
<li><a href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html"
- >Monitoring and Management Using JMX</a>: How to enable, configure, and
- connect to the JVM JMX agent.</li>
- <li><a name="JConsole"><a
+ >Monitoring and Management Using JMX</a>: How to enable, configure, and
+ connect to the JVM JMX agent.</li>
+ <li><a name="JConsole"><a
href="http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html"
>Using JConsole</a>: JConsole is a JMX-Compliant monitoring tool which allows
you to interact graphically with your own MBeans.
</li>
<li><a href="http://java.sun.com/javase/6/docs/technotes/guides/management/"
- >Monitoring and Management for the Java Platform</a>: The Java Platform
- Standard Edition (Java SE) 6 provides comprehensive monitoring and
+ >Monitoring and Management for the Java Platform</a>: The Java Platform
+ Standard Edition (Java SE) 6 provides comprehensive monitoring and
management support for the Java platform. </li>
<li><a href="http://java.sun.com/products/JavaManagement/community/jmx_blogs.html"
- >List of JMX-related Blogs</a>: This page provides links to the
- different web logs written by members of the Sun team working on the
+ >List of JMX-related Blogs</a>: This page provides links to the
+ different web logs written by members of the Sun team working on the
JMX API.</li>
<li><a
href="http://java.sun.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#HowSSLWorks"
title="The JSSE Reference Guide"
>Java<sup>TM</sup> Secure Socket Extension (JSSE) Reference Guide</a>:
- comprehensive documentation about the Java<sup>TM</sup> Secure Socket
+ comprehensive documentation about the Java<sup>TM</sup> Secure Socket
Extension (JSSE)
</li>
<li><a href="http://java.sun.com/javase/6/docs/"
--- a/jdk/src/sample/share/jmx/jmx-scandir/src/etc/access.properties Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/sample/share/jmx/jmx-scandir/src/etc/access.properties Wed Jul 05 20:08:34 2017 +0200
@@ -8,9 +8,9 @@
# passwords. To be functional, a role must have an entry in
# both the password and the access files.
#
-# Default location of this file is $JRE/lib/management/jmxremote.access
-# You can specify an alternate location by specifying a property in
-# the management config file $JRE/lib/management/management.properties
+# Default location of this file is $JRE/conf/management/jmxremote.access
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/conf/management/management.properties
# (See that file for details)
#
# The file format for password and access files is syntactically the same
@@ -30,9 +30,9 @@
# that changes the environment of the running program.
# "readwrite" grants access to read and write attributes of MBeans,
# to invoke operations on them, and to create or remove them.
-# This access should be granted to only trusted clients,
+# This access should be granted to only trusted clients,
# since they can potentially interfere with the smooth
-# operation of a running program
+# operation of a running program
#
# A given role should have at most one entry in this file. If a role
# has no entry, it has no access.
@@ -41,7 +41,7 @@
#
#
# Default access control entries:
-# o The "monitorRole" role has readonly access.
+# o The "monitorRole" role has readonly access.
# o The "controlRole" role has readwrite access.
#
# monitorRole readonly
--- a/jdk/src/sample/share/jmx/jmx-scandir/src/etc/management.properties Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/sample/share/jmx/jmx-scandir/src/etc/management.properties Wed Jul 05 20:08:34 2017 +0200
@@ -5,24 +5,24 @@
# The Management Configuration file (in java.util.Properties format)
# will be read if one of the following system properties is set:
# -Dcom.sun.management.jmxremote.port=<port-number>
-# or -Dcom.sun.management.snmp.port=<port-number>
+# or -Dcom.sun.management.snmp.port=<port-number>
# or -Dcom.sun.management.config.file=<this-file>
#
# The default Management Configuration file is:
#
-# $JRE/lib/management/management.properties
+# $JRE/conf/management/management.properties
#
# Another location for the Management Configuration File can be specified
# by the following property on the Java command line:
#
# -Dcom.sun.management.config.file=<this-file>
-#
+#
# If -Dcom.sun.management.config.file=<this-file> is set, the port
-# number for the management agent can be specified in the config file
+# number for the management agent can be specified in the config file
# using the following lines:
-#
+#
# ################ Management Agent Port #########################
-#
+#
# For setting the JMX RMI agent port use the following line
com.sun.management.jmxremote.port=4545
#
@@ -45,7 +45,7 @@
# Refer to the specification for the java.lang.management.ThreadMBean
# interface - see isThreadContentionMonitoringSupported() method.
#
-
+
# To enable thread contention monitoring, uncomment the following line
# com.sun.management.enableThreadContentionMonitoring
@@ -53,9 +53,9 @@
# SNMP Management Properties
#####################################################################
#
-# If the system property -Dcom.sun.management.snmp.port=<port-number>
+# If the system property -Dcom.sun.management.snmp.port=<port-number>
# is set then
-# - The SNMP agent (with the Java virtual machine MIB) is started
+# - The SNMP agent (with the Java virtual machine MIB) is started
# that listens on the specified port for incoming SNMP requests.
# - the following properties for read for SNMP management.
#
@@ -89,7 +89,7 @@
#
# The format of the value for that property is any string accepted
# by java.net.InetAddress.getByName(String).
-#
+#
# For restricting the port on which SNMP agent listens use the following line
# com.sun.management.snmp.interface=<InetAddress>
@@ -110,15 +110,15 @@
# com.sun.management.snmp.acl.file=filepath
# Specifies location for ACL file
# This is optional - default location is
-# $JRE/lib/management/snmp.acl
-#
+# $JRE/conf/management/snmp.acl
+#
# If the property "com.sun.management.snmp.acl" is set to false,
# then this property and the ACL file are ignored.
# Otherwise the ACL file must exist and be in the valid format.
# If the ACL file is empty or non existent then no access is allowed.
-#
-# The SNMP agent will read the ACL file at startup time.
-# Modification to the ACL file has no effect to any running SNMP
+#
+# The SNMP agent will read the ACL file at startup time.
+# Modification to the ACL file has no effect to any running SNMP
# agents which read that ACL file at startup.
#
@@ -131,7 +131,7 @@
#
# If system property -Dcom.sun.management.jmxremote.port=<port-number>
# is set then
-# - A MBean server is started
+# - A MBean server is started
# - JRE Platform MBeans are registered in the MBean server
# - RMI connector is published in a private readonly registry at
# specified port using a well known name, "jmxrmi"
@@ -140,7 +140,7 @@
# The configuration can be specified only at startup time.
# Later changes to above system property (e.g. via setProperty method),
# this config file, the password file, or the access file have no effect to the
-# running MBean server, the connector, or the registry.
+# running MBean server, the connector, or the registry.
#
#
@@ -149,7 +149,7 @@
# com.sun.management.jmxremote.ssl=true|false
# Default for this property is true. (Case for true/false ignored)
# If this property is specified as false then SSL is not used.
-#
+#
# For RMI monitoring without SSL use the following line
# com.sun.management.jmxremote.ssl=false
@@ -218,20 +218,20 @@
# ################ RMI Login configuration ###################
#
# com.sun.management.jmxremote.login.config=<config-name>
-# Specifies the name of a JAAS login configuration entry to use when
-# authenticating users of RMI monitoring.
+# Specifies the name of a JAAS login configuration entry to use when
+# authenticating users of RMI monitoring.
#
# Setting this property is optional - the default login configuration
# specifies a file-based authentication that uses the password file.
#
-# When using this property to override the default login configuration
-# then the named configuration entry must be in a file that gets loaded
+# When using this property to override the default login configuration
+# then the named configuration entry must be in a file that gets loaded
# by JAAS. In addition, the login module(s) specified in the configuration
-# should use the name and/or password callbacks to acquire the user's
-# credentials. See the NameCallback and PasswordCallback classes in the
+# should use the name and/or password callbacks to acquire the user's
+# credentials. See the NameCallback and PasswordCallback classes in the
# javax.security.auth.callback package for more details.
#
-# If the property "com.sun.management.jmxremote.authenticate" is set to
+# If the property "com.sun.management.jmxremote.authenticate" is set to
# false, then this property and the password & access files are ignored.
#
@@ -244,9 +244,9 @@
# com.sun.management.jmxremote.password.file=filepath
# Specifies location for password file
# This is optional - default location is
-# $JRE/lib/management/jmxremote.password
-#
-# If the property "com.sun.management.jmxremote.authenticate" is set to
+# $JRE/conf/management/jmxremote.password
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
# false, then this property and the password & access files are ignored.
# Otherwise the password file must exist and be in the valid format.
# If the password file is empty or non-existent then no access is allowed.
@@ -261,9 +261,9 @@
# com.sun.management.jmxremote.access.file=filepath
# Specifies location for access file
# This is optional - default location is
-# $JRE/lib/management/jmxremote.access
-#
-# If the property "com.sun.management.jmxremote.authenticate" is set to
+# $JRE/conf/management/jmxremote.access
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
# false, then this property and the password & access files are ignored.
# Otherwise, the access file must exist and be in the valid format.
# If the access file is empty or non-existent then no access is allowed.
--- a/jdk/src/sample/share/jmx/jmx-scandir/src/etc/password.properties Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/src/sample/share/jmx/jmx-scandir/src/etc/password.properties Wed Jul 05 20:08:34 2017 +0200
@@ -8,9 +8,9 @@
# access for each role. To be functional, a role must have an entry
# in both the password and the access files.
#
-# Default location of this file is $JRE/lib/management/jmxremote.password
-# You can specify an alternate location by specifying a property in
-# the management config file $JRE/lib/management/management.properties
+# Default location of this file is $JRE/conf/management/jmxremote.password
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/conf/management/management.properties
# or by specifying a system property (See that file for details).
@@ -19,7 +19,7 @@
##############################################################
# Since there are cleartext passwords stored in this file,
# this file must be readable by ONLY the owner,
-# otherwise the program will exit with an error.
+# otherwise the program will exit with an error.
#
# The file format for password and access files is syntactically the same
# as the Properties file format. The syntax is described in the Javadoc
--- a/jdk/test/ProblemList.txt Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/ProblemList.txt Wed Jul 05 20:08:34 2017 +0200
@@ -138,6 +138,9 @@
# 8058492
java/lang/management/ThreadMXBean/FindDeadlocks.java generic-all
+# 8058506
+java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java generic-all
+
############################################################################
# jdk_jmx
@@ -209,6 +212,9 @@
# 7195095
sun/rmi/transport/proxy/EagerHttpFallback.java generic-all
+# 8062724
+java/rmi/activation/Activatable/extLoadedImpl/ext.sh generic-all
+
############################################################################
# jdk_security
@@ -220,6 +226,9 @@
# 8051952: Unreachable.java test failing on Windows
sun/security/krb5/auto/Unreachable.java windows-all,macosx-all
+# 8058849
+sun/security/krb5/config/dns.sh generic-all
+
# 6988842: 4 tests failing on Solaris 5.10
sun/security/pkcs11/Secmod/AddPrivateKey.java solaris-all
sun/security/pkcs11/ec/ReadCertificates.java solaris-all
@@ -233,6 +242,9 @@
# 8049312
com/sun/crypto/provider/Cipher/AES/CICO.java generic-all
+# 8062758
+java/security/Security/ClassLoaderDeadlock/Deadlock2.sh generic-all
+
############################################################################
# jdk_sound
@@ -254,7 +266,8 @@
# jdk_tools
# Tests take too long, on sparcs see 7143279
-tools/pack200/CommandLineTests.java solaris-all,macosx-all
+# also see 8059906
+tools/pack200/CommandLineTests.java
tools/pack200/Pack200Test.java solaris-all,macosx-all
# 8007410
@@ -282,9 +295,6 @@
# 8058616
com/sun/jdi/RedefinePop.sh generic-all
-# 8061114
-com/sun/jdi/Redefine-g.sh generic-all
-
############################################################################
# jdk_util
@@ -292,6 +302,25 @@
# 8051641
sun/util/calendar/zi/TestZoneInfo310.java generic-all
+# 8062588
+java/util/Locale/LocaleProviders.sh generic-all
+java/util/PluggableLocale/BreakIteratorProviderTest.sh generic-all
+java/util/PluggableLocale/CalendarDataProviderTest.sh generic-all
+java/util/PluggableLocale/CalendarNameProviderTest.sh generic-all
+java/util/PluggableLocale/CollatorProviderTest.sh generic-all
+java/util/PluggableLocale/CurrencyNameProviderTest.sh generic-all
+java/util/PluggableLocale/DateFormatProviderTest.sh generic-all
+java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh generic-all
+java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh generic-all
+java/util/PluggableLocale/GenericTest.sh generic-all
+java/util/PluggableLocale/LocaleNameProviderTest.sh generic-all
+java/util/PluggableLocale/NumberFormatProviderTest.sh generic-all
+java/util/PluggableLocale/TimeZoneNameProviderTest.sh generic-all
+java/util/ResourceBundle/Bug6299235Test.sh generic-all
+
+# 8062512
+java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.java generic-all
+
############################################################################
# jdk_instrument
@@ -318,7 +347,7 @@
# 8057732
sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java generic-all
-# 8060736
-sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all
+# 8060088
+com/sun/tracing/BasicWithSecurityMgr.java generic-all
############################################################################
--- a/jdk/test/TEST.groups Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/TEST.groups Wed Jul 05 20:08:34 2017 +0200
@@ -182,6 +182,8 @@
#
core_tools = \
tools \
+ jdk/internal/jimage \
+ jdk/internal/jrtfs \
sun/tools/java \
sun/tools/native2ascii \
sun/tools/jrunscript
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ClassLoader/EndorsedDirs.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8060206
+ * @summary Endorsed standards and override mechanism is removed
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+public class EndorsedDirs {
+ public static void main(String arg[]) throws Exception {
+ String value = System.getProperty("java.endorsed.dirs");
+ if (value != null) {
+ throw new RuntimeException("java.endorsed.dirs not removed: " + value);
+ }
+
+ fatalError("-Djava.endorsed.dirs=foo");
+ }
+
+ static void fatalError(String... args) throws Exception {
+ List<String> commands = new ArrayList<>();
+ String java = System.getProperty("java.home") + "/bin/java";
+ commands.add(java);
+ for (String s : args) {
+ commands.add(s);
+ }
+ String cpath = System.getProperty("test.classes", ".");
+ commands.add("-cp");
+ commands.add(cpath);
+ commands.add("EndorsedDirs");
+
+ ProcessBuilder processBuilder = new ProcessBuilder(commands);
+ final Process process = processBuilder.start();
+ BufferedReader errorStream = new BufferedReader(
+ new InputStreamReader(process.getErrorStream()));
+ BufferedReader outStream = new BufferedReader(
+ new InputStreamReader(process.getInputStream()));
+ String errorLine;
+ StringBuilder errors = new StringBuilder();
+ String outLines;
+ while ((errorLine = errorStream.readLine()) != null) {
+ errors.append(errorLine).append("\n");
+ }
+ while ((outLines = outStream.readLine()) != null) {
+ System.out.println(outLines);
+ }
+ errorLine = errors.toString();
+ System.err.println(errorLine);
+ process.waitFor(1000, TimeUnit.MILLISECONDS);
+ int exitStatus = process.exitValue();
+ if (exitStatus == 0) {
+ throw new RuntimeException("Expect fatal error");
+ }
+ if (!errorLine.contains("Could not create the Java Virtual Machine")) {
+ throw new RuntimeException(errorLine);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ClassLoader/ExtDirs.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8060206
+ * @summary Extension mechanism is removed
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+public class ExtDirs {
+ public static void main(String arg[]) throws Exception {
+ String value = System.getProperty("java.ext.dirs");
+ if (value != null) {
+ throw new RuntimeException("java.ext.dirs not removed: " + value);
+ }
+
+ fatalError("-Djava.ext.dirs=foo");
+ }
+
+ static void fatalError(String... args) throws Exception {
+ List<String> commands = new ArrayList<>();
+ String java = System.getProperty("java.home") + "/bin/java";
+ commands.add(java);
+ for (String s : args) {
+ commands.add(s);
+ }
+ String cpath = System.getProperty("test.classes", ".");
+ commands.add("-cp");
+ commands.add(cpath);
+ commands.add("ExtDirs");
+
+ ProcessBuilder processBuilder = new ProcessBuilder(commands);
+ final Process process = processBuilder.start();
+ BufferedReader errorStream = new BufferedReader(
+ new InputStreamReader(process.getErrorStream()));
+ BufferedReader outStream = new BufferedReader(
+ new InputStreamReader(process.getInputStream()));
+ String errorLine;
+ StringBuilder errors = new StringBuilder();
+ String outLines;
+ while ((errorLine = errorStream.readLine()) != null) {
+ errors.append(errorLine).append("\n");
+ }
+ while ((outLines = outStream.readLine()) != null) {
+ System.out.println(outLines);
+ }
+ errorLine = errors.toString();
+ System.err.println(errorLine);
+ process.waitFor(1000, TimeUnit.MILLISECONDS);
+ int exitStatus = process.exitValue();
+ if (exitStatus == 0) {
+ throw new RuntimeException("Expect fatal error");
+ }
+ if (!errorLine.contains("Could not create the Java Virtual Machine")) {
+ throw new RuntimeException(errorLine);
+ }
+ }
+}
--- a/jdk/test/java/lang/ClassLoader/getdotresource.sh Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/java/lang/ClassLoader/getdotresource.sh Wed Jul 05 20:08:34 2017 +0200
@@ -23,8 +23,6 @@
# questions.
#
-#
-
if [ x"$TESTJAVA" = x ]; then
TESTJAVA=$1
shift
@@ -32,6 +30,19 @@
if [ x"$TESTCLASSES" = x ]; then TESTCLASSES=.; fi
if [ x"$TESTSRC" = x ]; then TESTSRC=.; fi
+OS=`uname -s`
+case "$OS" in
+ Windows* | CYGWIN* )
+ PS=";"
+ FS="\\"
+ ;;
+ * )
+ PS=":"
+ FS="/"
+ ;;
+esac
+
# now start the test
-${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.ext.dirs=$TESTSRC -cp $TESTCLASSES GetDotResource
+${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTSRC}${FS}resource.jar${PS}${TESTCLASSES} GetDotResource
+
--- a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java Wed Jul 05 20:08:34 2017 +0200
@@ -78,12 +78,14 @@
"com.sun.org.apache.xml.internal.serializer.utils.",
"com.sun.org.apache.xml.internal.utils.",
"com.sun.org.glassfish.",
+ "com.sun.tools.script.",
"com.oracle.xmlns.internal.",
"com.oracle.webservices.internal.",
"org.jcp.xml.dsig.internal.",
"jdk.internal.",
"jdk.nashorn.internal.",
"jdk.nashorn.tools.",
+ "jdk.tools.jimage.",
"com.sun.activation.registries."
};
--- a/jdk/test/java/lang/invoke/lambda/LUtils.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/java/lang/invoke/lambda/LUtils.java Wed Jul 05 20:08:34 2017 +0200
@@ -43,12 +43,10 @@
static final String JAVAHOME = System.getProperty("java.home");
static final boolean isWindows =
System.getProperty("os.name", "unknown").startsWith("Windows");
- //static final boolean isSDK = JAVAHOME.endsWith("jre");
static final File JAVA_BIN_FILE = new File(JAVAHOME, "bin");
static final File JAVA_CMD = new File(JAVA_BIN_FILE,
isWindows ? "java.exe" : "java");
- static final File JAR_BIN_FILE =
- new File(new File(JAVAHOME).getParentFile(), "bin");
+ static final File JAR_BIN_FILE = new File(JAVAHOME, "bin");
static final File JAR_CMD = new File(JAR_BIN_FILE,
isWindows ? "jar.exe" : "jar");
--- a/jdk/test/java/net/NetworkInterface/IPv4Only.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/java/net/NetworkInterface/IPv4Only.java Wed Jul 05 20:08:34 2017 +0200
@@ -23,7 +23,7 @@
/* @test
* @bug 6964714
- * @run main/othervm IPv4Only
+ * @run main/othervm -Djava.net.preferIPv4Stack=true IPv4Only
* @summary Test the networkinterface listing with java.net.preferIPv4Stack=true.
*/
@@ -34,8 +34,6 @@
public class IPv4Only {
public static void main(String[] args) throws Exception {
- System.setProperty("java.net.preferIPv4Stack","true");
-
Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces();
while (nifs.hasMoreElements()) {
NetworkInterface nif = nifs.nextElement();
--- a/jdk/test/java/nio/charset/spi/basic.sh Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/java/nio/charset/spi/basic.sh Wed Jul 05 20:08:34 2017 +0200
@@ -57,23 +57,23 @@
esac
JARD=$DIR/x.jar
-EXTD=$DIR/x.ext
+APPD=$DIR/x.ext
TESTD=$DIR/x.test
CSS='US-ASCII 8859_1 iso-ir-6 UTF-16 windows-1252 !BAR cp1252'
-if [ \! -d $EXTD ]; then
+if [ \! -d $APPD ]; then
# Initialize
echo Initializing...
- rm -rf $JARD $EXTD $TESTD
+ rm -rf $JARD $APPD $TESTD
mkdir -p $JARD/META-INF/services x.ext
echo FooProvider \
>$JARD/META-INF/services/java.nio.charset.spi.CharsetProvider
cp $TESTCLASSES/FooProvider.class $TESTCLASSES/FooCharset.class $JARD
mkdir $TESTD
cp $TESTCLASSES/Test.class $TESTD
- (cd $JARD; $JAR ${TESTTOOLVMOPTS} -cf $EXTD/test.jar *)
+ (cd $JARD; $JAR ${TESTTOOLVMOPTS} -cf $APPD/test.jar *)
fi
if [ $# -gt 0 ]; then
@@ -96,15 +96,13 @@
cd $TMP
failures=0
-for where in ext app; do
+for where in app; do
for security in none minimal-policy cp-policy; do
echo '';
echo "LC_ALL=$LC_ALL where=$where security=$security"
av=''
- if [ $where = ext ]; then
- av="$av -cp $TESTD -Djava.ext.dirs=$EXTD";
- else
- av="$av -cp $TESTD$CPS$EXTD/test.jar";
+ if [ $where = app ]; then
+ av="$av -cp $TESTD$CPS$APPD/test.jar";
fi
case $security in
none) css="$CSS FOO";;
--- a/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh Wed Jul 05 20:08:34 2017 +0200
@@ -89,11 +89,7 @@
if [ -d testlib ] ; then
rm -rf testlib
fi
-if [ -d ${TESTJAVA}${FILESEP}lib${FILESEP}ext ] ; then
- cp -r ${TESTJAVA}${FILESEP}lib${FILESEP}ext testlib
-else
- cp -r ${TESTJAVA}${FILESEP}jre${FILESEP}lib${FILESEP}ext testlib
-fi
+mkdir testlib
# compile and package the test program
${COMPILEJAVA}${FILESEP}bin${FILESEP}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
@@ -109,7 +105,8 @@
# create serialized object and run the test
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} CreateSerialized
-${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} -Djava.ext.dirs=${TESTCLASSES}${FILESEP}testlib Deadlock2
+${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \
+ -Djava.ext.dirs=${TESTCLASSES}${FILESEP}testlib${PATHSEP}${TESTJAVA}${FILESEP}lib${FILESEP}ext Deadlock2
STATUS=$?
# clean up
--- a/jdk/test/java/util/Properties/LoadAndStoreXML.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/java/util/Properties/LoadAndStoreXML.java Wed Jul 05 20:08:34 2017 +0200
@@ -136,7 +136,7 @@
props.put("k2", "bar");
props.put("k3", "\u0020\u0391\u0392\u0393\u0394\u0395\u0396\u0397");
props.put("k4", "\u7532\u9aa8\u6587");
- props.put("k5", "<java.home>/lib/jaxp.properties");
+ props.put("k5", "<java.home>/conf/jaxp.properties");
TestOutputStream out = new TestOutputStream();
props.storeToXML(out, null, encoding);
--- a/jdk/test/java/util/ServiceLoader/basic.sh Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/java/util/ServiceLoader/basic.sh Wed Jul 05 20:08:34 2017 +0200
@@ -44,16 +44,20 @@
OS=`uname -s`
case "$OS" in
SunOS | Darwin | AIX )
+ FS='/'
SEP=':' ;;
Linux )
+ FS='/'
SEP=':' ;;
* )
+ FS='\\'
SEP='\;' ;;
esac
JARD=x.jar
EXTD=x.ext
TESTD=x.test
+P3JAR=${EXTD}${FS}p3.jar
if [ \! -d $EXTD ]; then
# Initialize
@@ -103,8 +107,7 @@
# Java-level tests
T=Basic
-go ".${SEP}$TESTD${SEP}p2.jar" "-Djava.ext.dirs=$EXTD"
-
+go ".${SEP}$TESTD${SEP}p2.jar" ""
# Success cases
@@ -114,19 +117,15 @@
go ".${SEP}p2.jar" "" FooProvider2
-go "" "-Djava.ext.dirs=$EXTD" FooProvider3
+go "${P3JAR}${SEP}p2.jar" "" FooProvider3 FooProvider2
go "$TESTD${SEP}p2.jar" "" FooProvider1 FooProvider2
-go "$TESTD" "-Djava.ext.dirs=$EXTD" FooProvider3 FooProvider1
+go "${P3JAR}${SEP}$TESTD" "" FooProvider3 FooProvider1
-go "$TESTD${SEP}p2.jar" "-Djava.ext.dirs=$EXTD" \
+go "${P3JAR}${SEP}$TESTD${SEP}p2.jar" "" \
FooProvider3 FooProvider1 FooProvider2
-# Should only find the installed provider
-go "$TESTD${SEP}p2.jar" "-Djava.ext.dirs=$EXTD" -i FooProvider3
-
-
# Failure cases
mkdir -p x.meta/META-INF/services
@@ -141,8 +140,8 @@
echo FooProvider42 >x.meta/META-INF/services/FooService
go "$TESTD${SEP}x.meta" "" FooProvider1 fail
go "x.meta${SEP}$TESTD" "" fail FooProvider1
-go "$TESTD${SEP}x.meta${SEP}${SEP}p2.jar" "-Djava.ext.dirs=$EXTD" \
- FooProvider3 FooProvider1 fail FooProvider2
+go "$TESTD${SEP}x.meta${SEP}${SEP}p2.jar" "" \
+ FooProvider1 fail FooProvider2
# Summary
--- a/jdk/test/java/util/prefs/PrefsSpi.sh Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/java/util/prefs/PrefsSpi.sh Wed Jul 05 20:08:34 2017 +0200
@@ -100,8 +100,5 @@
Sys "$java" ${TESTVMOPTS} "-cp" "$TESTCLASSES${CPS}extDir/PrefsSpi.jar" \
-Djava.util.prefs.userRoot=. \
PrefsSpi "StubPreferences"
-Sys "$java" ${TESTVMOPTS} "-cp" "$TESTCLASSES" "-Djava.ext.dirs=extDir" \
- -Djava.util.prefs.userRoot=. \
- PrefsSpi "StubPreferences"
rm -rf jarDir extDir
--- a/jdk/test/javax/crypto/sanity/CheckManifestForRelease.java Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 7197071
- * @summary Makefiles for various security providers aren't including
- * the default manifest.
- */
-import java.net.*;
-import java.io.*;
-
-/**
- * When the Java specification version is incremented, all of the providers
- * must be recompiled with the proper implementation version to match.
- */
-public class CheckManifestForRelease {
-
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) throws Exception {
- checkFileManifests();
- }
-
- /*
- * Iterate over the files of interest: JCE framework and providers
- */
- static private void checkFileManifests() throws Exception {
- System.out.println("=============");
- String libDirName = System.getProperty("java.home", ".") + "/lib";
- String extDirName = libDirName + "/ext";
-
- System.out.println("Checking Manifest in directory: \n " +
- extDirName);
-
- /*
- * Current list of JCE providers, all of which currently live in
- * the extensions directory. Add if more are created.
- */
- String[] providers = new String[]{
- "sunjce_provider.jar",
- "sunec.jar",
- "sunmscapi.jar",
- "sunpkcs11.jar",
- "ucrypto.jar"
- };
-
- checkManifest(libDirName, "jce.jar");
- for (String provider : providers) {
- checkManifest(extDirName, provider);
- }
- System.out.println("Passed.");
- }
-
- // Helper method to format the URL properly.
- static private String formatURL(String dir, String file) {
- return "jar:file:///" + dir + "/" + file + "!/";
- }
-
- static private String specVersion =
- System.getProperty("java.specification.version");
-
- /*
- * Test the root cause, which is that there were no manifest values
- * for many of the providers, and for those that had them, there was
- * no test to make sure that the impl version was appropriate for
- * the spec version.
- */
- static private void checkManifest(String dir, String file)
- throws Exception {
-
- System.out.println("Checking: " + file);
-
- String url = formatURL(dir, file);
- JarURLConnection urlc =
- (JarURLConnection) (new URL(url).openConnection());
-
- String implVersion;
- try {
- implVersion = urlc.getManifest().getMainAttributes().getValue(
- "Implementation-Version");
- } catch (FileNotFoundException e) {
- /*
- * If the file doesn't exist (e.g. mscapi on solaris),
- * skip it. If there are other problems, fail out.
- */
- System.out.println(" " + file + " not found, skipping...");
- return;
- }
-
- if (implVersion == null) {
- throw new Exception(
- "Implementation-Version not found in Manifest");
- }
-
- if (!implVersion.startsWith(specVersion)) {
- throw new Exception(
- "Implementation-Version does not match " +
- "Specification-Version");
- }
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/internal/jimage/VerifyJimage.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Deque;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import jdk.internal.jimage.BasicImageReader;
+import jdk.internal.jimage.ImageLocation;
+
+/*
+ * @test
+ * @summary Verify jimage
+ * @run main/othervm VerifyJimage
+ */
+
+/**
+ * This test runs in two modes:
+ * (1) No argument: it verifies the jimage by loading all classes in the runtime
+ * (2) path of exploded modules: it compares bytes of each file in the exploded
+ * module with the entry in jimage
+ *
+ * FIXME: exception thrown when findLocation from jimage by multiple threads
+ * -Djdk.test.threads=<n> to specify the number of threads.
+ */
+public class VerifyJimage {
+ private static final Deque<String> failed = new ConcurrentLinkedDeque<>();
+
+ public static void main(String... args) throws Exception {
+ long start = System.nanoTime();
+ int numThreads = Integer.getInteger("jdk.test.threads", 1);
+ List<JImageReader> readers = newJImageReaders();
+ VerifyJimage verify = new VerifyJimage(readers, numThreads);
+ if (args.length == 0) {
+ // load classes from jimage
+ verify.loadClasses();
+ } else {
+ Path dir = Paths.get(args[0]);
+ if (Files.notExists(dir) || !Files.isDirectory(dir)) {
+ throw new RuntimeException("Invalid argument: " + dir);
+ }
+ verify.compareExplodedModules(dir);
+ }
+ verify.waitForCompletion();
+ long end = System.nanoTime();
+ int entries = readers.stream()
+ .mapToInt(JImageReader::entries)
+ .sum();
+ System.out.format("%d entries %d files verified: %d ms %d errors%n",
+ entries, verify.count.get(),
+ TimeUnit.NANOSECONDS.toMillis(end - start), failed.size());
+ for (String f : failed) {
+ System.err.println(f);
+ }
+ }
+
+ private final AtomicInteger count = new AtomicInteger(0);
+ private final List<JImageReader> readers;
+ private final ExecutorService pool;
+
+ VerifyJimage(List<JImageReader> readers, int numThreads) {
+ this.readers = readers;
+ this.pool = Executors.newFixedThreadPool(numThreads);
+ }
+
+ private void waitForCompletion() throws InterruptedException {
+ pool.shutdown();
+ pool.awaitTermination(20, TimeUnit.SECONDS);
+ }
+
+ private void compareExplodedModules(Path dir) throws IOException {
+ System.out.println("comparing jimage with " + dir);
+
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
+ for (Path mdir : stream) {
+ if (Files.isDirectory(mdir)) {
+ pool.execute(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Files.find(mdir, Integer.MAX_VALUE, (Path p, BasicFileAttributes attr)
+ -> !Files.isDirectory(p) &&
+ !mdir.relativize(p).toString().startsWith("_") &&
+ !p.getFileName().toString().equals("MANIFEST.MF"))
+ .forEach(p -> compare(mdir, p, readers));
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+ });
+ }
+ }
+ }
+ }
+
+ private final List<String> BOOT_RESOURCES = Arrays.asList(
+ "java.base/META-INF/services/java.nio.file.spi.FileSystemProvider"
+ );
+ private final List<String> EXT_RESOURCES = Arrays.asList(
+ "jdk.zipfs/META-INF/services/java.nio.file.spi.FileSystemProvider"
+ );
+ private final List<String> APP_RESOURCES = Arrays.asList(
+ "jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector",
+ "jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector"
+ );
+
+ private void compare(Path mdir, Path p, List<JImageReader> readers) {
+ String entry = mdir.relativize(p).toString().replace(File.separatorChar, '/');
+
+ count.incrementAndGet();
+ String file = mdir.getFileName().toString() + "/" + entry;
+ if (APP_RESOURCES.contains(file)) {
+ // skip until the service config file is merged
+ System.out.println("Skipped " + file);
+ return;
+ }
+
+ String jimage;
+ if (BOOT_RESOURCES.contains(file)) {
+ jimage = "bootmodules.jimage";
+ } else if (EXT_RESOURCES.contains(file)) {
+ jimage = "extmodules.jimage";
+ } else {
+ jimage = "";
+ }
+ JImageReader reader = readers.stream()
+ .filter(r -> r.findLocation(entry) != null)
+ .filter(r -> jimage.isEmpty() || r.imageName().equals(jimage))
+ .findFirst().orElse(null);
+ if (reader == null) {
+ failed.add(entry + " not found: " + p.getFileName().toString());
+ } else {
+ reader.compare(entry, p);
+ }
+ }
+
+ private void loadClasses() {
+ ClassLoader loader = ClassLoader.getSystemClassLoader();
+ for (JImageReader reader : readers) {
+ Arrays.stream(reader.getEntryNames())
+ .filter(n -> n.endsWith(".class"))
+ .forEach(n -> {
+ String cn = n.substring(0, n.length()-6).replace('/', '.');
+ count.incrementAndGet();
+ try {
+ Class.forName(cn, false, loader);
+ } catch (ClassNotFoundException e) {
+ failed.add(reader.imageName() + ": " + cn + " not found");
+ }
+ });
+ }
+ }
+
+
+ private static List<JImageReader> newJImageReaders() throws IOException {
+ String home = System.getProperty("java.home");
+ Path mlib = Paths.get(home, "lib", "modules");
+ try (Stream<Path> paths = Files.list(mlib)) {
+ Set<Path> jimages = paths.filter(p -> p.toString().endsWith(".jimage"))
+ .collect(Collectors.toSet());
+ List<JImageReader> result = new ArrayList<>();
+ for (Path jimage: jimages) {
+ result.add(new JImageReader(jimage));
+ System.out.println("opened " + jimage);
+ }
+ return result;
+ }
+ }
+
+ static class JImageReader extends BasicImageReader {
+ final Path jimage;
+ JImageReader(Path p) throws IOException {
+ super(p.toString());
+ this.jimage = p;
+ }
+
+ String imageName() {
+ return jimage.getFileName().toString();
+ }
+
+ int entries() {
+ return getHeader().getLocationCount();
+ }
+
+ void compare(String entry, Path p) {
+ try {
+ byte[] bytes = Files.readAllBytes(p);
+ byte[] imagebytes = getResource(entry);
+ if (!Arrays.equals(bytes, imagebytes)) {
+ failed.add(imageName() + ": bytes differs than " + p.toString());
+ }
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/internal/jrtfs/Basic.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,459 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Basic test of jrt file system provider
+ * @run testng Basic
+ */
+
+import java.io.InputStream;
+import java.io.DataInputStream;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.PathMatcher;
+import java.nio.file.Paths;
+import java.net.URI;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.stream.Stream;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
+
+/**
+ * Basic tests for jrt:/ file system provider.
+ */
+
+public class Basic {
+
+ // Checks that the given FileSystem is a jrt file system.
+ private void checkFileSystem(FileSystem fs) {
+ assertTrue(fs.provider().getScheme().equalsIgnoreCase("jrt"));
+ assertTrue(fs.isOpen());
+ assertTrue(fs.isReadOnly());
+ assertEquals(fs.getSeparator(), "/");
+
+ // one root
+ Iterator<Path> roots = fs.getRootDirectories().iterator();
+ assertTrue(roots.next().toString().equals("/"));
+ assertFalse(roots.hasNext());
+ }
+
+ @Test
+ public void testGetFileSystem() {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ checkFileSystem(fs);
+
+ // getFileSystem should return the same object each time
+ assertTrue(fs == FileSystems.getFileSystem(URI.create("jrt:/")));
+ }
+
+ @Test(expectedExceptions = UnsupportedOperationException.class)
+ public void testCloseFileSystem() throws Exception {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ fs.close(); // should throw UOE
+ }
+
+ @Test
+ public void testNewFileSystem() throws Exception {
+ FileSystem theFileSystem = FileSystems.getFileSystem(URI.create("jrt:/"));
+ Map<String, ?> env = Collections.emptyMap();
+ try (FileSystem fs = FileSystems.newFileSystem(URI.create("jrt:/"), env)) {
+ checkFileSystem(fs);
+ assertTrue(fs != theFileSystem);
+ }
+ }
+
+ @DataProvider(name = "knownClassFiles")
+ private Object[][] knownClassFiles() {
+ return new Object[][] {
+ { "/java.base/java/lang/Object.class" },
+ { "java.base/java/lang/Object.class" },
+ };
+ }
+
+ @Test(dataProvider = "knownClassFiles")
+ public void testKnownClassFiles(String path) throws Exception {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ Path classFile = fs.getPath(path);
+
+ assertTrue(Files.isRegularFile(classFile));
+ assertTrue(Files.size(classFile) > 0L);
+
+ // check magic number
+ try (InputStream in = Files.newInputStream(classFile)) {
+ int magic = new DataInputStream(in).readInt();
+ assertEquals(magic, 0xCAFEBABE);
+ }
+ }
+
+ @DataProvider(name = "knownDirectories")
+ private Object[][] knownDirectories() {
+ return new Object[][] {
+ { "/" },
+ { "." },
+ { "./" },
+ { "/." },
+ { "/./" },
+ { "/java.base/.." },
+ { "/java.base/../" },
+ { "/java.base/../." },
+ { "/java.base" },
+ { "/java.base/java/lang" },
+ { "java.base/java/lang" },
+ { "/java.base/java/lang/" },
+ { "java.base/java/lang/" }
+ };
+ }
+
+ @Test(dataProvider = "knownDirectories")
+ public void testKnownDirectories(String path) throws Exception {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ Path dir = fs.getPath(path);
+
+ assertTrue(Files.isDirectory(dir));
+
+ // directory should not be empty
+ try (Stream<Path> stream = Files.list(dir)) {
+ assertTrue(stream.count() > 0L);
+ }
+ try (Stream<Path> stream = Files.walk(dir)) {
+ assertTrue(stream.count() > 0L);
+ }
+ }
+
+ @DataProvider(name = "topLevelPkgDirs")
+ private Object[][] topLevelPkgDirs() {
+ return new Object[][] {
+ { "/java/lang" },
+ { "java/lang" },
+ { "/java/util" },
+ { "java/util" },
+ };
+ }
+
+ @Test(dataProvider = "topLevelPkgDirs")
+ public void testNotExists(String path) throws Exception {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ Path dir = fs.getPath(path);
+
+ // package directories should not be there at top level
+ assertTrue(Files.notExists(dir));
+ }
+
+ /**
+ * Test the URI of every file in the jrt file system
+ */
+ @Test
+ public void testToAndFromUri() throws Exception {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ Path top = fs.getPath("/");
+ try (Stream<Path> stream = Files.walk(top)) {
+ stream.forEach(path -> {
+ URI u = path.toUri();
+ assertTrue(u.getScheme().equalsIgnoreCase("jrt"));
+ assertFalse(u.isOpaque());
+ assertTrue(u.getAuthority() == null);
+ assertEquals(u.getPath(), path.toAbsolutePath().toString());
+ Path p = Paths.get(u);
+ assertEquals(p, path);
+ });
+ }
+ }
+
+ @Test
+ public void testDirectoryNames() throws Exception {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ Path top = fs.getPath("/");
+ // check that directory names do not have trailing '/' char
+ try (Stream<Path> stream = Files.walk(top)) {
+ stream.skip(1).filter(Files::isDirectory).forEach(path -> {
+ assertFalse(path.toString().endsWith("/"));
+ });
+ }
+ }
+
+ @DataProvider(name = "pathPrefixs")
+ private Object[][] pathPrefixes() {
+ return new Object[][] {
+ { "/" },
+ { "java.base/java/lang" },
+ { "./java.base/java/lang" },
+ { "/java.base/java/lang" },
+ { "/./java.base/java/lang" },
+ { "java.base/java/lang/" },
+ { "./java.base/java/lang/" },
+ { "/./java.base/java/lang/" },
+ };
+ }
+
+ @Test(dataProvider = "pathPrefixes")
+ public void testParentInDirList(String dir) throws Exception {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ Path base = fs.getPath(dir);
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(base)) {
+ for (Path entry: stream) {
+ assertTrue( entry.getParent().equals(base) );
+ }
+ }
+ }
+
+ @DataProvider(name = "dirStreamStringFilterData")
+ private Object[][] dirStreamStringFilterData() {
+ return new Object[][] {
+ { "/java.base/java/lang", "/reflect" },
+ { "/java.base/java/lang", "/Object.class" },
+ { "/java.base/java/util", "/stream" },
+ { "/java.base/java/util", "/List.class" },
+ };
+ }
+
+ @Test(dataProvider = "dirStreamStringFilterData")
+ public void testDirectoryStreamStringFilter(String dir, String filter) throws Exception {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ Path base = fs.getPath(dir);
+ try (DirectoryStream<Path> stream =
+ Files.newDirectoryStream(base, p->!p.toString().endsWith(filter))) {
+ for (Path entry: stream) {
+ assertFalse(entry.toString().contains(filter),
+ "filtered path seen: " + filter);
+ }
+ }
+
+ // make sure without filter, we do see that matching entry!
+ boolean seen = false;
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(base)) {
+ for (Path entry: stream) {
+ if (entry.toString().endsWith(filter)) {
+ seen = true;
+ break;
+ }
+ }
+ }
+
+ assertTrue(seen, "even without filter " + filter + " is missing");
+ }
+
+ @DataProvider(name = "dirStreamFilterData")
+ private Object[][] dirStreamFilterData() {
+ return new Object[][] {
+ {
+ "/",
+ (DirectoryStream.Filter<Path>)(Files::isDirectory),
+ "isDirectory"
+ },
+ {
+ "/java.base/java/lang",
+ (DirectoryStream.Filter<Path>)(Files::isRegularFile),
+ "isFile"
+ }
+ };
+ }
+
+ @Test(dataProvider = "dirStreamFilterData")
+ private void testDirectoryStreamFilter(String dir, DirectoryStream.Filter filter,
+ String name) throws Exception {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ Path base = fs.getPath(dir);
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(base, filter)) {
+ for (Path entry: stream) {
+ assertTrue(filter.accept(entry), "filtered path seen: " + name);
+ }
+ }
+
+ // make sure without filter, we do see that matching entry!
+ boolean seen = false;
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(base)) {
+ for (Path entry: stream) {
+ if (filter.accept(entry)) {
+ seen = true;
+ break;
+ }
+ }
+ }
+
+ assertTrue(seen, "even without filter " + name + " is missing");
+ }
+
+ @Test
+ private void testDirectoryStreamIterator() throws Exception {
+ // run the tests with null filter (no filter)
+ dirStreamIteratorTest(null);
+ // run the same tests with trivial "accept all" filter
+ dirStreamIteratorTest(p->true);
+ // two other non-trivial ones
+ dirStreamIteratorTest(Files::isDirectory);
+ dirStreamIteratorTest(Files::isRegularFile);
+ }
+
+ private void dirStreamIteratorTest(DirectoryStream.Filter<Path> filter)
+ throws Exception {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ // This test assumes at least there are two elements in "java/lang"
+ // package with any filter passed. don't change to different path here!
+ Path dir = fs.getPath("/java.base/java/lang");
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, filter)) {
+ Iterator<Path> itr = stream.iterator();
+ itr.hasNext();
+ Path path1 = itr.next();
+ // missing second hasNext call
+ Path path2 = itr.next();
+ assertNotEquals(path1, path2);
+ }
+
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, filter)) {
+ Iterator<Path> itr = stream.iterator();
+ // no hasNext calls at all
+ Path path1 = itr.next();
+ Path path2 = itr.next();
+ assertNotEquals(path1, path2);
+ }
+
+ int numEntries = 0;
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, filter)) {
+ Iterator<Path> itr = stream.iterator();
+ while (itr.hasNext()) {
+ numEntries++;
+ itr.next();
+ }
+
+ // reached EOF, next call should result in exception
+ try {
+ itr.next();
+ throw new AssertionError("should have thrown exception");
+ } catch (NoSuchElementException nsee) {
+ System.out.println("got NoSuchElementException as expected");
+ }
+ }
+
+ // redundant hasNext calls
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, filter)) {
+ Iterator<Path> itr = stream.iterator();
+ // any number of hasNext should definitely stay at first element
+ for (int i = 0; i < 2*numEntries; i++) {
+ itr.hasNext();
+ }
+
+ for (int j = 0; j < numEntries; j++) {
+ itr.next();
+ }
+ // exactly count number of entries!
+ assertFalse(itr.hasNext());
+ }
+ }
+
+ @DataProvider(name = "hiddenPaths")
+ private Object[][] hiddenPaths() {
+ return new Object[][] {
+ { "/META-INF" },
+ { "/META-INF/services" },
+ { "/META-INF/services/java.nio.file.spi.FileSystemProvider" },
+ { "/java.base/packages.offsets" },
+ { "/java.instrument/packages.offsets" },
+ { "/jdk.zipfs/packages.offsets" },
+ { "/java/lang" },
+ { "/java/util" },
+ };
+ }
+
+ @Test(dataProvider = "hiddenPaths")
+ public void testHiddenPathsNotExposed(String path) throws Exception {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ assertTrue(Files.notExists(fs.getPath(path)), path + " should not exist");
+ }
+
+ @DataProvider(name = "pathGlobPatterns")
+ private Object[][] pathGlobPatterns() {
+ return new Object[][] {
+ { "/*", "/java.base", true },
+ { "/*", "/java.base/java", false },
+ { "/j*", "/java.base", true },
+ { "/J*", "/java.base", false },
+ { "**.class", "/java.base/java/lang/Object.class", true },
+ { "**.java", "/java.base/java/lang/Object.class", false },
+ { "**java/*", "/java.base/java/lang", true },
+ { "**java/lang/ref*", "/java.base/java/lang/reflect", true },
+ { "**java/lang/ref*", "/java.base/java/lang/ref", true },
+ { "**java/lang/ref?", "/java.base/java/lang/ref", false },
+ { "**java/lang/{ref,refl*}", "/java.base/java/lang/ref", true },
+ { "**java/lang/{ref,refl*}", "/java.base/java/lang/reflect", true },
+ { "**java/[a-u]?*/*.class", "/java.base/java/util/Map.class", true },
+ { "**java/util/[a-z]*.class", "/java.base/java/util/TreeMap.class", false },
+ };
+ }
+
+ @Test(dataProvider = "pathGlobPatterns")
+ public void testGlobPathMatcher(String pattern, String path,
+ boolean expectMatch) throws Exception {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ PathMatcher pm = fs.getPathMatcher("glob:" + pattern);
+ Path p = fs.getPath(path);
+ assertTrue(Files.exists(p), path);
+ assertTrue(!(pm.matches(p) ^ expectMatch),
+ p + (expectMatch? " should match " : " should not match ") +
+ pattern);
+ }
+
+ @DataProvider(name = "pathRegexPatterns")
+ private Object[][] pathRegexPatterns() {
+ return new Object[][] {
+ { "/.*", "/java.base", true },
+ { "/[^/]*", "/java.base/java", false },
+ { "/j.*", "/java.base", true },
+ { "/J.*", "/java.base", false },
+ { ".*\\.class", "/java.base/java/lang/Object.class", true },
+ { ".*\\.java", "/java.base/java/lang/Object.class", false },
+ { ".*java/.*", "/java.base/java/lang", true },
+ { ".*java/lang/ref.*", "/java.base/java/lang/reflect", true },
+ { ".*java/lang/ref.*", "/java.base/java/lang/ref", true },
+ { ".*/java/lang/ref.+", "/java.base/java/lang/ref", false },
+ { ".*/java/lang/(ref|refl.*)", "/java.base/java/lang/ref", true },
+ { ".*/java/lang/(ref|refl.*)", "/java.base/java/lang/reflect", true },
+ { ".*/java/[a-u]?.*/.*\\.class", "/java.base/java/util/Map.class", true },
+ { ".*/java/util/[a-z]*\\.class", "/java.base/java/util/TreeMap.class", false },
+ };
+ }
+
+ @Test(dataProvider = "pathRegexPatterns")
+ public void testRegexPathMatcher(String pattern, String path,
+ boolean expectMatch) throws Exception {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ PathMatcher pm = fs.getPathMatcher("regex:" + pattern);
+ Path p = fs.getPath(path);
+ assertTrue(Files.exists(p), path);
+ assertTrue(!(pm.matches(p) ^ expectMatch),
+ p + (expectMatch? " should match " : " should not match ") +
+ pattern);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/internal/jrtfs/PathOps.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,458 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.InvalidPathException;
+import java.net.URI;
+import java.io.IOException;
+
+/**
+ * @test
+ * @summary Tests jrt path operations
+ */
+
+public class PathOps {
+
+ static final java.io.PrintStream out = System.out;
+ static FileSystem fs;
+
+ private String input;
+ private Path path;
+ private Exception exc;
+
+ private PathOps(String s) {
+ out.println();
+ input = s;
+ try {
+ path = fs.getPath(s);
+ out.format("%s -> %s", s, path);
+ } catch (Exception x) {
+ exc = x;
+ out.format("%s -> %s", s, x);
+ }
+ out.println();
+ }
+
+ Path path() {
+ return path;
+ }
+
+ void fail() {
+ throw new RuntimeException("PathOps failed");
+ }
+
+ void checkPath() {
+ if (path == null) {
+ throw new InternalError("path is null");
+ }
+ }
+
+ void check(Object result, String expected) {
+ out.format("\tExpected: %s\n", expected);
+ out.format("\tActual: %s\n", result);
+ if (result == null) {
+ if (expected == null) return;
+ } else {
+ // compare string representations
+ if (expected != null && result.toString().equals(expected.toString()))
+ return;
+ }
+ fail();
+ }
+
+ void check(Object result, boolean expected) {
+ check(result, Boolean.toString(expected));
+ }
+
+ PathOps root(String expected) {
+ out.println("check root");
+ checkPath();
+ check(path.getRoot(), expected);
+ return this;
+ }
+
+ PathOps parent(String expected) {
+ out.println("check parent");
+ checkPath();
+ check(path.getParent(), expected);
+ return this;
+ }
+
+ PathOps name(String expected) {
+ out.println("check name");
+ checkPath();
+ check(path.getFileName(), expected);
+ return this;
+ }
+
+ PathOps element(int index, String expected) {
+ out.format("check element %d\n", index);
+ checkPath();
+ check(path.getName(index), expected);
+ return this;
+ }
+
+ PathOps subpath(int startIndex, int endIndex, String expected) {
+ out.format("test subpath(%d,%d)\n", startIndex, endIndex);
+ checkPath();
+ check(path.subpath(startIndex, endIndex), expected);
+ return this;
+ }
+
+ PathOps starts(String prefix) {
+ out.format("test startsWith with %s\n", prefix);
+ checkPath();
+ Path s = fs.getPath(prefix);
+ check(path.startsWith(s), true);
+ return this;
+ }
+
+ PathOps notStarts(String prefix) {
+ out.format("test not startsWith with %s\n", prefix);
+ checkPath();
+ Path s = fs.getPath(prefix);
+ check(path.startsWith(s), false);
+ return this;
+ }
+
+ PathOps ends(String suffix) {
+ out.format("test endsWith %s\n", suffix);
+ checkPath();
+ Path s = fs.getPath(suffix);
+ check(path.endsWith(s), true);
+ return this;
+ }
+
+ PathOps notEnds(String suffix) {
+ out.format("test not endsWith %s\n", suffix);
+ checkPath();
+ Path s = fs.getPath(suffix);
+ check(path.endsWith(s), false);
+ return this;
+ }
+
+ PathOps absolute() {
+ out.println("check path is absolute");
+ checkPath();
+ check(path.isAbsolute(), true);
+ return this;
+ }
+
+ PathOps notAbsolute() {
+ out.println("check path is not absolute");
+ checkPath();
+ check(path.isAbsolute(), false);
+ return this;
+ }
+
+ PathOps resolve(String other, String expected) {
+ out.format("test resolve %s\n", other);
+ checkPath();
+ check(path.resolve(other), expected);
+ return this;
+ }
+
+ PathOps relativize(String other, String expected) {
+ out.format("test relativize %s\n", other);
+ checkPath();
+ Path that = fs.getPath(other);
+ check(path.relativize(that), expected);
+ return this;
+ }
+
+ PathOps normalize(String expected) {
+ out.println("check normalized path");
+ checkPath();
+ check(path.normalize(), expected);
+ return this;
+ }
+
+ PathOps string(String expected) {
+ out.println("check string representation");
+ checkPath();
+ check(path, expected);
+ return this;
+ }
+
+ PathOps isSameFile(String target) {
+ try {
+ out.println("check two paths are same");
+ checkPath();
+ check(Files.isSameFile(path, test(target).path()), true);
+ } catch (IOException ioe) {
+ fail();
+ }
+ return this;
+ }
+
+ PathOps invalid() {
+ if (!(exc instanceof InvalidPathException)) {
+ out.println("InvalidPathException not thrown as expected");
+ fail();
+ }
+ return this;
+ }
+
+ static PathOps test(String s) {
+ return new PathOps(s);
+ }
+
+ // -- PathOpss --
+
+ static void header(String s) {
+ out.println();
+ out.println();
+ out.println("-- " + s + " --");
+ }
+
+ static void doPathOpTests() {
+ header("Path operations");
+
+ // all components
+ test("/a/b/c")
+ .root("/")
+ .parent("/a/b")
+ .name("c");
+
+ // root component only
+ test("/")
+ .root("/")
+ .parent(null)
+ .name(null);
+
+ // no root component
+ test("a/b")
+ .root(null)
+ .parent("a")
+ .name("b");
+
+ // name component only
+ test("foo")
+ .root(null)
+ .parent(null)
+ .name("foo");
+
+ // startsWith
+ test("")
+ .starts("")
+ .notStarts("/");
+ test("/")
+ .starts("/")
+ .notStarts("/foo");
+ test("/foo")
+ .starts("/")
+ .starts("/foo")
+ .notStarts("/f")
+ .notStarts("");
+ test("/foo/bar")
+ .starts("/")
+ .starts("/foo")
+ .starts("/foo/")
+ .starts("/foo/bar")
+ .notStarts("/f")
+ .notStarts("foo")
+ .notStarts("foo/bar")
+ .notStarts("");
+ test("foo")
+ .starts("foo")
+ .notStarts("f");
+ test("foo/bar")
+ .starts("foo")
+ .starts("foo/")
+ .starts("foo/bar")
+ .notStarts("f")
+ .notStarts("/foo")
+ .notStarts("/foo/bar");
+
+ // endsWith
+ test("")
+ .ends("")
+ .notEnds("/");
+ test("/")
+ .ends("/")
+ .notEnds("foo")
+ .notEnds("/foo");
+ test("/foo")
+ .ends("foo")
+ .ends("/foo")
+ .notEnds("/");
+ test("/foo/bar")
+ .ends("bar")
+ .ends("foo/bar")
+ .ends("foo/bar/")
+ .ends("/foo/bar")
+ .notEnds("/bar");
+ test("/foo/bar/")
+ .ends("bar")
+ .ends("foo/bar")
+ .ends("foo/bar/")
+ .ends("/foo/bar")
+ .notEnds("/bar");
+ test("foo")
+ .ends("foo");
+ test("foo/bar")
+ .ends("bar")
+ .ends("bar/")
+ .ends("foo/bar/")
+ .ends("foo/bar");
+
+
+ // elements
+ test("a/b/c")
+ .element(0,"a")
+ .element(1,"b")
+ .element(2,"c");
+
+ // isAbsolute
+ test("/")
+ .absolute();
+ test("/tmp")
+ .absolute();
+ test("tmp")
+ .notAbsolute();
+ test("")
+ .notAbsolute();
+
+ // resolve
+ test("/tmp")
+ .resolve("foo", "/tmp/foo")
+ .resolve("/foo", "/foo");
+ test("tmp")
+ .resolve("foo", "tmp/foo")
+ .resolve("/foo", "/foo");
+
+ // relativize
+ test("/a/b/c")
+ .relativize("/a/b/c", "")
+ .relativize("/a/b/c/d/e", "d/e")
+ .relativize("/a/x", "../../x");
+
+ // normalize
+ test("/")
+ .normalize("/");
+ test("foo")
+ .normalize("foo");
+ test("/foo")
+ .normalize("/foo");
+ test(".")
+ .normalize("");
+ test("..")
+ .normalize("..");
+ test("/..")
+ .normalize("/");
+ test("/../..")
+ .normalize("/");
+ test("foo/.")
+ .normalize("foo");
+ test("./foo")
+ .normalize("foo");
+ test("foo/..")
+ .normalize("");
+ test("../foo")
+ .normalize("../foo");
+ test("../../foo")
+ .normalize("../../foo");
+ test("foo/bar/..")
+ .normalize("foo");
+ test("foo/bar/gus/../..")
+ .normalize("foo");
+ test("/foo/bar/gus/../..")
+ .normalize("/foo");
+ test("/./.")
+ .normalize("/");
+ test("/.")
+ .normalize("/");
+ test("/./abc")
+ .normalize("/abc");
+ // invalid
+ test("foo\u0000bar")
+ .invalid();
+ test("\u0000foo")
+ .invalid();
+ test("bar\u0000")
+ .invalid();
+ test("//foo\u0000bar")
+ .invalid();
+ test("//\u0000foo")
+ .invalid();
+ test("//bar\u0000")
+ .invalid();
+
+ // normalization
+ test("//foo//bar")
+ .string("/foo/bar")
+ .root("/")
+ .parent("/foo")
+ .name("bar");
+
+ // isSameFile
+ test("/fileDoesNotExist")
+ .isSameFile("/fileDoesNotExist");
+ }
+
+ static void npes() {
+ header("NullPointerException");
+
+ Path path = fs.getPath("foo");
+
+ try {
+ path.resolve((String)null);
+ throw new RuntimeException("NullPointerException not thrown");
+ } catch (NullPointerException npe) {
+ }
+
+ try {
+ path.relativize(null);
+ throw new RuntimeException("NullPointerException not thrown");
+ } catch (NullPointerException npe) {
+ }
+
+ try {
+ path.compareTo(null);
+ throw new RuntimeException("NullPointerException not thrown");
+ } catch (NullPointerException npe) {
+ }
+
+ try {
+ path.startsWith((Path)null);
+ throw new RuntimeException("NullPointerException not thrown");
+ } catch (NullPointerException npe) {
+ }
+
+ try {
+ path.endsWith((Path)null);
+ throw new RuntimeException("NullPointerException not thrown");
+ } catch (NullPointerException npe) {
+ }
+
+ }
+
+ public static void main(String[] args) throws Throwable {
+ fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ npes();
+ doPathOpTests();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/internal/jrtfs/WithSecurityManager.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @run main/othervm WithSecurityManager allow
+ * @run main/othervm WithSecurityManager deny
+ */
+
+import java.net.URI;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class WithSecurityManager {
+ public static void main(String[] args) throws Exception {
+ boolean allow = args[0].equals("allow");
+
+ // set security policy to allow access
+ if (allow) {
+ String testSrc = System.getProperty("test.src");
+ if (testSrc == null)
+ testSrc = ".";
+ Path policyFile = Paths.get(testSrc, "java.policy");
+ System.setProperty("java.security.policy", policyFile.toString());
+ }
+
+ // make sure that jrt:/ has been created before we have a security manager
+ FileSystems.getFileSystem(URI.create("jrt:/"));
+
+ System.setSecurityManager(new SecurityManager());
+
+ // check FileSystems.getFileSystem
+ try {
+ FileSystems.getFileSystem(URI.create("jrt:/"));
+ if (!allow) throw new RuntimeException("access not expected");
+ } catch (SecurityException se) {
+ if (allow) throw new RuntimeException("access expected");
+ }
+
+ // check FileSystems.newFileSystem
+ try {
+ FileSystems.newFileSystem(URI.create("jrt:/"), null);
+ if (!allow) throw new RuntimeException("access not expected");
+ } catch (SecurityException se) {
+ if (allow) throw new RuntimeException("access expected");
+ }
+
+ // check Paths.get
+ try {
+ Paths.get(URI.create("jrt:/java.base/java/lang/Object.class"));
+ if (!allow) throw new RuntimeException("access not expected");
+ } catch (SecurityException se) {
+ if (allow) throw new RuntimeException("access expected");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/internal/jrtfs/java.policy Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,3 @@
+grant {
+ permission java.io.FilePermission "${java.home}/-", "read";
+};
--- a/jdk/test/jdk/nio/zipfs/Basic.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/jdk/nio/zipfs/Basic.java Wed Jul 05 20:08:34 2017 +0200
@@ -21,15 +21,26 @@
* questions.
*/
-import java.nio.file.*;
-import java.nio.file.attribute.*;
+import java.nio.file.AccessMode;
+import java.nio.file.ClosedFileSystemException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.FileStore;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.spi.FileSystemProvider;
-import java.util.*;
import java.net.URI;
import java.io.IOException;
+import java.util.Collections;
+import java.util.Map;
/**
- *
* @test
* @bug 8038500 8040059
* @summary Basic test for zip provider
@@ -40,11 +51,8 @@
public class Basic {
public static void main(String[] args) throws Exception {
- Path zipfile = Paths.get(System.getProperty("test.jdk"),
- "jre/lib/ext/zipfs.jar");
// Test: zip should should be returned in provider list
boolean found = false;
-
for (FileSystemProvider provider: FileSystemProvider.installedProviders()) {
if (provider.getScheme().equalsIgnoreCase("jar")) {
found = true;
@@ -54,12 +62,16 @@
if (!found)
throw new RuntimeException("'jar' provider not installed");
+ // create JAR file for test
+ Path jarFile = Utils.createJarFile("basic.jar",
+ "META-INF/services/java.nio.file.spi.FileSystemProvider");
+
// Test: FileSystems#newFileSystem(Path)
- Map<String,?> env = new HashMap<String,Object>();
- FileSystems.newFileSystem(zipfile, null).close();
+ Map<String,?> env = Collections.emptyMap();
+ FileSystems.newFileSystem(jarFile, null).close();
// Test: FileSystems#newFileSystem(URI)
- URI uri = new URI("jar", zipfile.toUri().toString(), null);
+ URI uri = new URI("jar", jarFile.toUri().toString(), null);
FileSystem fs = FileSystems.newFileSystem(uri, env, null);
// Test: exercise toUri method
--- a/jdk/test/jdk/nio/zipfs/PathOps.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/jdk/nio/zipfs/PathOps.java Wed Jul 05 20:08:34 2017 +0200
@@ -21,10 +21,12 @@
* questions.
*/
-import java.nio.file.*;
-import java.net.*;
-import java.util.*;
import java.io.IOException;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
/**
*
@@ -33,7 +35,7 @@
* @summary Tests path operations for zip provider.
*
* @run main PathOps
- * @run main/othervm/java.security.policy=test.policy.readonly PathOps
+ * @run main/othervm/java.security.policy=test.policy PathOps
*/
public class PathOps {
@@ -452,12 +454,16 @@
}
- public static void main(String[] args) throws Throwable {
- Path zipfile = Paths.get(System.getProperty("test.jdk"),
- "jre/lib/ext/zipfs.jar");
- fs = FileSystems.newFileSystem(zipfile, null);
+ public static void main(String[] args) throws IOException {
+ // create empty JAR file, test doesn't require any contents
+ Path emptyJar = Utils.createJarFile("empty.jar");
+
+ fs = FileSystems.newFileSystem(emptyJar, null);
+ try {
npes();
doPathOpTests();
+ } finally {
fs.close();
}
}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/nio/zipfs/Utils.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.*;
+import java.util.Random;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+
+/**
+ * Utility class for zipfs tests.
+ */
+
+class Utils {
+ private Utils() { }
+
+ /**
+ * Creates a JAR file of the given name with 0 or more named entries.
+ *
+ * @return Path to the newly created JAR file
+ */
+ static Path createJarFile(String name, String... entries) throws IOException {
+ Path jarFile = Paths.get("basic.jar");
+ Random rand = new Random();
+ try (OutputStream out = Files.newOutputStream(jarFile);
+ JarOutputStream jout = new JarOutputStream(out)) {
+ int len = 100;
+ for (String entry: entries) {
+ JarEntry je = new JarEntry(entry);
+ jout.putNextEntry(je);
+ byte[] bytes = new byte[len];
+ rand.nextBytes(bytes);
+ jout.write(bytes);
+ jout.closeEntry();
+ len += 1024;
+ }
+ }
+ return jarFile;
+ }
+}
--- a/jdk/test/jdk/nio/zipfs/ZipFSTester.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/jdk/nio/zipfs/ZipFSTester.java Wed Jul 05 20:08:34 2017 +0200
@@ -21,16 +21,43 @@
* questions.
*/
-import java.io.*;
-import java.nio.*;
-import java.nio.channels.*;
-import java.nio.file.*;
-import java.nio.file.spi.*;
-import java.nio.file.attribute.*;
-import java.net.*;
-import java.util.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.file.DirectoryStream;
+import java.nio.file.FileAlreadyExistsException;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystemAlreadyExistsException;
+import java.nio.file.FileSystemException;
+import java.nio.file.FileSystems;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.OpenOption;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributeView;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.spi.FileSystemProvider;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
import java.util.concurrent.TimeUnit;
-import java.util.zip.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
import static java.nio.file.StandardOpenOption.*;
import static java.nio.file.StandardCopyOption.*;
@@ -48,16 +75,20 @@
public class ZipFSTester {
- public static void main(String[] args) throws Throwable {
- try (FileSystem fs = newZipFileSystem(
- Paths.get(System.getProperty("test.jdk"), "jre/lib/ext/zipfs.jar"),
- new HashMap<String, Object>()))
- {
+ public static void main(String[] args) throws Exception {
+
+ // create JAR file for test, actual contents don't matter
+ Path jarFile = Utils.createJarFile("tester.jar",
+ "META-INF/MANIFEST.MF",
+ "dir1/foo",
+ "dir2/bar");
+
+ try (FileSystem fs = newZipFileSystem(jarFile, Collections.emptyMap())) {
test0(fs);
test1(fs);
test2(fs); // more tests
}
- testTime(Paths.get(System.getProperty("test.jdk"), "jre/lib/ext/zipfs.jar"));
+ testTime(jarFile);
}
static void test0(FileSystem fs)
@@ -102,7 +133,7 @@
new URI("jar", tmpfsPath.toUri().toString(), null),
new HashMap<String, Object>()))
{
- throw new RuntimeException("newFileSystem(uri...) does not throw exception");
+ throw new RuntimeException("newFileSystem(URI...) does not throw exception");
} catch (FileSystemAlreadyExistsException fsaee) {}
// prepare a src
--- a/jdk/test/lib/security/java.policy/Ext_AllPolicy.java Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This is a trivial file to grab the security manager, grab a
- * permission object, then try to check the resulting permission.
- */
-
-import java.io.*;
-import java.security.*;
-
-public class Ext_AllPolicy {
- public static void main (String[] args) {
- boolean allPerms = args.length == 1 && args[0].equals("AllPermission");
- FilePermission mine = new FilePermission("/tmp/bar", "read");
- SecurityManager sm = System.getSecurityManager();
-
- if (sm != null) {
- try {
- sm.checkPermission(mine);
- if (!allPerms) {
- // Default has no privilege.
- throw new RuntimeException(mine + " expected to deny access");
- }
- } catch (AccessControlException e) {
- if (allPerms) {
- // expected all permissions granted
- throw e;
- }
- }
- }
- }
-}
--- a/jdk/test/lib/security/java.policy/Ext_AllPolicy.sh Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-#
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4215035 8040059
-# @summary standard extensions path is hard-coded in default system policy file
-#
-# @build Ext_AllPolicy
-# @run shell Ext_AllPolicy.sh
-
-#
-# For testing extenions, the classes live in jar files, and therefore
-# we shouldn't be able to find the raw class file.
-#
-
-# set a few environment variables so that the shell-script can run stand-alone
-# in the source directory
-if [ "${TESTSRC}" = "" ] ; then
- TESTSRC="."
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
- TESTCLASSES="."
-fi
-if [ "${TESTJAVA}" = "" ] ; then
- echo "TESTJAVA not set. Test cannot execute."
- echo "FAILED!!!"
- exit 1
-fi
-if [ "${COMPILEJAVA}" = "" ]; then
- COMPILEJAVA="${TESTJAVA}"
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- NULL=/dev/null
- PS=":"
- FS="/"
- ;;
- CYGWIN* )
- NULL=/dev/null
- PS=";"
- FS="/"
- ;;
- Windows_95 | Windows_98 | Windows_NT )
- NULL=NUL
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-# the test code
-
-cd ${TESTCLASSES}
-${COMPILEJAVA}${FS}bin${FS}jar ${TESTTOOLVMOPTS} -cvf Ext_AllPolicy.jar Ext_AllPolicy.class
-
-rm Ext_AllPolicy.class
-${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
- -Djava.security.manager -Djava.ext.dirs="${TESTCLASSES}" Ext_AllPolicy || exit 10
-
-${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
- -Djava.security.policy=${TESTSRC}${FS}test.policy \
- -Djava.security.manager -Djava.ext.dirs="${TESTCLASSES}" Ext_AllPolicy AllPermission
-exit $?
--- a/jdk/test/lib/security/java.policy/test.policy Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-grant codeBase "file:${{java.ext.dirs}}/*" {
- permission java.security.AllPermission;
-};
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java Wed Jul 05 20:08:34 2017 +0200
@@ -228,13 +228,13 @@
/**
* Compute the full path name for a default file.
* @param basename basename (with extension) of the default file.
- * @return ${JRE}/lib/management/${basename}
+ * @return ${JRE}/conf/management/${basename}
**/
private static String getDefaultFileName(String basename) {
final String fileSeparator = File.separator;
final StringBuffer defaultFileName =
new StringBuffer(System.getProperty("java.home")).
- append(fileSeparator).append("lib").append(fileSeparator).
+ append(fileSeparator).append("conf").append(fileSeparator).
append("management").append(fileSeparator).
append(basename);
return defaultFileName.toString();
@@ -243,7 +243,7 @@
/**
* Compute the full path name for a default file.
* @param basename basename (with extension) of the default file.
- * @return ${JRE}/lib/management/${basename}
+ * @return ${JRE}/conf/management/${basename}
**/
private static String getDefaultStoreName(String basename) {
final String fileSeparator = File.separator;
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.java Wed Jul 05 20:08:34 2017 +0200
@@ -126,13 +126,13 @@
/**
* Compute the full path name for a default file.
* @param basename basename (with extension) of the default file.
- * @return ${JRE}/lib/management/${basename}
+ * @return ${JRE}/conf/management/${basename}
**/
private static String getDefaultFileName(String basename) {
final String fileSeparator = File.separator;
final StringBuffer defaultFileName =
new StringBuffer(System.getProperty("java.home")).
- append(fileSeparator).append("lib").append(fileSeparator).
+ append(fileSeparator).append("conf").append(fileSeparator).
append("management").append(fileSeparator).
append(basename);
return defaultFileName.toString();
@@ -141,7 +141,7 @@
/**
* Compute the full path name for a default file.
* @param basename basename (with extension) of the default file.
- * @return ${JRE}/lib/management/${basename}
+ * @return ${JRE}/conf/management/${basename}
**/
private static String getDefaultStoreName(String basename) {
final String fileSeparator = File.separator;
--- a/jdk/test/sun/management/jmxremote/bootstrap/rmiregistry.properties Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/sun/management/jmxremote/bootstrap/rmiregistry.properties Wed Jul 05 20:08:34 2017 +0200
@@ -5,24 +5,24 @@
# The Management Configuration file (in java.util.Properties format)
# will be read if one of the following system properties is set:
# -Dcom.sun.management.jmxremote.port=<port-number>
-# or -Dcom.sun.management.snmp.port=<port-number>
+# or -Dcom.sun.management.snmp.port=<port-number>
# or -Dcom.sun.management.config.file=<this-file>
#
# The default Management Configuration file is:
#
-# $JRE/lib/management/management.properties
+# $JRE/conf/management/management.properties
#
# Another location for the Management Configuration File can be specified
# by the following property on the Java command line:
#
# -Dcom.sun.management.config.file=<this-file>
-#
+#
# If -Dcom.sun.management.config.file=<this-file> is set, the port
-# number for the management agent can be specified in the config file
+# number for the management agent can be specified in the config file
# using the following lines:
-#
+#
# ################ Management Agent Port #########################
-#
+#
# For setting the JMX RMI agent port use the following line
com.sun.management.jmxremote.port=${getFreePort}
#
@@ -45,7 +45,7 @@
# Refer to the specification for the java.lang.management.ThreadMBean
# interface - see isThreadContentionMonitoringSupported() method.
#
-
+
# To enable thread contention monitoring, uncomment the following line
# com.sun.management.enableThreadContentionMonitoring
@@ -53,9 +53,9 @@
# SNMP Management Properties
#####################################################################
#
-# If the system property -Dcom.sun.management.snmp.port=<port-number>
+# If the system property -Dcom.sun.management.snmp.port=<port-number>
# is set then
-# - The SNMP agent (with the Java virtual machine MIB) is started
+# - The SNMP agent (with the Java virtual machine MIB) is started
# that listens on the specified port for incoming SNMP requests.
# - the following properties for read for SNMP management.
#
@@ -89,7 +89,7 @@
#
# The format of the value for that property is any string accepted
# by java.net.InetAddress.getByName(String).
-#
+#
# For restricting the port on which SNMP agent listens use following line
# com.sun.management.snmp.interface=<InetAddress>
@@ -110,15 +110,15 @@
# com.sun.management.snmp.acl.file=filepath
# Specifies location for ACL file
# This is optional - default location is
-# $JRE/lib/management/snmp.acl
-#
+# $JRE/conf/management/snmp.acl
+#
# If the property "com.sun.management.snmp.acl" is set to false,
# then this property and the ACL file are ignored.
# Otherwise the ACL file must exist and be in the valid format.
# If the ACL file is empty or non existent then no access is allowed.
-#
-# The SNMP agent will read the ACL file at startup time.
-# Modification to the ACL file has no effect to any running SNMP
+#
+# The SNMP agent will read the ACL file at startup time.
+# Modification to the ACL file has no effect to any running SNMP
# agents which read that ACL file at startup.
#
@@ -131,7 +131,7 @@
#
# If system property -Dcom.sun.management.jmxremote.port=<port-number>
# is set then
-# - A MBean server is started
+# - A MBean server is started
# - JRE Platform MBeans are registered in the MBean server
# - RMI connector is published in a private readonly registry at
# specified port using a well known name, "jmxrmi"
@@ -140,7 +140,7 @@
# The configuration can be specified only at startup time.
# Later changes to above system property (e.g. via setProperty method),
# this config file, the password file, or the access file have no effect to the
-# running MBean server, the connector, or the registry.
+# running MBean server, the connector, or the registry.
#
#
@@ -149,7 +149,7 @@
# com.sun.management.jmxremote.ssl=true|false
# Default for this property is true. (Case for true/false ignored)
# If this property is specified as false then SSL is not used.
-#
+#
# For RMI monitoring without SSL use the following line
# com.sun.management.jmxremote.ssl=false
@@ -218,20 +218,20 @@
# ################ RMI Login configuration ###################
#
# com.sun.management.jmxremote.login.config=<config-name>
-# Specifies the name of a JAAS login configuration entry to use when
-# authenticating users of RMI monitoring.
+# Specifies the name of a JAAS login configuration entry to use when
+# authenticating users of RMI monitoring.
#
# Setting this property is optional - the default login configuration
# specifies a file-based authentication that uses the password file.
#
-# When using this property to override the default login configuration
-# then the named configuration entry must be in a file that gets loaded
+# When using this property to override the default login configuration
+# then the named configuration entry must be in a file that gets loaded
# by JAAS. In addition, the login module(s) specified in the configuration
-# should use the name and/or password callbacks to acquire the user's
-# credentials. See the NameCallback and PasswordCallback classes in the
+# should use the name and/or password callbacks to acquire the user's
+# credentials. See the NameCallback and PasswordCallback classes in the
# javax.security.auth.callback package for more details.
#
-# If the property "com.sun.management.jmxremote.authenticate" is set to
+# If the property "com.sun.management.jmxremote.authenticate" is set to
# false, then this property and the password & access files are ignored.
#
@@ -244,9 +244,9 @@
# com.sun.management.jmxremote.password.file=filepath
# Specifies location for password file
# This is optional - default location is
-# $JRE/lib/management/jmxremote.password
-#
-# If the property "com.sun.management.jmxremote.authenticate" is set to
+# $JRE/conf/management/jmxremote.password
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
# false, then this property and the password & access files are ignored.
# Otherwise the password file must exist and be in the valid format.
# If the password file is empty or non-existent then no access is allowed.
@@ -261,9 +261,9 @@
# com.sun.management.jmxremote.access.file=filepath
# Specifies location for access file
# This is optional - default location is
-# $JRE/lib/management/jmxremote.access
-#
-# If the property "com.sun.management.jmxremote.authenticate" is set to
+# $JRE/conf/management/jmxremote.access
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
# false, then this property and the password & access files are ignored.
# Otherwise, the access file must exist and be in the valid format.
# If the access file is empty or non-existent then no access is allowed.
--- a/jdk/test/sun/management/jmxremote/bootstrap/rmiregistryssl.properties Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/sun/management/jmxremote/bootstrap/rmiregistryssl.properties Wed Jul 05 20:08:34 2017 +0200
@@ -5,24 +5,24 @@
# The Management Configuration file (in java.util.Properties format)
# will be read if one of the following system properties is set:
# -Dcom.sun.management.jmxremote.port=<port-number>
-# or -Dcom.sun.management.snmp.port=<port-number>
+# or -Dcom.sun.management.snmp.port=<port-number>
# or -Dcom.sun.management.config.file=<this-file>
#
# The default Management Configuration file is:
#
-# $JRE/lib/management/management.properties
+# $JRE/conf/management/management.properties
#
# Another location for the Management Configuration File can be specified
# by the following property on the Java command line:
#
# -Dcom.sun.management.config.file=<this-file>
-#
+#
# If -Dcom.sun.management.config.file=<this-file> is set, the port
-# number for the management agent can be specified in the config file
+# number for the management agent can be specified in the config file
# using the following lines:
-#
+#
# ################ Management Agent Port #########################
-#
+#
# For setting the JMX RMI agent port use the following line
com.sun.management.jmxremote.port=${getFreePort}
#
@@ -45,7 +45,7 @@
# Refer to the specification for the java.lang.management.ThreadMBean
# interface - see isThreadContentionMonitoringSupported() method.
#
-
+
# To enable thread contention monitoring, uncomment the following line
# com.sun.management.enableThreadContentionMonitoring
@@ -53,9 +53,9 @@
# SNMP Management Properties
#####################################################################
#
-# If the system property -Dcom.sun.management.snmp.port=<port-number>
+# If the system property -Dcom.sun.management.snmp.port=<port-number>
# is set then
-# - The SNMP agent (with the Java virtual machine MIB) is started
+# - The SNMP agent (with the Java virtual machine MIB) is started
# that listens on the specified port for incoming SNMP requests.
# - the following properties for read for SNMP management.
#
@@ -89,7 +89,7 @@
#
# The format of the value for that property is any string accepted
# by java.net.InetAddress.getByName(String).
-#
+#
# For restricting the port on which SNMP agent listens use following line
# com.sun.management.snmp.interface=<InetAddress>
@@ -110,15 +110,15 @@
# com.sun.management.snmp.acl.file=filepath
# Specifies location for ACL file
# This is optional - default location is
-# $JRE/lib/management/snmp.acl
-#
+# $JRE/conf/management/snmp.acl
+#
# If the property "com.sun.management.snmp.acl" is set to false,
# then this property and the ACL file are ignored.
# Otherwise the ACL file must exist and be in the valid format.
# If the ACL file is empty or non existent then no access is allowed.
-#
-# The SNMP agent will read the ACL file at startup time.
-# Modification to the ACL file has no effect to any running SNMP
+#
+# The SNMP agent will read the ACL file at startup time.
+# Modification to the ACL file has no effect to any running SNMP
# agents which read that ACL file at startup.
#
@@ -131,7 +131,7 @@
#
# If system property -Dcom.sun.management.jmxremote.port=<port-number>
# is set then
-# - A MBean server is started
+# - A MBean server is started
# - JRE Platform MBeans are registered in the MBean server
# - RMI connector is published in a private readonly registry at
# specified port using a well known name, "jmxrmi"
@@ -140,7 +140,7 @@
# The configuration can be specified only at startup time.
# Later changes to above system property (e.g. via setProperty method),
# this config file, the password file, or the access file have no effect to the
-# running MBean server, the connector, or the registry.
+# running MBean server, the connector, or the registry.
#
#
@@ -149,7 +149,7 @@
# com.sun.management.jmxremote.ssl=true|false
# Default for this property is true. (Case for true/false ignored)
# If this property is specified as false then SSL is not used.
-#
+#
# For RMI monitoring without SSL use the following line
# com.sun.management.jmxremote.ssl=false
@@ -218,20 +218,20 @@
# ################ RMI Login configuration ###################
#
# com.sun.management.jmxremote.login.config=<config-name>
-# Specifies the name of a JAAS login configuration entry to use when
-# authenticating users of RMI monitoring.
+# Specifies the name of a JAAS login configuration entry to use when
+# authenticating users of RMI monitoring.
#
# Setting this property is optional - the default login configuration
# specifies a file-based authentication that uses the password file.
#
-# When using this property to override the default login configuration
-# then the named configuration entry must be in a file that gets loaded
+# When using this property to override the default login configuration
+# then the named configuration entry must be in a file that gets loaded
# by JAAS. In addition, the login module(s) specified in the configuration
-# should use the name and/or password callbacks to acquire the user's
-# credentials. See the NameCallback and PasswordCallback classes in the
+# should use the name and/or password callbacks to acquire the user's
+# credentials. See the NameCallback and PasswordCallback classes in the
# javax.security.auth.callback package for more details.
#
-# If the property "com.sun.management.jmxremote.authenticate" is set to
+# If the property "com.sun.management.jmxremote.authenticate" is set to
# false, then this property and the password & access files are ignored.
#
@@ -244,9 +244,9 @@
# com.sun.management.jmxremote.password.file=filepath
# Specifies location for password file
# This is optional - default location is
-# $JRE/lib/management/jmxremote.password
-#
-# If the property "com.sun.management.jmxremote.authenticate" is set to
+# $JRE/conf/management/jmxremote.password
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
# false, then this property and the password & access files are ignored.
# Otherwise the password file must exist and be in the valid format.
# If the password file is empty or non-existent then no access is allowed.
@@ -261,9 +261,9 @@
# com.sun.management.jmxremote.access.file=filepath
# Specifies location for access file
# This is optional - default location is
-# $JRE/lib/management/jmxremote.access
-#
-# If the property "com.sun.management.jmxremote.authenticate" is set to
+# $JRE/conf/management/jmxremote.access
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
# false, then this property and the password & access files are ignored.
# Otherwise, the access file must exist and be in the valid format.
# If the access file is empty or non-existent then no access is allowed.
--- a/jdk/test/sun/net/www/protocol/jar/getcontenttype.sh Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/sun/net/www/protocol/jar/getcontenttype.sh Wed Jul 05 20:08:34 2017 +0200
@@ -32,6 +32,20 @@
if [ x"$TESTCLASSES" = x ]; then TESTCLASSES=.; fi
if [ x"$TESTSRC" = x ]; then TESTSRC=.; fi
+OS=`uname -s`;
+# Set classpath separator
+case "$OS" in
+ Windows* | CYGWIN* )
+ SEP=";"
+ FS="\\"
+ ;;
+
+ * )
+ SEP=":"
+ FS="/"
+ ;;
+esac
+
# now start the test
-${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.ext.dirs=$TESTSRC -cp $TESTCLASSES GetContentType
+${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTSRC}${FS}resource.jar${SEP}${TESTCLASSES} GetContentType
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/www/protocol/jrt/Basic.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @summary Basic test of jimage protocol handler
+ * @run testng Basic
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+public class Basic {
+
+ @DataProvider(name = "resources")
+ public Object[][] resources() {
+ Object[][] data = {
+ { "java/lang/Object.class", "jrt:/java.base/java/lang/Object.class" },
+ { "java/awt/Component.class", "jrt:/java.desktop/java/awt/Component.class" },
+ { "jdk/internal/DoesNotExist", null },
+ };
+ return data;
+ }
+
+ @Test(dataProvider = "resources")
+ public void testResources(String name, String expectedUrlString) throws Exception {
+ URL url = ClassLoader.getSystemResource(name);
+ if (url == null) {
+ assertTrue(expectedUrlString == null);
+ } else {
+ assertEquals(url.toString(), expectedUrlString);
+ }
+ }
+
+ @DataProvider(name = "urls")
+ public Object[][] urls() {
+ Object[][] data = {
+ { "jrt:/java.base/java/lang/Object.class", true },
+ { "jrt:/java.desktop/java/lang/Object.class", false },
+ };
+ return data;
+ }
+
+ @Test(dataProvider = "urls")
+ public void testConnect(String urlString, boolean exists) throws Exception {
+ URL url = new URL(urlString);
+ URLConnection uc = url.openConnection();
+ try {
+ uc.connect();
+ if (!exists) fail("IOException expected");
+ } catch (IOException ioe) {
+ if (exists) fail("IOException not expected");
+ }
+ }
+
+ @Test(dataProvider = "urls")
+ public void testInputStream(String urlString, boolean exists) throws Exception {
+ URL url = new URL(urlString);
+ URLConnection uc = url.openConnection();
+ try {
+ int b = uc.getInputStream().read();
+ assertTrue(b != -1);
+ if (!exists) fail("IOException expected");
+ } catch (IOException ioe) {
+ if (exists) fail("IOException not expected");
+ }
+ }
+
+ @Test(dataProvider = "urls")
+ public void testContentLength(String urlString, boolean exists) throws Exception {
+ URL url = new URL(urlString);
+ int len = url.openConnection().getContentLength();
+ assertTrue((exists && len > 0) || (!exists && len == -1));
+ }
+
+ @Test(dataProvider = "urls")
+ public void testGetContent(String urlString, boolean exists) throws Exception {
+ URL url = new URL(urlString);
+ try {
+ Object obj = url.getContent();
+ assertTrue(obj != null);
+ if (!exists) fail("IOException expected");
+ } catch (IOException ioe) {
+ if (exists) fail("IOException not expected");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/www/protocol/jrt/WithSecurityManager.java Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @summary Test that the jimage protocol handler works with a security manager
+ * @run main/othervm WithSecurityManager allow
+ * @run main/othervm WithSecurityManager deny
+ */
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class WithSecurityManager {
+ public static void main(String[] args) throws Exception {
+ String home = System.getProperty("java.home");
+ Path bootmodules = Paths.get(home, "lib", "modules", "bootmodules.jimage");
+ if (Files.notExists(bootmodules)) {
+ System.out.println("This runtime is not jimage, test skipped");
+ return;
+ }
+
+ boolean allow = args[0].equals("allow");
+
+ // set security policy to allow access
+ if (allow) {
+ String testSrc = System.getProperty("test.src");
+ if (testSrc == null)
+ testSrc = ".";
+ Path policyFile = Paths.get(testSrc, "java.policy");
+ System.setProperty("java.security.policy", policyFile.toString());
+ }
+
+ System.setSecurityManager(new SecurityManager());
+
+ InputStream in = ClassLoader.getSystemResourceAsStream("java/lang/Object.class");
+ if (in == null && allow)
+ throw new RuntimeException("access expected");
+ if (in != null && !allow)
+ throw new RuntimeException("access not expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/www/protocol/jrt/java.policy Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,3 @@
+grant {
+ permission java.io.FilePermission "${java.home}/-", "read";
+};
--- a/jdk/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java Wed Jul 05 20:08:34 2017 +0200
@@ -48,12 +48,6 @@
String testclasses = System.getProperty("test.classes");
String userDir = System.getProperty("user.dir");
- if (javahome.regionMatches(true, javahome.length() - 4,
- File.separator + "jre", 0, 4))
- {
- javahome = javahome.substring(0, javahome.length() - 4);
- }
-
Process javacProcess = Runtime.getRuntime().exec(
javahome + File.separator + "bin" + File.separator +
"javac -d " + testclasses + " " +
--- a/jdk/test/sun/rmi/rmic/classpath/RMICClassPathTest.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/sun/rmi/rmic/classpath/RMICClassPathTest.java Wed Jul 05 20:08:34 2017 +0200
@@ -41,12 +41,11 @@
private final static String SRC_PATH = System.getProperty("test.src", ".");
public static void main(String[] args) throws Exception {
String sysPath = SRC_PATH + "/jdk/jre/lib/rt.jar";
- String extDir = "";
String clPath = SRC_PATH + "/user.jar" + File.pathSeparator +
SRC_PATH + "/user2.jar" + File.pathSeparator +
SRC_PATH + "/user3.jar";
- String cpStr = BatchEnvironment.createClassPath(clPath, sysPath, extDir).toString();
+ String cpStr = BatchEnvironment.createClassPath(clPath, sysPath).toString();
String[] paths = cpStr.split(File.pathSeparator);
--- a/jdk/test/sun/rmi/rmic/manifestClassPath/run.sh Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/sun/rmi/rmic/manifestClassPath/run.sh Wed Jul 05 20:08:34 2017 +0200
@@ -122,19 +122,6 @@
Success "$rmic" -classpath "jars/sub/B.zip${PS}." Main
Success "$java" ${TESTVMOPTS} -classpath "jars/sub/B.zip${PS}." Main
-#Sys rm -f Main.class MainI.class Main_Stub.class
-Sys rm -f Main_Stub.class # javac -extdirs workaround
-
-#Success "$javac" -extdirs "jars" -classpath None Main.java MainI.java
-Success "$rmic" -extdirs "jars" -classpath . Main
-Success "$java" ${TESTVMOPTS} -Djava.ext.dirs="jars" -cp . Main
-
-Sys rm -f Main_Stub.class
-
-#Success "$javac" -extdirs "jars/sub" -classpath None Main.java MainI.java
-Success "$rmic" -extdirs "jars/sub" -classpath . Main
-Success "$java" ${TESTVMOPTS} -Djava.ext.dirs="jars/sub" -cp . Main
-
Cleanup
Bottom Line
--- a/jdk/test/sun/tools/java/CFCTest.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/sun/tools/java/CFCTest.java Wed Jul 05 20:08:34 2017 +0200
@@ -91,7 +91,7 @@
*/
void exerciseClassDefinition() throws Exception {
BatchEnvironment env = new BatchEnvironment(System.out,
- BatchEnvironment.createClassPath(testClassPath, null, null),
+ BatchEnvironment.createClassPath(testClassPath, null),
null);
try {
ClassDeclaration decl = env.getClassDeclaration(
--- a/jdk/test/sun/tools/jconsole/ResourceCheckTest.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/sun/tools/jconsole/ResourceCheckTest.java Wed Jul 05 20:08:34 2017 +0200
@@ -23,12 +23,10 @@
/**
*
- *
- * This isn't the test case: ResourceCheckTest.sh is.
- * Refer to ResourceCheckTest.sh when running this test.
- *
+ * @test
* @bug 5008856 5023573 5024917 5062569 7172176
* @summary 'missing resource key' error for key = "Operating system"
+ * @run main ResourceCheckTest
*/
import java.lang.reflect.Field;
--- a/jdk/test/sun/tools/jconsole/ResourceCheckTest.sh Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-#
-# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 5023573 5062569
-# @summary jtreg test ResourceCheckTest.java must be
-# able to find jconsole.jar
-#
-# @run shell ResourceCheckTest.sh
-
-# Beginning of subroutines:
-status=1
-
-#Call this from anywhere to fail the test with an error message
-# usage: fail "reason why the test failed"
-fail()
- { echo "The test failed :-("
- echo "$*" 1>&2
- echo "exit status was $status"
- exit $status
- } #end of fail()
-
-#Call this from anywhere to pass the test with a message
-# usage: pass "reason why the test passed if applicable"
-pass()
- { echo "The test passed!!!"
- echo "$*" 1>&2
- exit 0
- } #end of pass()
-
-# end of subroutines
-
-# The beginning of the script proper
-
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX)
- PATHSEP=":"
- ;;
-
- Windows* | CYGWIN*)
- PATHSEP=";"
- ;;
-
- # catch all other OSs
- * )
- echo "Unrecognized system! $OS"
- fail "Unrecognized system! $OS"
- ;;
-esac
-
-TARGETCLASS="ResourceCheckTest"
-if [ -z "${TESTJAVA}" ] ; then
- # TESTJAVA is not set, so the test is running stand-alone.
- # TESTJAVA holds the path to the root directory of the build of the JDK
- # to be tested. That is, any java files run explicitly in this shell
- # should use TESTJAVA in the path to the java interpreter.
- # So, we'll set this to the JDK spec'd on the command line. If none
- # is given on the command line, tell the user that and use a default.
- # THIS IS THE JDK BEING TESTED.
- if [ -n "$1" ] ; then
- TESTJAVA=$1
- else
- TESTJAVA=$JAVA_HOME
- fi
- TESTSRC=.
- TESTCLASSES=.
- #Deal with .class files:
-fi
-#
-echo "JDK under test is: $TESTJAVA"
-#
-CP="-classpath ${TESTCLASSES}${PATHSEP}${TESTJAVA}/lib/jconsole.jar"
-# Compile the test class using the classpath we need:
-#
-env
-#
-set -vx
-#
-#Compile. jconsole.jar is required on the classpath.
-${TESTJAVA}/bin/javac -d "${TESTCLASSES}" ${CP} -g \
- "${TESTSRC}"/"${TARGETCLASS}".java
-#
-#Run the test class, again with the classpath we need:
-${TESTJAVA}/bin/java ${TESTVMOPTS} ${CP} ${TARGETCLASS}
-status=$?
-echo "test status was: $status"
-if [ $status -eq "0" ];
- then pass ""
-
- else fail "unspecified test failure"
-fi
--- a/jdk/test/sun/tools/native2ascii/resources/ImmutableResourceTest.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/sun/tools/native2ascii/resources/ImmutableResourceTest.java Wed Jul 05 20:08:34 2017 +0200
@@ -23,12 +23,10 @@
/**
*
- *
- * This isn't the test case: ImmutableResourceTest.sh is.
- * Refer to ImmutableResourceTest.sh when running this test.
- *
+ * @test
* @bug 6287579
* @summary SubClasses of ListResourceBundle should fix getContents()
+ * @run main ImmutableResourceTest
*
* @author Tim Bell
*
--- a/jdk/test/sun/tools/native2ascii/resources/ImmutableResourceTest.sh Tue Nov 18 15:25:16 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-#
-# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 6287579
-# @summary SubClasses of ListResourceBundle should fix getContents()
-# @author Tim Bell
-#
-# @run shell ImmutableResourceTest.sh
-#
-#
-
-# Beginning of subroutines:
-status=1
-
-#Call this from anywhere to fail the test with an error message
-# usage: fail "reason why the test failed"
-fail()
- { echo "The test failed :-("
- echo "$*" 1>&2
- echo "exit status was $status"
- exit $status
- } #end of fail()
-
-#Call this from anywhere to pass the test with a message
-# usage: pass "reason why the test passed if applicable"
-pass()
- { echo "The test passed!!!"
- echo "$*" 1>&2
- exit 0
- } #end of pass()
-
-# end of subroutines
-
-# The beginning of the script proper
-
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- PATHSEP=":"
- ;;
-
- Windows* | CYGWIN*)
- PATHSEP=";"
- ;;
-
- # catch all other OSs
- * )
- echo "Unrecognized system! $OS"
- fail "Unrecognized system! $OS"
- ;;
-esac
-
-TARGETCLASS="ImmutableResourceTest"
-if [ -z "${TESTJAVA}" ] ; then
- # TESTJAVA is not set, so the test is running stand-alone.
- # TESTJAVA holds the path to the root directory of the build of the JDK
- # to be tested. That is, any java files run explicitly in this shell
- # should use TESTJAVA in the path to the java interpreter.
- # So, we'll set this to the JDK spec'd on the command line. If none
- # is given on the command line, tell the user that and use a default.
- # THIS IS THE JDK BEING TESTED.
- if [ -n "$1" ] ; then
- TESTJAVA=$1
- else
- TESTJAVA=$JAVA_HOME
- fi
- TESTSRC=.
- TESTCLASSES=.
- #Deal with .class files:
-fi
-#
-echo "JDK under test is: $TESTJAVA"
-#
-CP="-classpath ${TESTCLASSES}${PATHSEP}${TESTJAVA}/lib/tools.jar"
-# Compile the test class using the classpath we need:
-#
-env
-#
-set -vx
-#
-#Compile. tools.jar is required on the classpath.
-${TESTJAVA}/bin/javac -d "${TESTCLASSES}" ${CP} -g \
- "${TESTSRC}"/"${TARGETCLASS}".java
-#
-#Run the test class, again with the classpath we need:
-${TESTJAVA}/bin/java ${TESTVMOPTS} ${CP} ${TARGETCLASS}
-status=$?
-echo "test status was: $status"
-if [ $status -eq "0" ];
- then pass ""
-
- else fail "unspecified test failure"
-fi
--- a/jdk/test/tools/jar/LeadingGarbage.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/tools/jar/LeadingGarbage.java Wed Jul 05 20:08:34 2017 +0200
@@ -46,8 +46,7 @@
@Test
public class LeadingGarbage {
final String jar =
- Paths.get(new File(System.getProperty("java.home")).getParent(),
- "bin", "jar").toString();
+ Paths.get(System.getProperty("java.home"), "bin", "jar").toString();
final File[] files = { new File("a"), new File("b") };
final File normalZip = new File("normal.zip");
final File leadingGarbageZip = new File("leadingGarbage.zip");
--- a/jdk/test/tools/launcher/VersionCheck.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/tools/launcher/VersionCheck.java Wed Jul 05 20:08:34 2017 +0200
@@ -46,13 +46,16 @@
"java-rmi",
"java-rmi.cgi",
"java",
+ "javacpl",
"javaw",
"javaws",
"jcontrol",
"jmc",
"jmc.ini",
+ "jp2launcher",
"jvisualvm",
"packager",
+ "ssvagent",
"unpack200",
"wsimport"
};
@@ -71,6 +74,7 @@
"jconsole",
"jcontrol",
"jdeps",
+ "jimage",
"jinfo",
"jmap",
"jmc",
@@ -78,6 +82,7 @@
"jps",
"jrunscript",
"jjs",
+ "jp2launcher",
"jsadebugd",
"jstack",
"jstat",
@@ -98,6 +103,7 @@
"schemagen", // returns error code 127
"serialver",
"servertool",
+ "ssvagent",
"tnameserv",
"unpack200",
"wsgen",
--- a/jdk/test/tools/pack200/CommandLineTests.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/tools/pack200/CommandLineTests.java Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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
@@ -24,6 +24,7 @@
/*
* @test CommandLineTests.sh
* @bug 6521334 6965836 6965836
+ * @ignore 8059906
* @compile -XDignore.symbol.file CommandLineTests.java Pack200Test.java
* @run main/timeout=1200 CommandLineTests
* @summary An ad hoc test to verify the behavior of pack200/unpack200 CLIs,
--- a/jdk/test/tools/pack200/Pack200Props.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/tools/pack200/Pack200Props.java Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, 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
@@ -54,9 +54,9 @@
Utils.cleanup();
}
- static void verifySegmentLimit(File outFile) {
+ static void verifySegmentLimit(File outFile) throws IOException {
File sdkHome = Utils.JavaSDK;
- File testJar = new File(new File(sdkHome, "lib"), "tools.jar");
+ File testJar = Utils.createRtJar();
System.out.println("using pack200: " + Utils.getPack200Cmd());
--- a/jdk/test/tools/pack200/Pack200Test.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/tools/pack200/Pack200Test.java Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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
@@ -126,8 +126,7 @@
public static void main(String[] args) throws IOException {
// select the jars carefully, adding more jars will increase the
// testing time, especially for jprt.
- jarList.add(Utils.locateJar("tools.jar"));
- jarList.add(Utils.locateJar("rt.jar"));
+ jarList.add(Utils.createRtJar());
jarList.add(Utils.locateJar("golden.jar"));
System.out.println(jarList);
doPackUnpack();
--- a/jdk/test/tools/pack200/PackageVersionTest.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/tools/pack200/PackageVersionTest.java Wed Jul 05 20:08:34 2017 +0200
@@ -54,10 +54,6 @@
public final static int JAVA7_PACKAGE_MINOR_VERSION = 1;
public static void main(String... args) throws IOException {
- if (!javaHome.getName().endsWith("jre")) {
- throw new RuntimeException("Error: requires an SDK to run");
- }
-
File out = new File("test.pack");
createClassFile("Test6");
createClassFile("Test7");
--- a/jdk/test/tools/pack200/T7007157.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/tools/pack200/T7007157.java Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, 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
@@ -38,7 +38,8 @@
public static void main(String... args) throws IOException {
File sdkHome = Utils.JavaSDK;
- File testJar = new File(new File(sdkHome, "lib"), "tools.jar");
+ File testJar = new File("test.jar");
+ Utils.jar("cvf", testJar.getName(), Utils.TEST_CLS_DIR.getAbsolutePath());
JarFile jarFile = new JarFile(testJar);
File packFile = new File("foo.pack");
Pack200.Packer packer = Pack200.newPacker();
--- a/jdk/test/tools/pack200/Utils.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/tools/pack200/Utils.java Wed Jul 05 20:08:34 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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
@@ -54,8 +54,7 @@
*/
/*
- * This class contains all the commonly used utilities used by various tests
- * in this directory.
+ * This class contains the commonly used utilities.
*/
class Utils {
static final String JavaHome = System.getProperty("test.java",
@@ -79,12 +78,6 @@
private Utils() {} // all static
- static {
- if (!JavaHome.endsWith("jre")) {
- throw new RuntimeException("Error: requires an SDK to run");
- }
- }
-
private static void init() throws IOException {
if (VerifierJar.exists()) {
return;
@@ -137,8 +130,7 @@
List<String> cmds = new ArrayList<String>();
cmds.add(getJavaCmd());
cmds.add("-cp");
- cmds.add(Utils.locateJar("tools.jar") +
- System.getProperty("path.separator") + VerifierJar.getName());
+ cmds.add(VerifierJar.getName());
cmds.add("sun.tools.pack.verify.Main");
cmds.add(reference.getAbsolutePath());
cmds.add(specimen.getAbsolutePath());
@@ -152,8 +144,7 @@
List<String> cmds = new ArrayList<String>();
cmds.add(getJavaCmd());
cmds.add("-cp");
- cmds.add(Utils.locateJar("tools.jar")
- + System.getProperty("path.separator") + VerifierJar.getName());
+ cmds.add(VerifierJar.getName());
cmds.add("sun.tools.pack.verify.Main");
cmds.add(reference.getName());
cmds.add(specimen.getName());
@@ -343,17 +334,21 @@
}
static void compiler(String... javacCmds) {
- if (com.sun.tools.javac.Main.compile(javacCmds) != 0) {
- throw new RuntimeException("compilation failed");
+ List<String> cmdList = new ArrayList<>();
+ cmdList.add(getJavacCmd());
+ for (String x : javacCmds) {
+ cmdList.add(x);
}
+ runExec(cmdList);
}
static void jar(String... jargs) {
- sun.tools.jar.Main jarTool =
- new sun.tools.jar.Main(System.out, System.err, "jartool");
- if (!jarTool.run(jargs)) {
- throw new RuntimeException("jar command failed");
+ List<String> cmdList = new ArrayList<>();
+ cmdList.add(getJarCmd());
+ for (String x : jargs) {
+ cmdList.add(x);
}
+ runExec(cmdList);
}
static void testWithRepack(File inFile, String... repackOpts) throws IOException {
@@ -528,6 +523,18 @@
return getAjavaCmd("java");
}
+ static String getJavacCmd() {
+ return getAjavaCmd("javac");
+ }
+
+ static String getJarCmd() {
+ return getAjavaCmd("jar");
+ }
+
+ static String getJimageCmd() {
+ return getAjavaCmd("jimage");
+ }
+
static String getAjavaCmd(String cmdStr) {
File binDir = new File(JavaHome, "bin");
File unpack200File = IsWindows
@@ -542,6 +549,31 @@
return cmd;
}
+ static File createRtJar() throws IOException {
+ File LibDir = new File(JavaHome, "lib");
+ File ModuleDir = new File(LibDir, "modules");
+ File BootModules = new File(ModuleDir, "bootmodules.jimage");
+ List<String> cmdList = new ArrayList<>();
+ cmdList.add(getJimageCmd());
+ cmdList.add("extract");
+ cmdList.add(BootModules.getAbsolutePath());
+ cmdList.add("--dir");
+ cmdList.add("out");
+ runExec(cmdList);
+
+ File rtJar = new File("rt.jar");
+ cmdList.clear();
+ cmdList.add(getJarCmd());
+ cmdList.add("cvf");
+ cmdList.add(rtJar.getName());
+ cmdList.add("-C");
+ cmdList.add("out");
+ cmdList.add(".");
+ runExec(cmdList);
+
+ recursiveDelete(new File("out"));
+ return rtJar;
+ }
private static List<File> locaterCache = null;
// search the source dir and jdk dir for requested file and returns
// the first location it finds.
--- a/jdk/test/tools/pack200/pack200-verifier/src/sun/tools/pack/verify/Globals.java Tue Nov 18 15:25:16 2014 -0800
+++ b/jdk/test/tools/pack200/pack200-verifier/src/sun/tools/pack/verify/Globals.java Wed Jul 05 20:08:34 2017 +0200
@@ -170,7 +170,6 @@
println("\tjava.home=" + System.getProperty("java.home"));
println("\tjava.class.version=" + System.getProperty("java.class.version"));
println("\tjava.class.path=" + System.getProperty("java.class.path"));
- println("\tjava.ext.dirs=" + System.getProperty("java.ext.dirs"));
println("\tos.name=" + System.getProperty("os.name"));
println("\tos.arch=" + System.getProperty("os.arch"));
println("\tos.version=" + System.getProperty("os.version"));
--- a/make/CompileJavaModules.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/make/CompileJavaModules.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -235,6 +235,11 @@
################################################################################
+java.scripting_COPY := .js
+java.scripting_CLEAN := .properties
+
+################################################################################
+
java.sql_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
################################################################################
@@ -318,6 +323,9 @@
################################################################################
jdk.compiler_COPY := javax.tools.JavaCompilerTool
+jdk.compiler_CLEAN_FILES := $(wildcard \
+ $(patsubst %, $(JDK_TOPDIR)/src/jdk.compiler/share/classes/%/*.properties, \
+ sun/tools/serialver/resources))
################################################################################
@@ -366,12 +374,6 @@
################################################################################
-jdk.compiler_CLEAN_FILES := $(wildcard \
- $(patsubst %, $(JDK_TOPDIR)/src/jdk.compiler/share/classes/%/*.properties, \
- sun/tools/serialver/resources))
-
-################################################################################
-
jdk.jdi_EXCLUDES += \
com/sun/tools/example/debug/bdi \
com/sun/tools/example/debug/event \
@@ -426,10 +428,8 @@
#
# To use this variable, use $(call ALL_SRC_DIRS,module) with no space.
GENERATED_SRC_DIRS += \
- $(JDK_OUTPUTDIR)/gensrc/$1 \
- $(LANGTOOLS_OUTPUTDIR)/gensrc/$1 \
- $(CORBA_OUTPUTDIR)/gensrc/$1 \
- $(JDK_OUTPUTDIR)/gensrc_no_srczip/$1 \
+ $(SUPPORT_OUTPUTDIR)/gensrc/$1 \
+ $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$1 \
#
OS_SRC_DIRS += $(JDK_TOPDIR)/src/$1/$(OPENJDK_TARGET_OS)/classes
@@ -488,7 +488,7 @@
SRC := $$(wildcard $$(call ALL_SRC_DIRS,$1)), \
INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
BIN := $(JDK_OUTPUTDIR)/modules/$1, \
- HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers/$1, \
+ HEADERS := $(SUPPORT_OUTPUTDIR)/headers/$1, \
ADD_JAVAC_FLAGS := $$($1_JAVAC_FLAGS)))
$1: $$($1) $$($1_COPY_EXTRA)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/Images.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,496 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+TOOL_TARGETS :=
+JDK_TARGETS :=
+JRE_TARGETS :=
+
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, , Images-pre.gmk))
+
+############################################################################
+
+MAIN_MODULES += java.se java.smartcardio jdk.httpserver jdk.sctp \
+ jdk.security.auth jdk.security.jgss jdk.runtime
+
+# providers
+PROVIDER_MODULES += jdk.charsets jdk.crypto.ec jdk.crypto.pkcs11 jdk.jvmstat jdk.localedata \
+ jdk.naming.dns jdk.naming.rmi jdk.scripting.nashorn jdk.zipfs
+
+# tools
+TOOLS_MODULES += jdk.attach jdk.compiler jdk.dev jdk.javadoc jdk.jcmd jdk.jconsole \
+ jdk.hotspot.agent jdk.hprof.agent jdk.jdi jdk.jdwp.agent jdk.rmic \
+ jdk.xml.bind jdk.xml.ws
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ PROVIDER_MODULES += jdk.crypto.mscapi
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+ PROVIDER_MODULES += jdk.crypto.ucrypto
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+ MAIN_MODULES += jdk.deploy.osx
+endif
+
+JRE_MODULES := $(MAIN_MODULES) $(PROVIDER_MODULES)
+JDK_MODULES := $(JRE_MODULES) $(TOOLS_MODULES)
+
+# compact3 builds have additional modules
+JDK_COMPACT3_MODULES := java.compact3 java.smartcardio jdk.httpserver jdk.naming.dns \
+ jdk.naming.rmi jdk.sctp jdk.security.auth
+
+# Replacing double-comma with a single comma is to workaround the issue
+# with some version of make on windows that doesn't substitute spaces
+# with one comma properly as with make 4.0
+define SubstComma
+ $(subst $(COMMA)$(COMMA),$(COMMA),$(subst $(SPACE),$(COMMA),$(strip $1)))
+endef
+JRE_MODULES_LIST := $(call SubstComma, $(JRE_MODULES))
+JDK_MODULES_LIST := $(call SubstComma, $(JDK_MODULES))
+
+################################################################################
+
+JRE_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/jre-sorted-modules
+JDK_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/jdk-sorted-modules
+JRE_COMPACT1_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact1-sorted-modules
+JRE_COMPACT2_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact2-sorted-modules
+JRE_COMPACT3_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact3-sorted-modules
+
+
+MODULES_CMDS := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
+MODULES_LIBS := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
+MODULES_CONF := $(SUPPORT_OUTPUTDIR)/modules_conf
+
+JIMAGE_TOOL := $(JAVA_SMALL) \
+ -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
+ -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.module.ImageBuilder \
+ --cmds $(MODULES_CMDS) \
+ --libs $(MODULES_LIBS) \
+ --configs $(MODULES_CONF) \
+ --classes $(JDK_OUTPUTDIR)/modules \
+ --endian $(OPENJDK_TARGET_CPU_ENDIAN) \
+ #
+
+MODULES_XML += $(SRC_ROOT)/modules.xml
+DEPENDENCIES := $(call CacheFind, \
+ $(SUPPORT_OUTPUTDIR)/modules_cmds \
+ $(SUPPORT_OUTPUTDIR)/modules_libs) \
+ $(wildcard $(JDK_OUTPUTDIR)/modules/*/_*) \
+ $(MODULES_XML)
+ #
+
+# Use this file inside the image as target for make rule
+JIMAGE_TARGET_FILE := bin/java$(EXE_SUFFIX)
+
+$(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+ $(ECHO) Creating jdk jimage
+ $(RM) -r $(JDK_IMAGE_DIR) $(JDK_SORTED_MODULES)
+ $(JIMAGE_TOOL) --mods $(JDK_MODULES_LIST) --output $(JDK_IMAGE_DIR) \
+ $(MODULES_XML) > $(JDK_SORTED_MODULES)
+ $(TOUCH) $@
+
+$(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+ $(ECHO) Creating jre jimage
+ $(RM) -r $(JRE_IMAGE_DIR) $(JRE_SORTED_MODULES)
+ $(JIMAGE_TOOL) --mods $(JRE_MODULES_LIST) --output $(JRE_IMAGE_DIR) \
+ $(MODULES_XML) > $(JRE_SORTED_MODULES)
+ $(TOUCH) $@
+
+JRE_COMPACT1_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact1
+JRE_COMPACT2_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact2
+JRE_COMPACT3_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact3
+
+COMPACT_EXTRA_MODULES := jdk.localedata jdk.crypto.pkcs11 jdk.crypto.ec
+
+$(JRE_COMPACT1_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+ $(ECHO) Creating jre compact1 jimage
+ $(RM) -r $(JRE_COMPACT1_IMAGE_DIR) $(JRE_COMPACT1_SORTED_MODULES)
+ $(JIMAGE_TOOL) \
+ --mods $(call SubstComma, java.compact1 $(COMPACT_EXTRA_MODULES)) \
+ --output $(JRE_COMPACT1_IMAGE_DIR) \
+ $(MODULES_XML) > $(JRE_COMPACT1_SORTED_MODULES)
+ $(TOUCH) $@
+
+$(JRE_COMPACT2_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+ $(ECHO) Creating jre compact2 jimage
+ $(RM) -r $(JRE_COMPACT2_IMAGE_DIR) $(JRE_COMPACT2_SORTED_MODULES)
+ $(JIMAGE_TOOL) \
+ --mods $(call SubstComma, java.compact2 $(COMPACT_EXTRA_MODULES)) \
+ --output $(JRE_COMPACT2_IMAGE_DIR) \
+ $(MODULES_XML) > $(JRE_COMPACT2_SORTED_MODULES)
+ $(TOUCH) $@
+
+$(JRE_COMPACT3_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+ $(ECHO) Creating jre compact3 jimage
+ $(RM) -r $(JRE_COMPACT3_IMAGE_DIR) $(JRE_COMPACT3_SORTED_MODULES)
+ $(JIMAGE_TOOL) \
+ --mods $(call SubstComma, $(JDK_COMPACT3_MODULES) $(COMPACT_EXTRA_MODULES)) \
+ --output $(JRE_COMPACT3_IMAGE_DIR) \
+ $(MODULES_XML) > $(JRE_COMPACT3_SORTED_MODULES)
+ $(TOUCH) $@
+
+TOOL_JRE_TARGETS := $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+TOOL_JDK_TARGETS := $(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+TOOL_JRE_COMPACT1_TARGETS := $(JRE_COMPACT1_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+TOOL_JRE_COMPACT2_TARGETS := $(JRE_COMPACT2_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+TOOL_JRE_COMPACT3_TARGETS := $(JRE_COMPACT3_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+
+################################################################################
+# /man dir
+#
+# All variables in this section are assigned with simple =, without :, to enable
+# more selective overriding from the custom version of this file.
+#
+# Avoid evaluating this whole section on windows for speed and stability
+ifneq ($(OPENJDK_TARGET_OS), windows)
+ JRE_MAN_PAGES += \
+ java.1 \
+ jjs.1 \
+ keytool.1 \
+ orbd.1 \
+ pack200.1 \
+ policytool.1 \
+ rmid.1 \
+ rmiregistry.1 \
+ servertool.1 \
+ tnameserv.1 \
+ unpack200.1
+
+ ifndef OPENJDK
+ ifneq ($(OPENJDK_TARGET_OS), solaris)
+ JRE_MAN_PAGES += javaws.1
+ endif
+ endif
+
+ JDK_MAN_PAGES += \
+ $(JRE_MAN_PAGES) \
+ appletviewer.1 \
+ idlj.1 \
+ jar.1 \
+ jarsigner.1 \
+ javac.1 \
+ javadoc.1 \
+ javah.1 \
+ javap.1 \
+ jconsole.1 \
+ jcmd.1 \
+ jdb.1 \
+ jdeps.1 \
+ jhat.1 \
+ jinfo.1 \
+ jmap.1 \
+ jps.1 \
+ jrunscript.1 \
+ jsadebugd.1 \
+ jstack.1 \
+ jstat.1 \
+ jstatd.1 \
+ native2ascii.1 \
+ rmic.1 \
+ schemagen.1 \
+ serialver.1 \
+ wsgen.1 \
+ wsimport.1 \
+ xjc.1
+
+ # This variable is potentially overridden in the closed makefile.
+ MAN_SRC_BASEDIR ?= $(JDK_TOPDIR)/src
+
+ ifeq ($(OPENJDK_TARGET_OS), linux)
+ MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/linux/doc
+ MAN1_SUBDIR = man
+ endif
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/solaris/doc
+ MAN1_SUBDIR = sun/man/man1
+ endif
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+ MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/bsd/doc
+ MAN1_SUBDIR = man
+ endif
+
+ $(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
+ $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(install-file)
+
+ $(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
+ $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(install-file)
+
+ define install-ja-manpage
+ $(MKDIR) -p $(@D)
+ $(CAT) $< \
+ | $(NATIVE2ASCII) -encoding eucJP \
+ | $(SED) 's/@@VERSION@@/$(THIS_JDK_VERSION)/g' \
+ | $(NATIVE2ASCII) -reverse -encoding $1 \
+ > $@
+ endef
+
+ $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+ $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call install-ja-manpage, UTF-8)
+
+ $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+ $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call install-ja-manpage, UTF-8)
+
+ $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+ $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call install-ja-manpage, PCK)
+
+ $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+ $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call install-ja-manpage, PCK)
+
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ $(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+ $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(install-file)
+
+ $(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+ $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(install-file)
+ endif
+
+ ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
+ $(JRE_IMAGE_DIR)/man/ja:
+ $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
+
+ $(JDK_IMAGE_DIR)/man/ja:
+ $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
+ endif
+
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
+ $(addprefix $(JRE_IMAGE_DIR)/man/ja/man1/, $(JRE_MAN_PAGES)) \
+ $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
+ $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JRE_MAN_PAGES))
+
+ JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
+ $(addprefix $(JDK_IMAGE_DIR)/man/ja/man1/, $(JDK_MAN_PAGES)) \
+ $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
+ $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JDK_MAN_PAGES))
+ endif
+
+ ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
+ JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
+ $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
+ $(JRE_IMAGE_DIR)/man/ja
+
+ JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
+ $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
+ $(JDK_IMAGE_DIR)/man/ja
+ endif
+
+ JRE_TARGETS += $(JRE_MAN_PAGE_LIST)
+ JDK_TARGETS += $(JDK_MAN_PAGE_LIST)
+endif # Windows
+
+################################################################################
+# /include dir
+
+$(eval $(call SetupCopyFiles,COPY_INCLUDES, \
+ SRC := $(JDK_OUTPUTDIR)/include, \
+ DEST := $(JDK_IMAGE_DIR)/include, \
+ FILES := $(call CacheFind,$(JDK_OUTPUTDIR)/include)))
+
+JDK_TARGETS += $(COPY_INCLUDES)
+
+################################################################################
+# doc files
+
+JRE_DOC_FILES ?= LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
+JDK_DOC_FILES ?= LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
+JRE_DOC_LOCATION ?= $(JDK_TOPDIR)
+JDK_DOC_LOCATION ?= $(JDK_TOPDIR)
+
+JRE_DOC_TARGETS := $(addprefix $(JRE_IMAGE_DIR)/, $(JRE_DOC_FILES))
+JDK_DOC_TARGETS := $(addprefix $(JDK_IMAGE_DIR)/, $(JDK_DOC_FILES))
+
+# Processing license files from source area to image area
+# These are modified to have the platform specific EOL chars.
+define process-doc-file
+ $(ECHO) $(LOG_INFO) Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ LC_ALL=C $(SED) 's/$$//g' $< > $@
+ $(CHMOD) 444 $@
+endef
+
+$(JRE_IMAGE_DIR)/%: $(JRE_DOC_LOCATION)/%
+ $(process-doc-file)
+
+$(JDK_IMAGE_DIR)/%: $(JDK_DOC_LOCATION)/%
+ $(process-doc-file)
+
+JRE_TARGETS += $(JRE_DOC_TARGETS)
+JDK_TARGETS += $(JDK_DOC_TARGETS)
+
+################################################################################
+# Release file
+
+JRE_INFO_FILE := $(JRE_IMAGE_DIR)/release
+JDK_INFO_FILE := $(JDK_IMAGE_DIR)/release
+JRE_COMPACT1_INFO_FILE := $(JRE_COMPACT1_IMAGE_DIR)/release
+JRE_COMPACT2_INFO_FILE := $(JRE_COMPACT2_IMAGE_DIR)/release
+JRE_COMPACT3_INFO_FILE := $(JRE_COMPACT3_IMAGE_DIR)/release
+
+# Common way to emit a line into the release or info file
+define info-file-item # name value
+ $(PRINTF) '%s="%s"\n' $1 $2 >> $@
+endef
+
+# Param 1 - The file containing the MODULES list
+define create-info-file
+ $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(call info-file-item, "JAVA_VERSION", "$(JDK_VERSION)")
+ $(call info-file-item, "OS_NAME", "$(REQUIRED_OS_NAME)")
+ $(call info-file-item, "OS_VERSION", "$(REQUIRED_OS_VERSION)")
+ $(call info-file-item, "OS_ARCH", "$(OPENJDK_TARGET_CPU_LEGACY)")
+ $(if $(JDK_ARCH_ABI_PROP_NAME), \
+ $(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)"))
+ $(call info-file-item, "SOURCE", "$(ALL_SOURCE_TIPS)")
+ $(call info-file-item, "MODULES", "`$(CAT) $1`")
+endef
+
+ALL_SOURCE_TIPS = $(shell \
+ if [ -f $(SUPPORT_OUTPUTDIR)/source_tips ] ; then \
+ $(CAT) $(SUPPORT_OUTPUTDIR)/source_tips ; \
+ fi)
+
+$(JRE_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+ $(call create-info-file, $(JRE_SORTED_MODULES))
+
+$(JDK_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+ $(call create-info-file, $(JDK_SORTED_MODULES))
+
+$(JRE_COMPACT1_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+ $(call create-info-file, $(JRE_COMPACT1_SORTED_MODULES))
+ $(call info-file-item, "JAVA_PROFILE", "compact1")
+
+$(JRE_COMPACT2_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+ $(call create-info-file, $(JRE_COMPACT2_SORTED_MODULES))
+ $(call info-file-item, "JAVA_PROFILE", "compact2")
+
+$(JRE_COMPACT3_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+ $(call create-info-file, $(JRE_COMPACT3_SORTED_MODULES))
+ $(call info-file-item, "JAVA_PROFILE", "compact3")
+
+JRE_TARGETS += $(JRE_INFO_FILE)
+JDK_TARGETS += $(JDK_INFO_FILE)
+JRE_COMPACT1_TARGETS += $(JRE_COMPACT1_INFO_FILE)
+JRE_COMPACT2_TARGETS += $(JRE_COMPACT2_INFO_FILE)
+JRE_COMPACT3_TARGETS += $(JRE_COMPACT3_INFO_FILE)
+
+################################################################################
+# src.zip
+
+$(JDK_IMAGE_DIR)/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
+ $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(install-file)
+
+JDK_TARGETS += $(JDK_IMAGE_DIR)/src.zip
+
+################################################################################
+# /demo dir
+
+# The db demo contains an empty dir that needs to be copied. The other
+# directories will always trigger the rule for recompile since
+# _the.list_of_packages files are touched.
+ifneq ($(findstring images, $(MAKECMDGOALS)), )
+ $(JDK_IMAGE_DIR)/demo/%: $(SUPPORT_OUTPUTDIR)/demo/image/%
+ if [ ! -d "$@" ]; then \
+ $(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'; \
+ $(MKDIR) -p $(@D); \
+ if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) '$<' '$@'; fi \
+ fi
+
+ # Find all files including directories
+ JDK_DEMO_TARGETS := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demo/image), \
+ $(patsubst $(SUPPORT_OUTPUTDIR)/demo/image/%, $(JDK_IMAGE_DIR)/demo/%, \
+ $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demo/image \
+ ! \( -name "_the*" -o -name "javac_state" \) )))
+
+ JDK_TARGETS += $(JDK_DEMO_TARGETS)
+endif
+
+################################################################################
+# /sample dir
+
+$(eval $(call SetupCopyFiles,COPY_SAMPLES, \
+ SRC := $(SUPPORT_OUTPUTDIR)/sample, \
+ DEST := $(JDK_IMAGE_DIR)/sample, \
+ FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample), \
+ $(call CacheFind,$(SUPPORT_OUTPUTDIR)/sample))))
+
+JDK_TARGETS += $(COPY_SAMPLES)
+
+################################################################################
+# jrt-fs.jar
+
+$(eval $(call SetupCopyFiles,COPY_JRTFS_JAR, \
+ SRC := $(SUPPORT_OUTPUTDIR), \
+ DEST := $(JDK_IMAGE_DIR), \
+ FILES := $(SUPPORT_OUTPUTDIR)/jrt-fs.jar))
+
+JDK_TARGETS += $(COPY_JRTFS_JAR)
+
+################################################################################
+
+# Include custom post hook here to make it possible to augment the target lists
+# before actual target prerequisites are declared.
+$(eval $(call IncludeCustomExtension, , Images-post.gmk))
+
+################################################################################
+
+$(JRE_TARGETS): $(TOOL_JRE_TARGETS)
+$(JDK_TARGETS): $(TOOL_JDK_TARGETS)
+
+jimages: $(TOOL_JRE_TARGETS) $(TOOL_JDK_TARGETS) $(JRE_TARGETS) $(JDK_TARGETS)
+
+
+$(JRE_COMPACT1_TARGETS): $(TOOL_JRE_COMPACT1_TARGETS)
+$(JRE_COMPACT2_TARGETS): $(TOOL_JRE_COMPACT2_TARGETS)
+$(JRE_COMPACT3_TARGETS): $(TOOL_JRE_COMPACT3_TARGETS)
+
+profiles: $(TOOL_JRE_COMPACT1_TARGETS) \
+ $(TOOL_JRE_COMPACT2_TARGETS) \
+ $(TOOL_JRE_COMPACT3_TARGETS) \
+ $(JRE_COMPACT1_TARGETS) \
+ $(JRE_COMPACT2_TARGETS) \
+ $(JRE_COMPACT3_TARGETS)
+
+.PHONY: default all jimages profiles
--- a/make/Javadoc.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/make/Javadoc.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -44,8 +44,8 @@
# Definitions for directories
#
-DOCSDIR := $(OUTPUT_ROOT)/docs
-TEMPDIR := $(OUTPUT_ROOT)/docstemp
+DOCSDIR := $(IMAGES_OUTPUTDIR)/docs
+DOCSTMPDIR = $(SUPPORT_OUTPUTDIR)/docs
HOTSPOT_DOCS_IMPORT_PATH=$(HOTSPOT_OUTPUTDIR)/docs
@@ -142,9 +142,8 @@
$(CORBA_TOPDIR)/src/*/share/classes \
$(JAXP_TOPDIR)/src/*/share/classes \
$(JAXWS_TOPDIR)/src/*/share/classes \
- $(JDK_OUTPUTDIR)/gensrc/j* \
- $(JDK_OUTPUTDIR)/gendocsrc_rmic \
- $(CORBA_OUTPUTDIR)/gensrc/j* \
+ $(SUPPORT_OUTPUTDIR)/gensrc/j* \
+ $(SUPPORT_OUTPUTDIR)/rmic/j* \
$(JDK_TOPDIR)/src/*/share/doc/stub \
) \
#
@@ -202,11 +201,6 @@
endef
#
-# Temporary directory for javadoc creation
-#
-DOCSTMPDIR = $(TEMPDIR)/doctmp
-
-#
# Different api directories created from root directory
#
COREAPI_DOCSDIR = $(DOCSDIR)/api
@@ -271,7 +265,6 @@
$(call OptionOnly,-quiet) ; \
$(call OptionOnly,-use) ; \
$(call OptionOnly,-keywords) ; \
- $(call OptionPair,-Xprofilespath,$(JDK_TOPDIR)/make/profile-rtjar-includes.txt) ; \
$(call OptionOnly,$(ADDITIONAL_JAVADOCFLAGS))
endef
@@ -668,7 +661,7 @@
JDWP_DOCDIR = $(PLATFORM_DOCSDIR)/jpda/jdwp
jdwpdocs: $(JDWP_DOCDIR)/jdwp-protocol.html
-$(JDWP_DOCDIR)/jdwp-protocol.html : $(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html
+$(JDWP_DOCDIR)/jdwp-protocol.html : $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/JrtfsJar.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+
+$(eval $(call SetupArchive,JRTFS_JAR, , \
+ SRCS := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes, \
+ JAR := $(SUPPORT_OUTPUTDIR)/jrt-fs.jar, \
+ MANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf))
+
+all: $(JRTFS_JAR)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/MacBundles.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,137 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include $(SPEC)
+include MakeBase.gmk
+
+default: bundles
+
+# Only macosx has bundles defined.
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+
+ bundles: jre-bundle jdk-bundle
+
+ # JDK_BUNDLE_DIR and JRE_BUNDLE_DIR are defined in SPEC.
+
+ MACOSX_PLIST_SRC := $(JDK_TOPDIR)/make/data/bundle
+
+ # All these OPENJDK checks are needed since there is no coherency between
+ # these values in open and closed. Should probably be fixed.
+ ifndef OPENJDK
+ BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(JDK_MINOR_VERSION)u$(JDK_UPDATE_VERSION)
+ else
+ BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE)
+ endif
+ BUNDLE_ID_JRE := $(BUNDLE_ID).jre
+ BUNDLE_ID_JDK := $(BUNDLE_ID).jdk
+
+ BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_MINOR_VERSION)
+ BUNDLE_NAME_JRE := $(BUNDLE_NAME)
+ BUNDLE_NAME_JDK := $(BUNDLE_NAME)
+
+ ifndef OPENJDK
+ BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_VERSION)
+ else
+ BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) ($(JDK_VERSION))
+ endif
+ BUNDLE_INFO_JRE := $(BUNDLE_INFO)
+ BUNDLE_INFO_JDK := $(BUNDLE_INFO)
+
+ BUNDLE_PLATFORM_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)
+ BUNDLE_VERSION := $(JDK_VERSION)
+ ifeq ($(COMPANY_NAME), N/A)
+ BUNDLE_VENDOR := UNDEFINED
+ else
+ BUNDLE_VENDOR := $(COMPANY_NAME)
+ endif
+
+
+ JDK_FILE_LIST := $(shell $(FIND) $(JDK_IMAGE_DIR))
+ JRE_FILE_LIST := $(shell $(FIND) $(JRE_IMAGE_DIR))
+
+ JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_BUNDLE_DIR)/Home/,$(JDK_FILE_LIST))
+ JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_BUNDLE_DIR)/Home/,$(JRE_FILE_LIST))
+
+ # Copy empty directories (jre/lib/applet).
+ $(JDK_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
+ $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
+
+ $(JRE_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
+ $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
+
+ $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib:
+ $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(LN) -s ../Home/lib/jli/libjli.dylib $@
+
+ $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib:
+ $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(LN) -s ../Home/lib/jli/libjli.dylib $@
+
+ $(JDK_BUNDLE_DIR)/Info.plist: $(SPEC)
+ $(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ $(SED) -e "s/@@ID@@/$(BUNDLE_ID_JDK)/g" \
+ -e "s/@@NAME@@/$(BUNDLE_NAME_JDK)/g" \
+ -e "s/@@INFO@@/$(BUNDLE_INFO_JDK)/g" \
+ -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
+ -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
+ -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
+ < $(MACOSX_PLIST_SRC)/JDK-Info.plist > $@
+
+ $(JRE_BUNDLE_DIR)/Info.plist: $(SPEC)
+ $(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ $(SED) -e "s/@@ID@@/$(BUNDLE_ID_JRE)/g" \
+ -e "s/@@NAME@@/$(BUNDLE_NAME_JRE)/g" \
+ -e "s/@@INFO@@/$(BUNDLE_INFO_JRE)/g" \
+ -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
+ -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
+ -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
+ < $(MACOSX_PLIST_SRC)/JRE-Info.plist > $@
+
+ jdk-bundle: $(JDK_TARGET_LIST) $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib \
+ $(JDK_BUNDLE_DIR)/Info.plist
+ $(SETFILE) -a B $(dir $(JDK_BUNDLE_DIR))
+
+ jre-bundle: $(JRE_TARGET_LIST) $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib \
+ $(JRE_BUNDLE_DIR)/Info.plist
+ $(SETFILE) -a B $(dir $(JRE_BUNDLE_DIR))
+
+else # Not macosx
+
+ bundles:
+ $(ECHO) "No bundles defined for $(OPENJDK_TARGET_OS)"
+
+endif # macosx
+
+.PHONY: jdk-bundle jre-bundle bundles
--- a/make/Main.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/make/Main.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -39,9 +39,6 @@
include $(SRC_ROOT)/make/common/MakeBase.gmk
include $(SRC_ROOT)/make/common/Modules.gmk
-# Load common profile names definitions
-include $(JDK_TOPDIR)/make/ProfileNames.gmk
-
# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
# valid top level targets. It's used to declare them all as PHONY and to
# generate the -only targets.
@@ -64,19 +61,23 @@
################################################################################
# Interim/build tools targets, compiling tools used during the build
+buildtools-langtools:
+ +($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
+
interim-langtools:
+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
interim-corba:
- +($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileCorba.gmk)
+ +($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
interim-rmic:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
-build-tools-jdk:
+buildtools-jdk:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
-ALL_TARGETS += interim-langtools interim-corba build-tools-jdk
+ALL_TARGETS += buildtools-langtools interim-langtools interim-corba \
+ interim-rmic buildtools-jdk
################################################################################
# Special targets for certain modules
@@ -87,56 +88,42 @@
unpack-sec:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
-policy-jars:
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreatePolicyJars.gmk)
-
-ALL_TARGETS += import-hotspot unpack-sec policy-jars
+ALL_TARGETS += import-hotspot unpack-sec
################################################################################
# Gensrc targets, generating source before java compilation can be done
-JDK_GENSRC_MODULES := $(call FindModulesWithMakefileFor, gensrc, Gensrc)
-LANGTOOLS_GENSRC_MODULES := jdk.compiler.tools
-CORBA_GENSRC_MODULES := java.corba
-GENSRC_MODULES := $(JDK_GENSRC_MODULES) $(LANGTOOLS_GENSRC_MODULES) \
- $(CORBA_GENSRC_MODULES)
-JDK_GENSRC_TARGETS := $(addsuffix -gensrc, $(JDK_GENSRC_MODULES))
-LANGTOOLS_GENSRC_TARGETS := $(addsuffix -gensrc, $(LANGTOOLS_GENSRC_MODULES))
-CORBA_GENSRC_TARGETS := $(addsuffix -gensrc, $(CORBA_GENSRC_MODULES))
-GENSRC_TARGETS := $(addsuffix -gensrc, $(GENSRC_MODULES))
+$(eval $(call DeclareRecipesForPhase, GENSRC, \
+ TARGET_SUFFIX := gensrc, \
+ FILE_PREFIX := Gensrc, \
+ MAKE_SUBDIR := gensrc, \
+ CHECK_MODULES := $(ALL_MODULES), \
+ MULTIPLE_MAKEFILES := true))
-jdk.compiler.tools-gensrc:
- +($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GensrcLangtools.gmk)
-
-java.corba-gensrc:
- +($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GensrcCorba.gmk)
-
-# Declare recipes for all jdk <module>-gensrc targets
-$(foreach m, $(JDK_GENSRC_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
- $m, gensrc, gensrc, Gensrc)))
+JDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
+LANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
+CORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
ALL_TARGETS += $(GENSRC_TARGETS)
################################################################################
# Generate data targets
-GENDATA_MODULES := $(call FindModulesWithMakefileFor, gendata, Gendata)
-GENDATA_TARGETS := $(addsuffix -gendata, $(GENDATA_MODULES))
-
-# Declare recipes for all <module>-gendata targets
-$(foreach m, $(GENDATA_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
- $m, gendata, gendata, Gendata)))
-
-$(foreach m, $(GENDATA_MODULES), $(eval $(call DeclareGendataRecipe,$m)))
+$(eval $(call DeclareRecipesForPhase, GENDATA, \
+ TARGET_SUFFIX := gendata, \
+ FILE_PREFIX := Gendata, \
+ MAKE_SUBDIR := gendata, \
+ CHECK_MODULES := $(ALL_MODULES), \
+ USE_WRAPPER := true))
ALL_TARGETS += $(GENDATA_TARGETS)
################################################################################
# Copy files targets
-COPY_MODULES := $(call FindModulesWithMakefileFor, copy, Copy)
-COPY_TARGETS := $(addsuffix -copy, $(COPY_MODULES))
-
-# Declare recipes for all <module>-copy targets
-$(foreach m, $(COPY_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
- $m, copy, copy, Copy)))
+$(eval $(call DeclareRecipesForPhase, COPY, \
+ TARGET_SUFFIX := copy, \
+ FILE_PREFIX := Copy, \
+ MAKE_SUBDIR := copy, \
+ CHECK_MODULES := $(ALL_MODULES), \
+ USE_WRAPPER := true))
ALL_TARGETS += $(COPY_TARGETS)
@@ -163,36 +150,33 @@
################################################################################
# Targets for running rmic.
-RMIC_MODULES := $(call FindModulesWithMakefileFor, rmic, Rmic)
-RMIC_TARGETS := $(addsuffix -rmic, $(RMIC_MODULES))
-
-# Declare recipes for all <module>-rmic targets
-$(foreach m, $(RMIC_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
- $m, rmic, rmic, Rmic)))
+$(eval $(call DeclareRecipesForPhase, RMIC, \
+ TARGET_SUFFIX := rmic, \
+ FILE_PREFIX := Rmic, \
+ MAKE_SUBDIR := rmic, \
+ CHECK_MODULES := $(ALL_MODULES)))
ALL_TARGETS += $(RMIC_TARGETS)
################################################################################
# Targets for compiling native libraries
-ALL_LIB_MODULES := $(call FindModulesWithMakefileFor, lib, Lib)
-LIB_MODULES := $(filter $(ALL_MODULES), $(ALL_LIB_MODULES))
-LIB_TARGETS := $(addsuffix -libs, $(LIB_MODULES))
+$(eval $(call DeclareRecipesForPhase, LIBS, \
+ TARGET_SUFFIX := libs, \
+ FILE_PREFIX := Lib, \
+ MAKE_SUBDIR := lib, \
+ CHECK_MODULES := $(ALL_MODULES), \
+ USE_WRAPPER := true))
-# Declare recipes for all <module>-libs targets
-$(foreach m, $(LIB_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
- $m, libs, lib, Lib)))
-
-ALL_TARGETS += $(LIB_TARGETS)
+ALL_TARGETS += $(LIBS_TARGETS)
################################################################################
# Targets for compiling native executables
-ALL_LAUNCHER_MODULES := $(call FindModulesWithMakefileFor, launcher, Launcher)
-LAUNCHER_MODULES := $(filter $(ALL_MODULES), $(ALL_LAUNCHER_MODULES))
-LAUNCHER_TARGETS := $(addsuffix -launchers, $(LAUNCHER_MODULES))
-
-# Declare recipes for all <module>-launchers targets
-$(foreach m, $(LAUNCHER_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
- $m, launchers, launcher, Launcher)))
+$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
+ TARGET_SUFFIX := launchers, \
+ FILE_PREFIX := Launcher, \
+ MAKE_SUBDIR := launcher, \
+ CHECK_MODULES := $(ALL_MODULES), \
+ USE_WRAPPER := true))
ALL_TARGETS += $(LAUNCHER_TARGETS)
@@ -222,53 +206,40 @@
# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
# used to track the exact sources used to build that image.
-source-tips: $(OUTPUT_ROOT)/source_tips
-$(OUTPUT_ROOT)/source_tips: FRC
+source-tips: $(SUPPORT_OUTPUTDIR)/source_tips
+$(SUPPORT_OUTPUTDIR)/source_tips: FRC
@$(MKDIR) -p $(@D)
@$(RM) $@
@$(call GetSourceTips)
-security-jars:
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreateSecurityJars.gmk)
-
-nashorn-jar:
- +($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk all)
-
-# Creates the jar files (rt.jar resources.jar etc)
-main-jars:
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE="" -f CreateJars.gmk)
-
-# Creates the images (j2sdk-image j2re-image etc)
-images:
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE="" -f Images.gmk)
- ifeq ($(OPENJDK_TARGET_OS), macosx)
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk)
- endif
-
-# Create Compact Profile jars
-PROFILE_JARS_TARGETS := $(addsuffix -jars, $(ALL_PROFILES))
-$(PROFILE_JARS_TARGETS):
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE=$(@:%-jars=%) -f CreateJars.gmk)
-
-# Create Compact Profile images
-PROFILE_IMAGES_TARGETS := $(addsuffix -images, $(ALL_PROFILES))
-$(PROFILE_IMAGES_TARGETS):
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE=$(@:%-images=%) \
- JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/j2re-$(word $(call profile_number,$(@:%-images=%)),$(PROFILE_NAMES))-image \
- -f Images.gmk profile-image)
-
-profiles-oscheck:
- ifneq ($(OPENJDK_TARGET_OS), linux)
- @echo "Error: The Java SE 8 Compact Profiles are only implemented for Linux at this time" && exit 1
- endif
-
+BOOTCYCLE_TARGET := images
bootcycle-images:
@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
- +$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk images
+ +$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
+
+zip-security:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
+
+zip-source:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
+
+strip-binaries:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk)
-ALL_TARGETS += source-tips security-jars nashorn-jar main-jars images \
- $(PROFILE_JARS_TARGETS) $(PROFILE_IMAGES_TARGETS) profiles-oscheck \
- bootcycle-images
+jrtfs-jar:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
+
+jimages:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
+
+profiles:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
+
+mac-bundles:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
+
+ALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
+ jrtfs-jar jimages profiles mac-bundles
################################################################################
# Docs targets
@@ -331,17 +302,19 @@
ifneq ($(findstring -only, $(MAKECMDGOALS)), )
.NOTPARALLEL:
else
+ $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
+
interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
- build-tools-jdk: interim-langtools
+ buildtools-jdk: interim-langtools
$(CORBA_GENSRC_TARGETS): interim-langtools
- $(JDK_GENSRC_TARGETS): interim-langtools build-tools-jdk
+ $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
interim-corba: $(CORBA_GENSRC_TARGETS)
- $(GENDATA_TARGETS): interim-langtools build-tools-jdk
+ $(GENDATA_TARGETS): interim-langtools buildtools-jdk
interim-rmic: interim-langtools
@@ -349,7 +322,7 @@
import-hotspot: hotspot
- $(LIB_TARGETS): import-hotspot
+ $(LIBS_TARGETS): import-hotspot
$(LAUNCHER_TARGETS): java.base-libs
@@ -371,55 +344,53 @@
# Declare dependencies from <module>-lib to <module>-java
# Skip jdk.jdwp.agent as it contains no java code.
- $(foreach m, $(filter-out jdk.jdwp.agent, $(LIB_MODULES)), $(eval $m-libs: $m-java))
+ $(foreach m, $(filter-out jdk.jdwp.agent, $(LIBS_MODULES)), $(eval $m-libs: $m-java))
# Declare dependencies from all other <module>-lib to java.base-lib
- $(foreach t, $(filter-out java.base-libs, $(LIB_TARGETS)), \
+ $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
$(eval $t: java.base-libs))
# Declare the special case dependency for jdk.deploy.osx where libosx
# links against libosxapp.
jdk.deploy.osx-libs: java.desktop-libs
- # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
- # header file used by jdk.jdwp libs.
- jdk.jdwp.agent-libs: jdk.jdi-gensrc
+ # This dependency needs to be explicitly declared as jdk.jdi-gensrc generates a
+ # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
+ # virtual target.
+ jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
+
+ # Until the module system is in place, jdk.jdi-gensrc needs to combine service
+ # loader configuration with jdk.hotspot.agent so is dependent on importing
+ # hotspot.
+ jdk.jdi-gensrc-jdk: import-hotspot
# The swing beans need to have java base properly generated to avoid errors
# in javadoc.
- java.desktop-gensrc: java.base-gensrc
+ java.desktop-gensrc-jdk: java.base-gensrc
# Explicitly add dependencies for special targets
java.base-java: unpack-sec
jdk.dev-gendata: java rmic
- security-jars: java
-
- nashorn-jar: jdk.scripting.nashorn-java
-
- main-jars: java rmic security-jars nashorn-jar policy-jars import-hotspot gendata
+ zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
+ $(filter jdk.crypto%, $(JAVA_TARGETS))
- # On windows, the jars target needs to wait for jgss libs to be built.
- # Should ideally split out the sec-bin zip file generation to avoid
- # this dependency.
- ifeq ($(OPENJDK_TARGET_OS), windows)
- main-jars: java.security.jgss-libs
- endif
+ zip-source: gensrc rmic
+
+ strip-binaries: libs launchers gendata copy
+
+ jrtfs-jar: buildtools-jdk
- images: jars demos samples exploded-image verify-modules source-tips
+ jimages: exploded-image zip-source strip-binaries source-tips demos samples \
+ jrtfs-jar
- bootcycle-images: images
+ profiles: exploded-image strip-binaries source-tips
- # Need to depend on jars as otherwise there will a race between all the
- # invocations of CreateJars.gmk.
- $(PROFILE_JARS_TARGETS): jars profiles-oscheck
+ mac-bundles: jimages
- $(PROFILE_IMAGES_TARGETS): demos samples exploded-image source-tips
+ bootcycle-images: jimages
- # Declare dependencies from <profile>-images to <profile>-jars
- $(foreach p, $(ALL_PROFILES), $(eval $p-images: $p-jars))
-
- docs-javadoc: $(GENSRC_TARGETS) rmic
+ docs-javadoc: gensrc rmic
docs-jvmtidoc: hotspot
@@ -432,6 +403,9 @@
################################################################################
# Virtual targets without recipes
+buildtools: buildtools-langtools interim-langtools interim-corba interim-rmic \
+ buildtools-jdk
+
gensrc: $(GENSRC_TARGETS)
gendata: $(GENDATA_TARGETS)
@@ -442,12 +416,13 @@
rmic: $(RMIC_TARGETS)
-libs: $(LIB_TARGETS)
+libs: $(LIBS_TARGETS)
launchers: $(LAUNCHER_TARGETS)
-# Explicitly add dependencies for these special targets
-java.base: import-hotspot policy-jars
+# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
+# is actually handled by jdk.jdi-gensrc
+jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
# Declare dependencies from <module> to all the individual targets specific
# to that module <module>-*.
@@ -455,34 +430,33 @@
$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
-$(foreach m, $(LIB_MODULES), $(eval $m: $m-libs))
+$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
ALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
- $(GENDATA_MODULES) $(LIB_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
+ $(GENDATA_MODULES) $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
exploded-image: $(ALL_MODULE_TARGETS)
# The old 'jdk' target most closely matches the new exploded-image. Keep an
# alias for ease of use.
jdk: exploded-image
-jars: main-jars nashorn-jar security-jars policy-jars
+images: jimages demos samples zip-security
-# Make each profile name a target that depends on it's images target.
-$(foreach p, $(ALL_PROFILES), $(eval $(p): $(p)-images $(p)-jars))
-
-profiles: $(ALL_PROFILES)
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+ images: mac-bundles
+endif
docs: docs-javadoc docs-jvmtidoc
-ALL_TARGETS += gensrc gendata copy java rmic libs launchers \
- $(ALL_MODULE_TARGETS) exploded-image jdk jars \
- $(ALL_PROFILES) profiles docs
+ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
+ jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) exploded-image jdk images \
+ docs
################################################################################
-all: images docs
+all: images
default: exploded-image
ALL_TARGETS += default all
@@ -496,17 +470,38 @@
# Clean targets are automatically run serially by the Makefile calling this
# file.
-CLEAN_COMPONENTS += langtools corba hotspot jdk nashorn images \
- bootcycle-build docs docstemp test make-support
-CLEAN_TARGETS := $(addprefix clean-, $(CLEAN_COMPONENTS))
+CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
+ images make-support
+CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
+CLEAN_PHASES := gensrc java native include
+CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
+CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
+# Construct targets of the form clean-$module-$phase
+CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
+ $(addprefix $m-, $(CLEAN_PHASES))))
# Remove everything, except the output from configure.
-clean: $(CLEAN_TARGETS)
- ($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
+clean: $(CLEAN_DIR_TARGETS)
+ ($(CD) $(OUTPUT_ROOT) && $(RM) -r source_tips build.log* build-trace*.log*)
$(ECHO) Cleaned all build artifacts.
-$(CLEAN_TARGETS):
- $(call CleanComponent,$(patsubst clean-%, %, $@))
+$(CLEAN_DIR_TARGETS):
+ $(call CleanDir,$(patsubst clean-%, %, $@))
+
+$(CLEAN_PHASE_TARGETS):
+ $(call Clean-$(patsubst clean-%,%, $@))
+
+$(CLEAN_MODULE_TARGETS):
+ $(call CleanModule,$(patsubst clean-%, %, $@))
+
+$(CLEAN_MODULE_PHASE_TARGETS):
+ $(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
+ $(word 2, $(subst -,$(SPACE),$@)))
+
+# When removing the support dir, we must also remove jdk. Building classes has
+# the side effect of generating native headers. The headers end up in support
+# while classes and touch files end up in jdk.
+clean-support: clean-jdk
clean-docs: clean-docstemp
@@ -525,7 +520,8 @@
)
$(ECHO) Cleaned everything, you will have to re-run configure.
-ALL_TARGETS += clean dist-clean $(CLEAN_TARGETS)
+ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_PHASE_TARGETS) \
+ $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
################################################################################
@@ -557,7 +553,7 @@
# Declare *-only targets for each normal target
$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
-ALL_TARGETS += $(addsuffix -only, $(ALL_TARGETS))
+ALL_TARGETS += $(addsuffix -only, $(filter-out clean%, $(ALL_TARGETS)))
################################################################################
--- a/make/MakeHelpers.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/make/MakeHelpers.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -46,7 +46,7 @@
list_alt_overrides=$(subst =command,,$(subst =environment,,$(list_alt_overrides_with_origins)))
# Store the build times in this directory.
-BUILDTIMESDIR=$(OUTPUT_ROOT)/tmp/buildtimes
+BUILDTIMESDIR=$(OUTPUT_ROOT)/make-support/build-times
# Global targets are possible to run either with or without a SPEC. The prototypical
# global target is "help".
@@ -296,38 +296,139 @@
### Convenience functions from Main.gmk
-# Cleans the component given as $1
-define CleanComponent
+# Cleans the dir given as $1
+define CleanDir
@$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
@($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
@$(PRINTF) " done\n"
endef
+define Clean-gensrc
+ @$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..."
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1)
+ @$(PRINTF) " done\n"
+endef
+
+define Clean-java
+ @$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..."
+ @$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1)
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1)
+ @$(PRINTF) " done\n"
+ @$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..."
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)
+ @$(PRINTF) " done\n"
+endef
+
+define Clean-native
+ @$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..."
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1)
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1)
+ @$(PRINTF) " done\n"
+endef
+
+define Clean-include
+ @$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..."
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1)
+ @$(PRINTF) " done\n"
+endef
+
+define CleanModule
+ $(call Clean-gensrc, $1)
+ $(call Clean-java, $1)
+ $(call Clean-native, $1)
+ $(call Clean-include, $1)
+endef
+
+
################################################################################
-MAKE_DIR_LIST := $(JDK_TOPDIR)/make
+MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR)
+MAKE_MAKEDIR_LIST := make
+
+# Helper macro for DeclareRecipesForPhase
+# Declare a recipe for calling the module and phase specific makefile.
+# If there are multiple makefiles to call, create a rule for each topdir
+# that contains a makefile with the target $module-$suffix-$repodir,
+# (i.e: java.base-gensrc-jdk)
+# Normally there is only one makefile, and the target will just be
+# $module-$suffix
+# Param 1: Name of list to add targets to
+# Param 2: Module name
+# Param 3: Topdir
+define DeclareRecipeForModuleMakefile
+ ifeq ($$($1_MULTIPLE_MAKEFILES), true)
+ $2-$$($1_TARGET_SUFFIX): $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
+ $1 += $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
-# Find all modules that has a makefile for a certain build phase
-# Param 1: Make subdir to look in
-# Param 2: File prefix to look for
-FindModulesWithMakefileFor = $(sort $(foreach d, $(MAKE_DIR_LIST), \
- $(patsubst $d/$(strip $1)/$(strip $2)-%.gmk,%, \
- $(wildcard $d/$(strip $1)/$(strip $2)-*.gmk))))
+ $2-$$($1_TARGET_SUFFIX)-$$(notdir $3):
+ else
+ $2-$$($1_TARGET_SUFFIX):
+ endif
+ $(ECHO) $(LOG_INFO) "Building $$@"
+ ifeq ($$($1_USE_WRAPPER), true)
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
+ -f ModuleWrapper.gmk \
+ $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
+ $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
+ MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX))
+ else
+ +($(CD) $$(dir $$(firstword $$(wildcard $$(patsubst %, \
+ $3/%/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $(MAKE_MAKEDIR_LIST))))) \
+ && $(MAKE) $(MAKE_ARGS) \
+ -f $$($1_FILE_PREFIX)-$2.gmk \
+ $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
+ $$(addsuffix /$3, $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
+ MODULE=$2)
+ endif
+
+endef
-# Declare a recipe for calling such a makefile
-# Param 1: Module name
-# Param 2: Suffix for rule
-# Param 3: Make subdir
-# Param 4: Makefile prefix
-define DeclareRecipeForModuleMakefile
- $$(strip $1)-$$(strip $2):
- +($(CD) $$(dir $$(firstword $$(wildcard $$(addsuffix /$$(strip $3)/$$(strip $4)-$$(strip $1).gmk, \
- $(MAKE_DIR_LIST))))) \
- && $(MAKE) $(MAKE_ARGS) \
- -f $$(strip $4)-$$(strip $1).gmk \
- $$(addprefix -I, $$(wildcard $(MAKE_DIR_LIST) \
- $$(addsuffix /$$(strip $3), $(MAKE_DIR_LIST)))) \
- MODULE=$$(strip $1))
+# Helper macro for DeclareRecipesForPhase
+# Param 1: Name of list to add targets to
+# Param 2: Module name
+define DeclareRecipesForPhaseAndModule
+ $1_$2_TOPDIRS := $$(strip $$(sort $$(foreach d, $(MAKE_TOPDIR_LIST), \
+ $$(patsubst $$d/%, $$d, $$(filter $$d/%, \
+ $$(wildcard $$(patsubst %, %/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, \
+ $$(foreach s, $(MAKE_MAKEDIR_LIST), \
+ $$(addsuffix /$$s, $(MAKE_TOPDIR_LIST))))))))))
+
+ # Only declare recipes if there are makefiles to call
+ ifneq ($$($1_$2_TOPDIRS), )
+ $$(foreach d, $$($1_$2_TOPDIRS), \
+ $$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2,$$d)))
+ $1 += $2-$$($1_TARGET_SUFFIX)
+ $1_MODULES += $2
+ endif
+endef
+
+# Declare recipes for a specific module and build phase if there are makefiles
+# present for the specific combination.
+# Param 1: Name of list to add targets to
+# Named params:
+# TARGET_SUFFIX : Suffix of target to create for recipe
+# MAKE_SUBDIR : Subdir for this build phase
+# FILE_PREFIX : File prefix for this build phase
+# USE_WRAPPER : Set to true to use ModuleWrapper.gmk
+# CHECK_MODULES : List of modules to try
+# MULTIPLE_MAKEFILES : Set to true to handle makefils for the same module in
+# phase in multiple repos
+# Exported variables:
+# $1_MODULES : All modules that had rules generated
+# $1_TARGETS : All targets generated
+define DeclareRecipesForPhase
+ $(foreach i,2 3 4 5 6 7, $(if $($i),$(strip $1)_$(strip $($i)))$(NEWLINE))
+ $(if $(8),$(error Internal makefile error: Too many arguments to \
+ DeclareRecipesForPhase, please update MakeHelper.gmk))
+
+ $$(foreach m, $$($(strip $1)_CHECK_MODULES), \
+ $$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m)))
+
+ $(strip $1)_TARGETS := $$($(strip $1))
endef
################################################################################
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/ModuleWrapper.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,88 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# This makefile is called from Main.gmk, through a macro in MakeHelpers.gmk
+# and wraps calls to makefiles for specific modules and build phases. Having
+# this wrapper reduces the need for boilerplate code. It also provides
+# opportunity for automatic copying of files to an interim exploded runnable
+# image.
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+# All makefiles should add the targets to be built to this variable.
+TARGETS :=
+
+# Include the file being wrapped.
+include $(MAKEFILE_PREFIX)-$(MODULE).gmk
+
+# Setup copy rules from the modules directories to the jdk image directory.
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ TO_BIN_FILTER := %$(SHARED_LIBRARY_SUFFIX) %.diz %.pdb %.map
+
+ $(eval $(call SetupCopyFiles,COPY_LIBS_TO_BIN, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
+ DEST := $(JDK_OUTPUTDIR)/bin, \
+ FILES := $(filter $(TO_BIN_FILTER), \
+ $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+ $(TARGETS)))))
+
+ $(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
+ DEST := $(JDK_OUTPUTDIR)/lib, \
+ FILES := $(filter-out $(TO_BIN_FILTER), \
+ $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+ $(TARGETS)))))
+
+else
+ $(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
+ DEST := $(JDK_OUTPUTDIR)/lib, \
+ FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+ $(TARGETS))))
+endif
+
+$(eval $(call SetupCopyFiles,COPY_INCLUDE, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE), \
+ DEST := $(JDK_OUTPUTDIR)/include, \
+ FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)/%, \
+ $(TARGETS))))
+
+$(eval $(call SetupCopyFiles,COPY_CMDS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
+ DEST := $(JDK_OUTPUTDIR)/bin, \
+ FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/%, $(TARGETS))))
+
+$(eval $(call SetupCopyFiles,COPY_CONF, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE), \
+ DEST := $(JDK_OUTPUTDIR)/conf, \
+ FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE)/%, \
+ $(TARGETS))))
+
+all: $(TARGETS) $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \
+ $(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/StripBinaries.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,99 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+################################################################################
+# Copy native libraries and executables to a secondary location to strip them
+# and filter out files that shouldn't go into the image.
+
+MODULES_CMDS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
+MODULES_LIBS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
+
+ifneq ($(POST_STRIP_CMD), )
+ define StripRecipe
+ $(ECHO) Stripping $(LOG_INFO) $(patsubst $(OUTPUT_ROOT)/%,%,$<)
+ $(MKDIR) -p $(@D)
+ $(CP) $< $@.tmp
+ $(CHMOD) u+w $@.tmp
+ $(POST_STRIP_CMD) $@.tmp
+ $(if $(POST_MCS_CMD), $(POST_MCS_CMD) $@.tmp)
+ $(CHMOD) go-w $@.tmp
+ $(MV) $@.tmp $@
+ endef
+else
+ define StripRecipe
+ $(call install-file)
+ endef
+endif
+
+# Don't include debug info for executables.
+ALL_CMDS_SRC := $(filter-out %.debuginfo %.diz %.map %.pdb, \
+ $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_cmds -type f -o -type l))
+COPY_CMDS_SRC := $(filter %.cgi, $(ALL_CMDS_SRC))
+STRIP_CMDS_SRC := $(filter-out $(COPY_CMDS_SRC), $(ALL_CMDS_SRC))
+
+# Make sure symbolic links are copied and not stripped
+COPY_LIBS_SRC := \
+ $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs \
+ \( ! -name '*$(SHARED_LIBRARY_SUFFIX)' -type f \) -o -type l)
+STRIP_LIBS_SRC := \
+ $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs \
+ -name '*$(SHARED_LIBRARY_SUFFIX)' -type f)
+
+# On Windows, don't include debug info for libs either.
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ COPY_LIBS_SRC := $(filter-out %.diz %.map %.pdb, $(COPY_LIBS_SRC))
+endif
+
+$(eval $(call SetupCopyFiles,STRIP_MODULES_CMDS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
+ DEST := $(MODULES_CMDS_STRIPPED), \
+ FILES := $(STRIP_CMDS_SRC), \
+ MACRO := StripRecipe))
+
+$(eval $(call SetupCopyFiles,COPY_MODULES_CMDS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
+ DEST := $(MODULES_CMDS_STRIPPED), \
+ FILES := $(COPY_CMDS_SRC)))
+
+$(eval $(call SetupCopyFiles,STRIP_MODULES_LIBS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
+ DEST := $(MODULES_LIBS_STRIPPED), \
+ FILES := $(STRIP_LIBS_SRC), \
+ MACRO := StripRecipe))
+
+$(eval $(call SetupCopyFiles,COPY_MODULES_LIBS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
+ DEST := $(MODULES_LIBS_STRIPPED), \
+ FILES := $(COPY_LIBS_SRC)))
+
+TARGETS += $(STRIP_MODULES_CMDS) $(COPY_MODULES_CMDS) \
+ $(STRIP_MODULES_LIBS) $(COPY_MODULES_LIBS)
+
+all: $(TARGETS)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/ZipSecurity.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,104 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+
+##########################################################################################
+#
+# sec-bin.zip is used by builds where the corresponding sources are not available
+#
+$(eval $(call SetupZipArchive,BUILD_SEC_BIN_ZIP, \
+ SRC := $(JDK_OUTPUTDIR), \
+ INCLUDES := \
+ modules/java.base/javax/crypto \
+ modules/java.base/javax/crypto/spec \
+ modules/java.base/sun/security/internal/interfaces \
+ modules/java.base/sun/security/internal/spec \
+ modules/java.base/com/sun/crypto/provider \
+ modules/jdk.crypto.ec/sun/security/ec \
+ modules/jdk.crypto.mscapi/sun/security/mscapi \
+ modules/jdk.crypto.pkcs11/sun/security/pkcs11 \
+ modules/jdk.crypto.pkcs11/sun/security/pkcs11/wrapper \
+ modules/jdk.crypto.ucrypto/com/oracle/security/ucrypto \
+ modules/java.base/javax/net \
+ modules/java.base/javax/security/cert \
+ modules/java.base/com/sun/net/ssl \
+ modules/java.base/com/sun/security/cert \
+ modules/java.base/sun/net/www/protocol/https \
+ modules/java.base/sun/security/pkcs12 \
+ modules/java.base/sun/security/ssl \
+ modules/java.security.jgss/sun/security/krb5 \
+ modules/java.security.jgss/sun/security/krb5/internal \
+ modules/java.security.jgss/sun/security/krb5/internal/ccache \
+ modules/java.security.jgss/sun/security/krb5/internal/crypto \
+ modules/java.security.jgss/sun/security/krb5/internal/ktab \
+ modules/java.security.jgss/sun/security/krb5/internal/rcache \
+ modules/java.security.jgss/sun/security/krb5/internal/util, \
+ INCLUDE_FILES := modules/java.security.jgss/sun/security/jgss/spi/GSSContextSpi.class, \
+ EXCLUDES := modules/java.security.jgss/sun/security/krb5/internal/tools, \
+ ZIP := $(IMAGES_OUTPUTDIR)/sec-bin.zip))
+
+TARGETS += $(IMAGES_OUTPUTDIR)/sec-bin.zip
+
+##########################################################################################
+#
+# Windows specific binary security packages.
+#
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ # sec-windows-bin.zip is used by builds where the corresponding sources are not available
+ $(eval $(call SetupZipArchive,BUILD_SEC_WINDOWS_BIN_ZIP, \
+ SRC := $(JDK_OUTPUTDIR), \
+ INCLUDES := modules/java.security.jgss/sun/security/krb5/internal/tools, \
+ ZIP := $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip))
+
+ TARGETS += $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip
+
+ # JGSS files contain the native Kerberos library
+ ifeq ($(OPENJDK_TARGET_CPU), x86_64)
+ JGSS_ZIP_NAME = jgss-windows-x64-bin.zip
+ else
+ JGSS_ZIP_NAME = jgss-windows-i586-bin.zip
+ endif
+
+ $(eval $(call SetupZipArchive,BUILD_JGSS_BIN_ZIP, \
+ SRC := $(SUPPORT_OUTPUTDIR), \
+ INCLUDE_FILES := modules_libs/java.security.jgss/w2k_lsa_auth.dll \
+ modules_libs/java.security.jgss/w2k_lsa_auth.diz \
+ modules_libs/java.security.jgss/w2k_lsa_auth.map \
+ modules_libs/java.security.jgss/w2k_lsa_auth.pdb, \
+ ZIP := $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)))
+
+ TARGETS += $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)
+endif
+
+##########################################################################################
+
+all: $(TARGETS)
+
+.PHONY: default all
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/ZipSource.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -0,0 +1,88 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, , ZipSource.gmk))
+
+################################################################################
+
+# Use ?= to enable override in custom makefile
+SRC_ZIP_INCLUDES ?= \
+ com \
+ java \
+ javax \
+ jdk \
+ org \
+ sun \
+ #
+
+SRC_ZIP_EXCLUDES ?=
+
+SRC_ZIP_SRCS += $(wildcard \
+ $(JDK_TOPDIR)/src/*/share/classes \
+ $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \
+ $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_API_DIR)/classes \
+ $(LANGTOOLS_TOPDIR)/src/*/share/classes \
+ $(CORBA_TOPDIR)/src/*/share/classes \
+ $(JAXP_TOPDIR)/src/*/share/classes \
+ $(JAXWS_TOPDIR)/src/*/share/classes \
+ $(SUPPORT_OUTPUTDIR)/gensrc/j* \
+ $(SUPPORT_OUTPUTDIR)/rmic/j* \
+ ) \
+ #
+
+# Need to copy launcher src files into desired directory structure
+# before zipping the sources.
+$(eval $(call SetupCopyFiles,COPY_LAUNCHER_SRC, \
+ SRC := $(JDK_TOPDIR)/src/java.base, \
+ DEST := $(SUPPORT_OUTPUTDIR)/src/launcher, \
+ FLATTEN := true, \
+ FILES := $(wildcard \
+ $(JDK_TOPDIR)/src/java.base/share/native/launcher/* \
+ $(JDK_TOPDIR)/src/java.base/share/native/libjli/* \
+ $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli/java_md*)))
+
+# This dir needs to exist before macro is evaluated to avoid warning from find.
+$(eval $(call MakeDir, $(SUPPORT_OUTPUTDIR)/src))
+$(eval $(call SetupZipArchive,BUILD_SRC_ZIP, \
+ SRC := $(SRC_ZIP_SRCS) $(SUPPORT_OUTPUTDIR)/src, \
+ INCLUDES := $(SRC_ZIP_INCLUDES) launcher, \
+ EXCLUDES := $(SRC_ZIP_EXCLUDES), \
+ EXCLUDE_FILES := $(SRC_ZIP_EXCLUDE_FILES), \
+ SUFFIXES := .java .c .h, \
+ ZIP := $(SUPPORT_OUTPUTDIR)/src.zip, \
+ EXTRA_DEPS := $(COPY_LAUNCHER_SRC)))
+
+################################################################################
+
+all: $(BUILD_SRC_ZIP)
+
+.PHONY: default all
--- a/make/common/JavaCompilation.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/make/common/JavaCompilation.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -325,10 +325,16 @@
$1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES))
endif
ifneq ($$($1_EXCLUDES),)
+ $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
$1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
- $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
$1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS))
endif
+ ifneq ($$($1_EXCLUDE_FILES),)
+ # Cannot precompute ZIP_EXCLUDE_FILES as it is dependent on which src root is being
+ # zipped at the moment.
+ $1_SRC_EXCLUDE_FILES := $$(addprefix %, $$($1_EXCLUDE_FILES)) $$($1_EXCLUDE_FILES)
+ $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDE_FILES), $$($1_ALL_SRCS))
+ endif
# Use a slightly shorter name for logging, but with enough path to identify this zip.
$1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
@@ -343,7 +349,10 @@
$$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
$(MKDIR) -p $$(@D)
$(ECHO) Updating $$($1_NAME)
- $$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES))) || test "$$$$?" = "12" )$$(NEWLINE)) true
+ $$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) \
+ $$($1_ZIP_EXCLUDES) -x \*_the.\* \
+ $$(addprefix -x$(SPACE), $$(patsubst $$i/%,%, $$($1_EXCLUDE_FILES))) \
+ || test "$$$$?" = "12" )$$(NEWLINE)) true
$(TOUCH) $$@
# Add zip to target list
--- a/make/common/Modules.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/make/common/Modules.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -64,6 +64,7 @@
SETUP := BOOT_JAVAC, \
SRC := $(JDK_TOPDIR)/make/src/classes, \
INCLUDES := build/tools/module, \
+ EXCLUDE_FILES := ImageBuilder.java ModuleArchive.java, \
BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \
DISABLE_SJAVAC := true))
--- a/make/common/NativeCompilation.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/make/common/NativeCompilation.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -450,13 +450,11 @@
$1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
- # This dependency dance ensures that windows debug info files get rebuilt
- # properly if deleted.
- $$($1_TARGET): $$($1_DEBUGINFO_FILES)
- $$($1_DEBUGINFO_FILES): $$($1_EXPECTED_OBJS)
-
else ifeq ($(OPENJDK_TARGET_OS), solaris)
$1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
+ # Setup the command line creating debuginfo files, to be run after linking.
+ # It cannot be run separately since it updates the original target file
+ #
# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
# Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
# empty section headers until a fixed $(OBJCOPY) is available.
@@ -466,29 +464,34 @@
#
# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
- $$($1_DEBUGINFO_FILES): $$($1_TARGET) \
- $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
- $(RM) $$@
- $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
- $(OBJCOPY) --only-keep-debug $$< $$@
- $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
- $(TOUCH) $$@
+ $1_CREATE_DEBUGINFO_CMDS := \
+ $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$($1_TARGET) $$(NEWLINE) \
+ $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
+ $(CD) $$($1_OUTPUT_DIR) && \
+ $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$($1_DEBUGINFO_FILES) $$($1_TARGET)
+ $1_DEBUGINFO_EXTRA_DEPS := $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
else ifeq ($(OPENJDK_TARGET_OS), linux)
$1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
- $$($1_DEBUGINFO_FILES): $$($1_TARGET)
- $(RM) $$@
- $(OBJCOPY) --only-keep-debug $$< $$@
- $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
- $(TOUCH) $$@
+ # Setup the command line creating debuginfo files, to be run after linking.
+ # It cannot be run separately since it updates the original target file
+ $1_CREATE_DEBUGINFO_CMDS := \
+ $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
+ $(CD) $$($1_OUTPUT_DIR) && \
+ $(OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
endif # No MacOS X support
+ # This dependency dance ensures that debug info files get rebuilt
+ # properly if deleted.
+ $$($1_TARGET): $$($1_DEBUGINFO_FILES)
+ $$($1_DEBUGINFO_FILES): $$($1_EXPECTED_OBJS)
+
ifeq ($(ZIP_DEBUGINFO_FILES), true)
$1_DEBUGINFO_ZIP := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).diz
$1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_ZIP))
- # The dependency on TARGET is needed on windows for debuginfo files
+ # The dependency on TARGET is needed for debuginfo files
# to be rebuilt properly.
$$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET)
$(CD) $$($1_OBJECT_DIR) \
@@ -504,29 +507,31 @@
ifneq (,$$($1_LIBRARY))
# Generating a dynamic library.
- $1_EXTRA_LDFLAGS+=$$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
+ $1_EXTRA_LDFLAGS += $$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
ifeq ($(OPENJDK_TARGET_OS), windows)
- $1_EXTRA_LDFLAGS+="-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
+ $1_EXTRA_LDFLAGS += "-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
endif
$1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)
- $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE)
- $$(call LINKING_MSG,$$($1_BASENAME))
- $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$@ \
- $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
- $$($1_EXTRA_LDFLAGS_SUFFIX)
- # Touch target to make sure it has a later time stamp than the debug
- # symbol files to avoid unnecessary relinking on rebuild.
- ifeq ($(OPENJDK_TARGET_OS), windows)
- $(TOUCH) $$@
- endif
+ $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) \
+ $$($1_DEBUGINFO_EXTRA_DEPS)
+ $$(call LINKING_MSG,$$($1_BASENAME))
+ $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$@ \
+ $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
+ $$($1_EXTRA_LDFLAGS_SUFFIX)
+ $$($1_CREATE_DEBUGINFO_CMDS)
+ # Touch target to make sure it has a later time stamp than the debug
+ # symbol files to avoid unnecessary relinking on rebuild.
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ $(TOUCH) $$@
+ endif
endif
ifneq (,$$($1_STATIC_LIBRARY))
# Generating a static library, ie object file archive.
- $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES)
+ $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES)
$$(call ARCHIVING_MSG,$$($1_LIBRARY))
$(AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_EXPECTED_OBJS) \
$$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
@@ -536,26 +541,28 @@
# A executable binary has been specified, setup the target for it.
$1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)
- $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST)
- $$(call LINKING_EXE_MSG,$$($1_BASENAME))
- $$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_TARGET) \
- $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
- $$($1_EXTRA_LDFLAGS_SUFFIX)
- ifneq (,$$($1_GEN_MANIFEST))
- $(MT) -nologo -manifest $$($1_GEN_MANIFEST) -outputresource:$$@;#1
- endif
- # This only works if the openjdk_codesign identity is present on the system. Let
- # silently fail otherwise.
- ifneq (,$(CODESIGN))
- ifneq (,$$($1_CODESIGN))
- $(CODESIGN) -s openjdk_codesign $$@
- endif
- endif
- # Touch target to make sure it has a later time stamp than the debug
- # symbol files to avoid unnecessary relinking on rebuild.
- ifeq ($(OPENJDK_TARGET_OS), windows)
- $(TOUCH) $$@
- endif
+ $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST) \
+ $$($1_DEBUGINFO_EXTRA_DEPS)
+ $$(call LINKING_EXE_MSG,$$($1_BASENAME))
+ $$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_TARGET) \
+ $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
+ $$($1_EXTRA_LDFLAGS_SUFFIX)
+ ifneq (,$$($1_GEN_MANIFEST))
+ $(MT) -nologo -manifest $$($1_GEN_MANIFEST) -outputresource:$$@;#1
+ endif
+ # This only works if the openjdk_codesign identity is present on the system. Let
+ # silently fail otherwise.
+ ifneq (,$(CODESIGN))
+ ifneq (,$$($1_CODESIGN))
+ $(CODESIGN) -s openjdk_codesign $$@
+ endif
+ endif
+ $$($1_CREATE_DEBUGINFO_CMDS)
+ # Touch target to make sure it has a later time stamp than the debug
+ # symbol files to avoid unnecessary relinking on rebuild.
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ $(TOUCH) $$@
+ endif
endif
endef
--- a/make/common/SetupJavaCompilers.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/make/common/SetupJavaCompilers.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -48,10 +48,13 @@
# The generate old bytecode javac setup uses the new compiler to compile for the
# boot jdk to generate tools that need to be run with the boot jdk.
# Thus we force the target bytecode to the previous JDK version.
+# Add -Xlint:-options to avoid the warning about not setting -bootclasspath. Since
+# it's running on the boot jdk, the default bootclasspath is correct.
$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
JVM := $(JAVA_SMALL), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := $(BOOT_JDK_SOURCETARGET) -bootclasspath $(BOOT_RTJAR) $(DISABLE_WARNINGS), \
+ FLAGS := $(BOOT_JDK_SOURCETARGET) -XDignore.symbol.file=true \
+ $(DISABLE_WARNINGS) -Xlint:-options, \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@@ -61,8 +64,7 @@
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
FLAGS := -source 9 -target 9 \
- -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS) \
- $(GENERATE_JDKBYTECODE_EXTRA_FLAGS), \
+ -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@@ -72,8 +74,7 @@
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
FLAGS := -source 9 -target 9 \
- -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS) \
- $(GENERATE_JDKBYTECODE_EXTRA_FLAGS), \
+ -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
--- a/make/jprt.properties Tue Nov 18 15:25:16 2014 -0800
+++ b/make/jprt.properties Wed Jul 05 20:08:34 2017 +0200
@@ -181,8 +181,8 @@
${my.test.target.set:TESTNAME=jdk_instrument}, \
${my.test.target.set:TESTNAME=jdk_jmx}, \
${my.test.target.set:TESTNAME=jdk_jdi}, \
- ${my.test.target.set:TESTNAME=jdk_jfr}, \
- ${my.test.target.set:TESTNAME=svc_tools}
+ ${my.test.target.set:TESTNAME=svc_tools}, \
+ ${my.make.rule.test.targets.svc.extra}
# All vm test targets (testset=all)
my.test.targets.all= \
--- a/modules.xml Tue Nov 18 15:25:16 2014 -0800
+++ b/modules.xml Wed Jul 05 20:08:34 2017 +0200
@@ -211,6 +211,10 @@
<to>java.security.sasl</to>
</export>
<export>
+ <name>jdk.internal.jimage</name>
+ <to>jdk.dev</to>
+ </export>
+ <export>
<name>jdk.internal.org.objectweb.asm</name>
<to>jdk.jfr</to>
<to>jdk.scripting.nashorn</to>
--- a/nashorn/.hgtags Tue Nov 18 15:25:16 2014 -0800
+++ b/nashorn/.hgtags Wed Jul 05 20:08:34 2017 +0200
@@ -273,3 +273,4 @@
dd7bbdf81a537106cfa9227d1a9a57849cb26b4d jdk9-b37
365f55e7b3c45637bf912c88d31b32a127ad7429 jdk9-b38
900508346b1c2436d7059fe46a621e6ec3ffdaad jdk9-b39
+74dcd8dbef252938d6deb032aefb46b8f452dd9e jdk9-b40
--- a/nashorn/make/BuildNashorn.gmk Tue Nov 18 15:25:16 2014 -0800
+++ b/nashorn/make/BuildNashorn.gmk Wed Jul 05 20:08:34 2017 +0200
@@ -34,7 +34,7 @@
JDK_CLASSES := $(subst $(SPACE),$(PATH_SEP),$(strip $(addprefix $(JDK_OUTPUTDIR)/modules/, \
java.base java.logging java.scripting)))
-NASHORN_JAR := $(NASHORN_DIST)/nashorn.jar
+NASHORN_JAR := $(IMAGES_OUTPUTDIR)/nashorn.jar
NASHORN_VERSION := $(JDK_VERSION)
NASHORN_FULL_VERSION := $(FULL_VERSION)
@@ -56,8 +56,9 @@
$(eval $(call SetupJavaCompilation,BUILD_NASHORN, \
SETUP := GENERATE_NEWBYTECODE_DEBUG, \
SRC := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes, \
+ EXCLUDE_FILES := META-INF/MANIFEST.MF, \
COPY := .properties .js, \
- BIN := $(NASHORN_OUTPUTDIR)/nashorn_classes))
+ BIN := $(SUPPORT_OUTPUTDIR)/misc/jdk.scripting.nashorn/classes))
NASGEN_SRC := $(NASHORN_TOPDIR)/buildtools/nasgen/src
ASM_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/jdk/internal/org/objectweb/asm
@@ -66,8 +67,8 @@
$(eval $(call SetupJavaCompilation,BUILD_NASGEN, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(NASGEN_SRC) $(ASM_SRC), \
- BIN := $(NASHORN_OUTPUTDIR)/nasgen_classes, \
- ADD_JAVAC_FLAGS := -bootclasspath "$(BOOT_RTJAR)$(PATH_SEP)$(NASHORN_OUTPUTDIR)/nashorn_classes"))
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes, \
+ ADD_JAVAC_FLAGS := -Xbootclasspath/p:"$(SUPPORT_OUTPUTDIR)/misc/jdk.scripting.nashorn/classes"))
# Nasgen needs nashorn classes
$(BUILD_NASGEN): $(BUILD_NASHORN)
@@ -80,9 +81,9 @@
$(ECHO) Running nasgen
$(MKDIR) -p $(@D)
$(RM) -rf $(@D)/jdk $(@D)/netscape
- $(CP) -R -p $(NASHORN_OUTPUTDIR)/nashorn_classes/* $(@D)/
+ $(CP) -R -p $(SUPPORT_OUTPUTDIR)/misc/jdk.scripting.nashorn/classes/* $(@D)/
$(FIXPATH) $(JAVA) \
- -Xbootclasspath/p:"$(NASHORN_OUTPUTDIR)/nasgen_classes$(PATH_SEP)$(NASHORN_OUTPUTDIR)/nashorn_classes" \
+ -Xbootclasspath/p:"$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes$(PATH_SEP)$(SUPPORT_OUTPUTDIR)/misc/jdk.scripting.nashorn/classes" \
jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D)
$(TOUCH) $@
--- a/nashorn/make/build.xml Tue Nov 18 15:25:16 2014 -0800
+++ b/nashorn/make/build.xml Wed Jul 05 20:08:34 2017 +0200
@@ -35,11 +35,10 @@
<path id="dist.path">
<pathelement location="${dist.dir}"/>
</path>
- <path id="nashorn.ext.path">
+ <path id="nashorn.boot.prefix.path">
<pathelement location="${dist.dir}"/>
- <pathelement location="${java.ext.dirs}"/>
</path>
- <property name="ext.class.path" value="-Djava.ext.dirs="${toString:nashorn.ext.path}""/>
+ <property name="boot.class.path" value="-Xbootclasspath/a:="${toString:nashorn.boot.prefix.path}""/>
<condition property="svn.executable" value="/usr/local/bin/svn" else="svn">
<available file="/usr/local/bin/svn"/>
</condition>
@@ -137,7 +136,6 @@
debug="${javac.debug}"
encoding="${javac.encoding}"
includeantruntime="false" fork="true">
- <compilerarg value="-J-Djava.ext.dirs="/>
<compilerarg value="-Xlint:all"/>
<compilerarg value="-XDignore.symbol.file"/>
<compilerarg value="-Xdiags:verbose"/>
@@ -243,7 +241,7 @@
<!-- generate shell.html for shell tool documentation -->
<target name="shelldoc" depends="jar">
<java classname="${nashorn.shell.tool}" dir="${basedir}" output="${dist.dir}/shell.html" failonerror="true" fork="true">
- <jvmarg line="${ext.class.path}"/>
+ <jvmarg line="${boot.class.path}"/>
<arg value="-scripting"/>
<arg value="docs/genshelldoc.js"/>
</java>
@@ -273,7 +271,6 @@
debug="${javac.debug}"
encoding="${javac.encoding}"
includeantruntime="false" fork="true">
- <compilerarg value="-J-Djava.ext.dirs="/>
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xdiags:verbose"/>
@@ -420,7 +417,7 @@
</fileset>
<testng outputdir="${build.nosecurity.test.results.dir}/${testResultsSubDir}" classfilesetref="test.nosecurity.classes"
verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
- <jvmarg line="${ext.class.path}"/>
+ <jvmarg line="${boot.class.path}"/>
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
<sysproperty key="nashorn.jar" value="${dist.dir}/nashorn.jar"/>
<propertyset>
@@ -443,7 +440,7 @@
<property name="debug.test.jvmargs" value=""/>
<testng outputdir="${build.test.results.dir}/${testResultsSubDir}" classfilesetref="test.classes"
verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
- <jvmarg line="${ext.class.path}"/>
+ <jvmarg line="${boot.class.path}"/>
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
<jvmarg line="${debug.test.jvmargs}"/>
<propertyset>
@@ -565,7 +562,7 @@
<target name="test262-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
<!-- use just build.test.classes.dir to avoid referring to TestNG -->
<java classname="${parallel.test.runner}" dir="${basedir}" fork="true">
- <jvmarg line="${ext.class.path}"/>
+ <jvmarg line="${boot.class.path}"/>
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
<!-- avoid too many typeinfo cache files. Each script is run only once anyway -->
<jvmarg line="-Dnashorn.typeInfo.disabled=true"/>
@@ -586,7 +583,7 @@
<java classname="${parallel.test.runner}" dir="${basedir}"
failonerror="true"
fork="true">
- <jvmarg line="${ext.class.path}"/>
+ <jvmarg line="${boot.class.path}"/>
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
<classpath>
<pathelement path="${run.test.classpath}"/>
@@ -605,7 +602,7 @@
<target name="run" depends="jar"
description="Run the shell with a sample script">
<java classname="${nashorn.shell.tool}" fork="true" dir="samples">
- <jvmarg line="${ext.class.path}"/>
+ <jvmarg line="${boot.class.path}"/>
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
<arg value="-dump-on-error"/>
<arg value="test.js"/>
@@ -615,7 +612,7 @@
<target name="debug" depends="jar"
description="Debug the shell with a sample script">
<java classname="${nashorn.shell.tool}" fork="true" dir="samples">
- <jvmarg line="${ext.class.path}"/>
+ <jvmarg line="${boot.class.path}"/>
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
<arg value="--print-code"/>
<arg value="--verify-code"/>
--- a/nashorn/test/script/nosecurity/JDK-8050964.js Tue Nov 18 15:25:16 2014 -0800
+++ b/nashorn/test/script/nosecurity/JDK-8050964.js Wed Jul 05 20:08:34 2017 +0200
@@ -48,6 +48,9 @@
var javahome = System.getProperty("java.home");
var jdepsPath = javahome + "/../bin/jdeps".replaceAll(/\//g, File.separater);
+if (! new File(jdepsPath).isFile()) {
+ jdepsPath = javahome + "/bin/jdeps".replaceAll(/\//g, File.separater);
+}
// run jdep on nashorn.jar - only summary but print profile info
`${jdepsPath} -s -P ${nashornJar.absolutePath}`
--- a/nashorn/test/script/nosecurity/JDK-8055034.js Tue Nov 18 15:25:16 2014 -0800
+++ b/nashorn/test/script/nosecurity/JDK-8055034.js Wed Jul 05 20:08:34 2017 +0200
@@ -47,8 +47,12 @@
// we want to use nashorn.jar passed and not the one that comes with JRE
var jjsCmd = javahome + "/../bin/jjs";
-jjsCmd += " -J-Djava.ext.dirs=" + nashornJarDir;
jjsCmd = jjsCmd.toString().replaceAll(/\//g, File.separater);
+if (! new File(jjsCmd).isFile()) {
+ jjsCmd = javahome + "/bin/jjs";
+ jjsCmd = jjsCmd.toString().replaceAll(/\//g, File.separater);
+}
+jjsCmd += " -J-Xbootclasspath/a:" + nashornJarDir;
$EXEC(jjsCmd, "var x = Object.create(null);\nx;\nprint('PASSED');\nexit(0)");
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java Tue Nov 18 15:25:16 2014 -0800
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java Wed Jul 05 20:08:34 2017 +0200
@@ -176,7 +176,8 @@
final List<String> cmd = new ArrayList<>();
cmd.add(System.getProperty("java.home") + separator + "bin" + separator + "java");
- cmd.add("-Djava.ext.dirs=dist");
+ // cmd.add("-Djava.ext.dirs=dist");
+ cmd.add("-Xbootclasspath/a:dist/nashorn.jar");
for (final String str : forkJVMOptions) {
if(!str.isEmpty()) {
cmd.add(str);