-
Notifications
You must be signed in to change notification settings - Fork 29.3k
feature: add usermessage when miss platform project #56531
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
feature: add usermessage when miss platform project #56531
Conversation
Thanks for the contribution. However, there are existing messages that are supposed to be reported (search through |
@jamesderlin
but in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a project has only Android project, but user enabled web and macOS, will this print duplicated lines for each missing platform? Maybe the message could be more like Your project $project is missing the following platform projects: ios, web, macos
@Zazo032 |
What if only supported platform is Android, the user hasn't an Android device available, and has enabled web and macOS? |
if enable web and macOS, it will print this user-message to notice user if should add some platform sub-projects.
maybe we should change some text in user-message to notice user about |
@Zazo032 Is there any more review comments? |
You'll have to wait for Flutter team's feedback |
Also, there's a failing test: Logs
|
fix it. |
globals.printStatus(''); | ||
globals.printStatus(userMessages.flutterMissPlatformProject(FlutterProject.current().directory.path)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of showing unsupported devices when no supported devices are found, but the "Your project is missing platform projects, run flutter create
." message is far too strong, and will be alarming to the much more common scenario of people who are trying to debug their Android app just forgot to plug in their phone.
I think just mentioning that the discovered devices are unsupported will be a sufficient hint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we could change that message to something less alarming like:
If you would like your app to run on Android or web, consider running `flutter create .` to generate projects for these platforms.
where "<Android or web>
" are examples generated based on the discovered but unsupported devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supported it. message alarm like:
No supported devices connected.
The following devices were found, but are not supported by this project:
MIX 2 • 2e7847af • android-arm64 • Android 9 (API 28)
Web Server • web-server • web-javascript • Flutter Tools
Chrome • chrome • web-javascript • Google Chrome 81.0.4044.138
Your project /Users/liufengkai/Documents/Code/FlutterSupport/a_test is missing some platform projects.
If you would like your app to run on android or web, consider running `flutter create .` to generate projects for these platforms.
<android or web>
generated by unsupported devices.
packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
Outdated
Show resolved
Hide resolved
|
@jamesderlin I responded in #56315 (comment). |
@jamesderlin fix typo and add wanted feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay on this. I think this will be helpful to our users!
A few comments and suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, thanks for the tests! A few very minor nits.
@zanderso And additional comments here?
packages/flutter_tools/test/commands.shard/hermetic/devices_test.dart
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm after addressing jmagman's comments and a small cleanup suggestion to try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you so much!
Description
When Flutter project miss platform sub-project (like
android
oriOS
dir), runflutter run
will get result like:this is a confusing message,because devices is supported but miss this sub-project.
So I added log printing in this case, such as:
Related Issues
#56315
Tests
I added the following tests:
https://github.com/flutter/flutter/compare/master...lfkdsk:feature-support-miss-platform-project-user-message?expand=1#diff-09cce1e3642fa7c47801e06ff46fcd60
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.