| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer_cli.src.build_mode; | 5 library analyzer_cli.src.build_mode; |
| 6 | 6 |
| 7 import 'dart:core' hide Resource; | 7 import 'dart:core' hide Resource; |
| 8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 return maxSeverity; | 124 return maxSeverity; |
| 125 } | 125 } |
| 126 | 126 |
| 127 void _createContext() { | 127 void _createContext() { |
| 128 DirectoryBasedDartSdk sdk = | 128 DirectoryBasedDartSdk sdk = |
| 129 new DirectoryBasedDartSdk(new JavaFile(options.dartSdkPath)); | 129 new DirectoryBasedDartSdk(new JavaFile(options.dartSdkPath)); |
| 130 sdk.analysisOptions = |
| 131 Driver.createAnalysisOptionsForCommandLineOptions(options); |
| 132 sdk.useSummary = true; |
| 130 | 133 |
| 131 // Read the summaries. | 134 // Read the summaries. |
| 132 SummaryDataStore summaryDataStore = | 135 SummaryDataStore summaryDataStore = |
| 133 new SummaryDataStore(options.buildSummaryInputs); | 136 new SummaryDataStore(options.buildSummaryInputs); |
| 134 | 137 |
| 135 // Create the context. | 138 // Create the context. |
| 136 context = AnalysisEngine.instance.createAnalysisContext(); | 139 context = AnalysisEngine.instance.createAnalysisContext(); |
| 137 context.sourceFactory = new SourceFactory(<UriResolver>[ | 140 context.sourceFactory = new SourceFactory(<UriResolver>[ |
| 138 new DartUriResolver(sdk), | 141 new DartUriResolver(sdk), |
| 139 new InSummaryPackageUriResolver(summaryDataStore), | 142 new InSummaryPackageUriResolver(summaryDataStore), |
| 140 new ExplicitSourceResolver(uriToFileMap) | 143 new ExplicitSourceResolver(uriToFileMap) |
| 141 ]); | 144 ]); |
| 142 | 145 |
| 143 // Set context options. | 146 // Set context options. |
| 144 Driver.setAnalysisContextOptions( | 147 Driver.setAnalysisContextOptions( |
| 145 context, options, (AnalysisOptionsImpl contextOptions) {}); | 148 context, options, (AnalysisOptionsImpl contextOptions) {}); |
| 146 | 149 |
| 147 // Configure using summaries. | 150 // Configure using summaries. |
| 148 sdk.useSummary = true; | |
| 149 context.typeProvider = sdk.context.typeProvider; | 151 context.typeProvider = sdk.context.typeProvider; |
| 150 context.resultProvider = | 152 context.resultProvider = |
| 151 new InputPackagesResultProvider(context, summaryDataStore); | 153 new InputPackagesResultProvider(context, summaryDataStore); |
| 152 } | 154 } |
| 153 | 155 |
| 154 /** | 156 /** |
| 155 * Print errors for all explicit sources. If [outputPath] is supplied, output | 157 * Print errors for all explicit sources. If [outputPath] is supplied, output |
| 156 * is sent to a new file at that path. | 158 * is sent to a new file at that path. |
| 157 */ | 159 */ |
| 158 void _printErrors({String outputPath}) { | 160 void _printErrors({String outputPath}) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 'Illegal input file (must be "\$uri|\$path"): $sourceFile'); | 195 'Illegal input file (must be "\$uri|\$path"): $sourceFile'); |
| 194 return null; | 196 return null; |
| 195 } | 197 } |
| 196 Uri uri = Uri.parse(sourceFile.substring(0, pipeIndex)); | 198 Uri uri = Uri.parse(sourceFile.substring(0, pipeIndex)); |
| 197 String path = sourceFile.substring(pipeIndex + 1); | 199 String path = sourceFile.substring(pipeIndex + 1); |
| 198 uriToFileMap[uri] = new JavaFile(path); | 200 uriToFileMap[uri] = new JavaFile(path); |
| 199 } | 201 } |
| 200 return uriToFileMap; | 202 return uriToFileMap; |
| 201 } | 203 } |
| 202 } | 204 } |
| OLD | NEW |