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

Remove libc++_shared.so from AAR and add hermes-cppruntime.aar #74

Closed
wants to merge 2 commits into from

Conversation

Kudo
Copy link
Contributor

@Kudo Kudo commented Jul 31, 2019

Currently the Hermes AAR includes libc++_shared.so, so that React Native needs to add pickFirst to workaround gradle conflict issue.
However, pickFirst is not a reliable way to select expected libc++_shared.so because we cannot ensure which gradle dependency is the first one for gradle to pick.
If user have other 3rd party gradle dependencies, the situation is even worst and this kind of bug is hard to troubleshoot.
Even though NDK maintains good ABI quality between different versions, I would still suggest if we could remove the pickFirst from RN project template.

This PR removes libc++_shared.so from Hermes AAR and adds another hermes-cppruntime.aar depedency if user need it for other purposes.
The approach is pretty much like as what we did in jsc-android.

Kudo added 2 commits July 31, 2019 21:06
Summary:
    1. Support multiple projects architecture and move original Hermes build
       into hermes/ subproject.
    2. Add packagingOptions.exclude "**/libc++_shared.so" for Hermes
       subproject.
Summary:
    1. Add cppruntime subproject which will generate
       hermes-cppruntime-release.aar included libc++_shared.so.

    2. To get libc++_shared.so, although we could have a gradle
       custom task to copy the file from NDK, the drawback is that the
       path might change between different NDK versions.
       I decided to have a stub cpp and use formal cmake build to
       generate libc++_shared.so as usual.
       During the time to generate AAR,
       using packagingOptions.exclude "**/libstub.so"
       to keep only libc++_shared.so.
@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Jul 31, 2019
@willholen
Copy link
Contributor

Looks good to me. Am I understanding it correctly that this does not prevent ABI compatibility bugs, but instead makes such bugs easier to reproduce and fix because the libc++_shared.so is now chosen deterministically?

Will we need to e.g. update the react-native app template?

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@willholen has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@Kudo
Copy link
Contributor Author

Kudo commented Aug 1, 2019

Yes, to truly prevent ABI incompatibility, we should align the NDK version for Hermes and RN.
Right now RN uses NDK r19c and Hermes seems to use latest NDK, say r20.
After removing the pickFirst, we could determine the libc++_shared.so is from RN.
If user add 3rd party dependencies and add pickFirst manually, that is user's risk.
Defensing ourselves that the pickFirst is not we introduced from RN template.

Will we need to e.g. update the react-native app template?

Yes, if the PR landed and new version released. I will have a PR to remove the pickFirst from RN template.

@facebook-github-bot
Copy link
Contributor

@willholen merged this pull request in 7089054.

facebook-github-bot pushed a commit that referenced this pull request Sep 12, 2019
Summary:
The 'aar/' subdirectory was introduced in PR #74. This changes it back, to
retain compatibility with existing versions.

Reviewed By: jbower-fb

Differential Revision: D17330056

fbshipit-source-id: 28722e874024ad16b2f5fbba4bbc3e7d4669610f
mganandraj pushed a commit to mganandraj/hermes that referenced this pull request Oct 15, 2019
…ook#74)

Summary:
Currently the Hermes AAR includes libc++_shared.so, so that React Native needs to add [pickFirst](https://github.com/facebook/react-native/blob/0738fe5738c21463da93e3551f8f78ddcb6545e3/template/android/app/build.gradle#L181-L184) to workaround gradle conflict issue.
However, pickFirst is not a reliable way to select expected libc++_shared.so because we cannot ensure which gradle dependency is the first one for gradle to pick.
If user have other 3rd party gradle dependencies, the situation is even worst and this kind of bug is hard to troubleshoot.
Even though NDK maintains good ABI quality between different versions, I would still suggest if we could remove the pickFirst from RN project template.

This PR removes libc++_shared.so from Hermes AAR and adds another hermes-cppruntime.aar depedency if user need it for other purposes.
The approach is pretty much like as what we did in [jsc-android](https://github.com/react-native-community/jsc-android-buildscripts#for-react-native-version-058-below).
Pull Request resolved: facebook#74

Reviewed By: dulinriley

Differential Revision: D16586875

Pulled By: willholen

fbshipit-source-id: add72a429d320c4ac02f443ddc1b912b2c52506f
mganandraj pushed a commit to mganandraj/hermes that referenced this pull request Oct 15, 2019
Summary:
The 'aar/' subdirectory was introduced in PR facebook#74. This changes it back, to
retain compatibility with existing versions.

Reviewed By: jbower-fb

Differential Revision: D17330056

fbshipit-source-id: 28722e874024ad16b2f5fbba4bbc3e7d4669610f
@whatleo whatleo mentioned this pull request Apr 1, 2021
mganandraj pushed a commit to mganandraj/hermes that referenced this pull request Jun 22, 2022
Split PR and CI in two yamls so we can run publish on internal ADO instance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants