Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Avoid thinning frameworks in iOS extensions #64674

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 2 commits into from
Aug 28, 2020

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Aug 26, 2020

Description

Watch extensions are embedded in iOS apps. Avoid lipo'ing those frameworks to iOS architectures. Stick to the app frameworks.

Related Issues

Fixes #60351

Tests

Updated ios_app_with_extensions_test to include a watch framework. Check the build succeeds, and that the watch extension frameworks have the expected watch architectures.

Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.

@jmagman jmagman added the platform-ios iOS applications specifically label Aug 26, 2020
@jmagman jmagman self-assigned this Aug 26, 2020
@flutter-dashboard flutter-dashboard bot added c: contributor-productivity Team-specific productivity, code health, technical debt. tool Affects the "flutter" command-line tool. See also t: labels. labels Aug 26, 2020
'EFQRCode.framework',
'EFQRCode',
);
_checkWatchExtensionFrameworkArchs(watchExtensionFrameworkPath);
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 the new check that these plugin frameworks haven't been lipod to the iOS ARCHS.

@@ -160,34 +191,6 @@ Future<void> main() async {
workingDirectory: flutterDirectory.path,
);

await inDirectory(projectDir, () async {
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 wasn't actually building for the simulator (it's missing --simulator) even with the -d flag. flutter build ios with a watch companion doesn't actually work. Anyway the next thing this does is run on the simulator, which does work.

use_frameworks!
use_modular_headers!

pod 'EFQRCode/watchOS', '5.1.6'
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 adds a framework to the watch extension. Previous this failed because xcode_backend lipod all .frameworks, even the ones in the watch extension with a different expected architecture.

@@ -811,7 +946,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = YES;
ENABLE_BITCODE = NO;
Copy link
Member Author

Choose a reason for hiding this comment

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

Bitcode should be off for Runner.

Choose a reason for hiding this comment

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

Why should bitcode be off? Bitcode is a requirement when you have a watch extension.

Copy link
Member Author

Choose a reason for hiding this comment

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

Because this is an integration test that will never be submitted to the App Store and I didn't want to track down issues related to the pods building before the correct bitcode-embedded version of Flutter gets copied around. I'll set it back to YES and see if this particular integration test triggers that case.

@@ -19,9 +19,13 @@ dependencies:
flutter:
sdk: flutter

device_info: 0.4.2+7
Copy link
Member Author

Choose a reason for hiding this comment

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

Adding (any) plugin is what kicks the tool into running pod install, which we need to embed the watch framework.

@@ -257,11 +257,10 @@ ThinFramework() {
}

ThinAppFrameworks() {
local app_path="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
local frameworks_dir="${app_path}/Frameworks"
local xcode_frameworks_dir="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
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 the actual fix.
Instead of finding and thinning all *.frameworks in Runner.app, it now only does so in the Runner.app/Frameworks directory.

Copy link
Member

@xster xster left a comment

Choose a reason for hiding this comment

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

LGTM

'watch Extension.appex',
'Frameworks',
'EFQRCode.framework',
'EFQRCode',
Copy link
Member

Choose a reason for hiding this comment

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

Add a comment for what this is? It came from a pod?

use_frameworks!
use_modular_headers!

pod 'EFQRCode/watchOS', '5.1.6'
Copy link
Member

Choose a reason for hiding this comment

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

never mind, the answer's here. Still good to comment in the other file.

@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • Please get at least one approved review before re-applying this label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@jmagman
Copy link
Member Author

jmagman commented Aug 28, 2020

LGTM

@xster would you mind approving it?

@xster
Copy link
Member

xster commented Aug 28, 2020

GitHub needs an approve button on the main tab instead of the files tab.

@fluttergithubbot fluttergithubbot merged commit ce9cde8 into flutter:master Aug 28, 2020
@jmagman jmagman deleted the lipo-dir branch August 28, 2020 17:54
@zanderso
Copy link
Member

It looks like this might have broken ios_app_with_extensions_test in the device lab.

zanderso added a commit that referenced this pull request Aug 28, 2020
@jmagman
Copy link
Member Author

jmagman commented Aug 28, 2020

Error:

 could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig' in search paths (in target 'Runner' from project 'Runner')error: /var/folders/gr/7pczn0h51nz2qb3t_0xyfhqc0000gn/T/ios_app_with_extensions_testUdVJD4/app_with_extensions/ios/Flutter/Release.xcconfig

mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
jmagman added a commit to jmagman/flutter that referenced this pull request Sep 15, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: contributor-productivity Team-specific productivity, code health, technical debt. platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Must run flutter clean before building when iOS app has watch extension, Failed to extract arm64 for .../PlugIns/WatchApp.appex/Frameworks
6 participants