Commit Graph

30 Commits

Author SHA1 Message Date
Jens Johansen 0d4b08caaa [analyzer] Use QueueList by default in SourceFileEdit
Adding edits (e.g. via `dart fix --apply` are often done with
`List.insert(0, whatnot)` which takes O(n) time.
Here QueueList that can insert fast at both ends is used instead
(and we use `addFirst` instead of `insert(0)`.

On the example from
https://github.com/feinstein/google-i18n-address-dart.git we go from:

```
$ time dart fix --use-aot-snapshot --apply
[...]
249517 fixes made in 255 files.

real    3m55.810s
user    4m1.209s
sys     0m3.714s

(resetting)
$ time dart fix --use-aot-snapshot --apply
[...]
249517 fixes made in 255 files.

real    3m33.966s
user    3m37.588s
sys     0m2.058s

(resetting)
$ time dart fix --use-aot-snapshot --apply
[...]
249517 fixes made in 255 files.

real    3m36.525s
user    3m40.083s
sys     0m1.907s
```

to:

```
$ time dart fix --use-aot-snapshot --apply
[...]
249517 fixes made in 255 files.

real    0m9.970s
user    0m12.676s
sys     0m2.100s

(resetting)
$ time dart fix --use-aot-snapshot --apply
[...]
249517 fixes made in 255 files.

real    0m9.862s
user    0m12.926s
sys     0m1.797s

(resetting)
$ time dart fix --use-aot-snapshot --apply
[...]
249517 fixes made in 255 files.

real    0m9.612s
user    0m12.712s
sys     0m1.834s
```

Statistics on the `real` runtime:

```
    N           Min           Max        Median           Avg        Stddev
x   3       213.966        235.81       216.525     222.10033     11.941664
+   3         9.612          9.97         9.862     9.8146667    0.18363369
Difference at 95.0% confidence
        -212.286 +/- 19.1415
        -95.581% +/- 8.61838%
        (Student's t, pooled s = 8.44503)
```

For `lsp_many_prefer_single_quotes_violations_benchmark.dart --sizes=3200`:

Before from something like:

```
Initial analysis: 0.115654
First code action call: 0.835152
Subsequent action call 1: 0.538592
Subsequent action call 2: 0.561636
Select all code action call: 1.564402
```

After to something like:
```
Initial analysis: 0.086985
First code action call: 0.411660
Subsequent action call 1: 0.171566
Subsequent action call 2: 0.193708
Select all code action call: 1.107339
```

Statistics on 5 runs gives:

First code action call:

```
Difference at 95.0% confidence
        -0.44381 +/- 0.0261597
        -52.4602% +/- 3.09218%
        (Student's t, pooled s = 0.0179367)
```

Subsequent action call 1:

```
Difference at 95.0% confidence
        -0.381012 +/- 0.0195618
        -69.9139% +/- 3.5895%
        (Student's t, pooled s = 0.0134128)
```

Subsequent action call 2:

```
Difference at 95.0% confidence
        -0.360077 +/- 0.0265277
        -64.634% +/- 4.76173%
        (Student's t, pooled s = 0.0181891)
```

Select all code action call:

```
Difference at 95.0% confidence
        -0.405855 +/- 0.027662
        -26.7277% +/- 1.82169%
        (Student's t, pooled s = 0.0189668)
```

Change-Id: I3868afaa8c32a24c01c3a52bd8a53d5e8e4e3afe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427401
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-16 00:45:34 -07:00
Sigurd Meldgaard 2fe05bd568 Reland "Migrate to use pub workspace"
This is a reland of commit b9b77058a9

Original change's description:
> Migrate to use pub workspace
>
> Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.
>
> All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.
>
> All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.
>
> Bug: https://github.com/dart-lang/sdk/issues/56220
> Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
> Tested: relies on CQ of existing tests. Should have no effect on functionality
> CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I29afabade2d2447dea05121cb87ff50bb21a4b76
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,flutter-web-try
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `//
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415561
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-20 06:19:16 -07:00
Sigurd Meldgaard 6c4de1ab7e Revert "Migrate to use pub workspace"
This reverts commit b9b77058a9.


Revert "Add missing sample pubspec to workspace"

This reverts commit 892ea15ac7.


These seem to break the engine.

Change-Id: Ieee26deb7928c3869a1b6265326c3ce568ffe731
Tested: this is a revert.
CoreLibraryReviewExempt: this is a revert
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415582
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 09:08:20 -07:00
Sigurd Meldgaard b9b77058a9 Migrate to use pub workspace
Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.

All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.

All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 05:21:40 -07:00
Sigurd Meldgaard a9ab52bcbb Language version bumps for publish_to: none pkgs
Also a separate pubspec for the tools/ folder

Extracted from https://dart-review.googlesource.com/c/sdk/+/397164

Change-Id: If49a6ede07e4864d0c0fcb210c04c18c804849df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412041
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-02-27 00:48:40 -08:00
Devon Carew 98befcf281 [pkg] rev packages to have a min sdk verison of at least 3.0
Change-Id: I365abf095f0801bb8ce864f3bbaa57ff298164c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402881
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2025-01-06 14:54:35 -08:00
Konstantin Shcheglov 895540889e Update SDK constraints for SDK packages.
https://dart-review.googlesource.com/c/sdk/+/287660 implements it.
I want to fix pre-existing violations before enabling.

Bug: https://github.com/dart-lang/sdk/issues/34978
Change-Id: Ie7731162c643018a2312b265f444bc00534c0a51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287664
Reviewed-by: Leon Senft <leonsenft@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-09 19:52:47 +00:00
Devon Carew 7835934d7f [pkg/analysis_server_client] add 'publish_to: none' to the pubspec
Change-Id: Ia15e2f27d1ceca4497a50c37ee24e61d4a167019
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268369
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-08 20:00:46 +00:00
Devon Carew e9709fe0b8 [pkg/analysis_server_client] deprecate the package and rev the version
Change-Id: I6a5079911411851011ef0f29b0283a16557e6ff0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267680
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-07 17:01:02 +00:00
Devon Carew de55cba4d0 [pkg/analysis_server_client] refactor member sort test
This refactors the member sort test so that this package does not depend on unpublished packages
(analysis_server, ...). This makes it possible to publish this package without having to have
local (non-git) modifications.

Change-Id: I52bdaa459c2e219f38ac930468647b4d7c4165e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265001
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-10-20 18:44:15 +00:00
Devon Carew 93d2077a7d [pkg/analysis_server_client] rev version in preparation for publishing
Change-Id: I60f9485bf0dd76123bb42214ece4030e0a8fd5c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264882
Commit-Queue: Devon Carew <devoncarew@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-10-19 20:00:07 +00:00
Devon Carew 9282573e2c [analyzer] use package:lints for pkg/analysis_server_client, pkg/analyzer_plugin
Change-Id: I97d30af3930c3f65532d77dee06de57ce5f5fc20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250766
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-06 19:54:00 +00:00
Devon Carew f7c46f145c [pkg] prefer 'any' deps for package dev dependencies
Tested: CI validation
Change-Id: If65cc156130a65ffe00c6f1660ac320e2921afae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246053
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2022-05-27 01:34:59 +00:00
Devon Carew 2a20d4be24 [pkg] ensure each publishable package has a repository pubspec field
Change-Id: I06c0d10c87c3f329098352a7abe9ef9fa0b1532e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241504
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-04-19 22:13:51 +00:00
Konstantin Shcheglov 66598d3e82 Switch analysis_server_client to language 2.12, so null safety, but opt-out files.
Protocol files are generated, so should be updated together with
analysis_server protocol files.

Change-Id: I8c3c7a5aecd2f7ff70c531bb794df3aed21888b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-31 03:34:22 +00:00
Paul Berry 7d3bc4862d Rename pkg/analysis_tool to pkg/analyzer_utilities.
It's no longer just for the tools in the `tool` directory; it also
contains test utilities for use by the analyzer and related packages.

Change-Id: I0f8cf57f24ea7aad8e2177e43ee2bcb2ab3030da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171704
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-13 17:46:30 +00:00
Paul Berry 596198fb74 Share logic of package_root.dart
This CL unifies the implementations of `package_root.dart` found in
packages `analysis_server`, `analysis_server_client`, `analyzer`, and
`analyzer_plugin`.

This should make it easier to re-use this logic in other packages,
such as `nnbd_migration`.

Change-Id: I0da44edb379b8e929dd0b1c16a6989c1e9418acb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-11-11 18:09:18 +00:00
Devon Carew 932712b602 update pubspec to reflect actual packages used
Change-Id: I02b10f92d858d0303f1a71e649395fb013f437aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159141
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-08-18 17:11:30 +00:00
Janice Collins 364b386fe2 Prepare for analysis_server_client 1.1.3.
Updates changelog and dependencies in pubspec.yaml, and I verified
by hand that the tests pass when run with the stable SDK.

Bug: https://github.com/dart-lang/sdk/issues/41679
Change-Id: Ibc2883e319678271d77dc4efa3fe4a9d61d9ce68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145621
Commit-Queue: Janice Collins <jcollins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-30 20:27:44 +00:00
Brian Wilkerson 2310768468 Prepare to publish analysis_server_client so that dartfix can use the new API
Change-Id: I677d7158e587b68a29b7cacef9acc9e1cf2597af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127962
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2019-12-11 14:26:21 +00:00
Sam Rawlins 7db3b15a48 Update changelog for analysis_server_client 1.1.2
Change-Id: Ic38c7bf0bd4176f569dce201fe3e3ea9c0869438
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123885
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-11-01 16:59:32 +00:00
danrubel 1c5911982e add includePedanticFixes flag to dartfix protocol
Change-Id: I43c40eacf038beed6245ec873e746dcbb1ed80df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-08-05 20:18:05 +00:00
danrubel 6c680a0ebd Update dartfix readme and update version numbers
* Update the readme to discuss required vs suggested fixes
* Remove the out-of-date options section from the readme
* Update dartfix and analysis_server_client versions and changelog

Change-Id: Ida4b30f9f89eb84a2fe856f61562ff73bf6725da
Reviewed-on: https://dart-review.googlesource.com/c/92153
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2019-02-07 01:16:56 +00:00
Dan Rubel 784ad29470 Update dartfix to check analysis server protocol version
This updates dartfix to more narrowly verify the analysis server
protocol version and print instructions for the user if the protocol
version expected by dartfix is incompatible with the current Dart SDK.
This is necessary because the edit.dartfix protocol is experimental
and will continue to evolve.

Change-Id: Ib31eb594a8a94416cb4fc676e7da9150f8c99b6a
Reviewed-on: https://dart-review.googlesource.com/c/84780
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-19 21:14:28 +00:00
Dan Rubel aa8cc30e5c Update ServerConnectionHandler to check the protocol version
... as well as reworking the example to use notification handlers and
addressing comments in https://dart-review.googlesource.com/c/sdk/+/83520

Change-Id: I27959cba79953d95d1afd851ab6a5f137dff47db
Reviewed-on: https://dart-review.googlesource.com/c/83580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-08 21:10:06 +00:00
Dan Rubel a074bcf93c Update dartfix package for publication
Updates to dartfix for publication including:
* add changelog, readme, and license
* update pubspec version and executables

along with a collection of smaller changes including:
* test cleanup
* remove duplicate time value from verbose output
* read dartfix pubspec version and pass that to analysis server

Change-Id: Ifa94df45e6cbcf9a98f7bf393c22e06eaab48c38
Reviewed-on: https://dart-review.googlesource.com/c/82240
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-31 17:36:51 +00:00
Dan Rubel c580e8cac6 Cleanup analysis_server_client package
Clients may now optionally add clientId and clientVersion information
when starting the analysis server.

In addition, this CL adds an example of how to use this package
and updates the changelog, readme and pubspec.

Change-Id: I969a13a7d8379d6289fbbbc5f8d1b66315aa6a37
Reviewed-on: https://dart-review.googlesource.com/c/82165
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-31 14:56:10 +00:00
Kevin Moore 4d5c5ecdbf Update synced version of pkg:test
Also updated the package references in a number of pubspecs to
more closely align with the package versions that are in the SDK

Change-Id: I061951587befa4211ac7455cf1179911eb07efc0
Reviewed-on: https://dart-review.googlesource.com/c/79920
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2018-10-16 16:12:38 +00:00
Brian Wilkerson db6e377e6d Make analysis_server_client Dart 2 safe
Change-Id: Iab06cb5b779599a1a107fa6fdf832345950fa84c
Reviewed-on: https://dart-review.googlesource.com/48322
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-25 15:20:36 +00:00
Max Kim 4e42dbc1f9 Add analysis_server_client without analysis_server.
BUG=
R=brianwilkerson@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2994723003 .
2017-08-08 14:57:43 -07:00