Add more summary support to ContextBuilder

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2416243003 .
This commit is contained in:
Brian Wilkerson 2016-10-15 08:40:04 -07:00
parent 790b9d9cb1
commit 4f6f05273e

View file

@ -20,6 +20,7 @@ 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/summary/summary_sdk.dart';
import 'package:analyzer/src/task/options.dart';
import 'package:package_config/packages.dart';
import 'package:package_config/packages_file.dart';
@ -95,6 +96,13 @@ class ContextBuilder {
*/
String defaultPackagesDirectoryPath;
/**
* The file path of the file containing the summary of the SDK that should be
* used to "analyze" the SDK. This option should only be specified by
* command-line tools such as 'dartanalyzer' or 'ddc'.
*/
String dartSdkSummaryPath;
/**
* The file path of the analysis options file that should be used in place of
* any file in the root directory or a parent of the root directory, or `null`
@ -288,7 +296,9 @@ class ContextBuilder {
*/
DartSdk findSdk(
Map<String, List<Folder>> packageMap, AnalysisOptions options) {
if (packageMap != null) {
if (dartSdkSummaryPath != null) {
return new SummaryBasedDartSdk(dartSdkSummaryPath, options.strongMode);
} else if (packageMap != null) {
SdkExtensionFinder extFinder = new SdkExtensionFinder(packageMap);
List<String> extFilePaths = extFinder.extensionFilePaths;
EmbedderYamlLocator locator = new EmbedderYamlLocator(packageMap);