Skip to content

Commit 7c255cb

Browse files
author
Fran Montiel
committed
Update to React Native 0.7
1 parent 8a4f653 commit 7c255cb

70 files changed

Lines changed: 5011 additions & 3918 deletions

File tree

Some content is hidden

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

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2.1
33
executors:
44
default:
55
docker:
6-
- image: circleci/node:10
6+
- image: circleci/node:16
77
working_directory: ~/project
88

99
commands:

.husky/.npmignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.husky/commit-msg

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

.husky/pre-commit

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

.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.watchmanconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

RnBugfender.podspec

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require "json"
22

33
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
45

56
Pod::Spec.new do |s|
67
s.name = "RnBugfender"
@@ -18,4 +19,18 @@ Pod::Spec.new do |s|
1819
s.dependency "React-Core"
1920
s.dependency 'BugfenderSDK', '~> 1.10.5'
2021

22+
# Don't install the dependencies when we run `pod install` in the old architecture.
23+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
24+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
25+
s.pod_target_xcconfig = {
26+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
27+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
28+
}
29+
30+
s.dependency "React-Codegen"
31+
s.dependency "RCT-Folly"
32+
s.dependency "RCTRequired"
33+
s.dependency "RCTTypeSafety"
34+
s.dependency "ReactCommon/turbomodule/core"
35+
end
2136
end

android/build.gradle

Lines changed: 117 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,138 @@
11
buildscript {
2-
if (project == rootProject) {
3-
repositories {
4-
google()
5-
mavenCentral()
6-
jcenter()
7-
}
2+
repositories {
3+
google()
4+
mavenCentral()
5+
}
86

9-
dependencies {
10-
classpath 'com.android.tools.build:gradle:3.5.3'
11-
}
12-
}
7+
dependencies {
8+
classpath 'com.android.tools.build:gradle:3.5.3'
9+
}
10+
}
11+
12+
def isNewArchitectureEnabled() {
13+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
1314
}
1415

1516
apply plugin: 'com.android.library'
1617

17-
def safeExtGet(prop, fallback) {
18-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
18+
if (isNewArchitectureEnabled()) {
19+
apply plugin: 'com.facebook.react'
20+
}
21+
22+
def getExtOrDefault(name) {
23+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RnBugfender_' + name]
24+
}
25+
26+
def getExtOrIntegerDefault(name) {
27+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['RnBugfender_' + name]).toInteger()
1928
}
2029

2130
android {
22-
compileSdkVersion safeExtGet('RnBugfender_compileSdkVersion', 29)
23-
defaultConfig {
24-
minSdkVersion safeExtGet('RnBugfender_minSdkVersion', 16)
25-
targetSdkVersion safeExtGet('RnBugfender_targetSdkVersion', 29)
26-
versionCode 1
27-
versionName "1.0"
31+
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
2832

33+
defaultConfig {
34+
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
35+
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
36+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
37+
}
38+
buildTypes {
39+
release {
40+
minifyEnabled false
2941
}
42+
}
3043

31-
buildTypes {
32-
release {
33-
minifyEnabled false
34-
}
35-
}
36-
lintOptions {
37-
disable 'GradleCompatible'
38-
}
39-
compileOptions {
40-
sourceCompatibility JavaVersion.VERSION_1_8
41-
targetCompatibility JavaVersion.VERSION_1_8
42-
}
44+
lintOptions {
45+
disable 'GradleCompatible'
46+
}
47+
48+
compileOptions {
49+
sourceCompatibility JavaVersion.VERSION_1_8
50+
targetCompatibility JavaVersion.VERSION_1_8
51+
}
4352
}
4453

4554
repositories {
46-
mavenLocal()
55+
mavenCentral()
56+
google()
57+
58+
def found = false
59+
def defaultDir = null
60+
def androidSourcesName = 'React Native sources'
61+
62+
if (rootProject.ext.has('reactNativeAndroidRoot')) {
63+
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
64+
} else {
65+
defaultDir = new File(
66+
projectDir,
67+
'/../../../node_modules/react-native/android'
68+
)
69+
}
70+
71+
if (defaultDir.exists()) {
4772
maven {
48-
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
49-
url("$rootDir/../node_modules/react-native/android")
73+
url defaultDir.toString()
74+
name androidSourcesName
5075
}
51-
google()
52-
mavenCentral()
53-
jcenter()
76+
77+
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
78+
found = true
79+
} else {
80+
def parentDir = rootProject.projectDir
81+
82+
1.upto(5, {
83+
if (found) return true
84+
parentDir = parentDir.parentFile
85+
86+
def androidSourcesDir = new File(
87+
parentDir,
88+
'node_modules/react-native'
89+
)
90+
91+
def androidPrebuiltBinaryDir = new File(
92+
parentDir,
93+
'node_modules/react-native/android'
94+
)
95+
96+
if (androidPrebuiltBinaryDir.exists()) {
97+
maven {
98+
url androidPrebuiltBinaryDir.toString()
99+
name androidSourcesName
100+
}
101+
102+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
103+
found = true
104+
} else if (androidSourcesDir.exists()) {
105+
maven {
106+
url androidSourcesDir.toString()
107+
name androidSourcesName
108+
}
109+
110+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
111+
found = true
112+
}
113+
})
114+
}
115+
116+
if (!found) {
117+
throw new GradleException(
118+
"${project.name}: unable to locate React Native android sources. " +
119+
"Ensure you have you installed React Native as a dependency in your project and try again."
120+
)
121+
}
54122
}
55123

124+
56125
dependencies {
57-
//noinspection GradleDynamicVersion
58-
implementation "com.facebook.react:react-native:+" // From node_modules
59-
//noinspection GradleDynamicVersion
60-
implementation 'com.bugfender.sdk:android:3.+'
126+
//noinspection GradleDynamicVersion
127+
implementation "com.facebook.react:react-native:+"
128+
//noinspection GradleDynamicVersion
129+
implementation 'com.bugfender.sdk:android:3.+'
130+
}
131+
132+
if (isNewArchitectureEnabled()) {
133+
react {
134+
jsRootDir = file("../src/")
135+
libraryName = "RnBugfender"
136+
codegenJavaPackageName = "com.bugfenderrnbugfender"
137+
}
61138
}

android/gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
RnBugfender_kotlinVersion=1.7.0
2+
RnBugfender_minSdkVersion=21
3+
RnBugfender_targetSdkVersion=31
4+
RnBugfender_compileSdkVersion=31
5+
RnBugfender_ndkversion=21.4.7075529
-58.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)