Skip to content

Commit cfc705c

Browse files
srawlinsCommit Queue
authored and
Commit Queue
committed
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: #53402 Change-Id: I70197fdf61dd5862c2220d8ed5dd0880a1593ead Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363600 Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Alexander Thomas <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent 43fa24f commit cfc705c

File tree

12 files changed

+297
-61
lines changed

12 files changed

+297
-61
lines changed
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Contributing
2+
3+
Contributions welcome! Please follow the guide in [Contributing][contributing].
4+
5+
## Building
6+
7+
If you want to build Dart yourself, here is a guide to [getting the source,
8+
preparing your machine to build the SDK, and building][building].
9+
10+
There are more documents on our [wiki][]. Once set up to build the SDK, run:
11+
12+
```none
13+
./tools/build.py -mrelease create_sdk
14+
```
15+
16+
## Coding style
17+
18+
The analyzer packages are coded with a styled specified in our [coding style
19+
document][coding style].
20+
21+
[building]: https://github.com/dart-lang/sdk/wiki/Building
22+
[coding style]: https://github.com/dart-lang/sdk/blob/main/pkg/analyzer/doc/implementation/coding_style.md
23+
[contributing]: https://github.com/dart-lang/sdk/wiki/Contributing
24+
[wiki]: https://github.com/dart-lang/sdk/wiki

pkg/analysis_server_plugin/LICENSE

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Copyright 2024, the Dart project authors.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above
9+
copyright notice, this list of conditions and the following
10+
disclaimer in the documentation and/or other materials provided
11+
with the distribution.
12+
* Neither the name of Google LLC nor the names of its
13+
contributors may be used to endorse or promote products derived
14+
from this software without specific prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

pkg/analysis_server_plugin/OWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
file:/tools/OWNERS_ANALYZER

