-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Gutenberg] Tweak Pod dependencies based on React Native version used by Gutenberg #21021
[Gutenberg] Tweak Pod dependencies based on React Native version used by Gutenberg #21021
Conversation
Builds are failing due to the XCFramework: Gutenberg:
Aztec:
I'm wondering why they failed since the minimum deployment target is already set to 15.0 🤔: WordPress-iOS/config/Common.xcconfig Line 3 in d7cdd21
Looks like the upstream branch didn't experience this issue, so not sure what's the difference here. I'm using a newer Gutenberg version ( cc @mokagio in case you have any insights about this issue. Thanks 🙇 ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes make sense to me.
Builds are failing due to the XCFramework
The builds do fail locally for me too. I recall seeing the error referenced before in eadad98#commitcomment-119894859, which was referenced in wordpress-mobile/gutenberg-mobile@8f74c77 and included in wordpress-mobile/gutenberg-mobile#5924. We may need to include that fix in this branch, as I believe it was only merged into the ongoing React Native upgrade branch.
I didn't encounter the failure in my case, but let me check it again cleaning the build caches.
Yep, since this PR is pointing to the latest version integrated In any case, I agree that incorporating the fix might address the issue. I'll try use a Gutenberg Mobile reference that includes it to validate it 👍. |
Generated by 🚫 dangerJS |
📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
|
I noticed that UI tests failed consistently in this branch and failures are related to some of the editor's test cases. I'll restart them just in case is something temporary. If they keep failing, we'd need to investigate this further. |
Following an internal discussion with @dcalhoun (p1689007827034449/1688993364.279019-slack-C01NFTM4BMY), we spotted that building iOS locally using Gutenberg via XCFramework leads to a crash when using a physical device. Error:
One of the entries the error output has caught my attention:
I understand that the Hermes framework is not signed, or at least there's an issue related to signing. However, the installable build isn't affected by this issue. Not sure what's the difference, especially related to signing, which only causes the crash when building locally 🤔. |
This SO answer led me to this Apple technote, which is a bit old but gave me pause…
Which might require us to revisit the whole approach of embedding Btw, even if the (ad-hoc-signed) Installable Build seems to work, in practice I'm pretty sure nested frameworks would be rejected by Apple on submission anyway… as they have been in the past for WCiOS (paNNhX-ee-p2). Which is one reason why I wrote a Script Build Phase on WCiOS back then to explicitly detect nested frameworks during builds, to avoid finding out about this AppStore-incompatible setup early on instead of only finding out at submission time… (except if this has changed in more recent iOS versions?) |
An update on progress so far can be found at p1689191819837949-slack-CSYKQSY8G, which includes a link to documentation of various errors/blockers encountered when attempting to flatten the Hermes XCFramework embed. A few of us on the team have continued attempts to get this working, but to no success so far. It feels like we may really benefit from your expertise @mokagio, if you have availability to take a look. Thank you in advance 🙇♀️ |
Following the above comments, and as a last try, I explored how to flatten the Hermes framework and managed to do it in this PR. I'm not completely sure this is the best approach, so I'd appreciate any feedback. I haven't tested all scenarios yet, but so far it's solving the issue shared here (i.e. building the app locally using a physical device). I'll share a final confirmation when we manage to generate an installable build 🤞. |
Just a note to say that I'm back from AFK and I've started looking into this. |
Using the changes from wordpress-mobile/gutenberg-mobile#5968, I managed to build and run successfully the app locally for both the simulator and physical device. I haven't encountered the crash mentioned in this comment 🎊. Besides, the installable build was also generated by CI successfully. |
def apply_rnreanimated_workaround!(dependencies:, gutenberg_path:) | ||
# RNReanimated needs React-jsc | ||
# Reference: https://github.com/WordPress/gutenberg/pull/51386/commits/9538f8eaf73dfacef17382e1ab7feda40231061f | ||
dependencies.push('React-jsc') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff removes React-jsc
from the list of dependencies at the start of the file, only to add it back here, despite those dependencies only being used in the code path that hits this method.
Is the rationale that React-jsc
is required only because of the particular RNReanimated
setup that we are using here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had to do something similar for the Gutenberg demo app (WordPress/gutenberg@9538f8e) when using the newer version of Reanimated. It's unclear to me why it really needs it, but now that we are using Hermes, probably it's not required. I'll remove it and check if it produces any build failure.
|
||
raise "[Gutenberg] Could not find local Gutenberg at given path #{local_gutenberg_path}" unless File.exist?(local_gutenberg_path) | ||
# Use a custom RNReanimated version while we coordinate a fix upstream | ||
dependencies.delete('RNReanimated') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, software-mansion/react-native-reanimated#4684
Gutenberg/cocoapods_helpers.rb
Outdated
react_native_path = react_native_path!(gutenberg_path: gutenberg_path) | ||
package_json_path = File.join(react_native_path, 'package.json') | ||
package_json_content = File.read(package_json_path) | ||
package_version_match = package_json_content.match(/"version":\s*"(.*?)"/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Ruby has built in support for parsing JSONs
package_version_match = package_json_content.match(/"version":\s*"(.*?)"/) | |
package_json_version = JSON.parse(package_json_content)['version'] |
This will also required importing Ruby's JSON module
# At the top of the file
require 'json'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I was tempted to use the JSON library but went that way (for no particular reason) to avoid adding it to Gemfile
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if you indeed need to explicitly require 'json'
to use it, iinm the JSON module is part of Ruby core, so there's no need to add it to the Gemfile
.
(Think of if you were using import Foundation
in a Swift project 😛 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks for pointing that out @AliSoftware. Not sure why I thought it wasn't part of the core. I'll use this approach then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion applied in 80db7ba.
82f2d79
to
1c5fb5f
Compare
The pre-install logic is only needed when using local Gutenberg installation. Hence, we can merge it into the `gutenberg_dependencies`, which is only used in that case. Additionally, the React Native modules path has been fixed to point to the local installation. Fix empty line after guard clause lint issue
1c5fb5f
to
551968e
Compare
@@ -11,8 +11,8 @@ | |||
# | |||
# LOCAL_GUTENBERG=../my-gutenberg-fork bundle exec pod install | |||
GUTENBERG_CONFIG = { | |||
# commit: '' | |||
tag: 'v1.100.0-alpha1' | |||
commit: 'd2eab790e3c4333a059f920ce6c4ced5b9c11112' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Points to wordpress-mobile/gutenberg-mobile#5973 to use the workaround for the Hermes framework.
…mework-and-ui-tests Fix failing UI tests after React Native upgrade in Gutenberg
Now with UI test failures solved, this PR is ready for a final review. |
Closing in favor of #20956, as these changes need to be merged along with the React Native upgrade |
Description
To test
bundle install && LOCAL_GUTENBERG=1 bundle exec pod install
.NOTE: If you experience a build failure related to
'butter/map.h'
, try to execute:rm -rf build && rm -rf Pods
and install pods again.1.99.0
via XCFramework:bundle install && bundle exec pod install
.NOTE: It's recommended to use Xcode 14.3.1, as I encountered build failures when using Xcode 14.0.
Regression Notes
Potential unintended areas of impact
N/A
What I did to test those areas of impact (or what existing automated tests I relied on)
N/A
What automated tests I added (or what prevented me from doing so)
N/A
PR submission checklist:
RELEASE-NOTES.txt
if necessary.UI Changes testing checklist: