From 599f1edd9a86f0ba8fe88c0882f7dbee05e58896 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Sat, 18 Apr 2020 14:51:46 -0700 Subject: [PATCH] Fabric: `scheduler` module was decoupled from `uimanager` Summary: We need to break up the `uimanager` module in order to solve circular dependencies problem (which future diff would have otherwise). Changelog: [Internal] Fabric-specific internal change. Reviewed By: JoshuaGross Differential Revision: D20885645 fbshipit-source-id: 8148bd934879802b076261ed86fa78acf0a07ed3 --- React/Fabric/RCTScheduler.h | 2 +- React/Fabric/RCTScheduler.mm | 4 +- React/Fabric/RCTSurfacePresenter.mm | 2 +- .../java/com/facebook/react/fabric/jni/BUCK | 1 + .../com/facebook/react/fabric/jni/Binding.cpp | 6 +- .../com/facebook/react/fabric/jni/Binding.h | 4 +- .../fabric/jni/ComponentFactoryDelegate.h | 2 +- ReactCommon/fabric/scheduler/BUCK | 67 +++++++++++++++++++ .../{uimanager => scheduler}/Scheduler.cpp | 0 .../{uimanager => scheduler}/Scheduler.h | 4 +- .../SchedulerDelegate.h | 0 .../SchedulerToolbox.cpp | 0 .../SchedulerToolbox.h | 0 13 files changed, 80 insertions(+), 12 deletions(-) create mode 100644 ReactCommon/fabric/scheduler/BUCK rename ReactCommon/fabric/{uimanager => scheduler}/Scheduler.cpp (100%) rename ReactCommon/fabric/{uimanager => scheduler}/Scheduler.h (97%) rename ReactCommon/fabric/{uimanager => scheduler}/SchedulerDelegate.h (100%) rename ReactCommon/fabric/{uimanager => scheduler}/SchedulerToolbox.cpp (100%) rename ReactCommon/fabric/{uimanager => scheduler}/SchedulerToolbox.h (100%) diff --git a/React/Fabric/RCTScheduler.h b/React/Fabric/RCTScheduler.h index 8268c6f4a7..d38465591f 100644 --- a/React/Fabric/RCTScheduler.h +++ b/React/Fabric/RCTScheduler.h @@ -14,7 +14,7 @@ #import #import #import -#import +#import #import NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/RCTScheduler.mm b/React/Fabric/RCTScheduler.mm index c4979f27dc..25821a72e6 100644 --- a/React/Fabric/RCTScheduler.mm +++ b/React/Fabric/RCTScheduler.mm @@ -9,8 +9,8 @@ #import #import -#import -#import +#import +#import #import diff --git a/React/Fabric/RCTSurfacePresenter.mm b/React/Fabric/RCTSurfacePresenter.mm index 255d7eb5a8..ae1005d367 100644 --- a/React/Fabric/RCTSurfacePresenter.mm +++ b/React/Fabric/RCTSurfacePresenter.mm @@ -28,7 +28,7 @@ #import #import #import -#import +#import #import #import diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK index 197318dfed..fc4d7c9c76 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK @@ -29,6 +29,7 @@ rn_xplat_cxx_library( react_native_xplat_target("better:better"), react_native_xplat_target("config:config"), react_native_xplat_target("fabric/uimanager:uimanager"), + react_native_xplat_target("fabric/scheduler:scheduler"), react_native_xplat_target("fabric/componentregistry:componentregistry"), react_native_xplat_target("fabric/components/scrollview:scrollview"), react_native_xplat_target("utils:utils"), diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp index 0ed720b2af..e188e9d336 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp @@ -21,9 +21,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h index 1145d7ea8f..2d7128d238 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h @@ -10,8 +10,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include "ComponentFactoryDelegate.h" diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactoryDelegate.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactoryDelegate.h index 61ca26c85c..aae5a8e522 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactoryDelegate.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactoryDelegate.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/ReactCommon/fabric/scheduler/BUCK b/ReactCommon/fabric/scheduler/BUCK new file mode 100644 index 0000000000..bea55d62d2 --- /dev/null +++ b/ReactCommon/fabric/scheduler/BUCK @@ -0,0 +1,67 @@ +load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_preprocessor_flags_for_build_mode") +load( + "//tools/build_defs/oss:rn_defs.bzl", + "ANDROID", + "APPLE", + "CXX", + "get_apple_compiler_flags", + "get_apple_inspector_flags", + "react_native_xplat_target", + "rn_xplat_cxx_library", + "subdir_glob", +) + +APPLE_COMPILER_FLAGS = get_apple_compiler_flags() + +rn_xplat_cxx_library( + name = "scheduler", + srcs = glob( + ["**/*.cpp"], + exclude = glob(["tests/**/*.cpp"]), + ), + headers = glob( + ["**/*.h"], + exclude = glob(["tests/**/*.h"]), + ), + header_namespace = "", + exported_headers = subdir_glob( + [ + ("", "*.h"), + ], + prefix = "react/scheduler", + ), + compiler_flags = [ + "-fexceptions", + "-frtti", + "-std=c++14", + "-Wall", + ], + fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, + fbobjc_labels = ["supermodule:ios/default/public.react_native.infra"], + fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), + force_static = True, + macosx_tests_override = [], + platforms = (ANDROID, APPLE, CXX), + preprocessor_flags = [ + "-DLOG_TAG=\"ReactNative\"", + "-DWITH_FBSYSTRACE=1", + ], + visibility = ["PUBLIC"], + deps = [ + "//xplat/fbsystrace:fbsystrace", + "//xplat/folly:headers_only", + "//xplat/folly:memory", + "//xplat/folly:molly", + "//xplat/jsi:JSIDynamic", + "//xplat/jsi:jsi", + "//xplat/third-party/glog:glog", + react_native_xplat_target("fabric/core:core"), + react_native_xplat_target("fabric/mounting:mounting"), + react_native_xplat_target("fabric/uimanager:uimanager"), + react_native_xplat_target("config:config"), + react_native_xplat_target("fabric/componentregistry:componentregistry"), + react_native_xplat_target("fabric/debug:debug"), + react_native_xplat_target("fabric/components/root:root"), + react_native_xplat_target("utils:utils"), + ], +) diff --git a/ReactCommon/fabric/uimanager/Scheduler.cpp b/ReactCommon/fabric/scheduler/Scheduler.cpp similarity index 100% rename from ReactCommon/fabric/uimanager/Scheduler.cpp rename to ReactCommon/fabric/scheduler/Scheduler.cpp diff --git a/ReactCommon/fabric/uimanager/Scheduler.h b/ReactCommon/fabric/scheduler/Scheduler.h similarity index 97% rename from ReactCommon/fabric/uimanager/Scheduler.h rename to ReactCommon/fabric/scheduler/Scheduler.h index 0cf62b7622..59e91c5dfa 100644 --- a/ReactCommon/fabric/uimanager/Scheduler.h +++ b/ReactCommon/fabric/scheduler/Scheduler.h @@ -16,8 +16,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/ReactCommon/fabric/uimanager/SchedulerDelegate.h b/ReactCommon/fabric/scheduler/SchedulerDelegate.h similarity index 100% rename from ReactCommon/fabric/uimanager/SchedulerDelegate.h rename to ReactCommon/fabric/scheduler/SchedulerDelegate.h diff --git a/ReactCommon/fabric/uimanager/SchedulerToolbox.cpp b/ReactCommon/fabric/scheduler/SchedulerToolbox.cpp similarity index 100% rename from ReactCommon/fabric/uimanager/SchedulerToolbox.cpp rename to ReactCommon/fabric/scheduler/SchedulerToolbox.cpp diff --git a/ReactCommon/fabric/uimanager/SchedulerToolbox.h b/ReactCommon/fabric/scheduler/SchedulerToolbox.h similarity index 100% rename from ReactCommon/fabric/uimanager/SchedulerToolbox.h rename to ReactCommon/fabric/scheduler/SchedulerToolbox.h