mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
TurboModule Android: compile TurboModule C++ Core into ReactAndroid
Summary: This is to prepare for enabling TurboModule on Android. This commit compiles in all the core files (C++) into the ReactAndroid NDK build step. This doesn't yet enable TurboModule by default, just compiling in the infra, just like for iOS. New shared libs: * libreact_nativemodule_core.so: The TurboModule Android core * libreact_nativemodule_manager.so: The TurboModule manager/delegate To be compatible with `<ReactCommon/` .h include prefix, the files had to move to local `ReactCommon` subdirs. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D23805717 fbshipit-source-id: b41c392a592dd095ae003f7b2a689f4add2c37a9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
412fc7d324
commit
5be44456f2
@@ -5,6 +5,10 @@
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
#########################
|
||||
### callinvokerholder ###
|
||||
#########################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
# Header search path for all source files in this module.
|
||||
@@ -15,10 +19,10 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||
|
||||
LOCAL_CFLAGS += -fexceptions -frtti -std=c++14 -Wall
|
||||
|
||||
LOCAL_STATIC_LIBRARIES = libcallinvoker libreactperfloggerjni
|
||||
|
||||
LOCAL_SHARED_LIBRARIES = libfb libfbjni
|
||||
|
||||
LOCAL_STATIC_LIBRARIES = libcallinvoker libreactperfloggerjni
|
||||
|
||||
# Name of this module.
|
||||
LOCAL_MODULE := callinvokerholder
|
||||
|
||||
@@ -27,3 +31,30 @@ LOCAL_SRC_FILES := $(LOCAL_PATH)/ReactCommon/CallInvokerHolder.cpp
|
||||
|
||||
# Build the files in this directory as a shared library
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
##################################
|
||||
### react_nativemodule_manager ###
|
||||
##################################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
# Name of this module.
|
||||
LOCAL_MODULE := react_nativemodule_manager
|
||||
|
||||
# Header search path for all source files in this module.
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/ReactCommon
|
||||
|
||||
# Header search path for modules that depend on this module
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||
|
||||
LOCAL_CFLAGS += -fexceptions -frtti -std=c++14 -Wall
|
||||
|
||||
LOCAL_SHARED_LIBRARIES = libfb libfbjni libreact_nativemodule_core
|
||||
|
||||
LOCAL_STATIC_LIBRARIES = libcallinvokerholder libreactperfloggerjni
|
||||
|
||||
# Compile all local c++ files
|
||||
LOCAL_SRC_FILES := $(LOCAL_PATH)/ReactCommon/TurboModuleManager.cpp $(LOCAL_PATH)/ReactCommon/OnLoad.cpp
|
||||
|
||||
# Build the files in this directory as a shared library
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
@@ -80,7 +80,7 @@ LOCAL_LDLIBS += -landroid
|
||||
LOCAL_SHARED_LIBRARIES := libreactnativeutilsjni libfolly_json libfb libfbjni libglog_init libyoga
|
||||
|
||||
# The static libraries (.a files) that this module depends on.
|
||||
LOCAL_STATIC_LIBRARIES := libreactnative libcallinvokerholder libruntimeexecutor
|
||||
LOCAL_STATIC_LIBRARIES := libreactnative libruntimeexecutor libcallinvokerholder
|
||||
|
||||
# Name of this module.
|
||||
#
|
||||
@@ -128,8 +128,11 @@ $(call import-module,callinvoker)
|
||||
$(call import-module,reactperflogger)
|
||||
$(call import-module,hermes)
|
||||
$(call import-module,runtimeexecutor)
|
||||
$(call import-module,react/nativemodule/core)
|
||||
|
||||
include $(REACT_SRC_DIR)/reactperflogger/jni/Android.mk
|
||||
# TODO (T48588859): Restructure this target to align with dir structure: "react/nativemodule/..."
|
||||
# Note: Update this only when ready to minimize breaking changes.
|
||||
include $(REACT_SRC_DIR)/turbomodule/core/jni/Android.mk
|
||||
|
||||
ifeq ($(BUILD_FABRIC),true)
|
||||
|
||||
@@ -49,13 +49,13 @@ Pod::Spec.new do |s|
|
||||
ss.dependency "glog"
|
||||
|
||||
ss.subspec "core" do |sss|
|
||||
sss.source_files = "react/nativemodule/core/*.{cpp,h}",
|
||||
"react/nativemodule/core/platform/ios/*.{mm,cpp,h}"
|
||||
sss.source_files = "react/nativemodule/core/ReactCommon/**/*.{cpp,h}",
|
||||
"react/nativemodule/core/platform/ios/**/*.{mm,cpp,h}"
|
||||
end
|
||||
|
||||
ss.subspec "samples" do |sss|
|
||||
sss.source_files = "react/nativemodule/samples/*.{cpp,h}",
|
||||
"react/nativemodule/samples/platform/ios/*.{mm,cpp,h}"
|
||||
"react/nativemodule/samples/platform/ios/**/*.{mm,cpp,h}"
|
||||
sss.dependency "ReactCommon/turbomodule/core", version
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := react_nativemodule_core
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../ $(LOCAL_PATH)/ReactCommon $(LOCAL_PATH)/platform/android/ReactCommon
|
||||
|
||||
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/ReactCommon/*.cpp) $(wildcard $(LOCAL_PATH)/platform/android/ReactCommon/*.cpp)
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/platform/android/
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := libfbjni libfolly_json libreactnativejni
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := libjsi libreactperflogger
|
||||
|
||||
LOCAL_CFLAGS := \
|
||||
-DLOG_TAG=\"ReactNative\"
|
||||
|
||||
LOCAL_CFLAGS += -fexceptions -frtti -std=c++14 -Wall
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,folly)
|
||||
$(call import-module,jsi)
|
||||
$(call import-module,reactperflogger)
|
||||
@@ -4,12 +4,12 @@ load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "APPLE", "FBJNI_TARGET", "
|
||||
rn_xplat_cxx_library(
|
||||
name = "core",
|
||||
srcs = glob(
|
||||
["*.cpp"],
|
||||
["ReactCommon/**/*.cpp"],
|
||||
),
|
||||
header_namespace = "",
|
||||
exported_headers = subdir_glob(
|
||||
[
|
||||
("", "*.h"),
|
||||
("ReactCommon", "*.h"),
|
||||
],
|
||||
prefix = "ReactCommon",
|
||||
),
|
||||
@@ -26,13 +26,13 @@ rn_xplat_cxx_library(
|
||||
],
|
||||
fbandroid_exported_headers = subdir_glob(
|
||||
[
|
||||
("platform/android", "*.h"),
|
||||
("platform/android/ReactCommon", "*.h"),
|
||||
],
|
||||
prefix = "ReactCommon",
|
||||
),
|
||||
fbandroid_srcs = glob(
|
||||
[
|
||||
"platform/android/**/*.cpp",
|
||||
"platform/android/ReactCommon/*.cpp",
|
||||
],
|
||||
),
|
||||
fbobjc_compiler_flags = [
|
||||
|
||||
@@ -524,7 +524,7 @@ SPEC CHECKSUMS:
|
||||
React-RCTText: 6c01963d3e562109f5548262b09b1b2bc260dd60
|
||||
React-RCTVibration: 0997fcaf753c7ac0a341177db120eebc438484cf
|
||||
React-runtimeexecutor: 60dd6204a13f68a1aa1118870edcc604a791df2b
|
||||
ReactCommon: 982fb4cf650ef68a435f3c0bfff76fbdda1ba663
|
||||
ReactCommon: e74025a9d02a02150f065719e14a8cbe03a93513
|
||||
Yoga: f7fa200d8c49f97b54c9421079e781fb900b5cae
|
||||
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
|
||||
|
||||
|
||||
Reference in New Issue
Block a user