-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail early when running dart migrate
with too-high min SDK constraint
#44144
Comments
@stereotype441 I think we should consider this for beta. If you can get this landed in master, I can handle cherry picking. |
Unfortunately we can't simply check the user's min SDK constraint, because there are reasonable scenarios where it makes sense to run migration over a tool whose min SDK constaint has already been updated (namely, when resuming migration of a package that has already been partially migrated). What we can do is detect the situation where the package contains errors and appears to be completely migrated; I think that should address this use case. I'm currently testing https://dart-review.googlesource.com/c/sdk/+/171624 on trybots. It causes the following text to be printed after the list of errors:
@kwalrath @mit-mit does this seem like it would address the problem? I'm happy to change the wording if needed. |
https://dart-review.googlesource.com/c/sdk/+/171624 has code review and passes trybots. I'm going to land it now so that it can get cherry-picked to Beta ASAP. If we want to change the wording I'm happy to do that as a follow-up CL. |
How about a message like this:
|
@kwalrath that sounds fine to me, but I have a clarifying question. Currently the tool has the ability to output a different message for the scenario where there are analysis errors but no opted out code (in which case the user probably just needs to set their lower SDK constraint back) and the scenario where there are analysis errors and some opted out code (in which case the user probably just has errors in their code, and it's unrelated to their lower SDK constraint). Are you proposing that message for both scenarios or just one of them? If you're proposing it for just one of them, do you have a recommendation for the error message we should display in the other scenario? |
If you can differentiate, I'd love different messages for the two cases. For the first case, something like this:
And in the second case:
|
@kwalrath thanks! I'll make a CL that updates the text. Re-opening the issue until that CL lands. |
Text update sent for review: https://dart-review.googlesource.com/c/sdk/+/171643 |
@mit-mit this is now landed in master. 2 CLs will need to be cherry-picked: |
Cherry pick filed here. |
Fixes #44144. Bug: #44144 Change-Id: I5db52426ba4e6a4cde803ae38fbc479cb8bbb862 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171624 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
Fixes #44144 Bug: #44144 Change-Id: I54ef9ca8f38335df2082d730ba558fd407a07767 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171643 Commit-Queue: Kathy Walrath <kathyw@google.com> Reviewed-by: Kathy Walrath <kathyw@google.com> Auto-Submit: Paul Berry <paulberry@google.com>
If you try to run
dart migrate
when your minimum SDK constraint is 2.12+, you get confusing analysis errors. Instead, you should get a message like this:Here's the output of
dart --version
:Details
Migrating a very simple package, I updated my minimum SDK to my Dart version (flutter master channel's
dart
version, 2.12.0-31.0.dev) so I could get null-safe dependencies (pedantic & test).dart pub outdated --mode=null-safety
was happy. But when I trieddart migrate
, it warned me about analysis issues:The text was updated successfully, but these errors were encountered: