Remove old plugin loader (#647)
diff --git a/.travis.yml b/.travis.yml index 11b1b67..02a9ebc 100644 --- a/.travis.yml +++ b/.travis.yml
@@ -14,4 +14,3 @@ - ./tools/travis.sh env: - PACKAGE=angular_analyzer_plugin - - PACKAGE=old_plugin_loader
diff --git a/old_plugin_loader/AUTHORS b/old_plugin_loader/AUTHORS deleted file mode 100644 index ff09364..0000000 --- a/old_plugin_loader/AUTHORS +++ /dev/null
@@ -1,7 +0,0 @@ -# Below is a list of people and organizations that have contributed -# to the project. Names should be added to the list like so: -# -# Name/Organization <email address> - -Google Inc. -
diff --git a/old_plugin_loader/LICENSE b/old_plugin_loader/LICENSE deleted file mode 100644 index 3c80eb5..0000000 --- a/old_plugin_loader/LICENSE +++ /dev/null
@@ -1,27 +0,0 @@ -Copyright 2015, the Dart project authors. All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - * Neither the name of Google Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
diff --git a/old_plugin_loader/README.md b/old_plugin_loader/README.md deleted file mode 100644 index 0b05222..0000000 --- a/old_plugin_loader/README.md +++ /dev/null
@@ -1,9 +0,0 @@ -# Angular2 analysis server plugin - -A plugin for Dart Analysis Server [package](https://github.com/dart-lang/sdk/tree/master/pkg/analysis_server) providing Angular2 support. - -## Features and bugs - -Please file feature requests and bugs at the [issue tracker][tracker]. - -[tracker]: https://github.com/angular/angular2-dart-analyzer/issues
diff --git a/old_plugin_loader/analysis_options.yaml b/old_plugin_loader/analysis_options.yaml deleted file mode 100644 index e0636d8..0000000 --- a/old_plugin_loader/analysis_options.yaml +++ /dev/null
@@ -1,77 +0,0 @@ -analyzer: - strong-mode: true - -linter: - rules: - - prefer_final_locals - - always_declare_return_types - - always_put_control_body_on_new_line - - always_require_non_null_named_parameters - - annotate_overrides - - avoid_annotating_with_dynamic - - avoid_catching_errors - - avoid_classes_with_only_static_members - - avoid_empty_else - - avoid_init_to_null - - avoid_null_checks_in_equality_operators - - avoid_positional_boolean_parameters - - avoid_return_types_on_setters - - avoid_returning_this - - avoid_setters_without_getters - - avoid_slow_async_io - - avoid_types_on_closure_parameters - - await_only_futures - - camel_case_types - - cancel_subscriptions - - cascade_invocations - - close_sinks - - control_flow_in_finally - - directives_ordering - - empty_catches - - empty_constructor_bodies - - empty_statements - - iterable_contains_unrelated_type - - join_return_with_assignment - - library_names - - library_prefixes - - list_remove_unrelated_type - - no_adjacent_strings_in_list - - no_duplicate_case_values - - non_constant_identifier_names - - omit_local_variable_types - - only_throw_errors - - overridden_fields - - parameter_assignments - - prefer_adjacent_string_concatenation - - prefer_collection_literals - - prefer_conditional_assignment - - prefer_const_constructors - - prefer_constructors_over_static_methods - - prefer_contains - - prefer_expression_function_bodies - - prefer_final_fields - - prefer_final_locals - - prefer_function_declarations_over_variables - - prefer_interpolation_to_compose_strings - - prefer_is_empty - - prefer_is_not_empty - - recursive_getters - - slash_for_doc_comments - - super_goes_last - - test_types_in_equals - - throw_in_finally - - type_init_formals - - unawaited_futures - - unnecessary_brace_in_string_interps - - unnecessary_getters_setters - - unnecessary_lambdas - - unnecessary_null_aware_assignments - - unnecessary_null_in_if_null_operators - - unnecessary_overrides - - unnecessary_this - - unrelated_type_equality_checks - - use_rethrow_when_possible - - use_setters_to_change_properties - - use_string_buffers - - use_to_and_as_if_applicable - - valid_regexps
diff --git a/old_plugin_loader/bin/make_snapshot b/old_plugin_loader/bin/make_snapshot deleted file mode 100755 index 2d7e72d..0000000 --- a/old_plugin_loader/bin/make_snapshot +++ /dev/null
@@ -1,5 +0,0 @@ -#!/bin/bash - -dart --snapshot=server.snapshot server.dart - -cp server.snapshot ~/.dart-sdk/bin/snapshots/analysis_server.dart.snapshot
diff --git a/old_plugin_loader/bin/server.dart b/old_plugin_loader/bin/server.dart deleted file mode 100644 index b5bae61..0000000 --- a/old_plugin_loader/bin/server.dart +++ /dev/null
@@ -1,15 +0,0 @@ -// Copyright (c) 2014, 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. - -import 'package:analysis_server/starter.dart'; - -import 'package:old_plugin_loader/starter.dart' as ng; - -/// Create and run an analysis server with Angular plugins. -void main(List<String> args) { - final starter = new ServerStarter(); - final server = starter.start(args); - - //new ng.Starter().start(server); -}
diff --git a/old_plugin_loader/lib/starter.dart b/old_plugin_loader/lib/starter.dart deleted file mode 100644 index b5fdce6..0000000 --- a/old_plugin_loader/lib/starter.dart +++ /dev/null
@@ -1,169 +0,0 @@ -import 'dart:async'; - -import 'package:analyzer/error/error.dart'; -import 'package:analysis_server/src/analysis_server.dart'; -import 'package:analyzer/src/generated/source.dart'; -import 'package:analyzer/src/dart/analysis/driver.dart'; -import 'package:angular_analyzer_plugin/notification_manager.dart'; -import 'package:angular_analyzer_plugin/src/angular_driver.dart'; -import 'package:analyzer/src/context/builder.dart'; -import 'package:analysis_server/src/protocol_server.dart' as protocol; -import 'package:analysis_server/protocol/protocol.dart' show Request; -import 'package:analysis_server/protocol/protocol_generated.dart' - show CompletionGetSuggestionsParams, CompletionGetSuggestionsResult; -import 'package:analysis_server/src/services/completion/completion_core.dart'; -import 'package:analysis_server/src/services/completion/completion_performance.dart'; -import 'package:angular_analyzer_plugin/src/completion.dart'; -import 'package:angular_analyzer_plugin/src/options.dart'; -import 'package:analyzer/src/source/source_resource.dart'; -import 'package:analysis_server/src/domain_completion.dart'; -import 'package:analyzer_plugin/src/utilities/completion/completion_core.dart' - as new_core; -import 'package:analyzer_plugin/utilities/completion/completion_core.dart'; -import 'package:angular_analyzer_plugin/src/completion_request.dart'; - -class Starter { - final angularDrivers = <String, AngularDriver>{}; - AnalysisServer server; - - void start(AnalysisServer server) { - this.server = server; - ContextBuilder.onCreateAnalysisDriver = onCreateAnalysisDriver; - server - ..onResultErrorSupplementor = sumErrors - ..onNoAnalysisResult = sendHtmlResult - ..onNoAnalysisCompletion = sendAngularCompletions; - } - - void onCreateAnalysisDriver( - analysisDriver, - scheduler, - logger, - resourceProvider, - byteStore, - contentOverlay, - driverPath, - sourceFactory, - analysisOptions) { - final driver = new AngularDriver( - resourceProvider, - new ServerNotificationManager(server, analysisDriver), - analysisDriver, - scheduler, - byteStore, - sourceFactory, - contentOverlay, - new AngularOptions.defaults()); - angularDrivers[driverPath] = driver; - server.onFileAdded.listen((path) { - if (server.contextManager.getContextFolderFor(path).path == driverPath) { - // only the owning driver "adds" the path - driver.addFile(path); - } else { - // but the addition of a file is a "change" to all the other drivers - driver.fileChanged(path); - } - }); - - // all drivers get change notification - server.onFileChanged.listen(driver.fileChanged); - } - - Future sumErrors(String path, List<AnalysisError> errors) async { - for (final driver in angularDrivers.values) { - final angularErrors = await driver.requestDartErrors(path); - errors.addAll(angularErrors); - } - return null; - } - - Future sendHtmlResult(String path, Function sendFn) async { - for (final driverPath in angularDrivers.keys) { - if (server.contextManager.getContextFolderFor(path).path == driverPath) { - final driver = angularDrivers[driverPath]; - // only the owning driver "adds" the path - final angularErrors = await driver.requestHtmlErrors(path); - sendFn( - driver.dartDriver.analysisOptions, - new LineInfo.fromContent(driver.getFileContent(path)), - angularErrors); - return; - } - } - - sendFn(null, null, null); - } - - // Handles .html completion. Directly sends the suggestions to the - // [completionHandler]. - Future sendAngularCompletions( - Request request, - CompletionDomainHandler completionHandler, - CompletionGetSuggestionsParams params, - CompletionPerformance performance, - String completionId, - ) async { - final filePath = (request.toJson()['params'] as Map)['file']; - final source = - new FileSource(server.resourceProvider.getFile(filePath), filePath); - - if (server.contextManager.isInAnalysisRoot(filePath)) { - for (final driverPath in angularDrivers.keys) { - if (server.contextManager.getContextFolderFor(filePath).path == - driverPath) { - final driver = angularDrivers[driverPath]; - - final contributors = <CompletionContributor>[ - new AngularCompletionContributor(), - new NgTypeMemberContributor(), - new NgInheritedReferenceContributor(), - new NgOffsetLengthContributor(), - ]; - final completionRequest = new CompletionRequestImpl( - null, // AnalysisResult - unneeded for AngularCompletion - params.offset, - performance, - ); - completionHandler.setNewRequest(completionRequest); - server.sendResponse(new CompletionGetSuggestionsResult(completionId) - .toResponse(request.id)); - - final templates = await driver.getTemplatesForFile(filePath); - final standardHtml = await driver.getStandardHtml(); - final angularRequest = new AngularCompletionRequest(params.offset, - filePath, server.resourceProvider, templates, standardHtml); - final collector = new new_core.CompletionCollectorImpl(); - - for (final contributor in contributors) { - await contributor.computeSuggestions(angularRequest, collector); - } - final suggestions = collector.suggestions; - - completionHandler - ..sendCompletionNotification( - completionId, - collector.offset ?? params.offset, - collector.length ?? 0, - suggestions) - ..ifMatchesRequestClear(completionRequest); - } - } - } - } -} - -class ServerNotificationManager implements NotificationManager { - final AnalysisServer server; - final AnalysisDriver dartDriver; - - ServerNotificationManager(this.server, this.dartDriver); - - @override - void recordAnalysisErrors( - String path, LineInfo lineInfo, List<AnalysisError> analysisErrors) => - server.notificationManager.recordAnalysisErrors( - 'angular driver', - path, - protocol.doAnalysisError_listFromEngine( - dartDriver.analysisOptions, lineInfo, analysisErrors)); -}
diff --git a/old_plugin_loader/pubspec.yaml b/old_plugin_loader/pubspec.yaml deleted file mode 100644 index 8150c05..0000000 --- a/old_plugin_loader/pubspec.yaml +++ /dev/null
@@ -1,25 +0,0 @@ -name: old_plugin_loader -version: 0.0.9 -description: Old style loader for angular plugin. DO NOT PUBLISH -environment: - sdk: '>=1.21.0-dev.1.0' -dependencies: - analyzer: '^0.30.0' - angular_analysis_plugin: - path: ../angular_analysis_plugin - analysis_server: any - analyzer_plugin: any - plugin: '^0.2.0' -dev_dependencies: - test_reflective_loader: '^0.1.0' - typed_mock: '^0.0.4' - unittest: '^0.11.0' -dependency_overrides: - analyzer: - path: ../../sdk/pkg/analyzer - analysis_server: - path: ../../sdk/pkg/analysis_server - analyzer_plugin: - path: ../../sdk/pkg/analyzer_plugin - front_end: - path: ../../sdk/pkg/front_end
diff --git a/old_plugin_loader/test/test_all.dart b/old_plugin_loader/test/test_all.dart deleted file mode 100644 index 4e4084c..0000000 --- a/old_plugin_loader/test/test_all.dart +++ /dev/null
@@ -1,6 +0,0 @@ -import 'package:test_reflective_loader/test_reflective_loader.dart'; - -/// Utility for manually running all tests. -void main() { - defineReflectiveSuite(() {}, name: 'Angular Old Plugin Loader tests'); -}
diff --git a/tools/travis.sh b/tools/travis.sh index f81f6ff..97b8e96 100755 --- a/tools/travis.sh +++ b/tools/travis.sh
@@ -13,27 +13,19 @@ # Check if we should resolve pub dependencies, or use what was fetched from # depot tools. -if [[ "$PACKAGE" != old_plugin_loader ]] +if [[ -z "$(echo $TRAVIS_BRANCH | grep 'SDK_AT_HEAD')" ]] then - if [[ -z "$(echo $TRAVIS_BRANCH | grep 'SDK_AT_HEAD')" ]] - then - echo Using pub for the SDK dependencies. - echo - echo To test against the SDK at master, include SDK_AT_HEAD in your branch - echo name. Otherwise, we will test with pub. - - pub get - else - echo Using depot_tools for the SDK dependencies. - echo - echo Because your branch name includes SDK_AT_HEAD, this will test against - echo the latest SDK source instead of using pub. - fi + echo Using pub for the SDK dependencies. + echo + echo To test against the SDK at master, include SDK_AT_HEAD in your branch + echo name. Otherwise, we will test with pub. + + pub get else echo Using depot_tools for the SDK dependencies. echo - echo The old_plugin_loader relies on packages not published by pub, and so - echo can only be tested by using depot_tools. + echo Because your branch name includes SDK_AT_HEAD, this will test against + echo the latest SDK source instead of using pub. fi # Analyze the test first
diff --git a/tools/update_deps.sh b/tools/update_deps.sh index 15198b5..46c8509 100755 --- a/tools/update_deps.sh +++ b/tools/update_deps.sh
@@ -31,11 +31,6 @@ echo done echo -echo Adding old plugin loader to .packages -echo 'old_plugin_loader:old_plugin_loader/lib' >> .packages -echo done -echo - echo Updating new plugin architecture .packages file echo Adding self hosting plugin architecture .packages file cd angular_analyzer_plugin/tools/analyzer_plugin