Index: pkg/kernel/lib/analyzer/loader.dart |
diff --git a/pkg/kernel/lib/analyzer/loader.dart b/pkg/kernel/lib/analyzer/loader.dart |
index ae169260ea99300157ce6e8bd8f436305648dfc9..b007d9fa33f723eb7defeeea09f3ff9f7f32fed9 100644 |
--- a/pkg/kernel/lib/analyzer/loader.dart |
+++ b/pkg/kernel/lib/analyzer/loader.dart |
@@ -16,6 +16,7 @@ import 'package:analyzer/src/generated/engine.dart'; |
import 'package:analyzer/src/generated/parser.dart'; |
import 'package:analyzer/src/generated/sdk.dart'; |
import 'package:analyzer/src/generated/source_io.dart'; |
+import 'package:analyzer/src/summary/summary_sdk.dart'; |
import 'package:kernel/application_root.dart'; |
import 'package:package_config/discovery.dart'; |
import 'package:package_config/packages.dart'; |
@@ -34,16 +35,29 @@ class DartOptions { |
/// True if the Dart SDK should be loaded in strong mode. |
bool strongModeSdk; |
+ |
+ /// Path to the sdk sources, ignored if sdkSummary is provided. |
String sdk; |
+ |
+ /// Path to a summary of the sdk sources. |
+ String sdkSummary; |
+ |
+ /// Path to the `.packages` file. |
String packagePath; |
+ |
+ /// Root used to relativize app file-urls, making them machine agnostic. |
ApplicationRoot applicationRoot; |
+ |
Map<Uri, Uri> customUriMappings; |
+ |
+ /// Environment definitions provided via `-Dkey=value`. |
Map<String, String> declaredVariables; |
DartOptions( |
{bool strongMode: false, |
bool strongModeSdk, |
this.sdk, |
+ this.sdkSummary, |
this.packagePath, |
ApplicationRoot applicationRoot, |
Map<Uri, Uri> customUriMappings, |
@@ -763,7 +777,10 @@ AnalysisOptions createAnalysisOptions(bool strongMode) { |
..enableSuperMixins = true; |
} |
-DartSdk createDartSdk(String path, {bool strongMode}) { |
+DartSdk createDartSdk(String path, {bool strongMode, bool isSummary}) { |
+ if (isSummary) { |
+ return new SummaryBasedDartSdk(path, strongMode); |
+ } |
var resources = PhysicalResourceProvider.INSTANCE; |
return new FolderBasedDartSdk(resources, resources.getFolder(path)) |
..context |
@@ -806,7 +823,9 @@ class CustomUriResolver extends UriResolver { |
AnalysisContext createContext(DartOptions options, Packages packages, |
{DartSdk dartSdk}) { |
- dartSdk ??= createDartSdk(options.sdk, strongMode: options.strongModeSdk); |
+ bool fromSummary = options.sdkSummary != null; |
+ dartSdk ??= createDartSdk(fromSummary ? options.sdkSummary : options.sdk, |
+ strongMode: options.strongModeSdk, isSummary: fromSummary); |
var resourceProvider = PhysicalResourceProvider.INSTANCE; |
var resourceUriResolver = new ResourceUriResolver(resourceProvider); |