Generate only requested platform directories on create#68376
Generate only requested platform directories on create#68376jmagman merged 2 commits intoflutter:masterfrom
Conversation
There was a problem hiding this comment.
checkProjects was never actually passed in, so was always false.
74728a1 to
40b62e1
Compare
There was a problem hiding this comment.
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
ae86c5c to
97a6cac
Compare
There was a problem hiding this comment.
Moved to app does not include desktop or web by default
There was a problem hiding this comment.
Moved to app does not include desktop or web by default
There was a problem hiding this comment.
Moved to app does not include desktop or web by default
There was a problem hiding this comment.
Moved to plugin does not include desktop or web by default
There was a problem hiding this comment.
Moved to plugin does not include desktop or web by default
There was a problem hiding this comment.
Moved to plugin does not include desktop or web by default
There was a problem hiding this comment.
@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.
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.
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.
Is this comment misleading now? it also re-generates for desktop+web projects if they exist
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 |
97a6cac to
ae8f1b9
Compare
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