Commit Graph

25 Commits

Author SHA1 Message Date
danrubel f7d3e5bebf Add dartfix --server option
This adds a --server option for specifying the analyis server snapshot
to be used when calculating fixes.

Change-Id: I0adc3148c030d23a9a62883d842851709cb78168
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106220
Auto-Submit: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-18 03:07:58 +00:00
danrubel f69d5dc2c2 show analyzer details in dartfix
This updates dartfix to display details about the analysis process
if the analysis server provides them.

Change-Id: I0b2a7e8267b92e1eefd1ce90aa53a85cc91c48d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105549
Commit-Queue: Dan Rubel <danrubel@google.com>
Auto-Submit: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-11 22:46:13 +00:00
danrubel a3348ab702 sort some dartfix classes
Change-Id: I0655c6ae7d06219ee17957c9c49e90fbf8afe63d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105548
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-11 22:46:13 +00:00
Dan Rubel b324850eae cleanup list of fixes in dartfix help text
This CL cleans up the displayed help text, better organizes and displays
the list of fixes that are or can be applied, and addresses
a comment in https://dart-review.googlesource.com/c/sdk/+/105002

Change-Id: I2e71001ae7eda61b3b01ce999cb9fdca968a9b93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105322
Commit-Queue: Dan Rubel <danrubel@google.com>
Auto-Submit: Dan Rubel <danrubel@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2019-06-06 19:57:12 +00:00
Dan Rubel ba8e5f6535 list fixes when displaying help
This removes this --list option from dartfix and instead displays
the list of fixes when the --help option is specified.

Partially addresses https://github.com/dart-lang/sdk/issues/36875

Change-Id: Ibd8b124c2c20a752f7e661672eac8aa2e4483b26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105002
Auto-Submit: Dan Rubel <danrubel@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-06 14:22:15 +00:00
Devon Carew ab84e36989 [dartfix] refactor the dartfix cli UI a bit
Change-Id: I9935ace979b0302d4f68c8a84ed9886a0ccf0c4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101761
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-05-08 18:51:11 +00:00
danrubel afe609d2c2 Update NNBD migration to add import as necessary
... and simplify apply code edits

Change-Id: I6f205df29ffd42341e2244ff3a5609ba005adcfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98612
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-04-04 20:31:23 +00:00
danrubel 0669c2cee5 fix dartfix modification of analysis options
... and improve NNBD YamlException error message
Address comments in https://dart-review.googlesource.com/c/sdk/+/98524

Change-Id: I0e44ca8b887b47f1fac247650402032d1e5f5b23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-04-03 19:34:01 +00:00
danrubel 1d6a7bee36 rework dartfix NNBD to use FixCodeTask.processPackage
This generalizes the dartfix NNBD processing of packages so that
other fixes can process packages in a similar manner.
In addition, if at least one package to be migrated to NNBD
cannot be marked as NNBD or is not already NNBD,
then no additional NNBD processing is done.

This also addresses comments in
https://dart-review.googlesource.com/c/sdk/+/98429

Change-Id: I406d9d395a0ee8a85cc5b3d7be311a76e1e48bdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98524
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-04-03 15:52:36 +00:00
danrubel ff99692175 dartfix update analysis options to enable NNBD
This updates the analysis server edit.dartfix functionality
to enable NNBD by modifying the analysis options file,
creating that file if necessary.

Change-Id: I831182e49e585ef0d851d4eb715885e90954bcad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98429
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-04-02 15:29:59 +00:00
danrubel 1c173c2ce7 Enhance dartfix to allow including and excluding specific fixes
This add several options to the dartfix command line
so that only specific fixes can be applied rather than all fixes.

Fix https://github.com/dart-lang/sdk/issues/35539

Change-Id: I8bb89696b0b47a291ed22aa00d4787f3ea5aa4be
Reviewed-on: https://dart-review.googlesource.com/c/91780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-02-01 16:55:17 +00:00
danrubel fe6b384ff5 revise dartfix protocol version check
Change-Id: I655773791189dd5cf133ade8a48ed39ff48b6345
Reviewed-on: https://dart-review.googlesource.com/c/89402
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-15 15:52:54 +00:00
danrubel 93306f5ec0 Add dartfix integration test
... and update changelog and tweak SDK constraints

