Skip to content
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

Adopt Flutter.xcframework in tool #71495

Merged
merged 2 commits into from Dec 4, 2020
Merged

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Dec 1, 2020

Description

XCFrameworks are bundles introduced in Xcode 11 that contain directories broken down by SDK (ex. iPhone, iPhone simulator, macOS, Catalyst macOS, etc) and architecture, plus an Info.plist with some metadata.

Flutter iOS engine artifacts now contain an unzipped Flutter.xcframework. (It also contains the old Flutter.framework.zip to support internal tooling, to be removed with b/172736803).

./Flutter.xcframework/ios-armv7_arm64/Flutter.framework
./Flutter.xcframework/ios-x86_64-simulator/Flutter.framework
./Flutter.xcframework/Info.plist
./Flutter.framework

At some point, ARM simulator bits will be added on the engine side, and it should Just Work™ on the tool side.

Adopt Flutter.xcframework bundle in tool. Also adopt in add-to-app modules and host apps.

Related Issues

Fixes #60109
Part of #60118 via #64502
Part of #66474
Part of #33850 for add-to-app
Unblocks part of #70413

Related:
#69809
#70224
#71095
#71100
#71103
#71113

Engine:
flutter/engine#22506
flutter/engine#22664
https://flutter-review.googlesource.com/c/recipes/+/9020

Tests

Most of this is being exercised by existing build tests.

  • Added artifacts_test
  • Updated build_ios_framework_module_test:
    • The engine builder is running Xcode 11, so creates a ios-armv7_arm64 instead of a ios-arm64_armv7 folder. Support both names so an engine builder update doesn't require a coordinated framework roll.
    • The add-to-app release version of Flutter.xcframework now includes the debug simulator, matching existing release Flutter.framework behavior.

module_test_ios failure will be fixed by #71525
build_ios_framework_module_test will be fixed by #71531

@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 Dec 1, 2020
@jmagman jmagman self-assigned this Dec 1, 2020
@flutter-dashboard flutter-dashboard bot added the team Infra upgrades, team productivity, code health, technical debt. See also team: labels. label Dec 1, 2020
@google-cla google-cla bot added the cla: yes label Dec 1, 2020
@jmagman
Copy link
Member Author

jmagman commented Dec 1, 2020

Blocked on an engine roll that contains Flutter.xcframework artifacts.

Rebased.

Blocked again, the roll was reverted.

Comment on lines +25 to +26
'-arch',
'arm64',
Copy link
Member Author

Choose a reason for hiding this comment

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

Now release add-to-app fat Flutter.framework contains debug x86 so it can be built on the simulator. otool -l doesn't show the bitcode section for a fat framework if any slices don't contain bitcode. Specify arm64 only since that's the part that actually gets shipped and requires bitcode.

Copy link
Contributor

Choose a reason for hiding this comment

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

What about armv7?

Copy link
Member Author

Choose a reason for hiding this comment

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

This has mostly been useful as a sanity check to make sure a debug version wasn't incorrectly embedded, not that the builder is producing the right artifacts, so that was a shortcut. I can check both if you prefer!

@jmagman
Copy link
Member Author

jmagman commented Dec 2, 2020

module_test_ios failure will be fixed by #71525

@jmagman
Copy link
Member Author

jmagman commented Dec 2, 2020

build_ios_framework_module_test will be fixed by #71531

Comment on lines -23 to -25
if (!globals.fs.isDirectorySync(flutterFrameworkPath)) {
throwToolExit('Flutter.framework not found at $flutterFrameworkPath');
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This is now thrown in getArtifactPath > _getIosEngineArtifactPath

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

LGTM once tests are passing, modulo questiona bout whether we should validate bitcode on arm7 as well as 64.

@jmagman
Copy link
Member Author

jmagman commented Dec 2, 2020

Waiting on an engine roll to rebase and retest.

@jmagman jmagman marked this pull request as ready for review December 2, 2020 19:17
@jmagman jmagman merged commit d4150d3 into flutter:master Dec 4, 2020
@jmagman jmagman deleted the xcframework branch December 4, 2020 21:57
cbracken pushed a commit to cbracken/flutter_recipes that referenced this pull request Apr 6, 2021
Flutter tooling stopped using Flutter.framework in flutter/flutter#71495
g3 stopped using it in cl/347847369

Change-Id: I5a25d4481e28ff736787b5f1ba7de2f81e6ce9c9
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/9560
Reviewed-by: Keyong Han <keyonghan@google.com>
Commit-Queue: Jenn Magder <magder@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-host-arm Building on an ARM-based platform platform-ios iOS applications specifically t: xcode "xcodebuild" on iOS and general Xcode project management team Infra upgrades, team productivity, code health, technical debt. See also team: labels. tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Distribute engine as Flutter.xcframework
2 participants