Просмотр исходного кода

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

Enabled hermes JS engine and updated SDK release scripts for both Android and iOS.
factor2
Calinteodor 6 месяцев назад
Родитель
Сommit
f3324ab165
Аккаунт пользователя с таким Email не найден

+ 0
- 6
android/app/build.gradle Просмотреть файл

@@ -15,12 +15,6 @@ def vcode = (int) (((new Date().getTime() / 1000) - 1546297200) / 10)
15 15
 android {
16 16
     compileSdkVersion rootProject.ext.compileSdkVersion
17 17
     buildToolsVersion rootProject.ext.buildToolsVersion
18
-    packagingOptions {
19
-        jniLibs {
20
-            excludes += ['lib/*/libhermes*.so']
21
-        }
22
-    }
23
-
24 18
 
25 19
     defaultConfig {
26 20
         applicationId 'org.jitsi.meet'

+ 4
- 6
android/build.gradle Просмотреть файл

@@ -17,15 +17,12 @@ buildscript {
17 17
 }
18 18
 
19 19
 ext {
20
-    kotlinVersion = "1.9.0"
21
-    buildToolsVersion = "33.0.2"
20
+    kotlinVersion = "1.9.24"
21
+    buildToolsVersion = "34.0.0"
22 22
     compileSdkVersion = 34
23 23
     minSdkVersion    = 24
24 24
     targetSdkVersion = 34
25 25
     supportLibVersion = "28.0.0"
26
-
27
-    // NDK is now entirely compatible with Apple Silicon M1 and M2 Macs as of version 24.0.
28
-    // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
29 26
     ndkVersion = "26.1.10909125"
30 27
 
31 28
     // The Maven artifact groupId of the third-party react-native modules which
@@ -44,8 +41,9 @@ ext {
44 41
 
45 42
     googleServicesEnabled = project.file('app/google-services.json').exists() && !libreBuild
46 43
 
47
-    //React Native Version
44
+    //React Native and Hermes Version
48 45
     rnVersion = "0.75.4"
46
+    hermesVersion = "0.75.4"
49 47
 }
50 48
 
51 49
 allprojects {

+ 1
- 29
android/scripts/release-sdk.sh Просмотреть файл

@@ -9,7 +9,6 @@ THE_MVN_REPO=${MVN_REPO:-${1:-$DEFAULT_MVN_REPO}}
9 9
 MVN_HTTP=0
10 10
 DEFAULT_SDK_VERSION=$(grep sdkVersion ${THIS_DIR}/../gradle.properties | cut -d"=" -f2)
11 11
 SDK_VERSION=${OVERRIDE_SDK_VERSION:-${DEFAULT_SDK_VERSION}}
12
-JSC_VERSION="r"$(jq -r '.dependencies."jsc-android"' ${THIS_DIR}/../../node_modules/react-native/package.json | cut -d . -f 1 | cut -c 2-)
13 12
 
14 13
 if [[ $THE_MVN_REPO == http* ]]; then
15 14
     MVN_HTTP=1
@@ -23,34 +22,7 @@ export MVN_REPO=$THE_MVN_REPO
23 22
 echo "Releasing Jitsi Meet SDK ${SDK_VERSION}"
24 23
 echo "Using ${MVN_REPO} as the Maven repo"
25 24
 
26
- if [[ $MVN_HTTP == 1 ]]; then
27
-    # Push JSC
28
-    echo "Pushing JSC ${JSC_VERSION} to the Maven repo"
29
-    pushd ${THIS_DIR}/../../node_modules/jsc-android/dist/org/webkit/android-jsc/${JSC_VERSION}
30
-    mvn \
31
-        deploy:deploy-file \
32
-        -Durl=${MVN_REPO} \
33
-        -DrepositoryId=${MVN_REPO_ID} \
34
-        -Dfile=android-jsc-${JSC_VERSION}.aar \
35
-        -Dpackaging=aar \
36
-        -DgeneratePom=false \
37
-        -DpomFile=android-jsc-${JSC_VERSION}.pom || true
38
-    popd
39
-else
40
-    # Push JSC, if necessary
41
-    if [[ ! -d ${MVN_REPO}/org/webkit/android-jsc/${JSC_VERSION} ]]; then
42
-        echo "Pushing JSC ${JSC_VERSION} to the Maven repo"
43
-        pushd ${THIS_DIR}/../../node_modules/jsc-android/dist/org/webkit/android-jsc/${JSC_VERSION}
44
-        mvn \
45
-            deploy:deploy-file \
46
-            -Durl=${MVN_REPO} \
47
-            -Dfile=android-jsc-${JSC_VERSION}.aar \
48
-            -Dpackaging=aar \
49
-            -DgeneratePom=false \
50
-            -DpomFile=android-jsc-${JSC_VERSION}.pom
51
-        popd
52
-    fi
53
-
25
+ if [[ $MVN_HTTP == 0 ]]; then
54 26
     # Check if an SDK with that same version has already been released
55 27
     if [[ -d ${MVN_REPO}/org/jitsi/react/jitsi-meet-sdk/${SDK_VERSION} ]]; then
56 28
         echo "There is already a release with that version in the Maven repo!"

+ 2
- 1
android/sdk/build.gradle Просмотреть файл

@@ -42,6 +42,7 @@ dependencies {
42 42
     implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
43 43
 
44 44
     api "com.facebook.react:react-android:$rootProject.ext.rnVersion"
45
+    api "com.facebook.react:hermes-android:$rootProject.ext.hermesVersion"
45 46
 
46 47
     //noinspection GradleDynamicVersion
47 48
     implementation 'org.webkit:android-jsc:+'
@@ -57,7 +58,7 @@ dependencies {
57 58
     if (!rootProject.ext.libreBuild) {
58 59
         implementation project(':react-native-amplitude')
59 60
         implementation project(':react-native-giphy')
60
-        implementation(project(":react-native-google-signin")) {
61
+        implementation(project(':react-native-google-signin')) {
61 62
             exclude group: 'com.google.android.gms'
62 63
             exclude group: 'androidx'
63 64
         }

+ 2
- 7
android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java Просмотреть файл

@@ -21,13 +21,13 @@ import android.util.Log;
21 21
 
22 22
 import androidx.annotation.Nullable;
23 23
 
24
+import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
24 25
 import com.facebook.react.ReactInstanceManager;
25 26
 import com.facebook.react.ReactPackage;
26 27
 import com.facebook.react.bridge.NativeModule;
27 28
 import com.facebook.react.bridge.ReactApplicationContext;
28 29
 import com.facebook.react.bridge.ReactContext;
29 30
 import com.facebook.react.common.LifecycleState;
30
-import com.facebook.react.jscexecutor.JSCExecutorFactory;
31 31
 import com.facebook.react.modules.core.DeviceEventManagerModule;
32 32
 import com.facebook.react.uimanager.ViewManager;
33 33
 import com.oney.WebRTCModule.EglUtils;
@@ -156,11 +156,6 @@ class ReactInstanceManagerHolder {
156 156
         return packages;
157 157
     }
158 158
 
159
-    static JSCExecutorFactory getReactNativeJSFactory() {
160
-        // Keep on using JSC, the jury is out on Hermes.
161
-        return new JSCExecutorFactory("", "");
162
-    }
163
-
164 159
     /**
165 160
      * Helper function to send an event to JavaScript.
166 161
      *
@@ -240,7 +235,7 @@ class ReactInstanceManagerHolder {
240 235
                 .setCurrentActivity(activity)
241 236
                 .setBundleAssetName("index.android.bundle")
242 237
                 .setJSMainModulePath("index.android")
243
-                .setJavaScriptExecutorFactory(getReactNativeJSFactory())
238
+                .setJavaScriptExecutorFactory(new HermesExecutorFactory())
244 239
                 .addPackages(getReactNativePackages())
245 240
                 .setUseDeveloperSupport(BuildConfig.DEBUG)
246 241
                 .setInitialLifecycleState(LifecycleState.RESUMED)

+ 23
- 2
ios/Podfile Просмотреть файл

@@ -32,7 +32,7 @@ target 'JitsiMeetSDK' do
32 32
   flags = get_default_flags()
33 33
   use_react_native!(
34 34
     :path => config[:reactNativePath],
35
-    :hermes_enabled => false,
35
+    :hermes_enabled => true,
36 36
     :fabric_enabled => false,
37 37
     # An absolute path to your application root.
38 38
     :app_path => "#{Pod::Config.instance.installation_root}/.."
@@ -65,7 +65,7 @@ target 'JitsiMeetSDKLite' do
65 65
     config = use_native_modules!
66 66
     use_react_native!(
67 67
       :path => config[:reactNativePath],
68
-      :hermes_enabled => false,
68
+      :hermes_enabled => true,
69 69
       :fabric_enabled => false,
70 70
       # An absolute path to your application root.
71 71
       :app_path => "#{Pod::Config.instance.installation_root}/.."
@@ -78,6 +78,8 @@ target 'JitsiMeetSDKLite' do
78 78
 end
79 79
 
80 80
 post_install do |installer|
81
+
82
+  PLIST_BUDDY_PATH = '/usr/libexec/PlistBuddy'
81 83
   react_native_post_install(
82 84
     installer,
83 85
     use_native_modules![:reactNativePath],
@@ -90,10 +92,29 @@ post_install do |installer|
90 92
         config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
91 93
       end
92 94
     end
95
+
93 96
     target.build_configurations.each do |config|
94 97
       config.build_settings['SUPPORTS_MACCATALYST'] = 'NO'
95 98
       config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.1'
96 99
       config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -no-verify-emitted-module-interface'
97 100
     end
101
+
102
+    # Can be removed when updated to RN 0.76
103
+    # Issue https://github.com/facebook/react-native/issues/35863#issuecomment-1387465588
104
+    if target.name == "hermes-engine"
105
+     installer.pods_project.files.each do |fileref|
106
+      if fileref.path.end_with? "hermes.xcframework"
107
+        hermes_plist_file = "#{fileref.real_path}/Info.plist"
108
+        # Patch Hermes to remove the debug symbols entry from the Info.plist (as it's not shipped with it)
109
+        # This might be removed once Hermes starts to ship with Debug symbols or we remove our
110
+        # direct dependency from the Main iOS target on "hermes.xcframework"
111
+        Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:0:DebugSymbolsPath', hermes_plist_file)
112
+        Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:1:DebugSymbolsPath', hermes_plist_file)
113
+        Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:2:DebugSymbolsPath', hermes_plist_file)
114
+        Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:3:DebugSymbolsPath', hermes_plist_file)
115
+        Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:4:DebugSymbolsPath', hermes_plist_file)
116
+      end
117
+    end
118
+   end
98 119
   end
99 120
 end

+ 156
- 102
ios/Podfile.lock
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 9
- 3
ios/app/app.xcodeproj/project.pbxproj Просмотреть файл

@@ -25,6 +25,8 @@
25 25
 		13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
26 26
 		2681BB562C7A0B42CFBA6719 /* libPods-JitsiMeet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D6152FF9E9F7B0E86F70A21D /* libPods-JitsiMeet.a */; };
27 27
 		361974E2A13624D7735D619D /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 5C1BE20ECD5DEEB48FED90B5 /* PrivacyInfo.xcprivacy */; };
28
+		4341A9062CF0D63200940D93 /* hermes.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4341A9052CF0D63200940D93 /* hermes.xcframework */; };
29
+		4341A9072CF0D63200940D93 /* hermes.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4341A9052CF0D63200940D93 /* hermes.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
28 30
 		4E90F9402632D1AB001102D4 /* Atomic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E90F93F2632D1AB001102D4 /* Atomic.swift */; };
29 31
 		4EB06024260E026600F524C5 /* ReplayKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EC49B8625BED71300E76218 /* ReplayKit.framework */; };
30 32
 		4EB06027260E026600F524C5 /* SampleHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EB06026260E026600F524C5 /* SampleHandler.swift */; };
@@ -75,6 +77,7 @@
75 77
 			dstSubfolderSpec = 10;
76 78
 			files = (
77 79
 				DEA9F28A258A6EA800D4CD74 /* JitsiMeetSDK.framework in Embed Frameworks */,
80
+				4341A9072CF0D63200940D93 /* hermes.xcframework in Embed Frameworks */,
78 81
 				FD572B9927EDF32300A800FB /* GiphyUISDK.xcframework in Embed Frameworks */,
79 82
 				DED016F228ECBC9D009D5E8D /* WebRTC.xcframework in Embed Frameworks */,
80 83
 			);
@@ -143,6 +146,7 @@
143 146
 		13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
144 147
 		13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
145 148
 		3E0F4ED943C0B12BE77F6B45 /* Pods-JitsiMeet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.release.xcconfig"; path = "Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.release.xcconfig"; sourceTree = "<group>"; };
149
+		4341A9052CF0D63200940D93 /* hermes.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = hermes.xcframework; path = "../Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework"; sourceTree = "<group>"; };
146 150
 		4E90F93F2632D1AB001102D4 /* Atomic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Atomic.swift; sourceTree = "<group>"; };
147 151
 		4EB06023260E026600F524C5 /* JitsiMeetBroadcastExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = JitsiMeetBroadcastExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
148 152
 		4EB06026260E026600F524C5 /* SampleHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleHandler.swift; sourceTree = "<group>"; };
@@ -152,7 +156,7 @@
152 156
 		4EB0603A260E09D000F524C5 /* DarwinNotificationCenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DarwinNotificationCenter.swift; sourceTree = "<group>"; };
153 157
 		4EB0603B260E09D000F524C5 /* SampleUploader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SampleUploader.swift; sourceTree = "<group>"; };
154 158
 		4EC49B8625BED71300E76218 /* ReplayKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReplayKit.framework; path = System/Library/Frameworks/ReplayKit.framework; sourceTree = SDKROOT; };
155
-		5C1BE20ECD5DEEB48FED90B5 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
159
+		5C1BE20ECD5DEEB48FED90B5 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
156 160
 		6132EF172BDFF13200BBE14D /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = ../PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
157 161
 		756FCE06C08D9B947653C98A /* Pods-JitsiMeet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.debug.xcconfig"; path = "Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.debug.xcconfig"; sourceTree = "<group>"; };
158 162
 		B3B083EB1D4955FF0069CEE7 /* app.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = app.entitlements; sourceTree = "<group>"; };
@@ -184,6 +188,7 @@
184 188
 				DEA9F289258A6EA800D4CD74 /* JitsiMeetSDK.framework in Frameworks */,
185 189
 				FD572B9827EDF32300A800FB /* GiphyUISDK.xcframework in Frameworks */,
186 190
 				2681BB562C7A0B42CFBA6719 /* libPods-JitsiMeet.a in Frameworks */,
191
+				4341A9062CF0D63200940D93 /* hermes.xcframework in Frameworks */,
187 192
 			);
188 193
 			runOnlyForDeploymentPostprocessing = 0;
189 194
 		};
