mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Back out "Enable RuntimeScheduler in old architecture" (#37623)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37623 Original commit changeset: 5f18cbe60e6c Original Phabricator Diff: D46078324 changelog: [internal] Resolves S344737 Reviewed By: FieryRobot Differential Revision: D46281951 fbshipit-source-id: dae1f7afe549686e3d5bbacf786c088bbfa49cca
This commit is contained in:
committed by
Facebook GitHub Bot
parent
02a73ca856
commit
88eef42cab
@@ -6,41 +6,38 @@
|
||||
*/
|
||||
|
||||
#import "RCTAppDelegate.h"
|
||||
#import <React/RCTCxxBridgeDelegate.h>
|
||||
#import <React/RCTRootView.h>
|
||||
#import <React/RCTRuntimeExecutorFromBridge.h>
|
||||
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
|
||||
|
||||
#import "RCTAppSetupUtils.h"
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
#import <React/CoreModulesPlugins.h>
|
||||
#import <React/RCTComponentViewFactory.h>
|
||||
#import <React/RCTComponentViewProtocol.h>
|
||||
#import <React/RCTCxxBridgeDelegate.h>
|
||||
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
|
||||
#import <React/RCTLegacyViewManagerInteropComponentView.h>
|
||||
#import <React/RCTSurfacePresenter.h>
|
||||
#import <React/RCTSurfacePresenterBridgeAdapter.h>
|
||||
#import <ReactCommon/RCTTurboModuleManager.h>
|
||||
#import <react/config/ReactNativeConfig.h>
|
||||
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
|
||||
#import <react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h>
|
||||
#import "RCTLegacyInteropComponents.h"
|
||||
|
||||
static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
||||
|
||||
@interface RCTAppDelegate () <RCTTurboModuleManagerDelegate, RCTComponentViewFactoryComponentProvider> {
|
||||
@interface RCTAppDelegate () <
|
||||
RCTTurboModuleManagerDelegate,
|
||||
RCTCxxBridgeDelegate,
|
||||
RCTComponentViewFactoryComponentProvider> {
|
||||
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
|
||||
facebook::react::ContextContainer::Shared _contextContainer;
|
||||
std::shared_ptr<facebook::react::RuntimeScheduler> _runtimeScheduler;
|
||||
}
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
@interface RCTAppDelegate () <RCTCxxBridgeDelegate> {
|
||||
std::shared_ptr<facebook::react::RuntimeScheduler> _runtimeScheduler;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation RCTAppDelegate
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
@@ -158,8 +155,6 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
||||
#endif
|
||||
}
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
|
||||
#pragma mark - RCTTurboModuleManagerDelegate
|
||||
|
||||
- (Class)getModuleClassFromName:(const char *)name
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#import <memory>
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
|
||||
#ifndef RCT_USE_HERMES
|
||||
#if __has_include(<reacthermes/HermesExecutorFactory.h>)
|
||||
@@ -27,27 +27,21 @@
|
||||
#import <React/JSCExecutorFactory.h>
|
||||
#endif
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
#import <ReactCommon/RCTTurboModuleManager.h>
|
||||
#endif
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
// Forward declaration to decrease compilation coupling
|
||||
namespace facebook::react {
|
||||
class RuntimeScheduler;
|
||||
}
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
RCT_EXTERN id<RCTTurboModule> RCTAppSetupDefaultModuleFromClass(Class moduleClass);
|
||||
|
||||
std::unique_ptr<facebook::react::JSExecutorFactory> RCTAppSetupDefaultJsExecutorFactory(
|
||||
RCTBridge *bridge,
|
||||
RCTTurboModuleManager *turboModuleManager,
|
||||
std::shared_ptr<facebook::react::RuntimeScheduler> const &runtimeScheduler);
|
||||
|
||||
#else
|
||||
std::unique_ptr<facebook::react::JSExecutorFactory> RCTAppSetupJsExecutorFactoryForOldArch(
|
||||
RCTBridge *bridge,
|
||||
std::shared_ptr<facebook::react::RuntimeScheduler> const &runtimeScheduler);
|
||||
#endif
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
|
||||
#import "RCTAppSetupUtils.h"
|
||||
|
||||
#import <React/RCTJSIExecutorRuntimeInstaller.h>
|
||||
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
|
||||
#import <react/renderer/runtimescheduler/RuntimeSchedulerBinding.h>
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
// Turbo Module
|
||||
#import <React/CoreModulesPlugins.h>
|
||||
@@ -19,6 +15,7 @@
|
||||
#import <React/RCTGIFImageDecoder.h>
|
||||
#import <React/RCTHTTPRequestHandler.h>
|
||||
#import <React/RCTImageLoader.h>
|
||||
#import <React/RCTJSIExecutorRuntimeInstaller.h>
|
||||
#import <React/RCTLocalAssetImageLoader.h>
|
||||
#import <React/RCTNetworking.h>
|
||||
|
||||
@@ -138,25 +135,4 @@ std::unique_ptr<facebook::react::JSExecutorFactory> RCTAppSetupDefaultJsExecutor
|
||||
}));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
std::unique_ptr<facebook::react::JSExecutorFactory> RCTAppSetupJsExecutorFactoryForOldArch(
|
||||
RCTBridge *bridge,
|
||||
std::shared_ptr<facebook::react::RuntimeScheduler> const &runtimeScheduler)
|
||||
{
|
||||
#if RCT_USE_HERMES
|
||||
return std::make_unique<facebook::react::HermesExecutorFactory>(
|
||||
#else
|
||||
return std::make_unique<facebook::react::JSCExecutorFactory>(
|
||||
#endif
|
||||
facebook::react::RCTJSIExecutorRuntimeInstaller([bridge, runtimeScheduler](facebook::jsi::Runtime &runtime) {
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
if (runtimeScheduler) {
|
||||
facebook::react::RuntimeSchedulerBinding::createAndInstallIfNeeded(runtime, runtimeScheduler);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -48,9 +48,6 @@ header_search_paths = [
|
||||
"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core",
|
||||
"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers",
|
||||
"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers/",
|
||||
"$(PODS_CONFIGURATION_BUILD_DIR)/React-utils/React_utils.framework/Headers/",
|
||||
"$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers/",
|
||||
"$(PODS_CONFIGURATION_BUILD_DIR)/React-runtimescheduler/React_runtimescheduler.framework/Headers/",
|
||||
] : []).map{|p| "\"#{p}\""}.join(" ")
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
@@ -83,7 +80,6 @@ Pod::Spec.new do |s|
|
||||
s.dependency "React-RCTImage"
|
||||
s.dependency "React-NativeModulesApple"
|
||||
s.dependency "React-CoreModules"
|
||||
s.dependency "React-runtimescheduler"
|
||||
|
||||
if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
|
||||
s.dependency "React-hermes"
|
||||
@@ -95,8 +91,6 @@ Pod::Spec.new do |s|
|
||||
s.dependency "React-Fabric"
|
||||
s.dependency "React-RCTFabric"
|
||||
s.dependency "React-graphics"
|
||||
s.dependency "React-utils"
|
||||
s.dependency "React-debug"
|
||||
|
||||
s.script_phases = {
|
||||
:name => "Generate Legacy Components Interop",
|
||||
|
||||
@@ -126,13 +126,11 @@ Pod::Spec.new do |s|
|
||||
end
|
||||
|
||||
s.dependency "RCT-Folly", folly_version
|
||||
s.dependency "React-cxxreact"
|
||||
s.dependency "React-perflogger"
|
||||
s.dependency "React-jsi"
|
||||
s.dependency "React-jsiexecutor"
|
||||
s.dependency "React-utils"
|
||||
s.dependency "React-cxxreact", version
|
||||
s.dependency "React-perflogger", version
|
||||
s.dependency "React-jsi", version
|
||||
s.dependency "React-jsiexecutor", version
|
||||
s.dependency "SocketRocket", socket_rocket_version
|
||||
s.dependency "React-runtimeexecutor"
|
||||
s.dependency "Yoga"
|
||||
s.dependency "glog"
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#ifdef __cplusplus
|
||||
#import <ReactCommon/RuntimeExecutor.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class RCTBridge;
|
||||
|
||||
facebook::react::RuntimeExecutor RCTRuntimeExecutorFromBridge(RCTBridge *bridge);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
#endif
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import "RCTRuntimeExecutorFromBridge.h"
|
||||
#import <React/RCTAssert.h>
|
||||
#import <React/RCTBridge+Private.h>
|
||||
#import <cxxreact/MessageQueueThread.h>
|
||||
#import <react/utils/ManagedObjectWrapper.h>
|
||||
|
||||
using namespace facebook::react;
|
||||
|
||||
@interface RCTBridge ()
|
||||
- (std::shared_ptr<MessageQueueThread>)jsMessageThread;
|
||||
- (void)invokeAsync:(std::function<void()> &&)func;
|
||||
@end
|
||||
|
||||
RuntimeExecutor RCTRuntimeExecutorFromBridge(RCTBridge *bridge)
|
||||
{
|
||||
RCTAssert(bridge, @"RCTRuntimeExecutorFromBridge: Bridge must not be nil.");
|
||||
|
||||
auto bridgeWeakWrapper = wrapManagedObjectWeakly([bridge batchedBridge] ?: bridge);
|
||||
|
||||
RuntimeExecutor runtimeExecutor = [bridgeWeakWrapper](
|
||||
std::function<void(facebook::jsi::Runtime & runtime)> &&callback) {
|
||||
RCTBridge *bridge = unwrapManagedObjectWeakly(bridgeWeakWrapper);
|
||||
|
||||
RCTAssert(bridge, @"RCTRuntimeExecutorFromBridge: Bridge must not be nil at the moment of scheduling a call.");
|
||||
|
||||
[bridge invokeAsync:[bridgeWeakWrapper, callback = std::move(callback)]() {
|
||||
RCTCxxBridge *batchedBridge = (RCTCxxBridge *)unwrapManagedObjectWeakly(bridgeWeakWrapper);
|
||||
|
||||
RCTAssert(batchedBridge, @"RCTRuntimeExecutorFromBridge: Bridge must not be nil at the moment of invocation.");
|
||||
|
||||
if (!batchedBridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto runtime = (facebook::jsi::Runtime *)(batchedBridge.runtime);
|
||||
|
||||
RCTAssert(
|
||||
runtime, @"RCTRuntimeExecutorFromBridge: Bridge must have a valid jsi::Runtime at the moment of invocation.");
|
||||
|
||||
if (!runtime) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback(*runtime);
|
||||
}];
|
||||
};
|
||||
|
||||
return runtimeExecutor;
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <ReactCommon/RuntimeExecutor.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <react/utils/ContextContainer.h>
|
||||
|
||||
@@ -14,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@class RCTSurfacePresenter;
|
||||
@class RCTBridge;
|
||||
|
||||
facebook::react::RuntimeExecutor RCTRuntimeExecutorFromBridge(RCTBridge *bridge);
|
||||
|
||||
/*
|
||||
* Controls a life-cycle of a Surface Presenter based on Bridge's life-cycle.
|
||||
* We are moving away from using Bridge.
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#import <React/RCTConstants.h>
|
||||
#import <React/RCTImageLoader.h>
|
||||
#import <React/RCTImageLoaderWithAttributionProtocol.h>
|
||||
#import <React/RCTRuntimeExecutorFromBridge.h>
|
||||
#import <React/RCTSurfacePresenter.h>
|
||||
#import <React/RCTSurfacePresenterStub.h>
|
||||
|
||||
@@ -43,6 +42,43 @@ static ContextContainer::Shared RCTContextContainerFromBridge(RCTBridge *bridge)
|
||||
return contextContainer;
|
||||
}
|
||||
|
||||
RuntimeExecutor RCTRuntimeExecutorFromBridge(RCTBridge *bridge)
|
||||
{
|
||||
RCTAssert(bridge, @"RCTRuntimeExecutorFromBridge: Bridge must not be nil.");
|
||||
|
||||
auto bridgeWeakWrapper = wrapManagedObjectWeakly([bridge batchedBridge] ?: bridge);
|
||||
|
||||
RuntimeExecutor runtimeExecutor = [bridgeWeakWrapper](
|
||||
std::function<void(facebook::jsi::Runtime & runtime)> &&callback) {
|
||||
RCTBridge *bridge = unwrapManagedObjectWeakly(bridgeWeakWrapper);
|
||||
|
||||
RCTAssert(bridge, @"RCTRuntimeExecutorFromBridge: Bridge must not be nil at the moment of scheduling a call.");
|
||||
|
||||
[bridge invokeAsync:[bridgeWeakWrapper, callback = std::move(callback)]() {
|
||||
RCTCxxBridge *batchedBridge = (RCTCxxBridge *)unwrapManagedObjectWeakly(bridgeWeakWrapper);
|
||||
|
||||
RCTAssert(batchedBridge, @"RCTRuntimeExecutorFromBridge: Bridge must not be nil at the moment of invocation.");
|
||||
|
||||
if (!batchedBridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto runtime = (facebook::jsi::Runtime *)(batchedBridge.runtime);
|
||||
|
||||
RCTAssert(
|
||||
runtime, @"RCTRuntimeExecutorFromBridge: Bridge must have a valid jsi::Runtime at the moment of invocation.");
|
||||
|
||||
if (!runtime) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback(*runtime);
|
||||
}];
|
||||
};
|
||||
|
||||
return runtimeExecutor;
|
||||
}
|
||||
|
||||
@implementation RCTSurfacePresenterBridgeAdapter {
|
||||
RCTSurfacePresenter *_Nullable _surfacePresenter;
|
||||
__weak RCTBridge *_bridge;
|
||||
|
||||
@@ -30,6 +30,7 @@ header_search_paths = [
|
||||
"\"$(PODS_ROOT)/Headers/Private/Yoga\"",
|
||||
"\"$(PODS_ROOT)/Headers/Public/React-Codegen\"",
|
||||
"\"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"",
|
||||
|
||||
]
|
||||
|
||||
if ENV['USE_FRAMEWORKS']
|
||||
@@ -42,9 +43,6 @@ if ENV['USE_FRAMEWORKS']
|
||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\""
|
||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-ImageManager/React_ImageManager.framework/Headers\""
|
||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\""
|
||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\""
|
||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\""
|
||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-runtimescheduler/React_runtimescheduler.framework/Headers\""
|
||||
end
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
@@ -81,8 +79,6 @@ Pod::Spec.new do |s|
|
||||
s.dependency "Yoga"
|
||||
s.dependency "React-RCTText"
|
||||
s.dependency "React-FabricImage"
|
||||
s.dependency "React-utils"
|
||||
s.dependency "React-runtimescheduler"
|
||||
|
||||
if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
|
||||
s.dependency "hermes-engine"
|
||||
|
||||
@@ -232,6 +232,14 @@ Pod::Spec.new do |s|
|
||||
end
|
||||
end
|
||||
|
||||
s.subspec "debug_core" do |ss|
|
||||
ss.dependency folly_dep_name, folly_version
|
||||
ss.compiler_flags = folly_compiler_flags
|
||||
ss.source_files = "react/debug/**/*.{m,mm,cpp,h}"
|
||||
ss.exclude_files = "react/debug/tests"
|
||||
ss.header_dir = "react/debug"
|
||||
end
|
||||
|
||||
s.subspec "debug_renderer" do |ss|
|
||||
ss.dependency folly_dep_name, folly_version
|
||||
ss.compiler_flags = folly_compiler_flags
|
||||
@@ -315,4 +323,19 @@ Pod::Spec.new do |s|
|
||||
ss.header_dir = "react/renderer/leakchecker"
|
||||
ss.pod_target_xcconfig = { "GCC_WARN_PEDANTIC" => "YES" }
|
||||
end
|
||||
|
||||
s.subspec "runtimescheduler" do |ss|
|
||||
ss.dependency folly_dep_name, folly_version
|
||||
ss.compiler_flags = folly_compiler_flags
|
||||
ss.source_files = "react/renderer/runtimescheduler/**/*.{cpp,h}"
|
||||
ss.exclude_files = "react/renderer/runtimescheduler/tests"
|
||||
ss.header_dir = "react/renderer/runtimescheduler"
|
||||
ss.pod_target_xcconfig = { "GCC_WARN_PEDANTIC" => "YES" }
|
||||
end
|
||||
|
||||
s.subspec "utils" do |ss|
|
||||
ss.source_files = "react/utils/*.{m,mm,cpp,h}"
|
||||
ss.header_dir = "react/utils"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -70,4 +70,8 @@ Pod::Spec.new do |s|
|
||||
sss.source_files = "react/nativemodule/core/ReactCommon/**/*.{cpp,h}"
|
||||
end
|
||||
end
|
||||
|
||||
s.subspec "react_debug_core" do |sss|
|
||||
sss.source_files = "react/debug/*.{cpp,h}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ Pod::Spec.new do |s|
|
||||
s.source_files = "*.{cpp,h}"
|
||||
s.exclude_files = "SampleCxxModule.*"
|
||||
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
|
||||
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-runtimeexecutor/React_runtimeexecutor.framework/Headers\"",
|
||||
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"",
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
|
||||
s.header_dir = "cxxreact"
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
require "json"
|
||||
|
||||
package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json")))
|
||||
version = package['version']
|
||||
|
||||
source = { :git => 'https://github.com/facebook/react-native.git' }
|
||||
if version == '1000.0.0'
|
||||
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
|
||||
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
|
||||
else
|
||||
source[:tag] = "v#{version}"
|
||||
end
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "React-debug"
|
||||
s.version = version
|
||||
s.summary = "-" # TODO
|
||||
s.homepage = "https://reactnative.dev/"
|
||||
s.license = package["license"]
|
||||
s.author = "Meta Platforms, Inc. and its affiliates"
|
||||
s.platforms = { :ios => min_ios_version_supported }
|
||||
s.source = source
|
||||
s.source_files = "**/*.{cpp,h}"
|
||||
s.header_dir = "react/debug"
|
||||
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
|
||||
|
||||
if ENV['USE_FRAMEWORKS']
|
||||
s.module_name = "React_debug"
|
||||
s.header_mappings_dir = "../.."
|
||||
end
|
||||
end
|
||||
-4
@@ -48,8 +48,6 @@ Pod::Spec.new do |s|
|
||||
"\"$(PODS_ROOT)/DoubleConversion\"",
|
||||
"\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\"",
|
||||
"\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\"",
|
||||
"\"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"",
|
||||
"\"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\"",
|
||||
]
|
||||
end
|
||||
|
||||
@@ -63,7 +61,5 @@ Pod::Spec.new do |s|
|
||||
s.dependency "React-Fabric"
|
||||
s.dependency "React-Core/Default"
|
||||
s.dependency "React-RCTImage"
|
||||
s.dependency "React-debug"
|
||||
s.dependency "React-utils"
|
||||
s.dependency "glog"
|
||||
end
|
||||
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
require "json"
|
||||
|
||||
package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "..", "package.json")))
|
||||
version = package['version']
|
||||
|
||||
source = { :git => 'https://github.com/facebook/react-native.git' }
|
||||
if version == '1000.0.0'
|
||||
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
|
||||
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
|
||||
else
|
||||
source[:tag] = "v#{version}"
|
||||
end
|
||||
|
||||
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
||||
folly_version = '2021.07.22.00'
|
||||
|
||||
header_search_paths = [
|
||||
"\"$(PODS_ROOT)/RCT-Folly\"",
|
||||
]
|
||||
|
||||
if ENV['USE_FRAMEWORKS']
|
||||
header_search_paths << "\"$(PODS_TARGET_SRCROOT)/../../..\"" #this is needed to allow the RuntimeScheduler access its own files
|
||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\""
|
||||
end
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "React-runtimescheduler"
|
||||
s.version = version
|
||||
s.summary = "-" # TODO
|
||||
s.homepage = "https://reactnative.dev/"
|
||||
s.license = package["license"]
|
||||
s.author = "Meta Platforms, Inc. and its affiliates"
|
||||
s.platforms = { :ios => min_ios_version_supported }
|
||||
s.source = source
|
||||
s.source_files = "**/*.{cpp,h}"
|
||||
s.compiler_flags = folly_compiler_flags
|
||||
s.header_dir = "react/renderer/runtimescheduler"
|
||||
s.exclude_files = "tests"
|
||||
s.pod_target_xcconfig = {
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
||||
"HEADER_SEARCH_PATHS" => header_search_paths.join(' ')}
|
||||
|
||||
if ENV['USE_FRAMEWORKS']
|
||||
s.module_name = "React_runtimescheduler"
|
||||
s.header_mappings_dir = "../../.."
|
||||
end
|
||||
|
||||
s.dependency "React-jsi"
|
||||
s.dependency "React-runtimeexecutor"
|
||||
s.dependency "React-callinvoker"
|
||||
s.dependency "React-debug"
|
||||
s.dependency "glog"
|
||||
s.dependency "RCT-Folly", folly_version
|
||||
|
||||
if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
|
||||
s.dependency "hermes-engine"
|
||||
else
|
||||
s.dependency "React-jsi"
|
||||
end
|
||||
|
||||
end
|
||||
-1
@@ -7,7 +7,6 @@
|
||||
|
||||
#include "RuntimeSchedulerBinding.h"
|
||||
#include <ReactCommon/SchedulerPriority.h>
|
||||
#include "RuntimeScheduler.h"
|
||||
#include "SchedulerPriorityUtils.h"
|
||||
#include "primitives.h"
|
||||
|
||||
|
||||
+1
-2
@@ -8,11 +8,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <jsi/jsi.h>
|
||||
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
class RuntimeScheduler;
|
||||
|
||||
/*
|
||||
* Exposes RuntimeScheduler to JavaScript realm.
|
||||
*/
|
||||
|
||||
-1
@@ -8,7 +8,6 @@
|
||||
#include "RuntimeSchedulerCallInvoker.h"
|
||||
|
||||
#include <utility>
|
||||
#include "RuntimeScheduler.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
|
||||
+1
-2
@@ -8,11 +8,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <ReactCommon/CallInvoker.h>
|
||||
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
class RuntimeScheduler;
|
||||
|
||||
/*
|
||||
* Exposes RuntimeScheduler to native modules. All calls invoked on JavaScript
|
||||
* queue from native modules will be funneled through RuntimeScheduler.
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <folly/dynamic.h>
|
||||
#include <jsi/jsi.h>
|
||||
#include <react/renderer/core/CoreFeatures.h>
|
||||
#include <react/renderer/runtimescheduler/Task.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <react/renderer/componentregistry/ComponentDescriptorFactory.h>
|
||||
#include <react/renderer/core/EventBeat.h>
|
||||
#include <react/renderer/leakchecker/LeakChecker.h>
|
||||
|
||||
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
|
||||
#include <react/renderer/uimanager/UIManagerCommitHook.h>
|
||||
#include <react/renderer/uimanager/primitives.h>
|
||||
#include <react/utils/ContextContainer.h>
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
require "json"
|
||||
|
||||
package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json")))
|
||||
version = package['version']
|
||||
|
||||
source = { :git => 'https://github.com/facebook/react-native.git' }
|
||||
if version == '1000.0.0'
|
||||
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
|
||||
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
|
||||
else
|
||||
source[:tag] = "v#{version}"
|
||||
end
|
||||
|
||||
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
||||
folly_version = '2021.07.22.00'
|
||||
|
||||
header_search_paths = [
|
||||
"\"$(PODS_ROOT)/RCT-Folly\"",
|
||||
"\"$(PODS_TARGET_SRCROOT)\"",
|
||||
"\"$(PODS_TARGET_SRCROOT)/ReactCommon\"",
|
||||
]
|
||||
|
||||
if ENV["USE_FRAMEWORKS"]
|
||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\""
|
||||
end
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "React-utils"
|
||||
s.version = version
|
||||
s.summary = "-" # TODO
|
||||
s.homepage = "https://reactnative.dev/"
|
||||
s.license = package["license"]
|
||||
s.author = "Meta Platforms, Inc. and its affiliates"
|
||||
s.platforms = { :ios => min_ios_version_supported }
|
||||
s.source = source
|
||||
s.source_files = "**/*.{cpp,h,mm}"
|
||||
s.compiler_flags = folly_compiler_flags
|
||||
s.header_dir = "react/utils"
|
||||
s.exclude_files = "tests"
|
||||
s.pod_target_xcconfig = {
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
||||
"HEADER_SEARCH_PATHS" => header_search_paths.join(' ')}
|
||||
|
||||
if ENV['USE_FRAMEWORKS']
|
||||
s.module_name = "React_utils"
|
||||
s.header_mappings_dir = "../.."
|
||||
end
|
||||
|
||||
s.dependency "RCT-Folly", folly_version
|
||||
s.dependency "React-debug"
|
||||
s.dependency "glog"
|
||||
end
|
||||
@@ -577,8 +577,7 @@ class CodegenUtilsTests < Test::Unit::TestCase
|
||||
'React-graphics': [],
|
||||
'React-rncore': [],
|
||||
'React-Fabric': [],
|
||||
'React-utils': [],
|
||||
'React-debug': [],
|
||||
|
||||
})
|
||||
|
||||
specs[:'script_phases'] = script_phases
|
||||
@@ -590,13 +589,11 @@ class CodegenUtilsTests < Test::Unit::TestCase
|
||||
specs = get_podspec_no_fabric_no_script()
|
||||
|
||||
specs["pod_target_xcconfig"]["FRAMEWORK_SEARCH_PATHS"].concat([])
|
||||
specs["pod_target_xcconfig"]["HEADER_SEARCH_PATHS"].concat(" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-Fabric/React_Fabric.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-FabricImage/React_FabricImage.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-utils/React_utils.framework/Headers\"")
|
||||
specs["pod_target_xcconfig"]["HEADER_SEARCH_PATHS"].concat(" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-Fabric/React_Fabric.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-FabricImage/React_FabricImage.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers\"")
|
||||
|
||||
specs[:dependencies].merge!({
|
||||
'React-graphics': [],
|
||||
'React-Fabric': [],
|
||||
'React-utils': [],
|
||||
'React-debug': [],
|
||||
})
|
||||
|
||||
return specs
|
||||
|
||||
@@ -129,7 +129,7 @@ class NewArchitectureTests < Test::Unit::TestCase
|
||||
|
||||
# Assert
|
||||
assert_equal(spec.compiler_flags, NewArchitectureHelper.folly_compiler_flags)
|
||||
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"")
|
||||
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\"")
|
||||
assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
|
||||
assert_equal(spec.pod_target_xcconfig["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1")
|
||||
assert_equal(
|
||||
@@ -148,8 +148,6 @@ class NewArchitectureTests < Test::Unit::TestCase
|
||||
{ :dependency_name => "Yoga" },
|
||||
{ :dependency_name => "React-Fabric" },
|
||||
{ :dependency_name => "React-graphics" },
|
||||
{ :dependency_name => "React-utils" },
|
||||
{ :dependency_name => "React-debug" },
|
||||
{ :dependency_name => "hermes-engine" }
|
||||
])
|
||||
end
|
||||
@@ -168,7 +166,7 @@ class NewArchitectureTests < Test::Unit::TestCase
|
||||
|
||||
# Assert
|
||||
assert_equal(spec.compiler_flags, "-Wno-nullability-completeness #{NewArchitectureHelper.folly_compiler_flags}")
|
||||
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "#{other_flags} \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"")
|
||||
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "#{other_flags} \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\"")
|
||||
assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
|
||||
assert_equal(
|
||||
spec.dependencies,
|
||||
|
||||
@@ -100,8 +100,6 @@ class CodegenUtils
|
||||
"\"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"",
|
||||
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\"",
|
||||
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers\"",
|
||||
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers\"",
|
||||
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-utils/React_utils.framework/Headers\"",
|
||||
])
|
||||
end
|
||||
|
||||
@@ -132,7 +130,7 @@ class CodegenUtils
|
||||
"React-jsi": [],
|
||||
"ReactCommon/turbomodule/bridging": [],
|
||||
"ReactCommon/turbomodule/core": [],
|
||||
"React-NativeModulesApple": [],
|
||||
"React-NativeModulesApple": [],
|
||||
"glog": [],
|
||||
"DoubleConversion": [],
|
||||
}
|
||||
@@ -142,8 +140,6 @@ class CodegenUtils
|
||||
spec[:'dependencies'].merge!({
|
||||
'React-graphics': [],
|
||||
'React-Fabric': [],
|
||||
'React-debug': [],
|
||||
'React-utils': [],
|
||||
});
|
||||
end
|
||||
|
||||
|
||||
@@ -109,8 +109,6 @@ class NewArchitectureHelper
|
||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\""
|
||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\""
|
||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\""
|
||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\""
|
||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\""
|
||||
end
|
||||
header_search_paths_string = header_search_paths.join(" ")
|
||||
spec.compiler_flags = compiler_flags.empty? ? @@folly_compiler_flags : "#{compiler_flags} #{@@folly_compiler_flags}"
|
||||
@@ -137,8 +135,6 @@ class NewArchitectureHelper
|
||||
spec.dependency "Yoga"
|
||||
spec.dependency "React-Fabric"
|
||||
spec.dependency "React-graphics"
|
||||
spec.dependency "React-utils"
|
||||
spec.dependency "React-debug"
|
||||
|
||||
if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
|
||||
spec.dependency "hermes-engine"
|
||||
|
||||
@@ -117,8 +117,6 @@ def use_react_native! (
|
||||
pod 'React-Core/RCTWebSocket', :path => "#{prefix}/"
|
||||
pod 'React-rncore', :path => "#{prefix}/ReactCommon"
|
||||
pod 'React-cxxreact', :path => "#{prefix}/ReactCommon/cxxreact"
|
||||
pod 'React-debug', :path => "#{prefix}/ReactCommon/react/debug"
|
||||
pod 'React-utils', :path => "#{prefix}/ReactCommon/react/utils"
|
||||
|
||||
if hermes_enabled
|
||||
setup_hermes!(:react_native_path => prefix, :fabric_enabled => fabric_enabled)
|
||||
@@ -131,7 +129,6 @@ def use_react_native! (
|
||||
|
||||
pod 'React-callinvoker', :path => "#{prefix}/ReactCommon/callinvoker"
|
||||
pod 'React-runtimeexecutor', :path => "#{prefix}/ReactCommon/runtimeexecutor"
|
||||
pod 'React-runtimescheduler', :path => "#{prefix}/ReactCommon/react/renderer/runtimescheduler"
|
||||
pod 'React-perflogger', :path => "#{prefix}/ReactCommon/reactperflogger"
|
||||
pod 'React-logger', :path => "#{prefix}/ReactCommon/logger"
|
||||
pod 'ReactCommon/turbomodule/core', :path => "#{prefix}/ReactCommon", :modular_headers => true
|
||||
|
||||
+142
-433
File diff suppressed because it is too large
Load Diff
@@ -9,18 +9,69 @@
|
||||
|
||||
#import <React/RCTBundleURLProvider.h>
|
||||
#import <React/RCTLinkingManager.h>
|
||||
#import <React/RCTLocalAssetImageLoader.h>
|
||||
#import <React/RCTNetworking.h>
|
||||
#import <React/RCTRootView.h>
|
||||
#import <ReactCommon/RCTSampleTurboModule.h>
|
||||
#import <ReactCommon/SampleTurboCxxModule.h>
|
||||
|
||||
#import <cxxreact/JSExecutor.h>
|
||||
|
||||
#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC
|
||||
#import <React/RCTPushNotificationManager.h>
|
||||
#endif
|
||||
|
||||
#ifdef RN_FABRIC_ENABLED
|
||||
#import <React/RCTComponentViewFactory.h>
|
||||
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
|
||||
#import <React/RCTSurfacePresenter.h>
|
||||
#import <React/RCTSurfacePresenterBridgeAdapter.h>
|
||||
|
||||
#import <React/RCTLegacyViewManagerInteropComponentView.h>
|
||||
#import <react/config/ReactNativeConfig.h>
|
||||
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
|
||||
#import <react/renderer/runtimescheduler/RuntimeSchedulerBinding.h>
|
||||
#import <react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h>
|
||||
#endif
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
#import <NativeCxxModuleExample/NativeCxxModuleExample.h>
|
||||
#import <RNTMyNativeViewComponentView.h>
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
#ifdef FB_SONARKIT_ENABLED
|
||||
#import <FlipperKit/FlipperClient.h>
|
||||
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
|
||||
#import <FlipperKitLayoutPlugin/SKDescriptorMapper.h>
|
||||
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
|
||||
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
|
||||
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
|
||||
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#import <ReactCommon/RCTTurboModuleManager.h>
|
||||
#import "RNTesterTurboModuleProvider.h"
|
||||
|
||||
@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
|
||||
#ifdef RN_FABRIC_ENABLED
|
||||
RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
|
||||
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
|
||||
facebook::react::ContextContainer::Shared _contextContainer;
|
||||
std::shared_ptr<facebook::react::RuntimeScheduler> _runtimeScheduler;
|
||||
#endif
|
||||
}
|
||||
@end
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
/// Declare conformance to `RCTComponentViewFactoryComponentProvider`
|
||||
@interface AppDelegate () <RCTComponentViewFactoryComponentProvider>
|
||||
@end
|
||||
#endif
|
||||
|
||||
static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
@@ -64,6 +115,67 @@
|
||||
[RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] onProgress:onProgress onComplete:loadCallback];
|
||||
}
|
||||
|
||||
#pragma mark - RCTCxxBridgeDelegate
|
||||
|
||||
// This function is called during
|
||||
// `[[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];`
|
||||
- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
|
||||
{
|
||||
std::shared_ptr<facebook::react::CallInvoker> callInvoker = bridge.jsCallInvoker;
|
||||
|
||||
#ifdef RN_FABRIC_ENABLED
|
||||
_runtimeScheduler = std::make_shared<facebook::react::RuntimeScheduler>(RCTRuntimeExecutorFromBridge(bridge));
|
||||
_contextContainer->erase("RuntimeScheduler");
|
||||
_contextContainer->insert("RuntimeScheduler", _runtimeScheduler);
|
||||
callInvoker = std::make_shared<facebook::react::RuntimeSchedulerCallInvoker>(_runtimeScheduler);
|
||||
#endif
|
||||
|
||||
RCTTurboModuleManager *turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
|
||||
delegate:self
|
||||
jsInvoker:callInvoker];
|
||||
[bridge setRCTTurboModuleRegistry:turboModuleManager];
|
||||
|
||||
#if RCT_DEV
|
||||
/**
|
||||
* Eagerly initialize RCTDevMenu so CMD + d, CMD + i, and CMD + r work.
|
||||
* This is a stop gap until we have a system to eagerly init Turbo Modules.
|
||||
*/
|
||||
[turboModuleManager moduleForName:"RCTDevMenu"];
|
||||
#endif
|
||||
|
||||
__weak __typeof(self) weakSelf = self;
|
||||
|
||||
#if RCT_USE_HERMES
|
||||
return std::make_unique<facebook::react::HermesExecutorFactory>(
|
||||
#else
|
||||
return std::make_unique<facebook::react::JSCExecutorFactory>(
|
||||
#endif
|
||||
facebook::react::RCTJSIExecutorRuntimeInstaller([weakSelf, bridge, turboModuleManager](
|
||||
facebook::jsi::Runtime &runtime) {
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if RN_FABRIC_ENABLED
|
||||
__typeof(self) strongSelf = weakSelf;
|
||||
if (strongSelf && strongSelf->_runtimeScheduler) {
|
||||
facebook::react::RuntimeSchedulerBinding::createAndInstallIfNeeded(runtime, strongSelf->_runtimeScheduler);
|
||||
}
|
||||
#endif
|
||||
|
||||
facebook::react::RuntimeExecutor syncRuntimeExecutor =
|
||||
[&](std::function<void(facebook::jsi::Runtime & runtime_)> &&callback) { callback(runtime); };
|
||||
[turboModuleManager installJSBindingWithRuntimeExecutor:syncRuntimeExecutor];
|
||||
}));
|
||||
}
|
||||
|
||||
#pragma mark - RCTTurboModuleManagerDelegate
|
||||
|
||||
- (Class)getModuleClassFromName:(const char *)name
|
||||
{
|
||||
return facebook::react::RNTesterTurboModuleClassProvider(name);
|
||||
}
|
||||
|
||||
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
||||
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user