diff --git a/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec b/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec index 815c03705ed..d542966ee1a 100644 --- a/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec +++ b/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec @@ -24,9 +24,8 @@ use_hermes = ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == '1' new_arch_enabled_flag = (is_new_arch_enabled ? " -DRCT_NEW_ARCH_ENABLED" : "") is_fabric_enabled = is_new_arch_enabled || ENV["RCT_FABRIC_ENABLED"] -fabric_flag = (is_fabric_enabled ? " -DRN_FABRIC_ENABLED" : "") hermes_flag = (use_hermes ? " -DUSE_HERMES" : "") -other_cflags = "$(inherited)" + folly_flags + new_arch_enabled_flag + fabric_flag + hermes_flag +other_cflags = "$(inherited)" + folly_flags + new_arch_enabled_flag + hermes_flag header_search_paths = [ "$(PODS_TARGET_SRCROOT)/../../ReactCommon", diff --git a/packages/react-native/React/React-RCTFabric.podspec b/packages/react-native/React/React-RCTFabric.podspec index 5c2f3c62fd8..e6dbb8cb3d4 100644 --- a/packages/react-native/React/React-RCTFabric.podspec +++ b/packages/react-native/React/React-RCTFabric.podspec @@ -58,7 +58,7 @@ Pod::Spec.new do |s| s.framework = ["JavaScriptCore", "MobileCoreServices"] s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => header_search_paths, - "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" + " " + folly_flags, + "OTHER_CFLAGS" => "$(inherited) " + folly_flags, "CLANG_CXX_LANGUAGE_STANDARD" => "c++20" }.merge!(ENV['USE_FRAMEWORKS'] != nil ? { "PUBLIC_HEADERS_FOLDER_PATH" => "#{module_name}.framework/Headers/#{header_dir}" diff --git a/packages/react-native/ReactCommon/jsc/CMakeLists.txt b/packages/react-native/ReactCommon/jsc/CMakeLists.txt index c5c17fb4048..d71b289679b 100644 --- a/packages/react-native/ReactCommon/jsc/CMakeLists.txt +++ b/packages/react-native/ReactCommon/jsc/CMakeLists.txt @@ -30,10 +30,6 @@ target_link_libraries(jscruntime jsi glog) -# TODO: Remove this flag when ready. -# Android has this enabled by default, but the flag is still needed for iOS. -target_compile_options(jscruntime PRIVATE -DRN_FABRIC_ENABLED) - if(NOT ${CMAKE_BUILD_TYPE} MATCHES Debug) target_compile_options(jscruntime PRIVATE -DNDEBUG) endif() diff --git a/packages/react-native/ReactCommon/jsc/JSCRuntime.cpp b/packages/react-native/ReactCommon/jsc/JSCRuntime.cpp index 34f43c0c08e..40633656596 100644 --- a/packages/react-native/ReactCommon/jsc/JSCRuntime.cpp +++ b/packages/react-native/ReactCommon/jsc/JSCRuntime.cpp @@ -240,10 +240,7 @@ class JSCRuntime : public jsi::Runtime { static JSStringRef stringRef(const jsi::String& str); static JSStringRef stringRef(const jsi::PropNameID& sym); static JSObjectRef objectRef(const jsi::Object& obj); - -#ifdef RN_FABRIC_ENABLED static JSObjectRef objectRef(const jsi::WeakObject& obj); -#endif // Factory methods for creating String/Object jsi::Symbol createSymbol(JSValueRef symbolRef) const; @@ -1065,23 +1062,15 @@ jsi::Array JSCRuntime::getPropertyNames(const jsi::Object& obj) { } jsi::WeakObject JSCRuntime::createWeakObject(const jsi::Object& obj) { -#ifdef RN_FABRIC_ENABLED // TODO: revisit this implementation JSObjectRef objRef = objectRef(obj); return make(makeObjectValue(objRef)); -#else - throw std::logic_error("Not implemented"); -#endif } jsi::Value JSCRuntime::lockWeakObject(const jsi::WeakObject& obj) { -#ifdef RN_FABRIC_ENABLED // TODO: revisit this implementation JSObjectRef objRef = objectRef(obj); return jsi::Value(createObject(objRef)); -#else - throw std::logic_error("Not implemented"); -#endif } jsi::Array JSCRuntime::createArray(size_t length) { @@ -1527,12 +1516,10 @@ JSObjectRef JSCRuntime::objectRef(const jsi::Object& obj) { return static_cast(getPointerValue(obj))->obj_; } -#ifdef RN_FABRIC_ENABLED JSObjectRef JSCRuntime::objectRef(const jsi::WeakObject& obj) { // TODO: revisit this implementation return static_cast(getPointerValue(obj))->obj_; } -#endif void JSCRuntime::checkException(JSValueRef exc) { if (JSC_UNLIKELY(exc)) { diff --git a/packages/react-native/ReactCommon/jsc/React-jsc.podspec b/packages/react-native/ReactCommon/jsc/React-jsc.podspec index ee9cf096e7a..6239621c6a8 100644 --- a/packages/react-native/ReactCommon/jsc/React-jsc.podspec +++ b/packages/react-native/ReactCommon/jsc/React-jsc.podspec @@ -32,6 +32,6 @@ Pod::Spec.new do |s| s.dependency "React-jsi", version s.subspec "Fabric" do |ss| - ss.pod_target_xcconfig = { "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" } + ss.pod_target_xcconfig = { "OTHER_CFLAGS" => "$(inherited)" } end end diff --git a/packages/react-native/scripts/cocoapods/__tests__/utils-test.rb b/packages/react-native/scripts/cocoapods/__tests__/utils-test.rb index 2acd46732ea..cf9988492da 100644 --- a/packages/react-native/scripts/cocoapods/__tests__/utils-test.rb +++ b/packages/react-native/scripts/cocoapods/__tests__/utils-test.rb @@ -790,68 +790,6 @@ class UtilsTests < Test::Unit::TestCase end end - # ============================= # - # Test - Apply Flags For Fabric # - # ============================= # - def test_applyFlagsForFabric_whenFabricEnabled_addsTheFlag - # Arrange - first_target = prepare_target("FirstTarget") - second_target = prepare_target("SecondTarget") - third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle") - user_project_mock = UserProjectMock.new("a/path", [ - prepare_config("Debug"), - prepare_config("Release"), - ], - :native_targets => [ - first_target, - second_target - ] - ) - pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}}) - installer = InstallerMock.new(pods_projects_mock, [ - AggregatedProjectMock.new(user_project_mock) - ]) - - # Act - ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: true) - - # Assert - user_project_mock.build_configurations.each do |config| - received_cflags = config.build_settings["OTHER_CFLAGS"] - expected_cflags = "$(inherited) -DRN_FABRIC_ENABLED" - assert_equal(received_cflags, expected_cflags) - end - - end - - def test_applyFlagsForFabric_whenFabricDisabled_doNothing - # Arrange - first_target = prepare_target("FirstTarget") - second_target = prepare_target("SecondTarget") - third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle") - user_project_mock = UserProjectMock.new("/a/path", [ - prepare_config("Debug"), - prepare_config("Release"), - ], - :native_targets => [ - first_target, - second_target - ] - ) - pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}}) - installer = InstallerMock.new(pods_projects_mock, [ - AggregatedProjectMock.new(user_project_mock) - ]) - - # Act - ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: false) - - # Assert - user_project_mock.build_configurations.each do |config| - assert_equal(config.build_settings["OTHER_CFLAGS"], "$(inherited)") - end - end - # ============================== # # Test - Apply ATS configuration # # ============================== # diff --git a/packages/react-native/scripts/cocoapods/utils.rb b/packages/react-native/scripts/cocoapods/utils.rb index eb89a3de200..11cb59a62c5 100644 --- a/packages/react-native/scripts/cocoapods/utils.rb +++ b/packages/react-native/scripts/cocoapods/utils.rb @@ -147,15 +147,6 @@ class ReactNativePodsUtils end - def self.apply_flags_for_fabric(installer, fabric_enabled: false) - fabric_flag = "-DRN_FABRIC_ENABLED" - if fabric_enabled - self.add_compiler_flag_to_project(installer, fabric_flag) - else - self.remove_compiler_flag_from_project(installer, fabric_flag) - end - end - private def self.add_build_settings_to_pod(installer, settings_name, settings_value, target_pod_name, configuration) diff --git a/packages/react-native/scripts/react_native_pods.rb b/packages/react-native/scripts/react_native_pods.rb index 93d9b6536e3..472a563badd 100644 --- a/packages/react-native/scripts/react_native_pods.rb +++ b/packages/react-native/scripts/react_native_pods.rb @@ -281,7 +281,6 @@ def react_native_post_install( ReactNativePodsUtils.update_search_paths(installer) ReactNativePodsUtils.set_use_hermes_build_setting(installer, hermes_enabled) ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path) - ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: fabric_enabled) ReactNativePodsUtils.apply_xcode_15_patch(installer) ReactNativePodsUtils.apply_ats_config(installer) ReactNativePodsUtils.updateOSDeploymentTarget(installer) diff --git a/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj b/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj index ff0cf5e629d..848876452f4 100644 --- a/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj +++ b/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj @@ -933,10 +933,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.4; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - OTHER_CFLAGS = ( - "$(inherited)", - "-DRN_FABRIC_ENABLED", - ); + OTHER_CFLAGS = "$(inherited)"; OTHER_CPLUSPLUSFLAGS = ( "$(OTHER_CFLAGS)", "-DFOLLY_NO_CONFIG", @@ -944,7 +941,6 @@ "-DFOLLY_USE_LIBCPP=1", "-DFOLLY_CFG_NO_COROUTINES=1", "-DFOLLY_HAVE_CLOCK_GETTIME=1", - "-DRN_FABRIC_ENABLED", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1029,10 +1025,7 @@ ); IPHONEOS_DEPLOYMENT_TARGET = 13.4; MTL_ENABLE_DEBUG_INFO = NO; - OTHER_CFLAGS = ( - "$(inherited)", - "-DRN_FABRIC_ENABLED", - ); + OTHER_CFLAGS = "$(inherited)"; OTHER_CPLUSPLUSFLAGS = ( "$(OTHER_CFLAGS)", "-DFOLLY_NO_CONFIG", @@ -1040,7 +1033,6 @@ "-DFOLLY_USE_LIBCPP=1", "-DFOLLY_CFG_NO_COROUTINES=1", "-DFOLLY_HAVE_CLOCK_GETTIME=1", - "-DRN_FABRIC_ENABLED", ); OTHER_LDFLAGS = ( "-ObjC",