pkg/analysis_server_plugin/README.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# analysis\_server\_plugin package
2+
3+
This package is being developed for the second incarnation of Dart Analyzer
4+
plugins. It is in an intermediate state, and a few things must be kept in mind
5+
during this phase of development:
6+
7+
1. **This package is not to be published on pub yet.** We will flesh out a
8+
stable API befoure the first publish.
9+
2. **In order to support the above point, no pub-publishable code can depend on
10+
this package.** At no point can we introduce a dependency from a package
11+
like `analyzer` or `analyzer_plugin` to this package. If we did so, then at
12+
the next time we published _that_ package to pub, we would need to publish
13+
_this_ package to pub. No. In short, I think what this means is that only
14+
the `analysis_server` package can depend on this package.
15+
16+
## Migration of code between packages
17+
18+
As part of the design of the new Dart Analyzer plugins, much code will shift
19+
around, in a few directions.
20+
21+
* **`analysis_server` package to `analysis_server_plugin` package:** The API of
22+
the new Dart Analyzer plugins focuses around two primary concepts: lint rules
23+
and quick fixes. Quick assists may be chosen as a third important concept.
24+
Lint rule code has typically lived in the `analyzer` package, and does not
25+
need to move. (It's presence in the `analyzer` package could be deprecated in
26+
favor of this package, but it is not important for the implementation.)
27+
28+
Quick fixes, however, have only existed in concept, and interface, and API,
29+
in the `analysis_server` package. That code needs to move to this package in
30+
order to be used in a Dart Analyzer plugin.
31+
32+
**A move from the `analysis_server` package to this package is not a breaking
33+
change.**
34+
35+
* **`analyzer_plugin` package to `analysis_server_plugin` package:** Care is
36+
being taken to decide where Dart Analyzer plugin code will live and how it
37+
will be published. It is not decided yet what the ultimate package API will
38+
be. Some code from **analyzer_plugin** may move to this package.
39+
40+
**A move from the `analyzer_plugin` package is a breaking change. Extreme
41+
care must be taken.**
42+
43+
* **`analyzer_plugin` package to `analysis_server` package:** There will be
44+
many components of the analysis server that currently live in
45+
`analyzer_plugin`, because they were necessary for the first version of Dart
46+
Analyzer plugins), but are not part of the new Dart Analyzer plugins. These
47+
components can be moved safely back into the `analysis_server` package.
48+
49+
In terms of priority, it is not crucial for such code to be moved out of the
50+
`analyzer_plugin` package. It can live there indefinitely, and the
51+
`analysis_server` package can continue to depend on code from the
52+
`analyzer_plugin` package, as shipped in the SDK.
53+
54+
**A move from the `analyzer_plugin` package is a breaking change. Extreme
55+
care must be taken.**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
include: package:lints/recommended.yaml
2+
3+
analyzer:
4+
language:
5+
strict-casts: true
6+
strict-inference: true
7+
strict-raw-types: true
8+
errors:
9+
# This package imports much of the implementation libraries of the
10+
# 'analyzer' package, because it is tightly integrated. This will not
11+
# likely change any time soon.
12+
implementation_imports: ignore
13+
14+
linter:
15+
rules:
16+
- always_use_package_imports
17+
- avoid_dynamic_calls
18+
- avoid_redundant_argument_values
19+
- avoid_unused_constructor_parameters
20+
- flutter_style_todos
21+
- library_annotations
22+
- prefer_single_quotes
23+
- unawaited_futures
24+
- unnecessary_breaks
25+
- unnecessary_library_directive
26+
- unnecessary_parenthesis
27+
- unreachable_from_main
28+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Copyright (c) 2024, 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+
// TODO(srawlins): Move the contents of this imported library, here.
6+
export 'package:server_plugin/edit/fix/dart_fix_context.dart';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Copyright (c) 2024, 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+
// TODO(srawlins): Move the contents of this imported library, here.
6+
export 'package:server_plugin/edit/fix/fix.dart';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Copyright (c) 2024, 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+
// TODO(srawlins): Move the contents of this imported library, here.
6+
export 'package:server_plugin/edit/fix/fix_context.dart';
+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: analysis_server_plugin
2+
# This package is not yet intended for consumption on pub.dev. DO NOT publish.
3+
publish_to: none
4+
5+
environment:
6+
sdk: '>=3.3.0 <4.0.0'
7+
8+
# Use 'any' constraints here; we get our versions from the DEPS file.
9+
dependencies:
10+
# TODO(srawlins): Move all code from `server_plugin` here, and remove dep.
11+
server_plugin: any
12+
13+
# Use 'any' constraints here; we get our versions from the DEPS file.
14+
dev_dependencies:
15+
lints: any
16+
17+
dependency_overrides:
18+
_fe_analyzer_shared:
19+
path: ../_fe_analyzer_shared
20+
analyzer:
21+
path: ../analyzer
22+
analyzer_plugin:
23+
path: ../analyzer_plugin
24+
analyzer_utilities:
25+
path: ../analyzer_utilities
26+
args:
27+
path: ../../third_party/pkg/args
28+
async:
29+
path: ../../third_party/pkg/async
30+
boolean_selector:
31+
path: ../../third_party/pkg/boolean_selector
32+
cli_util:
33+
path: ../../third_party/pkg/cli_util
34+
clock:
35+
path: ../../third_party/pkg/clock
36+
collection:
37+
path: ../../third_party/pkg/collection
38+
convert:
39+
path: ../../third_party/pkg/convert
40+
crypto:
41+
path: ../../third_party/pkg/crypto
42+
dart_style:
43+
path: ../../third_party/pkg/dart_style
44+
file:
45+
path: ../../third_party/pkg/file/packages/file
46+
frontend_server_client:
47+
path: ../../third_party/pkg/webdev/frontend_server_client
48+
glob:
49+
path: ../../third_party/pkg/glob
50+
http:
51+
path: ../../third_party/pkg/http/pkgs/http
52+
http_multi_server:
53+
path: ../../third_party/pkg/http_multi_server
54+
http_parser:
55+
path: ../../third_party/pkg/http_parser
56+
intl:
57+
path: ../../third_party/pkg/intl
58+
js:
59+
path: ../js
60+
language_server_protocol:
61+
path: ../../third_party/pkg/language_server_protocol
62+
linter:
63+
path: ../linter
64+
lints:
65+
path: ../../third_party/pkg/lints
66+
logging:
67+
path: ../../third_party/pkg/logging
68+
matcher:
69+
path: ../../third_party/pkg/matcher
70+
memory_usage:
71+
path: ../../third_party/pkg/leak_tracker/pkgs/memory_usage
72+
meta:
73+
path: ../meta
74+
mime:
75+
path: ../../third_party/pkg/mime
76+
package_config:
77+
path: ../../third_party/pkg/package_config
78+
path:
79+
path: ../../third_party/pkg/path
80+
pool:
81+
path: ../../third_party/pkg/pool
82+
pub_semver:
83+
path: ../../third_party/pkg/pub_semver
84+
server_plugin:
85+
path: ../server_plugin
86+
shelf:
87+
path: ../../third_party/pkg/shelf/pkgs/shelf
88+
shelf_packages_handler:
89+
path: ../../third_party/pkg/shelf/pkgs/shelf_packages_handler
90+
shelf_static:
91+
path: ../../third_party/pkg/shelf/pkgs/shelf_static
92+
shelf_web_socket:
93+
path: ../../third_party/pkg/shelf/pkgs/shelf_web_socket
94+
source_map_stack_trace:
95+
path: ../../third_party/pkg/source_map_stack_trace
96+
source_maps:
97+
path: ../../third_party/pkg/source_maps
98+
source_span:
99+
path: ../../third_party/pkg/source_span
100+
stack_trace:
101+
path: ../../third_party/pkg/stack_trace
102+
stream_channel:
103+
path: ../../third_party/pkg/stream_channel
104+
string_scanner:
105+
path: ../../third_party/pkg/string_scanner
106+
telemetry:
107+
path: ../telemetry
108+
term_glyph:
109+
path: ../../third_party/pkg/term_glyph
110+
test:
111+
path: ../../third_party/pkg/test/pkgs/test
112+
test_api:
113+
path: ../../third_party/pkg/test/pkgs/test_api
114+
test_core:
115+
path: ../../third_party/pkg/test/pkgs/test_core
116+
test_descriptor:
117+
path: ../../third_party/pkg/test_descriptor
118+
test_reflective_loader:
119+
path: ../../third_party/pkg/test_reflective_loader
120+
typed_data:
121+
path: ../../third_party/pkg/typed_data
122+
unified_analytics:
123+
path: ../../third_party/pkg/tools/pkgs/unified_analytics
124+
usage:
125+
path: ../../third_party/pkg/usage
126+
vm_service:
127+
path: ../vm_service
128+
watcher:
129+
path: ../../third_party/pkg/watcher
130+
web_socket_channel:
131+
path: ../../third_party/pkg/web_socket_channel
132+
webkit_inspection_protocol:
133+
path: ../../third_party/pkg/webkit_inspection_protocol
134+
yaml:
135+
path: ../../third_party/pkg/yaml
136+
yaml_edit:
137+
path: ../../third_party/pkg/yaml_edit

