diff --git a/.gitignore b/.gitignore index bab54701df6ae2..4db4e83235ccae 100644 --- a/.gitignore +++ b/.gitignore @@ -123,6 +123,7 @@ package-lock.json /packages/react-native-codegen/tmp/ /ReactCommon/react/renderer/components/rncore/ /packages/rn-tester/NativeModuleExample/ScreenshotManagerSpec* +/**/RCTThirdPartyFabricComponentsProvider.* # Additional SDKs diff --git a/Libraries/AppDelegate/React-RCTAppDelegate.podspec b/Libraries/AppDelegate/React-RCTAppDelegate.podspec index 763ae2d9874306..ccc57afe0688d0 100644 --- a/Libraries/AppDelegate/React-RCTAppDelegate.podspec +++ b/Libraries/AppDelegate/React-RCTAppDelegate.podspec @@ -43,7 +43,8 @@ header_search_paths = [ "$(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/react/nativemodule/core", - "$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core/platform/ios" + "$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core/platform/ios", + "$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers/", ] : []).map{|p| "\"#{p}\""}.join(" ") Pod::Spec.new do |s| diff --git a/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h b/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h index 1a4bdaa25e3d65..6ce762210f0e99 100644 --- a/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h +++ b/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h @@ -17,7 +17,7 @@ // OSS-compatibility layer #import -#import +#import #import #pragma GCC diagnostic push diff --git a/React/Fabric/Mounting/RCTComponentViewFactory.mm b/React/Fabric/Mounting/RCTComponentViewFactory.mm index f174ba1dfe3a90..0fe7f13d286722 100644 --- a/React/Fabric/Mounting/RCTComponentViewFactory.mm +++ b/React/Fabric/Mounting/RCTComponentViewFactory.mm @@ -23,19 +23,19 @@ #ifdef RN_DISABLE_OSS_PLUGIN_HEADER #import #else -#import "RCTFabricComponentsPlugins.h" +#import #endif -#import "RCTComponentViewClassDescriptor.h" -#import "RCTFabricComponentsPlugins.h" -#import "RCTImageComponentView.h" -#import "RCTLegacyViewManagerInteropComponentView.h" -#import "RCTMountingTransactionObserving.h" -#import "RCTParagraphComponentView.h" -#import "RCTRootComponentView.h" -#import "RCTTextInputComponentView.h" -#import "RCTUnimplementedViewComponentView.h" -#import "RCTViewComponentView.h" +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import #import diff --git a/React/Fabric/Mounting/RCTComponentViewRegistry.mm b/React/Fabric/Mounting/RCTComponentViewRegistry.mm index 63bd88e0f763de..624ffec0d5d35e 100644 --- a/React/Fabric/Mounting/RCTComponentViewRegistry.mm +++ b/React/Fabric/Mounting/RCTComponentViewRegistry.mm @@ -11,9 +11,9 @@ #import #import -#import "RCTImageComponentView.h" -#import "RCTParagraphComponentView.h" -#import "RCTViewComponentView.h" +#import +#import +#import #import diff --git a/React/Fabric/Mounting/RCTMountingManager.mm b/React/Fabric/Mounting/RCTMountingManager.mm index ec5b9152c39ff1..086849f2be4951 100644 --- a/React/Fabric/Mounting/RCTMountingManager.mm +++ b/React/Fabric/Mounting/RCTMountingManager.mm @@ -22,10 +22,10 @@ #import #import -#import "RCTComponentViewProtocol.h" -#import "RCTComponentViewRegistry.h" -#import "RCTConversions.h" -#import "RCTMountingTransactionObserverCoordinator.h" +#import +#import +#import +#import using namespace facebook::react; diff --git a/React/React-RCTFabric.podspec b/React/React-RCTFabric.podspec index fbd3e6b04ac100..0f9484b00b7841 100644 --- a/React/React-RCTFabric.podspec +++ b/React/React-RCTFabric.podspec @@ -40,6 +40,7 @@ if ENV['USE_FRAMEWORKS'] header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\"" 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\"" end Pod::Spec.new do |s| @@ -62,7 +63,9 @@ Pod::Spec.new do |s| "HEADER_SEARCH_PATHS" => header_search_paths, "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" + " " + folly_flags, "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" - } + }.merge!(ENV['USE_FRAMEWORKS'] != nil ? { + "PUBLIC_HEADERS_FOLDER_PATH" => "$(CONTENTS_FOLDER_PATH)/Headers/React" + }: {}) s.dependency "React-Core", version s.dependency "React-Fabric", version diff --git a/scripts/cocoapods/__tests__/codegen-test.rb b/scripts/cocoapods/__tests__/codegen-test.rb index bcd475e0a9eecd..2141638f2eae99 100644 --- a/scripts/cocoapods/__tests__/codegen-test.rb +++ b/scripts/cocoapods/__tests__/codegen-test.rb @@ -24,7 +24,7 @@ def setup @prefix = "../.." @third_party_provider_header = "RCTThirdPartyFabricComponentsProvider.h" - @third_party_provider_implementation = "RCTThirdPartyFabricComponentsProvider.cpp" + @third_party_provider_implementation = "RCTThirdPartyFabricComponentsProvider.mm" @base_path = "~/app/ios" @tmp_schema_list_file = "tmpSchemaList.txt" Pathname.pwd!(@base_path) @@ -47,19 +47,19 @@ def testCheckAndGenerateEmptyThirdPartyProvider_whenFileAlreadyExists_doNothing( # Arrange FileMock.mocked_existing_files([ - @base_path + "/build/" + @third_party_provider_header, - @base_path + "/build/" + @third_party_provider_implementation, + @prefix + "/React/Fabric/" + @third_party_provider_header, + @prefix + "/React/Fabric/" + @third_party_provider_implementation, ]) # Act - checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, 'build', dir_manager: DirMock, file_manager: FileMock) + checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, dir_manager: DirMock, file_manager: FileMock) # Assert assert_equal(Pathname.pwd_invocation_count, 1) assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1) assert_equal(FileMock.exist_invocation_params, [ - @base_path + "/build/" + @third_party_provider_header, - @base_path + "/build/" + @third_party_provider_implementation, + @prefix + "/React/Fabric/" + @third_party_provider_header, + @prefix + "/React/Fabric/" + @third_party_provider_implementation, ]) assert_equal(DirMock.exist_invocation_params, []) assert_equal(Pod::UI.collected_messages, []) @@ -77,14 +77,14 @@ def testCheckAndGenerateEmptyThirdPartyProvider_whenHeaderMissingAndCodegenMissi # Act assert_raise { - checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, 'build', dir_manager: DirMock, file_manager: FileMock) + checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, dir_manager: DirMock, file_manager: FileMock) } # Assert assert_equal(Pathname.pwd_invocation_count, 1) assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1) assert_equal(FileMock.exist_invocation_params, [ - @base_path + "/build/" + @third_party_provider_header + @prefix + "/React/Fabric/" + @third_party_provider_header ]) assert_equal(DirMock.exist_invocation_params, [ @base_path + "/"+ @prefix + "/packages/react-native-codegen", @@ -100,8 +100,8 @@ def testCheckAndGenerateEmptyThirdPartyProvider_whenImplementationMissingAndCode # Arrange FileMock.mocked_existing_files([ - @base_path + "/build/" + @third_party_provider_header, - @base_path + "/build/tmpSchemaList.txt" + @prefix + "/React/Fabric/" + @third_party_provider_header, + @prefix + "/React/Fabric/tmpSchemaList.txt" ]) DirMock.mocked_existing_dirs([ @@ -110,15 +110,15 @@ def testCheckAndGenerateEmptyThirdPartyProvider_whenImplementationMissingAndCode ]) # Act - checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, 'build', dir_manager: DirMock, file_manager: FileMock) + checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, dir_manager: DirMock, file_manager: FileMock) # Assert assert_equal(Pathname.pwd_invocation_count, 1) assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1) assert_equal(FileMock.exist_invocation_params, [ - @base_path + "/build/" + @third_party_provider_header, - @base_path + "/build/" + @third_party_provider_implementation, - @base_path + "/build/tmpSchemaList.txt", + @prefix + "/React/Fabric/" + @third_party_provider_header, + @prefix + "/React/Fabric/" + @third_party_provider_implementation, + @prefix + "/React/Fabric/tmpSchemaList.txt", ]) assert_equal(DirMock.exist_invocation_params, [ @base_path + "/"+ @prefix + "/packages/react-native-codegen", @@ -127,7 +127,7 @@ def testCheckAndGenerateEmptyThirdPartyProvider_whenImplementationMissingAndCode assert_equal(Pod::UI.collected_messages, ["[Codegen] generating an empty RCTThirdPartyFabricComponentsProvider"]) assert_equal($collected_commands, []) assert_equal(FileMock.open_invocation_count, 1) - assert_equal(FileMock.open_files_with_mode[@base_path + "/build/tmpSchemaList.txt"], 'w') + assert_equal(FileMock.open_files_with_mode[@prefix + "/React/Fabric/tmpSchemaList.txt"], 'w') assert_equal(FileMock.open_files[0].collected_write, ["[]"]) assert_equal(FileMock.open_files[0].fsync_invocation_count, 1) assert_equal(Pod::Executable.executed_commands[0], { @@ -135,12 +135,12 @@ def testCheckAndGenerateEmptyThirdPartyProvider_whenImplementationMissingAndCode "arguments" => [ @base_path + "/" + @prefix + "/scripts/generate-provider-cli.js", "--platform", 'ios', - "--schemaListPath", @base_path + "/build/tmpSchemaList.txt", - "--outputDir", @base_path + "/build" + "--schemaListPath", @prefix + "/React/Fabric/tmpSchemaList.txt", + "--outputDir", @prefix + "/React/Fabric" ] }) assert_equal(FileMock.delete_invocation_count, 1) - assert_equal(FileMock.deleted_files, [@base_path + "/build/tmpSchemaList.txt"]) + assert_equal(FileMock.deleted_files, [ @prefix + "/React/Fabric/tmpSchemaList.txt"]) end def testCheckAndGenerateEmptyThirdPartyProvider_whenBothMissing_buildCodegen() @@ -150,14 +150,14 @@ def testCheckAndGenerateEmptyThirdPartyProvider_whenBothMissing_buildCodegen() codegen_cli_path, ]) # Act - checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, 'build', dir_manager: DirMock, file_manager: FileMock) + checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, dir_manager: DirMock, file_manager: FileMock) # Assert assert_equal(Pathname.pwd_invocation_count, 1) assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1) assert_equal(FileMock.exist_invocation_params, [ - @base_path + "/build/" + @third_party_provider_header, - @base_path + "/build/" + @tmp_schema_list_file + @prefix + "/React/Fabric/" + @third_party_provider_header, + @prefix + "/React/Fabric/" + @tmp_schema_list_file ]) assert_equal(DirMock.exist_invocation_params, [ @base_path + "/" + @prefix + "/packages/react-native-codegen", @@ -176,8 +176,8 @@ def testCheckAndGenerateEmptyThirdPartyProvider_whenBothMissing_buildCodegen() "arguments" => [ @base_path + "/" + @prefix + "/scripts/generate-provider-cli.js", "--platform", 'ios', - "--schemaListPath", @base_path + "/build/" + @tmp_schema_list_file, - "--outputDir", @base_path + "/build" + "--schemaListPath", @prefix + "/React/Fabric/" + @tmp_schema_list_file, + "--outputDir", @prefix + "/React/Fabric" ] }) end diff --git a/scripts/cocoapods/__tests__/codegen_utils-test.rb b/scripts/cocoapods/__tests__/codegen_utils-test.rb index 4e1ea5a49dd095..147d7a8f259aa3 100644 --- a/scripts/cocoapods/__tests__/codegen_utils-test.rb +++ b/scripts/cocoapods/__tests__/codegen_utils-test.rb @@ -417,9 +417,10 @@ def testCleanUpCodegenFolder_whenFolderDoesNotExists_markAsCleanupDone CodegenUtils.set_cleanup_done(false) codegen_dir = "build/generated/ios" ios_folder = '.' + rn_path = '../node_modules/react-native' # Act - CodegenUtils.clean_up_build_folder(@base_path, ios_folder, codegen_dir, dir_manager: DirMock, file_manager: FileMock) + CodegenUtils.clean_up_build_folder(rn_path, @base_path, ios_folder, codegen_dir, dir_manager: DirMock, file_manager: FileMock) # Assert assert_equal(FileUtils::FileUtilsStorage.rmrf_invocation_count, 0) @@ -440,17 +441,23 @@ def testCleanUpCodegenFolder_whenFolderExists_deleteItAndSetCleanupDone "#{codegen_path}/react/components/MyComponent/ShadowNode.h", "#{codegen_path}/react/components/MyComponent/ShadowNode.mm", ] + rn_path = '../node_modules/react-native' + DirMock.mocked_existing_dirs(codegen_path) DirMock.mocked_existing_globs(globs, "#{codegen_path}/*") # Act - CodegenUtils.clean_up_build_folder(@base_path, ios_folder, codegen_dir, dir_manager: DirMock, file_manager: FileMock) + CodegenUtils.clean_up_build_folder(rn_path, @base_path, ios_folder, codegen_dir, dir_manager: DirMock, file_manager: FileMock) # Assert assert_equal(DirMock.exist_invocation_params, [codegen_path, codegen_path]) assert_equal(DirMock.glob_invocation, ["#{codegen_path}/*", "#{codegen_path}/*"]) - assert_equal(FileUtils::FileUtilsStorage.rmrf_invocation_count, 1) - assert_equal(FileUtils::FileUtilsStorage.rmrf_paths, [globs]) + assert_equal(FileUtils::FileUtilsStorage.rmrf_invocation_count, 3) + assert_equal(FileUtils::FileUtilsStorage.rmrf_paths, [ + globs, + "#{rn_path}/React/Fabric/RCTThirdPartyFabricComponentsProvider.h", + "#{rn_path}/React/Fabric/RCTThirdPartyFabricComponentsProvider.mm", + ]) assert_equal(CodegenUtils.cleanup_done(), true) end @@ -566,8 +573,8 @@ def get_podspec_fabric_and_script_phases(script_phases) def get_podspec_when_use_frameworks specs = get_podspec_no_fabric_no_script() - specs["pod_target_xcconfig"]["FRAMEWORK_SEARCH_PATHS"].concat(["\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric\""]) - 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-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)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core/platform/ios\"") + 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-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)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core/platform/ios\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers\"") specs[:dependencies].merge!({ 'React-graphics': [], diff --git a/scripts/cocoapods/__tests__/new_architecture-test.rb b/scripts/cocoapods/__tests__/new_architecture-test.rb index f716703913536b..b9fef9c43d8bb3 100644 --- a/scripts/cocoapods/__tests__/new_architecture-test.rb +++ b/scripts/cocoapods/__tests__/new_architecture-test.rb @@ -159,7 +159,7 @@ def test_installModulesDependencies_whenNewArchEnabledAndNewArchAndNoSearchPaths # Assert assert_equal(spec.compiler_flags, NewArchitectureHelper.folly_compiler_flags) - assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\" \"$(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}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"") + assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\" \"$(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}/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( @@ -190,7 +190,7 @@ def test_installModulesDependencies_whenNewArchDisabledAndSearchPathsAndCompiler # 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)/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}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"") + assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "#{other_flags} \"$(PODS_ROOT)/boost\" \"$(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}/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, diff --git a/scripts/cocoapods/codegen.rb b/scripts/cocoapods/codegen.rb index 1cbcb0c7ecd15b..51b69c9ca17d22 100644 --- a/scripts/cocoapods/codegen.rb +++ b/scripts/cocoapods/codegen.rb @@ -34,18 +34,17 @@ def build_codegen!(react_native_path, relative_installation_root, dir_manager: D # Parameters: # - react_native_path: path to the react native framework # - new_arch_enabled: whether the New Architecture is enabled or not -# - codegen_output_dir: the output directory for the codegen # - dir_manager: a class that implements the `Dir` interface. Defaults to `Dir`, the Dependency can be injected for testing purposes. # - file_manager: a class that implements the `File` interface. Defaults to `File`, the Dependency can be injected for testing purposes. -def checkAndGenerateEmptyThirdPartyProvider!(react_native_path, new_arch_enabled, codegen_output_dir, dir_manager: Dir, file_manager: File) +def checkAndGenerateEmptyThirdPartyProvider!(react_native_path, new_arch_enabled, dir_manager: Dir, file_manager: File) return if new_arch_enabled relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd) - output_dir = "#{relative_installation_root}/#{codegen_output_dir}" + output_dir = "#{react_native_path}/React/Fabric" provider_h_path = "#{output_dir}/RCTThirdPartyFabricComponentsProvider.h" - provider_cpp_path ="#{output_dir}/RCTThirdPartyFabricComponentsProvider.cpp" + provider_cpp_path ="#{output_dir}/RCTThirdPartyFabricComponentsProvider.mm" if(!file_manager.exist?(provider_h_path) || !file_manager.exist?(provider_cpp_path)) # build codegen diff --git a/scripts/cocoapods/codegen_utils.rb b/scripts/cocoapods/codegen_utils.rb index 50362f260bf8d8..658c97104c7d8f 100644 --- a/scripts/cocoapods/codegen_utils.rb +++ b/scripts/cocoapods/codegen_utils.rb @@ -95,10 +95,9 @@ def get_react_codegen_spec(package_json_file, folly_version: '2021.07.22.00', fa "\"$(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)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core/platform/ios\"" + "\"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core/platform/ios\"", + "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers\"", ]) - - framework_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric\"" end spec = { @@ -127,7 +126,7 @@ def get_react_codegen_spec(package_json_file, folly_version: '2021.07.22.00', fa "React-Core": [], "React-jsi": [], "ReactCommon/turbomodule/bridging": [], - "ReactCommon/turbomodule/core": [] + "ReactCommon/turbomodule/core": [], } } @@ -339,7 +338,7 @@ def self.cleanup_done return @@CLEANUP_DONE end - def self.clean_up_build_folder(app_path, ios_folder, codegen_dir, dir_manager: Dir, file_manager: File) + def self.clean_up_build_folder(rn_path, app_path, ios_folder, codegen_dir, dir_manager: Dir, file_manager: File) return if CodegenUtils.cleanup_done() CodegenUtils.set_cleanup_done(true) @@ -347,6 +346,9 @@ def self.clean_up_build_folder(app_path, ios_folder, codegen_dir, dir_manager: D return if !dir_manager.exist?(codegen_path) FileUtils.rm_rf(dir_manager.glob("#{codegen_path}/*")) + base_provider_path = file_manager.join(rn_path, 'React', 'Fabric', 'RCTThirdPartyFabricComponentsProvider') + FileUtils.rm_rf("#{base_provider_path}.h") + FileUtils.rm_rf("#{base_provider_path}.mm") CodegenUtils.assert_codegen_folder_is_empty(app_path, ios_folder, codegen_dir, dir_manager: dir_manager, file_manager: file_manager) end diff --git a/scripts/cocoapods/fabric.rb b/scripts/cocoapods/fabric.rb index 4f18ac3f478a73..1bd3cb2fb9db9b 100644 --- a/scripts/cocoapods/fabric.rb +++ b/scripts/cocoapods/fabric.rb @@ -13,6 +13,4 @@ def setup_fabric!(react_native_path: "../node_modules/react-native", new_arch_en pod 'React-RCTFabric', :path => "#{react_native_path}/React", :modular_headers => true pod 'React-ImageManager', :path => "#{react_native_path}/ReactCommon/react/renderer/imagemanager/platform/ios" pod 'RCT-Folly/Fabric', :podspec => "#{react_native_path}/third-party-podspecs/RCT-Folly.podspec" - - pod 'React-rncore', :path => "#{react_native_path}/ReactCommon" if !new_arch_enabled end diff --git a/scripts/cocoapods/new_architecture.rb b/scripts/cocoapods/new_architecture.rb index 7c6d62550b48a4..8cadc93b21d79e 100644 --- a/scripts/cocoapods/new_architecture.rb +++ b/scripts/cocoapods/new_architecture.rb @@ -87,6 +87,7 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version) header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\"" 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\"" end header_search_paths_string = header_search_paths.join(" ") spec.compiler_flags = compiler_flags.empty? ? @@folly_compiler_flags : "#{compiler_flags} #{@@folly_compiler_flags}" diff --git a/scripts/codegen/generate-artifacts-executor.js b/scripts/codegen/generate-artifacts-executor.js index 5fa441f9f142b9..b006c5e597c244 100644 --- a/scripts/codegen/generate-artifacts-executor.js +++ b/scripts/codegen/generate-artifacts-executor.js @@ -401,6 +401,8 @@ function createComponentProvider( fs.closeSync(fd); console.log(`Generated schema list: ${schemaListTmpPath}`); + const outputDir = path.join(RN_ROOT, 'React', 'Fabric'); + // Generate FabricComponentProvider. // Only for iOS at this moment. executeNodeScript( @@ -409,9 +411,9 @@ function createComponentProvider( RN_ROOT, 'scripts', 'generate-provider-cli.js', - )} --platform ios --schemaListPath "${schemaListTmpPath}" --outputDir ${iosOutputDir}`, + )} --platform ios --schemaListPath "${schemaListTmpPath}" --outputDir ${outputDir}`, ); - console.log(`Generated provider in: ${iosOutputDir}`); + console.log(`Generated provider in: ${outputDir}`); } } diff --git a/scripts/react_native_pods.rb b/scripts/react_native_pods.rb index 7baabeacf65237..7b66c7823d23ca 100644 --- a/scripts/react_native_pods.rb +++ b/scripts/react_native_pods.rb @@ -68,7 +68,7 @@ def use_react_native! ( # that has invoked the `use_react_native!` function. ReactNativePodsUtils.detect_use_frameworks(current_target_definition) - CodegenUtils.clean_up_build_folder(app_path, ios_folder, $CODEGEN_OUTPUT_DIR) + CodegenUtils.clean_up_build_folder(path, app_path, ios_folder, $CODEGEN_OUTPUT_DIR) # We are relying on this flag also in third parties libraries to proper install dependencies. # Better to rely and enable this environment flag if the new architecture is turned on using flags. @@ -139,7 +139,7 @@ def use_react_native! ( pod 'React-Codegen', :path => $CODEGEN_OUTPUT_DIR, :modular_headers => true if fabric_enabled - checkAndGenerateEmptyThirdPartyProvider!(prefix, new_arch_enabled, $CODEGEN_OUTPUT_DIR) + checkAndGenerateEmptyThirdPartyProvider!(prefix, new_arch_enabled) setup_fabric!(:react_native_path => prefix, new_arch_enabled: new_arch_enabled) else relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)