Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Properly support pods with static library and Swift Framework #508

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
chkuang-g merged 3 commits into master from patch/swift-framework
Apr 4, 2022

Conversation

Copy link
Collaborator

@chkuang-g chkuang-g commented Apr 1, 2022
edited
Loading

For more context b/196153528

A couple of changes:

  1. Change Link Framework Statically setting default value to true
  2. Add a workaround to properly link Swift Standard Library if any pod is using Swift Framework and Link Framework Statically is true. This workaround is turned OFF by default. It basically does the following
    a. Add a dummy.swift file to Xcode project
    b. Set SWIFT_VERSION build property. If Xcode project has multiple targets (generated by Unity 2019.3+), then also enable CLANG_ENABLE_MODULES and ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES

Change the default value of "Link Framework statically" in iOS Resolver
settings to TRUE since it is very likely that some pod frameworks
includes pre-built static libraries, and can cause unexpected crash
in runtime if the app is build with with multiple targets
(Unity 2019.3+).
The Xcode project generate from Unity may not be able to link Swift
Standard Libaries properly if
1. Some pods include Swift frameworks
2. Podfile sets to link frameworks statically
The workround attempts to fix this by
1. Add a Dummy.swift file to the Xcode project.
2. Enable `CLANG_ENABLE_MODULES` and `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES`
 build settings.
3. Change `SWIFT_VERSION` to the value specified in iOS Resolver
 settings. Default to "5".
This workaround is turned OFF by default.
Copy link
Collaborator Author

chkuang-g commented Apr 1, 2022
edited
Loading

Test with Analytics testapp, FirebaseAnalytics 8.8.0 (.unitypackage. This depends on a pod containing static library) and Facebook Unity SDK (this depends on a pod containing Swift Framework). and Xcode 13.2.

Due to that Facebook SDK always append use_frameworks! at the end of Podfile, which will be duplicated with use_frameworks! :linkage => :static added by EDM4U, I would need to manually move that line, run pod install under Xcode project folder before building Xcode app.

Verified in the following Unity versions

Unity Version Checked
2018436
2019年4月30日
2020年3月18日
2021年2月17日 Unable Build, not related to EDM4U
202210 Unable Build, not related to EDM4U

The Xcode project generate from Unity may not be able to link Swift
Standard Libaries properly if
1. Some pods include Swift frameworks
2. Podfile sets to link frameworks statically
The workround attempts to fix this by
1. Add a Dummy.swift file to the Xcode project.
2. Enable `CLANG_ENABLE_MODULES` and `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES`
 build settings.
3. Change `SWIFT_VERSION` to the value specified in iOS Resolver
 settings. Default to "5".
This workaround is turned OFF by default.
@chkuang-g chkuang-g merged commit 4d58f41 into master Apr 4, 2022
@chkuang-g chkuang-g deleted the patch/swift-framework branch April 4, 2022 18:17
@googlesamples googlesamples locked and limited conversation to collaborators May 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Reviewers

@AlmostMatt AlmostMatt AlmostMatt left review comments

@a-maurice a-maurice a-maurice approved these changes

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /