Skip to content

Commit 019149d

Browse files
authored
Upgrade React Native to 0.60.4 (#96)
* Change gitignore * Update deps * Update node image * Remove eslint * Fix issues with tests * Fix issues with tests * Upgrade example project to 0.56 * Upgrade to 57 * Example updated to RN60 * Delete unnecessary file * Clean up of unnecessary files * Send reports to codecov
1 parent b497303 commit 019149d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+8148
-8514
lines changed

.DS_Store

8 KB
Binary file not shown.

.babelrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.circleci/config.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
version: 2
22
jobs:
3-
build:
4-
docker:
5-
- image: circleci/node:8.8.1
6-
working_directory: /home/circleci/rosetta
7-
steps:
8-
- checkout
9-
- run: yarn install
10-
- run: yarn add react@16.2.0
11-
- run: yarn add react-native@0.54.2
12-
- run: yarn add codecov
13-
- run: yarn lint
14-
- run: yarn tslint
15-
- run: yarn type-check
16-
- run: yarn test
3+
build:
4+
docker:
5+
- image: circleci/node:12.7.0
6+
working_directory: /home/circleci/rosetta
7+
steps:
8+
- checkout
9+
- run: yarn install
10+
- run: yarn add react@16.8.6
11+
- run: yarn add react-native@0.60.4
12+
- run: yarn add codecov
13+
- run: yarn tslint
14+
- run: yarn type-check
15+
- run: yarn test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ lib/
1010
.jest/
1111

1212
dist/
13+
node_modules

babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ['module:metro-react-native-babel-preset']
3+
}

examples/.babelrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/.flowconfig

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@ node_modules/react-native/flow-github/
3232
emoji=true
3333

3434
module.system=haste
35+
module.system.haste.use_name_reducers=true
36+
# get basename
37+
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
38+
# strip .js or .js.flow suffix
39+
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
40+
# strip .ios suffix
41+
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
42+
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
43+
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
44+
module.system.haste.paths.blacklist=.*/__tests__/.*
45+
module.system.haste.paths.blacklist=.*/__mocks__/.*
46+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
47+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
3548

3649
munge_underscores=true
3750

@@ -53,4 +66,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
5366
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
5467

5568
[version]
56-
^0.65.0
69+
^0.75.0

examples/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,9 @@ buck-out/
5151
*/fastlane/report.xml
5252
*/fastlane/Preview.html
5353
*/fastlane/screenshots
54+
55+
# Bundle artifact
56+
*.jsbundle
57+
58+
ios/Pods/
59+

examples/android/app/BUCK

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,13 @@
88
# - `buck install -r android/app` - compile, install and run application
99
#
1010

11+
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12+
1113
lib_deps = []
1214

13-
for jarfile in glob(['libs/*.jar']):
14-
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15-
lib_deps.append(':' + name)
16-
prebuilt_jar(
17-
name = name,
18-
binary_jar = jarfile,
19-
)
15+
create_aar_targets(glob(["libs/*.aar"]))
2016

21-
for aarfile in glob(['libs/*.aar']):
22-
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23-
lib_deps.append(':' + name)
24-
android_prebuilt_aar(
25-
name = name,
26-
aar = aarfile,
27-
)
17+
create_jar_targets(glob(["libs/*.jar"]))
2818