@@ -208,6 +213,7 @@
208 213
 		0B26BE711EC5BC4D00EEFB41 /* Frameworks */ = {
209 214
 			isa = PBXGroup;
210 215
 			children = (
216
+				4341A9052CF0D63200940D93 /* hermes.xcframework */,
211 217
 				DED016F028ECBC9D009D5E8D /* WebRTC.xcframework */,
212 218
 				FD572B9727EDF32300A800FB /* GiphyUISDK.xcframework */,
213 219
 				DEA9F288258A6EA800D4CD74 /* JitsiMeetSDK.framework */,
@@ -1068,7 +1074,7 @@
1068 1074
 				SDKROOT = iphoneos;
1069 1075
 				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
1070 1076
 				TARGETED_DEVICE_FAMILY = "1,2";
1071
-				USE_HERMES = false;
1077
+				USE_HERMES = true;
1072 1078
 			};
1073 1079
 			name = Debug;
1074 1080
 		};
@@ -1134,7 +1140,7 @@
1134 1140
 				SDKROOT = iphoneos;
1135 1141
 				SWIFT_COMPILATION_MODE = wholemodule;
1136 1142
 				TARGETED_DEVICE_FAMILY = "1,2";
1137
-				USE_HERMES = false;
1143
+				USE_HERMES = true;
1138 1144
 				VALIDATE_PRODUCT = YES;
