Skip to content

Commit e9e20e6

Browse files
sherginfacebook-github-bot
authored andcommitted
Fabric: <Root> component was decoupled from <View>
Summary: @public There is no reason to have it inside View; it deserves that. Reviewed By: mdvacca Differential Revision: D8757012 fbshipit-source-id: 881b54008b51614cd203ab97811494fa7c30e4ef
1 parent 95bd4a0 commit e9e20e6

File tree

10 files changed

+97
-14
lines changed

10 files changed

+97
-14
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
load("@xplat//tools/build_defs:glob_defs.bzl", "subdir_glob")
2+
load("//configurations/buck/apple:flag_defs.bzl", "OBJC_ARC_PREPROCESSOR_FLAGS", "get_application_ios_flags", "get_debug_preprocessor_flags")
3+
load("//ReactNative:DEFS.bzl", "ANDROID", "APPLE", "IS_OSS_BUILD", "get_apple_inspector_flags", "react_native_xplat_target", "rn_xplat_cxx_library")
4+
5+
APPLE_COMPILER_FLAGS = []
6+
7+
if not IS_OSS_BUILD:
8+
load("@xplat//configurations/buck/apple:flag_defs.bzl", "flags", "get_static_library_ios_flags")
9+
10+
APPLE_COMPILER_FLAGS = flags.get_flag_value(get_static_library_ios_flags(), "compiler_flags")
11+
12+
rn_xplat_cxx_library(
13+
name = "root",
14+
srcs = glob(
15+
["**/*.cpp"],
16+
exclude = glob(["tests/**/*.cpp"]),
17+
),
18+
headers = [],
19+
header_namespace = "",
20+
exported_headers = subdir_glob(
21+
[
22+
("", "*.h"),
23+
],
24+
prefix = "fabric/components/root",
25+
),
26+
compiler_flags = [
27+
"-fexceptions",
28+
"-frtti",
29+
"-std=c++14",
30+
"-Wall",
31+
],
32+
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
33+
fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(),
34+
fbobjc_tests = [
35+
":tests",
36+
],
37+
macosx_tests_override = [],
38+
platforms = (ANDROID, APPLE),
39+
preprocessor_flags = [
40+
"-DLOG_TAG=\"ReactNative\"",
41+
"-DWITH_FBSYSTRACE=1",
42+
],
43+
tests = [],
44+
visibility = ["PUBLIC"],
45+
deps = [
46+
"xplat//fbsystrace:fbsystrace",
47+
"xplat//folly:headers_only",
48+
"xplat//folly:memory",
49+
"xplat//folly:molly",
50+
"xplat//third-party/glog:glog",
51+
"xplat//yoga:yoga",
52+
react_native_xplat_target("fabric/debug:debug"),
53+
react_native_xplat_target("fabric/core:core"),
54+
react_native_xplat_target("fabric/graphics:graphics"),
55+
react_native_xplat_target("fabric/components/view:view"),
56+
],
57+
)
58+
59+
if not IS_OSS_BUILD:
60+
load("@xplat//build_defs:fb_xplat_cxx_test.bzl", "fb_xplat_cxx_test")
61+
62+
fb_xplat_cxx_test(
63+
name = "tests",
64+
srcs = glob(["tests/**/*.cpp"]),
65+
headers = glob(["tests/**/*.h"]),
66+
contacts = ["oncall+react_native@xmail.facebook.com"],
67+
compiler_flags = [
68+
"-fexceptions",
69+
"-frtti",
70+
"-std=c++14",
71+
"-Wall",
72+
],
73+
platforms = APPLE,
74+
deps = [
75+
"xplat//folly:molly",
76+
"xplat//third-party/gmock:gtest",
77+
":root",
78+
],
79+
)

ReactCommon/fabric/components/view/root/RootShadowNode.h renamed to ReactCommon/fabric/components/root/RootShadowNode.h

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

1010
#include <memory>
1111

12-
#include <fabric/components/view/RootProps.h>
12+
#include <fabric/components/root/RootProps.h>
1313
#include <fabric/components/view/ConcreteViewShadowNode.h>
1414
#include <fabric/core/LayoutContext.h>
1515

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#include <memory>
9+
10+
#include <gtest/gtest.h>
11+
12+
TEST(RootShadowNodeTest, testSomething) {
13+
// TODO
14+
}

ReactCommon/fabric/uimanager/BUCK

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,10 @@ rn_xplat_cxx_library(
5656
"xplat//folly:memory",
5757
"xplat//folly:molly",
5858
"xplat//third-party/glog:glog",
59-
react_native_xplat_target("fabric/components/scrollview:scrollview"),
60-
react_native_xplat_target("fabric/components/text:text"),
59+
react_native_xplat_target("fabric/components/root:root"),
60+
react_native_xplat_target("fabric/components/view:view"),
6161
react_native_xplat_target("fabric/core:core"),
6262
react_native_xplat_target("fabric/debug:debug"),
63-
react_native_xplat_target("fabric/components/view:view"),
6463
],
6564
)
6665

ReactCommon/fabric/uimanager/Scheduler.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55

66
#include "Scheduler.h"
77

8-
#include <fabric/components/scrollview/ScrollViewComponentDescriptor.h>
9-
#include <fabric/components/text/ParagraphComponentDescriptor.h>
10-
#include <fabric/components/text/RawTextComponentDescriptor.h>
11-
#include <fabric/components/text/TextComponentDescriptor.h>
12-
#include <fabric/components/view/ViewComponentDescriptor.h>
13-
#include <fabric/components/view/ViewProps.h>
14-
#include <fabric/components/view/ViewShadowNode.h>
158
#include <fabric/core/LayoutContext.h>
169
#include <fabric/uimanager/ComponentDescriptorRegistry.h>
1710
#include <fabric/uimanager/FabricUIManager.h>

ReactCommon/fabric/uimanager/Scheduler.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
#include <memory>
99

10-
#include <fabric/components/view/ViewShadowNode.h>
11-
#include <fabric/components/view/RootShadowNode.h>
1210
#include <fabric/core/ComponentDescriptor.h>
1311
#include <fabric/core/LayoutConstraints.h>
1412
#include <fabric/uimanager/ContextContainer.h>

ReactCommon/fabric/uimanager/ShadowTree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <memory>
99
#include <mutex>
1010

11-
#include <fabric/components/view/RootShadowNode.h>
11+
#include <fabric/components/root/RootShadowNode.h>
1212
#include <fabric/core/LayoutConstraints.h>
1313
#include <fabric/core/ReactPrimitives.h>
1414
#include <fabric/core/ShadowNode.h>

0 commit comments

Comments
 (0)