Move react/fabric/components -> react/cxxcomponents

Summary:
This diff moves Component and ComponentManager classes -> react/cxxcomponents. The purpose is to be able to use these classes from any platform, not only Android

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D39531533

fbshipit-source-id: 4732aa7bf59d82dae11441212975f0e225c6d458
This commit is contained in:
David Vacca
2022-09-16 12:33:15 -07:00
committed by Facebook GitHub Bot
parent c9966e417d
commit 85e9b073cb
9 changed files with 75 additions and 4 deletions
+1
View File
@@ -93,6 +93,7 @@ add_react_android_subdir(src/main/jni/first-party/fbjni)
add_react_android_subdir(src/main/jni/first-party/fb)
add_react_android_subdir(src/main/jni/first-party/fbgloginit)
add_react_android_subdir(src/main/jni/first-party/yogajni)
add_react_android_subdir(src/main/jni/react/cxxcomponents)
add_react_android_subdir(src/main/jni/react/jni)
add_react_android_subdir(src/main/jni/react/reactperflogger)
add_react_android_subdir(src/main/jni/react/jscexecutor)
@@ -0,0 +1,46 @@
load(
"//tools/build_defs/oss:rn_defs.bzl",
"ANDROID",
"APPLE",
"CXX",
"react_native_xplat_target",
"rn_xplat_cxx_library",
"subdir_glob",
)
rn_xplat_cxx_library(
name = "components",
srcs = glob(
["**/*.cpp"],
),
headers = glob(
["**/*.h"],
),
header_namespace = "",
exported_headers = subdir_glob(
[
("", "**/*.h"),
],
prefix = "react/cxxcomponents",
),
force_static = True,
labels = [
"pfh:ReactNative_CommonInfrastructurePlaceholder",
"supermodule:xplat/default/public.react_native.infra",
],
platforms = (APPLE, ANDROID, CXX),
preprocessor_flags = [
"-DLOG_TAG=\"ReactNative\"",
"-DWITH_FBSYSTRACE=1",
],
soname = "libcxxcomponents.$(ext)",
tests = [":tests"],
visibility = ["PUBLIC"],
deps = [
"//third-party/glog:glog",
"//xplat/fbsystrace:fbsystrace",
"//xplat/folly:memory",
"//xplat/folly:molly",
react_native_xplat_target("react/renderer/core:core"),
],
)
@@ -0,0 +1,22 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)
add_compile_options(
-fexceptions
-frtti
-std=c++17
-Wall
-Wpedantic
-Wno-gnu-zero-variadic-macro-arguments)
file(GLOB_RECURSE cxxcomponents_SRC CONFIGURE_DEPENDS *.cpp *.h)
add_library(cxxcomponents SHARED ${cxxcomponents_SRC})
target_include_directories(cxxcomponents PUBLIC .)
set_target_properties(cxxcomponents PROPERTIES LINKER_LANGUAGE CXX)
@@ -7,7 +7,7 @@
#pragma once
#include <react/fabric/Component.h>
#include <react/cxxcomponents/Component.h>
#include <react/renderer/core/Props.h>
namespace facebook::react {
@@ -35,6 +35,7 @@ rn_xplat_cxx_library(
react_native_xplat_target("react/renderer/componentregistry:componentregistry"),
react_native_xplat_target("react/renderer/components/scrollview:scrollview"),
react_native_xplat_target("runtimeexecutor:runtimeexecutor"),
"//xplat/js/react-native-github/ReactAndroid/src/main/jni/react/cxxcomponents:components",
react_native_target("jni/react/jni:jni"),
"//xplat/fbsystrace:fbsystrace",
"//xplat/jsi:JSIDynamic",
@@ -18,6 +18,7 @@ target_include_directories(fabricjni PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(
fabricjni
butter
cxxcomponents
fb
fbjni
folly_runtime
@@ -8,7 +8,7 @@
#pragma once
#include <fbjni/fbjni.h>
#include <react/fabric/ComponentManager.h>
#include <react/cxxcomponents/ComponentManager.h>
namespace facebook {
namespace react {
@@ -14,8 +14,8 @@
#include <mutex>
#include <unordered_set>
#include <react/fabric/Component.h>
#include <react/fabric/ComponentManager.h>
#include <react/cxxcomponents/Component.h>
#include <react/cxxcomponents/ComponentManager.h>
#include <react/fabric/ComponentRegistryResolver.h>
namespace facebook {