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

Side by Side Diff: analyzer/lib/src/plugin/engine_plugin.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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library analyzer.src.plugin.engine_plugin;
6
7 import 'package:analyzer/plugin/task.dart';
8 import 'package:analyzer/src/task/dart.dart';
9 import 'package:analyzer/src/task/general.dart';
10 import 'package:analyzer/src/task/html.dart';
11 import 'package:analyzer/task/model.dart';
12 import 'package:plugin/plugin.dart';
13
14 /**
15 * A plugin that defines the extension points and extensions that are inherently
16 * defined by the analysis engine.
17 */
18 class EnginePlugin implements Plugin {
19 /**
20 * The simple identifier of the extension point that allows plugins to
21 * register new analysis tasks with the analysis engine.
22 */
23 static const String TASK_EXTENSION_POINT = 'task';
24
25 /**
26 * The unique identifier of this plugin.
27 */
28 static const String UNIQUE_IDENTIFIER = 'analysis_engine.core';
29
30 /**
31 * The extension point that allows plugins to register new analysis tasks with
32 * the analysis engine.
33 */
34 ExtensionPoint taskExtensionPoint;
35
36 /**
37 * Initialize a newly created plugin.
38 */
39 EnginePlugin();
40
41 /**
42 * Return a list containing all of the task descriptors that were contributed.
43 */
44 List<TaskDescriptor> get taskDescriptors => taskExtensionPoint.extensions;
45
46 @override
47 String get uniqueIdentifier => UNIQUE_IDENTIFIER;
48
49 @override
50 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) {
51 taskExtensionPoint =
52 registerExtensionPoint(TASK_EXTENSION_POINT, _validateTaskExtension);
53 }
54
55 @override
56 void registerExtensions(RegisterExtension registerExtension) {
57 String taskId = TASK_EXTENSION_POINT_ID;
58 //
59 // Register general tasks.
60 //
61 registerExtension(taskId, GetContentTask.DESCRIPTOR);
62 //
63 // Register Dart tasks.
64 //
65 registerExtension(taskId, BuildCompilationUnitElementTask.DESCRIPTOR);
66 registerExtension(taskId, BuildDirectiveElementsTask.DESCRIPTOR);
67 registerExtension(taskId, BuildEnumMemberElementsTask.DESCRIPTOR);
68 registerExtension(taskId, BuildExportNamespaceTask.DESCRIPTOR);
69 registerExtension(taskId, BuildLibraryElementTask.DESCRIPTOR);
70 registerExtension(taskId, BuildPublicNamespaceTask.DESCRIPTOR);
71 registerExtension(taskId, BuildSourceExportClosureTask.DESCRIPTOR);
72 registerExtension(taskId, BuildSourceImportExportClosureTask.DESCRIPTOR);
73 registerExtension(taskId, BuildTypeProviderTask.DESCRIPTOR);
74 registerExtension(taskId, ComputeConstantDependenciesTask.DESCRIPTOR);
75 registerExtension(taskId, ComputeConstantValueTask.DESCRIPTOR);
76 registerExtension(taskId, ContainingLibrariesTask.DESCRIPTOR);
77 registerExtension(taskId, DartErrorsTask.DESCRIPTOR);
78 registerExtension(taskId, EvaluateUnitConstantsTask.DESCRIPTOR);
79 registerExtension(taskId, GatherUsedImportedElementsTask.DESCRIPTOR);
80 registerExtension(taskId, GatherUsedLocalElementsTask.DESCRIPTOR);
81 registerExtension(taskId, GenerateHintsTask.DESCRIPTOR);
82 registerExtension(taskId, LibraryErrorsReadyTask.DESCRIPTOR);
83 registerExtension(taskId, LibraryUnitErrorsTask.DESCRIPTOR);
84 registerExtension(taskId, ParseDartTask.DESCRIPTOR);
85 registerExtension(taskId, ResolveLibraryReferencesTask.DESCRIPTOR);
86 registerExtension(taskId, ResolveLibraryTypeNamesTask.DESCRIPTOR);
87 registerExtension(taskId, ResolveUnitReferencesTask.DESCRIPTOR);
88 registerExtension(taskId, ResolveUnitTypeNamesTask.DESCRIPTOR);
89 registerExtension(taskId, ResolveVariableReferencesTask.DESCRIPTOR);
90 registerExtension(taskId, ScanDartTask.DESCRIPTOR);
91 registerExtension(taskId, VerifyUnitTask.DESCRIPTOR);
92 //
93 // Register HTML tasks.
94 //
95 registerExtension(taskId, DartScriptsTask.DESCRIPTOR);
96 registerExtension(taskId, HtmlErrorsTask.DESCRIPTOR);
97 registerExtension(taskId, ParseHtmlTask.DESCRIPTOR);
98 }
99
100 /**
101 * Validate the given extension by throwing an [ExtensionError] if it is not a
102 * valid domain.
103 */
104 void _validateTaskExtension(Object extension) {
105 if (extension is! TaskDescriptor) {
106 String id = taskExtensionPoint.uniqueIdentifier;
107 throw new ExtensionError('Extensions to $id must be a TaskDescriptor');
108 }
109 }
110 }
OLDNEW
« no previous file with comments | « analyzer/lib/src/plugin/command_line_plugin.dart ('k') | analyzer/lib/src/plugin/options_plugin.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698