Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: lib/src/driver.dart

Issue 1378193004: Fix Analysis Engine plugin setup. (Closed) Base URL: https://github.com/dart-lang/analyzer_cli.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/driver_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.driver; 5 library analyzer_cli.src.driver;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 return; 361 return;
362 } 362 }
363 _previousOptions = options; 363 _previousOptions = options;
364 // Choose a package resolution policy and a diet parsing policy based on 364 // Choose a package resolution policy and a diet parsing policy based on
365 // the command-line options. 365 // the command-line options.
366 SourceFactory sourceFactory = _chooseUriResolutionPolicy(options); 366 SourceFactory sourceFactory = _chooseUriResolutionPolicy(options);
367 AnalyzeFunctionBodiesPredicate dietParsingPolicy = 367 AnalyzeFunctionBodiesPredicate dietParsingPolicy =
368 _chooseDietParsingPolicy(options); 368 _chooseDietParsingPolicy(options);
369 // Create a context using these policies. 369 // Create a context using these policies.
370 AnalysisContext context = AnalysisEngine.instance.createAnalysisContext(); 370 AnalysisContext context = AnalysisEngine.instance.createAnalysisContext();
371
371 context.sourceFactory = sourceFactory; 372 context.sourceFactory = sourceFactory;
372 373
373 if (options.strongMode) { 374 if (options.strongMode) {
374 // TODO(jmesserly): support options file 375 // TODO(jmesserly): support options file
375 var strongOptions = new StrongModeOptions(hints: options.strongHints); 376 var strongOptions = new StrongModeOptions(hints: options.strongHints);
376 // TODO(jmesserly): make StrongChecker an analysis plugin 377 // TODO(jmesserly): make StrongChecker an analysis plugin
377 _strongChecker = new StrongChecker(context, strongOptions); 378 _strongChecker = new StrongChecker(context, strongOptions);
378 } 379 }
379 380
380 Map<String, String> definedVariables = options.definedVariables; 381 Map<String, String> definedVariables = options.definedVariables;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 optionsProcessors 449 optionsProcessors
449 .forEach((OptionsProcessor p) => p.optionsProcessed(options)); 450 .forEach((OptionsProcessor p) => p.optionsProcessed(options));
450 } on Exception catch (e) { 451 } on Exception catch (e) {
451 optionsProcessors.forEach((OptionsProcessor p) => p.onError(e)); 452 optionsProcessors.forEach((OptionsProcessor p) => p.onError(e));
452 } 453 }
453 } 454 }
454 455
455 void _processPlugins() { 456 void _processPlugins() {
456 List<Plugin> plugins = <Plugin>[]; 457 List<Plugin> plugins = <Plugin>[];
457 plugins.add(linterPlugin); 458 plugins.add(linterPlugin);
458 plugins.addAll(AnalysisEngine.instance.supportedPlugins);
459 plugins.addAll(_userDefinedPlugins); 459 plugins.addAll(_userDefinedPlugins);
460 ExtensionManager manager = new ExtensionManager(); 460 AnalysisEngine.instance.userDefinedPlugins = plugins;
461 manager.processPlugins(plugins); 461
462 // This ensures that AE extension manager processes plugins.
463 AnalysisEngine.instance.taskManager;
462 } 464 }
463 465
464 /// Analyze a single source. 466 /// Analyze a single source.
465 ErrorSeverity _runAnalyzer(Source source, CommandLineOptions options) { 467 ErrorSeverity _runAnalyzer(Source source, CommandLineOptions options) {
466 int startTime = currentTimeMillis(); 468 int startTime = currentTimeMillis();
467 AnalyzerImpl analyzer = 469 AnalyzerImpl analyzer =
468 new AnalyzerImpl(_context, _strongChecker, source, options, startTime); 470 new AnalyzerImpl(_context, _strongChecker, source, options, startTime);
469 var errorSeverity = analyzer.analyzeSync(); 471 var errorSeverity = analyzer.analyzeSync();
470 if (errorSeverity == ErrorSeverity.ERROR) { 472 if (errorSeverity == ErrorSeverity.ERROR) {
471 exitCode = errorSeverity.ordinal; 473 exitCode = errorSeverity.ordinal;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 for (var package in packages) { 588 for (var package in packages) {
587 var packageName = path.basename(package.path); 589 var packageName = path.basename(package.path);
588 var realPath = package.resolveSymbolicLinksSync(); 590 var realPath = package.resolveSymbolicLinksSync();
589 result[packageName] = [ 591 result[packageName] = [
590 PhysicalResourceProvider.INSTANCE.getFolder(realPath) 592 PhysicalResourceProvider.INSTANCE.getFolder(realPath)
591 ]; 593 ];
592 } 594 }
593 return result; 595 return result;
594 } 596 }
595 } 597 }
OLDNEW
« no previous file with comments | « no previous file | test/driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698