Chromium Code Reviews| Index: pkg/dev_compiler/lib/src/analyzer/context.dart |
| diff --git a/pkg/dev_compiler/lib/src/analyzer/context.dart b/pkg/dev_compiler/lib/src/analyzer/context.dart |
| index 188f9787624ef985c855d269d392cc837e6adad8..496ae800fdf03883953792226e605b00ed04798b 100644 |
| --- a/pkg/dev_compiler/lib/src/analyzer/context.dart |
| +++ b/pkg/dev_compiler/lib/src/analyzer/context.dart |
| @@ -32,6 +32,8 @@ class AnalyzerOptions { |
| /// List of summary file paths. |
| final List<String> summaryPaths; |
| + final Map<String, String> customSummaryModules = {}; |
|
vsm
2017/06/23 14:29:08
Perhaps combine these last two data structs into a
Bob Nystrom
2017/06/24 00:29:36
I like that idea, but I think it might require mov
|
| + |
| /// Path to the dart-sdk, or `null` if the path couldn't be determined. |
| final String dartSdkPath; |
| @@ -51,6 +53,7 @@ class AnalyzerOptions { |
| : dartSdkPath = dartSdkPath ?? getSdkDir().path, |
| summaryPaths = summaryPaths ?? const [] { |
| contextBuilderOptions.declaredVariables ??= const {}; |
| + _parseCustomSummaryModules(); |
| } |
| factory AnalyzerOptions.basic( |
| @@ -109,6 +112,24 @@ class AnalyzerOptions { |
| } |
| return mappings; |
| } |
| + |
| + /// A summary path can contain ":" followed by an explicit module name to |
| + /// allow working with summaries whose physical location is outside of the |
| + /// module root directory. |
| + /// |
| + /// Removes any explicit module names from [summaryPaths] and populates with |
| + /// [customSummaryModules] with them. |
| + void _parseCustomSummaryModules() { |
| + for (var i = 0; i < summaryPaths.length; i++) { |
| + var summaryPath = summaryPaths[i]; |
| + var comma = summaryPath.indexOf(":"); |
| + if (comma != -1) { |
| + summaryPaths[i] = summaryPath.substring(0, comma); |
| + customSummaryModules[summaryPaths[i]] = |
| + summaryPath.substring(comma + 1); |
| + } |
| + } |
| + } |
| } |
| /// Creates a SourceFactory configured by the [options]. |