Skip to content

Commit d4d3e2c

Browse files
authored
SPLIT1: Use modules for jsi, up to rn 68 (keybase#25201)
* SPLIT 2: update small deps on spli 1 (keybase#25212) * SPLIT 3: RN 696 (keybase#25213)
1 parent 1a37f94 commit d4d3e2c

163 files changed

Lines changed: 18642 additions & 4626 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.

‎.gitignore‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ pvl-tools/node_modules
5555
shared/.tsOuts/.*
5656
# Storybook
5757
shared/.cache
58+
node_modules
59+
.gradle
60+
rnmodules/react-native-drop-view/android/build
61+
rnmodules/react-native-kb/android/build
62+
rnmodules/react-native-kb/android/.cxx
5863

5964
Keybase.app.dSYM.zip
6065

@@ -80,3 +85,4 @@ go/keybase/keybase_production
8085
go/keybase_freebsd
8186
go/keybase_netbsd
8287
go/keybase_openbsd
88+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
buildscript {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
}
6+
7+
dependencies {
8+
classpath("com.android.tools.build:gradle:4.2.2")
9+
}
10+
}
11+
12+
def isNewArchitectureEnabled() {
13+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
14+
}
15+
16+
apply plugin: 'com.android.library'
17+
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['DropView_' + name]
24+
}
25+
26+
def getExtOrIntegerDefault(name) {
27+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['DropView_' + name]).toInteger()
28+
}
29+
30+
android {
31+
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
32+
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
41+
}
42+
}
43+
44+
lintOptions {
45+
disable 'GradleCompatible'
46+
}
47+
48+
compileOptions {
49+
sourceCompatibility JavaVersion.VERSION_1_8
50+
targetCompatibility JavaVersion.VERSION_1_8
51+
}
52+
}
53+
54+
repositories {
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()) {
72+
maven {
73+
url defaultDir.toString()
74+
name androidSourcesName
75+
}
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+
}
122+
}
123+
124+
125+
dependencies {
126+
//noinspection GradleDynamicVersion
127+
implementation "com.facebook.react:react-native:+"
128+
// From node_modules
129+
}
130+
131+
if (isNewArchitectureEnabled()) {
132+
react {
133+
jsRootDir = file("../src/")
134+
libraryName = "DropView"
135+
codegenJavaPackageName = "com.reactnativedropview"
136+
}
137+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
DropView_kotlinVersion=1.7.0
2+
DropView_minSdkVersion=21
3+
DropView_targetSdkVersion=31
4+
DropView_compileSdkVersion=31
5+
DropView_ndkversion=21.4.7075529
6+
7+
android.useAndroidX=true
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.reactnativedropview">
3+
4+
</manifest>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.reactnativedropview;
2+
3+
import com.facebook.react.ReactPackage;
4+
import com.facebook.react.bridge.NativeModule;
5+
import com.facebook.react.bridge.ReactApplicationContext;
6+
import com.facebook.react.uimanager.ViewManager;
7+
8+
import java.util.Arrays;
9+
import java.util.Collections;
10+
import java.util.List;
11+
12+
public class DropViewPackage implements ReactPackage {
13+
@Override
14+
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
15+
return Collections.emptyList();
16+
}
17+
18+
@Override
19+
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
20+
DropViewViewManager dvvm = new DropViewViewManager();
21+
return Arrays.<ViewManager>asList(dvvm);
22+
}
23+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.reactnativedropview;
2+
3+
import android.graphics.Color;
4+
import android.view.View;
5+
import android.widget.FrameLayout;
6+
7+
import androidx.annotation.NonNull;
8+
9+
import com.facebook.react.uimanager.SimpleViewManager;
10+
import com.facebook.react.uimanager.ViewGroupManager;
11+
import com.facebook.react.uimanager.ThemedReactContext;
12+
import com.facebook.react.uimanager.annotations.ReactProp;
13+
14+
public class DropViewViewManager extends ViewGroupManager<FrameLayout> {
15+
public static final String REACT_CLASS = "DropView";
16+
17+
@Override
18+
@NonNull
19+
public String getName() {
20+
return REACT_CLASS;
21+
}
22+
23+
@Override
24+
public FrameLayout createViewInstance(ThemedReactContext reactContext) {
25+
return new FrameLayout(reactContext);
26+
}
27+
}
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+
};

0 commit comments

Comments
 (0)