Skip to content

Instantly share code, notes, and snippets.

@hypest
Created February 12, 2020 21:47
Show Gist options
  • Save hypest/c6abffb4d2a1c0e0b8b89529af89a8e3 to your computer and use it in GitHub Desktop.
Save hypest/c6abffb4d2a1c0e0b8b89529af89a8e3 to your computer and use it in GitHub Desktop.
diff --git a/android/app/build.gradle b/android/app/build.gradle
index c986be65..4a6aaa2b 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -74,7 +74,7 @@ import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js",
- enableHermes: true, // clean and rebuild if changing
+ enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
@@ -94,6 +94,19 @@ def enableSeparateBuildPerCPUArchitecture = false
*/
def enableProguardInReleaseBuilds = false
+/**
+ * The preferred build flavor of JavaScriptCore.
+ *
+ * For example, to use the international variant, you can use:
+ * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
+ *
+ * The international variant includes ICU i18n library and necessary data
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
+ * give correct results when using with locales other than en-US. Note that
+ * this variant is about 6MiB larger per architecture than default.
+ */
+def jscFlavor = 'org.webkit:android-jsc:+'
+
/**
* Whether to enable the Hermes VM.
*
diff --git a/android/build.gradle b/android/build.gradle
index 1507607d..9080e38e 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -30,6 +30,11 @@ allprojects {
url("$rootDir/../node_modules/react-native/android")
}
+ maven {
+ // Local Maven repo containing AARs with JSC library built for Android
+ url "$rootDir/../node_modules/jsc-android/dist"
+ }
+
google()
jcenter()
maven { url 'https://jitpack.io' }
diff --git a/react-native-gutenberg-bridge/android/build.gradle b/react-native-gutenberg-bridge/android/build.gradle
index 60eaf7a4..8cc56eb3 100644
--- a/react-native-gutenberg-bridge/android/build.gradle
+++ b/react-native-gutenberg-bridge/android/build.gradle
@@ -79,9 +79,6 @@ group='com.github.wordpress-mobile.gutenberg-mobile'
// fallback flag value for when lib is compiled individually (e.g. via jitpack)
project.ext.buildGutenbergFromSource = false
-def hermesOriginalPath = "../../node_modules/hermes-engine/android/";
-def hermesPath = hermesOriginalPath;
-
android {
compileSdkVersion 28
@@ -111,6 +108,7 @@ repositories {
// If building from source, use the local sources from node_modules
def nodeModulesPath = "${project.buildDir}/../../../node_modules/"
maven { url "${nodeModulesPath}/react-native/android" }
+ maven { url "${nodeModulesPath}/jsc-android/dist" }
} else {
// If not building from source (e.g. Jitpack), use the bintray repo so a local RN setup is not needed
def reactNativeRepo = 'https://dl.bintray.com/wordpress-mobile/react-native-mirror/'
@@ -120,6 +118,9 @@ repositories {
}
dependencies {
+ // Make sure to put android-jsc as the first dependency
+ implementation "org.webkit:android-jsc:r241213"
+
implementation project(':react-native-aztec')
implementation "org.wordpress:utils:1.22"
@@ -136,7 +137,6 @@ dependencies {
implementation 'com.facebook.react:react-native:+'
} else {
- hermesPath = "../../bundle/";
implementation (waitJitpack('com.github.wordpress-mobile', 'react-native-svg', readHashedVersion('../../package.json', 'react-native-svg', 'dependencies')))
implementation (waitJitpack('com.github.wordpress-mobile', 'react-native-video', readHashedVersion('../../package.json', 'react-native-video', 'dependencies')))
@@ -148,9 +148,6 @@ dependencies {
def rnVersion = '0.61.5'
implementation "com.facebook.react:react-native:${rnVersion}"
}
-
- debugImplementation files(hermesPath + "hermes-debug.aar")
- releaseImplementation files(hermesPath + "hermes-release.aar")
}
if (isJitPack) {
@@ -167,26 +164,6 @@ if (isJitPack) {
}
}
- task backupHermesDebugAAR(type: Copy) {
- def origFileName = 'hermes-debug.aar'
- def origWithPath = hermesOriginalPath + origFileName
- from origWithPath
- into hermesPath
- doLast {
- println "Done backing up Hermes debug AARs"
- }
- }
-
- task backupHermesReleaseAAR(type: Copy) {
- def origFileName = 'hermes-release.aar'
- def origWithPath = hermesOriginalPath + origFileName
- from origWithPath
- into hermesPath
- doLast {
- println "Done backing up Hermes release AARs"
- }
- }
-
task copyJSBundle(type: Copy) {
def origFileName = 'App.js'
def origWithPath = "../../bundle/android/${origFileName}"
@@ -205,9 +182,7 @@ if (isJitPack) {
if (isJitPack) {
preBuild.dependsOn(cleanupNodeModulesFolder)
- cleanupNodeModulesFolder.dependsOn(backupHermesDebugAAR)
- backupHermesDebugAAR.dependsOn(backupHermesReleaseAAR)
- backupHermesReleaseAAR.dependsOn(copyJSBundle)
+ cleanupNodeModulesFolder.dependsOn(copyJSBundle)
copyJSBundle.dependsOn(buildJSBundle)
buildJSBundle.dependsOn(yarn_install, ensureAssetsDirectory)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment