Refactor BUCK file for WebPerformance (use TurboModule plugins) (#36197)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36197 [Changelog][Internal] This turns NativePerformance* module dependencies into "TurboModule plugins", which allows for more streamlined client integration (as it makes them register automatically once the dependency is there). Reviewed By: rubennorte Differential Revision: D43353204 fbshipit-source-id: 01d0089750a4873088dc4aefe34fd48693ee9791
This commit is contained in:
Родитель
bcf493f346
Коммит
1629b9f0a1
23
BUCK
23
BUCK
|
@ -12,7 +12,6 @@ load(
|
|||
"//tools/build_defs/oss:rn_defs.bzl",
|
||||
"ANDROID",
|
||||
"APPLE",
|
||||
"CXX",
|
||||
"HERMES_BYTECODE_VERSION",
|
||||
"IOS",
|
||||
"RCT_IMAGE_DATA_DECODER_SOCKET",
|
||||
|
@ -20,6 +19,7 @@ load(
|
|||
"RCT_URL_REQUEST_HANDLER_SOCKET",
|
||||
"YOGA_CXX_TARGET",
|
||||
"get_react_native_ios_target_sdk_version",
|
||||
"react_cxx_module_plugin_provider",
|
||||
"react_fabric_component_plugin_provider",
|
||||
"react_module_plugin_providers",
|
||||
"react_native_root_target",
|
||||
|
@ -28,6 +28,7 @@ load(
|
|||
"rn_apple_library",
|
||||
"rn_apple_xplat_cxx_library",
|
||||
"rn_extra_build_flags",
|
||||
"rn_xplat_cxx_library",
|
||||
"subdir_glob",
|
||||
)
|
||||
load("//tools/build_defs/third_party:yarn_defs.bzl", "yarn_workspace")
|
||||
|
@ -1455,7 +1456,7 @@ rn_apple_xplat_cxx_library(
|
|||
],
|
||||
)
|
||||
|
||||
rn_apple_xplat_cxx_library(
|
||||
rn_xplat_cxx_library(
|
||||
name = "RCTWebPerformance",
|
||||
srcs = glob([
|
||||
"Libraries/WebPerformance/**/*.cpp",
|
||||
|
@ -1465,15 +1466,23 @@ rn_apple_xplat_cxx_library(
|
|||
[("Libraries/WebPerformance", "*.h")],
|
||||
prefix = "RCTWebPerformance",
|
||||
),
|
||||
fbandroid_compiler_flags = [
|
||||
"-fexceptions",
|
||||
"-frtti",
|
||||
],
|
||||
compiler_flags_enable_exceptions = True,
|
||||
compiler_flags_enable_rtti = True,
|
||||
labels = [
|
||||
"depslint_never_remove",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
],
|
||||
platforms = (ANDROID, APPLE, CXX),
|
||||
platforms = (ANDROID, APPLE),
|
||||
plugins = [
|
||||
react_cxx_module_plugin_provider(
|
||||
name = "NativePerformanceCxx",
|
||||
function = "NativePerformanceModuleProvider",
|
||||
),
|
||||
react_cxx_module_plugin_provider(
|
||||
name = "NativePerformanceObserverCxx",
|
||||
function = "NativePerformanceObserverModuleProvider",
|
||||
),
|
||||
],
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
":FBReactNativeSpecJSI",
|
||||
|
|
|
@ -5,11 +5,20 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "NativePerformance.h"
|
||||
#include <glog/logging.h>
|
||||
#include <memory>
|
||||
|
||||
#include <jsi/instrumentation.h>
|
||||
#include "NativePerformance.h"
|
||||
#include "PerformanceEntryReporter.h"
|
||||
|
||||
#include "Plugins.h"
|
||||
|
||||
std::shared_ptr<facebook::react::TurboModule> NativePerformanceModuleProvider(
|
||||
std::shared_ptr<facebook::react::CallInvoker> jsInvoker) {
|
||||
return std::make_shared<facebook::react::NativePerformance>(
|
||||
std::move(jsInvoker));
|
||||
}
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
NativePerformance::NativePerformance(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
|
|
|
@ -5,9 +5,20 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "NativePerformanceObserver.h"
|
||||
#include "PerformanceEntryReporter.h"
|
||||
|
||||
#include "Plugins.h"
|
||||
|
||||
std::shared_ptr<facebook::react::TurboModule>
|
||||
NativePerformanceObserverModuleProvider(
|
||||
std::shared_ptr<facebook::react::CallInvoker> jsInvoker) {
|
||||
return std::make_shared<facebook::react::NativePerformanceObserver>(
|
||||
std::move(jsInvoker));
|
||||
}
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
NativePerformanceObserver::NativePerformanceObserver(
|
||||
|
|
|
@ -424,6 +424,10 @@ def react_module_plugin_providers(*args, **kwargs):
|
|||
def react_fabric_component_plugin_provider(name, native_class_func):
|
||||
return None
|
||||
|
||||
# C++ TurboModule plugins support (stubbed)
|
||||
def react_cxx_module_plugin_provider(name, function):
|
||||
return None
|
||||
|
||||
HERMES_BYTECODE_VERSION = -1
|
||||
|
||||
RCT_IMAGE_DATA_DECODER_SOCKET = None
|
||||
|
|
Загрузка…
Ссылка в новой задаче