| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 * objects. | 69 * objects. |
| 70 */ | 70 */ |
| 71 ContextInfo parent; | 71 ContextInfo parent; |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * The package description file path for this context. | 74 * The package description file path for this context. |
| 75 */ | 75 */ |
| 76 String packageDescriptionPath; | 76 String packageDescriptionPath; |
| 77 | 77 |
| 78 /** | 78 /** |
| 79 * The folder disposition for this context. |
| 80 */ |
| 81 final FolderDisposition disposition; |
| 82 |
| 83 /** |
| 79 * Paths to files which determine the folder disposition and package map. | 84 * Paths to files which determine the folder disposition and package map. |
| 80 * | 85 * |
| 81 * TODO(paulberry): if any of these files are outside of [folder], they won't | 86 * TODO(paulberry): if any of these files are outside of [folder], they won't |
| 82 * be watched for changes. I believe the use case for watching these files | 87 * be watched for changes. I believe the use case for watching these files |
| 83 * is no longer relevant. | 88 * is no longer relevant. |
| 84 */ | 89 */ |
| 85 Set<String> _dependencies = new Set<String>(); | 90 Set<String> _dependencies = new Set<String>(); |
| 86 | 91 |
| 87 /** | 92 /** |
| 88 * The analysis context that was created for the [folder]. | 93 * The analysis context that was created for the [folder]. |
| 89 */ | 94 */ |
| 90 AnalysisContext context; | 95 AnalysisContext context; |
| 91 | 96 |
| 92 /** | 97 /** |
| 93 * Map from full path to the [Source] object, for each source that has been | 98 * Map from full path to the [Source] object, for each source that has been |
| 94 * added to the context. | 99 * added to the context. |
| 95 */ | 100 */ |
| 96 Map<String, Source> sources = new HashMap<String, Source>(); | 101 Map<String, Source> sources = new HashMap<String, Source>(); |
| 97 | 102 |
| 98 ContextInfo(ContextManagerImpl contextManager, this.parent, Folder folder, | 103 ContextInfo(ContextManagerImpl contextManager, this.parent, Folder folder, |
| 99 File packagespecFile, this.packageRoot) | 104 File packagespecFile, this.packageRoot, this.disposition) |
| 100 : folder = folder, | 105 : folder = folder, |
| 101 pathFilter = new PathFilter( | 106 pathFilter = new PathFilter( |
| 102 folder.path, null, contextManager.resourceProvider.pathContext) { | 107 folder.path, null, contextManager.resourceProvider.pathContext) { |
| 103 packageDescriptionPath = packagespecFile.path; | 108 packageDescriptionPath = packagespecFile.path; |
| 104 parent.children.add(this); | 109 parent.children.add(this); |
| 105 } | 110 } |
| 106 | 111 |
| 107 /** | 112 /** |
| 108 * Create the virtual [ContextInfo] which acts as an ancestor to all other | 113 * Create the virtual [ContextInfo] which acts as an ancestor to all other |
| 109 * [ContextInfo]s. | 114 * [ContextInfo]s. |
| 110 */ | 115 */ |
| 111 ContextInfo._root() | 116 ContextInfo._root() |
| 112 : folder = null, | 117 : folder = null, |
| 113 pathFilter = null; | 118 pathFilter = null, |
| 119 packageRoot = null, |
| 120 disposition = null; |
| 114 | 121 |
| 115 /** | 122 /** |
| 116 * Iterate through all [children] and their children, recursively. | 123 * Iterate through all [children] and their children, recursively. |
| 117 */ | 124 */ |
| 118 Iterable<ContextInfo> get descendants sync* { | 125 Iterable<ContextInfo> get descendants sync* { |
| 119 for (ContextInfo child in children) { | 126 for (ContextInfo child in children) { |
| 120 yield child; | 127 yield child; |
| 121 yield* child.descendants; | 128 yield* child.descendants; |
| 122 } | 129 } |
| 123 } | 130 } |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 if (options == null && !optionsRemoved) { | 583 if (options == null && !optionsRemoved) { |
| 577 return; | 584 return; |
| 578 } | 585 } |
| 579 | 586 |
| 580 // In case options files are removed, revert to defaults. | 587 // In case options files are removed, revert to defaults. |
| 581 if (optionsRemoved) { | 588 if (optionsRemoved) { |
| 582 // Start with defaults. | 589 // Start with defaults. |
| 583 info.context.analysisOptions = new AnalysisOptionsImpl(); | 590 info.context.analysisOptions = new AnalysisOptionsImpl(); |
| 584 | 591 |
| 585 // Apply inherited options. | 592 // Apply inherited options. |
| 586 options = _toStringMap(_getEmbeddedOptions(info.context)); | 593 options = _toStringMap(_getEmbeddedOptions(info)); |
| 587 if (options != null) { | 594 if (options != null) { |
| 588 configureContextOptions(info.context, options); | 595 configureContextOptions(info.context, options); |
| 589 } | 596 } |
| 590 } else { | 597 } else { |
| 591 // Check for embedded options. | 598 // Check for embedded options. |
| 592 Map embeddedOptions = _getEmbeddedOptions(info.context); | 599 Map embeddedOptions = _getEmbeddedOptions(info); |
| 593 if (embeddedOptions != null) { | 600 if (embeddedOptions != null) { |
| 594 options = _toStringMap(new Merger().merge(embeddedOptions, options)); | 601 options = _toStringMap(new Merger().merge(embeddedOptions, options)); |
| 595 } | 602 } |
| 596 } | 603 } |
| 597 | 604 |
| 598 // Notify options processors. | 605 // Notify options processors. |
| 599 AnalysisEngine.instance.optionsPlugin.optionsProcessors | 606 AnalysisEngine.instance.optionsPlugin.optionsProcessors |
| 600 .forEach((OptionsProcessor p) { | 607 .forEach((OptionsProcessor p) { |
| 601 try { | 608 try { |
| 602 p.optionsProcessed(info.context, options); | 609 p.optionsProcessed(info.context, options); |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 return new PackageMapDisposition(packageMapInfo.packageMap); | 1039 return new PackageMapDisposition(packageMapInfo.packageMap); |
| 1033 } | 1040 } |
| 1034 } | 1041 } |
| 1035 | 1042 |
| 1036 /** | 1043 /** |
| 1037 * Create a new empty context associated with [folder], having parent | 1044 * Create a new empty context associated with [folder], having parent |
| 1038 * [parent] and using [packagespecFile] to resolve package URI's. | 1045 * [parent] and using [packagespecFile] to resolve package URI's. |
| 1039 */ | 1046 */ |
| 1040 ContextInfo _createContext( | 1047 ContextInfo _createContext( |
| 1041 ContextInfo parent, Folder folder, File packagespecFile) { | 1048 ContextInfo parent, Folder folder, File packagespecFile) { |
| 1049 List<String> dependencies = <String>[]; |
| 1050 FolderDisposition disposition = |
| 1051 _computeFolderDisposition(folder, dependencies.add, packagespecFile); |
| 1042 ContextInfo info = new ContextInfo(this, parent, folder, packagespecFile, | 1052 ContextInfo info = new ContextInfo(this, parent, folder, packagespecFile, |
| 1043 normalizedPackageRoots[folder.path]); | 1053 normalizedPackageRoots[folder.path], disposition); |
| 1044 | |
| 1045 FolderDisposition disposition; | |
| 1046 List<String> dependencies = <String>[]; | |
| 1047 | |
| 1048 // Next resort to a package uri resolver. | |
| 1049 if (disposition == null) { | |
| 1050 disposition = | |
| 1051 _computeFolderDisposition(folder, dependencies.add, packagespecFile); | |
| 1052 } | |
| 1053 | 1054 |
| 1054 Map<String, Object> optionMap = readOptions(info.folder); | 1055 Map<String, Object> optionMap = readOptions(info.folder); |
| 1055 AnalysisOptions options = | 1056 AnalysisOptions options = |
| 1056 new AnalysisOptionsImpl.from(defaultContextOptions); | 1057 new AnalysisOptionsImpl.from(defaultContextOptions); |
| 1057 applyToAnalysisOptions(options, optionMap); | 1058 applyToAnalysisOptions(options, optionMap); |
| 1058 | 1059 |
| 1059 info.setDependencies(dependencies); | 1060 info.setDependencies(dependencies); |
| 1060 info.context = callbacks.addContext(folder, options, disposition); | 1061 info.context = callbacks.addContext(folder, options, disposition); |
| 1061 folderMap[folder] = info.context; | 1062 folderMap[folder] = info.context; |
| 1062 info.context.name = folder.path; | 1063 info.context.name = folder.path; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 /** | 1148 /** |
| 1148 * Set up a [SourceFactory] that resolves packages as appropriate for the | 1149 * Set up a [SourceFactory] that resolves packages as appropriate for the |
| 1149 * given [disposition]. | 1150 * given [disposition]. |
| 1150 */ | 1151 */ |
| 1151 SourceFactory _createSourceFactory(InternalAnalysisContext context, | 1152 SourceFactory _createSourceFactory(InternalAnalysisContext context, |
| 1152 AnalysisOptions options, FolderDisposition disposition, Folder folder) { | 1153 AnalysisOptions options, FolderDisposition disposition, Folder folder) { |
| 1153 List<UriResolver> resolvers = []; | 1154 List<UriResolver> resolvers = []; |
| 1154 List<UriResolver> packageUriResolvers = | 1155 List<UriResolver> packageUriResolvers = |
| 1155 disposition.createPackageUriResolvers(resourceProvider); | 1156 disposition.createPackageUriResolvers(resourceProvider); |
| 1156 | 1157 |
| 1157 EmbedderSdk sdk = | 1158 EmbedderYamlLocator locator = |
| 1158 new EmbedderSdk(context.embedderYamlLocator.embedderYamls); | 1159 disposition.getEmbedderLocator(resourceProvider); |
| 1160 EmbedderSdk sdk = new EmbedderSdk(locator.embedderYamls); |
| 1159 if (sdk.libraryMap.size() == 0) { | 1161 if (sdk.libraryMap.size() == 0) { |
| 1160 // The embedder uri resolver has no mappings. Use the default Dart SDK | 1162 // The embedder uri resolver has no mappings. Use the default Dart SDK |
| 1161 // uri resolver. | 1163 // uri resolver. |
| 1162 resolvers.add(new DartUriResolver(sdkManager.getSdkForOptions(options))); | 1164 resolvers.add(new DartUriResolver(sdkManager.getSdkForOptions(options))); |
| 1163 } else { | 1165 } else { |
| 1164 // The embedder uri resolver has mappings, use it instead of the default | 1166 // The embedder uri resolver has mappings, use it instead of the default |
| 1165 // Dart SDK uri resolver. | 1167 // Dart SDK uri resolver. |
| 1166 resolvers.add(new DartUriResolver(sdk)); | 1168 resolvers.add(new DartUriResolver(sdk)); |
| 1167 } | 1169 } |
| 1168 | 1170 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 } | 1238 } |
| 1237 return packageSpec; | 1239 return packageSpec; |
| 1238 } | 1240 } |
| 1239 | 1241 |
| 1240 /// Get analysis options inherited from an `_embedder.yaml` (deprecated) | 1242 /// Get analysis options inherited from an `_embedder.yaml` (deprecated) |
| 1241 /// and/or a package specified configuration. If more than one | 1243 /// and/or a package specified configuration. If more than one |
| 1242 /// `_embedder.yaml` is associated with the given context, the embedder is | 1244 /// `_embedder.yaml` is associated with the given context, the embedder is |
| 1243 /// skipped. | 1245 /// skipped. |
| 1244 /// | 1246 /// |
| 1245 /// Returns null if there are no embedded/configured options. | 1247 /// Returns null if there are no embedded/configured options. |
| 1246 Map _getEmbeddedOptions(AnalysisContext context) { | 1248 Map _getEmbeddedOptions(ContextInfo info) { |
| 1247 Map embeddedOptions; | 1249 Map embeddedOptions = null; |
| 1250 EmbedderYamlLocator locator = |
| 1251 info.disposition.getEmbedderLocator(resourceProvider); |
| 1252 Iterable<YamlMap> maps = locator.embedderYamls.values; |
| 1253 if (maps.length == 1) { |
| 1254 embeddedOptions = maps.first; |
| 1255 } |
| 1248 | 1256 |
| 1249 if (context is InternalAnalysisContext) { | 1257 AnalysisConfiguration configuration = getConfiguration(info.context); |
| 1250 EmbedderYamlLocator locator = context.embedderYamlLocator; | 1258 if (configuration != null) { |
| 1251 Iterable<YamlMap> maps = locator.embedderYamls.values; | 1259 Map configMap = configuration.options; |
| 1252 if (maps.length == 1) { | 1260 if (configMap != null) { |
| 1253 embeddedOptions = maps.first; | 1261 if (embeddedOptions != null) { |
| 1254 } | 1262 embeddedOptions = new Merger().merge(embeddedOptions, configMap); |
| 1255 | 1263 } else { |
| 1256 AnalysisConfiguration configuration = getConfiguration(context); | 1264 embeddedOptions = configMap; |
| 1257 if (configuration != null) { | |
| 1258 Map configMap = configuration.options; | |
| 1259 if (configMap != null) { | |
| 1260 if (embeddedOptions != null) { | |
| 1261 embeddedOptions = new Merger().merge(embeddedOptions, configMap); | |
| 1262 } else { | |
| 1263 embeddedOptions = configMap; | |
| 1264 } | |
| 1265 } | 1265 } |
| 1266 } | 1266 } |
| 1267 } | 1267 } |
| 1268 | |
| 1269 return embeddedOptions; | 1268 return embeddedOptions; |
| 1270 } | 1269 } |
| 1271 | 1270 |
| 1272 /** | 1271 /** |
| 1273 * Return the [ContextInfo] for the "innermost" context whose associated | 1272 * Return the [ContextInfo] for the "innermost" context whose associated |
| 1274 * folder is or contains the given path. ("innermost" refers to the nesting | 1273 * folder is or contains the given path. ("innermost" refers to the nesting |
| 1275 * of contexts, so if there is a context for path /foo and a context for | 1274 * of contexts, so if there is a context for path /foo and a context for |
| 1276 * path /foo/bar, then the innermost context containing /foo/bar/baz.dart is | 1275 * path /foo/bar, then the innermost context containing /foo/bar/baz.dart is |
| 1277 * the context for /foo/bar.) | 1276 * the context for /foo/bar.) |
| 1278 * | 1277 * |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 @override | 1689 @override |
| 1691 String get packageRoot => null; | 1690 String get packageRoot => null; |
| 1692 | 1691 |
| 1693 @override | 1692 @override |
| 1694 Packages get packages => null; | 1693 Packages get packages => null; |
| 1695 | 1694 |
| 1696 @override | 1695 @override |
| 1697 Iterable<UriResolver> createPackageUriResolvers( | 1696 Iterable<UriResolver> createPackageUriResolvers( |
| 1698 ResourceProvider resourceProvider) => | 1697 ResourceProvider resourceProvider) => |
| 1699 <UriResolver>[resolver]; | 1698 <UriResolver>[resolver]; |
| 1699 |
| 1700 @override |
| 1701 EmbedderYamlLocator getEmbedderLocator(ResourceProvider resourceProvider) => |
| 1702 new EmbedderYamlLocator(null); |
| 1700 } | 1703 } |
| 1701 | 1704 |
| 1702 /** | 1705 /** |
| 1703 * An instance of the class [FolderDisposition] represents the information | 1706 * An instance of the class [FolderDisposition] represents the information |
| 1704 * gathered by the [ContextManagerImpl] to determine how to create an | 1707 * gathered by the [ContextManagerImpl] to determine how to create an |
| 1705 * [AnalysisContext] for a given folder. | 1708 * [AnalysisContext] for a given folder. |
| 1706 * | 1709 * |
| 1707 * Note: [ContextManagerImpl] may use equality testing and hash codes to | 1710 * Note: [ContextManagerImpl] may use equality testing and hash codes to |
| 1708 * determine when two folders should share the same context, so derived classes | 1711 * determine when two folders should share the same context, so derived classes |
| 1709 * may need to override operator== and hashCode() if object identity is | 1712 * may need to override operator== and hashCode() if object identity is |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1730 | 1733 |
| 1731 /** | 1734 /** |
| 1732 * Create all the [UriResolver]s which should be used to resolve packages in | 1735 * Create all the [UriResolver]s which should be used to resolve packages in |
| 1733 * contexts governed by this [FolderDisposition]. | 1736 * contexts governed by this [FolderDisposition]. |
| 1734 * | 1737 * |
| 1735 * [resourceProvider] is provided since it is needed to construct most | 1738 * [resourceProvider] is provided since it is needed to construct most |
| 1736 * [UriResolver]s. | 1739 * [UriResolver]s. |
| 1737 */ | 1740 */ |
| 1738 Iterable<UriResolver> createPackageUriResolvers( | 1741 Iterable<UriResolver> createPackageUriResolvers( |
| 1739 ResourceProvider resourceProvider); | 1742 ResourceProvider resourceProvider); |
| 1743 |
| 1744 /** |
| 1745 * Return the locator used to locate the _embedder.yaml file used to configure |
| 1746 * the SDK. The [resourceProvider] is used to access the file system in cases |
| 1747 * where that is necessary. |
| 1748 */ |
| 1749 EmbedderYamlLocator getEmbedderLocator(ResourceProvider resourceProvider); |
| 1740 } | 1750 } |
| 1741 | 1751 |
| 1742 /** | 1752 /** |
| 1743 * Concrete [FolderDisposition] object indicating that the context for a given | 1753 * Concrete [FolderDisposition] object indicating that the context for a given |
| 1744 * folder should not resolve "package:" URIs at all. | 1754 * folder should not resolve "package:" URIs at all. |
| 1745 */ | 1755 */ |
| 1746 class NoPackageFolderDisposition extends FolderDisposition { | 1756 class NoPackageFolderDisposition extends FolderDisposition { |
| 1747 @override | 1757 @override |
| 1748 final String packageRoot; | 1758 final String packageRoot; |
| 1749 | 1759 |
| 1750 NoPackageFolderDisposition({this.packageRoot}); | 1760 NoPackageFolderDisposition({this.packageRoot}); |
| 1751 | 1761 |
| 1752 @override | 1762 @override |
| 1753 Packages get packages => null; | 1763 Packages get packages => null; |
| 1754 | 1764 |
| 1755 @override | 1765 @override |
| 1756 Iterable<UriResolver> createPackageUriResolvers( | 1766 Iterable<UriResolver> createPackageUriResolvers( |
| 1757 ResourceProvider resourceProvider) => | 1767 ResourceProvider resourceProvider) => |
| 1758 const <UriResolver>[]; | 1768 const <UriResolver>[]; |
| 1769 |
| 1770 @override |
| 1771 EmbedderYamlLocator getEmbedderLocator(ResourceProvider resourceProvider) => |
| 1772 new EmbedderYamlLocator(null); |
| 1759 } | 1773 } |
| 1760 | 1774 |
| 1761 /** | 1775 /** |
| 1762 * Concrete [FolderDisposition] object indicating that the context for a given | 1776 * Concrete [FolderDisposition] object indicating that the context for a given |
| 1763 * folder should resolve packages using a package map. | 1777 * folder should resolve packages using a package map. |
| 1764 */ | 1778 */ |
| 1765 class PackageMapDisposition extends FolderDisposition { | 1779 class PackageMapDisposition extends FolderDisposition { |
| 1766 final Map<String, List<Folder>> packageMap; | 1780 final Map<String, List<Folder>> packageMap; |
| 1767 | 1781 |
| 1782 EmbedderYamlLocator _embedderLocator; |
| 1783 |
| 1768 @override | 1784 @override |
| 1769 final String packageRoot; | 1785 final String packageRoot; |
| 1770 | 1786 |
| 1771 PackageMapDisposition(this.packageMap, {this.packageRoot}); | 1787 PackageMapDisposition(this.packageMap, {this.packageRoot}); |
| 1772 | 1788 |
| 1773 @override | 1789 @override |
| 1774 Packages get packages => null; | 1790 Packages get packages => null; |
| 1775 | 1791 |
| 1776 @override | 1792 @override |
| 1777 Iterable<UriResolver> createPackageUriResolvers( | 1793 Iterable<UriResolver> createPackageUriResolvers( |
| 1778 ResourceProvider resourceProvider) => | 1794 ResourceProvider resourceProvider) => |
| 1779 <UriResolver>[ | 1795 <UriResolver>[ |
| 1780 new SdkExtUriResolver(packageMap), | 1796 new SdkExtUriResolver(packageMap), |
| 1781 new PackageMapUriResolver(resourceProvider, packageMap) | 1797 new PackageMapUriResolver(resourceProvider, packageMap) |
| 1782 ]; | 1798 ]; |
| 1799 |
| 1800 @override |
| 1801 EmbedderYamlLocator getEmbedderLocator(ResourceProvider resourceProvider) { |
| 1802 if (_embedderLocator == null) { |
| 1803 _embedderLocator = new EmbedderYamlLocator(packageMap); |
| 1804 } |
| 1805 return _embedderLocator; |
| 1806 } |
| 1783 } | 1807 } |
| 1784 | 1808 |
| 1785 /** | 1809 /** |
| 1786 * Concrete [FolderDisposition] object indicating that the context for a given | 1810 * Concrete [FolderDisposition] object indicating that the context for a given |
| 1787 * folder should resolve packages using a ".packages" file. | 1811 * folder should resolve packages using a ".packages" file. |
| 1788 */ | 1812 */ |
| 1789 class PackagesFileDisposition extends FolderDisposition { | 1813 class PackagesFileDisposition extends FolderDisposition { |
| 1790 @override | 1814 @override |
| 1791 final Packages packages; | 1815 final Packages packages; |
| 1792 | 1816 |
| 1817 Map<String, List<Folder>> packageMap; |
| 1818 |
| 1819 EmbedderYamlLocator _embedderLocator; |
| 1820 |
| 1793 PackagesFileDisposition(this.packages); | 1821 PackagesFileDisposition(this.packages); |
| 1794 | 1822 |
| 1795 @override | 1823 @override |
| 1796 String get packageRoot => null; | 1824 String get packageRoot => null; |
| 1797 | 1825 |
| 1798 Map<String, List<Folder>> buildPackageMap(ResourceProvider resourceProvider) { | 1826 Map<String, List<Folder>> buildPackageMap(ResourceProvider resourceProvider) { |
| 1799 Map<String, List<Folder>> packageMap = <String, List<Folder>>{}; | 1827 if (packageMap == null) { |
| 1800 if (packages == null) { | 1828 packageMap = <String, List<Folder>>{}; |
| 1801 return packageMap; | 1829 if (packages != null) { |
| 1830 packages.asMap().forEach((String name, Uri uri) { |
| 1831 if (uri.scheme == 'file' || uri.scheme == '' /* unspecified */) { |
| 1832 var path = resourceProvider.pathContext.fromUri(uri); |
| 1833 packageMap[name] = <Folder>[resourceProvider.getFolder(path)]; |
| 1834 } |
| 1835 }); |
| 1836 } |
| 1802 } | 1837 } |
| 1803 packages.asMap().forEach((String name, Uri uri) { | |
| 1804 if (uri.scheme == 'file' || uri.scheme == '' /* unspecified */) { | |
| 1805 var path = resourceProvider.pathContext.fromUri(uri); | |
| 1806 packageMap[name] = <Folder>[resourceProvider.getFolder(path)]; | |
| 1807 } | |
| 1808 }); | |
| 1809 return packageMap; | 1838 return packageMap; |
| 1810 } | 1839 } |
| 1811 | 1840 |
| 1812 @override | 1841 @override |
| 1813 Iterable<UriResolver> createPackageUriResolvers( | 1842 Iterable<UriResolver> createPackageUriResolvers( |
| 1814 ResourceProvider resourceProvider) { | 1843 ResourceProvider resourceProvider) { |
| 1815 if (packages != null) { | 1844 if (packages != null) { |
| 1816 // Construct package map for the SdkExtUriResolver. | 1845 // Construct package map for the SdkExtUriResolver. |
| 1817 Map<String, List<Folder>> packageMap = buildPackageMap(resourceProvider); | 1846 Map<String, List<Folder>> packageMap = buildPackageMap(resourceProvider); |
| 1818 return <UriResolver>[new SdkExtUriResolver(packageMap)]; | 1847 return <UriResolver>[new SdkExtUriResolver(packageMap)]; |
| 1819 } else { | 1848 } else { |
| 1820 return const <UriResolver>[]; | 1849 return const <UriResolver>[]; |
| 1821 } | 1850 } |
| 1822 } | 1851 } |
| 1852 |
| 1853 @override |
| 1854 EmbedderYamlLocator getEmbedderLocator(ResourceProvider resourceProvider) { |
| 1855 if (_embedderLocator == null) { |
| 1856 _embedderLocator = |
| 1857 new EmbedderYamlLocator(buildPackageMap(resourceProvider)); |
| 1858 } |
| 1859 return _embedderLocator; |
| 1860 } |
| 1823 } | 1861 } |
| OLD | NEW |