Chromium Code Reviews| Index: pkg/analyzer_cli/lib/src/driver.dart |
| diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart |
| index b16b78780bdbc9b1e9cbaba98615834fd4fcbde4..2593aef1c77783cc7f187ff5371d7c7d1ef9f153 100644 |
| --- a/pkg/analyzer_cli/lib/src/driver.dart |
| +++ b/pkg/analyzer_cli/lib/src/driver.dart |
| @@ -32,6 +32,7 @@ import 'package:analyzer/src/generated/utilities_general.dart' |
| show PerformanceTag; |
| import 'package:analyzer/src/services/lint.dart'; |
| import 'package:analyzer/src/source/source_resource.dart'; |
| +import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
| import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk; |
| import 'package:analyzer/src/task/options.dart'; |
| import 'package:analyzer_cli/src/analyzer_impl.dart'; |
| @@ -78,7 +79,7 @@ class Driver implements CommandLineStarter { |
| /// The context that was most recently created by a call to [_analyzeAll], or |
| /// `null` if [_analyzeAll] hasn't been called yet. |
| - AnalysisContext _context; |
| + InternalAnalysisContext _context; |
| /// The total number of source files loaded by an AnalysisContext. |
| int _analyzedFileCount = 0; |
| @@ -314,6 +315,10 @@ class Driver implements CommandLineStarter { |
| if (options.incrementalCachePath != _previousOptions.incrementalCachePath) { |
| return false; |
| } |
| + if (!_equalLists( |
| + options.buildSummaryInputs, _previousOptions.buildSummaryInputs)) { |
| + return false; |
| + } |
| return true; |
| } |
| @@ -347,8 +352,11 @@ class Driver implements CommandLineStarter { |
| /// Decide on the appropriate method for resolving URIs based on the given |
| /// [options] and [customUrlMappings] settings, and return a |
| /// [SourceFactory] that has been configured accordingly. |
| - SourceFactory _chooseUriResolutionPolicy(CommandLineOptions options, |
| - Map<file_system.Folder, YamlMap> embedderMap, _PackageInfo packageInfo) { |
| + SourceFactory _chooseUriResolutionPolicy( |
| + CommandLineOptions options, |
| + Map<file_system.Folder, YamlMap> embedderMap, |
| + _PackageInfo packageInfo, |
| + SummaryDataStore summaryDataStore) { |
| // Create a custom package resolver if one has been specified. |
| if (packageResolverProvider != null) { |
| file_system.Folder folder = resourceProvider.getResource('.'); |
| @@ -359,6 +367,7 @@ class Driver implements CommandLineStarter { |
| // TODO(brianwilkerson) This doesn't handle sdk extensions. |
| List<UriResolver> resolvers = <UriResolver>[ |
| sdkResolver, |
| + new InSummaryUriResolver(resourceProvider, summaryDataStore), |
| resolver, |
| new file_system.ResourceUriResolver(resourceProvider) |
| ]; |
| @@ -417,6 +426,9 @@ class Driver implements CommandLineStarter { |
| resolvers.add(new SdkExtUriResolver(packageInfo.packageMap)); |
| } |
| + // Then package URIs from summaries. |
| + resolvers.add(new InSummaryUriResolver(resourceProvider, summaryDataStore)); |
| + |
| // Then package URIs. |
| if (packageUriResolver != null) { |
| resolvers.add(packageUriResolver); |
| @@ -505,15 +517,26 @@ class Driver implements CommandLineStarter { |
| // No summaries in the presence of embedders or extenders. |
| bool useSummaries = embedderMap.isEmpty && !hasSdkExt; |
| + if (!useSummaries && options.buildSummaryInputs.isNotEmpty) { |
| + throw new _DriverError( |
| + 'Summaries are not supported in this configuration'); |
|
Brian Wilkerson
2016/09/16 19:27:30
Could we be more specific? Maybe something like
S
Paul Berry
2016/09/16 21:50:14
Done.
|
| + } |
| + |
| + // Read any input summaries. |
| + SummaryDataStore summaryDataStore = new SummaryDataStore( |
| + useSummaries ? options.buildSummaryInputs : <String>[]); |
| + |
| // Once options and embedders are processed, setup the SDK. |
| _setupSdk(options, useSummaries); |
| // Choose a package resolution policy and a diet parsing policy based on |
| // the command-line options. |
| - SourceFactory sourceFactory = |
| - _chooseUriResolutionPolicy(options, embedderMap, packageInfo); |
| + SourceFactory sourceFactory = _chooseUriResolutionPolicy( |
| + options, embedderMap, packageInfo, summaryDataStore); |
| _context.sourceFactory = sourceFactory; |
| + _context.resultProvider = |
| + new InputPackagesResultProvider(_context, summaryDataStore); |
| incrementalSession = configureIncrementalAnalysis(options, context); |
| } |
| @@ -693,6 +716,19 @@ class Driver implements CommandLineStarter { |
| _processAnalysisOptions(resourceProvider, context, options); |
| } |
| + /// Perform a deep comparison of two string lists. |
| + static bool _equalLists(List<String> l1, List<String> l2) { |
| + if (l1.length != l2.length) { |
| + return false; |
| + } |
| + for (int i = 0; i < l1.length; i++) { |
| + if (l1[i] != l2[i]) { |
| + return false; |
| + } |
| + } |
| + return true; |
| + } |
| + |
| /// Perform a deep comparison of two string maps. |
| static bool _equalMaps(Map<String, String> m1, Map<String, String> m2) { |
| if (m1.length != m2.length) { |