changeset 2611:9da59b2ab73d

8055856: checkdeps build target doesn't work for cross-compilation builds 8056113: [build] tools.jar missing modules.xml Reviewed-by: ihse, erikj
author mchung
date Fri, 29 Aug 2014 10:46:33 -0700
parents 9e29021d0d13
children 13705e2ddeb2 37e0edfac52e
files make/CompileInterim.gmk src/jdk.dev/share/classes/com/sun/tools/jdeps/ModulesXmlReader.java src/jdk.dev/share/classes/com/sun/tools/jdeps/PlatformClassPath.java
diffstat 3 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/make/CompileInterim.gmk	Fri Aug 29 14:58:35 2014 +0200
+++ b/make/CompileInterim.gmk	Fri Aug 29 10:46:33 2014 -0700
@@ -41,12 +41,14 @@
     DISABLE_SJAVAC := true, \
     SRC := $(LANGTOOLS_TOPDIR)/src/java.compiler/share/classes \
       $(LANGTOOLS_TOPDIR)/src/jdk.compiler/share/classes \
+      $(LANGTOOLS_TOPDIR)/src/jdk.dev/share/classes \
       $(LANGTOOLS_TOPDIR)/src/jdk.javadoc/share/classes \
       $(LANGTOOLS_TOPDIR)/src/java.base/share/classes \
       $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler \
+      $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.dev \
       $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.javadoc, \
     EXCLUDES := com/sun/tools/javac/nio compileproperties anttasks crules, \
-    COPY := $(RESOURCE_SUFFIXES), \
+    COPY := $(RESOURCE_SUFFIXES) jdeps.properties jdkinternals.properties version.properties, \
     BIN := $(LANGTOOLS_OUTPUTDIR)/interim_classes, \
     JAR := $(INTERIM_LANGTOOLS_JAR)))
 
--- a/src/jdk.dev/share/classes/com/sun/tools/jdeps/ModulesXmlReader.java	Fri Aug 29 14:58:35 2014 +0200
+++ b/src/jdk.dev/share/classes/com/sun/tools/jdeps/ModulesXmlReader.java	Fri Aug 29 10:46:33 2014 -0700
@@ -71,7 +71,7 @@
             if (Files.exists(mdir) && Files.isDirectory(mdir)) {
                 return ClassFileReader.newInstance(mdir);
             } else {
-                // aggregator module or os-specific module in modules.xml
+                // aggregator module or os-specific module in jdeps-modules.xml
                 // mdir not exist
                 return defaultReader;
             }
@@ -124,8 +124,7 @@
     public Set<Module> load(InputStream in) throws XMLStreamException, IOException {
         Set<Module> modules = new HashSet<>();
         if (in == null) {
-            System.err.println("WARNING: modules.xml doesn't exist");
-            return modules;
+            throw new RuntimeException("jdeps-modules.xml doesn't exist");
         }
         XMLInputFactory factory = XMLInputFactory.newInstance();
         XMLEventReader reader = factory.createXMLEventReader(in, "UTF-8");
--- a/src/jdk.dev/share/classes/com/sun/tools/jdeps/PlatformClassPath.java	Fri Aug 29 14:58:35 2014 +0200
+++ b/src/jdk.dev/share/classes/com/sun/tools/jdeps/PlatformClassPath.java	Fri Aug 29 10:46:33 2014 -0700
@@ -32,6 +32,7 @@
 import com.sun.tools.classfile.Dependencies.ClassFileError;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.BufferedInputStream;
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -91,9 +92,17 @@
     }
 
     private static List<Archive> initModules(Path mpath) throws IOException {
-        try (InputStream in = PlatformClassPath.class
-                .getResourceAsStream("resources/modules.xml")) {
-            return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in));
+        String fn = System.getProperty("jdeps.modules.xml");
+        if (fn!= null) {
+            Path p = Paths.get(fn);
+            try (InputStream in = new BufferedInputStream(Files.newInputStream(p))) {
+                return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in));
+            }
+        } else {
+            try (InputStream in = PlatformClassPath.class
+                    .getResourceAsStream("resources/jdeps-modules.xml")) {
+                return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in));
+            }
         }
     }
 
@@ -101,7 +110,7 @@
         LegacyImageHelper cfr = new LegacyImageHelper(home);
         List<Archive> archives = new ArrayList<>(cfr.nonPlatformArchives);
         try (InputStream in = PlatformClassPath.class
-                .getResourceAsStream("resources/modules.xml")) {
+                .getResourceAsStream("resources/jdeps-modules.xml")) {
             archives.addAll(ModulesXmlReader.loadFromImage(cfr, in));
             return archives;
         }