Skip to content

Move iOS framework thinning into the tool as assemble target #76665

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

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Feb 24, 2021

The xcode_backend script removed extraneous architectures from the app in debug and profile ("thinned") to reduce install app size.

  1. Move framework thinning into the tool as an assemble target.
  2. Change the logic to only thin Flutter-owned App.framework and Flutter.framework instead of all frameworks in the app. CocoaPods handles thinning plugins, and Xcode handles the rest, so don't duplicate the work.
  3. Remove the logic that creates a framework per requested architecture and then merges them at the end. Instead, first validate all the frameworks have the requested architectures via lipo -verify_arch, then extract all the requested architectures at the same time in-place to the same binary location.

Added unit tests, but this is also already covered by existing tests like

Future<void> _checkFlutterFrameworkArchs(String frameworkPath, {

@jmagman jmagman added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. t: xcode "xcodebuild" on iOS and general Xcode project management labels Feb 24, 2021
@jmagman jmagman self-assigned this Feb 24, 2021
@google-cla google-cla bot added the cla: yes label Feb 24, 2021
@jonahwilliams
Copy link
Contributor

If we extract in-place, doesn't that remove the possibility of conditionally skipping the thinning in the future? Or would we be relying entirely on xcode to skip

@jmagman
Copy link
Member Author

jmagman commented Feb 25, 2021

If we extract in-place, doesn't that remove the possibility of conditionally skipping the thinning in the future? Or would we be relying entirely on xcode to skip

The existing UnpackIOS assemble target called from the Run script build phase (pre-compile) copies the Flutter framework from the artifacts cache into the mode-specific directory like build/ios/Debug-iphoneos/, but skips if it's already there (unless the artifacts changed). Then the Thin Binary Xcode build phase (post-compile) always copies from there into the app framework directory Runner.app/Frameworks and is never skipped. So it's a new copy of the engine artifacts fat framework with all its archs on every build. So destroying it in-place doesn't matter since it will be re-copied on the next build.

We could skip thinning in this new target by validating the input framework already only contains the requested archs. I can look into that performance improvement in a follow up PR, I was mostly just trying to refactor this one out of the bash script without changing too much.

Actually come to think of it the App.framework probably never needs to be thinned--it was built with the same requested archs. I'll also look into that in a new PR.

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

RIP even more shell scripts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-ios iOS applications specifically t: xcode "xcodebuild" on iOS and general Xcode project management tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy