Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: pkg/analyzer/lib/src/context/builder.dart

Issue 2380573006: ContextBuilder can configure contexts to use summaries (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698