Index: pkg/analyzer/lib/src/context/builder.dart |
diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart |
index e72f33395bf863bb2dd7241a67b1fae5e8b808fa..02e1237a2eae93b76517e3a6970c256812e3c5be 100644 |
--- a/pkg/analyzer/lib/src/context/builder.dart |
+++ b/pkg/analyzer/lib/src/context/builder.dart |
@@ -17,6 +17,8 @@ import 'package:analyzer/src/dart/sdk/sdk.dart'; |
import 'package:analyzer/src/generated/engine.dart'; |
import 'package:analyzer/src/generated/sdk.dart'; |
import 'package:analyzer/src/generated/source.dart'; |
+import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
+import 'package:analyzer/src/summary/pub_summary.dart'; |
import 'package:analyzer/src/task/options.dart'; |
import 'package:package_config/packages.dart'; |
import 'package:package_config/packages_file.dart'; |
@@ -111,6 +113,11 @@ class ContextBuilder { |
Map<String, String> declaredVariables; |
/** |
+ * The manager of pub package summaries. |
+ */ |
+ PubSummaryManager pubSummaryManager; |
+ |
+ /** |
* Initialize a newly created builder to be ready to build a context rooted in |
* the directory with the given [rootDirectoryPath]. |
*/ |
@@ -132,9 +139,29 @@ class ContextBuilder { |
context.name = path; |
//_processAnalysisOptions(context, optionMap); |
declareVariables(context); |
+ configureSummaries(context); |
return context; |
} |
+ /** |
+ * Configure the context to make use of summaries. |
+ */ |
+ void configureSummaries(InternalAnalysisContext context) { |
+ if (pubSummaryManager != null) { |
+ List<LinkedPubPackage> linkedBundles = |
+ pubSummaryManager.getLinkedBundles(context); |
+ if (linkedBundles.isNotEmpty) { |
+ SummaryDataStore store = new SummaryDataStore([]); |
+ for (LinkedPubPackage package in linkedBundles) { |
+ store.addBundle(null, package.unlinked); |
+ store.addBundle(null, package.linked); |
+ } |
+ context.resultProvider = |
+ new InputPackagesResultProvider(context, store); |
+ } |
+ } |
+ } |
+ |
Map<String, List<Folder>> convertPackagesToMap(Packages packages) { |
Map<String, List<Folder>> folderMap = new HashMap<String, List<Folder>>(); |
if (packages != null && packages != Packages.noPackages) { |