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.bootloader; | 5 library analyzer_cli.src.bootloader; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:isolate'; | 8 import 'dart:isolate'; |
9 | 9 |
10 import 'package:analyzer/file_system/physical_file_system.dart'; | 10 import 'package:analyzer/file_system/physical_file_system.dart'; |
11 import 'package:analyzer/source/analysis_options_provider.dart'; | 11 import 'package:analyzer/source/analysis_options_provider.dart'; |
12 import 'package:analyzer/src/context/context.dart'; | 12 import 'package:analyzer/src/context/context.dart'; |
| 13 import 'package:analyzer/src/generated/engine.dart' as engine; |
13 import 'package:analyzer/src/plugin/plugin_configuration.dart'; | 14 import 'package:analyzer/src/plugin/plugin_configuration.dart'; |
14 import 'package:analyzer_cli/src/driver.dart'; | 15 import 'package:analyzer_cli/src/driver.dart'; |
15 import 'package:analyzer_cli/src/options.dart'; | 16 import 'package:analyzer_cli/src/options.dart'; |
16 import 'package:source_span/source_span.dart'; | 17 import 'package:source_span/source_span.dart'; |
17 import 'package:yaml/src/yaml_node.dart'; | 18 import 'package:yaml/src/yaml_node.dart'; |
18 | 19 |
19 const _analyzerPackageName = 'analyzer'; | 20 const _analyzerPackageName = 'analyzer'; |
20 | 21 |
21 /// Return non-null if there is a validation issue with this plugin. | 22 /// Return non-null if there is a validation issue with this plugin. |
22 String validate(PluginInfo plugin) { | 23 String validate(PluginInfo plugin) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // Process analysis options file (and notify all interested parties). | 121 // Process analysis options file (and notify all interested parties). |
121 _processAnalysisOptions(options); | 122 _processAnalysisOptions(options); |
122 | 123 |
123 // TODO(pquitslund): Pass in .packages info | 124 // TODO(pquitslund): Pass in .packages info |
124 return new Image(_pluginOptionsProcessor.config, | 125 return new Image(_pluginOptionsProcessor.config, |
125 args: args, packageRootPath: options.packageRootPath); | 126 args: args, packageRootPath: options.packageRootPath); |
126 } | 127 } |
127 | 128 |
128 void _processAnalysisOptions(CommandLineOptions options) { | 129 void _processAnalysisOptions(CommandLineOptions options) { |
129 // Determine options file path. | 130 // Determine options file path. |
130 var filePath = options.analysisOptionsFile != null | 131 var filePath = options.analysisOptionsFile ?? |
131 ? options.analysisOptionsFile | 132 engine.AnalysisEngine.ANALYSIS_OPTIONS_FILE; |
132 : AnalysisOptionsProvider.ANALYSIS_OPTIONS_NAME; | |
133 try { | 133 try { |
134 var file = PhysicalResourceProvider.INSTANCE.getFile(filePath); | 134 var file = PhysicalResourceProvider.INSTANCE.getFile(filePath); |
135 AnalysisOptionsProvider analysisOptionsProvider = | 135 AnalysisOptionsProvider analysisOptionsProvider = |
136 new AnalysisOptionsProvider(); | 136 new AnalysisOptionsProvider(); |
137 Map<String, YamlNode> options = | 137 Map<String, YamlNode> options = |
138 analysisOptionsProvider.getOptionsFromFile(file); | 138 analysisOptionsProvider.getOptionsFromFile(file); |
139 //TODO(pq): thread in proper context. | 139 //TODO(pq): thread in proper context. |
140 var temporaryContext = new AnalysisContextImpl(); | 140 var temporaryContext = new AnalysisContextImpl(); |
141 _pluginOptionsProcessor.optionsProcessed(temporaryContext, options); | 141 _pluginOptionsProcessor.optionsProcessed(temporaryContext, options); |
142 } on Exception catch (e) { | 142 } on Exception catch (e) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 String packageRoot = | 187 String packageRoot = |
188 packageRootPath != null ? packageRootPath : './packages'; | 188 packageRootPath != null ? packageRootPath : './packages'; |
189 Uri packageUri = new Uri.file(packageRoot); | 189 Uri packageUri = new Uri.file(packageRoot); |
190 | 190 |
191 Isolate.spawnUri(uri, args, null /* msg */, | 191 Isolate.spawnUri(uri, args, null /* msg */, |
192 packageRoot: packageUri, onExit: exitListener.sendPort); | 192 packageRoot: packageUri, onExit: exitListener.sendPort); |
193 | 193 |
194 return completer.future; | 194 return completer.future; |
195 } | 195 } |
196 } | 196 } |
OLD | NEW |