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

Unified Diff: mojo/public/dart/third_party/analyzer/lib/plugin/options.dart

Issue 1346773002: Stop running pub get at gclient sync time and fix build bugs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/dart/third_party/analyzer/lib/plugin/options.dart
diff --git a/mojo/public/dart/third_party/analyzer/lib/plugin/options.dart b/mojo/public/dart/third_party/analyzer/lib/plugin/options.dart
new file mode 100644
index 0000000000000000000000000000000000000000..cc0b88d5a1aa9abc4a9d53df1bcccd6b964c7e11
--- /dev/null
+++ b/mojo/public/dart/third_party/analyzer/lib/plugin/options.dart
@@ -0,0 +1,61 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// Support for client code that wants to consume options contributed to the
+/// analysis options file.
+library analyzer.plugin.options;
+
+import 'package:analyzer/src/plugin/options_plugin.dart';
+import 'package:plugin/plugin.dart';
+import 'package:yaml/yaml.dart';
+
+/// The identifier of the extension point that allows plugins to access
+/// options defined in the analysis options file. The object used as an
+/// extension must be an [OptionsProcessor].
+final String OPTIONS_PROCESSOR_EXTENSION_POINT_ID = Plugin.join(
+ OptionsPlugin.UNIQUE_IDENTIFIER,
+ OptionsPlugin.OPTIONS_PROCESSOR_EXTENSION_POINT);
+
+/// Processes options defined in the analysis options file.
+///
+/// The options file format is intentionally very open-ended, giving clients
+/// utmost flexibility in defining their own options. The only hardfast
+/// expectation is that options files will contain a mapping from Strings
+/// (identifying 'scopes') to associated options. For example, the given
+/// content
+///
+/// linter:
+/// rules:
+/// camel_case_types: true
+/// compiler:
+/// resolver:
+/// useMultiPackage: true
+/// packagePaths:
+/// - /foo/bar/pkg
+/// - /bar/baz/pkg
+///
+/// defines two scopes, `linter` and `compiler`. Parsing would result in a
+/// map, mapping the `linter` and `compiler` scope identifiers to their
+/// respective parsed option node contents. Extracting values is a simple
+/// matter of inspecting the parsed nodes. For example, testing whether the
+/// compiler's resolver is set to use the `useMultiPackage` option might look
+/// something like this (eliding error-checking):
+///
+/// bool useMultiPackage =
+/// options['compiler']['resolver']['useMultiPackage'];
+abstract class OptionsProcessor {
+
+ /// Called when an error occurs in processing options.
+ void onError(Exception exception);
+
+ /// Called when the options file is processed.
+ ///
+ /// The options file is processed on analyzer initialization and
+ /// subsequently when the file is changed on disk. In the event of a
+ /// change notification, note that the notification simply indicates
+ /// a change on disk. Content in specific option scopes may or may not
+ /// be different. It is up to the implementer to check whether specific
+ /// options have changed and to handle those changes appropriately.
+ void optionsProcessed(Map<String, YamlNode> options);
+}

Powered by Google App Engine
This is Rietveld 408576698