* Rename isPreviewServerRunnning to isPreviewServerRunning
* Fix top "Migrating" checkbox upon navigation.
This change does not completely solve google3-compatibility, just the
web preview UI portion.
Work to improve any opt-out `// @dart=2.9` comments will follow.
Change-Id: Iee38650ab732179d82060b14bc7b657e3c560543
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178160
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Checking and unchecking a directory toggles the status of all child files which
are 'migrating' or 'opting out.' Files which are already migrated do not
change.
Checking and unchecking a file updates the status of all parent directories.
Directories with both 'migrating' and 'opting out' files are 'indeterminate'.
The difference between 'file' and 'directory' NavigationTreeNodes was
getting too hairy so I split into two subclasses.
Removed the keepingOptedOut status and added the indeterminate status.
Bug: https://github.com/dart-lang/sdk/issues/44101
Change-Id: Iea1a8c07b08c3d7956db51ca372437093457fe7f
https://github.com/dart-lang/sdk/issues/44124
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173600
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
I will need to add another callback in a follow-up CL, and it seems
silly to pass a bunch of closures to the DartFixListener constructor.
Change-Id: I969d1d90fca0889b131589248aaa1cec343a9059
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171700
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Previously, the user experience was an `UnimplementedError` with no
further information. Now the user gets an error message telling them
how they need to update the pubspec, which I believe was the original
implementation intent.
Note that the field `_packageIsNNBD` has been removed. Although the
comment for this field said it was tracking whether the package was
opted in to null safety, it actually had no effect (since the only
code path that would set it to `false` was after the
`UnimplementedError` and thus unreachable).
Change-Id: I3cef2f0a7203941b22e37e3ae1bee14806cfc9c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171621
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Instead of running `pub outdated` to see if the user's dependencies
have been migrated yet, the migration tool now examines all of the
transitive import dependencies of the user's code to see if they are
opted in to null safety. This produces a more accurate result than
`pub outdated`, because it is able to ignore files in transitive
package dependencies that aren't reachable via imports
(e.g. references to `package:analyzer` brought in by `package:test`).
Fixes#44061.
Bug: https://github.com/dart-lang/sdk/issues/44061
Change-Id: I38465bcbf35e8552f0060b5d51c0f1cfc5d18c7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170561
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This shows progress for work which happens after the migration suggestions have
been generated. This work is generating instrumentation details for the front
end.
When migrating the analyzer package, the progress indicated by this third
progress bar takes approximately the same time as generating suggestions (on
the same order of magnitude).
Fixes https://github.com/dart-lang/sdk/issues/44074
Change-Id: I0b40dd5e587b718bd1ef56d64f03929924cc430a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170563
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Currently the migrator can add `@required` from the preview, which will crash
the preview upon rerunning, if package:meta is not imported.
This change instead adds a /*required*/ hint when meta is not imported.
Additionally, /*required*/ is understood by the migrator just as if it were
`@required`.
Fixes https://github.com/dart-lang/sdk/issues/43751
Change-Id: I1ea532246b956feacedd179146372b13c65003df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169900
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Previously, we were switching test paths to drive `D` at the start of
the test, after the `package_config.json` file had already been
generated to drive `C`; as a result, it didn't apply. We will need
the `package_config.json` to apply when we flip the null safety flag
(so that the inputs to the migration tool are considered opted out
prior to migration). This CL reworks the test so that the paths are
modified as part of test set-up, so `package_config.json` gets put in
the right place.
Fixes#43883.
Bug: https://github.com/dart-lang/sdk/issues/43883
Change-Id: I08f79ddb07d7a5ecf640370a32334a7ceb92ceff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169421
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
With this change, the functionality of changing iterable method calls
such as `.firstWhere` into extension method calls such as
`.firstWhereOrNull` is working well enough that I think we can switch
it on.
We don't update the pubspec properly yet; that will be addressed in
follow-up CLs.
Change-Id: I758332e9752b12d399ecb5c70cf37bbc8da77d6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168988
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
We don't want inserted lines to receive their own line number for two reasons:
- It makes the line numbers displayed by the migration preview fail to
line up with the line numbers in the user's editor (since the lines
haven't been added yet)
- It makes navigation links within the migration tool point to the
wrong place, since these links are computed based on analysis of the
pre-migration code.
So instead, we supply a line number string of `(new)` for inserted lines.
This required refactoring the algorithm for
`UnitRenderer._computeRegionContent` a bit. Now, instead of trying to
accumulate the output HTML string all at once, we produce it one row
at a time, first accumulating the line text in a StringBuffer, and
then once the end of the line is reached, attaching the line number to
form a table row. Then we join together all the rows into a table
when we're done.
Change-Id: Ie18632186ddd0f4f5f33d4da41b4943759699e1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168987
Reviewed-by: Samuel Rawlins <srawlins@google.com>
The method we use to rename method calls to Iterable
(e.g. `firstWhere` -> `firstWhereOrNull`) causes a pair of consecutive
AtomicEdit objects to be generated: one to remove the old name
followed by one to add the new name. This was causing
InfoBuilder._explainUnit to update its output offsets incorrectly,
because it waited until after processing all of the AtomicEdit objects
pointing to a single source offset before updating the output offset.
What it needs to do instead is update the output offset (in the
variable called `offset`) after processing every single AtomicEdit.
Change-Id: I8ad51e20d4021c62c45542cec7f0f54a9ff3cf26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169000
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Well not quite all; migration_cli_test tests are a bit of a different
beast so I am going to tackle them separately. But this fixes over
1000 test failures, and should clean up test output for further
debugging of the flip CL.
Each test file needs to be in a package with a package config file
which spells out that it is _opted out_ of null safety.
Bug: https://github.com/dart-lang/sdk/issues/43883
Change-Id: I583f66119df57031fd80824111923e15e0f91782
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168900
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
These tests were initially based on analysis server tests, so they
shared a lot of analysis server infrastructure. However, none of that
infrastructure was really needed; we can test equally well just using
analyzer infrastructure. This helps pave the way for removing the
dependency from nnbd_migration on analysis_server, which will in turn
allow nnbd_migration to be published as its own package.
Change-Id: Icccb73a6248a0b766db5cfe66f42a6dceac0d944
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148540
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Change `handleInsertion` to use a `SourceEdit` instead, and update
`PreviewSite` to use it, but otherwise do not change `PreviewSite`. That
can be tested later when we have new `HintAction`s that allow us to
exercise this new code.
Change-Id: Idd6d782e003d4d643abb5770daa9055685f2e76a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148186
Reviewed-by: Paul Berry <paulberry@google.com>
This existed solely to have a centralized location for the analysis
server's dependencies on nnbd_migration. Now that nnbd_migration
doesn't depend on the analysis server, there's no need for it anymore.
Change-Id: I24b231337b1f724840b4533afef1672241b0af4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148181
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
This should help ensure that descriptions of nullabilities that show
up in the stack trace refer to parts of the program the user is
familiar with, rather than simply saying "explicit type".
Change-Id: If53198cc45077a664e44859c7c0770ec9831c765
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146964
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>