-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Embed Flutter and App frameworks for add-to-app on iOS #102538
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
86d0d33 to
2b32a72
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.
.ios/Flutter/engine no longer exists
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 is now called from the host app Podfile script, and the fake podspec is in the Flutter module, so don't assume they are sibling paths.
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 comment is already in parseFlutterBuildMode we don't need it twice.
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.
Instead of duplicating logic, call the ruby script in the tool
| def flutter_install_ios_engine_pod(ios_application_path = nil) |
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.
Remove duplicated logic, call
| def flutter_install_plugin_pods(application_path = nil, relative_symlink_dir, platform) |
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.
Stop making the dummy App.framework in the ephemeral module directory.
🐮
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.
Stop copying the engine into the module ephemeral directory. Let the tool handle copying the right version where it needs to go when assemble is called.
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.
Instead of letting CocoaPods copy/re-codesign/strip the frameworks from the ephemeral directory, instead let the tool copy it via embed_and_thin after the rest of the app has compiled. The tool already codesigned/stripped it during assemble.
Note this is the only real added logic to this PR, everything else is deletions or slight refactoring.
2b32a72 to
c46c66e
Compare
c46c66e to
5de2d33
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
|
friendly ping @christopherfujino |
christopherfujino
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.
Sorry, thought I approved this, LGTM
Previously, the iOS Flutter module copied the Flutter.xcframework and created a dummy version of App.framework in the the ephemeral
.iosdirectory, as well as two correspondingpodspecs that pointed at these frameworks. On every compilation of the host app,flutter assemblewould create the real App.framework and copy the right Flutter.framework variant into the XcodeBUILT_PRODUCTS_DIR. On the first build, CocoaPods would then copy/re-codesign/re-strip the frameworks and embed them into the app.However, since
flutter assembleupdates the frameworks inBUILT_PRODUCTS_DIRand not the dummy frameworks in the ephemeral directory, on incremental builds CocoaPods would not run its copy script because the timestamp of the dummy ephemeral frameworks did not change. So the compiled dart code embedded in the app would not be updated, and would be stale until a hot reload.podhelperscripts that embed the frameworks into the app.assemblealready codesigns, bitcode strips, and debug symbol strips the frameworks, so all that's left it torsyncthem to the right place in the app.podhelper.rbruby script to use the Flutter SDKflutter_tools/bin/podhelper.rbversion of this file to push as much logic as possible into the SDK instead of the module project.Fixes #101979
Probably would have resolved parts of #94481
Follow-up to #101943
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.