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

Unified Diff: pkg/analysis_server/lib/src/context_manager.dart

Issue 1711353003: update setAnalysisRoots to accept package spec file (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 4 years, 10 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: pkg/analysis_server/lib/src/context_manager.dart
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 992cf5500a764aab18fd3a04290bd73c15e5acb5..8575086ec3ac51bedf108b5a609fcd006469b618 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -960,10 +960,10 @@ class ContextManagerImpl implements ContextManager {
if (packageRoot != null) {
// TODO(paulberry): We shouldn't be using JavaFile here because it
// makes the code untestable (see dartbug.com/23909).
- JavaFile packagesDir = new JavaFile(packageRoot);
+ JavaFile packagesDirOrFile = new JavaFile(packageRoot);
Map<String, List<Folder>> packageMap = new Map<String, List<Folder>>();
- if (packagesDir.isDirectory()) {
- for (JavaFile file in packagesDir.listFiles()) {
+ if (packagesDirOrFile.isDirectory()) {
+ for (JavaFile file in packagesDirOrFile.listFiles()) {
// Ensure symlinks in packages directory are canonicalized
// to prevent 'type X cannot be assigned to type X' warnings
String path;
@@ -980,6 +980,12 @@ class ContextManagerImpl implements ContextManager {
}
}
return new PackageMapDisposition(packageMap, packageRoot: packageRoot);
+ } else if (packagesDirOrFile.isFile()) {
+ File packageSpecFile = resourceProvider.getFile(packageRoot);
+ Packages packages = _readPackagespec(packageSpecFile);
+ if (packages != null) {
+ return new PackagesFileDisposition(packages);
+ }
}
// The package root does not exist (or is not a folder). Since
// [setRoots] ignores any package roots that don't exist (or aren't

Powered by Google App Engine
This is Rietveld 408576698