Skip to content

Commit 85e9b07

Browse files
mdvaccafacebook-github-bot
authored andcommitted
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
1 parent c9966e4 commit 85e9b07

File tree

9 files changed

+75
-4
lines changed

9 files changed

+75
-4
lines changed

ReactAndroid/src/main/jni/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ add_react_android_subdir(src/main/jni/first-party/fbjni)
9393
add_react_android_subdir(src/main/jni/first-party/fb)
9494
add_react_android_subdir(src/main/jni/first-party/fbgloginit)
9595
add_react_android_subdir(src/main/jni/first-party/yogajni)
96+
add_react_android_subdir(src/main/jni/react/cxxcomponents)
9697
add_react_android_subdir(src/main/jni/react/jni)
9798
add_react_android_subdir(src/main/jni/react/reactperflogger)
9899
add_react_android_subdir(src/main/jni/react/jscexecutor)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
load(
2+
"//tools/build_defs/oss:rn_defs.bzl",
3+
"ANDROID",
4+
"APPLE",
5+
"CXX",
6+
"react_native_xplat_target",
7+
"rn_xplat_cxx_library",
8+
"subdir_glob",
9+
)
10+
11+
rn_xplat_cxx_library(
12+
name = "components",
13+
srcs = glob(
14+
["**/*.cpp"],
15+
),
16+
headers = glob(
17+
["**/*.h"],
18+
),
19+
header_namespace = "",
20+
exported_headers = subdir_glob(
21+
[
22+
("", "**/*.h"),
23+
],
24+
prefix = "react/cxxcomponents",
25+
),
26+
force_static = True,
27+
labels = [
28+
"pfh:ReactNative_CommonInfrastructurePlaceholder",
29+
"supermodule:xplat/default/public.react_native.infra",
30+
],
31+
platforms = (APPLE, ANDROID, CXX),
32+
preprocessor_flags = [
33+
"-DLOG_TAG=\"ReactNative\"",
34+
"-DWITH_FBSYSTRACE=1",
35+
],
36+
soname = "libcxxcomponents.$(ext)",
37+
tests = [":tests"],
38+
visibility = ["PUBLIC"],
39+
deps = [
40+
"//third-party/glog:glog",
41+
"//xplat/fbsystrace:fbsystrace",
42+
"//xplat/folly:memory",
43+
"//xplat/folly:molly",
44+
react_native_xplat_target("react/renderer/core:core"),
45+
],
46+
)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
#
3+
# This source code is licensed under the MIT license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
cmake_minimum_required(VERSION 3.13)
7+
set(CMAKE_VERBOSE_MAKEFILE on)
8+
9+
add_compile_options(
10+
-fexceptions
11+
-frtti
12+
-std=c++17
13+
-Wall
14+
-Wpedantic
15+
-Wno-gnu-zero-variadic-macro-arguments)
16+
17+
file(GLOB_RECURSE cxxcomponents_SRC CONFIGURE_DEPENDS *.cpp *.h)
18+
19+
add_library(cxxcomponents SHARED ${cxxcomponents_SRC})
20+
21+
target_include_directories(cxxcomponents PUBLIC .)
22+
set_target_properties(cxxcomponents PROPERTIES LINKER_LANGUAGE CXX)

ReactAndroid/src/main/jni/react/fabric/ComponentManager.h renamed to ReactAndroid/src/main/jni/react/cxxcomponents/ComponentManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#pragma once
99

10-
#include <react/fabric/Component.h>
10+
#include <react/cxxcomponents/Component.h>
1111
#include <react/renderer/core/Props.h>
1212

1313
namespace facebook::react {

ReactAndroid/src/main/jni/react/fabric/BUCK

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ rn_xplat_cxx_library(
3535
react_native_xplat_target("react/renderer/componentregistry:componentregistry"),
3636
react_native_xplat_target("react/renderer/components/scrollview:scrollview"),
3737
react_native_xplat_target("runtimeexecutor:runtimeexecutor"),
38+
"//xplat/js/react-native-github/ReactAndroid/src/main/jni/react/cxxcomponents:components",
3839
react_native_target("jni/react/jni:jni"),
3940
"//xplat/fbsystrace:fbsystrace",
4041
"//xplat/jsi:JSIDynamic",

ReactAndroid/src/main/jni/react/fabric/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ target_include_directories(fabricjni PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
1818
target_link_libraries(
1919
fabricjni
2020
butter
21+
cxxcomponents
2122
fb
2223
fbjni
2324
folly_runtime

ReactAndroid/src/main/jni/react/fabric/ComponentRegistryResolver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#pragma once
99

1010
#include <fbjni/fbjni.h>
11-
#include <react/fabric/ComponentManager.h>
11+
#include <react/cxxcomponents/ComponentManager.h>
1212

1313
namespace facebook {
1414
namespace react {

ReactAndroid/src/main/jni/react/fabric/CppComponentRegistry.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include <mutex>
1515
#include <unordered_set>
1616

17-
#include <react/fabric/Component.h>
18-
#include <react/fabric/ComponentManager.h>
17+
#include <react/cxxcomponents/Component.h>
18+
#include <react/cxxcomponents/ComponentManager.h>
1919
#include <react/fabric/ComponentRegistryResolver.h>
2020

2121
namespace facebook {

0 commit comments

Comments
 (0)