Update RCTFabric to generate headers in the `React` folder when using Frameworks
Summary: By leveraging the `PUBLIC_HEADERS_FOLDER_PATH` build settings of Xcode, we can instruct cocoapods to generate the frameworks Headers in a specific folder, for example the `React` folder. This allows us to maintain the `#include`/`#import` structure, even if the framework has a different name. However, we need to update the search paths to take into account this extra folder. ## Changelog: [iOS][Changed] - Generate RCTFabric framework's headers in the React folder Reviewed By: sammy-SC, dmytrorykun Differential Revision: D43425677 fbshipit-source-id: 94a4f3a3c7de86341b3ce3457704e6b8fb9a588e
This commit is contained in:
Родитель
5d175c6775
Коммит
e7becb06c1
|
@ -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
|
||||
|
|
|
@ -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|
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
// OSS-compatibility layer
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <RCTThirdPartyFabricComponentsProvider.h>
|
||||
#import <React/RCTThirdPartyFabricComponentsProvider.h>
|
||||
#import <React/RCTComponentViewProtocol.h>
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
|
|
|
@ -23,19 +23,19 @@
|
|||
#ifdef RN_DISABLE_OSS_PLUGIN_HEADER
|
||||
#import <RCTFabricComponentPlugin/RCTFabricPluginProvider.h>
|
||||
#else
|
||||
#import "RCTFabricComponentsPlugins.h"
|
||||
#import <React/RCTFabricComponentsPlugins.h>
|
||||
#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 <React/RCTComponentViewClassDescriptor.h>
|
||||
#import <React/RCTFabricComponentsPlugins.h>
|
||||
#import <React/RCTImageComponentView.h>
|
||||
#import <React/RCTLegacyViewManagerInteropComponentView.h>
|
||||
#import <React/RCTMountingTransactionObserving.h>
|
||||
#import <React/RCTParagraphComponentView.h>
|
||||
#import <React/RCTRootComponentView.h>
|
||||
#import <React/RCTTextInputComponentView.h>
|
||||
#import <React/RCTUnimplementedViewComponentView.h>
|
||||
#import <React/RCTViewComponentView.h>
|
||||
|
||||
#import <objc/runtime.h>
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
#import <React/RCTAssert.h>
|
||||
#import <React/RCTConstants.h>
|
||||
|
||||
#import "RCTImageComponentView.h"
|
||||
#import "RCTParagraphComponentView.h"
|
||||
#import "RCTViewComponentView.h"
|
||||
#import <React/RCTImageComponentView.h>
|
||||
#import <React/RCTParagraphComponentView.h>
|
||||
#import <React/RCTViewComponentView.h>
|
||||
|
||||
#import <butter/map.h>
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
#import <react/renderer/debug/SystraceSection.h>
|
||||
#import <react/renderer/mounting/TelemetryController.h>
|
||||
|
||||
#import "RCTComponentViewProtocol.h"
|
||||
#import "RCTComponentViewRegistry.h"
|
||||
#import "RCTConversions.h"
|
||||
#import "RCTMountingTransactionObserverCoordinator.h"
|
||||
#import <React/RCTComponentViewProtocol.h>
|
||||
#import <React/RCTComponentViewRegistry.h>
|
||||
#import <React/RCTConversions.h>
|
||||
#import <React/RCTMountingTransactionObserverCoordinator.h>
|
||||
|
||||
using namespace facebook::react;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -24,7 +24,7 @@ class CodegenTests < Test::Unit::TestCase
|
|||
|
||||
@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 @@ class CodegenTests < Test::Unit::TestCase
|
|||
|
||||
# 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 @@ class CodegenTests < Test::Unit::TestCase
|
|||
|
||||
# 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 @@ class CodegenTests < Test::Unit::TestCase
|
|||
|
||||
# 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 @@ class CodegenTests < Test::Unit::TestCase
|
|||
])
|
||||
|
||||
# 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 @@ class CodegenTests < Test::Unit::TestCase
|
|||
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 @@ class CodegenTests < Test::Unit::TestCase
|
|||
"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 @@ class CodegenTests < Test::Unit::TestCase
|
|||
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 @@ class CodegenTests < Test::Unit::TestCase
|
|||
"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
|
||||
|
|
|
@ -417,9 +417,10 @@ class CodegenUtilsTests < Test::Unit::TestCase
|
|||
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 @@ class CodegenUtilsTests < Test::Unit::TestCase
|
|||
"#{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 @@ class CodegenUtilsTests < Test::Unit::TestCase
|
|||
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': [],
|
||||
|
|
|
@ -159,7 +159,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)/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 @@ 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)/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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -95,10 +95,9 @@ class CodegenUtils
|
|||
"\"$(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 @@ class CodegenUtils
|
|||
"React-Core": [],
|
||||
"React-jsi": [],
|
||||
"ReactCommon/turbomodule/bridging": [],
|
||||
"ReactCommon/turbomodule/core": []
|
||||
"ReactCommon/turbomodule/core": [],
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,7 +338,7 @@ class CodegenUtils
|
|||
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 @@ class CodegenUtils
|
|||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -87,6 +87,7 @@ class NewArchitectureHelper
|
|||
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}"
|
||||
|
|
|
@ -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}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче