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

Side by Side Diff: pkg/analyzer/lib/src/context/builder.dart

Issue 2698133002: Remove PubSummaryManager. (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 analyzer.src.context.context_builder; 5 library analyzer.src.context.context_builder;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:core'; 8 import 'dart:core';
9 9
10 import 'package:analyzer/context/declared_variables.dart'; 10 import 'package:analyzer/context/declared_variables.dart';
11 import 'package:analyzer/file_system/file_system.dart'; 11 import 'package:analyzer/file_system/file_system.dart';
12 import 'package:analyzer/plugin/resolver_provider.dart'; 12 import 'package:analyzer/plugin/resolver_provider.dart';
13 import 'package:analyzer/source/analysis_options_provider.dart'; 13 import 'package:analyzer/source/analysis_options_provider.dart';
14 import 'package:analyzer/source/package_map_resolver.dart'; 14 import 'package:analyzer/source/package_map_resolver.dart';
15 import 'package:analyzer/src/command_line/arguments.dart' 15 import 'package:analyzer/src/command_line/arguments.dart'
16 show applyAnalysisOptionFlags; 16 show applyAnalysisOptionFlags;
17 import 'package:analyzer/src/dart/analysis/byte_store.dart'; 17 import 'package:analyzer/src/dart/analysis/byte_store.dart';
18 import 'package:analyzer/src/dart/analysis/driver.dart' 18 import 'package:analyzer/src/dart/analysis/driver.dart'
19 show AnalysisDriver, AnalysisDriverScheduler, PerformanceLog; 19 show AnalysisDriver, AnalysisDriverScheduler, PerformanceLog;
20 import 'package:analyzer/src/dart/analysis/file_state.dart'; 20 import 'package:analyzer/src/dart/analysis/file_state.dart';
21 import 'package:analyzer/src/dart/sdk/sdk.dart'; 21 import 'package:analyzer/src/dart/sdk/sdk.dart';
22 import 'package:analyzer/src/generated/bazel.dart'; 22 import 'package:analyzer/src/generated/bazel.dart';
23 import 'package:analyzer/src/generated/engine.dart'; 23 import 'package:analyzer/src/generated/engine.dart';
24 import 'package:analyzer/src/generated/gn.dart'; 24 import 'package:analyzer/src/generated/gn.dart';
25 import 'package:analyzer/src/generated/sdk.dart'; 25 import 'package:analyzer/src/generated/sdk.dart';
26 import 'package:analyzer/src/generated/source.dart'; 26 import 'package:analyzer/src/generated/source.dart';
27 import 'package:analyzer/src/generated/workspace.dart'; 27 import 'package:analyzer/src/generated/workspace.dart';
28 import 'package:analyzer/src/summary/package_bundle_reader.dart';
29 import 'package:analyzer/src/summary/pub_summary.dart';
30 import 'package:analyzer/src/summary/summary_sdk.dart'; 28 import 'package:analyzer/src/summary/summary_sdk.dart';
31 import 'package:analyzer/src/task/options.dart'; 29 import 'package:analyzer/src/task/options.dart';
32 import 'package:args/args.dart'; 30 import 'package:args/args.dart';
33 import 'package:package_config/packages.dart'; 31 import 'package:package_config/packages.dart';
34 import 'package:package_config/packages_file.dart'; 32 import 'package:package_config/packages_file.dart';
35 import 'package:package_config/src/packages_impl.dart'; 33 import 'package:package_config/src/packages_impl.dart';
36 import 'package:path/src/context.dart'; 34 import 'package:path/src/context.dart';
37 import 'package:yaml/yaml.dart'; 35 import 'package:yaml/yaml.dart';
38 36
39 /** 37 /**
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 AnalysisContext buildContext(String path) { 131 AnalysisContext buildContext(String path) {
134 InternalAnalysisContext context = 132 InternalAnalysisContext context =
135 AnalysisEngine.instance.createAnalysisContext(); 133 AnalysisEngine.instance.createAnalysisContext();
136 AnalysisOptions options = getAnalysisOptions(path); 134 AnalysisOptions options = getAnalysisOptions(path);
137 context.contentCache = contentCache; 135 context.contentCache = contentCache;
138 context.sourceFactory = createSourceFactory(path, options); 136 context.sourceFactory = createSourceFactory(path, options);
139 context.analysisOptions = options; 137 context.analysisOptions = options;
140 context.name = path; 138 context.name = path;
141 //_processAnalysisOptions(context, optionMap); 139 //_processAnalysisOptions(context, optionMap);
142 declareVariables(context); 140 declareVariables(context);
143 configureSummaries(context);
144 return context; 141 return context;
145 } 142 }
146 143
147 /** 144 /**
148 * Return an analysis driver that is configured correctly to analyze code in 145 * Return an analysis driver that is configured correctly to analyze code in
149 * the directory with the given [path]. 146 * the directory with the given [path].
150 */ 147 */
151 AnalysisDriver buildDriver(String path) { 148 AnalysisDriver buildDriver(String path) {
152 AnalysisOptions options = getAnalysisOptions(path); 149 AnalysisOptions options = getAnalysisOptions(path);
153 //_processAnalysisOptions(context, optionMap); 150 //_processAnalysisOptions(context, optionMap);
154 AnalysisDriver driver = new AnalysisDriver( 151 AnalysisDriver driver = new AnalysisDriver(
155 analysisDriverScheduler, 152 analysisDriverScheduler,
156 performanceLog, 153 performanceLog,
157 resourceProvider, 154 resourceProvider,
158 byteStore, 155 byteStore,
159 fileContentOverlay, 156 fileContentOverlay,
160 path, 157 path,
161 createSourceFactory(path, options), 158 createSourceFactory(path, options),
162 options); 159 options);
163 declareVariablesInDriver(driver); 160 declareVariablesInDriver(driver);
164 return driver; 161 return driver;
165 } 162 }
166 163
167 /**
168 * Configure the context to make use of summaries.
169 */
170 void configureSummaries(InternalAnalysisContext context) {
171 PubSummaryManager manager = builderOptions.pubSummaryManager;
172 if (manager != null) {
173 List<LinkedPubPackage> linkedBundles = manager.getLinkedBundles(context);
174 if (linkedBundles.isNotEmpty) {
175 SummaryDataStore store = new SummaryDataStore([]);
176 for (LinkedPubPackage package in linkedBundles) {
177 store.addBundle(null, package.unlinked);
178 store.addBundle(null, package.linked);
179 }
180 context.resultProvider =
181 new InputPackagesResultProvider(context, store);
182 }
183 }
184 }
185
186 Map<String, List<Folder>> convertPackagesToMap(Packages packages) { 164 Map<String, List<Folder>> convertPackagesToMap(Packages packages) {
187 Map<String, List<Folder>> folderMap = new HashMap<String, List<Folder>>(); 165 Map<String, List<Folder>> folderMap = new HashMap<String, List<Folder>>();
188 if (packages != null && packages != Packages.noPackages) { 166 if (packages != null && packages != Packages.noPackages) {
189 packages.asMap().forEach((String packageName, Uri uri) { 167 packages.asMap().forEach((String packageName, Uri uri) {
190 String path = resourceProvider.pathContext.fromUri(uri); 168 String path = resourceProvider.pathContext.fromUri(uri);
191 folderMap[packageName] = [resourceProvider.getFolder(path)]; 169 folderMap[packageName] = [resourceProvider.getFolder(path)];
192 }); 170 });
193 } 171 }
194 return folderMap; 172 return folderMap;
195 } 173 }
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 String defaultPackageFilePath; 599 String defaultPackageFilePath;
622 600
623 /** 601 /**
624 * The file path of the packages directory that should be used in place of any 602 * The file path of the packages directory that should be used in place of any
625 * file found using the normal (Package Specification DEP) lookup mechanism, 603 * file found using the normal (Package Specification DEP) lookup mechanism,
626 * or `null` if the normal lookup mechanism should be used. 604 * or `null` if the normal lookup mechanism should be used.
627 */ 605 */
628 String defaultPackagesDirectoryPath; 606 String defaultPackagesDirectoryPath;
629 607
630 /** 608 /**
631 * The manager of pub package summaries.
632 */
633 PubSummaryManager pubSummaryManager;
634
635 /**
636 * Initialize a newly created set of options 609 * Initialize a newly created set of options
637 */ 610 */
638 ContextBuilderOptions(); 611 ContextBuilderOptions();
639 } 612 }
640 613
641 /** 614 /**
642 * Given a package map, check in each package's lib directory for the existence 615 * Given a package map, check in each package's lib directory for the existence
643 * of an `_embedder.yaml` file. If the file contains a top level YamlMap, it 616 * of an `_embedder.yaml` file. If the file contains a top level YamlMap, it
644 * will be added to the [embedderYamls] map. 617 * will be added to the [embedderYamls] map.
645 */ 618 */
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 } 760 }
788 761
789 /** 762 /**
790 * Find the basic workspace that contains the given [path]. 763 * Find the basic workspace that contains the given [path].
791 */ 764 */
792 static _BasicWorkspace find( 765 static _BasicWorkspace find(
793 ResourceProvider resourceProvider, String path, ContextBuilder builder) { 766 ResourceProvider resourceProvider, String path, ContextBuilder builder) {
794 return new _BasicWorkspace._(resourceProvider, path, builder); 767 return new _BasicWorkspace._(resourceProvider, path, builder);
795 } 768 }
796 } 769 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/server/driver.dart ('k') | pkg/analyzer/lib/src/summary/pub_summary.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698