Move xreact/jni to react/jni

Reviewed By: mhorowitz

Differential Revision: D5155612

fbshipit-source-id: 871a23916c0069498691dc0dd3c94fd2e404cec9
This commit is contained in:
Pieter De Baets 2017-06-01 05:30:34 -07:00 committed by Facebook Github Bot
parent 7c980c5ba5
commit bd5051adeb
63 changed files with 108 additions and 204 deletions

View File

@ -195,7 +195,7 @@ def getNdkBuildFullPath() {
}
task buildReactNdkLib(dependsOn: [prepareJSC, prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog], type: Exec) {
inputs.file('src/main/jni/xreact')
inputs.file('src/main/jni/react')
outputs.dir("$buildDir/react-ndk/all")
commandLine getNdkBuildFullPath(),
'NDK_PROJECT_PATH=null',

View File

@ -1,6 +1,12 @@
include_defs("//ReactAndroid/DEFS")
DEPS = [
android_library(
name = "react",
srcs = glob(["*.java"]),
visibility = [
"PUBLIC",
],
deps = [
react_native_dep("java/com/facebook/systrace:systrace"),
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
react_native_dep("libraries/soloader/java/com/facebook/soloader:soloader"),
@ -23,13 +29,5 @@ DEPS = [
react_native_target("java/com/facebook/react/modules/toast:toast"),
react_native_target("java/com/facebook/react/uimanager:uimanager"),
react_native_target("java/com/facebook/react/views/imagehelper:imagehelper"),
]
android_library(
name = "react",
srcs = glob(["*.java"]),
visibility = [
"PUBLIC",
],
deps = DEPS,
)

View File

@ -34,5 +34,6 @@ android_library(
react_native_dep("third-party/java/jsr-305:jsr-305"),
react_native_target("java/com/facebook/react/common:common"),
react_native_target("java/com/facebook/react/module/model:model"),
react_native_target("jni/react/jni:jni"),
],
)

View File

@ -40,11 +40,8 @@ import com.facebook.systrace.TraceListener;
*/
@DoNotStrip
public class CatalystInstanceImpl implements CatalystInstance {
/* package */ static final String REACT_NATIVE_LIB = "reactnativejnifb";
static {
SoLoader.loadLibrary(REACT_NATIVE_LIB);
ReactBridge.staticInit();
}
private static final AtomicInteger sNextInstanceIdForTrace = new AtomicInteger(1);

View File

@ -16,7 +16,7 @@ import com.facebook.soloader.SoLoader;
public class CxxModuleWrapperBase implements NativeModule
{
static {
SoLoader.loadLibrary(CatalystInstanceImpl.REACT_NATIVE_LIB);
ReactBridge.staticInit();
}
@DoNotStrip

View File

@ -32,7 +32,7 @@ public class JSCJavaScriptExecutor extends JavaScriptExecutor {
}
static {
SoLoader.loadLibrary(CatalystInstanceImpl.REACT_NATIVE_LIB);
ReactBridge.staticInit();
}
public JSCJavaScriptExecutor(ReadableNativeArray jscConfig) {

View File

@ -39,7 +39,7 @@ public class ProxyJavaScriptExecutor extends JavaScriptExecutor {
}
static {
SoLoader.loadLibrary(CatalystInstanceImpl.REACT_NATIVE_LIB);
ReactBridge.staticInit();
}
private @Nullable JavaJSExecutor mJavaJSExecutor;

View File

@ -12,16 +12,11 @@ package com.facebook.react.bridge;
import com.facebook.soloader.SoLoader;
public class ReactBridge {
private static final String REACT_NATIVE_LIB = "reactnativejni";
private static final String XREACT_NATIVE_LIB = "reactnativejnifb";
static {
staticInit();
SoLoader.loadLibrary("reactnativejni");
}
public static void staticInit() {
SoLoader.loadLibrary(REACT_NATIVE_LIB);
SoLoader.loadLibrary(XREACT_NATIVE_LIB);
// This method only exists to trigger the static initializer above
}
}

View File

@ -2,13 +2,31 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libreactnativejni
LOCAL_MODULE := reactnativejni
LOCAL_SRC_FILES := \
Dummy.cpp \
CatalystInstanceImpl.cpp \
CxxModuleWrapper.cpp \
JavaModuleWrapper.cpp \
JMessageQueueThread.cpp \
JSCPerfLogging.cpp \
JSLoader.cpp \
JSLogging.cpp \
JniJSModulesUnbundle.cpp \
MethodInvoker.cpp \
ModuleRegistryBuilder.cpp \
NativeArray.cpp \
NativeCommon.cpp \
NativeMap.cpp \
OnLoad.cpp \
ProxyExecutor.cpp \
ReadableNativeArray.cpp \
ReadableNativeMap.cpp \
WritableNativeArray.cpp \
WritableNativeMap.cpp \
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../.. $(LOCAL_PATH)/..
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../..
LOCAL_CFLAGS += -Wall -Werror -fvisibility=hidden -fexceptions -frtti
CXX11_FLAGS := -std=c++11
@ -16,9 +34,14 @@ LOCAL_CFLAGS += $(CXX11_FLAGS)
LOCAL_EXPORT_CPPFLAGS := $(CXX11_FLAGS)
LOCAL_LDLIBS += -landroid
LOCAL_SHARED_LIBRARIES := libreactnativejnifb
LOCAL_STATIC_LIBRARIES :=
LOCAL_SHARED_LIBRARIES := libfolly_json libfbjni libjsc libglog_init libyoga
LOCAL_STATIC_LIBRARIES := libreactnative
include $(BUILD_SHARED_LIBRARY)
$(call import-module,xreact/jni)
$(call import-module,cxxreact)
$(call import-module,fb)
$(call import-module,fbgloginit)
$(call import-module,folly)
$(call import-module,jsc)
$(call import-module,yogajni)

View File

@ -1,17 +1,57 @@
include_defs("//ReactAndroid/DEFS")
# TODO(cjhopman): Remove this target (or move the xreact target to this directory).
EXPORTED_HEADERS = [
"CxxModuleWrapper.h",
"CxxModuleWrapperBase.h",
"CxxSharedModuleWrapper.h",
"JavaModuleWrapper.h",
"JSLoader.h",
"MethodInvoker.h",
"ModuleRegistryBuilder.h",
"NativeArray.h",
"NativeCommon.h",
"NativeMap.h",
"ReadableNativeArray.h",
"ReadableNativeMap.h",
"WritableNativeArray.h",
"WritableNativeMap.h",
]
cxx_library(
name = "jni",
srcs = [
"Dummy.cpp",
srcs = glob(["*.cpp"]),
compiler_flags = [
"-Wall",
"-Werror",
"-fexceptions",
"-std=c++1y",
"-frtti",
"-Wno-pessimizing-move",
"-Wno-inconsistent-missing-override",
],
exported_headers = EXPORTED_HEADERS,
header_namespace = "react/jni",
headers = glob(
["*.h"],
excludes = EXPORTED_HEADERS,
),
preprocessor_flags = [
"-DLOG_TAG=\"ReactNativeJNI\"",
"-DWITH_FBSYSTRACE=1",
"-DWITH_INSPECTOR=1",
],
soname = "libreactnativejni.$(ext)",
visibility = [
"PUBLIC",
],
deps = [
react_native_target("jni/xreact/jni:jni"),
xcode_public_headers_symlinks = True,
deps = JSC_DEPS + [
"//native/third-party/android-ndk:android",
"//xplat/folly:molly",
"//xplat/fbgloginit:fbgloginit",
"//xplat/fbsystrace:fbsystrace",
react_native_xplat_target("cxxreact:bridge"),
react_native_xplat_target("cxxreact:module"),
FBJNI_TARGET,
],
)

View File

@ -1,7 +0,0 @@
// Copyright 2004-present Facebook. All Rights Reserved.
namespace facebook {
namespace react {
void ThisWhatsLeftOfTheOldBridge() {
}
}
}

View File

@ -1,39 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := reactnativejnifb
LOCAL_SRC_FILES := \
CatalystInstanceImpl.cpp \
CxxModuleWrapper.cpp \
JavaModuleWrapper.cpp \
JMessageQueueThread.cpp \
JniJSModulesUnbundle.cpp \
JSCPerfLogging.cpp \
JSLoader.cpp \
JSLogging.cpp \
MethodInvoker.cpp \
OnLoad.cpp \
ProxyExecutor.cpp \
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../
LOCAL_CFLAGS += -Wall -Werror -fvisibility=hidden -fexceptions -frtti
CXX11_FLAGS := -std=c++11
LOCAL_CFLAGS += $(CXX11_FLAGS)
LOCAL_EXPORT_CPPFLAGS := $(CXX11_FLAGS)
LOCAL_LDLIBS += -landroid
LOCAL_SHARED_LIBRARIES := libfolly_json libfbjni libjsc libglog_init libreactnativejni
LOCAL_STATIC_LIBRARIES := libreactnative libreactnativefb
include $(BUILD_SHARED_LIBRARY)
$(call import-module,cxxreact)
$(call import-module,jsc)
$(call import-module,folly)
$(call import-module,fbgloginit)
$(call import-module,jni)
$(call import-module,react)

View File

@ -1,47 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libreactnativejnifb
LOCAL_SRC_FILES := \
CatalystInstanceImpl.cpp \
CxxModuleWrapper.cpp \
JavaModuleWrapper.cpp \
JMessageQueueThread.cpp \
JSCPerfLogging.cpp \
JSLoader.cpp \
JSLogging.cpp \
JniJSModulesUnbundle.cpp \
MethodInvoker.cpp \
ModuleRegistryBuilder.cpp \
NativeArray.cpp \
NativeCommon.cpp \
NativeMap.cpp \
OnLoad.cpp \
ProxyExecutor.cpp \
ReadableNativeArray.cpp \
ReadableNativeMap.cpp \
WritableNativeArray.cpp \
WritableNativeMap.cpp \
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../..
LOCAL_CFLAGS += -Wall -Werror -fvisibility=hidden -fexceptions -frtti
CXX11_FLAGS := -std=c++11
LOCAL_CFLAGS += $(CXX11_FLAGS)
LOCAL_EXPORT_CPPFLAGS := $(CXX11_FLAGS)
LOCAL_LDLIBS += -landroid
LOCAL_SHARED_LIBRARIES := libfolly_json libfbjni libjsc libglog_init libyoga
LOCAL_STATIC_LIBRARIES := libreactnativefb
include $(BUILD_SHARED_LIBRARY)
$(call import-module,cxxreact)
$(call import-module,jsc)
$(call import-module,folly)
$(call import-module,fbgloginit)
$(call import-module,jsc)
$(call import-module,yogajni)

View File

@ -1,57 +0,0 @@
include_defs("//ReactAndroid/DEFS")
EXPORTED_HEADERS = [
"CxxModuleWrapper.h",
"CxxModuleWrapperBase.h",
"CxxSharedModuleWrapper.h",
"JavaModuleWrapper.h",
"JSLoader.h",
"MethodInvoker.h",
"ModuleRegistryBuilder.h",
"NativeArray.h",
"NativeCommon.h",
"NativeMap.h",
"ReadableNativeArray.h",
"ReadableNativeMap.h",
"WritableNativeArray.h",
"WritableNativeMap.h",
]
cxx_library(
name = "jni",
srcs = glob(["*.cpp"]),
compiler_flags = [
"-Wall",
"-Werror",
"-fexceptions",
"-std=c++1y",
"-frtti",
"-Wno-pessimizing-move",
"-Wno-inconsistent-missing-override",
],
exported_headers = EXPORTED_HEADERS,
header_namespace = "xreact/jni",
headers = glob(
["*.h"],
excludes = EXPORTED_HEADERS,
),
preprocessor_flags = [
"-DLOG_TAG=\"ReactNativeJNI\"",
"-DWITH_FBSYSTRACE=1",
"-DWITH_INSPECTOR=1",
],
soname = "libreactnativejnifb.$(ext)",
visibility = [
"PUBLIC",
],
xcode_public_headers_symlinks = True,
deps = JSC_DEPS + [
"//native/third-party/android-ndk:android",
"//xplat/folly:molly",
"//xplat/fbgloginit:fbgloginit",
"//xplat/fbsystrace:fbsystrace",
react_native_xplat_target("cxxreact:bridge"),
react_native_xplat_target("cxxreact:module"),
FBJNI_TARGET,
],
)

View File

@ -2,7 +2,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libreactnativefb
LOCAL_MODULE := reactnative
LOCAL_SRC_FILES := \
CxxNativeModule.cpp \

View File

@ -134,7 +134,7 @@ rn_xplat_cxx_library(
# `initOnJSVMThread` to be called before the platform-specific hooks
# have been properly initialised. Bad Times(TM).
# -- @ashokmenon (2017/01/03)
react_native_target("jni/xreact/jni:jni"),
react_native_target("jni/react/jni:jni"),
react_native_xplat_target("cxxreact/..."),
],
fbobjc_frameworks = [