Change-Id: Ifb3e733b84c3aecad0ff8fe805f77ef497248f3b
Reviewed-on: https://dart-review.googlesource.com/c/86600
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-12-17 04:37:07 +00:00
danrubel b607f65217 More dartfix tests
This adds a test that asserts the analysis_server_client version
matches the version specified in the dartfix pubspec.

In addition, this remove code that reads the version
from dartfix pubspec.yaml because the pubspec.yaml is not present
when dartfix is activated and run via pub global activate.

Change-Id: I6deed00428afb8844d03a9604699e0c089d7ce6f
Reviewed-on: https://dart-review.googlesource.com/c/84940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-20 17:47:27 +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
danrubel e39fa29bd6 analysis_server_client API tweaks before publish
* Rename ClientListener to ServerListener
* Change ServerConnectionHandler on --> implements NotificationHandler

Change-Id: I459e4c566971d49790e12b8f1386ae80db33b38b
Reviewed-on: https://dart-review.googlesource.com/c/84560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-15 21:44:03 +00:00
Dan Rubel bec2daba02 Cleanup analysis_server_client API
This reduces the client functionality and renames some
of the classes and methods in the API.

Specifically:
- rename Server to Client
- rename ServerConnectionHandler to ConnectionHandler
- rename Client.start to Client.startServer
- rename Client.stop to Client.stopServer
- rename Client.kill to Client.killServer
- extract behavior from Client into Listeners
- move some of the listeners into dartfix
- make several Client fields private
Change-Id: Ie71b0ac55b489099a848764251e8369c27f6ea2d
Reviewed-on: https://dart-review.googlesource.com/c/84460
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-15 15:06:55 +00:00
Dan Rubel 8178cb602e Refactor dartfix to use new notification handlers
and narrow the SDK version supported by dartfix

Change-Id: I63317a3a89d68d74815f5c192970f71bfbc422d4
Reviewed-on: https://dart-review.googlesource.com/c/83720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@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 6294171508 comment cleanup
Change-Id: I83bf6513b1acd9faedb14f1bf44e32df76dd8528
Reviewed-on: https://dart-review.googlesource.com/c/82164
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-31 14:25:35 +00:00
Dan Rubel 645ec2e8b5 Meld server runner in dart fix with analysis_server_client
Change-Id: I86a2e7b815ff6d3beea2d968c5e34c4e3feae2c3
Reviewed-on: https://dart-review.googlesource.com/c/82080
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-30 20:04:58 +00:00
danrubel e414b5823d Improve dartfix output
* include file path in suggestion output
* more verbose output for debugging in the field
* update pubspec.yaml
* display paths relative to the target directories

Change-Id: I64e519d72773c3e56e4502fab7591c43fda35bf3
Reviewed-on: https://dart-review.googlesource.com/c/81860
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-29 16:47:30 +00:00
danrubel 0fe448a996 Revise the analysis server edit.dartfix protocol
This updates the edit.dartfix protocol to separate location from the text
describing the changes so that the dartfix client can choose
what location information to display and how it should be displayed.

Change-Id: Ic56a4cb187538571d60136d6de9265d879fccb53
Reviewed-on: https://dart-review.googlesource.com/c/81780
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-29 01:50:27 +00:00
Dan Rubel b8fd29e0bb Remove dartfix dependencies on analysis server
This replaces dartfix dependencies on ...
* analysis_server
* analyzer (except for testing)
* analyzer_plugins

... with a dependency on analysis_server_client.

Change-Id: If511de69333e925ae082fa06c5114188c3c405b1
Reviewed-on: https://dart-review.googlesource.com/c/81342
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-24 19:26:58 +00:00
danrubel a82e025739 Move dartfix to its own package
Fix https://github.com/dart-lang/sdk/issues/34765

Change-Id: I44b3ccc4861b383601fea1b006f1fd4726b11062
Reviewed-on: https://dart-review.googlesource.com/c/81080
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2018-10-22 17:50:25 +00:00