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

Upgrade to RN 0.60.5 and enable Hermes JS engine #8943

Merged
merged 4 commits into from
Sep 12, 2019
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
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
};
39 changes: 32 additions & 7 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,20 @@

# Ignore duplicate module providers
# For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root
.*/Libraries/react-native/React.js
node_modules/react-native/Libraries/react-native/React.js
.*/Libraries/react-native/ReactNative.js
.*/node_modules/jest-runtime/build/__tests__/.*

; Ignore polyfills
.*/Libraries/polyfills/.*
node_modules/react-native/Libraries/polyfills/.*

; Ignore metro
.*/node_modules/metro/.*
; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
node_modules/warning/.*
; Flow doesn't support platforms
.*/Libraries/Utilities/HMRLoadingView.js
[untyped]
.*/node_modules/@react-native-community/cli/.*/.*

[include]

Expand All @@ -40,11 +45,31 @@ node_modules/react-native/flow/
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable

module.system=haste

esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable

module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js

module.system=haste
module.system.haste.use_name_reducers=true
# get basename
# get basename
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*

experimental.strict_type_args=true

munge_underscores=true
Expand All @@ -67,4 +92,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy

[version]
^0.92.0
^0.98.0
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ doo-index.html
Statusgo.framework

#ios
ios/Pods
ios/StatusIm.xcworkspace
/ios/Pods/
/ios/StatusIm.xcworkspace
.ruby-version
status-e2e/

Expand Down
6 changes: 6 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
bracketSpacing: false,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
};
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,9 @@ release-android: export BUILD_ENV ?= prod
release-android: export BUILD_TYPE ?= nightly
release-android: export BUILD_NUMBER ?= 9999
release-android: export NDK_ABI_FILTERS ?= armeabi-v7a;arm64-v8a;x86
release-android: export STORE_FILE ?= ~/.gradle/status-im.keystore
release-android: export STORE_FILE ?= $(HOME)/.gradle/status-im.keystore
release-android: ##@build build release for Android
nix/build.sh targets.mobile.$(TARGET_OS).release \
--arg env '{NDK_ABI_FILTERS="$(NDK_ABI_FILTERS)";}' \
--argstr build-type $(BUILD_TYPE) \
--argstr build-number $(BUILD_NUMBER) \
--argstr keystore-file $(STORE_FILE) \
--option extra-sandbox-paths $(STORE_FILE)
scripts/release-android.sh

release-ios: export TARGET_OS ?= ios
release-ios: export BUILD_ENV ?= prod
Expand Down Expand Up @@ -269,6 +264,11 @@ geth-connect: ##@other Connect to Geth on the device
adb forward tcp:8545 tcp:8545 && \
build/bin/geth attach http://localhost:8545

android-clean: export TARGET_OS ?= android
android-clean: ##@prepare Clean Gradle state
git clean -dxf -f ./android/app/build
[ -d android/.gradle ] && cd android && ./gradlew clean

android-ports: export _NIX_ATTR := targets.mobile.android.adb.shell
android-ports: export TARGET_OS ?= android
android-ports: ##@other Add proxies to Android Device/Simulator
Expand Down
105 changes: 70 additions & 35 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.Copy
project.ext.react = [
nodeExecutableAndArgs: ["node", "--max-old-space-size=16384"],
entryFile: "index.android.js",
enableHermes: true, // clean and rebuild if changing. NOTE: Hermes engine is required for Android 64-bit builds running on 64 devices, to guard against a hang in the UI thread after invoking status-go
bundleInPr: true,
inputExcludes: ["android/**", "ios/**", "react-native/**", "src/**", "test/**"]
]

configurations.all {
exclude group: 'com.facebook.react', module: 'react-native'
}
// NOTE: Uncomment if building RN from a fork
// configurations.all {
// exclude group: 'com.facebook.react', module: 'react-native'
// }

apply from: "../../node_modules/react-native/react.gradle"

Expand All @@ -104,6 +106,28 @@ 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.
*
* This should be set on project.ext.react and mirrored here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);

