mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 20:01:01 +08:00
Build new bridge with gradle
Reviewed By: bestander Differential Revision: D3324351 fbshipit-source-id: 41fa18a23c8661440a7deff244c93278f418e1d9
This commit is contained in:
committed by
Facebook Github Bot 9
parent
708530a905
commit
5e8f1716fc
@@ -5,7 +5,7 @@ APP_PLATFORM := android-9
|
||||
|
||||
APP_MK_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
|
||||
NDK_MODULE_PATH := $(APP_MK_DIR)$(HOST_DIRSEP)$(THIRD_PARTY_NDK_DIR)$(HOST_DIRSEP)$(APP_MK_DIR)first-party
|
||||
NDK_MODULE_PATH := $(APP_MK_DIR)$(HOST_DIRSEP)$(THIRD_PARTY_NDK_DIR)$(HOST_DIRSEP)$(REACT_COMMON_DIR)$(HOST_DIRSEP)$(APP_MK_DIR)first-party
|
||||
|
||||
APP_STL := gnustl_shared
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
@@ -18,7 +18,6 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
|
||||
LOCAL_CFLAGS := \
|
||||
-DLOG_TAG=\"ReactNative\"
|
||||
|
||||
LOCAL_LDLIBS += -landroid
|
||||
LOCAL_CFLAGS += -Wall -Werror -fexceptions -frtti
|
||||
CXX11_FLAGS := -std=c++11
|
||||
LOCAL_CFLAGS += $(CXX11_FLAGS)
|
||||
|
||||
@@ -2,20 +2,21 @@ LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := reactnativejni
|
||||
LOCAL_MODULE := libreactnativejni
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
JExecutorToken.cpp \
|
||||
JMessageQueueThread.cpp \
|
||||
JniJSModulesUnbundle.cpp \
|
||||
JSCPerfLogging.cpp \
|
||||
JSLoader.cpp \
|
||||
JSLogging.cpp \
|
||||
JniJSModulesUnbundle.cpp \
|
||||
NativeArray.cpp \
|
||||
OnLoad.cpp \
|
||||
ProxyExecutor.cpp \
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../.. $(LOCAL_PATH)/..
|
||||
|
||||
LOCAL_CFLAGS += -Wall -Werror -fvisibility=hidden -fexceptions -frtti
|
||||
CXX11_FLAGS := -std=c++11
|
||||
|
||||
@@ -24,4 +24,3 @@ LOCAL_LDFLAGS += $(BUCK_DEP_LDFLAGS)
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
$(call import-module,react)
|
||||
$(call import-module,google-test)
|
||||
|
||||
@@ -5,6 +5,7 @@ LOCAL_SRC_FILES:= \
|
||||
folly/json.cpp \
|
||||
folly/Unicode.cpp \
|
||||
folly/Conv.cpp \
|
||||
folly/Demangle.cpp \
|
||||
folly/detail/FunctionalExcept.cpp \
|
||||
folly/detail/MallocImpl.cpp \
|
||||
folly/StringBase.cpp \
|
||||
|
||||
40
ReactAndroid/src/main/jni/xreact/Android.mk
Normal file
40
ReactAndroid/src/main/jni/xreact/Android.mk
Normal file
@@ -0,0 +1,40 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := reactnativejnifb
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
CatalystInstanceImpl.cpp \
|
||||
CxxModuleWrapper.cpp \
|
||||
JExecutorToken.cpp \
|
||||
JMessageQueueThread.cpp \
|
||||
JniJSModulesUnbundle.cpp \
|
||||
JSCPerfLogging.cpp \
|
||||
JSLoader.cpp \
|
||||
JSLogging.cpp \
|
||||
MethodInvoker.cpp \
|
||||
ModuleRegistryHolder.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)
|
||||
40
ReactAndroid/src/main/jni/xreact/jni/Android.mk
Normal file
40
ReactAndroid/src/main/jni/xreact/jni/Android.mk
Normal file
@@ -0,0 +1,40 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libreactnativejnifb
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
CatalystInstanceImpl.cpp \
|
||||
CxxModuleWrapper.cpp \
|
||||
JExecutorToken.cpp \
|
||||
JMessageQueueThread.cpp \
|
||||
JniJSModulesUnbundle.cpp \
|
||||
JSCPerfLogging.cpp \
|
||||
JSLoader.cpp \
|
||||
JSLogging.cpp \
|
||||
MethodInvoker.cpp \
|
||||
ModuleRegistryHolder.cpp \
|
||||
OnLoad.cpp \
|
||||
ProxyExecutor.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 libreactnativejni
|
||||
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,react/jni)
|
||||
@@ -18,8 +18,8 @@ cxx_library(
|
||||
'//xplat/folly:molly',
|
||||
'//xplat/fbsystrace:fbsystrace',
|
||||
react_native_target('jni/react/jni:jni'),
|
||||
react_native_xplat_target('bridge:bridge'),
|
||||
react_native_xplat_target('bridge:module'),
|
||||
react_native_xplat_target('cxxreact:bridge'),
|
||||
react_native_xplat_target('cxxreact:module'),
|
||||
],
|
||||
srcs = glob(['*.cpp']),
|
||||
exported_headers = EXPORTED_HEADERS,
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <jni/Registration.h>
|
||||
|
||||
#include <cxxreact/JsArgumentHelpers.h>
|
||||
#include <cxxreact/FollySupport.h>
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
@@ -190,7 +191,7 @@ std::string CxxModuleWrapper::getConstantsJson() {
|
||||
constsobject.insert(std::move(c.first), std::move(c.second));
|
||||
}
|
||||
|
||||
return folly::toJson(constsobject);
|
||||
return facebook::react::detail::toStdString(folly::toJson(constsobject));
|
||||
}
|
||||
|
||||
jobject CxxModuleWrapper::getMethods() {
|
||||
|
||||
@@ -137,7 +137,7 @@ jvalue extract(std::weak_ptr<Instance>& instance, ExecutorToken token, char type
|
||||
value.l = valueOf(extractDouble(arg));
|
||||
break;
|
||||
case 'S':
|
||||
value.l = jni::make_jstring(arg.getString()).release();
|
||||
value.l = jni::make_jstring(arg.getString().c_str()).release();
|
||||
break;
|
||||
case 'A':
|
||||
value.l = ReadableNativeArray::newObjectCxxArgs(arg).release();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <fb/fbjni.h>
|
||||
|
||||
#include <cxxreact/ModuleRegistry.h>
|
||||
#include <react/jni/CxxModuleWrapper.h>
|
||||
#include "CxxModuleWrapper.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <folly/Memory.h>
|
||||
|
||||
#include <cxxreact/SystraceSection.h>
|
||||
#include <cxxreact/FollySupport.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
@@ -56,7 +57,7 @@ ProxyExecutor::ProxyExecutor(jni::global_ref<jobject>&& executorInstance,
|
||||
SystraceSection t("setGlobalVariable");
|
||||
setGlobalVariable(
|
||||
"__fbBatchedBridgeConfig",
|
||||
folly::make_unique<JSBigStdString>(folly::toJson(config)));
|
||||
folly::make_unique<JSBigStdString>(detail::toStdString(folly::toJson(config))));
|
||||
}
|
||||
|
||||
ProxyExecutor::~ProxyExecutor() {
|
||||
|
||||
@@ -8,10 +8,10 @@ cxx_library(
|
||||
'-fexceptions',
|
||||
],
|
||||
deps = [
|
||||
'//native:base',
|
||||
'//native/fb:fb',
|
||||
'//native:base',
|
||||
'//xplat/folly:molly',
|
||||
react_native_xplat_target('bridge:module'),
|
||||
react_native_xplat_target('cxxreact:module'),
|
||||
],
|
||||
visibility = [
|
||||
'//instrumentation_tests/com/facebook/react/...',
|
||||
|
||||
Reference in New Issue
Block a user