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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/SystemLibraryManagerProvider.java

Issue 9865025: Revert "Removes dartc reliance on its own libraries, now can be targeted at any implementation's li… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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
Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/SystemLibraryManagerProvider.java
diff --git a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/SystemLibraryManagerProvider.java b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/SystemLibraryManagerProvider.java
index 17820af1bd33be94e5294456fc11ff0ff9691fc7..74aaf37dd340cbf81038e2ad4b2cf0749bce8e15 100644
--- a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/SystemLibraryManagerProvider.java
+++ b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/SystemLibraryManagerProvider.java
@@ -35,8 +35,9 @@ import java.net.URI;
* system library managers} used by the tools.
*/
public class SystemLibraryManagerProvider {
+ private static final String IMPORT_CONFIG = "import.config";
private static final Object lock = new Object();
- private static EditorLibraryManager ANY_LIBRARY_MANAGER;
+ private static EditorLibraryManager VM_LIBRARY_MANAGER;
private static AnalysisServer defaultAnalysisServer;
@@ -48,7 +49,7 @@ public class SystemLibraryManagerProvider {
public static AnalysisServer getDefaultAnalysisServer() {
synchronized (lock) {
if (defaultAnalysisServer == null) {
- defaultAnalysisServer = new AnalysisServer(getAnyLibraryManager());
+ defaultAnalysisServer = new AnalysisServer(getVmLibraryManager());
defaultAnalysisServer.addAnalysisListener(new AnalysisMarkerManager(defaultAnalysisServer));
defaultAnalysisServer.addAnalysisListener(new AnalysisIndexManager());
// TODO (danrubel) merge ResourceChangeListener with delta processor
@@ -64,35 +65,63 @@ public class SystemLibraryManagerProvider {
* Return the default library manager.
*/
public static EditorLibraryManager getSystemLibraryManager() {
- return getAnyLibraryManager();
+ return getVmLibraryManager();
}
/**
* Return the manager for VM libraries
*/
- public static EditorLibraryManager getAnyLibraryManager() {
+ public static EditorLibraryManager getVmLibraryManager() {
synchronized (lock) {
- if (ANY_LIBRARY_MANAGER == null) {
-
- DartSdk sdk = DartSdk.getInstance();
- if (sdk == null) {
- DartCore.logError("Missing SDK");
- return null;
- }
-
- File sdkDir = sdk.getDirectory();
- if (!sdkDir.exists()) {
- DartCore.logError("Missing libraries directory: " + sdkDir);
- return null;
- }
-
- DartCore.logInformation("Reading bundled libraries from " + sdkDir);
-
- ANY_LIBRARY_MANAGER = new EditorLibraryManager(sdkDir, "any");
-
+ if (VM_LIBRARY_MANAGER == null) {
+ VM_LIBRARY_MANAGER = new EditorLibraryManager() {
+
+ /**
+ * Return the SDK "lib" directory
+ */
+ @Override
+ public File getLibrariesDir() {
+ DartSdk sdk = DartSdk.getInstance();
+ if (sdk == null) {
+ DartCore.logError("Missing SDK");
+ }
+ File libDir = sdk.getLibraryDirectory();
+ if (!libDir.exists()) {
+ DartCore.logError("Missing libraries directory: " + libDir);
+ }
+ File librariesDir = libDir;
+ if (DartCoreDebug.DARTLIB) {
+ DartCore.logInformation("Reading bundled libraries from " + librariesDir);
+ }
+ return librariesDir;
+ }
+
+ @Override
+ protected URI getBaseUri() {
+ return DartSdk.getInstallDirectory().toURI();
+ }
+
+ @Override
+ protected InputStream getImportConfigStream() {
+ File file = new File(getLibrariesDir(), IMPORT_CONFIG);
+ if (!file.exists()) {
+ throw new AssertionFailedException("Failed to find " + IMPORT_CONFIG);
+ }
+ try {
+ return new BufferedInputStream(new FileInputStream(file));
+ } catch (FileNotFoundException e) {
+ throw new AssertionFailedException("Failed to open " + file);
+ }
+ }
+
+ @Override
+ protected String getPlatformName() {
+ return "runtime";
+ }
+ };
}
}
- return ANY_LIBRARY_MANAGER;
+ return VM_LIBRARY_MANAGER;
}
/**

Powered by Google App Engine
This is Rietveld 408576698