| 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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 // folders), the only way we should be able to get here is due to a race | 761 // folders), the only way we should be able to get here is due to a race |
| 762 // condition. In any case, the package root folder is gone, so we can't | 762 // condition. In any case, the package root folder is gone, so we can't |
| 763 // resolve packages. | 763 // resolve packages. |
| 764 return new NoPackageFolderDisposition(packageRoot: packageRoot); | 764 return new NoPackageFolderDisposition(packageRoot: packageRoot); |
| 765 } else { | 765 } else { |
| 766 PackageMapInfo packageMapInfo; | 766 PackageMapInfo packageMapInfo; |
| 767 callbacks.beginComputePackageMap(); | 767 callbacks.beginComputePackageMap(); |
| 768 try { | 768 try { |
| 769 if (ENABLE_PACKAGESPEC_SUPPORT) { | 769 if (ENABLE_PACKAGESPEC_SUPPORT) { |
| 770 // Try .packages first. | 770 // Try .packages first. |
| 771 if (pathos.basename(packagespecFile.path) == PACKAGE_SPEC_NAME) { | 771 if (pathContext.basename(packagespecFile.path) == PACKAGE_SPEC_NAME) { |
| 772 Packages packages = _readPackagespec(packagespecFile); | 772 Packages packages = _readPackagespec(packagespecFile); |
| 773 return new PackagesFileDisposition(packages); | 773 return new PackagesFileDisposition(packages); |
| 774 } | 774 } |
| 775 } | 775 } |
| 776 if (packageResolverProvider != null) { | 776 if (packageResolverProvider != null) { |
| 777 UriResolver resolver = packageResolverProvider(folder); | 777 UriResolver resolver = packageResolverProvider(folder); |
| 778 if (resolver != null) { | 778 if (resolver != null) { |
| 779 return new CustomPackageResolverDisposition(resolver); | 779 return new CustomPackageResolverDisposition(resolver); |
| 780 } | 780 } |
| 781 } | 781 } |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 String directoryPath = pathContext.dirname(path); | 1011 String directoryPath = pathContext.dirname(path); |
| 1012 | 1012 |
| 1013 // Check to see if we need to create a new context. | 1013 // Check to see if we need to create a new context. |
| 1014 if (info.isTopLevel) { | 1014 if (info.isTopLevel) { |
| 1015 // Only create a new context if this is not the same directory | 1015 // Only create a new context if this is not the same directory |
| 1016 // described by our info object. | 1016 // described by our info object. |
| 1017 if (info.folder.path != directoryPath) { | 1017 if (info.folder.path != directoryPath) { |
| 1018 if (_isPubspec(path)) { | 1018 if (_isPubspec(path)) { |
| 1019 // Check for a sibling .packages file. | 1019 // Check for a sibling .packages file. |
| 1020 if (!resourceProvider | 1020 if (!resourceProvider |
| 1021 .getFile(pathos.join(directoryPath, PACKAGE_SPEC_NAME)) | 1021 .getFile(pathContext.join(directoryPath, PACKAGE_SPEC_NAME)) |
| 1022 .exists) { | 1022 .exists) { |
| 1023 _extractContext(info, resource); | 1023 _extractContext(info, resource); |
| 1024 return; | 1024 return; |
| 1025 } | 1025 } |
| 1026 } | 1026 } |
| 1027 if (_isPackagespec(path)) { | 1027 if (_isPackagespec(path)) { |
| 1028 // Check for a sibling pubspec.yaml file. | 1028 // Check for a sibling pubspec.yaml file. |
| 1029 if (!resourceProvider | 1029 if (!resourceProvider |
| 1030 .getFile(pathos.join(directoryPath, PUBSPEC_NAME)) | 1030 .getFile(pathContext.join(directoryPath, PUBSPEC_NAME)) |
| 1031 .exists) { | 1031 .exists) { |
| 1032 _extractContext(info, resource); | 1032 _extractContext(info, resource); |
| 1033 return; | 1033 return; |
| 1034 } | 1034 } |
| 1035 } | 1035 } |
| 1036 } | 1036 } |
| 1037 } | 1037 } |
| 1038 } else { | 1038 } else { |
| 1039 // pubspec was added in a sub-folder, extract a new context | 1039 // pubspec was added in a sub-folder, extract a new context |
| 1040 if (_isPubspec(path) && | 1040 if (_isPubspec(path) && |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1066 // lingering pubspec.yaml before merging. | 1066 // lingering pubspec.yaml before merging. |
| 1067 if (!info.isTopLevel) { | 1067 if (!info.isTopLevel) { |
| 1068 if (ENABLE_PACKAGESPEC_SUPPORT) { | 1068 if (ENABLE_PACKAGESPEC_SUPPORT) { |
| 1069 String directoryPath = pathContext.dirname(path); | 1069 String directoryPath = pathContext.dirname(path); |
| 1070 | 1070 |
| 1071 // Only merge if this is the same directory described by our info ob
ject. | 1071 // Only merge if this is the same directory described by our info ob
ject. |
| 1072 if (info.folder.path == directoryPath) { | 1072 if (info.folder.path == directoryPath) { |
| 1073 if (_isPubspec(path)) { | 1073 if (_isPubspec(path)) { |
| 1074 // Check for a sibling .packages file. | 1074 // Check for a sibling .packages file. |
| 1075 if (!resourceProvider | 1075 if (!resourceProvider |
| 1076 .getFile(pathos.join(directoryPath, PACKAGE_SPEC_NAME)) | 1076 .getFile(pathContext.join(directoryPath, PACKAGE_SPEC_NAME)) |
| 1077 .exists) { | 1077 .exists) { |
| 1078 _mergeContext(info); | 1078 _mergeContext(info); |
| 1079 return; | 1079 return; |
| 1080 } | 1080 } |
| 1081 } | 1081 } |
| 1082 if (_isPackagespec(path)) { | 1082 if (_isPackagespec(path)) { |
| 1083 // Check for a sibling pubspec.yaml file. | 1083 // Check for a sibling pubspec.yaml file. |
| 1084 if (!resourceProvider | 1084 if (!resourceProvider |
| 1085 .getFile(pathos.join(directoryPath, PUBSPEC_NAME)) | 1085 .getFile(pathContext.join(directoryPath, PUBSPEC_NAME)) |
| 1086 .exists) { | 1086 .exists) { |
| 1087 _mergeContext(info); | 1087 _mergeContext(info); |
| 1088 return; | 1088 return; |
| 1089 } | 1089 } |
| 1090 } | 1090 } |
| 1091 } | 1091 } |
| 1092 } else { | 1092 } else { |
| 1093 if (info.isPathToPackageDescription(path)) { | 1093 if (info.isPathToPackageDescription(path)) { |
| 1094 _mergeContext(info); | 1094 _mergeContext(info); |
| 1095 return; | 1095 return; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 PackagesFileDisposition(this.packages) {} | 1366 PackagesFileDisposition(this.packages) {} |
| 1367 | 1367 |
| 1368 @override | 1368 @override |
| 1369 String get packageRoot => null; | 1369 String get packageRoot => null; |
| 1370 | 1370 |
| 1371 @override | 1371 @override |
| 1372 Iterable<UriResolver> createPackageUriResolvers( | 1372 Iterable<UriResolver> createPackageUriResolvers( |
| 1373 ResourceProvider resourceProvider) => | 1373 ResourceProvider resourceProvider) => |
| 1374 const <UriResolver>[]; | 1374 const <UriResolver>[]; |
| 1375 } | 1375 } |
| OLD | NEW |