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

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

Issue 1042293003: Recognize nested pubspecs (issue 22907) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 058662c887d0fcc273258bb9fdde87cc565aa162..c76ac5e9b43cd9ce02feba13ef84b47dc072c209 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -335,7 +335,7 @@ abstract class ContextManager {
for (Resource child in children) {
String path = child.path;
// ignore excluded files or folders
- if (_isExcluded(path)) {
+ if (_isExcluded(path) || info.excludes(path)) {
continue;
}
// add files, recurse into folders
@@ -400,47 +400,45 @@ abstract class ContextManager {
}
/**
- * Creates a new context associated with [folder].
+ * Potentially create a new context associated with the given [folder].
*
- * If there are subfolders with 'pubspec.yaml' files, separate contexts
- * are created for them, and excluded from the context associated with
+ * If there are subfolders with 'pubspec.yaml' files, separate contexts are
+ * created for them and excluded from the context associated with the
* [folder].
*
- * If [folder] itself contains a 'pubspec.yaml' file, subfolders are ignored.
- *
* If [withPubspecOnly] is `true`, a context will be created only if there
- * is a 'pubspec.yaml' file in [folder].
+ * is a 'pubspec.yaml' file in the [folder].
*
* Returns create pubspec-based contexts.
*/
List<_ContextInfo> _createContexts(Folder folder, bool withPubspecOnly) {
- // check whether there is a pubspec in the folder
- File pubspecFile = folder.getChild(PUBSPEC_NAME);
- if (pubspecFile.exists) {
- _ContextInfo info =
- _createContextWithSources(folder, pubspecFile, <_ContextInfo>[]);
- return [info];
- }
// try to find subfolders with pubspec files
List<_ContextInfo> children = <_ContextInfo>[];
try {
for (Resource child in folder.getChildren()) {
if (child is Folder) {
- List<_ContextInfo> childContexts = _createContexts(child, true);
- children.addAll(childContexts);
+ children.addAll(_createContexts(child, true));
}
}
} on FileSystemException {
// The directory either doesn't exist or cannot be read. Either way, there
// are no subfolders that need to be added.
}
+ // check whether there is a pubspec in the folder
+ File pubspecFile = folder.getChild(PUBSPEC_NAME);
+ if (pubspecFile.exists) {
+ return <_ContextInfo>[
+ _createContextWithSources(folder, pubspecFile, children)
+ ];
+ }
// no pubspec, done
if (withPubspecOnly) {
return children;
}
// OK, create a context without a pubspec
- _createContextWithSources(folder, pubspecFile, children);
- return children;
+ return <_ContextInfo>[
+ _createContextWithSources(folder, pubspecFile, children)
+ ];
}
/**
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698