8055856: checkdeps build target doesn't work for cross-compilation builds

8056113: [build] tools.jar missing modules.xml

Reviewed-by: ihse, erikj
This commit is contained in:
Mandy Chung 2014-08-29 10:46:33 -07:00
parent baa94f7823
commit b82e9ddea4
3 changed files with 18 additions and 8 deletions

View File

@ -41,12 +41,14 @@ $(eval $(call SetupJavaCompilation,BUILD_INTERIM_LANGTOOLS, \
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)))

View File

@ -71,7 +71,7 @@ abstract class ModulesXmlReader {
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 @@ abstract class ModulesXmlReader {
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");

View File

@ -32,6 +32,7 @@ import com.sun.tools.classfile.RuntimeAnnotations_attribute;
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 @@ class PlatformClassPath {
}
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 @@ class PlatformClassPath {
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;
}