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

feat(react-native): enable hermes engine #15279

Merged
merged 6 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ def vcode = (int) (((new Date().getTime() / 1000) - 1546297200) / 10)
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
packagingOptions {
jniLibs {
excludes += ['lib/*/libhermes*.so']
}
}


defaultConfig {
applicationId 'org.jitsi.meet'
Expand Down
10 changes: 4 additions & 6 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@ buildscript {
}

ext {
kotlinVersion = "1.9.0"
buildToolsVersion = "33.0.2"
kotlinVersion = "1.9.24"
buildToolsVersion = "34.0.0"
compileSdkVersion = 34
minSdkVersion = 24
targetSdkVersion = 34
supportLibVersion = "28.0.0"

// NDK is now entirely compatible with Apple Silicon M1 and M2 Macs as of version 24.0.
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
Calinteodor marked this conversation as resolved.
Show resolved Hide resolved
ndkVersion = "26.1.10909125"

// The Maven artifact groupId of the third-party react-native modules which
Expand All @@ -44,8 +41,9 @@ ext {

googleServicesEnabled = project.file('app/google-services.json').exists() && !libreBuild

//React Native Version
//React Native and Hermes Version
rnVersion = "0.75.4"
hermesVersion = "0.75.4"
}

allprojects {
Expand Down
30 changes: 1 addition & 29 deletions android/scripts/release-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ THE_MVN_REPO=${MVN_REPO:-${1:-$DEFAULT_MVN_REPO}}
MVN_HTTP=0
DEFAULT_SDK_VERSION=$(grep sdkVersion ${THIS_DIR}/../gradle.properties | cut -d"=" -f2)
SDK_VERSION=${OVERRIDE_SDK_VERSION:-${DEFAULT_SDK_VERSION}}
JSC_VERSION="r"$(jq -r '.dependencies."jsc-android"' ${THIS_DIR}/../../node_modules/react-native/package.json | cut -d . -f 1 | cut -c 2-)

if [[ $THE_MVN_REPO == http* ]]; then
MVN_HTTP=1
Expand All @@ -23,34 +22,7 @@ export MVN_REPO=$THE_MVN_REPO
echo "Releasing Jitsi Meet SDK ${SDK_VERSION}"
echo "Using ${MVN_REPO} as the Maven repo"

if [[ $MVN_HTTP == 1 ]]; then
# Push JSC
echo "Pushing JSC ${JSC_VERSION} to the Maven repo"
pushd ${THIS_DIR}/../../node_modules/jsc-android/dist/org/webkit/android-jsc/${JSC_VERSION}
mvn \
deploy:deploy-file \
-Durl=${MVN_REPO} \
-DrepositoryId=${MVN_REPO_ID} \
-Dfile=android-jsc-${JSC_VERSION}.aar \
-Dpackaging=aar \
-DgeneratePom=false \
-DpomFile=android-jsc-${JSC_VERSION}.pom || true
popd
else
# Push JSC, if necessary
if [[ ! -d ${MVN_REPO}/org/webkit/android-jsc/${JSC_VERSION} ]]; then
echo "Pushing JSC ${JSC_VERSION} to the Maven repo"
pushd ${THIS_DIR}/../../node_modules/jsc-android/dist/org/webkit/android-jsc/${JSC_VERSION}
mvn \
deploy:deploy-file \
-Durl=${MVN_REPO} \
-Dfile=android-jsc-${JSC_VERSION}.aar \
-Dpackaging=aar \
-DgeneratePom=false \
-DpomFile=android-jsc-${JSC_VERSION}.pom
popd
fi

if [[ $MVN_HTTP == 0 ]]; then
# Check if an SDK with that same version has already been released
if [[ -d ${MVN_REPO}/org/jitsi/react/jitsi-meet-sdk/${SDK_VERSION} ]]; then
echo "There is already a release with that version in the Maven repo!"
Expand Down
3 changes: 2 additions & 1 deletion android/sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dependencies {
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

api "com.facebook.react:react-android:$rootProject.ext.rnVersion"
api "com.facebook.react:hermes-android:$rootProject.ext.hermesVersion"

//noinspection GradleDynamicVersion
implementation 'org.webkit:android-jsc:+'
Expand All @@ -57,7 +58,7 @@ dependencies {
if (!rootProject.ext.libreBuild) {
implementation project(':react-native-amplitude')
implementation project(':react-native-giphy')
implementation(project(":react-native-google-signin")) {
implementation(project(':react-native-google-signin')) {
exclude group: 'com.google.android.gms'
exclude group: 'androidx'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

import androidx.annotation.Nullable;

import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.common.LifecycleState;
import com.facebook.react.jscexecutor.JSCExecutorFactory;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.uimanager.ViewManager;
import com.oney.WebRTCModule.EglUtils;
Expand Down Expand Up @@ -156,11 +156,6 @@ public List<ViewManager> createViewManagers(ReactApplicationContext reactContext
return packages;
}

static JSCExecutorFactory getReactNativeJSFactory() {
// Keep on using JSC, the jury is out on Hermes.
return new JSCExecutorFactory("", "");
}

/**
* Helper function to send an event to JavaScript.
*
Expand Down Expand Up @@ -240,7 +235,7 @@ static void initReactInstanceManager(Activity activity) {
.setCurrentActivity(activity)
.setBundleAssetName("index.android.bundle")
.setJSMainModulePath("index.android")
.setJavaScriptExecutorFactory(getReactNativeJSFactory())
.setJavaScriptExecutorFactory(new HermesExecutorFactory())
.addPackages(getReactNativePackages())
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
Expand Down
25 changes: 23 additions & 2 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ target 'JitsiMeetSDK' do
flags = get_default_flags()
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => false,
:hermes_enabled => true,
:fabric_enabled => false,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
Expand Down Expand Up @@ -65,7 +65,7 @@ target 'JitsiMeetSDKLite' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => false,
:hermes_enabled => true,
:fabric_enabled => false,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
Expand All @@ -78,6 +78,8 @@ target 'JitsiMeetSDKLite' do
end

post_install do |installer|

PLIST_BUDDY_PATH = '/usr/libexec/PlistBuddy'
react_native_post_install(
installer,
use_native_modules![:reactNativePath],
Expand All @@ -90,10 +92,29 @@ post_install do |installer|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
end
end

target.build_configurations.each do |config|
config.build_settings['SUPPORTS_MACCATALYST'] = 'NO'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.1'
config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -no-verify-emitted-module-interface'
end

# Can be removed when updated to RN 0.76
# Issue https://github.com/facebook/react-native/issues/35863#issuecomment-1387465588
if target.name == "hermes-engine"
installer.pods_project.files.each do |fileref|
if fileref.path.end_with? "hermes.xcframework"
hermes_plist_file = "#{fileref.real_path}/Info.plist"
# Patch Hermes to remove the debug symbols entry from the Info.plist (as it's not shipped with it)
# This might be removed once Hermes starts to ship with Debug symbols or we remove our
# direct dependency from the Main iOS target on "hermes.xcframework"
Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:0:DebugSymbolsPath', hermes_plist_file)
Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:1:DebugSymbolsPath', hermes_plist_file)
Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:2:DebugSymbolsPath', hermes_plist_file)
Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:3:DebugSymbolsPath', hermes_plist_file)
Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:4:DebugSymbolsPath', hermes_plist_file)
end
end
end
end
end
Loading