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
This commit is contained in:
Valentin Shergin 2018-07-15 16:46:35 -07:00 committed by Facebook Github Bot
parent 95bd4a0a9e
commit e9e20e6c83
10 changed files with 97 additions and 14 deletions

View File

@ -0,0 +1,79 @@
load("@xplat//tools/build_defs:glob_defs.bzl", "subdir_glob")
load("//configurations/buck/apple:flag_defs.bzl", "OBJC_ARC_PREPROCESSOR_FLAGS", "get_application_ios_flags", "get_debug_preprocessor_flags")
load("//ReactNative:DEFS.bzl", "ANDROID", "APPLE", "IS_OSS_BUILD", "get_apple_inspector_flags", "react_native_xplat_target", "rn_xplat_cxx_library")
APPLE_COMPILER_FLAGS = []
if not IS_OSS_BUILD:
load("@xplat//configurations/buck/apple:flag_defs.bzl", "flags", "get_static_library_ios_flags")
APPLE_COMPILER_FLAGS = flags.get_flag_value(get_static_library_ios_flags(), "compiler_flags")
rn_xplat_cxx_library(
name = "root",
srcs = glob(
["**/*.cpp"],
exclude = glob(["tests/**/*.cpp"]),
),
headers = [],
header_namespace = "",
exported_headers = subdir_glob(
[
("", "*.h"),
],
prefix = "fabric/components/root",
),
compiler_flags = [
"-fexceptions",
"-frtti",
"-std=c++14",
"-Wall",
],
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(),
fbobjc_tests = [
":tests",
],
macosx_tests_override = [],
platforms = (ANDROID, APPLE),
preprocessor_flags = [
"-DLOG_TAG=\"ReactNative\"",
"-DWITH_FBSYSTRACE=1",
],
tests = [],
visibility = ["PUBLIC"],
deps = [
"xplat//fbsystrace:fbsystrace",
"xplat//folly:headers_only",
"xplat//folly:memory",
"xplat//folly:molly",
"xplat//third-party/glog:glog",
"xplat//yoga:yoga",
react_native_xplat_target("fabric/debug:debug"),
react_native_xplat_target("fabric/core:core"),
react_native_xplat_target("fabric/graphics:graphics"),
react_native_xplat_target("fabric/components/view:view"),
],
)
if not IS_OSS_BUILD:
load("@xplat//build_defs:fb_xplat_cxx_test.bzl", "fb_xplat_cxx_test")
fb_xplat_cxx_test(
name = "tests",
srcs = glob(["tests/**/*.cpp"]),
headers = glob(["tests/**/*.h"]),
contacts = ["oncall+react_native@xmail.facebook.com"],
compiler_flags = [
"-fexceptions",
"-frtti",
"-std=c++14",
"-Wall",
],
platforms = APPLE,
deps = [
"xplat//folly:molly",
"xplat//third-party/gmock:gtest",
":root",
],
)

View File

@ -9,7 +9,7 @@
#include <memory>
#include <fabric/components/view/RootProps.h>
#include <fabric/components/root/RootProps.h>
#include <fabric/components/view/ConcreteViewShadowNode.h>
#include <fabric/core/LayoutContext.h>

View File

@ -0,0 +1,14 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <memory>
#include <gtest/gtest.h>
TEST(RootShadowNodeTest, testSomething) {
// TODO
}

View File

@ -56,11 +56,10 @@ rn_xplat_cxx_library(
"xplat//folly:memory",
"xplat//folly:molly",
"xplat//third-party/glog:glog",
react_native_xplat_target("fabric/components/scrollview:scrollview"),
react_native_xplat_target("fabric/components/text:text"),
react_native_xplat_target("fabric/components/root:root"),
react_native_xplat_target("fabric/components/view:view"),
react_native_xplat_target("fabric/core:core"),
react_native_xplat_target("fabric/debug:debug"),
react_native_xplat_target("fabric/components/view:view"),
],
)

View File

@ -5,13 +5,6 @@
#include "Scheduler.h"
#include <fabric/components/scrollview/ScrollViewComponentDescriptor.h>
#include <fabric/components/text/ParagraphComponentDescriptor.h>
#include <fabric/components/text/RawTextComponentDescriptor.h>
#include <fabric/components/text/TextComponentDescriptor.h>
#include <fabric/components/view/ViewComponentDescriptor.h>
#include <fabric/components/view/ViewProps.h>
#include <fabric/components/view/ViewShadowNode.h>
#include <fabric/core/LayoutContext.h>
#include <fabric/uimanager/ComponentDescriptorRegistry.h>
#include <fabric/uimanager/FabricUIManager.h>

View File

@ -7,8 +7,6 @@
#include <memory>
#include <fabric/components/view/ViewShadowNode.h>
#include <fabric/components/view/RootShadowNode.h>
#include <fabric/core/ComponentDescriptor.h>
#include <fabric/core/LayoutConstraints.h>
#include <fabric/uimanager/ContextContainer.h>

View File

@ -8,7 +8,7 @@
#include <memory>
#include <mutex>
#include <fabric/components/view/RootShadowNode.h>
#include <fabric/components/root/RootShadowNode.h>
#include <fabric/core/LayoutConstraints.h>
#include <fabric/core/ReactPrimitives.h>
#include <fabric/core/ShadowNode.h>