From e9e20e6c8335f27af8469cd23cb7ba079b0422f9 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Sun, 15 Jul 2018 16:46:35 -0700 Subject: [PATCH] Fabric: component was decoupled from Summary: @public There is no reason to have it inside View; it deserves that. Reviewed By: mdvacca Differential Revision: D8757012 fbshipit-source-id: 881b54008b51614cd203ab97811494fa7c30e4ef --- ReactCommon/fabric/components/root/BUCK | 79 +++++++++++++++++++ .../components/{view => }/root/RootProps.cpp | 0 .../components/{view => }/root/RootProps.h | 0 .../{view => }/root/RootShadowNode.cpp | 0 .../{view => }/root/RootShadowNode.h | 2 +- .../root/tests/RootShadowNodeTest.cpp | 14 ++++ ReactCommon/fabric/uimanager/BUCK | 5 +- ReactCommon/fabric/uimanager/Scheduler.cpp | 7 -- ReactCommon/fabric/uimanager/Scheduler.h | 2 - ReactCommon/fabric/uimanager/ShadowTree.h | 2 +- 10 files changed, 97 insertions(+), 14 deletions(-) create mode 100644 ReactCommon/fabric/components/root/BUCK rename ReactCommon/fabric/components/{view => }/root/RootProps.cpp (100%) rename ReactCommon/fabric/components/{view => }/root/RootProps.h (100%) rename ReactCommon/fabric/components/{view => }/root/RootShadowNode.cpp (100%) rename ReactCommon/fabric/components/{view => }/root/RootShadowNode.h (95%) create mode 100644 ReactCommon/fabric/components/root/tests/RootShadowNodeTest.cpp diff --git a/ReactCommon/fabric/components/root/BUCK b/ReactCommon/fabric/components/root/BUCK new file mode 100644 index 000000000..d25d012e7 --- /dev/null +++ b/ReactCommon/fabric/components/root/BUCK @@ -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", + ], + ) diff --git a/ReactCommon/fabric/components/view/root/RootProps.cpp b/ReactCommon/fabric/components/root/RootProps.cpp similarity index 100% rename from ReactCommon/fabric/components/view/root/RootProps.cpp rename to ReactCommon/fabric/components/root/RootProps.cpp diff --git a/ReactCommon/fabric/components/view/root/RootProps.h b/ReactCommon/fabric/components/root/RootProps.h similarity index 100% rename from ReactCommon/fabric/components/view/root/RootProps.h rename to ReactCommon/fabric/components/root/RootProps.h diff --git a/ReactCommon/fabric/components/view/root/RootShadowNode.cpp b/ReactCommon/fabric/components/root/RootShadowNode.cpp similarity index 100% rename from ReactCommon/fabric/components/view/root/RootShadowNode.cpp rename to ReactCommon/fabric/components/root/RootShadowNode.cpp diff --git a/ReactCommon/fabric/components/view/root/RootShadowNode.h b/ReactCommon/fabric/components/root/RootShadowNode.h similarity index 95% rename from ReactCommon/fabric/components/view/root/RootShadowNode.h rename to ReactCommon/fabric/components/root/RootShadowNode.h index 535b8bdb8..b6d96db38 100644 --- a/ReactCommon/fabric/components/view/root/RootShadowNode.h +++ b/ReactCommon/fabric/components/root/RootShadowNode.h @@ -9,7 +9,7 @@ #include -#include +#include #include #include diff --git a/ReactCommon/fabric/components/root/tests/RootShadowNodeTest.cpp b/ReactCommon/fabric/components/root/tests/RootShadowNodeTest.cpp new file mode 100644 index 000000000..776da172d --- /dev/null +++ b/ReactCommon/fabric/components/root/tests/RootShadowNodeTest.cpp @@ -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 + +#include + +TEST(RootShadowNodeTest, testSomething) { + // TODO +} diff --git a/ReactCommon/fabric/uimanager/BUCK b/ReactCommon/fabric/uimanager/BUCK index 727fbbd0c..6776c72b7 100644 --- a/ReactCommon/fabric/uimanager/BUCK +++ b/ReactCommon/fabric/uimanager/BUCK @@ -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"), ], ) diff --git a/ReactCommon/fabric/uimanager/Scheduler.cpp b/ReactCommon/fabric/uimanager/Scheduler.cpp index ad1b42d75..08b1980bb 100644 --- a/ReactCommon/fabric/uimanager/Scheduler.cpp +++ b/ReactCommon/fabric/uimanager/Scheduler.cpp @@ -5,13 +5,6 @@ #include "Scheduler.h" -#include -#include -#include -#include -#include -#include -#include #include #include #include diff --git a/ReactCommon/fabric/uimanager/Scheduler.h b/ReactCommon/fabric/uimanager/Scheduler.h index ed13ba2de..f603b5778 100644 --- a/ReactCommon/fabric/uimanager/Scheduler.h +++ b/ReactCommon/fabric/uimanager/Scheduler.h @@ -7,8 +7,6 @@ #include -#include -#include #include #include #include diff --git a/ReactCommon/fabric/uimanager/ShadowTree.h b/ReactCommon/fabric/uimanager/ShadowTree.h index f9bb361d6..4366fc8d4 100644 --- a/ReactCommon/fabric/uimanager/ShadowTree.h +++ b/ReactCommon/fabric/uimanager/ShadowTree.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include