Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upfeat: Enable Hermes to work on iOS #29914
Conversation
Base commit: 36b0f7d |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment has been hidden.
This comment has been hidden.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment has been hidden.
This comment has been hidden.
Summary: The nested `.gitattributes` file in `packages/react-native-codegen/android/` caused some confusion on Linux and macOS, causing Git to show `packages/react-native-codegen/android/gradlew.bat` as modified (CRLF removed, LF added). Instead of relying on repo-local `.gitattributes` files to convert endings in the working directory, the files should be committed to source control with the correct line endings in the first place. There is no reason to convert LF endings in .sh and many other file to CRLF on Windows (maybe this was an issue a long time ago, but unless Notepad is used this won't be a problem for practically all modern editors). Also fixed the line endings of `scripts/launchPackager.bat` which was incorrectly committed as LF. ## Changelog [Internal] [Fixed] - Line endings and .gitattributes Pull Request resolved: #29792 Test Plan: Clone repo on Linux, macOS, and Windows, and make sure no modified files show up. Reviewed By: fkgozali Differential Revision: D23546135 Pulled By: mdvacca fbshipit-source-id: 1572fcb959212f212b137066f1aa66f0bb6e86c3
This comment has been hidden.
This comment has been hidden.
|
Note: Upgrading to CocoaPods 1.10.0 in this PR to resolve #29984 |
|
@grabbou Looking at the CI output, it doesn't look like the |
Correct, we should be using |
…ve into feat/ios-hermes-try
|
FYI @hramos, I bumped Xcode to 12 and it fixed the build time errors I was getting on the CI. I will rebase once your PR is merged and remove my commits. |
| @@ -90,7 +90,7 @@ - (void)testLogging | |||
|
|
|||
| XCTAssertEqual(_lastLogLevel, RCTLogLevelError); | |||
| XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); | |||
| XCTAssertEqualObjects(_lastLogMessage, @"Invariant Violation: Invariant failed"); | |||
| XCTAssertTrue([_lastLogMessage containsString:@"Invariant Violation: Invariant failed"]); | |||
grabbou
Oct 29, 2020
Author
Collaborator
js engine: Hermes is added to the end of the error message / invariant when Hermes is on. Replaced with containsString to make it more universal.
CC: @alloy
js engine: Hermes is added to the end of the error message / invariant when Hermes is on. Replaced with containsString to make it more universal.
CC: @alloy
| @@ -114,7 +114,7 @@ - (void)testLogging | |||
|
|
|||
| XCTAssertEqual(_lastLogLevel, RCTLogLevelError); | |||
| XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); | |||
| XCTAssertEqualObjects(_lastLogMessage, @"Error: Throwing an error"); | |||
| XCTAssertTrue([_lastLogMessage containsString:@"Error: Throwing an error"]); | |||
grabbou
Oct 29, 2020
•
Author
Collaborator
On that note, shall we have two targets for integration tests and two targets for unit tests and run them on both Hermes and JSC? To be honest, it sounds to me like an overkill, but would like to discuss this idea.
Right now, Hermes is turned on by default in RNTester on iOS. As a result, all tests that we run are against Hermes.
On that note, shall we have two targets for integration tests and two targets for unit tests and run them on both Hermes and JSC? To be honest, it sounds to me like an overkill, but would like to discuss this idea.
Right now, Hermes is turned on by default in RNTester on iOS. As a result, all tests that we run are against Hermes.
alloy
Oct 30, 2020
Collaborator
I wonder if we can achieve that simply by passing something like GCC_PREPROCESSOR_DEFINITIONS ="RCT_USE_HERMES=0" to the xcodebuild command, rather than adding extra targets.
Either way, it might be better to do that in a follow-up PR?
I wonder if we can achieve that simply by passing something like GCC_PREPROCESSOR_DEFINITIONS ="RCT_USE_HERMES=0" to the xcodebuild command, rather than adding extra targets.
Either way, it might be better to do that in a follow-up PR?
|
The good news for anyone who is following this PR is - the build failures on CircleCI are finally gone! This week I spent on trying to understand why everything works and is green on my laptop and breaks on the CI. My plan for tomorrow is to make both |
| @@ -42,7 +42,8 @@ class GlobalEvalWithSourceUrlTest extends React.Component<{...}> { | |||
| 'Expected globalEvalWithSourceUrl to throw on a syntax error', | |||
| ); | |||
| } | |||
| if (!(syntaxError instanceof SyntaxError)) { | |||
| // Hermes throws an Error, not a SyntaxError | |||
| if (syntaxError.jsEngine !== 'hermes' && !(syntaxError instanceof SyntaxError)) { | |||
grabbou
Oct 30, 2020
•
Author
Collaborator
The exact error is:
Error: Exception in HostFunction: Compiling JS failed: 1:2:'}' expected at end of block
Is this a bug or a known characteristics of Hermes?
CC: @Huxpro
The exact error is:
Error: Exception in HostFunction: Compiling JS failed: 1:2:'}' expected at end of block
Is this a bug or a known characteristics of Hermes?
CC: @Huxpro
Huxpro
Oct 30, 2020
•
Contributor
@grabbou It's kinda related to a known problem that is complex and not going to be resolved anytime soon. It's complex since it's not so much of Hermes but the way we are building and linking our apps. I think we can leave the code this way for now and file an issue against the Hermes repo so we can track it down later.
@grabbou It's kinda related to a known problem that is complex and not going to be resolved anytime soon. It's complex since it's not so much of Hermes but the way we are building and linking our apps. I think we can leave the code this way for now and file an issue against the Hermes repo so we can track it down later.
Base commit: 36b0f7d |
Base commit: 36b0f7d |
|
@grabbou no need to wait for my PR to land first, don't let that block you, I can rebase after your changes land. As for the failing Android tests, we landed some fixes to master recently. |
|
Current status is:
Reverting that commit does fix the iOS build again, but I’m unsure of the ramifications. The proper fix would be to first build the macOS artefacts and then re-use its @Huxpro @TheSavior Do you have any thoughts on the best recourse/prioritization? Possible options I see are the following: Fastest turnaround timeThis could technically be released in a stable RN release.
Medium turnaround timeThis can not be released in a stable RN release.
Longest turnaround timeThis can definitely be released in a stable RN release.
|
|
@alloy thanks for the detailed summary! It seems like the real road blocking issue was just the JSI getting out of sync by d8b0e9d and we only need to do 2 and 3 of the "longest turnaround time" option to get this PR rolling again. We are working on a patch that include facebook/hermes@73594b5 and its dependencies onto the Hermes
It would be helpful to know what are the steps to repro so we can verify if the patch resolve the issue. I can still build RN Tester app on Android on RN master with the
Yeah, that would be the proper fix. At some point we'll need a hermes |
Summary
This PR makes it possible to build iOS applications with Hermes.
Fixes #27845 (by downgrading iOS deployment target for RCT-Folly to 9.0)
Fixes #28810 (as above)
Checklist:
yarn linkits master to this project)i386to Hermes framework and enable BitcodeChangelog
[IOS] [FEATURE] - Enable Hermes on iOS
[INTERNAL] - Upgrade to CocoaPods 1.10.0 to resolve Xcode 12.0 issues
[INTERNAL] - Upgrade to Xcode 12.0 on the CircleCI
[INTERNAL] - Fix building RNTester in Release mode
[INTERNAL] - Fix build-time errors of
libeventwithuse_frameworks![INTERNAL] - Do not fetch CocoaPods repository since we're using CDN anyway
Test Plan
Turn on
hermes_enabledto true in yourPodfile, install pods, and run the iOS application. Your app should be running Hermes now.Preview: (note "Engine: Hermes")