pkg/server_plugin/README.md

+3-56
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,5 @@
11
# server\_plugin package
22

3-
This package is being developed for the second incarnation of Dart Analyzer
4-
plugins. It is in an intermediate state, and a few things must be kept in mind
5-
during this phase of development:
6-
7-
1. **This package is not to be published on pub.** Yet. We may decide to go
8-
forward with this package as a full replacement of the `analyzer_plugin`
9-
package, in which case we _would_ ultimately publish it. But we may choose a
10-
different plan. Until we finalize, this package is not to be published.
11-
2. **In order to support the above point, no pub-publishable code can depend on
12-
this package.** At no point can we introduce a dependency from a package
13-
like `analyzer` or `analyzer_plugin` to this package. If we did so, then at
14-
the next time we published _that_ package to pub, we would need to publish
15-
_this_ package to pub. No. In short, I think what this means is that only
16-
the `analsis_server` package can depend on this package (until we decide the
17-
final path to publishing the next Dart Analyzer plugins story.
18-
19-
## Migration of code between packages
20-
21-
As part of the design of the new Dart Analyzer plugins, much code will shift
22-
around, in a few directions.
23-
24-
* **`analysis_server` package to `server_plugin` package:** The API of the new
25-
Dart Analyzer plugins focuses around two primary concepts: lint rules and
26-
quick fixes. Quick assists may be chosen as a third important concept. Lint
27-
rule code has typically lived in the `analyzer` package, and does not need to
28-
move. (It's presense in the `analyzer` package could be deprecated in favor
29-
of this package, but it is not important for the implementation.)
30-
31-
Quick fixes, however, have only existed in concept, and interface, and API,
32-
in the `analysis_server` package. That code needs to move to this package in
33-
order to be used in a Dart Analyzer plugin.
34-
35-
**A move from the `analysis_server` package to this package is not a breaking
36-
change.**
37-
38-
* **`analyzer_plugin` package to `server_plugin` package:** Care is being taken
39-
to decide where Dart Analyzer plugin code will live and how it will be
40-
published. It is not decided yet what the ultimate package API will be. Some
41-
code from **analyzer_plugin** may move to this package.
42-
43-
**A move from the `analyzer_plugin` package is a breaking change. Extreme
44-
care must be taken.**
45-
46-
* **`analyzer_plugin` package to `analysis_server` package:** There will be
47-
many components of the analysis server that currently live in
48-
`analyzer_plugin`, because they were necessary for the first version of Dart
49-
Analyzer plugins), but are not part of the new Dart Analyzer plugins. These
50-
components can be moved safely back into the `analysis_server` package.
51-
52-
In terms of priority, it is not crucial for such code to be moved out of the
53-
`analyzer_plugin` package. It can live there indefinitely, and the
54-
`analysis_server` package can continue to depend on code from the
55-
`analyzer_plugin` package, as shipped in the SDK.
56-
57-
**A move from the `analyzer_plugin` package is a breaking change. Extreme
58-
care must be taken.**
3+
This package is being renamed as `analysis_server_plugin`. All code should move
4+
to that package soon, and then this directory will be deleted. This package was
5+
never published under the name `server_plugin`.

