From 4f6f05273e2f9f569d63eef057d849d6b8d47ae3 Mon Sep 17 00:00:00 2001 From: Brian Wilkerson Date: Sat, 15 Oct 2016 08:40:04 -0700 Subject: [PATCH] Add more summary support to ContextBuilder R=scheglov@google.com Review URL: https://codereview.chromium.org/2416243003 . --- pkg/analyzer/lib/src/context/builder.dart | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart index bef683755c5..882094f350c 100644 --- a/pkg/analyzer/lib/src/context/builder.dart +++ b/pkg/analyzer/lib/src/context/builder.dart @@ -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> 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 extFilePaths = extFinder.extensionFilePaths; EmbedderYamlLocator locator = new EmbedderYamlLocator(packageMap);