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

Do not embed Hermes in the Gutenberg XCFramework. Add to distribution archive instead. #5973

Merged

Conversation

mokagio
Copy link
Contributor

@mokagio mokagio commented Jul 18, 2023

A different approach to the problem #5968 tries to solve.

Under the assumption this approach works, I believe it's simpler than the alternative because it avoids embedding in the first place.



otool -L output:

➜ otool -L DerivedData/Build/Products/Debug-iphonesimulator/WordPress.app/WordPress | grep Gutenberg
	@rpath/Gutenberg.framework/Gutenberg (compatibility version 1.0.0, current version 1.0.0)

➜ otool -L DerivedData/Build/Products/Debug-iphonesimulator/WordPress.app/WordPress | grep hermes
# no result

➜ otool -L DerivedData/Build/Products/Debug-iphonesimulator/WordPress.app/Frameworks/Gutenberg.framework/Gutenberg | grep
Gutenberg
DerivedData/Build/Products/Debug-iphonesimulator/WordPress.app/Frameworks/Gutenberg.framework/Gutenberg (architecture arm64):
	@rpath/Gutenberg.framework/Gutenberg (compatibility version 1.0.0, current version 1.0.0)

➜ otool -L DerivedData/Build/Products/Debug-iphonesimulator/WordPress.app/Frameworks/Gutenberg.framework/Gutenberg | grep
hermes
	@rpath/hermes.framework/hermes (compatibility version 0.12.0, current version 0.12.0)

The outcome is different from the one @fluiddot reported with the version built from #5968. But it doesn't seem to impact the behavior at runtime.

@mokagio mokagio marked this pull request as draft July 18, 2023 07:42
fluiddot and others added 3 commits July 18, 2023 19:03
The idea being to avoid nested frameworks because of embedding and
instead adding Hermes as a another vendored framework in the podspec.
@mokagio mokagio force-pushed the mokagio/use-hermes-from-cocoapods branch from dea1737 to a5f1d5f Compare July 18, 2023 09:03
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jul 18, 2023

Wanna run full suite of Android and iOS UI tests? Click here and 'Approve' CI job!

@fluiddot
Copy link
Contributor

Hey @mokagio 👋 , the file size issue was solved by having the Hermes framework embedded in the XCFramework Xcode project with the option "Embed & Sign". I tried other options like "Embed without Signing" but it was producing a way larger framework (around 500 MB). I'm not sure what's Xcode doing when enabling that option, but my gut feeling is that it's somehow filtering out unused parts of the framework 🤔.

Copy link
Contributor

@fluiddot fluiddot left a comment

Choose a reason for hiding this comment

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

@mokagio I've tested this solution in wordpress-mobile/WordPress-iOS#21021 and confirmed the app is working as expected. I think this PR is good to go, so feel free to set it ready for review anytime. In the meantime, I'll go ahead and preliminary approve it in case you want to merge it right away.

Branches used:

  • Gutenberg: rnmobile/upgrade/react-native-0.71.8
  • WP-iOS: gutenberg/tweak-pod-deps-by-rn-version

Test results using a local build with a local Gutenberg installation:

  • ✅ Simulator
  • ✅ Device

Test results using a local build with Gutenberg framework:

  • ✅ Simulator
  • ✅ Device

CI build (pr21021-1c5fb5f):

  • ✅ Device

NOTE: The only problem I found is a 💥 crash when opening a post with a VideoPress video, inserting the block doesn't crash. This error seems unrelated to the Hermes framework workaround, so we can omit it for now as it will be solved in a separate PR.

@SiobhyB SiobhyB mentioned this pull request Jul 19, 2023
2 tasks
@mokagio mokagio marked this pull request as ready for review July 20, 2023 02:56
@mokagio mokagio changed the title WIP – Alternative solution to Hermes crash on device Do not embed Hermes in the Gutenberg XCFramework. Add to distribution archive instead. Jul 20, 2023
@mokagio
Copy link
Contributor Author

mokagio commented Jul 20, 2023

Thanks @fluiddot for the detailed review and for getting this ready to merge.

The Git history is dirtier than I'd like it to be. Shame on me for shipping those "WIP – ..." commits in the first place. I briefly explored rebasing or creating a new branch to cherry pick, but I got conflicts in the submodules and decided to take the hit in terms of non linear history in the interest of moving the work along.

Merging now.

@mokagio mokagio merged commit 378e233 into upgrade/react-native-0.71.8 Jul 20, 2023
@mokagio mokagio deleted the mokagio/use-hermes-from-cocoapods branch July 20, 2023 03:06
@fluiddot
Copy link
Contributor

Thanks @fluiddot for the detailed review and for getting this ready to merge.

The Git history is dirtier than I'd like it to be. Shame on me for shipping those "WIP – ..." commits in the first place. I briefly explored rebasing or creating a new branch to cherry pick, but I got conflicts in the submodules and decided to take the hit in terms of non linear history in the interest of moving the work along.

Merging now.

Another option would be to squash and merge, this option can be helpful when merging into a feature branch like the RN upgrade to keep the Git history simpler and cleaner. In fact, we followed this approach in the Gutenberg PR because we had tons of changes there.

@mokagio
Copy link
Contributor Author

mokagio commented Jul 20, 2023

@fluiddot yeah, good point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants