Browse Source

feat(android) revert to JSC as our JS engine

JSC wasn't the cause for the crash we were hunting after all. RN doesn't set
HErmes as the default, neither does Expo, so the jury is still out on Hermes,
and it looks like JSC is still the safest bet.

In addition, the way Hermes is packaged (as a standalone AARs, instead of a
local "Maven repo") complicates the SDK build and can make the resulting build
bloated.
master
Titus-Andrei Moldovan 5 years ago
parent
commit
2a9805f9b1

+ 1
- 5
android/app/proguard-rules.pro View File

85
 # ^^^ We added the above when we switched minifyEnabled on.
85
 # ^^^ We added the above when we switched minifyEnabled on.
86
 
86
 
87
 # Rule to avoid build errors related to SVGs.
87
 # Rule to avoid build errors related to SVGs.
88
--keep public class com.horcrux.svg.** {*;}
89
-
90
-# Hermes
91
--keep class com.facebook.hermes.unicode.** { *; }
92
-
88
+-keep public class com.horcrux.svg.** {*;}

+ 2
- 0
android/build.gradle View File

21
         jcenter()
21
         jcenter()
22
         // React Native (JS, Obj-C sources, Android binaries) is installed from npm.
22
         // React Native (JS, Obj-C sources, Android binaries) is installed from npm.
23
         maven { url "$rootDir/../node_modules/react-native/android" }
23
         maven { url "$rootDir/../node_modules/react-native/android" }
24
+        // Android JSC is installed from npm.
25
+        maven { url("$rootDir/../node_modules/jsc-android/dist") }
24
     }
26
     }
25
 
27
 
26
     // Make sure we use the react-native version in node_modules and not the one
28
     // Make sure we use the react-native version in node_modules and not the one

+ 14
- 18
android/scripts/release-sdk.sh View File

10
 DEFAULT_SDK_VERSION=$(grep sdkVersion ${THIS_DIR}/../gradle.properties | cut -d"=" -f2)
10
 DEFAULT_SDK_VERSION=$(grep sdkVersion ${THIS_DIR}/../gradle.properties | cut -d"=" -f2)
11
 SDK_VERSION=${OVERRIDE_SDK_VERSION:-${DEFAULT_SDK_VERSION}}
11
 SDK_VERSION=${OVERRIDE_SDK_VERSION:-${DEFAULT_SDK_VERSION}}
12
 RN_VERSION=$(jq -r '.version' ${THIS_DIR}/../../node_modules/react-native/package.json)
12
 RN_VERSION=$(jq -r '.version' ${THIS_DIR}/../../node_modules/react-native/package.json)
13
-HERMES_VERSION=$(jq -r '.dependencies."hermes-engine"' ${THIS_DIR}/../../node_modules/react-native/package.json | cut -c 2-)
13
+JSC_VERSION="r"$(jq -r '.dependencies."jsc-android"' ${THIS_DIR}/../../node_modules/react-native/package.json | cut -d . -f 1 | cut -c 2-)
14
 DO_GIT_TAG=${GIT_TAG:-0}
14
 DO_GIT_TAG=${GIT_TAG:-0}
15
 
15
 
16
 if [[ $THE_MVN_REPO == http* ]]; then
16
 if [[ $THE_MVN_REPO == http* ]]; then
38
         -DgeneratePom=false \
38
         -DgeneratePom=false \
39
         -DpomFile=react-native-${RN_VERSION}.pom || true
39
         -DpomFile=react-native-${RN_VERSION}.pom || true
40
     popd
40
     popd
41
-    # Push Hermes
42
-    echo "Pushing Hermes ${HERMES_VERSION} to the Maven repo"
43
-    pushd ${THIS_DIR}/../../node_modules/hermes-engine/android/
41
+    # Push JSC
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 \
44
     mvn \
45
         deploy:deploy-file \
45
         deploy:deploy-file \
46
         -Durl=${MVN_REPO} \
46
         -Durl=${MVN_REPO} \
47
         -DrepositoryId=${MVN_REPO_ID} \
47
         -DrepositoryId=${MVN_REPO_ID} \
48
-        -Dfile=hermes-release.aar \
48
+        -Dfile=android-jsc-${JSC_VERSION}.aar \
49
         -Dpackaging=aar \
49
         -Dpackaging=aar \
50
-        -DgroupId=com.facebook \
51
-        -DartifactId=hermes \
52
-        -Dversion=${HERMES_VERSION} \
53
-        -DgeneratePom=true || true
50
+        -DgeneratePom=false \
51
+        -DpomFile=android-jsc-${JSC_VERSION}.pom || true
54
     popd
52
     popd
55
 else
53
 else
56
     # Push React Native, if necessary
54
     # Push React Native, if necessary
67
         popd
65
         popd
68
     fi
66
     fi
69
 
67
 
70
-    # Push Hermes, if necessary
71
-    if [[ ! -d ${MVN_REPO}/com/facebook/hermes/${HERMES_VERSION} ]]; then
72
-        echo "Pushing Hermes ${HERMES_VERSION} to the Maven repo"
73
-        pushd ${THIS_DIR}/../../node_modules/hermes-engine/android/
68
+    # Push JSC, if necessary
69
+    if [[ ! -d ${MVN_REPO}/org/webkit/android-jsc/${JSC_VERSION} ]]; then
70
+        echo "Pushing JSC ${JSC_VERSION} to the Maven repo"
71
+        pushd ${THIS_DIR}/../../node_modules/jsc-android/dist/org/webkit/android-jsc/${JSC_VERSION}
74
         mvn \
72
         mvn \
75
             deploy:deploy-file \
73
             deploy:deploy-file \
76
             -Durl=${MVN_REPO} \
74
             -Durl=${MVN_REPO} \
77
-            -Dfile=hermes-release.aar \
75
+            -Dfile=android-jsc-${JSC_VERSION}.aar \
78
             -Dpackaging=aar \
76
             -Dpackaging=aar \
79
-            -DgroupId=com.facebook \
80
-            -DartifactId=hermes \
81
-            -Dversion=${HERMES_VERSION} \
82
-            -DgeneratePom=true
77
+            -DgeneratePom=false \
78
+            -DpomFile=android-jsc-${JSC_VERSION}.pom
83
         popd
79
         popd
84
     fi
80
     fi
85
 
81
 

+ 2
- 19
android/sdk/build.gradle View File

1
-import groovy.json.JsonSlurper
2
-
3
 apply plugin: 'com.android.library'
1
 apply plugin: 'com.android.library'
4
 apply plugin: 'maven-publish'
2
 apply plugin: 'maven-publish'
5
 
3
 
35
             }
33
             }
36
         }
34
         }
37
     }
35
     }
38
-
39
-    packagingOptions {
40
-        pickFirst '**/libc++_shared.so'
41
-    }
42
 }
36
 }
43
 
37
 
44
 dependencies {
38
 dependencies {
50
 
44
 
51
     //noinspection GradleDynamicVersion
45
     //noinspection GradleDynamicVersion
52
     api 'com.facebook.react:react-native:+'
46
     api 'com.facebook.react:react-native:+'
53
-
54
-    // Hermes JS engine
55
-    def hermesPath = "../../node_modules/hermes-engine/android/"
56
-    debugImplementation files(hermesPath + "hermes-debug.aar")
57
-    releaseImplementation files(hermesPath + "hermes-release.aar")
47
+    //noinspection GradleDynamicVersion
48
+    implementation 'org.webkit:android-jsc:+'
58
 
49
 
59
     implementation 'com.dropbox.core:dropbox-core-sdk:3.0.8'
50
     implementation 'com.dropbox.core:dropbox-core-sdk:3.0.8'
60
     implementation 'com.jakewharton.timber:timber:4.7.1'
51
     implementation 'com.jakewharton.timber:timber:4.7.1'
227
                     dependency.appendNode('artifactId', artifactId)
218
                     dependency.appendNode('artifactId', artifactId)
228
                     dependency.appendNode('version', it.moduleVersion)
219
                     dependency.appendNode('version', it.moduleVersion)
229
                 }
220
                 }
230
-
231
-                // Add Hermes dependency.
232
-                def hermesPkg = new File("$rootDir/../node_modules/hermes-engine/package.json")
233
-                def hermesVersion = new JsonSlurper().parseText(hermesPkg.text).version
234
-                def hermesDependency = dependencies.appendNode('dependency')
235
-                hermesDependency.appendNode('groupId', "com.facebook")
236
-                hermesDependency.appendNode('artifactId', "hermes")
237
-                hermesDependency.appendNode('version', hermesVersion)
238
             }
221
             }
239
         }
222
         }
240
 
223
 

+ 5
- 3
android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java View File

20
 
20
 
21
 import androidx.annotation.Nullable;
21
 import androidx.annotation.Nullable;
22
 
22
 
23
-import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
24
 import com.facebook.react.ReactInstanceManager;
23
 import com.facebook.react.ReactInstanceManager;
25
 import com.facebook.react.ReactPackage;
24
 import com.facebook.react.ReactPackage;
26
 import com.facebook.react.bridge.NativeModule;
25
 import com.facebook.react.bridge.NativeModule;
28
 import com.facebook.react.bridge.ReactApplicationContext;
27
 import com.facebook.react.bridge.ReactApplicationContext;
29
 import com.facebook.react.common.LifecycleState;
28
 import com.facebook.react.common.LifecycleState;
30
 import com.facebook.react.devsupport.DevInternalSettings;
29
 import com.facebook.react.devsupport.DevInternalSettings;
30
+import com.facebook.react.jscexecutor.JSCExecutorFactory;
31
 import com.facebook.react.modules.core.DeviceEventManagerModule;
31
 import com.facebook.react.modules.core.DeviceEventManagerModule;
32
 import com.facebook.react.uimanager.ViewManager;
32
 import com.facebook.react.uimanager.ViewManager;
33
 import com.facebook.soloader.SoLoader;
33
 import com.facebook.soloader.SoLoader;
35
 import com.oney.WebRTCModule.RTCVideoViewManager;
35
 import com.oney.WebRTCModule.RTCVideoViewManager;
36
 import com.oney.WebRTCModule.WebRTCModule;
36
 import com.oney.WebRTCModule.WebRTCModule;
37
 
37
 
38
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
38
 import org.webrtc.SoftwareVideoDecoderFactory;
39
 import org.webrtc.SoftwareVideoDecoderFactory;
39
 import org.webrtc.SoftwareVideoEncoderFactory;
40
 import org.webrtc.SoftwareVideoEncoderFactory;
40
 import org.webrtc.audio.AudioDeviceModule;
41
 import org.webrtc.audio.AudioDeviceModule;
216
             // Ignore any error, the module is not compiled when LIBRE_BUILD is enabled.
217
             // Ignore any error, the module is not compiled when LIBRE_BUILD is enabled.
217
         }
218
         }
218
 
219
 
219
-        // Use the Hermes JavaScript engine.
220
-        HermesExecutorFactory jsFactory = new HermesExecutorFactory();
220
+        // Keep on using JSC, the jury is out on Hermes.
221
+        JSCExecutorFactory jsFactory
222
+            = new JSCExecutorFactory("", "");
221
 
223
 
222
         reactInstanceManager
224
         reactInstanceManager
223
             = ReactInstanceManager.builder()
225
             = ReactInstanceManager.builder()

Loading…
Cancel
Save