pkg/server_plugin/analysis_options.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ analyzer:
77
strict-raw-types: true
88
errors:
99
# This package imports much of the implementation libraries of the
10-
# 'analyzer' (and sometimes the '_fe_analyzer_shared' package), because it
11-
# is tightly integrated. This will not likely change any time soon.
10+
# 'analyzer' package, because it is tightly integrated. This will not
11+
# likely change any time soon.
1212
implementation_imports: ignore
1313

1414
linter:

tools/bots/test_matrix.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2711,7 +2711,7 @@
27112711
"name": "unit tests",
27122712
"arguments": [
27132713
"-nanalyzer-unittest-asserts-${mode}-${system}",
2714-
"pkg/(analyzer|analysis_server|analyzer_cli|analyzer_plugin|server_plugin)"
2714+
"pkg/(analyzer|analysis_server|analysis_server_plugin|analyzer_cli|analyzer_plugin)"
27152715
],
27162716
"shards": 9,
27172717
"fileset": "analyzer_unit_tests"
@@ -2983,7 +2983,7 @@
29832983
"name": "package unit tests and macro build tests",
29842984
"arguments": [
29852985
"-nunittest-asserts-${mode}-${system}-${arch}",
2986-
"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)/)",
2986+
"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)/)",
29872987
"macro_build"
29882988
],
29892989
"shards": 3,
@@ -3104,7 +3104,7 @@
31043104
"name": "package unit tests",
31053105
"arguments": [
31063106
"-nunittest-asserts-${mode}-${system}-${arch}",
3107-
"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)/)"
3107+
"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)/)"
31083108
]
31093109
}
31103110
]

0 commit comments

Comments
 (0)