dart-archive / dart2_fix

A tool to migrate API usage to Dart 2
https://pub.dartlang.org/packages/dart2_fix
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

first functioning implementation #5

Closed devoncarew closed 6 years ago

devoncarew commented 6 years ago

The V1 implementation of an API migration tool. The uses the analysis server to location uses of deprecated symbols in user code, and matches those uses up with known renamed Dart1 => Dart2 constants.

A likely improved future version will instead get information from a more toolable @deprecated annotation, and apply analysis server quick fixes. This will be bot more automatic and more precise.

@bwilkerson @kevmoo @scheglov

devoncarew commented 6 years ago

Note that the translation table was hand-written, so isn't guaranteed to be typo or copy/paste errors free.

kevmoo commented 6 years ago

Test it on pkg:test ?

On Wed, Mar 28, 2018 at 6:19 AM Brian Wilkerson notifications@github.com wrote:

@bwilkerson approved this pull request.

In pubspec.yaml https://github.com/dart-lang/dart2_fix/pull/5#discussion_r177745770:

@@ -6,8 +6,11 @@ environment: sdk: '>=1.20.1 <2.0.0'

dependencies:

  • analysis_server_lib: ^0.1.3

If this is where the code to interface with the server lives, then we should unify it with 'analysis_server_client'.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dart-lang/dart2_fix/pull/5#pullrequestreview-107672780, or mute the thread https://github.com/notifications/unsubscribe-auth/AABCiqBsWKWJtpgccojgm3yb1-LbEQIAks5ti438gaJpZM4S-GKO .

devoncarew commented 6 years ago

Test it on pkg:test ?

I updated the travis script to run the unit tests.

kevmoo commented 6 years ago

Awesome. Try a dry-run on pkg:test? It covers about everything....

On Wed, Mar 28, 2018 at 8:28 AM Devon Carew notifications@github.com wrote:

Test it on pkg:test ?

I updated the travis script to run the unit tests.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dart-lang/dart2_fix/pull/5#issuecomment-376928745, or mute the thread https://github.com/notifications/unsubscribe-auth/AABCivi7L9BYfYIczF1tEY_duFNdYKHkks5ti6wwgaJpZM4S-GKO .

devoncarew commented 6 years ago

Test it on pkg:test ?

Ah, I misunderstood. I've tried it on a few projects - will try on package:test as well.

kevmoo commented 6 years ago

Ah, I misunderstood. I've tried it on a few projects - will try on package:test as well.

I just did. All good except for one collision with a local var named json.

Good job!

devoncarew commented 6 years ago
Checking ../test...                     

../test/lib/pub_serve.dart
  line 75 • HTML_ESCAPE => htmlEscape
  line 77 • HTML_ESCAPE => htmlEscape

../test/lib/src/backend/live_test_controller.dart
  line 173 • Zone.ROOT => Zone.root

../test/lib/src/frontend/spawn_hybrid.dart
  line 184 • UTF8 => utf8

../test/lib/src/frontend/stream_matcher.dart
  line 158 • Duration.ZERO => Duration.zero

../test/lib/src/runner/browser/browser.dart
  line 102 • UTF8 => utf8

../test/lib/src/runner/browser/browser_manager.dart
  line 213 • JSON => json

../test/lib/src/runner/browser/dartium.dart
  line 193 • JSON => json
  line 200 • JSON => json
  line 205 • JSON => json

../test/lib/src/runner/browser/platform.dart
  line 194 • HTML_ESCAPE => htmlEscape
  line 203 • HTML_ESCAPE => htmlEscape
  line 369 • UTF8 => utf8

../test/lib/src/runner/browser/safari.dart
  line 37 • JSON => json

../test/lib/src/runner/compiler_pool.dart
  line 115 • JSON => json
  line 125 • JSON => json
  line 132 • UTF8 => utf8

../test/lib/src/runner/node/platform.dart
  line 122 • UTF8 => utf8
  line 236 • UTF8 => utf8

../test/lib/src/runner/reporter/json.dart
  line 279 • JSON => json

../test/lib/src/util/dart.dart
  line 29 • UTF8 => utf8

../test/lib/src/util/io.dart
  line 243 • JSON => json
  line 243 • UTF8 => utf8

../test/lib/src/utils.dart
  line 31 • UTF8 => utf8
  line 327 • BASE64 => base64

