Add Hermes support to React Native on Android#25613
Conversation
facebook-github-bot
left a comment
There was a problem hiding this comment.
@cpojer has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
analysis-bot
left a comment
There was a problem hiding this comment.
Code analysis results:
eslintfound some issues. Runyarn lint --fixto automatically fix problems.
There was a problem hiding this comment.
should this be wrapped in an if (enableHermes)? We don't need both hermes and jsc.
There was a problem hiding this comment.
what do you think about moving this to react.gradle so all apps don't have to manually do this? we'd need to be able to infer if a variant requires the release or debug aar. There's already hermesFlagsRelease/hermesFlagsDebug so we could build on that concept.
There was a problem hiding this comment.
This change is really large, I prefer to land it and then hope the community will help improve it. Right now this is following what JSC is doing already.
|
analysis-bot
left a comment
There was a problem hiding this comment.
Code analysis results:
eslintfound some issues. Runyarn lint --fixto automatically fix problems.
analysis-bot
left a comment
There was a problem hiding this comment.
Code analysis results:
eslintfound some issues. Runyarn lint --fixto automatically fix problems.
There was a problem hiding this comment.
no-unused-vars: 'Property' is defined but never used.
There was a problem hiding this comment.
no-unused-vars: 'Writable' is defined but never used.
facebook-github-bot
left a comment
There was a problem hiding this comment.
@cpojer has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@cpojer Looks like there is a missing BUCK config for hermes.reactexecutor, which then needs to be imported in ReactAndroid/src/main/java/com/facebook/react/BUCK. |
|
Thanks @janicduplessis. I didn’t have time to work on it yet. Any chance you could create the buck file so I can amend it into this PR? I’d love to merge this PR this week but not sure I’ll have the time. |
|
@cpojer Is the hermes executor used internally at fb? I'd be surprised if the buck file doesn't already exist. Anyway I'll look into adding it and see if I can get this PR building with BUCK later today. |
|
Buck problem is fixed, now we are actually down to the interesting issues. |
|
Currently blocked on an issue that @mhorowitz is looking into. |
34e9993 to
13ad3aa
Compare
|
Hi @cpojer, would you mind releasing a 0.60.4 please? The last two commits enables to use Sentry and also reduce the APK size (since it doesn't include sourcemaps anymore) |
|
@Minishlink we'll be making a new release soon. |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@cpojer has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
Thanks @cpojer 😃 |
|
Got another patch to fix proguard support janicduplessis@aa4dd9e. I guess if this is about to land we can wait and I'll open a new PR. |
|
@janicduplessis currently working on getting CI working at FB. I'll manually pick your change into the internal version of this PR. Thanks for linking it! |
|
@cpojer Oups I just noticed I missed adding @DoNotStrip on the first method. janicduplessis@aa4dd9e is the fixed version. |
| pickFirst '**/arm64-v8a/libc++_shared.so' | ||
| pickFirst '**/x86_64/libc++_shared.so' | ||
| pickFirst '**/x86/libjsc.so' | ||
| pickFirst '**/armeabi-v7a/libjsc.so' |
There was a problem hiding this comment.
Just curious if the pickFirst for libjsc.so is needed?
IMO, even the pickFirst for libc++_shared.so getting some risk.
I knew that Hermes AAR includes libc++_shared.so, so we need the pickFirst here.
Hermes libc++_shared.so should be from NDK r13b and RN's is from NDK r17c or r19c.
This works because NDK maintains good ABI compatibility.
However, if user have other 3rd party gradle dependencies, gradle may pick to the 3rd party libc++_shared.so which is not what we expected.
This kind of problem is hard to troubleshoot because gradle pickFirst is really undeterministic.
Recommend if Hermes could remove libc++_shared.so from AAR and we could remove the pickFirst from template.
|
This pull request was successfully merged by @cpojer in d7f5153. When will my fix make it into a release? | Upcoming Releases |
|
It landed thanks to @willholen who helped patch everything up at FB. I hope this isn't going to cause internal issues and has to be reverted – we should know more about that at the end of the day. If you are having suggestions on how to improve Hermes integration, please send PRs to make it incrementally better :) |
Summary
Yesterday we shipped hermesengine.dev as part of the current 0.60 release. This PR brings those changes to master.
Changelog
[General] [Added] - Added support for Hermes
Test Plan