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

Side by Side Diff: packages/analyzer/lib/plugin/options.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.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 | « packages/analyzer/lib/plugin/command_line.dart ('k') | packages/analyzer/lib/plugin/task.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 /// Support for client code that wants to consume options contributed to the 5 /// Support for client code that wants to consume options contributed to the
6 /// analysis options file. 6 /// analysis options file.
7 library analyzer.plugin.options; 7 library analyzer.plugin.options;
8 8
9 import 'package:analyzer/src/generated/engine.dart';
9 import 'package:analyzer/src/plugin/options_plugin.dart'; 10 import 'package:analyzer/src/plugin/options_plugin.dart';
10 import 'package:plugin/plugin.dart'; 11 import 'package:plugin/plugin.dart';
11 import 'package:yaml/yaml.dart'; 12 import 'package:yaml/yaml.dart';
12 13
13 /// The identifier of the extension point that allows plugins to access 14 /// The identifier of the extension point that allows plugins to access
14 /// options defined in the analysis options file. The object used as an 15 /// options defined in the analysis options file. The object used as an
15 /// extension must be an [OptionsProcessor]. 16 /// extension must be an [OptionsProcessor].
16 final String OPTIONS_PROCESSOR_EXTENSION_POINT_ID = Plugin.join( 17 final String OPTIONS_PROCESSOR_EXTENSION_POINT_ID = Plugin.join(
17 OptionsPlugin.UNIQUE_IDENTIFIER, 18 OptionsPlugin.UNIQUE_IDENTIFIER,
18 OptionsPlugin.OPTIONS_PROCESSOR_EXTENSION_POINT); 19 OptionsPlugin.OPTIONS_PROCESSOR_EXTENSION_POINT);
19 20
20 /// Processes options defined in the analysis options file. 21 /// Processes options defined in the analysis options file.
21 /// 22 ///
22 /// The options file format is intentionally very open-ended, giving clients 23 /// The options file format is intentionally very open-ended, giving clients
23 /// utmost flexibility in defining their own options. The only hardfast 24 /// utmost flexibility in defining their own options. The only hardfast
24 /// expectation is that options files will contain a mapping from Strings 25 /// expectation is that options files will contain a mapping from Strings
25 /// (identifying 'scopes') to associated options. For example, the given 26 /// (identifying 'scopes') to associated options. For example, the given
26 /// content 27 /// content
27 /// 28 ///
28 /// linter: 29 /// linter:
29 /// rules: 30 /// rules:
30 /// camel_case_types: true 31 /// camel_case_types: true
31 /// compiler: 32 /// compiler:
32 /// resolver: 33 /// resolver:
33 /// useMultiPackage: true 34 /// useMultiPackage: true
34 /// packagePaths: 35 /// packagePaths:
35 /// - /foo/bar/pkg 36 /// - /foo/bar/pkg
36 /// - /bar/baz/pkg 37 /// - /bar/baz/pkg
37 /// 38 ///
38 /// defines two scopes, `linter` and `compiler`. Parsing would result in a 39 /// defines two scopes, `linter` and `compiler`. Parsing would result in a
39 /// map, mapping the `linter` and `compiler` scope identifiers to their 40 /// map, mapping the `linter` and `compiler` scope identifiers to their
40 /// respective parsed option node contents. Extracting values is a simple 41 /// respective parsed option node contents. Extracting values is a simple
41 /// matter of inspecting the parsed nodes. For example, testing whether the 42 /// matter of inspecting the parsed nodes. For example, testing whether the
42 /// compiler's resolver is set to use the `useMultiPackage` option might look 43 /// compiler's resolver is set to use the `useMultiPackage` option might look
43 /// something like this (eliding error-checking): 44 /// something like this (eliding error-checking):
44 /// 45 ///
45 /// bool useMultiPackage = 46 /// bool useMultiPackage =
46 /// options['compiler']['resolver']['useMultiPackage']; 47 /// options['compiler']['resolver']['useMultiPackage'];
47 abstract class OptionsProcessor { 48 abstract class OptionsProcessor {
48
49 /// Called when an error occurs in processing options. 49 /// Called when an error occurs in processing options.
50 void onError(Exception exception); 50 void onError(Exception exception);
51 51
52 /// Called when the options file is processed. 52 /// Called when an options file is processed.
53 /// 53 ///
54 /// The options file is processed on analyzer initialization and 54 /// The options file is processed on analyzer initialization and
55 /// subsequently when the file is changed on disk. In the event of a 55 /// subsequently when the file is changed on disk. In the event of a
56 /// change notification, note that the notification simply indicates 56 /// change notification, note that the notification simply indicates
57 /// a change on disk. Content in specific option scopes may or may not 57 /// a change on disk. Content in specific option scopes may or may not
58 /// be different. It is up to the implementer to check whether specific 58 /// be different. It is up to the implementer to check whether specific
59 /// options have changed and to handle those changes appropriately. 59 /// options have changed and to handle those changes appropriately. In
60 void optionsProcessed(Map<String, YamlNode> options); 60 /// addition to the [options] map, the associated analysis [context] is
61 /// provided as well to allow for context-specific configuration.
62 void optionsProcessed(AnalysisContext context, Map<String, YamlNode> options);
61 } 63 }
OLDNEW
« no previous file with comments | « packages/analyzer/lib/plugin/command_line.dart ('k') | packages/analyzer/lib/plugin/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698