../test/test/frontend/test_chain_test.dart
  line 34 • JSON => json
  line 56 • JSON => json
  line 71 • JSON => json

../test/test/runner/configuration/global_test.dart
  line 35 • JSON => json
  line 54 • JSON => json
  line 73 • JSON => json
  line 77 • JSON => json
  line 101 • JSON => json

../test/test/runner/configuration/platform_test.dart
  line 22 • JSON => json
  line 51 • JSON => json
  line 93 • JSON => json
  line 112 • JSON => json
  line 128 • JSON => json
  line 143 • JSON => json
  line 160 • JSON => json
  line 180 • JSON => json
  line 216 • JSON => json
  line 261 • JSON => json
  line 278 • JSON => json
  line 293 • JSON => json

../test/test/runner/configuration/presets_test.dart
  line 22 • JSON => json
  line 46 • JSON => json
  line 73 • JSON => json
  line 103 • JSON => json
  line 133 • JSON => json
  line 159 • JSON => json
  line 174 • JSON => json
  line 204 • JSON => json
  line 221 • JSON => json
  line 249 • JSON => json
  line 273 • JSON => json
  line 292 • JSON => json
  line 322 • JSON => json
  line 363 • JSON => json
  line 379 • JSON => json
  line 390 • JSON => json
  line 407 • JSON => json
  line 434 • JSON => json
  line 450 • JSON => json
  line 468 • JSON => json
  line 481 • JSON => json
  line 496 • JSON => json

../test/test/runner/configuration/tags_test.dart
  line 21 • JSON => json
  line 52 • JSON => json
  line 74 • JSON => json
  line 102 • JSON => json
  line 132 • JSON => json
  line 161 • JSON => json
  line 188 • JSON => json
  line 209 • JSON => json
  line 244 • JSON => json
  line 258 • JSON => json
  line 269 • JSON => json
  line 286 • JSON => json
  line 303 • JSON => json
  line 316 • JSON => json
  line 331 • JSON => json
  line 350 • JSON => json
  line 361 • JSON => json
  line 376 • JSON => json
  line 387 • JSON => json

../test/test/runner/configuration/top_level_error_test.dart
  line 18 • JSON => json
  line 31 • JSON => json
  line 51 • JSON => json
  line 66 • JSON => json
  line 79 • JSON => json
  line 90 • JSON => json
  line 101 • JSON => json
  line 111 • JSON => json
  line 120 • JSON => json
  line 129 • JSON => json
  line 139 • JSON => json
  line 148 • JSON => json
  line 161 • JSON => json
  line 170 • JSON => json
  line 181 • JSON => json
  line 189 • JSON => json
  line 200 • JSON => json
  line 211 • JSON => json
  line 225 • JSON => json
  line 240 • JSON => json
  line 253 • JSON => json
  line 266 • JSON => json
  line 278 • JSON => json
  line 293 • JSON => json
  line 308 • JSON => json
  line 319 • JSON => json
  line 333 • JSON => json
  line 348 • JSON => json
  line 362 • JSON => json
  line 372 • JSON => json

../test/test/runner/configuration/top_level_test.dart
  line 37 • JSON => json
  line 39 • JSON => json
  line 58 • JSON => json
  line 102 • JSON => json
  line 120 • JSON => json
  line 139 • JSON => json
  line 170 • JSON => json
  line 189 • JSON => json
  line 213 • JSON => json
  line 230 • JSON => json
  line 249 • JSON => json
  line 266 • JSON => json
  line 289 • JSON => json
  line 311 • JSON => json
  line 334 • JSON => json
  line 357 • JSON => json
  line 419 • JSON => json
  line 429 • JSON => json
  line 447 • JSON => json
  line 471 • JSON => json
  line 490 • JSON => json
  line 511 • JSON => json
  line 535 • JSON => json
  line 559 • JSON => json
  line 601 • JSON => json

../test/test/runner/engine_test.dart
  line 143 • Duration.ZERO => Duration.zero

../test/test/runner/json_reporter_test.dart
  line 540 • JSON => json
  line 547 • JSON => json

../test/test/runner/load_suite_test.dart
  line 56 • Duration.ZERO => Duration.zero
  line 60 • Duration.ZERO => Duration.zero
  line 86 • Duration.ZERO => Duration.zero

../test/tool/host.dart
  line 169 • JSON => json
  line 173 • JSON => json

Found 149 fixes in 2.3s.

To apply these fixes, run again using the --apply argument.