Skip to content

Commit 13d08f1

Browse files
cipolleschifacebook-github-bot
authored andcommitted
Remove RN_FABRIC_ENABLED flag (facebook#41561)
Summary: Pull Request resolved: facebook#41561 The RN_FABRIC_ENABLED has been deprecated and superseded by the RCT_NEW_ARCH_ENABLED for a while now. This change removes it, from the codebase as now we always have the Fabric pod available to the codebase. ## Changelog [Internal] - Remove RN_FABRIC_ENABLED flag Reviewed By: dmytrorykun Differential Revision: D51468332 fbshipit-source-id: 6b2fc554e6bf5ac748b9e45d7c14f9ba9b57820c
1 parent 0cbd2a3 commit 13d08f1

File tree

9 files changed

+5
-103
lines changed

9 files changed

+5
-103
lines changed

packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ use_hermes = ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == '1'
2424

2525
new_arch_enabled_flag = (is_new_arch_enabled ? " -DRCT_NEW_ARCH_ENABLED" : "")
2626
is_fabric_enabled = is_new_arch_enabled || ENV["RCT_FABRIC_ENABLED"]
27-
fabric_flag = (is_fabric_enabled ? " -DRN_FABRIC_ENABLED" : "")
2827
hermes_flag = (use_hermes ? " -DUSE_HERMES" : "")
29-
other_cflags = "$(inherited)" + folly_flags + new_arch_enabled_flag + fabric_flag + hermes_flag
28+
other_cflags = "$(inherited)" + folly_flags + new_arch_enabled_flag + hermes_flag
3029

3130
header_search_paths = [
3231
"$(PODS_TARGET_SRCROOT)/../../ReactCommon",

packages/react-native/React/React-RCTFabric.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Pod::Spec.new do |s|
5858
s.framework = ["JavaScriptCore", "MobileCoreServices"]
5959
s.pod_target_xcconfig = {
6060
"HEADER_SEARCH_PATHS" => header_search_paths,
61-
"OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" + " " + folly_flags,
61+
"OTHER_CFLAGS" => "$(inherited) " + folly_flags,
6262
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20"
6363
}.merge!(ENV['USE_FRAMEWORKS'] != nil ? {
6464
"PUBLIC_HEADERS_FOLDER_PATH" => "#{module_name}.framework/Headers/#{header_dir}"

packages/react-native/ReactCommon/jsc/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ target_link_libraries(jscruntime
3030
jsi
3131
glog)
3232

33-
# TODO: Remove this flag when ready.
34-
# Android has this enabled by default, but the flag is still needed for iOS.
35-
target_compile_options(jscruntime PRIVATE -DRN_FABRIC_ENABLED)
36-
3733
if(NOT ${CMAKE_BUILD_TYPE} MATCHES Debug)
3834
target_compile_options(jscruntime PRIVATE -DNDEBUG)
3935
endif()

packages/react-native/ReactCommon/jsc/JSCRuntime.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,7 @@ class JSCRuntime : public jsi::Runtime {
240240
static JSStringRef stringRef(const jsi::String& str);
241241
static JSStringRef stringRef(const jsi::PropNameID& sym);
242242
static JSObjectRef objectRef(const jsi::Object& obj);
243-
244-
#ifdef RN_FABRIC_ENABLED
245243
static JSObjectRef objectRef(const jsi::WeakObject& obj);
246-
#endif
247244

248245
// Factory methods for creating String/Object
249246
jsi::Symbol createSymbol(JSValueRef symbolRef) const;
@@ -1065,23 +1062,15 @@ jsi::Array JSCRuntime::getPropertyNames(const jsi::Object& obj) {
10651062
}
10661063

10671064
jsi::WeakObject JSCRuntime::createWeakObject(const jsi::Object& obj) {
1068-
#ifdef RN_FABRIC_ENABLED
10691065
// TODO: revisit this implementation
10701066
JSObjectRef objRef = objectRef(obj);
10711067
return make<jsi::WeakObject>(makeObjectValue(objRef));
1072-
#else
1073-
throw std::logic_error("Not implemented");
1074-
#endif
10751068
}
10761069

10771070
jsi::Value JSCRuntime::lockWeakObject(const jsi::WeakObject& obj) {
1078-
#ifdef RN_FABRIC_ENABLED
10791071
// TODO: revisit this implementation
10801072
JSObjectRef objRef = objectRef(obj);
10811073
return jsi::Value(createObject(objRef));
1082-
#else
1083-
throw std::logic_error("Not implemented");
1084-
#endif
10851074
}
10861075

10871076
jsi::Array JSCRuntime::createArray(size_t length) {
@@ -1527,12 +1516,10 @@ JSObjectRef JSCRuntime::objectRef(const jsi::Object& obj) {
15271516
return static_cast<const JSCObjectValue*>(getPointerValue(obj))->obj_;
15281517
}
15291518

1530-
#ifdef RN_FABRIC_ENABLED
15311519
JSObjectRef JSCRuntime::objectRef(const jsi::WeakObject& obj) {
15321520
// TODO: revisit this implementation
15331521
return static_cast<const JSCObjectValue*>(getPointerValue(obj))->obj_;
15341522
}
1535-
#endif
15361523

15371524
void JSCRuntime::checkException(JSValueRef exc) {
15381525
if (JSC_UNLIKELY(exc)) {

packages/react-native/ReactCommon/jsc/React-jsc.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ Pod::Spec.new do |s|
3232
s.dependency "React-jsi", version
3333

3434
s.subspec "Fabric" do |ss|
35-
ss.pod_target_xcconfig = { "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" }
35+
ss.pod_target_xcconfig = { "OTHER_CFLAGS" => "$(inherited)" }
3636
end
3737
end

packages/react-native/scripts/cocoapods/__tests__/utils-test.rb

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -790,68 +790,6 @@ def test_updateSearchPaths_whenNotUseFrameworks_addsSearchPaths
790790
end
791791
end
792792

793-
# ============================= #
794-
# Test - Apply Flags For Fabric #
795-
# ============================= #
796-
def test_applyFlagsForFabric_whenFabricEnabled_addsTheFlag
797-
# Arrange
798-
first_target = prepare_target("FirstTarget")
799-
second_target = prepare_target("SecondTarget")
800-
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
801-
user_project_mock = UserProjectMock.new("a/path", [
802-
prepare_config("Debug"),
803-
prepare_config("Release"),
804-
],
805-
:native_targets => [
806-
first_target,
807-
second_target
808-
]
809-
)
810-
pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}})
811-
installer = InstallerMock.new(pods_projects_mock, [
812-
AggregatedProjectMock.new(user_project_mock)
813-
])
814-
815-
# Act
816-
ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: true)
817-
818-
# Assert
819-
user_project_mock.build_configurations.each do |config|
820-
received_cflags = config.build_settings["OTHER_CFLAGS"]
821-
expected_cflags = "$(inherited) -DRN_FABRIC_ENABLED"
822-
assert_equal(received_cflags, expected_cflags)
823-
end
824-
825-
end
826-
827-
def test_applyFlagsForFabric_whenFabricDisabled_doNothing
828-
# Arrange
829-
first_target = prepare_target("FirstTarget")
830-
second_target = prepare_target("SecondTarget")
831-
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
832-
user_project_mock = UserProjectMock.new("/a/path", [
833-
prepare_config("Debug"),
834-
prepare_config("Release"),
835-
],
836-
:native_targets => [
837-
first_target,
838-
second_target
839-
]
840-
)
841-
pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}})
842-
installer = InstallerMock.new(pods_projects_mock, [
843-
AggregatedProjectMock.new(user_project_mock)
844-
])
845-
846-
# Act
847-
ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: false)
848-
849-
# Assert
850-
user_project_mock.build_configurations.each do |config|
851-
assert_equal(config.build_settings["OTHER_CFLAGS"], "$(inherited)")
852-
end
853-
end
854-
855793
# ============================== #
856794
# Test - Apply ATS configuration #
857795
# ============================== #

