Introduce analysis_server_plugin package; replacement for server_plugin

We have chosen a new name for this package. So before we write more
code inside, we need to move everything from 'server_plugin' to
'analysis_server_plugin'. There are some steps do doing so, to not
break various infra:

1. Land this change, introducing the new package in the SDK, but no
   dependencies on it.
2. Land this change independently in google3 (the package is not
   yet "unbundled.")
3. Mark the package as "unbundled" in google3.
4. Move all code from server_plugin to analysis_server_plugin; update
   imports; and delete server_plugin.
5. Remove server_plugin as an "unbundled" package; and remove
   server_plugin from google3.

Bug: https://github.com/dart-lang/sdk/issues/53402
Change-Id: I70197fdf61dd5862c2220d8ed5dd0880a1593ead
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
Sam Rawlins
2024-04-19 01:38:29 +00:00
committed by Commit Queue
parent 43fa24f839
commit cfc705ce09
12 changed files with 297 additions and 61 deletions
@@ -0,0 +1,24 @@
## Contributing
Contributions welcome! Please follow the guide in [Contributing][contributing].
## Building
If you want to build Dart yourself, here is a guide to [getting the source,
preparing your machine to build the SDK, and building][building].
There are more documents on our [wiki][]. Once set up to build the SDK, run:
```none
./tools/build.py -mrelease create_sdk
```
## Coding style
The analyzer packages are coded with a styled specified in our [coding style
document][coding style].
[building]: https://github.com/dart-lang/sdk/wiki/Building
[coding style]: https://github.com/dart-lang/sdk/blob/main/pkg/analyzer/doc/implementation/coding_style.md
[contributing]: https://github.com/dart-lang/sdk/wiki/Contributing
[wiki]: https://github.com/dart-lang/sdk/wiki
+26
View File
@@ -0,0 +1,26 @@
Copyright 2024, the Dart project authors.
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 LLC 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.
+1
View File
@@ -0,0 +1 @@
file:/tools/OWNERS_ANALYZER
+55
View File
@@ -0,0 +1,55 @@
# analysis\_server\_plugin package
This package is being developed for the second incarnation of Dart Analyzer
plugins. It is in an intermediate state, and a few things must be kept in mind
during this phase of development:
1. **This package is not to be published on pub yet.** We will flesh out a
stable API befoure the first publish.
2. **In order to support the above point, no pub-publishable code can depend on
this package.** At no point can we introduce a dependency from a package
like `analyzer` or `analyzer_plugin` to this package. If we did so, then at
the next time we published _that_ package to pub, we would need to publish
_this_ package to pub. No. In short, I think what this means is that only
the `analysis_server` package can depend on this package.
## Migration of code between packages
As part of the design of the new Dart Analyzer plugins, much code will shift
around, in a few directions.
* **`analysis_server` package to `analysis_server_plugin` package:** The API of
the new Dart Analyzer plugins focuses around two primary concepts: lint rules
and quick fixes. Quick assists may be chosen as a third important concept.
Lint rule code has typically lived in the `analyzer` package, and does not
need to move. (It's presence in the `analyzer` package could be deprecated in
favor of this package, but it is not important for the implementation.)
Quick fixes, however, have only existed in concept, and interface, and API,
in the `analysis_server` package. That code needs to move to this package in
order to be used in a Dart Analyzer plugin.
**A move from the `analysis_server` package to this package is not a breaking
change.**
* **`analyzer_plugin` package to `analysis_server_plugin` package:** Care is
being taken to decide where Dart Analyzer plugin code will live and how it
will be published. It is not decided yet what the ultimate package API will
be. Some code from **analyzer_plugin** may move to this package.
**A move from the `analyzer_plugin` package is a breaking change. Extreme
care must be taken.**
* **`analyzer_plugin` package to `analysis_server` package:** There will be
many components of the analysis server that currently live in
`analyzer_plugin`, because they were necessary for the first version of Dart
Analyzer plugins), but are not part of the new Dart Analyzer plugins. These
components can be moved safely back into the `analysis_server` package.
In terms of priority, it is not crucial for such code to be moved out of the
`analyzer_plugin` package. It can live there indefinitely, and the
`analysis_server` package can continue to depend on code from the
`analyzer_plugin` package, as shipped in the SDK.
**A move from the `analyzer_plugin` package is a breaking change. Extreme
care must be taken.**
@@ -0,0 +1,28 @@
include: package:lints/recommended.yaml
analyzer:
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
errors:
# This package imports much of the implementation libraries of the
# 'analyzer' package, because it is tightly integrated. This will not
# likely change any time soon.
implementation_imports: ignore
linter:
rules:
- always_use_package_imports
- avoid_dynamic_calls
- avoid_redundant_argument_values
- avoid_unused_constructor_parameters
- flutter_style_todos
- library_annotations
- prefer_single_quotes
- unawaited_futures
- unnecessary_breaks
- unnecessary_library_directive
- unnecessary_parenthesis
- unreachable_from_main
@@ -0,0 +1,6 @@
// Copyright (c) 2024, 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.
// TODO(srawlins): Move the contents of this imported library, here.
export 'package:server_plugin/edit/fix/dart_fix_context.dart';
@@ -0,0 +1,6 @@
// Copyright (c) 2024, 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.
// TODO(srawlins): Move the contents of this imported library, here.
export 'package:server_plugin/edit/fix/fix.dart';
@@ -0,0 +1,6 @@
// Copyright (c) 2024, 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.
// TODO(srawlins): Move the contents of this imported library, here.
export 'package:server_plugin/edit/fix/fix_context.dart';
+137
View File
@@ -0,0 +1,137 @@
name: analysis_server_plugin
# This package is not yet intended for consumption on pub.dev. DO NOT publish.
publish_to: none
environment:
sdk: '>=3.3.0 <4.0.0'
# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
# TODO(srawlins): Move all code from `server_plugin` here, and remove dep.
server_plugin: any
# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
lints: any
dependency_overrides:
_fe_analyzer_shared:
path: ../_fe_analyzer_shared
analyzer:
path: ../analyzer
analyzer_plugin:
path: ../analyzer_plugin
analyzer_utilities:
path: ../analyzer_utilities
args:
path: ../../third_party/pkg/args
async:
path: ../../third_party/pkg/async
boolean_selector:
path: ../../third_party/pkg/boolean_selector
cli_util:
path: ../../third_party/pkg/cli_util
clock:
path: ../../third_party/pkg/clock
collection:
path: ../../third_party/pkg/collection
convert:
path: ../../third_party/pkg/convert
crypto:
path: ../../third_party/pkg/crypto
dart_style:
path: ../../third_party/pkg/dart_style
file:
path: ../../third_party/pkg/file/packages/file
frontend_server_client:
path: ../../third_party/pkg/webdev/frontend_server_client
glob:
path: ../../third_party/pkg/glob
http:
path: ../../third_party/pkg/http/pkgs/http
http_multi_server:
path: ../../third_party/pkg/http_multi_server
http_parser:
path: ../../third_party/pkg/http_parser
intl:
path: ../../third_party/pkg/intl
js:
path: ../js
language_server_protocol:
path: ../../third_party/pkg/language_server_protocol
linter:
path: ../linter
lints:
path: ../../third_party/pkg/lints
logging:
path: ../../third_party/pkg/logging
matcher:
path: ../../third_party/pkg/matcher
memory_usage:
path: ../../third_party/pkg/leak_tracker/pkgs/memory_usage
meta:
path: ../meta
mime:
path: ../../third_party/pkg/mime
package_config:
path: ../../third_party/pkg/package_config
path:
path: ../../third_party/pkg/path
pool:
path: ../../third_party/pkg/pool
pub_semver:
path: ../../third_party/pkg/pub_semver
server_plugin:
path: ../server_plugin
shelf:
path: ../../third_party/pkg/shelf/pkgs/shelf
shelf_packages_handler:
path: ../../third_party/pkg/shelf/pkgs/shelf_packages_handler
shelf_static:
path: ../../third_party/pkg/shelf/pkgs/shelf_static
shelf_web_socket:
path: ../../third_party/pkg/shelf/pkgs/shelf_web_socket
source_map_stack_trace:
path: ../../third_party/pkg/source_map_stack_trace
source_maps:
path: ../../third_party/pkg/source_maps
source_span:
path: ../../third_party/pkg/source_span
stack_trace:
path: ../../third_party/pkg/stack_trace
stream_channel:
path: ../../third_party/pkg/stream_channel
string_scanner:
path: ../../third_party/pkg/string_scanner
telemetry:
path: ../telemetry
term_glyph:
path: ../../third_party/pkg/term_glyph
test:
path: ../../third_party/pkg/test/pkgs/test
test_api:
path: ../../third_party/pkg/test/pkgs/test_api
test_core:
path: ../../third_party/pkg/test/pkgs/test_core
test_descriptor:
path: ../../third_party/pkg/test_descriptor
test_reflective_loader:
path: ../../third_party/pkg/test_reflective_loader
typed_data:
path: ../../third_party/pkg/typed_data
unified_analytics:
path: ../../third_party/pkg/tools/pkgs/unified_analytics
usage:
path: ../../third_party/pkg/usage
vm_service:
path: ../vm_service
watcher:
path: ../../third_party/pkg/watcher
web_socket_channel:
path: ../../third_party/pkg/web_socket_channel
webkit_inspection_protocol:
path: ../../third_party/pkg/webkit_inspection_protocol
yaml:
path: ../../third_party/pkg/yaml
yaml_edit:
path: ../../third_party/pkg/yaml_edit
+3 -56
View File
@@ -1,58 +1,5 @@
# server\_plugin package
This package is being developed for the second incarnation of Dart Analyzer
plugins. It is in an intermediate state, and a few things must be kept in mind
during this phase of development:
1. **This package is not to be published on pub.** Yet. We may decide to go
forward with this package as a full replacement of the `analyzer_plugin`
package, in which case we _would_ ultimately publish it. But we may choose a
different plan. Until we finalize, this package is not to be published.
2. **In order to support the above point, no pub-publishable code can depend on
this package.** At no point can we introduce a dependency from a package
like `analyzer` or `analyzer_plugin` to this package. If we did so, then at
the next time we published _that_ package to pub, we would need to publish
_this_ package to pub. No. In short, I think what this means is that only
the `analsis_server` package can depend on this package (until we decide the
final path to publishing the next Dart Analyzer plugins story.
## Migration of code between packages
As part of the design of the new Dart Analyzer plugins, much code will shift
around, in a few directions.
* **`analysis_server` package to `server_plugin` package:** The API of the new
Dart Analyzer plugins focuses around two primary concepts: lint rules and
quick fixes. Quick assists may be chosen as a third important concept. Lint
rule code has typically lived in the `analyzer` package, and does not need to
move. (It's presense in the `analyzer` package could be deprecated in favor
of this package, but it is not important for the implementation.)
Quick fixes, however, have only existed in concept, and interface, and API,
in the `analysis_server` package. That code needs to move to this package in
order to be used in a Dart Analyzer plugin.
**A move from the `analysis_server` package to this package is not a breaking
change.**
* **`analyzer_plugin` package to `server_plugin` package:** Care is being taken
to decide where Dart Analyzer plugin code will live and how it will be
published. It is not decided yet what the ultimate package API will be. Some
code from **analyzer_plugin** may move to this package.
**A move from the `analyzer_plugin` package is a breaking change. Extreme
care must be taken.**
* **`analyzer_plugin` package to `analysis_server` package:** There will be
many components of the analysis server that currently live in
`analyzer_plugin`, because they were necessary for the first version of Dart
Analyzer plugins), but are not part of the new Dart Analyzer plugins. These
components can be moved safely back into the `analysis_server` package.
In terms of priority, it is not crucial for such code to be moved out of the
`analyzer_plugin` package. It can live there indefinitely, and the
`analysis_server` package can continue to depend on code from the
`analyzer_plugin` package, as shipped in the SDK.
**A move from the `analyzer_plugin` package is a breaking change. Extreme
care must be taken.**
This package is being renamed as `analysis_server_plugin`. All code should move
to that package soon, and then this directory will be deleted. This package was
never published under the name `server_plugin`.
+2 -2
View File
@@ -7,8 +7,8 @@ analyzer:
strict-raw-types: true
errors:
# This package imports much of the implementation libraries of the
# 'analyzer' (and sometimes the '_fe_analyzer_shared' package), because it
# is tightly integrated. This will not likely change any time soon.
# 'analyzer' package, because it is tightly integrated. This will not
# likely change any time soon.
implementation_imports: ignore
linter:
+3 -3
View File
@@ -2711,7 +2711,7 @@
"name": "unit tests",
"arguments": [
"-nanalyzer-unittest-asserts-${mode}-${system}",
"pkg/(analyzer|analysis_server|analyzer_cli|analyzer_plugin|server_plugin)"
"pkg/(analyzer|analysis_server|analysis_server_plugin|analyzer_cli|analyzer_plugin)"
],
"shards": 9,
"fileset": "analyzer_unit_tests"
@@ -2983,7 +2983,7 @@
"name": "package unit tests and macro build tests",
"arguments": [
"-nunittest-asserts-${mode}-${system}-${arch}",
"pkg/pkg/(?!(analyzer*|analysis_server|compiler|dev_compiler|js_runtime|front_end|kernel|frontend_server|nnbd_migration|dartdev/test/native_assets|server_plugin|vm_service)/)",
"pkg/pkg/(?!(analyzer*|analysis_server|analysis_server_plugin|compiler|dev_compiler|js_runtime|front_end|kernel|frontend_server|nnbd_migration|dartdev/test/native_assets|vm_service)/)",
"macro_build"
],
"shards": 3,
@@ -3104,7 +3104,7 @@
"name": "package unit tests",
"arguments": [
"-nunittest-asserts-${mode}-${system}-${arch}",
"pkg/pkg/(?!(analyzer*|analysis_server|compiler|dev_compiler|js_runtime|front_end|kernel|frontend_server|nnbd_migration|dartdev/test/native_assets|server_plugin|vm_service)/)"
"pkg/pkg/(?!(analyzer*|analysis_server|analysis_server_plugin|compiler|dev_compiler|js_runtime|front_end|kernel|frontend_server|nnbd_migration|dartdev/test/native_assets|vm_service)/)"
]
}
]