OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library context.directory.manager; | 5 library context.directory.manager; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 * Resursively adds all Dart and HTML files to the [changeSet]. | 232 * Resursively adds all Dart and HTML files to the [changeSet]. |
233 */ | 233 */ |
234 void _addPreviouslyExcludedSources(_ContextInfo info, ChangeSet changeSet, | 234 void _addPreviouslyExcludedSources(_ContextInfo info, ChangeSet changeSet, |
235 Folder folder, List<String> oldExcludedPaths) { | 235 Folder folder, List<String> oldExcludedPaths) { |
236 if (info.excludesResource(folder)) { | 236 if (info.excludesResource(folder)) { |
237 return; | 237 return; |
238 } | 238 } |
239 List<Resource> children = folder.getChildren(); | 239 List<Resource> children = folder.getChildren(); |
240 for (Resource child in children) { | 240 for (Resource child in children) { |
241 String path = child.path; | 241 String path = child.path; |
242 // ignore if wasn't previously excluded | |
243 bool wasExcluded = | |
244 _isExcludedBy(oldExcludedPaths, path) && | |
245 !_isExcludedBy(excludedPaths, path); | |
246 if (!wasExcluded) { | |
247 continue; | |
248 } | |
249 // add files, recurse into folders | 242 // add files, recurse into folders |
250 if (child is File) { | 243 if (child is File) { |
251 if (_shouldFileBeAnalyzed(child)) { | 244 // ignore if should not be analyzed at all |
252 Source source = child.createSource(); | 245 if (!_shouldFileBeAnalyzed(child)) { |
253 changeSet.addedSource(source); | 246 continue; |
254 info.sources[path] = source; | |
255 } | 247 } |
| 248 // ignore if was not excluded |
| 249 bool wasExcluded = |
| 250 _isExcludedBy(oldExcludedPaths, path) && |
| 251 !_isExcludedBy(excludedPaths, path); |
| 252 if (!wasExcluded) { |
| 253 continue; |
| 254 } |
| 255 // do add the file |
| 256 Source source = child.createSource(); |
| 257 changeSet.addedSource(source); |
| 258 info.sources[path] = source; |
256 } else if (child is Folder) { | 259 } else if (child is Folder) { |
257 if (child.shortName == PACKAGES_NAME) { | 260 if (child.shortName == PACKAGES_NAME) { |
258 continue; | 261 continue; |
259 } | 262 } |
260 _addPreviouslyExcludedSources(info, changeSet, child, oldExcludedPaths); | 263 _addPreviouslyExcludedSources(info, changeSet, child, oldExcludedPaths); |
261 } | 264 } |
262 } | 265 } |
263 } | 266 } |
264 | 267 |
265 /** | 268 /** |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 return excludes(resource.path); | 650 return excludes(resource.path); |
648 } | 651 } |
649 | 652 |
650 /** | 653 /** |
651 * Returns `true` if [path] is the pubspec file of this context. | 654 * Returns `true` if [path] is the pubspec file of this context. |
652 */ | 655 */ |
653 bool isPubspec(String path) { | 656 bool isPubspec(String path) { |
654 return path == pubspecPath; | 657 return path == pubspecPath; |
655 } | 658 } |
656 } | 659 } |
OLD | NEW |