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

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

Issue 303413003: Don't add files inside "packages" subdir to context. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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/lib/src/resource.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_directory_manager.dart
diff --git a/pkg/analysis_server/lib/src/context_directory_manager.dart b/pkg/analysis_server/lib/src/context_directory_manager.dart
index c171798b74e5a72d8441d217cc23988631aaec0d..cadbb0fa66c6062c93377d90a44b0b8da8a107d2 100644
--- a/pkg/analysis_server/lib/src/context_directory_manager.dart
+++ b/pkg/analysis_server/lib/src/context_directory_manager.dart
@@ -100,6 +100,11 @@ abstract class ContextDirectoryManager {
void _handleWatchEvent(Folder folder, _ContextDirectoryInfo info, WatchEvent event) {
switch (event.type) {
case ChangeType.ADD:
+ if (_isInPackagesDir(event.path, folder)) {
+ // TODO(paulberry): perhaps we should only skip packages dirs if
+ // there is a pubspec.yaml?
+ break;
+ }
// TODO(paulberry): handle adding pubspec.yaml
if (_shouldFileBeAnalyzed(event.path)) {
ChangeSet changeSet = new ChangeSet();
@@ -133,6 +138,21 @@ abstract class ContextDirectoryManager {
}
/**
+ * Determine if the path from [folder] to [path] contains a 'packages'
+ * directory.
+ */
+ bool _isInPackagesDir(String path, Folder folder) {
+ String relativePath = resourceProvider.pathContext.relative(path, from: folder.path);
+ List<String> pathParts = resourceProvider.pathContext.split(relativePath);
+ for (int i = 0; i < pathParts.length - 1; i++) {
+ if (pathParts[i] == 'packages') {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* Resursively adds all Dart and HTML files to the [changeSet].
*/
static void _addSourceFiles(ChangeSet changeSet, Folder folder, _ContextDirectoryInfo info) {
@@ -145,6 +165,11 @@ abstract class ContextDirectoryManager {
info.sources[child.path] = source;
}
} else if (child is Folder) {
+ if (child.shortName == 'packages') {
+ // TODO(paulberry): perhaps we should only skip packages dirs if
+ // there is a pubspec.yaml?
+ continue;
+ }
_addSourceFiles(changeSet, child, info);
}
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/resource.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698