Unverified Commit da508a88 authored by Marek Kotewicz's avatar Marek Kotewicz Committed by GitHub
Browse files

Merge pull request #102 from paritytech/react-update

[WIP] React and toolchain upgrade
parents 5b1fe47a 04a852b3
{ {
"presets": ["react-native"] "presets": ["react-native"]
} }
\ No newline at end of file
...@@ -12,33 +12,43 @@ ...@@ -12,33 +12,43 @@
; For RN Apps installed via npm, "Libraries" folder is inside ; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root ; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js .*/Libraries/react-native/React.js
.*/Libraries/react-native/ReactNative.js
; Ignore polyfills
.*/Libraries/polyfills/.*
; Ignore metro
.*/node_modules/metro/.*
[include] [include]
[libs] [libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow node_modules/react-native/flow/
flow/ node_modules/react-native/flow-github/
[options] [options]
module.system=haste emoji=true
experimental.strict_type_args=true module.system=haste
munge_underscores=true munge_underscores=true
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js
suppress_type=$FlowIssue suppress_type=$FlowIssue
suppress_type=$FlowFixMe suppress_type=$FlowFixMe
suppress_type=$FixMe suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-6]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-6]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
unsafe.enable_getters_and_setters=true
[version] [version]
^0.36.0 ^0.67.0
yarn-error.log
# NDK # NDK
NDK/ NDK/
rust/.cargo rust/.cargo
...@@ -64,3 +66,4 @@ fastlane/screenshots ...@@ -64,3 +66,4 @@ fastlane/screenshots
# vim # vim
*.swp *.swp
.vscode
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import React from 'react'
import 'react-native'
import App from '../src/components/App'
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer'
it('renders correctly', () => {
const tree = renderer.create(
<App />
)
expect(tree).toBeTruthy()
})
import re
# To learn about Buck see [Docs](https://buckbuild.com/). # To learn about Buck see [Docs](https://buckbuild.com/).
# To run your application with Buck: # To run your application with Buck:
# - install Buck # - install Buck
...@@ -11,8 +9,9 @@ import re ...@@ -11,8 +9,9 @@ import re
# #
lib_deps = [] lib_deps = []
for jarfile in glob(['libs/*.jar']): for jarfile in glob(['libs/*.jar']):
name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
lib_deps.append(':' + name) lib_deps.append(':' + name)
prebuilt_jar( prebuilt_jar(
name = name, name = name,
...@@ -20,7 +19,7 @@ for jarfile in glob(['libs/*.jar']): ...@@ -20,7 +19,7 @@ for jarfile in glob(['libs/*.jar']):
) )
for aarfile in glob(['libs/*.aar']): for aarfile in glob(['libs/*.aar']):
name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
lib_deps.append(':' + name) lib_deps.append(':' + name)
android_prebuilt_aar( android_prebuilt_aar(
name = name, name = name,
...@@ -28,39 +27,39 @@ for aarfile in glob(['libs/*.aar']): ...@@ -28,39 +27,39 @@ for aarfile in glob(['libs/*.aar']):
) )
android_library( android_library(
name = 'all-libs', name = "all-libs",
exported_deps = lib_deps exported_deps = lib_deps,
) )
android_library( android_library(
name = 'app-code', name = "app-code",
srcs = glob([ srcs = glob([
'src/main/java/**/*.java', "src/main/java/**/*.java",
]), ]),
deps = [ deps = [
':all-libs', ":all-libs",
':build_config', ":build_config",
':res', ":res",
], ],
) )
android_build_config( android_build_config(
name = 'build_config', name = "build_config",
package = 'com.nativesigner', package = "com.nativesigner",
) )
android_resource( android_resource(
name = 'res', name = "res",
res = 'src/main/res', package = "com.nativesigner",
package = 'com.nativesigner', res = "src/main/res",
) )
android_binary( android_binary(
name = 'app', name = "app",
package_type = 'debug', keystore = "//android/keystores:debug",
manifest = 'src/main/AndroidManifest.xml', manifest = "src/main/AndroidManifest.xml",
keystore = '//android/keystores:debug', package_type = "debug",
deps = [ deps = [
':app-code', ":app-code",
], ],
) )
...@@ -33,6 +33,13 @@ import com.android.build.OutputFile ...@@ -33,6 +33,13 @@ import com.android.build.OutputFile
* // bundleInPaidRelease: true, * // bundleInPaidRelease: true,
* // bundleInBeta: true, * // bundleInBeta: true,
* *
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives * // the root of your project, i.e. where "package.json" lives
* root: "../../", * root: "../../",
* *
...@@ -58,13 +65,17 @@ import com.android.build.OutputFile ...@@ -58,13 +65,17 @@ import com.android.build.OutputFile
* inputExcludes: ["android/**", "ios/**"], * inputExcludes: ["android/**", "ios/**"],
* *
* // override which node gets called and with what additional arguments * // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"] * nodeExecutableAndArgs: ["node"],
* *
* // supply additional arguments to the packager * // supply additional arguments to the packager
* extraPackagerArgs: [] * extraPackagerArgs: []
* ] * ]
*/ */
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/react-native/react.gradle"
/** /**
...@@ -83,29 +94,18 @@ def enableSeparateBuildPerCPUArchitecture = false ...@@ -83,29 +94,18 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false def enableProguardInReleaseBuilds = false
android { android {
compileSdkVersion 23 compileSdkVersion 26
buildToolsVersion "23.0.1"
defaultConfig { defaultConfig {
applicationId "com.nativesigner" applicationId "com.nativesigner"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 22 targetSdkVersion 22
versionCode 14 versionCode 1
versionName "1.0b" versionName "1.0"
ndk { ndk {
abiFilters "armeabi-v7a", "x86" abiFilters "armeabi-v7a", "x86"
} }
} }
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
splits { splits {
abi { abi {
reset() reset()
...@@ -118,7 +118,6 @@ android { ...@@ -118,7 +118,6 @@ android {
release { release {
minifyEnabled enableProguardInReleaseBuilds minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
} }
} }
// applicationVariants are e.g. debug, release // applicationVariants are e.g. debug, release
...@@ -126,7 +125,7 @@ android { ...@@ -126,7 +125,7 @@ android {
variant.outputs.each { output -> variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here: // For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a": 1, "x86": 2] def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI) def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride = output.versionCodeOverride =
...@@ -134,12 +133,6 @@ android { ...@@ -134,12 +133,6 @@ android {
} }
} }
} }
externalNativeBuild {
ndkBuild {
path 'src/main/jniLibs/Android.mk'
}
}
} }
dependencies { dependencies {
...@@ -150,13 +143,6 @@ dependencies { ...@@ -150,13 +143,6 @@ dependencies {
compile "com.facebook.react:react-native:+" // From node_modules compile "com.facebook.react:react-native:+" // From node_modules
} }
// TODO: set env variables
//task compileRust(type: Exec) {
// commandLine "make", '-C', '../../rust/signer', 'android'
//}
//
//preBuild.dependsOn compileRust
// Run this once to be able to run the application with BUCK // Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use // puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) { task copyDownloadableDepsToLibs(type: Copy) {
......
...@@ -50,6 +50,10 @@ ...@@ -50,6 +50,10 @@
-dontwarn com.facebook.react.** -dontwarn com.facebook.react.**
# TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
-dontwarn android.text.StaticLayout
# okhttp # okhttp
-keepattributes Signature -keepattributes Signature
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nativesigner" package="com.nativesigner">
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<application <application
android:name=".MainApplication" android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name" android:label="@string/app_name"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"> android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
......
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
package com.nativesigner; package com.nativesigner;
import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivity;
......
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
package com.nativesigner; package com.nativesigner;
import android.app.Application; import android.app.Application;
import android.util.Log;
import com.facebook.react.ReactApplication; import com.facebook.react.ReactApplication;
import com.reactlibrary.RNSecureStoragePackage; import com.reactlibrary.RNSecureStoragePackage;
import com.lwansbrough.RCTCamera.RCTCameraPackage; import com.lwansbrough.RCTCamera.RCTCameraPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage; import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage; import com.facebook.react.shell.MainReactPackage;
...@@ -35,19 +17,23 @@ public class MainApplication extends Application implements ReactApplication { ...@@ -35,19 +17,23 @@ public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override @Override
protected boolean getUseDeveloperSupport() { public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG; return BuildConfig.DEBUG;
} }
@Override @Override
protected List<ReactPackage> getPackages() { protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList( return Arrays.<ReactPackage>asList(
new MainReactPackage(), new MainReactPackage(),
new RNSecureStoragePackage(), new RNSecureStoragePackage(),
new RCTCameraPackage(), new RCTCameraPackage()
new EthkeyBridgePackage()
); );
} }
@Override
protected String getJSMainModuleName() {
return "index";
}
}; };
@Override @Override
......
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libsigner
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libsigner.so
include $(PREBUILT_SHARED_LIBRARY)
\ No newline at end of file
<resources> <resources>
<string name="app_name">Parity Signer</string> <string name="app_name">NativeSigner</string>
</resources> </resources>
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.android.tools.build:gradle:3.1.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
...@@ -16,9 +17,22 @@ allprojects { ...@@ -16,9 +17,22 @@ allprojects {
repositories { repositories {
mavenLocal() mavenLocal()
jcenter() jcenter()
google()
maven { url "https://jitpack.io" }
maven { maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android" url "$rootDir/../node_modules/react-native/android"
} }
} }
} }
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "26.1.0"
}
}
}
}
#Mon Mar 06 10:46:53 CET 2017
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
{
"name": "NativeSigner",