| 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'; | 10 import 'dart:core'; |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 List<String> excludeList = toStringList(exclude); | 709 List<String> excludeList = toStringList(exclude); |
| 710 if (excludeList != null) { | 710 if (excludeList != null) { |
| 711 setIgnorePatternsForContext(info, excludeList); | 711 setIgnorePatternsForContext(info, excludeList); |
| 712 } | 712 } |
| 713 } | 713 } |
| 714 } | 714 } |
| 715 | 715 |
| 716 /** | 716 /** |
| 717 * Process [options] for the given context [info]. | 717 * Process [options] for the given context [info]. |
| 718 */ | 718 */ |
| 719 void processOptionsForDriver(ContextInfo info, Map<String, Object> options) { | 719 void processOptionsForDriver(ContextInfo info, |
| 720 AnalysisOptionsImpl analysisOptions, Map<String, Object> options) { |
| 720 if (options == null) { | 721 if (options == null) { |
| 721 return; | 722 return; |
| 722 } | 723 } |
| 723 AnalysisOptionsImpl analysisOptions = info.analysisDriver.analysisOptions; | |
| 724 | 724 |
| 725 // Check for embedded options. | 725 // Check for embedded options. |
| 726 Map embeddedOptions = _getEmbeddedOptions(info); | 726 Map embeddedOptions = _getEmbeddedOptions(info); |
| 727 if (embeddedOptions != null) { | 727 if (embeddedOptions != null) { |
| 728 options = _toStringMap(new Merger().merge(embeddedOptions, options)); | 728 options = _toStringMap(new Merger().merge(embeddedOptions, options)); |
| 729 } | 729 } |
| 730 | 730 |
| 731 applyToAnalysisOptions(analysisOptions, options); | 731 applyToAnalysisOptions(analysisOptions, options); |
| 732 | 732 |
| 733 var analyzer = options[AnalyzerOptions.analyzer]; | 733 var analyzer = options[AnalyzerOptions.analyzer]; |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 normalizedPackageRoots[folder.path], disposition); | 1158 normalizedPackageRoots[folder.path], disposition); |
| 1159 | 1159 |
| 1160 Map<String, Object> optionMap = | 1160 Map<String, Object> optionMap = |
| 1161 readOptions(info.folder, disposition.packages); | 1161 readOptions(info.folder, disposition.packages); |
| 1162 AnalysisOptions options = | 1162 AnalysisOptions options = |
| 1163 new AnalysisOptionsImpl.from(defaultContextOptions); | 1163 new AnalysisOptionsImpl.from(defaultContextOptions); |
| 1164 applyToAnalysisOptions(options, optionMap); | 1164 applyToAnalysisOptions(options, optionMap); |
| 1165 | 1165 |
| 1166 info.setDependencies(dependencies); | 1166 info.setDependencies(dependencies); |
| 1167 if (enableNewAnalysisDriver) { | 1167 if (enableNewAnalysisDriver) { |
| 1168 processOptionsForDriver(info, options, optionMap); |
| 1168 info.analysisDriver = callbacks.addAnalysisDriver(folder, options); | 1169 info.analysisDriver = callbacks.addAnalysisDriver(folder, options); |
| 1169 } else { | 1170 } else { |
| 1170 info.context = callbacks.addContext(folder, options); | 1171 info.context = callbacks.addContext(folder, options); |
| 1171 _folderMap[folder] = info.context; | 1172 _folderMap[folder] = info.context; |
| 1172 info.context.name = folder.path; | 1173 info.context.name = folder.path; |
| 1173 } | |
| 1174 | |
| 1175 // Look for pubspec-specified analysis configuration. | |
| 1176 File pubspec; | |
| 1177 if (packagespecFile?.exists == true) { | |
| 1178 if (packagespecFile.shortName == PUBSPEC_NAME) { | |
| 1179 pubspec = packagespecFile; | |
| 1180 } | |
| 1181 } | |
| 1182 if (pubspec == null) { | |
| 1183 Resource child = folder.getChild(PUBSPEC_NAME); | |
| 1184 if (child.exists && child is File) { | |
| 1185 pubspec = child; | |
| 1186 } | |
| 1187 } | |
| 1188 | |
| 1189 if (enableNewAnalysisDriver) { | |
| 1190 processOptionsForDriver(info, optionMap); | |
| 1191 } else { | |
| 1192 processOptionsForContext(info, optionMap); | 1174 processOptionsForContext(info, optionMap); |
| 1193 } | 1175 } |
| 1194 | 1176 |
| 1195 return info; | 1177 return info; |
| 1196 } | 1178 } |
| 1197 | 1179 |
| 1198 /** | 1180 /** |
| 1199 * Potentially create a new context associated with the given [folder]. | 1181 * Potentially create a new context associated with the given [folder]. |
| 1200 * | 1182 * |
| 1201 * If there are subfolders with 'pubspec.yaml' files, separate contexts are | 1183 * If there are subfolders with 'pubspec.yaml' files, separate contexts are |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1957 } | 1939 } |
| 1958 return _embedderLocator; | 1940 return _embedderLocator; |
| 1959 } | 1941 } |
| 1960 | 1942 |
| 1961 @override | 1943 @override |
| 1962 SdkExtensionFinder getSdkExtensionFinder(ResourceProvider resourceProvider) { | 1944 SdkExtensionFinder getSdkExtensionFinder(ResourceProvider resourceProvider) { |
| 1963 return _sdkExtensionFinder ??= | 1945 return _sdkExtensionFinder ??= |
| 1964 new SdkExtensionFinder(buildPackageMap(resourceProvider)); | 1946 new SdkExtensionFinder(buildPackageMap(resourceProvider)); |
| 1965 } | 1947 } |
| 1966 } | 1948 } |
| OLD | NEW |