We now store both environmentVariables and injectArtificialException
in the _MigrationCliTestBase class, and refer to them wherever they
are needed, so we reduce the amount of plumbing we need to do.
In a follow up CL I'll be adding more behavior injection using the
same technique.
Change-Id: Ib736373f7a92a46922964d3c5c59d35bf72d618a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151300
Reviewed-by: Janice Collins <jcollins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
There is logic to navigate to the top of a newly-loaded page. It
broke with a visual redesign, in which the title of a page is always
sitting at the top of the screen. The new logic will scroll the page
to the first line of source text.
Change-Id: I685d1fb96c6ca1789f114871acd2bb8148e6ae7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151032
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Previously the API was general, exposing a `numPhases` integer, and
providing a generic processing function with a `phase` argument. This
was necessary back when migration was built into DartFix (because
different kinds of fixes had different numbers of phases), but now
that migration is a separate tool, it gets in the way because it makes
it difficult for the caller to have different behaviors in different
phases.
This is a prerequisite for making it possible to have some files
analyzed but not finalized (which is in turn necessary for handling
generated files).
Change-Id: I5993808eb3dace21d8b6cb9c5308f94a3b1f898e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151081
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This API can be used by tools that wish to perform migration but want
to provide their own command-line argument parsing.
Change-Id: Ic54e993139c803ded5ac39229ae84980db12184e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151080
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Previously, MigrationCli.run() would always return, but it would set
MigrationCli.exitCode to indicate whether an error occurred. This
made it necessary to thread a lot of tricky logic around to ensure
that we would exit quickly if an error occurred. This CL switches to
using an exception, so we get the same effect automatically.
Change-Id: I2b885092dec551700900b118ec3d9acd2f3649d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150760
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
When running the FixBuilder we need to override the behavior of
ClassElement.interfaces so that it returns the post-migration
interface types. We also need to override the behavior of
LibraryElement.isNonNullableByDefault so that the library being
migrated is considered opted in during FixBuilder analysis. This
required adding hooks to the analyzer to allow those overrides.
Additionally, since the analyzer caches the InheritanceManager, we
need to clear that cache out just prior to running the FixBuilder, so
that no pre-migration interface types leak into the FixBuilder.
Fixes#40475.
Fixes#42139.
Change-Id: I45e2c30ebe8c12e4a599e2458d77a3731bad0f98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150260
Reviewed-by: Janice Collins <jcollins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
When tests are run internally under bazel, there's no `version` file
we can look for to verify that we are looking at an SDK directory.
Looking for a `bin` directory works equally well.
Change-Id: Ib19350eaf90d105ebaa3d197fb45b5a41a10179d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150285
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Permissive mode in the analyzer currently is broken, leading to a
useless stacktrace if an exception occurs. As a quick fix, turn
permissive mode off, so the exception just bubbles up normally and
shows on the console. In follow-up CLs I'll actually fix permissive
mode and add a user option to enable it.
Fixes#42138.
Change-Id: I59322ca9dd90b856c56a6ec335762b94ec6935b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149863
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The previous deps had never been validated and were wrong in many ways
(for some deps the constraint was too narrow or too wide; other deps
were missing or extraneous). I did some experimenting with `pub get`
and `pub run test` to find the earliest version of each package for
which the version solve succeeds and the tests pass.
Note, however, that nnbd_migration currently depends on unpublished
functionality from the _fe_analyzer_shared and analyzer packges. So
before publishing nnbd_migration we'll need to publish
_fe_analyzer_shared and analyzer and then update the pubspec one last
time.
Change-Id: If8453226bfcc5e94ac84f1a3fdc0d2f4ee150f54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149661
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
* Prevent cast exception crash when pubspec.yaml is not a map
* Prevent cast exception crash when pubspec sdk is not a string
* Test error cases for parsing pubspec.
Change-Id: Id392815207dc52719cfec5038d6fa2d09f952f08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149602
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
* Change the "Migrating a package" to be an ordered list of steps.
* Spell 'url' as 'URL'.
* Be consistent about capitalization and hyphenating "null-safe" and not
hyphenating "null safety".
* Add text that the tool will edit pubspec.yaml.
Change-Id: Ief5eac682af2813d267568695f920445b0b79615
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149484
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>