Skip to content

Commit bd5051a

Browse files
javachefacebook-github-bot
authored andcommitted
Move xreact/jni to react/jni
Reviewed By: mhorowitz Differential Revision: D5155612 fbshipit-source-id: 871a23916c0069498691dc0dd3c94fd2e404cec9
1 parent 7c980c5 commit bd5051a

Some content is hidden

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

63 files changed

+108
-204
lines changed

ReactAndroid/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def getNdkBuildFullPath() {
195195
}
196196

197197
task buildReactNdkLib(dependsOn: [prepareJSC, prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog], type: Exec) {
198-
inputs.file('src/main/jni/xreact')
198+
inputs.file('src/main/jni/react')
199199
outputs.dir("$buildDir/react-ndk/all")
200200
commandLine getNdkBuildFullPath(),
201201
'NDK_PROJECT_PATH=null',
Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
include_defs("//ReactAndroid/DEFS")
22

3-
DEPS = [
4-
react_native_dep("java/com/facebook/systrace:systrace"),
5-
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
6-
react_native_dep("libraries/soloader/java/com/facebook/soloader:soloader"),
7-
react_native_dep("third-party/android/support/v4:lib-support-v4"),
8-
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
9-
react_native_dep("third-party/java/jsr-305:jsr-305"),
10-
react_native_target("java/com/facebook/react/bridge:bridge"),
11-
react_native_target("java/com/facebook/react/common:common"),
12-
react_native_target("java/com/facebook/react/devsupport:devsupport"),
13-
react_native_target("java/com/facebook/react/devsupport:interfaces"),
14-
react_native_target("java/com/facebook/react/jstasks:jstasks"),
15-
react_native_target("java/com/facebook/react/module/annotations:annotations"),
16-
react_native_target("java/com/facebook/react/module/model:model"),
17-
react_native_target("java/com/facebook/react/modules/appregistry:appregistry"),
18-
react_native_target("java/com/facebook/react/modules/core:core"),
19-
react_native_target("java/com/facebook/react/modules/debug:debug"),
20-
react_native_target("java/com/facebook/react/modules/debug:interfaces"),
21-
react_native_target("java/com/facebook/react/modules/deviceinfo:deviceinfo"),
22-
react_native_target("java/com/facebook/react/modules/systeminfo:systeminfo"),
23-
react_native_target("java/com/facebook/react/modules/toast:toast"),
24-
react_native_target("java/com/facebook/react/uimanager:uimanager"),
25-
react_native_target("java/com/facebook/react/views/imagehelper:imagehelper"),
26-
]
27-
283
android_library(
294
name = "react",
305
srcs = glob(["*.java"]),
316
visibility = [
327
"PUBLIC",
338
],
34-
deps = DEPS,
9+
deps = [
10+
react_native_dep("java/com/facebook/systrace:systrace"),
11+
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
12+
react_native_dep("libraries/soloader/java/com/facebook/soloader:soloader"),
13+
react_native_dep("third-party/android/support/v4:lib-support-v4"),
14+
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
15+
react_native_dep("third-party/java/jsr-305:jsr-305"),
16+
react_native_target("java/com/facebook/react/bridge:bridge"),
17+
react_native_target("java/com/facebook/react/common:common"),
18+
react_native_target("java/com/facebook/react/devsupport:devsupport"),
19+
react_native_target("java/com/facebook/react/devsupport:interfaces"),
20+
react_native_target("java/com/facebook/react/jstasks:jstasks"),
21+
react_native_target("java/com/facebook/react/module/annotations:annotations"),
22+
react_native_target("java/com/facebook/react/module/model:model"),
23+
react_native_target("java/com/facebook/react/modules/appregistry:appregistry"),
24+
react_native_target("java/com/facebook/react/modules/core:core"),
25+
react_native_target("java/com/facebook/react/modules/debug:debug"),
26+
react_native_target("java/com/facebook/react/modules/debug:interfaces"),
27+
react_native_target("java/com/facebook/react/modules/deviceinfo:deviceinfo"),
28+
react_native_target("java/com/facebook/react/modules/systeminfo:systeminfo"),
29+
react_native_target("java/com/facebook/react/modules/toast:toast"),
30+
react_native_target("java/com/facebook/react/uimanager:uimanager"),
31+
react_native_target("java/com/facebook/react/views/imagehelper:imagehelper"),
32+
],
3533
)

ReactAndroid/src/main/java/com/facebook/react/bridge/BUCK

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ android_library(
3434
react_native_dep("third-party/java/jsr-305:jsr-305"),
3535
react_native_target("java/com/facebook/react/common:common"),
3636
react_native_target("java/com/facebook/react/module/model:model"),
37+
react_native_target("jni/react/jni:jni"),
3738
],
3839
)

ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,8 @@
4040
*/
4141
@DoNotStrip
4242
public class CatalystInstanceImpl implements CatalystInstance {
43-
44-
/* package */ static final String REACT_NATIVE_LIB = "reactnativejnifb";
45-
4643
static {
47-
SoLoader.loadLibrary(REACT_NATIVE_LIB);
44+
ReactBridge.staticInit();
4845
}
4946

5047
private static final AtomicInteger sNextInstanceIdForTrace = new AtomicInteger(1);

ReactAndroid/src/main/java/com/facebook/react/bridge/CxxModuleWrapperBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
public class CxxModuleWrapperBase implements NativeModule
1717
{
1818
static {
19-
SoLoader.loadLibrary(CatalystInstanceImpl.REACT_NATIVE_LIB);
19+
ReactBridge.staticInit();
2020
}
2121

2222
@DoNotStrip

ReactAndroid/src/main/java/com/facebook/react/bridge/JSCJavaScriptExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public JavaScriptExecutor create() throws Exception {
3232
}
3333

3434
static {
35-
SoLoader.loadLibrary(CatalystInstanceImpl.REACT_NATIVE_LIB);
35+
ReactBridge.staticInit();
3636
}
3737

3838
public JSCJavaScriptExecutor(ReadableNativeArray jscConfig) {

ReactAndroid/src/main/java/com/facebook/react/bridge/ProxyJavaScriptExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public JavaScriptExecutor create() throws Exception {
3939
}
4040

4141
static {
42-
SoLoader.loadLibrary(CatalystInstanceImpl.REACT_NATIVE_LIB);
42+
ReactBridge.staticInit();
4343
}
4444

4545
private @Nullable JavaJSExecutor mJavaJSExecutor;

ReactAndroid/src/main/java/com/facebook/react/bridge/ReactBridge.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,11 @@
1212
import com.facebook.soloader.SoLoader;
1313

1414
public class ReactBridge {
15-
16-
private static final String REACT_NATIVE_LIB = "reactnativejni";
17-
private static final String XREACT_NATIVE_LIB = "reactnativejnifb";
18-
1915
static {
20-
staticInit();
16+
SoLoader.loadLibrary("reactnativejni");
2117
}
2218

2319
public static void staticInit() {
24-
SoLoader.loadLibrary(REACT_NATIVE_LIB);
25-
SoLoader.loadLibrary(XREACT_NATIVE_LIB);
20+
// This method only exists to trigger the static initializer above
2621
}
2722
}

ReactAndroid/src/main/jni/react/jni/Android.mk

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,46 @@ LOCAL_PATH := $(call my-dir)
22

33
include $(CLEAR_VARS)
44

5-
LOCAL_MODULE := libreactnativejni
5+
LOCAL_MODULE := reactnativejni
66

77
LOCAL_SRC_FILES := \
8-
Dummy.cpp \
8+
CatalystInstanceImpl.cpp \
9+
CxxModuleWrapper.cpp \
10+
JavaModuleWrapper.cpp \
11+
JMessageQueueThread.cpp \
12+
JSCPerfLogging.cpp \
13+
JSLoader.cpp \
14+
JSLogging.cpp \
15+
JniJSModulesUnbundle.cpp \
16+
MethodInvoker.cpp \
17+
ModuleRegistryBuilder.cpp \
18+
NativeArray.cpp \
19+
NativeCommon.cpp \
20+
NativeMap.cpp \
21+
OnLoad.cpp \
22+
ProxyExecutor.cpp \
23+
ReadableNativeArray.cpp \
24+
ReadableNativeMap.cpp \
25+
WritableNativeArray.cpp \
26+
WritableNativeMap.cpp \
927

1028
LOCAL_C_INCLUDES := $(LOCAL_PATH)
11-
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../.. $(LOCAL_PATH)/..
29+
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../..
1230

1331
LOCAL_CFLAGS += -Wall -Werror -fvisibility=hidden -fexceptions -frtti
1432
CXX11_FLAGS := -std=c++11
1533
LOCAL_CFLAGS += $(CXX11_FLAGS)
1634
LOCAL_EXPORT_CPPFLAGS := $(CXX11_FLAGS)
1735

1836
LOCAL_LDLIBS += -landroid
19-
LOCAL_SHARED_LIBRARIES := libreactnativejnifb
20-
LOCAL_STATIC_LIBRARIES :=
37+
LOCAL_SHARED_LIBRARIES := libfolly_json libfbjni libjsc libglog_init libyoga
38+
LOCAL_STATIC_LIBRARIES := libreactnative
2139

2240
include $(BUILD_SHARED_LIBRARY)
2341

24-
$(call import-module,xreact/jni)
42+
$(call import-module,cxxreact)
43+
$(call import-module,fb)
44+
$(call import-module,fbgloginit)
45+
$(call import-module,folly)
46+
$(call import-module,jsc)
47+
$(call import-module,yogajni)
Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,57 @@
11
include_defs("//ReactAndroid/DEFS")
22

3-
# TODO(cjhopman): Remove this target (or move the xreact target to this directory).
3+
EXPORTED_HEADERS = [
4+
"CxxModuleWrapper.h",
5+
"CxxModuleWrapperBase.h",
6+
"CxxSharedModuleWrapper.h",
7+
"JavaModuleWrapper.h",
8+
"JSLoader.h",
9+
"MethodInvoker.h",
10+
"ModuleRegistryBuilder.h",
11+
"NativeArray.h",
12+
"NativeCommon.h",
13+
"NativeMap.h",
14+
"ReadableNativeArray.h",
15+
"ReadableNativeMap.h",
16+
"WritableNativeArray.h",
17+
"WritableNativeMap.h",
18+
]
19+
420
cxx_library(
521
name = "jni",
6-
srcs = [
7-
"Dummy.cpp",
22+
srcs = glob(["*.cpp"]),
23+
compiler_flags = [
24+
"-Wall",
25+
"-Werror",
26+
"-fexceptions",
27+
"-std=c++1y",
28+
"-frtti",
29+
"-Wno-pessimizing-move",
30+
"-Wno-inconsistent-missing-override",
831
],
32+
exported_headers = EXPORTED_HEADERS,
933
header_namespace = "react/jni",
34+
headers = glob(
35+
["*.h"],
36+
excludes = EXPORTED_HEADERS,
37+
),
38+
preprocessor_flags = [
39+
"-DLOG_TAG=\"ReactNativeJNI\"",
40+
"-DWITH_FBSYSTRACE=1",
41+
"-DWITH_INSPECTOR=1",
42+
],
1043
soname = "libreactnativejni.$(ext)",
1144
visibility = [
1245
"PUBLIC",
1346
],
14-
deps = [
15-
react_native_target("jni/xreact/jni:jni"),
47+
xcode_public_headers_symlinks = True,
48+
deps = JSC_DEPS + [
49+
"//native/third-party/android-ndk:android",
50+
"//xplat/folly:molly",
51+
"//xplat/fbgloginit:fbgloginit",
52+
"//xplat/fbsystrace:fbsystrace",
53+
react_native_xplat_target("cxxreact:bridge"),
54+
react_native_xplat_target("cxxreact:module"),
55+
FBJNI_TARGET,
1656
],
1757
)

0 commit comments

Comments
 (0)