-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Generate only requested platform directories on create #68376
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
Conversation
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.
checkProjects was never actually passed in, so was always false.
74728a1 to
40b62e1
Compare
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.
These templateContext values are only true if the corresponding feature is on.
flutter/packages/flutter_tools/lib/src/commands/create.dart
Lines 423 to 426 in 73301a3
| web: featureFlags.isWebEnabled && platforms.contains('web'), | |
| linux: featureFlags.isLinuxEnabled && platforms.contains('linux'), | |
| macos: featureFlags.isMacOSEnabled && platforms.contains('macos'), | |
| windows: featureFlags.isWindowsEnabled && platforms.contains('windows'), |
ae86c5c to
97a6cac
Compare
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.
Moved to app does not include desktop or web by default
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.
Moved to app does not include desktop or web by default
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.
Moved to app does not include desktop or web by default
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.
Moved to plugin does not include desktop or web by default
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.
Moved to plugin does not include desktop or web by default
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.
Moved to plugin does not include desktop or web by default
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.
@stuartmorgan I moved the TODOs scattered around to reexamine the logic to this spot. Let me know if you want it somewhere else, or need it reworded.
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.
The TODO was really about figuring out what checkProjects was for and why we would ever want the checkProjects = false behavior since it seemed really bizarre, so it looks like this PR obsoletes it. But I can clean it up later.
jonahwilliams
left a comment
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.
Only small nits, seems like a good change.
Why were we getting the warning about the android embedding though? even if the project wasn't there or was partially created, we should probably default to not showing a warning
packages/flutter_tools/test/commands.shard/permeable/create_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.
Is this comment misleading now? it also re-generates for desktop+web projects if they exist
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.
Good call, reworded.
Before this PR the flutter/packages/flutter_tools/lib/src/project.dart Lines 860 to 862 in 345188d
is guarded by a check if the android directory exists (it did, but only contained GeneratedPluginRegistrant.java) and returned v1 because the app manifest didn't exist.
After this PR, the |
jonahwilliams
left a comment
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 with nits
97a6cac to
ae8f1b9
Compare
cyanglaz
left a comment
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!
Description
The
android(andios) directories are incorrectly created during the plugin registrant generation step. After aflutter createthe only thing inandroidisGeneratedPluginRegistrant.javaand the only thing iniosisGeneratedPluginRegistrant.{h,m}.flutter/packages/flutter_tools/lib/src/project.dart
Lines 860 to 862 in 345188d
is guarded by a check if the
androiddirectory exists (it did, but only containedGeneratedPluginRegistrant.java) and returnedv1because the app manifest didn't exist, and caused a confusing warning.Avoid creating platform directories during the plugin registrant generation step, which bypasses the Android embedding version warning.
flutter create -t app, generate the directories/plugins only for the requested platforms.checkProjectconcept by explicitly requesting platforms based on user flags, existing directories, and whether features are on, as appropriate.Related Issues
Fixes #67346
Fixes #60023
Related:
#31342
#59507
Tests
Added
--platformapp create tests. Update existing plugin, project, cocoapods tests which already exercise these code paths.Checklist
///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change