Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Unified Diff: compiler/java/com/google/dart/compiler/SystemLibraryManager.java

Issue 10907135: fix library manager to handle nested dart: libraries (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/SystemLibraryManager.java
===================================================================
--- compiler/java/com/google/dart/compiler/SystemLibraryManager.java (revision 12043)
+++ compiler/java/com/google/dart/compiler/SystemLibraryManager.java (working copy)
@@ -136,54 +136,64 @@
String shortName = entry.getKey().trim();
DartLibrary library = entry.getValue();
String path = library.getPath();
- File file;
+ URI libFileUri;
try {
- file = new File(base.resolve(new URI(null, null, path, null, null)).normalize());
+ libFileUri = base.resolve(new URI(null, null, path, null, null)).normalize();
} catch (URISyntaxException e) {
continue;
}
+ File file = new File(libFileUri);
if (!file.exists()) {
throw new InternalCompilerException("Can't find system library dart:" + shortName
+ " at " + file);
}
- int index = shortName.indexOf(':');
- if (index == -1) {
- continue;
- }
- explicitShortNames.add(shortName);
- String scheme = shortName.substring(0, index + 1);
- String name = shortName.substring(index + 1);
- String host = file.getParentFile().getName();
- addLib(scheme,
- host,
- name,
- file.getParentFile(),
- file.getName(),
- library.getCategory(),
- library.isDocumented(),
- library.isImplementation());
+ int index = shortName.indexOf(':');
+ if (index == -1) {
+ continue;
+ }
+ explicitShortNames.add(shortName);
+ String scheme = shortName.substring(0, index + 1);
+ String name = shortName.substring(index + 1);
+ String relPath = sdkLibPathUri.relativize(libFileUri).getPath();
+ index = relPath.indexOf('/');
+ if (index == -1) {
+ continue;
+ }
+ String host = relPath.substring(0, index);
+ File dir = new File(sdkLibPath, host);
+ String pathToLib = relPath.substring(index + 1);
+
+ addLib(scheme,
+ host,
+ name,
+ dir,
+ pathToLib,
+ library.getCategory(),
+ library.isDocumented(),
+ library.isImplementation());
+
}
return libraries.toArray(new SystemLibrary[libraries.size()]);
}
- private boolean addLib(String scheme, String host, String name, File dir, String libFileName,
+ private boolean addLib(String scheme, String host, String name, File dir, String pathToLib,
String category, boolean documented, boolean implementation)
throws AssertionError {
-
- File libFile = new File(dir, libFileName);
+ File libFile = new File(dir, pathToLib);
if (!libFile.isFile()) {
throw new InternalCompilerException("Error mapping dart:" + host + ", path "
+ libFile.getAbsolutePath() + " is not a file.");
}
- SystemLibrary lib = new SystemLibrary(name, host, libFileName, dir, category,documented, implementation);
+ SystemLibrary lib = new SystemLibrary(
+ name, host, pathToLib, dir, category, documented, implementation);
libraries.add(lib);
String libSpec = scheme + name;
URI libUri;
URI expandedUri;
try {
libUri = new URI(libSpec);
- expandedUri = new URI("dart:" + "//" + host + "/" + libFileName);
+ expandedUri = new URI("dart:" + "//" + host + "/" + pathToLib);
} catch (URISyntaxException e) {
throw new AssertionError(e);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698