| 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 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:core' hide Resource; | 10 import 'dart:core' hide Resource; |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 if (ENABLE_PACKAGESPEC_SUPPORT) { | 837 if (ENABLE_PACKAGESPEC_SUPPORT) { |
| 838 // Start by looking for .packages. | 838 // Start by looking for .packages. |
| 839 packageSpec = folder.getChild(PACKAGE_SPEC_NAME); | 839 packageSpec = folder.getChild(PACKAGE_SPEC_NAME); |
| 840 } | 840 } |
| 841 | 841 |
| 842 // Fall back to looking for a pubspec. | 842 // Fall back to looking for a pubspec. |
| 843 if (packageSpec == null || !packageSpec.exists) { | 843 if (packageSpec == null || !packageSpec.exists) { |
| 844 packageSpec = folder.getChild(PUBSPEC_NAME); | 844 packageSpec = folder.getChild(PUBSPEC_NAME); |
| 845 } | 845 } |
| 846 | 846 |
| 847 bool parentCreated = false; | 847 bool createContext = packageSpec.exists || !withPackageSpecOnly; |
| 848 if (packageSpec.exists || !withPackageSpecOnly) { | 848 if (withPackageSpecOnly && packageSpec.exists && |
| 849 parentCreated = true; | 849 (parent != null) && parent.ignored(packageSpec.path)) { |
| 850 // Don't create a context if the package spec is required and ignored. |
| 851 createContext = false; |
| 852 } |
| 853 if (createContext) { |
| 850 parent = _createContext(parent, folder, packageSpec); | 854 parent = _createContext(parent, folder, packageSpec); |
| 851 } | 855 } |
| 852 | 856 |
| 853 // Try to find subfolders with pubspecs or .packages files. | 857 // Try to find subfolders with pubspecs or .packages files. |
| 854 try { | 858 try { |
| 855 for (Resource child in folder.getChildren()) { | 859 for (Resource child in folder.getChildren()) { |
| 856 if (child is Folder) { | 860 if (child is Folder) { |
| 857 _createContexts(parent, child, true); | 861 if (!parent.ignored(child.path)) { |
| 862 _createContexts(parent, child, true); |
| 863 } |
| 858 } | 864 } |
| 859 } | 865 } |
| 860 } on FileSystemException { | 866 } on FileSystemException { |
| 861 // The directory either doesn't exist or cannot be read. Either way, there | 867 // The directory either doesn't exist or cannot be read. Either way, there |
| 862 // are no subfolders that need to be added. | 868 // are no subfolders that need to be added. |
| 863 } | 869 } |
| 864 | 870 |
| 865 if (parentCreated) { | 871 if (createContext) { |
| 866 // Now that the child contexts have been created, add the sources that | 872 // Now that the child contexts have been created, add the sources that |
| 867 // don't belong to the children. | 873 // don't belong to the children. |
| 868 ChangeSet changeSet = new ChangeSet(); | 874 ChangeSet changeSet = new ChangeSet(); |
| 869 _addSourceFiles(changeSet, folder, parent); | 875 _addSourceFiles(changeSet, folder, parent); |
| 870 callbacks.applyChangesToContext(folder, changeSet); | 876 callbacks.applyChangesToContext(folder, changeSet); |
| 871 } | 877 } |
| 872 } | 878 } |
| 873 | 879 |
| 874 /** | 880 /** |
| 875 * Clean up and destroy the context associated with the given folder. | 881 * Clean up and destroy the context associated with the given folder. |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 | 1342 |
| 1337 PackagesFileDisposition(this.packages) {} | 1343 PackagesFileDisposition(this.packages) {} |
| 1338 | 1344 |
| 1339 @override | 1345 @override |
| 1340 String get packageRoot => null; | 1346 String get packageRoot => null; |
| 1341 | 1347 |
| 1342 @override | 1348 @override |
| 1343 Iterable<UriResolver> createPackageUriResolvers( | 1349 Iterable<UriResolver> createPackageUriResolvers( |
| 1344 ResourceProvider resourceProvider) => const <UriResolver>[]; | 1350 ResourceProvider resourceProvider) => const <UriResolver>[]; |
| 1345 } | 1351 } |
| OLD | NEW |