-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Move embedding and linking Flutter frameworks into the tool #51453
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.
EXPANDED_CODE_SIGN_IDENTITY is more correct, it's the resolved underlying ID as opposed to a name (on my machine the name was ambiguous)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
This link is temporary. I will write wiki or website instructions and update this link: flutter/website#3741
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.
Follow up questions:
-
Did you use the flutter tool to migrate the examples in repo?
-
Do we need to make a similar change to the macOS project structure? If so, that doesn't need to be done now but it would be nice to have an issue for it.
-
Is there an issue filled for adding this information to the web site?
Re: migration time - I think this is okay provided that we're not overwriting the file if it isn't necessary. It doesn't look like this is the case in your code.
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.
Since this is a private member with a private typedef, I would instead do the function type inline:
void _processFileLines(File file, String Function(String) processLine)
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.
consider a better name, like migrateProject et cetera
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 would add some contextual top level information about why this class exists
Yes, all examples and tests were migrated by running
I think it may be a good idea to do the same pattern for macOS for the future-proofing xcframework / App.framework rename reasons I mentioned in the "Observations" section, and to remove the
No, it doesn't overwrite the file unless there's a change. See the "skipped if nothing to upgrade" |
|
Even if its not necessary, it would be nice to keep the macOS and iOS projects as similar as possible. |
|
Oh another thing: this migration will prevent users from downgrading Flutter versions to before this change since I could change the script build phase to first run embed, then run thin, since that's all the new |
|
I would recommend that if you modify the project files, to take the old sources and save them as "*.old". Then the documentation on the website/wiki can explain how to restore the project by renaming them |
stuartmorgan-g
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.
It terms of the general approach to managing the framework, this looks good to me! And capturing from offline discussion, it has the added bonus that it should make it pretty easy to solve the debug/profile/release problem with assemble that @jonahwilliams had encountered previously, since we won't be bound by Xcode's limitation of needing a single known path to the Flutter framework.
My comments are actually about the specifics of we do the migration, rather than the end result.
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.
Why do only some of the projects have these input/output path changes?
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.
CocoaPods adds this in their scripting, so it's present in apps that have iOS platform code in their plugins.
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.
(so projects that have Podfiles)
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.
Breadcrumb for later reference: I think we can use this to fix #39659
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 would love to move most of that logic into a Ruby helper script in the project (like xcode_backend) so it (almost) never has to be upgraded again #45197
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'm looking at this class and thinking about what happens when we want to add a second migration for something else later; it seems like it'll become very hard to maintain/understand pretty quickly.
I think it would be helpful to design this up front so that instead of a single processor, it uses an array of processors. That way we can encapsulate each conceptual migration and keep them all from bleeding together over time. It would also mean we could run individual ones selectively (see later comment). I don't think it would add too much complexity, and it would make the next migration much easier to add in a maintainable way (vs us always deciding that it's not bad enough to refactor this time, but maybe next time...)
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.
Done.
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.
Couldn't we pretty easily use the .metadata file to keep track of migrations that we've done (say, with a UUID for each completed migration)?
In addition to efficiency over time, it also means that we won't accidentally fight users. E.g., if someone had their own unrelated reasons that they needed disable_input_output_paths in their podspec, they'd have a really bad time if we re-run on every build.
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 really wish we could wait until https://docs.google.com/document/d/1fPnpUI6gXE9PkNWuFoAW20m_sQ87ZSC1rrn_D7fxBvs/edit?ts=5e58625e#heading=h.pub7jnop54q0 was in place and use that instead of having a bunch of one-off migrators fighting each other... but we can't wait in this case.
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.
Since I removed the disable_input_output_paths change, I didn't implement migration versioning, but it really is a good idea. I'd like to split it out into it's own change as part of the wider flutter migrate effort. For now it's running on every run like #13011.
Description
Xcode 11.4 changed its behavior to require linked and embedded frameworks (App.framework and Flutter.framework) to have the right architecture BEFORE the Flutter script can run. So building against the simulator would work, then the next time building against a real device it would just fail:
and vice versa from real device to simulator:
Observations
Flutter.xcframeworkand link on that without a breaking change. Or nameApp.frameworkuniquely to support different add-to-app modules. Or we could move more things from xcode_backend into the tool. Or we could update search paths to point directly to the right build mode engine artifacts directory without copyingFlutter.frameworkinto the project.flutter build ios/flutter run! However these migrations are really fast when there's no changes to make.Changes
OTHER_LDFLAGS=$(inherited) -framework Flutterto Generated.xcconfig and remove Flutter.framework from linking build phase (no need add forAppsince there are no symbols).SHARD=build_testsand let all the examples migrate.Related Issues
Fixes #50568
Fixes #32454
Tests
ios_project_migration_test, updated xcodeproj_test
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