packages/react-native/scripts/cocoapods/utils.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,6 @@ def self.apply_xcode_15_patch(installer, xcodebuild_manager: Xcodebuild)
147147

148148
end
149149

150-
def self.apply_flags_for_fabric(installer, fabric_enabled: false)
151-
fabric_flag = "-DRN_FABRIC_ENABLED"
152-
if fabric_enabled
153-
self.add_compiler_flag_to_project(installer, fabric_flag)
154-
else
155-
self.remove_compiler_flag_from_project(installer, fabric_flag)
156-
end
157-
end
158-
159150
private
160151

161152
def self.add_build_settings_to_pod(installer, settings_name, settings_value, target_pod_name, configuration)

packages/react-native/scripts/react_native_pods.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ def react_native_post_install(
281281
ReactNativePodsUtils.update_search_paths(installer)
282282
ReactNativePodsUtils.set_use_hermes_build_setting(installer, hermes_enabled)
283283
ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path)
284-
ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: fabric_enabled)
285284
ReactNativePodsUtils.apply_xcode_15_patch(installer)
286285
ReactNativePodsUtils.apply_ats_config(installer)
287286
ReactNativePodsUtils.updateOSDeploymentTarget(installer)

packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -933,18 +933,14 @@
933933
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
934934
MTL_ENABLE_DEBUG_INFO = YES;
935935
ONLY_ACTIVE_ARCH = YES;
936-
OTHER_CFLAGS = (
937-
"$(inherited)",
938-
"-DRN_FABRIC_ENABLED",
939-
);
936+
OTHER_CFLAGS = "$(inherited)";
940937
OTHER_CPLUSPLUSFLAGS = (
941938
"$(OTHER_CFLAGS)",
942939
"-DFOLLY_NO_CONFIG",
943940
"-DFOLLY_MOBILE=1",
944941
"-DFOLLY_USE_LIBCPP=1",
945942
"-DFOLLY_CFG_NO_COROUTINES=1",
946943
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
947-
"-DRN_FABRIC_ENABLED",
948944
);
949945
OTHER_LDFLAGS = (
950946
"-ObjC",
@@ -1029,18 +1025,14 @@
10291025
);
10301026
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
10311027
MTL_ENABLE_DEBUG_INFO = NO;
1032-
OTHER_CFLAGS = (
1033-
"$(inherited)",
1034-
"-DRN_FABRIC_ENABLED",
1035-
);
1028+
OTHER_CFLAGS = "$(inherited)";
10361029
OTHER_CPLUSPLUSFLAGS = (
10371030
"$(OTHER_CFLAGS)",
10381031
"-DFOLLY_NO_CONFIG",
10391032
"-DFOLLY_MOBILE=1",
10401033
"-DFOLLY_USE_LIBCPP=1",
10411034
"-DFOLLY_CFG_NO_COROUTINES=1",
10421035
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
1043-
"-DRN_FABRIC_ENABLED",
10441036
);
10451037
OTHER_LDFLAGS = (
10461038
"-ObjC",

0 commit comments

Comments
 (0)