1139 1145
 			};
1140 1146
 			name = Release;

+ 1
- 0
ios/scripts/release-sdk-lite.sh Просмотреть файл

@@ -54,6 +54,7 @@ pushd ${RELEASE_REPO}
54 54
 
55 55
 # Put the new files in the repo
56 56
 cp -a ${PROJECT_REPO}/ios/sdk/out/JitsiMeetSDK.xcframework lite/Frameworks/
57
+cp -a ${PROJECT_REPO}/ios/sdk/out/hermes.xcframework lite/Frameworks/
57 58
 
58 59
 # Add all files to git
59 60
 git add -A .

+ 1
- 0
ios/scripts/release-sdk.sh Просмотреть файл

@@ -54,6 +54,7 @@ pushd ${RELEASE_REPO}
54 54
 
55 55
 # Put the new files in the repo
56 56
 cp -a ${PROJECT_REPO}/ios/sdk/out/JitsiMeetSDK.xcframework Frameworks/
57
+cp -a ${PROJECT_REPO}/ios/sdk/out/hermes.xcframework Frameworks/
57 58
 
58 59
 # Add all files to git
59 60
 git add -A .

+ 2
- 2
ios/sdk/sdk.xcodeproj/project.pbxproj Просмотреть файл

@@ -790,7 +790,7 @@
790 790
 				SDKROOT = iphoneos;
791 791
 				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
792 792
 				TARGETED_DEVICE_FAMILY = "1,2";
793
-				USE_HERMES = false;
793
+				USE_HERMES = true;
794 794
 				VERSIONING_SYSTEM = "apple-generic";
795 795
 				VERSION_INFO_PREFIX = "";
796 796
 			};
@@ -859,7 +859,7 @@
859 859
 				SDKROOT = iphoneos;
860 860
 				SWIFT_COMPILATION_MODE = wholemodule;
861 861
 				TARGETED_DEVICE_FAMILY = "1,2";
862
-				USE_HERMES = false;
862
+				USE_HERMES = true;
863 863
 				VALIDATE_PRODUCT = YES;
864 864
 				VERSIONING_SYSTEM = "apple-generic";
865 865
 				VERSION_INFO_PREFIX = "";

Загрузка…
Отмена
Сохранить