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

Side by Side Diff: pkg/analyzer/lib/src/plugin/options_plugin.dart

Issue 2559523005: Remove the AnalysisOptionsProcessor (Closed)
Patch Set: Created 4 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
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.src.plugin.options_plugin; 5 library analyzer.src.plugin.options_plugin;
6 6
7 import 'package:analyzer/plugin/options.dart'; 7 import 'package:analyzer/plugin/options.dart';
8 import 'package:analyzer/plugin/task.dart'; 8 import 'package:analyzer/plugin/task.dart';
9 import 'package:analyzer/src/task/options.dart'; 9 import 'package:analyzer/src/task/options.dart';
10 import 'package:plugin/plugin.dart'; 10 import 'package:plugin/plugin.dart';
11 11
12 /// A plugin that defines the extension points and extensions that are defined 12 /// A plugin that defines the extension points and extensions that are defined
13 /// by applications that want to consume options defined in the analysis 13 /// by applications that want to consume options defined in the analysis
14 /// options file. 14 /// options file.
15 class OptionsPlugin implements Plugin { 15 class OptionsPlugin implements Plugin {
16 /// The simple identifier of the extension point that allows plugins to 16 /// The simple identifier of the extension point that allows plugins to
17 /// register new options processors.
18 static const String OPTIONS_PROCESSOR_EXTENSION_POINT = 'optionsProcessor';
19
20 /// The simple identifier of the extension point that allows plugins to
21 /// register new options validators. 17 /// register new options validators.
22 static const String OPTIONS_VALIDATOR_EXTENSION_POINT = 'optionsValidator'; 18 static const String OPTIONS_VALIDATOR_EXTENSION_POINT = 'optionsValidator';
23 19
24 /// The unique identifier of this plugin. 20 /// The unique identifier of this plugin.
25 static const String UNIQUE_IDENTIFIER = 'options.core'; 21 static const String UNIQUE_IDENTIFIER = 'options.core';
26 22
27 /// The extension point that allows plugins to register new options 23 /// The extension point that allows plugins to register new options
28 /// processors.
29 ExtensionPoint<OptionsProcessor> optionsProcessorExtensionPoint;
30
31 /// The extension point that allows plugins to register new options
32 /// validators. 24 /// validators.
33 ExtensionPoint<OptionsValidator> optionsValidatorExtensionPoint; 25 ExtensionPoint<OptionsValidator> optionsValidatorExtensionPoint;
34 26
35 /// All contributed options processors.
36 List<OptionsProcessor> get optionsProcessors =>
37 optionsProcessorExtensionPoint?.extensions ?? const <OptionsProcessor>[];
38
39 /// All contributed options validators. 27 /// All contributed options validators.
40 List<OptionsValidator> get optionsValidators => 28 List<OptionsValidator> get optionsValidators =>
41 optionsValidatorExtensionPoint?.extensions ?? const <OptionsValidator>[]; 29 optionsValidatorExtensionPoint?.extensions ?? const <OptionsValidator>[];
42 30
43 @override 31 @override
44 String get uniqueIdentifier => UNIQUE_IDENTIFIER; 32 String get uniqueIdentifier => UNIQUE_IDENTIFIER;
45 33
46 @override 34 @override
47 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) { 35 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) {
48 optionsProcessorExtensionPoint = new ExtensionPoint<OptionsProcessor>(
49 this, OPTIONS_PROCESSOR_EXTENSION_POINT, null);
50 registerExtensionPoint(optionsProcessorExtensionPoint);
51 optionsValidatorExtensionPoint = new ExtensionPoint<OptionsValidator>( 36 optionsValidatorExtensionPoint = new ExtensionPoint<OptionsValidator>(
52 this, OPTIONS_VALIDATOR_EXTENSION_POINT, null); 37 this, OPTIONS_VALIDATOR_EXTENSION_POINT, null);
53 registerExtensionPoint(optionsValidatorExtensionPoint); 38 registerExtensionPoint(optionsValidatorExtensionPoint);
54 } 39 }
55 40
56 @override 41 @override
57 void registerExtensions(RegisterExtension registerExtension) { 42 void registerExtensions(RegisterExtension registerExtension) {
58 // Analyze options files. 43 // Analyze options files.
59 registerExtension( 44 registerExtension(
60 TASK_EXTENSION_POINT_ID, GenerateOptionsErrorsTask.DESCRIPTOR); 45 TASK_EXTENSION_POINT_ID, GenerateOptionsErrorsTask.DESCRIPTOR);
61 // Validate analyzer analysis options. 46 // Validate analyzer analysis options.
62 registerExtension( 47 registerExtension(
63 OPTIONS_VALIDATOR_EXTENSION_POINT_ID, new AnalyzerOptionsValidator()); 48 OPTIONS_VALIDATOR_EXTENSION_POINT_ID, new AnalyzerOptionsValidator());
64 } 49 }
65 } 50 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/context/builder.dart ('k') | pkg/analyzer/lib/src/plugin/plugin_configuration.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698