| 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 303 } |
| 304 | 304 |
| 305 /** | 305 /** |
| 306 * Class that maintains a mapping from included/excluded paths to a set of | 306 * Class that maintains a mapping from included/excluded paths to a set of |
| 307 * folders that should correspond to analysis contexts. | 307 * folders that should correspond to analysis contexts. |
| 308 */ | 308 */ |
| 309 class ContextManagerImpl implements ContextManager { | 309 class ContextManagerImpl implements ContextManager { |
| 310 /** | 310 /** |
| 311 * Temporary flag to hide WIP .packages support (DEP 5). | 311 * Temporary flag to hide WIP .packages support (DEP 5). |
| 312 */ | 312 */ |
| 313 static bool ENABLE_PACKAGESPEC_SUPPORT = | 313 static bool ENABLE_PACKAGESPEC_SUPPORT = serverOptions.isSet( |
| 314 serverOptions.isSet('ContextManagerImpl.ENABLE_PACKAGESPEC_SUPPORT'); | 314 'ContextManagerImpl.ENABLE_PACKAGESPEC_SUPPORT', defaultValue: true); |
| 315 | 315 |
| 316 /** | 316 /** |
| 317 * The name of the `lib` directory. | 317 * The name of the `lib` directory. |
| 318 */ | 318 */ |
| 319 static const String LIB_DIR_NAME = 'lib'; | 319 static const String LIB_DIR_NAME = 'lib'; |
| 320 | 320 |
| 321 /** | 321 /** |
| 322 * The name of `packages` folders. | 322 * The name of `packages` folders. |
| 323 */ | 323 */ |
| 324 static const String PACKAGES_NAME = 'packages'; | 324 static const String PACKAGES_NAME = 'packages'; |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 createContext = packageSpec.exists || !withPackageSpecOnly; | 847 bool createContext = packageSpec.exists || !withPackageSpecOnly; |
| 848 if (withPackageSpecOnly && packageSpec.exists && | 848 if (withPackageSpecOnly && |
| 849 (parent != null) && parent.ignored(packageSpec.path)) { | 849 packageSpec.exists && |
| 850 (parent != null) && |
| 851 parent.ignored(packageSpec.path)) { |
| 850 // Don't create a context if the package spec is required and ignored. | 852 // Don't create a context if the package spec is required and ignored. |
| 851 createContext = false; | 853 createContext = false; |
| 852 } | 854 } |
| 853 if (createContext) { | 855 if (createContext) { |
| 854 parent = _createContext(parent, folder, packageSpec); | 856 parent = _createContext(parent, folder, packageSpec); |
| 855 } | 857 } |
| 856 | 858 |
| 857 // Try to find subfolders with pubspecs or .packages files. | 859 // Try to find subfolders with pubspecs or .packages files. |
| 858 try { | 860 try { |
| 859 for (Resource child in folder.getChildren()) { | 861 for (Resource child in folder.getChildren()) { |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 | 1344 |
| 1343 PackagesFileDisposition(this.packages) {} | 1345 PackagesFileDisposition(this.packages) {} |
| 1344 | 1346 |
| 1345 @override | 1347 @override |
| 1346 String get packageRoot => null; | 1348 String get packageRoot => null; |
| 1347 | 1349 |
| 1348 @override | 1350 @override |
| 1349 Iterable<UriResolver> createPackageUriResolvers( | 1351 Iterable<UriResolver> createPackageUriResolvers( |
| 1350 ResourceProvider resourceProvider) => const <UriResolver>[]; | 1352 ResourceProvider resourceProvider) => const <UriResolver>[]; |
| 1351 } | 1353 } |
| OLD | NEW |