2919
android_library(
3020
name = "all-libs",

examples/android/app/build.gradle

Lines changed: 74 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import com.android.build.OutputFile
1818
* // the entry file for bundle generation
1919
* entryFile: "index.android.js",
2020
*
21+
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
22+
* bundleCommand: "ram-bundle",
23+
*
2124
* // whether to bundle JS and assets in debug mode
2225
* bundleInDebug: false,
2326
*
@@ -73,7 +76,8 @@ import com.android.build.OutputFile
7376
*/
7477

7578
project.ext.react = [
76-
entryFile: "index.js"
79+
entryFile: "index.js",
80+
enableHermes: false, // clean and rebuild if changing
7781
]
7882

7983
apply from: "../../node_modules/react-native/react.gradle"
@@ -93,30 +97,67 @@ def enableSeparateBuildPerCPUArchitecture = false
9397
*/
9498
def enableProguardInReleaseBuilds = false
9599

100+
/**
101+
* The preferred build flavor of JavaScriptCore.
102+
*
103+
* For example, to use the international variant, you can use:
104+
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
105+
*
106+
* The international variant includes ICU i18n library and necessary data
107+
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
108+
* give correct results when using with locales other than en-US. Note that
109+
* this variant is about 6MiB larger per architecture than default.
110+
*/
111+
def jscFlavor = 'org.webkit:android-jsc:+'
112+
113+
/**
114+
* Whether to enable the Hermes VM.
115+
*
116+
* This should be set on project.ext.react and mirrored here. If it is not set
117+
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
118+
* and the benefits of using Hermes will therefore be sharply reduced.
119+
*/
120+
def enableHermes = project.ext.react.get("enableHermes", false);
121+
96122
android {
97-
compileSdkVersion 23
98-
buildToolsVersion "23.0.1"
123+
compileSdkVersion rootProject.ext.compileSdkVersion
124+
125+
compileOptions {
126+
sourceCompatibility JavaVersion.VERSION_1_8
127+
targetCompatibility JavaVersion.VERSION_1_8
128+
}
99129

100130
defaultConfig {
101131
applicationId "com.example"
102-
minSdkVersion 16
103-
targetSdkVersion 22
132+
minSdkVersion rootProject.ext.minSdkVersion
133+
targetSdkVersion rootProject.ext.targetSdkVersion
104134
versionCode 1
105135
versionName "1.0"
106-
ndk {
107-
abiFilters "armeabi-v7a", "x86"
108-
}
109136
}
110137
splits {
111138
abi {
112139
reset()
113140
enable enableSeparateBuildPerCPUArchitecture
114141
universalApk false // If true, also generate a universal APK
115-
include "armeabi-v7a", "x86"
142+
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
143+
}
144+
}
145+
signingConfigs {
146+
debug {
147+
storeFile file('debug.keystore')
148+
storePassword 'android'
149+
keyAlias 'androiddebugkey'
150+
keyPassword 'android'
116151
}
117152
}
118153
buildTypes {
154+
debug {
155+
signingConfig signingConfigs.debug
156+
}
119157
release {
158+
// Caution! In production, you need to generate your own keystore file.
159+
// see https://facebook.github.io/react-native/docs/signed-apk-android.
160+
signingConfig signingConfigs.debug
120161
minifyEnabled enableProguardInReleaseBuilds
121162
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
122163
}
@@ -125,21 +166,38 @@ android {
125166
applicationVariants.all { variant ->
126167
variant.outputs.each { output ->
127168
// For each separate APK per architecture, set a unique version code as described here:
128-
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
129-
def versionCodes = ["armeabi-v7a":1, "x86":2]
169+
// https://developer.android.com/studio/build/configure-apk-splits.html
170+
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
130171
def abi = output.getFilter(OutputFile.ABI)
131172
if (abi != null) { // null for the universal-debug, universal-release variants
132173
output.versionCodeOverride =
133174
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
134175
}
176+
135177
}
136178
}
179+
180+
packagingOptions {
181+
pickFirst '**/armeabi-v7a/libc++_shared.so'
182+
pickFirst '**/x86/libc++_shared.so'
183+
pickFirst '**/arm64-v8a/libc++_shared.so'
184+
pickFirst '**/x86_64/libc++_shared.so'
185+
pickFirst '**/x86/libjsc.so'
186+
pickFirst '**/armeabi-v7a/libjsc.so'
187+
}
137188
}
138189

139190
dependencies {
140-
compile fileTree(dir: "libs", include: ["*.jar"])
141-
compile "com.android.support:appcompat-v7:23.0.1"
142-
compile "com.facebook.react:react-native:+" // From node_modules
191+
implementation fileTree(dir: "libs", include: ["*.jar"])
192+
implementation "com.facebook.react:react-native:+" // From node_modules
193+
194+
if (enableHermes) {
195+
def hermesPath = "../../node_modules/hermesvm/android/";
196+
debugImplementation files(hermesPath + "hermes-debug.aar")
197+
releaseImplementation files(hermesPath + "hermes-release.aar")
198+
} else {
199+
implementation jscFlavor
200+
}
143201
}
144202

145203
// Run this once to be able to run the application with BUCK
@@ -148,3 +206,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
148206
from configurations.compile
149207
into 'libs'
150208
}
209+
210+
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

0 commit comments

Comments
 (0)