def getVersionCode = { ->
new ByteArrayOutputStream().withStream { stdOut ->
if (project.hasProperty("versionCode")) {
Expand Down Expand Up @@ -162,6 +186,7 @@ android {
ndk {
abiFilters getEnvOrConfig('NDK_ABI_FILTERS').split(';')
}
missingDimensionStrategy 'react-native-camera', 'general'
}
/**
* Arbitrary project metadata
Expand All @@ -179,8 +204,15 @@ android {
packagingOptions {
exclude 'META-INF/rxjava.properties'
exclude '/lib/mips64/**'
exclude '/lib/arm64-v8a/**'
exclude '/lib/armeabi/**'

pickFirst '**/armeabi-v7a/libc++_shared.so'
pickFirst '**/x86/libc++_shared.so'
pickFirst '**/arm64-v8a/libc++_shared.so'
pickFirst '**/x86_64/libc++_shared.so'
pickFirst '**/x86/libjsc.so'
pickFirst '**/armeabi-v7a/libjsc.so'

/** Fix for: Execution failed for task ':app:transformNativeLibsWithStripDebugSymbolForDebug'.
* with recent version of ndk (17.0.4754217)
*/
Expand All @@ -192,6 +224,12 @@ android {
javaMaxHeapSize "8g"
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
/* environment variables take precedence over gradle.properties file */
storeFile file(getEnvOrConfig('STATUS_RELEASE_STORE_FILE').replaceAll("~", System.properties['user.home']))
Expand All @@ -213,9 +251,13 @@ android {
applicationIdSuffix ".debug"
debuggable true
versionNameSuffix "-SNAPSHOT"
signingConfig signingConfigs.debug
resValue "string", "build_config_package", "im.status.ethereum"
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
Expand All @@ -242,6 +284,7 @@ android {
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}

}
}

Expand All @@ -256,44 +299,34 @@ android {
}

dependencies {
implementation project(':@react-native-community_netinfo')
implementation project(':react-native-background-timer')
implementation project(':react-native-svg')
implementation 'com.android.support:multidex:1.0.2'
implementation project(':react-native-splash-screen')
implementation project(':react-native-image-resizer')
implementation project(':react-native-dialogs')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules

if (enableHermes) {
def hermesPath = "../../node_modules/hermesvm/android/";
// Force using the release Hermes VM until the perf issues in debug VM are fixed in npm package > 0.1.1 (https://github.com/facebook/hermes/issues/73)
implementation files(hermesPath + "hermes-release.aar")
// debugImplementation files(hermesPath + "hermes-debug.aar")
// releaseImplementation files(hermesPath + "hermes-release.aar")
// prImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}

implementation 'androidx.multidex:multidex:2.0.1' // only needed if minSdkVersion is less than 21 (https://developer.android.com/studio/build/multidex)
implementation project(':react-native-dialogs')
// Force using exact RN version instead of relying on gradle dependency resolution
// https://docs.gradle.org/current/userguide/introduction_dependency_management.html#sec:dependency_resolution
// NOTE: Uncomment if building RN from a fork
//compile ("com.facebook.react:react-native:0.55.4") { force = true } // From node_modules
implementation project(':react-native-android')
implementation project(':react-native-languages')
implementation project(':react-native-status')
implementation project(':react-native-fs')
implementation project(':react-native-image-crop-picker')
implementation project(':react-native-webview-bridge')
implementation project(':react-native-touch-id')
implementation project(':react-native-config')
implementation project(':react-native-firebase')
implementation project(':react-native-shake')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-screens')
implementation project(':RNMail')
compile ('com.google.android.gms:play-services-base:16.0.1') {
force = true
}
compile (project(':react-native-camera')) {
exclude group: "com.google.android.gms"
compile 'com.android.support:exifinterface:28.+'
}
implementation project(':react-native-status-keycard')
implementation 'com.google.firebase:firebase-core:16.0.3' //this decides your firebase SDK version
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation project(':react-native-keychain')
implementation "com.google.android.gms:play-services-base:${rootProject.ext.googlePlayServicesVersion}"
implementation 'com.google.firebase:firebase-core:16.0.9' //this decides your firebase SDK version
implementation 'com.google.firebase:firebase-messaging:18.0.0'

compile 'com.github.status-im:function:0.0.1'
implementation 'com.github.status-im:function:0.0.1'
implementation 'com.facebook.fresco:animated-gif:1.10.0'
}

Expand All @@ -318,5 +351,7 @@ task hemroidBuild(type: Exec) {
preBuild.dependsOn hemroidBuild

// Must be at bottom to avoid dependency collision
apply plugin: "com.google.gms.google-services"
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
Binary file added android/app/debug.keystore
Binary file not shown.
7 changes: 0 additions & 7 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Disabling obfuscation is useful if you collect stack traces from production crashes
# (unless you are using a system that supports de-obfuscate the stack traces).
-dontobfuscate
Expand Down
7 changes: 1 addition & 6 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,9 @@
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<service android:name="io.invertase.firebase.messaging.RNFirebaseBackgroundMessagingService" />
<provider
android:name="android.support.v4.content.FileProvider"
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.content.Context;
import android.annotation.TargetApi;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.app.AlertDialog;
import android.app.ActivityManager;
import android.content.DialogInterface;
Expand All @@ -13,7 +13,7 @@
import android.os.Build;
import android.os.Looper;
import android.preference.PreferenceManager;
import android.support.v4.app.ActivityCompat;
import androidx.core.app.ActivityCompat;
import android.util.Log;
import android.view.WindowManager;
import android.content.Intent;
Expand Down
Loading