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

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

Issue 1487953002: Clean-up the registration of plugins (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | « pkg/analyzer/tool/task_dependency_graph/generate.dart ('k') | no next file » | 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 17 matching lines...) Expand all
28 import 'package:analyzer/src/services/lint.dart'; 28 import 'package:analyzer/src/services/lint.dart';
29 import 'package:analyzer/src/task/options.dart'; 29 import 'package:analyzer/src/task/options.dart';
30 import 'package:analyzer_cli/src/analyzer_impl.dart'; 30 import 'package:analyzer_cli/src/analyzer_impl.dart';
31 import 'package:analyzer_cli/src/options.dart'; 31 import 'package:analyzer_cli/src/options.dart';
32 import 'package:linter/src/plugin/linter_plugin.dart'; 32 import 'package:linter/src/plugin/linter_plugin.dart';
33 import 'package:package_config/discovery.dart' as pkgDiscovery; 33 import 'package:package_config/discovery.dart' as pkgDiscovery;
34 import 'package:package_config/packages.dart' show Packages; 34 import 'package:package_config/packages.dart' show Packages;
35 import 'package:package_config/packages_file.dart' as pkgfile show parse; 35 import 'package:package_config/packages_file.dart' as pkgfile show parse;
36 import 'package:package_config/src/packages_impl.dart' show MapPackages; 36 import 'package:package_config/src/packages_impl.dart' show MapPackages;
37 import 'package:path/path.dart' as path; 37 import 'package:path/path.dart' as path;
38 import 'package:plugin/manager.dart';
38 import 'package:plugin/plugin.dart'; 39 import 'package:plugin/plugin.dart';
39 import 'package:yaml/yaml.dart'; 40 import 'package:yaml/yaml.dart';
40 41
41 /// The maximum number of sources for which AST structures should be kept in the 42 /// The maximum number of sources for which AST structures should be kept in the
42 /// cache. 43 /// cache.
43 const int _maxCacheSize = 512; 44 const int _maxCacheSize = 512;
44 45
45 /// Shared IO sink for standard error reporting. 46 /// Shared IO sink for standard error reporting.
46 /// 47 ///
47 /// *Visible for testing.* 48 /// *Visible for testing.*
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 if (optionMap != null) { 494 if (optionMap != null) {
494 configureContextOptions(context, optionMap); 495 configureContextOptions(context, optionMap);
495 } 496 }
496 } on Exception catch (e) { 497 } on Exception catch (e) {
497 optionsProcessors.forEach((OptionsProcessor p) => p.onError(e)); 498 optionsProcessors.forEach((OptionsProcessor p) => p.onError(e));
498 } 499 }
499 } 500 }
500 501
501 void _processPlugins() { 502 void _processPlugins() {
502 List<Plugin> plugins = <Plugin>[]; 503 List<Plugin> plugins = <Plugin>[];
504 plugins.addAll(AnalysisEngine.instance.requiredPlugins);
505 plugins.add(AnalysisEngine.instance.commandLinePlugin);
506 plugins.add(AnalysisEngine.instance.optionsPlugin);
503 plugins.add(linterPlugin); 507 plugins.add(linterPlugin);
504 plugins.addAll(_userDefinedPlugins); 508 plugins.addAll(_userDefinedPlugins);
505 AnalysisEngine.instance.userDefinedPlugins = plugins;
506 509
507 // This ensures that AE extension manager processes plugins. 510 ExtensionManager manager = new ExtensionManager();
508 AnalysisEngine.instance.taskManager; 511 manager.processPlugins(plugins);
509 } 512 }
510 513
511 /// Analyze a single source. 514 /// Analyze a single source.
512 ErrorSeverity _runAnalyzer(Source source, CommandLineOptions options) { 515 ErrorSeverity _runAnalyzer(Source source, CommandLineOptions options) {
513 int startTime = currentTimeMillis(); 516 int startTime = currentTimeMillis();
514 AnalyzerImpl analyzer = 517 AnalyzerImpl analyzer =
515 new AnalyzerImpl(_context, source, options, startTime); 518 new AnalyzerImpl(_context, source, options, startTime);
516 var errorSeverity = analyzer.analyzeSync(); 519 var errorSeverity = analyzer.analyzeSync();
517 if (errorSeverity == ErrorSeverity.ERROR) { 520 if (errorSeverity == ErrorSeverity.ERROR) {
518 exitCode = errorSeverity.ordinal; 521 exitCode = errorSeverity.ordinal;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 for (var package in packages) { 635 for (var package in packages) {
633 var packageName = path.basename(package.path); 636 var packageName = path.basename(package.path);
634 var realPath = package.resolveSymbolicLinksSync(); 637 var realPath = package.resolveSymbolicLinksSync();
635 result[packageName] = [ 638 result[packageName] = [
636 PhysicalResourceProvider.INSTANCE.getFolder(realPath) 639 PhysicalResourceProvider.INSTANCE.getFolder(realPath)
637 ]; 640 ];
638 } 641 }
639 return result; 642 return result;
640 } 643 }
641 } 644 }
OLDNEW
« no previous file with comments | « pkg/analyzer/tool/task_dependency_graph/generate.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698