8049367: Modular Run-Time Images
authorchegar
Wed, 03 Dec 2014 14:26:07 +0000
changeset 27571 08ef93eaca80
parent 27570 143040336a1b
child 27572 f2dcd0af93b2
8049367: Modular Run-Time Images Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, bradford.wetmore@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, james.laskey@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com, sundararajan.athijegannathan@oracle.com
nashorn/make/BuildNashorn.gmk
nashorn/make/build.xml
nashorn/test/script/nosecurity/JDK-8050964.js
nashorn/test/script/nosecurity/JDK-8055034.js
nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java
--- a/nashorn/make/BuildNashorn.gmk	Tue Nov 18 15:25:19 2014 -0800
+++ b/nashorn/make/BuildNashorn.gmk	Wed Dec 03 14:26:07 2014 +0000
@@ -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:19 2014 -0800
+++ b/nashorn/make/build.xml	Wed Dec 03 14:26:07 2014 +0000
@@ -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=&quot;${toString:nashorn.ext.path}&quot;"/>
+    <property name="boot.class.path" value="-Xbootclasspath/a:=&quot;${toString:nashorn.boot.prefix.path}&quot;"/>
     <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:19 2014 -0800
+++ b/nashorn/test/script/nosecurity/JDK-8050964.js	Wed Dec 03 14:26:07 2014 +0000
@@ -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:19 2014 -0800
+++ b/nashorn/test/script/nosecurity/JDK-8055034.js	Wed Dec 03 14:26:07 2014 +0000
@@ -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:19 2014 -0800
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java	Wed Dec 03 14:26:07 2014 +0000
@@ -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);